|
1 /* |
|
2 * Copyright (c) 2002-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: Audio input base implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <AudioInput.h> |
|
22 #include <mmf/server/sounddevice.h> |
|
23 #include "AudioInputProxy.h" |
|
24 #include "AudioInputMessageTypes.h" |
|
25 #include <CustomInterfaceUtility.h> |
|
26 #include <CustomCommandUtility.h> |
|
27 #include <mdaaudioinputstream.h> |
|
28 #include <videorecorder.h> |
|
29 |
|
30 #ifdef _DEBUG |
|
31 #define DEBPRN0 RDebug::Printf( "%s", __PRETTY_FUNCTION__); |
|
32 #define DEBPRN1(str) RDebug::Printf( "%s %s", __PRETTY_FUNCTION__, str ); |
|
33 #else |
|
34 #define DEBPRN0 |
|
35 #define DEBPRN1(str) |
|
36 #endif |
|
37 |
|
38 // Two-phased constructor. |
|
39 EXPORT_C CAudioInput* CAudioInput::NewL(CMdaAudioRecorderUtility& aUtility) |
|
40 { |
|
41 DEBPRN0; |
|
42 CAudioInputProxy* audioInput; |
|
43 CCustomInterfaceUtility* customInterface; |
|
44 |
|
45 //customInterface = CCustomInterfaceUtility::NewL(aUtility,ECCRecording); |
|
46 customInterface = CCustomInterfaceUtility::NewL(aUtility,ETrue); |
|
47 CleanupStack::PushL(customInterface); |
|
48 |
|
49 // The ownership of customInterface is taken by the audioInput |
|
50 audioInput = (CAudioInputProxy*)customInterface->CustomInterface(KUidAudioInput); |
|
51 |
|
52 if (audioInput == NULL) |
|
53 { |
|
54 DEBPRN1("No Adaptation Support - leaving"); |
|
55 User::Leave(KErrNotSupported); |
|
56 } |
|
57 CleanupStack::Pop(customInterface); |
|
58 return audioInput; |
|
59 } |
|
60 |
|
61 EXPORT_C CAudioInput* CAudioInput::NewL(CMMFDevSound& aDevSound) |
|
62 { |
|
63 DEBPRN0; |
|
64 CAudioInputProxy* audioInput = NULL; |
|
65 audioInput = (CAudioInputProxy*)aDevSound.CustomInterface(KUidAudioInput); |
|
66 if (audioInput == NULL) |
|
67 { |
|
68 DEBPRN1("No Adaptation Support - leaving"); |
|
69 User::Leave(KErrNotSupported); |
|
70 } |
|
71 return audioInput; |
|
72 } |
|
73 |
|
74 // Two-phased constructor. |
|
75 EXPORT_C CAudioInput* CAudioInput::NewL(MCustomCommand& aUtility) |
|
76 { |
|
77 DEBPRN0; |
|
78 CAudioInputProxy* audioInput; |
|
79 CCustomInterfaceUtility* customInterface; |
|
80 |
|
81 customInterface = CCustomInterfaceUtility::NewL(aUtility); |
|
82 CleanupStack::PushL(customInterface); |
|
83 |
|
84 audioInput = (CAudioInputProxy*)customInterface->CustomInterface(KUidAudioInput); |
|
85 if (audioInput == NULL) |
|
86 { |
|
87 DEBPRN1("No Adaptation Support - leaving"); |
|
88 User::Leave(KErrNotSupported); |
|
89 } |
|
90 |
|
91 CleanupStack::Pop(customInterface); |
|
92 return audioInput; |
|
93 } |
|
94 |
|
95 // Two-phased constructor. |
|
96 EXPORT_C CAudioInput* CAudioInput::NewL(MCustomInterface& aUtility) |
|
97 { |
|
98 DEBPRN0; |
|
99 CAudioInput* audioInput = (CAudioInputProxy*)aUtility.CustomInterface(KUidAudioInput); |
|
100 |
|
101 if ( !audioInput ) |
|
102 { |
|
103 DEBPRN1("No Adaptation Support - leaving"); |
|
104 User::Leave(KErrNotSupported); |
|
105 } |
|
106 |
|
107 return audioInput; |
|
108 } |
|
109 |
|
110 EXPORT_C CAudioInput* CAudioInput::NewL(CMdaAudioInputStream& aUtility) |
|
111 { |
|
112 DEBPRN0; |
|
113 CAudioInputProxy* audioInput = NULL; |
|
114 audioInput = (CAudioInputProxy*)aUtility.CustomInterface(KUidAudioInput); |
|
115 if (audioInput == NULL) |
|
116 { |
|
117 DEBPRN1("No Adaptation Support - leaving"); |
|
118 User::Leave(KErrNotSupported); |
|
119 } |
|
120 return audioInput; |
|
121 } |
|
122 |
|
123 EXPORT_C CAudioInput* CAudioInput::NewL(CVideoRecorderUtility& aUtility) |
|
124 { |
|
125 DEBPRN0; |
|
126 CAudioInputProxy* audioInput; |
|
127 CCustomInterfaceUtility* customInterface; |
|
128 |
|
129 customInterface = CCustomInterfaceUtility::NewL(aUtility); |
|
130 CleanupStack::PushL(customInterface); |
|
131 |
|
132 // The ownership of customInterface is taken by the audioInput |
|
133 audioInput = (CAudioInputProxy*)customInterface->CustomInterface(KUidAudioInput); |
|
134 if (audioInput == NULL) |
|
135 { |
|
136 DEBPRN1("No Adaptation Support - leaving"); |
|
137 User::Leave(KErrNotSupported); |
|
138 } |
|
139 |
|
140 CleanupStack::Pop(customInterface); |
|
141 return audioInput; |
|
142 } |
|
143 |
|
144 // End of File |