|
1 /* |
|
2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: This is the implementation of the CAudioOutput class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include <mmf/server/sounddevice.h> |
|
23 #include "AudioOutputProxy.h" |
|
24 #include "AudioOutputMessageTypes.h" |
|
25 #include <CustomInterfaceUtility.h> |
|
26 #include <CustomCommandUtility.h> |
|
27 #include <mdaaudiotoneplayer.h> |
|
28 #include <mdaaudiooutputstream.h> |
|
29 #include <AudioOutput.h> |
|
30 #include <DrmAudioSamplePlayer.h> |
|
31 #include <videoplayer.h> |
|
32 |
|
33 #ifdef _DEBUG |
|
34 #define DEBPRN0 RDebug::Printf( "%s", __PRETTY_FUNCTION__); |
|
35 #define DEBPRN1(str) RDebug::Printf( "%s %s", __PRETTY_FUNCTION__, str ); |
|
36 #else |
|
37 #define DEBPRN0 |
|
38 #define DEBPRN1(str) |
|
39 #endif |
|
40 |
|
41 // Two-phased constructor. |
|
42 EXPORT_C CAudioOutput* CAudioOutput::NewL(CMdaAudioPlayerUtility& aUtility) |
|
43 { |
|
44 DEBPRN0; |
|
45 CAudioOutputProxy* audioOutput = NULL; |
|
46 CCustomInterfaceUtility* customInterface; |
|
47 |
|
48 customInterface = CCustomInterfaceUtility::NewL(aUtility); |
|
49 CleanupStack::PushL( customInterface ); |
|
50 |
|
51 audioOutput = (CAudioOutputProxy*)customInterface->CustomInterface(KUidAudioOutput); |
|
52 |
|
53 if (audioOutput == NULL) |
|
54 { |
|
55 DEBPRN1("No Adaptation Support - leaving"); |
|
56 User::Leave(KErrNotSupported); |
|
57 } |
|
58 |
|
59 CleanupStack::Pop(customInterface); |
|
60 return audioOutput; |
|
61 } |
|
62 |
|
63 |
|
64 // Two-phased constructor. |
|
65 EXPORT_C CAudioOutput* CAudioOutput::NewL(CMdaAudioRecorderUtility& aUtility, TBool aRecordStream) |
|
66 { |
|
67 DEBPRN0; |
|
68 CAudioOutputProxy* audioOutput = NULL; |
|
69 CCustomInterfaceUtility* customInterface; |
|
70 |
|
71 customInterface = CCustomInterfaceUtility::NewL(aUtility,aRecordStream); |
|
72 CleanupStack::PushL( customInterface ); |
|
73 |
|
74 audioOutput = (CAudioOutputProxy*)customInterface->CustomInterface(KUidAudioOutput); |
|
75 |
|
76 if (audioOutput == NULL) |
|
77 { |
|
78 DEBPRN1("No Adaptation Support - leaving"); |
|
79 User::Leave(KErrNotSupported); |
|
80 } |
|
81 |
|
82 CleanupStack::Pop(customInterface); |
|
83 return audioOutput; |
|
84 } |
|
85 |
|
86 |
|
87 // Two-phased constructor. |
|
88 EXPORT_C CAudioOutput* CAudioOutput::NewL(CMdaAudioOutputStream& aUtility) |
|
89 { |
|
90 DEBPRN0; |
|
91 CAudioOutputProxy* audioOutput = NULL; |
|
92 audioOutput = (CAudioOutputProxy*)aUtility.CustomInterface(KUidAudioOutput); |
|
93 |
|
94 if (audioOutput == NULL) |
|
95 { |
|
96 DEBPRN1("No Adaptation Support - leaving"); |
|
97 User::Leave(KErrNotSupported); |
|
98 } |
|
99 |
|
100 return audioOutput; |
|
101 } |
|
102 |
|
103 // Two-phased constructor. |
|
104 EXPORT_C CAudioOutput* CAudioOutput::NewL(CMdaAudioToneUtility& aUtility) |
|
105 { |
|
106 DEBPRN0; |
|
107 CAudioOutputProxy* audioOutput = NULL; |
|
108 audioOutput = (CAudioOutputProxy*)aUtility.CustomInterface(KUidAudioOutput); |
|
109 |
|
110 if (audioOutput == NULL) |
|
111 { |
|
112 DEBPRN1("No Adaptation Support - leaving"); |
|
113 User::Leave(KErrNotSupported); |
|
114 } |
|
115 |
|
116 return audioOutput; |
|
117 } |
|
118 |
|
119 // Two-phased constructor. |
|
120 EXPORT_C CAudioOutput* CAudioOutput::NewL(CMMFDevSound& aDevSound) |
|
121 { |
|
122 DEBPRN0; |
|
123 CAudioOutputProxy* audioOutput = NULL; |
|
124 audioOutput = (CAudioOutputProxy*)aDevSound.CustomInterface(KUidAudioOutput); |
|
125 |
|
126 if (audioOutput == NULL) |
|
127 { |
|
128 DEBPRN1("No Adaptation Support - leaving"); |
|
129 User::Leave(KErrNotSupported); |
|
130 } |
|
131 |
|
132 return audioOutput; |
|
133 } |
|
134 |
|
135 // Two-phased constructor. |
|
136 EXPORT_C CAudioOutput* CAudioOutput::NewL(MCustomInterface& aUtility) |
|
137 { |
|
138 DEBPRN0; |
|
139 CAudioOutputProxy* audioOutput = (CAudioOutputProxy*)aUtility.CustomInterface(KUidAudioOutput); |
|
140 |
|
141 if ( !audioOutput ) |
|
142 { |
|
143 DEBPRN1("No Adaptation Support - leaving"); |
|
144 User::Leave(KErrNotSupported); |
|
145 } |
|
146 |
|
147 return audioOutput; |
|
148 } |
|
149 |
|
150 // Two-phased constructor. |
|
151 EXPORT_C CAudioOutput* CAudioOutput::NewL(MCustomCommand& aUtility) |
|
152 { |
|
153 DEBPRN0; |
|
154 CAudioOutputProxy* audioOutput = NULL; |
|
155 CCustomInterfaceUtility* customInterface; |
|
156 |
|
157 customInterface = CCustomInterfaceUtility::NewL(aUtility); |
|
158 CleanupStack::PushL( customInterface ); |
|
159 |
|
160 audioOutput = (CAudioOutputProxy*)customInterface->CustomInterface(KUidAudioOutput); |
|
161 |
|
162 if (audioOutput == NULL) |
|
163 { |
|
164 DEBPRN1("No Adaptation Support - leaving"); |
|
165 User::Leave(KErrNotSupported); |
|
166 } |
|
167 |
|
168 CleanupStack::Pop(customInterface); |
|
169 return audioOutput; |
|
170 } |
|
171 |
|
172 // Two-phased constructor. |
|
173 EXPORT_C CAudioOutput* CAudioOutput::NewL(CMidiClientUtility& aUtility) |
|
174 { |
|
175 DEBPRN0; |
|
176 CAudioOutputProxy* audioOutput = NULL; |
|
177 CCustomInterfaceUtility* customInterface; |
|
178 |
|
179 customInterface = CCustomInterfaceUtility::NewL(aUtility); |
|
180 CleanupStack::PushL( customInterface ); |
|
181 |
|
182 audioOutput = (CAudioOutputProxy*)customInterface->CustomInterface(KUidAudioOutput); |
|
183 |
|
184 if (audioOutput == NULL) |
|
185 { |
|
186 DEBPRN1("No Adaptation Support - leaving"); |
|
187 User::Leave(KErrNotSupported); |
|
188 } |
|
189 |
|
190 CleanupStack::Pop(customInterface); |
|
191 return audioOutput; |
|
192 } |
|
193 |
|
194 // Two-phased constructor. |
|
195 EXPORT_C CAudioOutput* CAudioOutput::NewL(CDrmPlayerUtility& aUtility) |
|
196 { |
|
197 DEBPRN0; |
|
198 CAudioOutputProxy* audioOutput = NULL; |
|
199 CCustomInterfaceUtility* customInterface; |
|
200 |
|
201 customInterface = CCustomInterfaceUtility::NewL(aUtility); |
|
202 CleanupStack::PushL( customInterface ); |
|
203 |
|
204 audioOutput = (CAudioOutputProxy*)customInterface->CustomInterface(KUidAudioOutput); |
|
205 |
|
206 if (audioOutput == NULL) |
|
207 { |
|
208 DEBPRN1("No Adaptation Support - leaving"); |
|
209 User::Leave(KErrNotSupported); |
|
210 } |
|
211 |
|
212 CleanupStack::Pop(customInterface); |
|
213 return audioOutput; |
|
214 } |
|
215 |
|
216 EXPORT_C CAudioOutput* CAudioOutput::NewL(CVideoPlayerUtility& aUtility) |
|
217 { |
|
218 DEBPRN0; |
|
219 CAudioOutputProxy* audioOutput = NULL; |
|
220 CCustomInterfaceUtility* customInterface; |
|
221 |
|
222 customInterface = CCustomInterfaceUtility::NewL(aUtility); |
|
223 CleanupStack::PushL( customInterface ); |
|
224 |
|
225 audioOutput = (CAudioOutputProxy*)customInterface->CustomInterface(KUidAudioOutput); |
|
226 |
|
227 if (audioOutput == NULL) |
|
228 { |
|
229 DEBPRN1("No Adaptation Support - leaving"); |
|
230 User::Leave(KErrNotSupported); |
|
231 } |
|
232 |
|
233 CleanupStack::Pop(customInterface); |
|
234 return audioOutput; |
|
235 } |
|
236 |
|
237 // End of file |
|
238 |