|
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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include "mccvideosource.h" |
|
23 #include "mccfilesourceimpl.h" |
|
24 #include "mmcccodecinformation.h" |
|
25 #include "mmccinterfacedef.h" |
|
26 #include "mccvideosourcesinklogs.h" |
|
27 #include "mccinternaldef.h" |
|
28 |
|
29 |
|
30 #include <videoplayer.h> |
|
31 |
|
32 _LIT( KMccVideoTestH263Clip, "c:\\Test.3gp" ); |
|
33 _LIT( KMccVideoTestAvcClip, "c:\\Test_avc.3gp" ); |
|
34 |
|
35 #define MCC_TEMP_FILE_IMPL reinterpret_cast<CMccFileSourceImpl*>( iReserved2 ) |
|
36 |
|
37 #define DELETE_MCC_TEMP_FILE_IMPL \ |
|
38 if ( MCC_TEMP_FILE_IMPL != NULL ){ \ |
|
39 delete MCC_TEMP_FILE_IMPL; \ |
|
40 iReserved2 = 0; \ |
|
41 } |
|
42 |
|
43 #define CREATE_MCC_TEMP_FILE_IMPL { \ |
|
44 DELETE_MCC_TEMP_FILE_IMPL \ |
|
45 iReserved2 = reinterpret_cast<TUint32>( \ |
|
46 CMccFileSourceImpl::NewL( \ |
|
47 MCC_ENDPOINT_ID( static_cast<MDataSource*>( this ) ), iMccResources ) ); \ |
|
48 MCC_TEMP_FILE_IMPL->OpenFileL( KMccVideoTestAvcClip() ); \ |
|
49 } |
|
50 |
|
51 |
|
52 // ============================ MEMBER FUNCTIONS =============================== |
|
53 |
|
54 // ----------------------------------------------------------------------------- |
|
55 // CMccVideoSource::NewSourceL |
|
56 // Static constructor. |
|
57 // ----------------------------------------------------------------------------- |
|
58 // |
|
59 MDataSource* CMccVideoSource::NewSourceL( TUid /*aImplementationUid*/, |
|
60 const TDesC8& /*aInitData*/ ) |
|
61 { |
|
62 CMccVideoSource* self = new ( ELeave ) CMccVideoSource(); |
|
63 return static_cast<MDataSource*>( self ); |
|
64 } |
|
65 |
|
66 // ----------------------------------------------------------------------------- |
|
67 // CMccVideoSource::ConstructSourceL |
|
68 // ----------------------------------------------------------------------------- |
|
69 // |
|
70 void CMccVideoSource::ConstructSourceL( const TDesC8& aInitData ) |
|
71 { |
|
72 __V_SOURCESINK_CONTROLL( "CMccVideoSource::ConstructSourceL" ) |
|
73 |
|
74 if ( aInitData.Length() > 0 ) |
|
75 { |
|
76 __V_SOURCESINK_CONTROLL( "CMccVideoSource::ConstructSourceL, with init data" ) |
|
77 |
|
78 TMccVideoSourceSettingBuf settingsBuf; |
|
79 settingsBuf.Copy( aInitData ); |
|
80 TMccVideoSourceSetting& settings = settingsBuf(); |
|
81 |
|
82 iCameraIndex = settings.iDeviceIndex; |
|
83 |
|
84 __V_SOURCESINK_CONTROLL_INT1( "CMccVideoSource::ConstructSourceL, camera index:", |
|
85 iCameraIndex ) |
|
86 } |
|
87 |
|
88 __V_SOURCESINK_CONTROLL( "CMccVideoSource::ConstructSourceL, exit" ) |
|
89 } |
|
90 |
|
91 // ----------------------------------------------------------------------------- |
|
92 // CMccVideoSource::CMccVideoSource |
|
93 // ----------------------------------------------------------------------------- |
|
94 // |
|
95 CMccVideoSource::CMccVideoSource() : |
|
96 CMccDataSource( KMccVideoSourceUid ) |
|
97 { |
|
98 } |
|
99 |
|
100 // ----------------------------------------------------------------------------- |
|
101 // CMccVideoSource::~CMccVideoSource |
|
102 // ----------------------------------------------------------------------------- |
|
103 // |
|
104 CMccVideoSource::~CMccVideoSource() |
|
105 { |
|
106 delete iSourceImpl; |
|
107 iUsers.ResetAndDestroy(); |
|
108 DELETE_MCC_TEMP_FILE_IMPL |
|
109 } |
|
110 |
|
111 // ----------------------------------------------------------------------------- |
|
112 // CMccVideoSource::SetCameraHandler |
|
113 // ----------------------------------------------------------------------------- |
|
114 // |
|
115 void CMccVideoSource::SetCameraHandler( MMccCameraHandler& /*aCameraHandler*/ ) |
|
116 { |
|
117 __V_SOURCESINK_CONTROLL( "CMccVideoSource::SetCameraHandler" ) |
|
118 } |
|
119 |
|
120 // ----------------------------------------------------------------------------- |
|
121 // CMccVideoSource::CameraIndex |
|
122 // ----------------------------------------------------------------------------- |
|
123 // |
|
124 TInt CMccVideoSource::CameraIndex() const |
|
125 { |
|
126 __V_SOURCESINK_CONTROLL_INT1( "CMccVideoSource::CameraIndex, index:", iCameraIndex ) |
|
127 return iCameraIndex; |
|
128 } |
|
129 |
|
130 // ----------------------------------------------------------------------------- |
|
131 // CMccVideoSource::SourcePrimeL |
|
132 // ----------------------------------------------------------------------------- |
|
133 // |
|
134 void CMccVideoSource::SourcePrimeL() |
|
135 { |
|
136 __V_SOURCESINK_CONTROLL( "CMccVideoSource::SourcePrimeL" ) |
|
137 __ASSERT_ALWAYS( iSourceImpl, User::Leave( KErrArgument ) ); |
|
138 __ASSERT_ALWAYS( iUsers.Count() > 0, User::Leave( KErrNotReady ) ); |
|
139 |
|
140 if ( MCC_IS_AVC_PRIMARY_CODEC ) |
|
141 { |
|
142 iSourceImpl->OpenFileL( KMccVideoTestAvcClip() ); |
|
143 } |
|
144 else |
|
145 { |
|
146 iSourceImpl->OpenFileL( KMccVideoTestH263Clip() ); |
|
147 if ( MultipleCodecs() && !MCC_TEMP_FILE_IMPL ) |
|
148 { |
|
149 // Avc as second user, need to open also avc for config key retrieval |
|
150 CREATE_MCC_TEMP_FILE_IMPL |
|
151 } |
|
152 } |
|
153 |
|
154 iSourceImpl->SourcePrimeL(); |
|
155 } |
|
156 |
|
157 // ----------------------------------------------------------------------------- |
|
158 // CMccVideoSource::SourcePlayL() |
|
159 // ----------------------------------------------------------------------------- |
|
160 // |
|
161 void CMccVideoSource::SourcePlayL() |
|
162 { |
|
163 __V_SOURCESINK_CONTROLL( "CMccVideoSource::SourcePlayL" ) |
|
164 __ASSERT_ALWAYS( iSourceImpl, User::Leave( KErrArgument ) ); |
|
165 |
|
166 UpdateCurrentUserL(); |
|
167 |
|
168 iSourceImpl->SourcePlayL(); |
|
169 __V_SOURCESINK_CONTROLL( "CMccVideoSource::SourcePlayL, done" ) |
|
170 } |
|
171 |
|
172 // ----------------------------------------------------------------------------- |
|
173 // CMccVideoSource::SourcePauseL() |
|
174 // |
|
175 // Pauses streaming by cancelling timers |
|
176 // ----------------------------------------------------------------------------- |
|
177 // |
|
178 void CMccVideoSource::SourcePauseL() |
|
179 { |
|
180 __V_SOURCESINK_CONTROLL( "CMccVideoSource::SourcePauseL" ) |
|
181 __ASSERT_ALWAYS( iSourceImpl, User::Leave( KErrArgument ) ); |
|
182 |
|
183 iSourceImpl->SourcePauseL(); |
|
184 } |
|
185 |
|
186 // ----------------------------------------------------------------------------- |
|
187 // CMccVideoSource::SourceStopL() |
|
188 // |
|
189 // Stops streaming |
|
190 // ----------------------------------------------------------------------------- |
|
191 // |
|
192 void CMccVideoSource::SourceStopL() |
|
193 { |
|
194 __V_SOURCESINK_CONTROLL( "CMccVideoSource::SourceStopL" ) |
|
195 __ASSERT_ALWAYS( iSourceImpl, User::Leave( KErrArgument ) ); |
|
196 iSourceImpl->SourceStopL(); |
|
197 } |
|
198 |
|
199 // ----------------------------------------------------------------------------- |
|
200 // CMccVideoSource::SourceDataTypeCode() |
|
201 // ----------------------------------------------------------------------------- |
|
202 // |
|
203 TFourCC CMccVideoSource::SourceDataTypeCode( TMediaId aMediaId ) |
|
204 { |
|
205 __V_SOURCESINK_CONTROLL( "CMccVideoSource::SourceDataTypeCode" ) |
|
206 |
|
207 if ( iSourceImpl ) |
|
208 { |
|
209 return iSourceImpl->SourceDataTypeCode( aMediaId ); |
|
210 } |
|
211 else |
|
212 { |
|
213 return TFourCC( KMMFFourCCCodeNULL ); |
|
214 } |
|
215 } |
|
216 |
|
217 // ----------------------------------------------------------------------------- |
|
218 // CMccVideoSource::SetSourceDataTypeCode() |
|
219 // ----------------------------------------------------------------------------- |
|
220 // |
|
221 TInt CMccVideoSource::SetSourceDataTypeCode( |
|
222 TFourCC aCodec, |
|
223 TMediaId aMediaId ) |
|
224 { |
|
225 __V_SOURCESINK_CONTROLL_INT1( |
|
226 "CMccVideoSource::SetSourceDataTypeCode, cc", aCodec.FourCC() ) |
|
227 |
|
228 if ( iSourceImpl ) |
|
229 { |
|
230 return iSourceImpl->SetSourceDataTypeCode( aCodec, aMediaId ); |
|
231 } |
|
232 else |
|
233 { |
|
234 return KErrArgument; |
|
235 } |
|
236 } |
|
237 |
|
238 // ----------------------------------------------------------------------------- |
|
239 // CMccVideoSource::BufferEmptiedL() |
|
240 // ----------------------------------------------------------------------------- |
|
241 // |
|
242 void CMccVideoSource::BufferEmptiedL( CMMFBuffer* /*aBuffer*/ ) |
|
243 { |
|
244 __V_SOURCESINK_MEDIA( "CMccVideoSource::BufferEmptiedL" ) |
|
245 __ASSERT_ALWAYS( EFalse, User::Leave( KErrNotSupported ) ); |
|
246 } |
|
247 |
|
248 // ----------------------------------------------------------------------------- |
|
249 // CMccVideoSource::CanCreateSourceBuffer() |
|
250 // ----------------------------------------------------------------------------- |
|
251 // |
|
252 TBool CMccVideoSource::CanCreateSourceBuffer() |
|
253 { |
|
254 __V_SOURCESINK_CONTROLL( "CMccVideoSource::CanCreateSourceBuffer, ETrue" ) |
|
255 return EFalse; |
|
256 } |
|
257 |
|
258 // ----------------------------------------------------------------------------- |
|
259 // CMccVideoSource::CreateSourceBufferL() |
|
260 // ----------------------------------------------------------------------------- |
|
261 // |
|
262 CMMFBuffer* CMccVideoSource::CreateSourceBufferL( |
|
263 TMediaId /*aMediaId*/, |
|
264 TBool& /*aReference*/ ) |
|
265 { |
|
266 __V_SOURCESINK_CONTROLL( "CMccVideoSource::CreateSourceBufferL" ) |
|
267 return NULL; |
|
268 } |
|
269 |
|
270 // ----------------------------------------------------------------------------- |
|
271 // CMccVideoSource::SourceThreadLogon() |
|
272 // ----------------------------------------------------------------------------- |
|
273 // |
|
274 TInt CMccVideoSource::SourceThreadLogon( MAsyncEventHandler& aEventHandler ) |
|
275 { |
|
276 __V_SOURCESINK_CONTROLL( "CMccVideoSource::SourceThreadLogon" ) |
|
277 |
|
278 TInt err( KErrNone ); |
|
279 if ( !iSourceImpl ) |
|
280 { |
|
281 TRAP( err, iSourceImpl = CMccFileSourceImpl::NewL( |
|
282 MCC_ENDPOINT_ID( static_cast<MDataSource*>( this ) ), iMccResources ) ); |
|
283 } |
|
284 if ( !err ) |
|
285 { |
|
286 err = iSourceImpl->SourceThreadLogon( aEventHandler ); |
|
287 } |
|
288 return err; |
|
289 } |
|
290 |
|
291 // ----------------------------------------------------------------------------- |
|
292 // CMccVideoSource::SourceThreadLogoff() |
|
293 // ----------------------------------------------------------------------------- |
|
294 // |
|
295 void CMccVideoSource::SourceThreadLogoff() |
|
296 { |
|
297 __V_SOURCESINK_CONTROLL( "CMccVideoSource::SourceThreadLogoff" ) |
|
298 iSourceImpl->SourceThreadLogoff(); |
|
299 TRAP_IGNORE( iSourceImpl->SourceStopL() ); |
|
300 } |
|
301 |
|
302 // ----------------------------------------------------------------------------- |
|
303 // CMccVideoSource::FillBufferL() |
|
304 // ----------------------------------------------------------------------------- |
|
305 // |
|
306 void CMccVideoSource::FillBufferL( CMMFBuffer* aBuffer, |
|
307 MDataSink* aConsumer, |
|
308 TMediaId aMediaId ) |
|
309 { |
|
310 __V_SOURCESINK_MEDIA( "CMccVideoSource::FillBufferL" ) |
|
311 __ASSERT_ALWAYS( iSourceImpl, User::Leave( KErrArgument ) ); |
|
312 |
|
313 iSourceImpl->FillBufferL( aBuffer, aConsumer, aMediaId ); |
|
314 } |
|
315 |
|
316 // ----------------------------------------------------------------------------- |
|
317 // CMccVideoSource::NegotiateSourceL() |
|
318 // ----------------------------------------------------------------------------- |
|
319 // |
|
320 void CMccVideoSource::NegotiateSourceL( MDataSink& /*aDataSink*/ ) |
|
321 { |
|
322 __V_SOURCESINK_CONTROLL( "CMccVideoSource::NegotiateSourceL" ) |
|
323 } |
|
324 |
|
325 // ----------------------------------------------------------------------------- |
|
326 // CMccVideoSource::RateAdaptationRequest() |
|
327 // ----------------------------------------------------------------------------- |
|
328 // |
|
329 TInt CMccVideoSource::RateAdaptationRequest( |
|
330 const TMccEvent& /*aInputData*/, |
|
331 TMccEvent& /*aOutputData*/ ) |
|
332 { |
|
333 return KErrNotSupported; |
|
334 } |
|
335 |
|
336 // ----------------------------------------------------------------------------- |
|
337 // CMccVideoSource::SetVideoCodecL() |
|
338 // ----------------------------------------------------------------------------- |
|
339 // |
|
340 void CMccVideoSource::SetVideoCodecL( const TMccCodecInfo& aVideoCodec ) |
|
341 { |
|
342 __V_SOURCESINK_CONTROLL_STR8( |
|
343 "CMccVideoSource::SetVideoCodecL, sdpname:", aVideoCodec.iSdpName ) |
|
344 __ASSERT_ALWAYS( iSourceImpl, User::Leave( KErrArgument ) ); |
|
345 |
|
346 TMccVideoSourceUser* user = |
|
347 MccUserArray<TMccVideoSourceUser>::FindUserEntryForCurrent( iUsers, iCurrentUser ); |
|
348 if ( user ) |
|
349 { |
|
350 user->iCodecInfo = aVideoCodec; |
|
351 } |
|
352 } |
|
353 |
|
354 // ----------------------------------------------------------------------------- |
|
355 // CMccVideoSource::GetVideoCodecL() |
|
356 // ----------------------------------------------------------------------------- |
|
357 // |
|
358 void CMccVideoSource::GetVideoCodecL( TMccCodecInfo& /*aVideoCodec*/ ) |
|
359 { |
|
360 __V_SOURCESINK_CONTROLL( "CMccVideoSource::GetVideoCodecL" ) |
|
361 __ASSERT_ALWAYS( iSourceImpl, User::Leave( KErrArgument ) ); |
|
362 } |
|
363 |
|
364 // ----------------------------------------------------------------------------- |
|
365 // CMccVideoSource::GetSupportedVideoCodecsL() |
|
366 // ----------------------------------------------------------------------------- |
|
367 // |
|
368 void CMccVideoSource::GetSupportedVideoCodecsL( RArray<TFourCC>& /*aVideoTypes*/ ) |
|
369 { |
|
370 __V_SOURCESINK_CONTROLL( "CMccVideoSource::GetSupportedVideoCodecsL" ) |
|
371 __ASSERT_ALWAYS( iSourceImpl, User::Leave( KErrArgument ) ); |
|
372 } |
|
373 |
|
374 // ----------------------------------------------------------------------------- |
|
375 // CMccVideoSource::SetAudioCodecL() |
|
376 // ----------------------------------------------------------------------------- |
|
377 // |
|
378 void CMccVideoSource::SetAudioCodecL( const TMccCodecInfo& /*aAudioCodec*/ ) |
|
379 { |
|
380 __V_SOURCESINK_CONTROLL( "CMccVideoSource::SetAudioCodecL" ) |
|
381 __ASSERT_ALWAYS( iSourceImpl, User::Leave( KErrArgument ) ); |
|
382 } |
|
383 |
|
384 // ----------------------------------------------------------------------------- |
|
385 // CMccVideoSource::GetAudioCodecL() |
|
386 // ----------------------------------------------------------------------------- |
|
387 // |
|
388 void CMccVideoSource::GetAudioCodecL( TMccCodecInfo& /*aAudioCodec*/ ) |
|
389 { |
|
390 __V_SOURCESINK_CONTROLL( "CMccVideoSource::GetAudioCodecL" ) |
|
391 __ASSERT_ALWAYS( iSourceImpl, User::Leave( KErrArgument ) ); |
|
392 } |
|
393 |
|
394 // ----------------------------------------------------------------------------- |
|
395 // CMccVideoSource::GetSupportedAudioCodecsL() |
|
396 // ----------------------------------------------------------------------------- |
|
397 // |
|
398 void CMccVideoSource::GetSupportedAudioCodecsL( RArray<TFourCC>& /*aAudioTypes*/ ) |
|
399 { |
|
400 __V_SOURCESINK_CONTROLL( "CMccVideoSource::GetSupportedAudioCodecsL" ) |
|
401 __ASSERT_ALWAYS( iSourceImpl, User::Leave( KErrArgument ) ); |
|
402 } |
|
403 |
|
404 // ----------------------------------------------------------------------------- |
|
405 // CMccVideoSource::SetAudioEnabledL() |
|
406 // ----------------------------------------------------------------------------- |
|
407 // |
|
408 void CMccVideoSource::SetAudioEnabledL( TBool /*aEnabled*/ ) |
|
409 { |
|
410 __V_SOURCESINK_CONTROLL( "CMccVideoSource::SetAudioEnabledL" ) |
|
411 __ASSERT_ALWAYS( iSourceImpl, User::Leave( KErrArgument ) ); |
|
412 } |
|
413 |
|
414 // ----------------------------------------------------------------------------- |
|
415 // CMccVideoSource::AudioEnabledL() |
|
416 // ----------------------------------------------------------------------------- |
|
417 // |
|
418 TBool CMccVideoSource::AudioEnabledL() const |
|
419 { |
|
420 __V_SOURCESINK_CONTROLL( "CMccVideoSource::AudioEnabledL" ) |
|
421 __ASSERT_ALWAYS( iSourceImpl, User::Leave( KErrArgument ) ); |
|
422 return ETrue; |
|
423 } |
|
424 |
|
425 // ----------------------------------------------------------------------------- |
|
426 // CMccVideoSource::SetGainL() |
|
427 // ----------------------------------------------------------------------------- |
|
428 // |
|
429 void CMccVideoSource::SetGainL( TInt /*aGain*/ ) |
|
430 { |
|
431 __V_SOURCESINK_CONTROLL( "CMccVideoSource::SetGainL" ) |
|
432 __ASSERT_ALWAYS( iSourceImpl, User::Leave( KErrArgument ) ); |
|
433 } |
|
434 |
|
435 // ----------------------------------------------------------------------------- |
|
436 // CMccVideoSource::GainL() |
|
437 // ----------------------------------------------------------------------------- |
|
438 // |
|
439 TInt CMccVideoSource::GainL() const |
|
440 { |
|
441 __V_SOURCESINK_CONTROLL( "CMccVideoSource::GainL" ) |
|
442 __ASSERT_ALWAYS( iSourceImpl, User::Leave( KErrArgument ) ); |
|
443 |
|
444 return 0; |
|
445 } |
|
446 |
|
447 // ----------------------------------------------------------------------------- |
|
448 // CMccVideoSource::MaxGainL() |
|
449 // ----------------------------------------------------------------------------- |
|
450 // |
|
451 TInt CMccVideoSource::MaxGainL() const |
|
452 { |
|
453 __V_SOURCESINK_CONTROLL( "CMccVideoSource::MaxGainL" ) |
|
454 __ASSERT_ALWAYS( iSourceImpl, User::Leave( KErrArgument ) ); |
|
455 |
|
456 return 0; |
|
457 } |
|
458 |
|
459 // ----------------------------------------------------------------------------- |
|
460 // CMccVideoSource::AddUser() |
|
461 // ----------------------------------------------------------------------------- |
|
462 // |
|
463 TInt CMccVideoSource::AddUser( MAsyncEventHandler* aUser ) |
|
464 { |
|
465 __V_SOURCESINK_CONTROLL_INT1( |
|
466 "CMccVideoSource::AddUser, user:", reinterpret_cast<TInt>( aUser ) ) |
|
467 TInt retVal( KErrNone ); |
|
468 TMccVideoSourceUser* userEntry = |
|
469 MccUserArray<TMccVideoSourceUser>::FindUserEntryForCurrent( iUsers, aUser ); |
|
470 if ( !userEntry ) |
|
471 { |
|
472 TRAP( retVal, AddUserL( aUser ) ); |
|
473 } |
|
474 return retVal; |
|
475 } |
|
476 |
|
477 // ----------------------------------------------------------------------------- |
|
478 // CMccVideoSource::RemoveUser() |
|
479 // ----------------------------------------------------------------------------- |
|
480 // |
|
481 void CMccVideoSource::RemoveUser( MAsyncEventHandler* aUser ) |
|
482 { |
|
483 __V_SOURCESINK_CONTROLL_INT1( |
|
484 "CMccVideoSource::RemoveUser, user:", reinterpret_cast<TInt>( aUser ) ) |
|
485 |
|
486 MccUserArray<TMccVideoSourceUser>::RemoveCurrentUser( iUsers, aUser ); |
|
487 |
|
488 if ( aUser == iCurrentUser ) |
|
489 { |
|
490 if ( iUsers.Count() > 0 ) |
|
491 { |
|
492 iCurrentUser = iUsers[ 0 ]->iEventHandler; |
|
493 TRAP_IGNORE( UpdateCurrentUserL() ) |
|
494 } |
|
495 iCurrentUser = NULL; |
|
496 } |
|
497 } |
|
498 |
|
499 // ----------------------------------------------------------------------------- |
|
500 // CMccVideoSource::SetCurrentUser() |
|
501 // ----------------------------------------------------------------------------- |
|
502 // |
|
503 void CMccVideoSource::SetCurrentUser( MAsyncEventHandler* aUser ) |
|
504 { |
|
505 iCurrentUser = aUser; |
|
506 } |
|
507 |
|
508 // ----------------------------------------------------------------------------- |
|
509 // CMccVideoSource::UpdateL() |
|
510 // ----------------------------------------------------------------------------- |
|
511 // |
|
512 void CMccVideoSource::UpdateL( const TDesC8& aVal ) |
|
513 { |
|
514 __V_SOURCESINK_CONTROLL( "CMccVideoSource::UpdateL" ) |
|
515 |
|
516 // Only device index is used atm |
|
517 |
|
518 TMccVideoSourceSettingBuf settingsBuf; |
|
519 settingsBuf.Copy( aVal ); |
|
520 TMccVideoSourceSetting& settings = settingsBuf(); |
|
521 |
|
522 __V_SOURCESINK_CONTROLL_INT1( "CMccVideoSource::UpdateL, current camera index:", |
|
523 iCameraIndex ) |
|
524 __V_SOURCESINK_CONTROLL_INT1( "CMccVideoSource::UpdateL, new camera index:", |
|
525 settings.iDeviceIndex ) |
|
526 |
|
527 iCameraIndex = settings.iDeviceIndex; |
|
528 |
|
529 __V_SOURCESINK_CONTROLL( "CMccVideoSource::UpdateL, exit" ) |
|
530 } |
|
531 |
|
532 // ----------------------------------------------------------------------------- |
|
533 // CMccVideoSource::GetParameterL() |
|
534 // ----------------------------------------------------------------------------- |
|
535 // |
|
536 void CMccVideoSource::GetParameterL( TUint32 aParam, TDes8& aVal ) |
|
537 { |
|
538 switch ( aParam ) |
|
539 { |
|
540 case KMccConfigKey: |
|
541 { |
|
542 __ASSERT_ALWAYS( iSourceImpl, User::Leave( KErrNotReady ) ); |
|
543 if ( MCC_TEMP_FILE_IMPL ) |
|
544 { |
|
545 MCC_TEMP_FILE_IMPL->GetConfigKeyL( aVal ); |
|
546 } |
|
547 else |
|
548 { |
|
549 iSourceImpl->GetConfigKeyL( aVal ); |
|
550 } |
|
551 break; |
|
552 } |
|
553 default: |
|
554 { |
|
555 User::Leave( KErrArgument ); |
|
556 break; |
|
557 } |
|
558 } |
|
559 } |
|
560 |
|
561 // ----------------------------------------------------------------------------- |
|
562 // CMccVideoSource::SetParameterL() |
|
563 // ----------------------------------------------------------------------------- |
|
564 // |
|
565 void CMccVideoSource::SetParameterL( TUint32 aParam, const TDesC8& /*aVal*/ ) |
|
566 { |
|
567 switch ( aParam ) |
|
568 { |
|
569 case KMccConfigKey: |
|
570 { |
|
571 // NOP |
|
572 break; |
|
573 } |
|
574 default: |
|
575 { |
|
576 User::Leave( KErrArgument ); |
|
577 break; |
|
578 } |
|
579 } |
|
580 } |
|
581 |
|
582 // ----------------------------------------------------------------------------- |
|
583 // CMccVideoSource::AddUserL() |
|
584 // ----------------------------------------------------------------------------- |
|
585 // |
|
586 void CMccVideoSource::AddUserL( MAsyncEventHandler* aUser ) |
|
587 { |
|
588 TMccVideoSourceUser* user = new ( ELeave ) TMccVideoSourceUser( aUser ); |
|
589 CleanupStack::PushL( user ); |
|
590 iUsers.AppendL( user ); |
|
591 CleanupStack::Pop( user ); |
|
592 } |
|
593 |
|
594 // ----------------------------------------------------------------------------- |
|
595 // CMccVideoSource::MultipleCodecs() |
|
596 // ----------------------------------------------------------------------------- |
|
597 // |
|
598 TBool CMccVideoSource::MultipleCodecs() const |
|
599 { |
|
600 TBool multipleCodecs( EFalse ); |
|
601 TMccCodecInfo* codecInfo = iUsers.Count() > 1 ? &iUsers[ 0 ]->iCodecInfo : NULL; |
|
602 for ( TInt i = 1; i < iUsers.Count() && codecInfo; i++ ) |
|
603 { |
|
604 if ( codecInfo->iSdpName.CompareF( iUsers[ i ]->iCodecInfo.iSdpName ) != 0 ) |
|
605 { |
|
606 multipleCodecs = ETrue; |
|
607 codecInfo = NULL; |
|
608 } |
|
609 } |
|
610 return multipleCodecs; |
|
611 } |
|
612 |
|
613 // ----------------------------------------------------------------------------- |
|
614 // CMccVideoSource::UpdateCurrentUserL() |
|
615 // ----------------------------------------------------------------------------- |
|
616 // |
|
617 void CMccVideoSource::UpdateCurrentUserL() |
|
618 { |
|
619 __V_SOURCESINK_CONTROLL( "CMccVideoSource::UpdateCurrentUserL" ) |
|
620 |
|
621 TMccVideoSourceUser* userEntry = |
|
622 MccUserArray<TMccVideoSourceUser>::FindUserEntryForCurrent( iUsers, iCurrentUser ); |
|
623 |
|
624 // If multiple different codecs may be using the video source, update source |
|
625 // according to current user |
|
626 |
|
627 if ( MCC_IS_AVC_USER_ENTRY( userEntry ) ) |
|
628 { |
|
629 if ( iSourceImpl->FileNameL().CompareF( KMccVideoTestAvcClip() ) != 0 ) |
|
630 { |
|
631 iSourceImpl->OpenFileL( KMccVideoTestAvcClip() ); |
|
632 } |
|
633 } |
|
634 else if ( MCC_IS_H263_USER_ENTRY( userEntry ) ) |
|
635 { |
|
636 if ( iSourceImpl->FileNameL().CompareF( KMccVideoTestH263Clip() ) != 0 ) |
|
637 { |
|
638 iSourceImpl->OpenFileL( KMccVideoTestH263Clip() ); |
|
639 } |
|
640 } |
|
641 else |
|
642 { |
|
643 } |
|
644 |
|
645 __V_SOURCESINK_CONTROLL( "CMccVideoSource::UpdateCurrentUserL, exit" ) |
|
646 } |
|
647 |
|
648 // End of file |
|
649 |