|
1 /* |
|
2 * Copyright (c) 2002-2004 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include <mmf/common/mmfutilities.h> |
|
20 #include "mccdatapathbase.h" |
|
21 #include "mcccompletecallback.h" |
|
22 #include "mccsubcontrollerlogs.h" |
|
23 #include "mccinternaldef.h" |
|
24 |
|
25 // EXTERNAL DATA STRUCTURES |
|
26 |
|
27 // EXTERNAL FUNCTION PROTOTYPES |
|
28 |
|
29 // CONSTANTS |
|
30 |
|
31 // MACROS |
|
32 |
|
33 // LOCAL CONSTANTS AND MACROS |
|
34 |
|
35 // MODULE DATA STRUCTURES |
|
36 |
|
37 // LOCAL FUNCTION PROTOTYPES |
|
38 |
|
39 // FORWARD DECLARATIONS |
|
40 |
|
41 // ============================= LOCAL FUNCTIONS =============================== |
|
42 |
|
43 // ============================ MEMBER FUNCTIONS =============================== |
|
44 |
|
45 // ----------------------------------------------------------------------------- |
|
46 // CMccDataPathBase::AddDataSourceL |
|
47 // Adds a datasource to the datapath |
|
48 // ----------------------------------------------------------------------------- |
|
49 void CMccDataPathBase::AddDataSourceL( MDataSource* aSource ) |
|
50 { |
|
51 __SUBCONTROLLER( "CMccDataPathBase::AddDataSourceL" ) |
|
52 } |
|
53 |
|
54 // ----------------------------------------------------------------------------- |
|
55 // CMccDataPathBase::AddDataSinkL |
|
56 // Adds a datasink to the datapath |
|
57 // ----------------------------------------------------------------------------- |
|
58 void CMccDataPathBase::AddDataSinkL( MDataSink* aSink ) |
|
59 { |
|
60 __SUBCONTROLLER( "CMccDataPathBase::AddDataSinkL" ) |
|
61 } |
|
62 |
|
63 // ----------------------------------------------------------------------------- |
|
64 // CMccDataPathBase::SetAssociatedSink |
|
65 // ----------------------------------------------------------------------------- |
|
66 void CMccDataPathBase::SetAssociatedSink( MDataSink* aAssociatedSink ) |
|
67 { |
|
68 __SUBCONTROLLER_INT1( "CMccDataPathBase::SetAssociatedSinkId, id:", |
|
69 MCC_ENDPOINT_ID( aAssociatedSink ) ) |
|
70 |
|
71 iAssociatedSink = aAssociatedSink; |
|
72 } |
|
73 |
|
74 // ----------------------------------------------------------------------------- |
|
75 // CMccDataPathBase::SetAssociatedSource |
|
76 // ----------------------------------------------------------------------------- |
|
77 void CMccDataPathBase::SetAssociatedSource( MDataSource* aAssociatedSource ) |
|
78 { |
|
79 __SUBCONTROLLER_INT1( "CMccDataPathBase::SetAssociatedSourceId,id:", |
|
80 MCC_ENDPOINT_ID( aAssociatedSource ) ) |
|
81 |
|
82 iAssociatedSource = aAssociatedSource; |
|
83 } |
|
84 |
|
85 // ----------------------------------------------------------------------------- |
|
86 // CMccDataPathBase::ChangeDataPathTransferState |
|
87 // Changes the transfer state of the datapath |
|
88 // ----------------------------------------------------------------------------- |
|
89 TBool CMccDataPathBase::ChangeDataPathTransferState( |
|
90 TTransferState aTransferState, |
|
91 TBool aFailureFallback ) |
|
92 { |
|
93 return ETrue; |
|
94 } |
|
95 |
|
96 // ----------------------------------------------------------------------------- |
|
97 // CMccDataPathBase::CreateDataPathL |
|
98 // Datapath creating |
|
99 // ----------------------------------------------------------------------------- |
|
100 void CMccDataPathBase::CreateDataPathL( MDataSource* aSource, MDataSink* aSink ) |
|
101 { |
|
102 __SUBCONTROLLER( "CMccDataPathBase::CreateDataPathL" ) |
|
103 iDataPathCreated = EFalse; |
|
104 __SUBCONTROLLER( "CMccDataPathBase::CreateDataPathL, exit" ) |
|
105 } |
|
106 |
|
107 // ----------------------------------------------------------------------------- |
|
108 // CMccDataPathBase::~CMccDataPathBase |
|
109 // Destructor |
|
110 // ----------------------------------------------------------------------------- |
|
111 CMccDataPathBase::~CMccDataPathBase() |
|
112 { |
|
113 delete iCompleteCallback; |
|
114 Cancel(); |
|
115 |
|
116 |
|
117 iDataSink = NULL; |
|
118 iDataSource = NULL; |
|
119 iSourceBuffer = NULL; |
|
120 iSinkBuffer = NULL; |
|
121 iEventHandler = NULL; |
|
122 } |
|
123 |
|
124 // ----------------------------------------------------------------------------- |
|
125 // CMccDataPathBase::ConstructSinkL |
|
126 // From MDataSink |
|
127 // ----------------------------------------------------------------------------- |
|
128 void CMccDataPathBase::ConstructSinkL( const TDesC8& /*aInitData*/ ) |
|
129 { |
|
130 User::Leave( KErrNotSupported ); |
|
131 } |
|
132 |
|
133 // ----------------------------------------------------------------------------- |
|
134 // CMccDataPathBase::ConstructSourceL |
|
135 // From MDataSource |
|
136 // ----------------------------------------------------------------------------- |
|
137 void CMccDataPathBase::ConstructSourceL( const TDesC8& /*aInitData*/ ) |
|
138 { |
|
139 User::Leave( KErrNotSupported ); |
|
140 } |
|
141 |
|
142 // ----------------------------------------------------------------------------- |
|
143 // CMccDataPathBase::CanCreateSinkBuffer |
|
144 // From MDataSink |
|
145 // ----------------------------------------------------------------------------- |
|
146 TBool CMccDataPathBase::CanCreateSinkBuffer() |
|
147 { |
|
148 // CMccDataPathBase can't create buffers |
|
149 return EFalse; |
|
150 } |
|
151 |
|
152 // ----------------------------------------------------------------------------- |
|
153 // CMccDataPathBase::CanCreateSourceBuffer |
|
154 // From MDataSource |
|
155 // ----------------------------------------------------------------------------- |
|
156 TBool CMccDataPathBase::CanCreateSourceBuffer() |
|
157 { |
|
158 // CMccDataPathBase can't create buffers |
|
159 return EFalse; |
|
160 } |
|
161 |
|
162 // ----------------------------------------------------------------------------- |
|
163 // CMccUlDataPath::CreateSinkBufferL |
|
164 // From MDataSink |
|
165 // ----------------------------------------------------------------------------- |
|
166 CMMFBuffer* CMccDataPathBase::CreateSinkBufferL( TMediaId /*aMediaId*/, |
|
167 TBool& /*aReference*/ ) |
|
168 { |
|
169 // CMccDataPathBase can't create buffers |
|
170 User::Leave( KErrNotSupported ); |
|
171 return NULL; |
|
172 } |
|
173 |
|
174 // ----------------------------------------------------------------------------- |
|
175 // CMccDataPathBase::CreateSourceBufferL |
|
176 // From MDataSource |
|
177 // ----------------------------------------------------------------------------- |
|
178 CMMFBuffer* CMccDataPathBase::CreateSourceBufferL( TMediaId /*aMediaId*/, |
|
179 TBool& /*aReference*/ ) |
|
180 { |
|
181 // CMccDataPathBase can't create buffers |
|
182 User::Leave( KErrNotSupported ); |
|
183 return NULL; |
|
184 } |
|
185 |
|
186 // ----------------------------------------------------------------------------- |
|
187 // ----------------------------------------------------------------------------- |
|
188 // CMccDataPathBase::FillBufferL |
|
189 // From MDataSource |
|
190 // ----------------------------------------------------------------------------- |
|
191 void CMccDataPathBase::FillBufferL( CMMFBuffer* /*aBuffer*/, |
|
192 MDataSink* /*aConsumer*/, TMediaId /*aMediaId*/ ) |
|
193 { |
|
194 // Not implemented |
|
195 User::Leave( KErrNotSupported ); |
|
196 } |
|
197 |
|
198 // ----------------------------------------------------------------------------- |
|
199 // CMccDataPathBase::IsBufferSupportedL |
|
200 // Checks if the given buffer is supported |
|
201 // ----------------------------------------------------------------------------- |
|
202 void CMccDataPathBase::IsBufferSupportedL( CMMFBuffer* aBuffer ) |
|
203 { |
|
204 __ASSERT_ALWAYS ( aBuffer, User::Leave(KErrArgument) ); |
|
205 |
|
206 TUid type = aBuffer->Type(); |
|
207 |
|
208 if( KUidMmfDataBuffer == type ) |
|
209 { |
|
210 return; |
|
211 } |
|
212 else if( KUidMmfTransferBuffer == type ) |
|
213 { |
|
214 return; |
|
215 } |
|
216 else if( KUidMmfAudioBuffer == type ) |
|
217 { |
|
218 return; |
|
219 } |
|
220 else if( KUidMmfPtrBuffer == type ) |
|
221 { |
|
222 return; |
|
223 } |
|
224 else |
|
225 { |
|
226 User::Leave( KErrNotSupported ); |
|
227 } |
|
228 } |
|
229 |
|
230 // ----------------------------------------------------------------------------- |
|
231 // CMccDataPathBase::CopyBuffer |
|
232 // copy data and settings from one buffer to another |
|
233 // ----------------------------------------------------------------------------- |
|
234 void CMccDataPathBase::CopyBuffer( CMMFBuffer* aDesBuffer, |
|
235 CMMFBuffer* aOrigBuffer) |
|
236 { |
|
237 |
|
238 } |
|
239 |
|
240 // ----------------------------------------------------------------------------- |
|
241 // CMccDataPathBase::CreateCompleteCallBackL |
|
242 // a CCompleteCallback object is created |
|
243 // ----------------------------------------------------------------------------- |
|
244 void CMccDataPathBase::CreateCompleteCallBackL() |
|
245 { |
|
246 } |
|
247 |
|
248 // ----------------------------------------------------------------------------- |
|
249 // CMccDataPathBase::SignalDataPathCompleteL |
|
250 // a signal the datapath complete with a error code |
|
251 // ----------------------------------------------------------------------------- |
|
252 void CMccDataPathBase::SignalDataPathCompleteL( TInt aErrorCode ) |
|
253 { |
|
254 } |
|
255 |
|
256 |
|
257 // ----------------------------------------------------------------------------- |
|
258 // CMccDataPathBase::SetSinkDataTypeCode |
|
259 // From MDataSink |
|
260 // ----------------------------------------------------------------------------- |
|
261 TInt CMccDataPathBase::SetSinkDataTypeCode( TFourCC aSinkFourCC, TMediaId aMediaId ) |
|
262 { |
|
263 return KErrNone; |
|
264 } |
|
265 |
|
266 // ----------------------------------------------------------------------------- |
|
267 // CMccDataPathBase::SetSourceDataTypeCode |
|
268 // From MDataSource |
|
269 // ----------------------------------------------------------------------------- |
|
270 TInt CMccDataPathBase::SetSourceDataTypeCode( TFourCC aSourceFourCC, TMediaId aMediaId ) |
|
271 { |
|
272 return KErrNone; |
|
273 } |
|
274 |
|
275 // ----------------------------------------------------------------------------- |
|
276 // CMccDataPathBase::SetState |
|
277 // Sets the current datapath state |
|
278 // ----------------------------------------------------------------------------- |
|
279 void CMccDataPathBase::SetStateL( const TDataPathState& aState ) |
|
280 { |
|
281 |
|
282 } |
|
283 |
|
284 // ----------------------------------------------------------------------------- |
|
285 // CMccDataPathBase::EmptyBufferL |
|
286 // From MDataSink |
|
287 // ----------------------------------------------------------------------------- |
|
288 void CMccDataPathBase::EmptyBufferL( CMMFBuffer* /* aBuffer */, MDataSource* |
|
289 /*aSupplier*/, TMediaId /*aMediaId*/ ) |
|
290 { |
|
291 User::Leave( KErrNotSupported ); |
|
292 } |
|
293 |
|
294 // ----------------------------------------------------------------------------- |
|
295 // CMccDataPathBase::SinkDataTypeCode |
|
296 // From MDataSink |
|
297 // ----------------------------------------------------------------------------- |
|
298 TFourCC CMccDataPathBase::SinkDataTypeCode( TMediaId aMediaId ) |
|
299 { |
|
300 TFourCC dummy( KFourCCNULL ); |
|
301 return dummy; |
|
302 } |
|
303 |
|
304 // ----------------------------------------------------------------------------- |
|
305 // CMccDataPathBase::SourceDataTypeCode |
|
306 // From MDataSource |
|
307 // ----------------------------------------------------------------------------- |
|
308 TFourCC CMccDataPathBase::SourceDataTypeCode( TMediaId aMediaId ) |
|
309 { |
|
310 TFourCC dummy( KFourCCNULL ); |
|
311 return dummy; |
|
312 } |
|
313 |
|
314 // ----------------------------------------------------------------------------- |
|
315 // CMccDataPathBase::State |
|
316 // Returns the current datapath state |
|
317 // ----------------------------------------------------------------------------- |
|
318 TDataPathState CMccDataPathBase::State() const |
|
319 { |
|
320 return iState; |
|
321 } |
|
322 |
|
323 // ----------------------------------------------------------------------------- |
|
324 // CMccDataPathBase::TransferState |
|
325 // Returns the current transferstate |
|
326 // ----------------------------------------------------------------------------- |
|
327 TTransferState CMccDataPathBase::TransferState() const |
|
328 { |
|
329 return iTransferState; |
|
330 } |
|
331 |
|
332 // ----------------------------------------------------------------------------- |
|
333 // CMccDataPathBase::ControlSource |
|
334 // ----------------------------------------------------------------------------- |
|
335 TBool CMccDataPathBase::ControlSource( TUint32 aEndpointId ) const |
|
336 { |
|
337 return ( MCC_CONTROL_ALL_ENDPOINTS( aEndpointId ) || |
|
338 aEndpointId == MCC_ENDPOINT_ID( iAssociatedSource ) ); |
|
339 } |
|
340 |
|
341 // ----------------------------------------------------------------------------- |
|
342 // CMccDataPathBase::ControlSink |
|
343 // ----------------------------------------------------------------------------- |
|
344 TBool CMccDataPathBase::ControlSink( TUint32 aEndpointId ) const |
|
345 { |
|
346 return ( MCC_CONTROL_ALL_ENDPOINTS( aEndpointId ) || |
|
347 aEndpointId == MCC_ENDPOINT_ID( iAssociatedSink ) ); |
|
348 } |
|
349 |
|
350 // ----------------------------------------------------------------------------- |
|
351 // CMccDataPathBase::IsMmfEndpoint |
|
352 // ----------------------------------------------------------------------------- |
|
353 TBool CMccDataPathBase::IsMmfEndpoint( MDataSink* aSink ) const |
|
354 { |
|
355 return ( aSink && aSink->DataSinkType() == KUidMmfAudioOutput ); |
|
356 } |
|
357 |
|
358 // ----------------------------------------------------------------------------- |
|
359 // CMccDataPathBase::IsMmfEndpoint |
|
360 // ----------------------------------------------------------------------------- |
|
361 TBool CMccDataPathBase::IsMmfEndpoint( MDataSource* aSource ) const |
|
362 { |
|
363 return ( aSource && aSource->DataSourceType() == KUidMmfAudioInput ); |
|
364 } |
|
365 |
|
366 // ----------------------------------------------------------------------------- |
|
367 // CMccDataPathBase::DoCancel |
|
368 // From CActive |
|
369 // ----------------------------------------------------------------------------- |
|
370 void CMccDataPathBase::DoCancel() |
|
371 { |
|
372 // Nothing to do |
|
373 } |
|
374 |
|
375 // ----------------------------------------------------------------------------- |
|
376 // CMccDataPathBase::EndOfData |
|
377 // End of data |
|
378 // ----------------------------------------------------------------------------- |
|
379 void CMccDataPathBase::EndOfData() |
|
380 { |
|
381 |
|
382 } |
|
383 |
|
384 // ----------------------------------------------------------------------------- |
|
385 // CMccDataPathBase::RunL |
|
386 // From CActive |
|
387 // ----------------------------------------------------------------------------- |
|
388 void CMccDataPathBase::RunL() |
|
389 { |
|
390 |
|
391 } |
|
392 |
|
393 // ----------------------------------------------------------------------------- |
|
394 // CMccDataPathBase::RunError |
|
395 // From CActive |
|
396 // ----------------------------------------------------------------------------- |
|
397 TInt CMccDataPathBase::RunError( TInt /*aError*/ ) |
|
398 { |
|
399 return KErrNone; |
|
400 } |
|
401 |
|
402 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
403 |
|
404 // End of File |