diff -r 73a1feb507fb -r bc78a40cd63c mmsharing/mmshengine/src/musengmceutils.cpp --- a/mmsharing/mmshengine/src/musengmceutils.cpp Tue Aug 31 15:12:07 2010 +0300 +++ b/mmsharing/mmshengine/src/musengmceutils.cpp Wed Sep 01 12:31:01 2010 +0100 @@ -51,23 +51,6 @@ aStream.Source()->Type() == KMceRTPSource ); } -// ----------------------------------------------------------------------------- -// Tells if parameter stream is a video stream with RTP sink -// ----------------------------------------------------------------------------- -// -TBool MusEngMceUtils::IsVideoOutStream( CMceMediaStream& aStream ) - { - TBool isOutStream( EFalse ); - if ( aStream.Type() == KMceVideo ) - { - CMceMediaSink* rtpSink = MusEngMceUtils::GetMediaSink( - aStream, - KMceRTPSink ); - - isOutStream = ( rtpSink != NULL ); - } - return isOutStream; - } // ----------------------------------------------------------------------------- // Tells if parameter stream is an audio stream with RTP source @@ -95,22 +78,21 @@ for ( TInt i = 0; i < streams.Count(); ++i ) { - if ( MusEngMceUtils::IsVideoOutStream( *streams[i] ) ) + if ( streams[i]->Type() == KMceVideo ) { - __ASSERT_ALWAYS( !videoOut, User::Leave( KErrOverflow ) ); - - videoOut = static_cast( streams[i] ); - } + CMceMediaSink* rtpSink = MusEngMceUtils::GetMediaSink( + *streams[i], + KMceRTPSink ); + if ( rtpSink ) + { + __ASSERT_ALWAYS( !videoOut, User::Leave( KErrOverflow ) ); + + videoOut = static_cast( streams[i] ); + } - // Check if bound stream is a video stream with RTP sink. - if ( streams[i]->BoundStream() && - MusEngMceUtils::IsVideoOutStream( streams[i]->BoundStreamL() ) ) - { - __ASSERT_ALWAYS( !videoOut, User::Leave( KErrOverflow ) ); - - videoOut = static_cast( - &streams[i]->BoundStreamL() ); - } + // There is no need to investigate bound stream since + // outstream is always constructed by Mus instead of MCE + } } __ASSERT_ALWAYS( videoOut, User::Leave( KErrNotFound ) ); @@ -196,15 +178,12 @@ // ----------------------------------------------------------------------------- // CMceMediaSink* MusEngMceUtils::GetMediaSink( CMceMediaStream& aStream, - TMceSinkType aType, - TMceSourceType aAssociatedSourceType ) + TMceSinkType aType ) { const RPointerArray& sinks = aStream.Sinks(); for ( TInt i = 0; i < sinks.Count(); ++i ) { - if ( sinks[i]->Type() == aType && - ( aAssociatedSourceType == KMusEngNoAssociatedSourceType || - aStream.Source()->Type() == aAssociatedSourceType ) ) + if ( sinks[i]->Type() == aType ) { return sinks[i]; } @@ -219,11 +198,10 @@ // ----------------------------------------------------------------------------- // CMceMediaSink* MusEngMceUtils::GetMediaSinkL( CMceMediaStream& aStream, - TMceSinkType aType, - TMceSourceType aAssociatedSourceType ) + TMceSinkType aType ) { - CMceMediaSink* sink = MusEngMceUtils::GetMediaSink( aStream, aType, aAssociatedSourceType ); + CMceMediaSink* sink = MusEngMceUtils::GetMediaSink( aStream, aType ); __ASSERT_ALWAYS( sink, User::Leave( KErrNotFound ) ); @@ -236,14 +214,11 @@ // ----------------------------------------------------------------------------- // CMceMediaSink* MusEngMceUtils::GetMediaSink( CMceSession& aSession, - TMceSinkType aType, - TMceSourceType aAssociatedSourceType, - TBool aStrictMatch ) + TMceSinkType aType ) { CMceMediaSink* sink = NULL; - TRAP_IGNORE( sink = MusEngMceUtils::GetMediaSinkL( - aSession, aType, aAssociatedSourceType, aStrictMatch ) ) + TRAP_IGNORE( sink = MusEngMceUtils::GetMediaSinkL( aSession, aType ) ) return sink; } @@ -254,9 +229,7 @@ // ----------------------------------------------------------------------------- // CMceMediaSink* MusEngMceUtils::GetMediaSinkL( CMceSession& aSession, - TMceSinkType aType, - TMceSourceType aAssociatedSourceType, - TBool aStrictMatch ) + TMceSinkType aType ) { CMceMediaSink* sink = NULL; @@ -264,7 +237,7 @@ for ( TInt i = 0; i < streams.Count(); ++i ) { - sink = MusEngMceUtils::GetMediaSink( *streams[i], aType, aAssociatedSourceType ); + sink = MusEngMceUtils::GetMediaSink( *streams[i], aType ); if ( sink ) { return sink; @@ -273,20 +246,13 @@ if ( streams[i]->BoundStream() ) { sink = MusEngMceUtils::GetMediaSink( streams[i]->BoundStreamL(), - aType, - aAssociatedSourceType ); + aType ); if ( sink ) { return sink; } } } - - if ( !sink && aAssociatedSourceType != KMusEngNoAssociatedSourceType && !aStrictMatch ) - { - // No preferred match, try without source preference - sink = GetMediaSinkL( aSession, aType ); - } __ASSERT_ALWAYS( sink, User::Leave( KErrNotFound ) ); @@ -376,15 +342,12 @@ // Gets handle to a display sink. // ----------------------------------------------------------------------------- // -CMceDisplaySink* MusEngMceUtils::GetDisplay( - CMceSession& aSession, TBool aPreferViewFinder ) +CMceDisplaySink* MusEngMceUtils::GetDisplay( CMceSession& aSession ) { MUS_LOG( "mus: [ENGINE] -> MusEngMceUtils::GetDisplay()" ) MUS_LOG( "mus: [ENGINE] <- MusEngMceUtils::GetDisplay()" ) - TMceSourceType preferredSource = - aPreferViewFinder ? KMceCameraSource : KMusEngNoAssociatedSourceType; return static_cast( - MusEngMceUtils::GetMediaSink( aSession, KMceDisplaySink, preferredSource ) ); + MusEngMceUtils::GetMediaSink( aSession, KMceDisplaySink ) ); } @@ -393,12 +356,11 @@ // Gets handle to a display sink. // ----------------------------------------------------------------------------- // -CMceDisplaySink* MusEngMceUtils::GetDisplayL( - CMceSession& aSession, TBool aPreferViewFinder ) +CMceDisplaySink* MusEngMceUtils::GetDisplayL( CMceSession& aSession ) { MUS_LOG( "mus: [ENGINE] -> MusEngMceUtils::GetDisplayL()" ) - CMceDisplaySink* display = MusEngMceUtils::GetDisplay( aSession, aPreferViewFinder ); + CMceDisplaySink* display = MusEngMceUtils::GetDisplay( aSession ); __ASSERT_ALWAYS( display, User::Leave( KErrNotFound ) ); @@ -406,51 +368,6 @@ return display; } -// ----------------------------------------------------------------------------- -// Gets handle to a display sink displaying received video. -// ----------------------------------------------------------------------------- -// -CMceDisplaySink* MusEngMceUtils::GetReceivingDisplay( CMceSession& aSession ) - { - MUS_LOG( "mus: [ENGINE] -> MusEngMceUtils::GetReceivingDisplay()" ) - MUS_LOG( "mus: [ENGINE] <- MusEngMceUtils::GetReceivingDisplay()" ) - - // Search display which is connected with rtp source - TMceSourceType preferredSource = KMceRTPSource; - return static_cast( MusEngMceUtils::GetMediaSink( - aSession, KMceDisplaySink, preferredSource, ETrue ) ); - } - -// ----------------------------------------------------------------------------- -// Gets handle to a display sink displaying received video. -// ----------------------------------------------------------------------------- -// -CMceDisplaySink* MusEngMceUtils::GetReceivingDisplayL( CMceSession& aSession ) - { - MUS_LOG( "mus: [ENGINE] -> MusEngMceUtils::GetReceivingDisplayL()" ) - - CMceDisplaySink* display = GetReceivingDisplay( aSession ); - __ASSERT_ALWAYS( display != NULL, User::Leave( KErrNotFound ) ); - - MUS_LOG( "mus: [ENGINE] <- MusEngMceUtils::GetReceivingDisplay()" ) - - return display; - } - -// ----------------------------------------------------------------------------- -// Gets handle to a display sink displaying viewfinder content. -// ----------------------------------------------------------------------------- -// -CMceDisplaySink* MusEngMceUtils::GetVfDisplay( CMceSession& aSession ) - { - MUS_LOG( "mus: [ENGINE] -> MusEngMceUtils::GetVfDisplay()" ) - MUS_LOG( "mus: [ENGINE] <- MusEngMceUtils::GetVfDisplay()" ) - - // Search display which is connected with camera - TMceSourceType preferredSource = KMceCameraSource; - return static_cast( MusEngMceUtils::GetMediaSink( - aSession, KMceDisplaySink, preferredSource, ETrue ) ); - } // ----------------------------------------------------------------------------- // Adds display sink to specified stream if one does not exist already. @@ -459,8 +376,7 @@ // void MusEngMceUtils::AddDisplayL( CMceMediaStream& aStream, CMceManager& aManager, - const TRect& aDisplayRect, - TBool aDisabled ) + const TRect& aDisplayRect ) { MUS_LOG( "mus: [ENGINE] -> MusEngMceUtils::AddDisplayL()" ) @@ -478,11 +394,6 @@ CleanupStack::Pop( display ); } - if ( aDisabled ) - { - MUS_LOG( "mus: [ENGINE] Initially disabled display" ) - display->DisableL(); - } display->SetDisplayRectL( aDisplayRect ); MUS_LOG( "mus: [ENGINE] <- MusEngMceUtils::AddDisplayL()" ) @@ -538,63 +449,9 @@ MUS_LOG( "mus: [ENGINE] -> MusEngMceUtils::DisableStreamL()" ) } -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void MusEngMceUtils::DoEnableDisplayL( CMceDisplaySink& aDisplay, TBool aEnable ) - { - MUS_LOG1( "mus: [ENGINE] -> MusEngMceUtils::DoEnableDisplayL() %d", - aEnable ) - - if ( aEnable ) - { - if ( !aDisplay.IsEnabled() ) - { - aDisplay.EnableL(); - MUS_LOG( " Display enabled" ) - } - else - { - MUS_LOG( " Display already enabled, ignore" ) - } - } - else - { - if ( aDisplay.IsEnabled() ) - { - aDisplay.DisableL(); - MUS_LOG( " Display disabled" ) - } - else - { - MUS_LOG( " Display already disabled, ignore" ) - } - } - - MUS_LOG( "mus: [ENGINE] <- MusEngMceUtils::DoEnableDisplayL()") - } + + -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -TInt MusEngMceUtils::EnableInactivityTimer( - CMceSession& aSession, - TUint32 aInactivityTimeout ) - { - TInt err( KErrNotFound ); - CMceVideoStream* stream = NULL; - TRAP_IGNORE( stream = MusEngMceUtils::GetVideoInStreamL( aSession ) ) - if ( stream ) - { - // Instream has always RTP source - err = KErrNone; - CMceRtpSource* rtpSource = static_cast( stream->Source() ); - TRAP( err, rtpSource->EnableInactivityTimerL( aInactivityTimeout ) ) - } - - return err; - } - -// End of file + + +