76 |
93 |
77 CMceVideoStream* videoOut = NULL; |
94 CMceVideoStream* videoOut = NULL; |
78 |
95 |
79 for ( TInt i = 0; i < streams.Count(); ++i ) |
96 for ( TInt i = 0; i < streams.Count(); ++i ) |
80 { |
97 { |
81 if ( streams[i]->Type() == KMceVideo ) |
98 if ( MusEngMceUtils::IsVideoOutStream( *streams[i] ) ) |
82 { |
99 { |
83 CMceMediaSink* rtpSink = MusEngMceUtils::GetMediaSink( |
100 __ASSERT_ALWAYS( !videoOut, User::Leave( KErrOverflow ) ); |
84 *streams[i], |
|
85 KMceRTPSink ); |
|
86 if ( rtpSink ) |
|
87 { |
|
88 __ASSERT_ALWAYS( !videoOut, User::Leave( KErrOverflow ) ); |
|
89 |
|
90 videoOut = static_cast<CMceVideoStream*>( streams[i] ); |
|
91 } |
|
92 |
101 |
93 // There is no need to investigate bound stream since |
102 videoOut = static_cast<CMceVideoStream*>( streams[i] ); |
94 // outstream is always constructed by Mus instead of MCE |
103 } |
95 } |
104 |
|
105 // Check if bound stream is a video stream with RTP sink. |
|
106 if ( streams[i]->BoundStream() && |
|
107 MusEngMceUtils::IsVideoOutStream( streams[i]->BoundStreamL() ) ) |
|
108 { |
|
109 __ASSERT_ALWAYS( !videoOut, User::Leave( KErrOverflow ) ); |
|
110 |
|
111 videoOut = static_cast<CMceVideoStream*>( |
|
112 &streams[i]->BoundStreamL() ); |
|
113 } |
96 } |
114 } |
97 |
115 |
98 __ASSERT_ALWAYS( videoOut, User::Leave( KErrNotFound ) ); |
116 __ASSERT_ALWAYS( videoOut, User::Leave( KErrNotFound ) ); |
99 |
117 |
100 MUS_LOG( "mus: [ENGINE] <- MusEngMceUtils::GetVideoOutStreamL()" ) |
118 MUS_LOG( "mus: [ENGINE] <- MusEngMceUtils::GetVideoOutStreamL()" ) |
212 // ----------------------------------------------------------------------------- |
234 // ----------------------------------------------------------------------------- |
213 // Gets handle to a media sink of spesified type contained by a session. |
235 // Gets handle to a media sink of spesified type contained by a session. |
214 // ----------------------------------------------------------------------------- |
236 // ----------------------------------------------------------------------------- |
215 // |
237 // |
216 CMceMediaSink* MusEngMceUtils::GetMediaSink( CMceSession& aSession, |
238 CMceMediaSink* MusEngMceUtils::GetMediaSink( CMceSession& aSession, |
217 TMceSinkType aType ) |
239 TMceSinkType aType, |
|
240 TMceSourceType aAssociatedSourceType, |
|
241 TBool aStrictMatch ) |
218 { |
242 { |
219 CMceMediaSink* sink = NULL; |
243 CMceMediaSink* sink = NULL; |
220 |
244 |
221 TRAP_IGNORE( sink = MusEngMceUtils::GetMediaSinkL( aSession, aType ) ) |
245 TRAP_IGNORE( sink = MusEngMceUtils::GetMediaSinkL( |
|
246 aSession, aType, aAssociatedSourceType, aStrictMatch ) ) |
222 |
247 |
223 return sink; |
248 return sink; |
224 } |
249 } |
225 |
250 |
226 |
251 |
227 // ----------------------------------------------------------------------------- |
252 // ----------------------------------------------------------------------------- |
228 // Gets handle to a media sink of spesified type contained by a session. |
253 // Gets handle to a media sink of spesified type contained by a session. |
229 // ----------------------------------------------------------------------------- |
254 // ----------------------------------------------------------------------------- |
230 // |
255 // |
231 CMceMediaSink* MusEngMceUtils::GetMediaSinkL( CMceSession& aSession, |
256 CMceMediaSink* MusEngMceUtils::GetMediaSinkL( CMceSession& aSession, |
232 TMceSinkType aType ) |
257 TMceSinkType aType, |
|
258 TMceSourceType aAssociatedSourceType, |
|
259 TBool aStrictMatch ) |
233 { |
260 { |
234 CMceMediaSink* sink = NULL; |
261 CMceMediaSink* sink = NULL; |
235 |
262 |
236 const RPointerArray<CMceMediaStream>& streams = aSession.Streams(); |
263 const RPointerArray<CMceMediaStream>& streams = aSession.Streams(); |
237 |
264 |
238 for ( TInt i = 0; i < streams.Count(); ++i ) |
265 for ( TInt i = 0; i < streams.Count(); ++i ) |
239 { |
266 { |
240 sink = MusEngMceUtils::GetMediaSink( *streams[i], aType ); |
267 sink = MusEngMceUtils::GetMediaSink( *streams[i], aType, aAssociatedSourceType ); |
241 if ( sink ) |
268 if ( sink ) |
242 { |
269 { |
243 return sink; |
270 return sink; |
244 } |
271 } |
245 |
272 |
246 if ( streams[i]->BoundStream() ) |
273 if ( streams[i]->BoundStream() ) |
247 { |
274 { |
248 sink = MusEngMceUtils::GetMediaSink( streams[i]->BoundStreamL(), |
275 sink = MusEngMceUtils::GetMediaSink( streams[i]->BoundStreamL(), |
249 aType ); |
276 aType, |
|
277 aAssociatedSourceType ); |
250 if ( sink ) |
278 if ( sink ) |
251 { |
279 { |
252 return sink; |
280 return sink; |
253 } |
281 } |
254 } |
282 } |
|
283 } |
|
284 |
|
285 if ( !sink && aAssociatedSourceType != KMusEngNoAssociatedSourceType && !aStrictMatch ) |
|
286 { |
|
287 // No preferred match, try without source preference |
|
288 sink = GetMediaSinkL( aSession, aType ); |
255 } |
289 } |
256 |
290 |
257 __ASSERT_ALWAYS( sink, User::Leave( KErrNotFound ) ); |
291 __ASSERT_ALWAYS( sink, User::Leave( KErrNotFound ) ); |
258 |
292 |
259 return sink; |
293 return sink; |
340 |
374 |
341 // ----------------------------------------------------------------------------- |
375 // ----------------------------------------------------------------------------- |
342 // Gets handle to a display sink. |
376 // Gets handle to a display sink. |
343 // ----------------------------------------------------------------------------- |
377 // ----------------------------------------------------------------------------- |
344 // |
378 // |
345 CMceDisplaySink* MusEngMceUtils::GetDisplay( CMceSession& aSession ) |
379 CMceDisplaySink* MusEngMceUtils::GetDisplay( |
|
380 CMceSession& aSession, TBool aPreferViewFinder ) |
346 { |
381 { |
347 MUS_LOG( "mus: [ENGINE] -> MusEngMceUtils::GetDisplay()" ) |
382 MUS_LOG( "mus: [ENGINE] -> MusEngMceUtils::GetDisplay()" ) |
348 MUS_LOG( "mus: [ENGINE] <- MusEngMceUtils::GetDisplay()" ) |
383 MUS_LOG( "mus: [ENGINE] <- MusEngMceUtils::GetDisplay()" ) |
|
384 TMceSourceType preferredSource = |
|
385 aPreferViewFinder ? KMceCameraSource : KMusEngNoAssociatedSourceType; |
349 return static_cast<CMceDisplaySink*>( |
386 return static_cast<CMceDisplaySink*>( |
350 MusEngMceUtils::GetMediaSink( aSession, KMceDisplaySink ) ); |
387 MusEngMceUtils::GetMediaSink( aSession, KMceDisplaySink, preferredSource ) ); |
351 |
388 |
352 } |
389 } |
353 |
390 |
354 |
391 |
355 // ----------------------------------------------------------------------------- |
392 // ----------------------------------------------------------------------------- |
356 // Gets handle to a display sink. |
393 // Gets handle to a display sink. |
357 // ----------------------------------------------------------------------------- |
394 // ----------------------------------------------------------------------------- |
358 // |
395 // |
359 CMceDisplaySink* MusEngMceUtils::GetDisplayL( CMceSession& aSession ) |
396 CMceDisplaySink* MusEngMceUtils::GetDisplayL( |
|
397 CMceSession& aSession, TBool aPreferViewFinder ) |
360 { |
398 { |
361 MUS_LOG( "mus: [ENGINE] -> MusEngMceUtils::GetDisplayL()" ) |
399 MUS_LOG( "mus: [ENGINE] -> MusEngMceUtils::GetDisplayL()" ) |
362 |
400 |
363 CMceDisplaySink* display = MusEngMceUtils::GetDisplay( aSession ); |
401 CMceDisplaySink* display = MusEngMceUtils::GetDisplay( aSession, aPreferViewFinder ); |
364 |
402 |
365 __ASSERT_ALWAYS( display, User::Leave( KErrNotFound ) ); |
403 __ASSERT_ALWAYS( display, User::Leave( KErrNotFound ) ); |
366 |
404 |
367 MUS_LOG( "mus: [ENGINE] <- MusEngMceUtils::GetDisplayL()" ) |
405 MUS_LOG( "mus: [ENGINE] <- MusEngMceUtils::GetDisplayL()" ) |
368 return display; |
406 return display; |
369 } |
407 } |
370 |
408 |
|
409 // ----------------------------------------------------------------------------- |
|
410 // Gets handle to a display sink displaying received video. |
|
411 // ----------------------------------------------------------------------------- |
|
412 // |
|
413 CMceDisplaySink* MusEngMceUtils::GetReceivingDisplay( CMceSession& aSession ) |
|
414 { |
|
415 MUS_LOG( "mus: [ENGINE] -> MusEngMceUtils::GetReceivingDisplay()" ) |
|
416 MUS_LOG( "mus: [ENGINE] <- MusEngMceUtils::GetReceivingDisplay()" ) |
|
417 |
|
418 // Search display which is connected with rtp source |
|
419 TMceSourceType preferredSource = KMceRTPSource; |
|
420 return static_cast<CMceDisplaySink*>( MusEngMceUtils::GetMediaSink( |
|
421 aSession, KMceDisplaySink, preferredSource, ETrue ) ); |
|
422 } |
|
423 |
|
424 // ----------------------------------------------------------------------------- |
|
425 // Gets handle to a display sink displaying received video. |
|
426 // ----------------------------------------------------------------------------- |
|
427 // |
|
428 CMceDisplaySink* MusEngMceUtils::GetReceivingDisplayL( CMceSession& aSession ) |
|
429 { |
|
430 MUS_LOG( "mus: [ENGINE] -> MusEngMceUtils::GetReceivingDisplayL()" ) |
|
431 |
|
432 CMceDisplaySink* display = GetReceivingDisplay( aSession ); |
|
433 __ASSERT_ALWAYS( display != NULL, User::Leave( KErrNotFound ) ); |
|
434 |
|
435 MUS_LOG( "mus: [ENGINE] <- MusEngMceUtils::GetReceivingDisplay()" ) |
|
436 |
|
437 return display; |
|
438 } |
|
439 |
|
440 // ----------------------------------------------------------------------------- |
|
441 // Gets handle to a display sink displaying viewfinder content. |
|
442 // ----------------------------------------------------------------------------- |
|
443 // |
|
444 CMceDisplaySink* MusEngMceUtils::GetVfDisplay( CMceSession& aSession ) |
|
445 { |
|
446 MUS_LOG( "mus: [ENGINE] -> MusEngMceUtils::GetVfDisplay()" ) |
|
447 MUS_LOG( "mus: [ENGINE] <- MusEngMceUtils::GetVfDisplay()" ) |
|
448 |
|
449 // Search display which is connected with camera |
|
450 TMceSourceType preferredSource = KMceCameraSource; |
|
451 return static_cast<CMceDisplaySink*>( MusEngMceUtils::GetMediaSink( |
|
452 aSession, KMceDisplaySink, preferredSource, ETrue ) ); |
|
453 } |
371 |
454 |
372 // ----------------------------------------------------------------------------- |
455 // ----------------------------------------------------------------------------- |
373 // Adds display sink to specified stream if one does not exist already. |
456 // Adds display sink to specified stream if one does not exist already. |
374 // Display rect is set in both cases. |
457 // Display rect is set in both cases. |
375 // ----------------------------------------------------------------------------- |
458 // ----------------------------------------------------------------------------- |
376 // |
459 // |
377 void MusEngMceUtils::AddDisplayL( CMceMediaStream& aStream, |
460 void MusEngMceUtils::AddDisplayL( CMceMediaStream& aStream, |
378 CMceManager& aManager, |
461 CMceManager& aManager, |
379 const TRect& aDisplayRect ) |
462 const TRect& aDisplayRect, |
|
463 TBool aDisabled ) |
380 { |
464 { |
381 MUS_LOG( "mus: [ENGINE] -> MusEngMceUtils::AddDisplayL()" ) |
465 MUS_LOG( "mus: [ENGINE] -> MusEngMceUtils::AddDisplayL()" ) |
382 |
466 |
383 __ASSERT_ALWAYS( aStream.Type() == KMceVideo, User::Leave( KErrArgument ) ); |
467 __ASSERT_ALWAYS( aStream.Type() == KMceVideo, User::Leave( KErrArgument ) ); |
384 |
468 |
447 } |
536 } |
448 |
537 |
449 MUS_LOG( "mus: [ENGINE] -> MusEngMceUtils::DisableStreamL()" ) |
538 MUS_LOG( "mus: [ENGINE] -> MusEngMceUtils::DisableStreamL()" ) |
450 } |
539 } |
451 |
540 |
452 |
541 // ----------------------------------------------------------------------------- |
453 |
542 // |
454 |
543 // ----------------------------------------------------------------------------- |
455 |
544 // |
456 |
545 void MusEngMceUtils::DoEnableDisplayL( CMceDisplaySink& aDisplay, TBool aEnable ) |
457 |
546 { |
|
547 MUS_LOG1( "mus: [ENGINE] -> MusEngMceUtils::DoEnableDisplayL() %d", |
|
548 aEnable ) |
|
549 |
|
550 if ( aEnable ) |
|
551 { |
|
552 if ( !aDisplay.IsEnabled() ) |
|
553 { |
|
554 aDisplay.EnableL(); |
|
555 MUS_LOG( " Display enabled" ) |
|
556 } |
|
557 else |
|
558 { |
|
559 MUS_LOG( " Display already enabled, ignore" ) |
|
560 } |
|
561 } |
|
562 else |
|
563 { |
|
564 if ( aDisplay.IsEnabled() ) |
|
565 { |
|
566 aDisplay.DisableL(); |
|
567 MUS_LOG( " Display disabled" ) |
|
568 } |
|
569 else |
|
570 { |
|
571 MUS_LOG( " Display already disabled, ignore" ) |
|
572 } |
|
573 } |
|
574 |
|
575 MUS_LOG( "mus: [ENGINE] <- MusEngMceUtils::DoEnableDisplayL()") |
|
576 } |
|
577 |
|
578 // ----------------------------------------------------------------------------- |
|
579 // |
|
580 // ----------------------------------------------------------------------------- |
|
581 // |
|
582 TInt MusEngMceUtils::EnableInactivityTimer( |
|
583 CMceSession& aSession, |
|
584 TUint32 aInactivityTimeout ) |
|
585 { |
|
586 TInt err( KErrNotFound ); |
|
587 CMceVideoStream* stream = NULL; |
|
588 TRAP_IGNORE( stream = MusEngMceUtils::GetVideoInStreamL( aSession ) ) |
|
589 if ( stream ) |
|
590 { |
|
591 // Instream has always RTP source |
|
592 err = KErrNone; |
|
593 CMceRtpSource* rtpSource = static_cast<CMceRtpSource*>( stream->Source() ); |
|
594 TRAP( err, rtpSource->EnableInactivityTimerL( aInactivityTimeout ) ) |
|
595 } |
|
596 |
|
597 return err; |
|
598 } |
|
599 |
|
600 // End of file |