First public contribution.
2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: This is the implementation of the CAudioOutput class.
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>
34 #define DEBPRN0 RDebug::Printf( "%s", __PRETTY_FUNCTION__);
35 #define DEBPRN1(str) RDebug::Printf( "%s %s", __PRETTY_FUNCTION__, str );
41 // Two-phased constructor.
42 EXPORT_C CAudioOutput* CAudioOutput::NewL(CMdaAudioPlayerUtility& aUtility)
45 CAudioOutputProxy* audioOutput = NULL;
46 CCustomInterfaceUtility* customInterface;
48 customInterface = CCustomInterfaceUtility::NewL(aUtility);
49 CleanupStack::PushL( customInterface );
51 audioOutput = (CAudioOutputProxy*)customInterface->CustomInterface(KUidAudioOutput);
53 if (audioOutput == NULL)
55 DEBPRN1("No Adaptation Support - leaving");
56 User::Leave(KErrNotSupported);
59 CleanupStack::Pop(customInterface);
64 // Two-phased constructor.
65 EXPORT_C CAudioOutput* CAudioOutput::NewL(CMdaAudioRecorderUtility& aUtility, TBool aRecordStream)
68 CAudioOutputProxy* audioOutput = NULL;
69 CCustomInterfaceUtility* customInterface;
71 customInterface = CCustomInterfaceUtility::NewL(aUtility,aRecordStream);
72 CleanupStack::PushL( customInterface );
74 audioOutput = (CAudioOutputProxy*)customInterface->CustomInterface(KUidAudioOutput);
76 if (audioOutput == NULL)
78 DEBPRN1("No Adaptation Support - leaving");
79 User::Leave(KErrNotSupported);
82 CleanupStack::Pop(customInterface);
87 // Two-phased constructor.
88 EXPORT_C CAudioOutput* CAudioOutput::NewL(CMdaAudioOutputStream& aUtility)
91 CAudioOutputProxy* audioOutput = NULL;
92 audioOutput = (CAudioOutputProxy*)aUtility.CustomInterface(KUidAudioOutput);
94 if (audioOutput == NULL)
96 DEBPRN1("No Adaptation Support - leaving");
97 User::Leave(KErrNotSupported);
103 // Two-phased constructor.
104 EXPORT_C CAudioOutput* CAudioOutput::NewL(CMdaAudioToneUtility& aUtility)
107 CAudioOutputProxy* audioOutput = NULL;
108 audioOutput = (CAudioOutputProxy*)aUtility.CustomInterface(KUidAudioOutput);
110 if (audioOutput == NULL)
112 DEBPRN1("No Adaptation Support - leaving");
113 User::Leave(KErrNotSupported);
119 // Two-phased constructor.
120 EXPORT_C CAudioOutput* CAudioOutput::NewL(CMMFDevSound& aDevSound)
123 CAudioOutputProxy* audioOutput = NULL;
124 audioOutput = (CAudioOutputProxy*)aDevSound.CustomInterface(KUidAudioOutput);
126 if (audioOutput == NULL)
128 DEBPRN1("No Adaptation Support - leaving");
129 User::Leave(KErrNotSupported);
135 // Two-phased constructor.
136 EXPORT_C CAudioOutput* CAudioOutput::NewL(MCustomInterface& aUtility)
139 CAudioOutputProxy* audioOutput = (CAudioOutputProxy*)aUtility.CustomInterface(KUidAudioOutput);
143 DEBPRN1("No Adaptation Support - leaving");
144 User::Leave(KErrNotSupported);
150 // Two-phased constructor.
151 EXPORT_C CAudioOutput* CAudioOutput::NewL(MCustomCommand& aUtility)
154 CAudioOutputProxy* audioOutput = NULL;
155 CCustomInterfaceUtility* customInterface;
157 customInterface = CCustomInterfaceUtility::NewL(aUtility);
158 CleanupStack::PushL( customInterface );
160 audioOutput = (CAudioOutputProxy*)customInterface->CustomInterface(KUidAudioOutput);
162 if (audioOutput == NULL)
164 DEBPRN1("No Adaptation Support - leaving");
165 User::Leave(KErrNotSupported);
168 CleanupStack::Pop(customInterface);
172 // Two-phased constructor.
173 EXPORT_C CAudioOutput* CAudioOutput::NewL(CMidiClientUtility& aUtility)
176 CAudioOutputProxy* audioOutput = NULL;
177 CCustomInterfaceUtility* customInterface;
179 customInterface = CCustomInterfaceUtility::NewL(aUtility);
180 CleanupStack::PushL( customInterface );
182 audioOutput = (CAudioOutputProxy*)customInterface->CustomInterface(KUidAudioOutput);
184 if (audioOutput == NULL)
186 DEBPRN1("No Adaptation Support - leaving");
187 User::Leave(KErrNotSupported);
190 CleanupStack::Pop(customInterface);
194 // Two-phased constructor.
195 EXPORT_C CAudioOutput* CAudioOutput::NewL(CDrmPlayerUtility& aUtility)
198 CAudioOutputProxy* audioOutput = NULL;
199 CCustomInterfaceUtility* customInterface;
201 customInterface = CCustomInterfaceUtility::NewL(aUtility);
202 CleanupStack::PushL( customInterface );
204 audioOutput = (CAudioOutputProxy*)customInterface->CustomInterface(KUidAudioOutput);
206 if (audioOutput == NULL)
208 DEBPRN1("No Adaptation Support - leaving");
209 User::Leave(KErrNotSupported);
212 CleanupStack::Pop(customInterface);
216 EXPORT_C CAudioOutput* CAudioOutput::NewL(CVideoPlayerUtility& aUtility)
219 CAudioOutputProxy* audioOutput = NULL;
220 CCustomInterfaceUtility* customInterface;
222 customInterface = CCustomInterfaceUtility::NewL(aUtility);
223 CleanupStack::PushL( customInterface );
225 audioOutput = (CAudioOutputProxy*)customInterface->CustomInterface(KUidAudioOutput);
227 if (audioOutput == NULL)
229 DEBPRN1("No Adaptation Support - leaving");
230 User::Leave(KErrNotSupported);
233 CleanupStack::Pop(customInterface);