mmsharing/livecommsui/lcui/tsrc/dummymusengineplugin/src/musengmceutils.cpp
branchRCL_3
changeset 33 bc78a40cd63c
parent 32 73a1feb507fb
child 35 6c57ef9392d2
equal deleted inserted replaced
32:73a1feb507fb 33:bc78a40cd63c
     1 /*
       
     2 * Copyright (c) 2005-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:  Utilities to get and set profile used with SWIS.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // USER
       
    21 
       
    22 #include "musengmceutils.h"
       
    23 #include "muslogger.h"
       
    24 
       
    25 // SYSTEM
       
    26 
       
    27 #include <mcesession.h>
       
    28 #include <mcevideostream.h>
       
    29 #include <mceaudiostream.h>
       
    30 #include <mcertpsink.h>
       
    31 #include <mcemediasource.h>
       
    32 #include <mcertpsource.h>
       
    33 #include <mcecamerasource.h>
       
    34 #include <mcedisplaysink.h>
       
    35 #include <mcefilesource.h>
       
    36 #include <mcefilesink.h>
       
    37 #include <mcespeakersink.h>
       
    38 
       
    39 
       
    40 
       
    41 
       
    42 
       
    43 // -----------------------------------------------------------------------------
       
    44 // Tells if parameter stream is a video stream with RTP source
       
    45 // -----------------------------------------------------------------------------
       
    46 //
       
    47 TBool MusEngMceUtils::IsVideoInStream( CMceMediaStream& aStream )
       
    48     {
       
    49     return ( aStream.Type() == KMceVideo &&
       
    50              aStream.Source() && 
       
    51              aStream.Source()->Type() == KMceRTPSource );
       
    52     }
       
    53 
       
    54 // -----------------------------------------------------------------------------
       
    55 // Tells if parameter stream is a video stream with RTP sink
       
    56 // -----------------------------------------------------------------------------
       
    57 //
       
    58 TBool MusEngMceUtils::IsVideoOutStream( CMceMediaStream& aStream )
       
    59     {
       
    60     TBool isOutStream( EFalse );
       
    61     if ( aStream.Type() == KMceVideo )
       
    62         {
       
    63         CMceMediaSink* rtpSink = MusEngMceUtils::GetMediaSink(
       
    64                                                    aStream,
       
    65                                                    KMceRTPSink );
       
    66         
       
    67         isOutStream = ( rtpSink != NULL );
       
    68         }
       
    69     return isOutStream;
       
    70     }
       
    71 
       
    72 // -----------------------------------------------------------------------------
       
    73 // Tells if parameter stream is an audio stream with RTP source
       
    74 // -----------------------------------------------------------------------------
       
    75 //
       
    76 TBool MusEngMceUtils::IsAudioInStream( CMceMediaStream& aStream )
       
    77     {
       
    78     return ( aStream.Type() == KMceAudio &&
       
    79              aStream.Source() && 
       
    80              aStream.Source()->Type() == KMceRTPSource );
       
    81     }
       
    82     
       
    83 
       
    84 // -----------------------------------------------------------------------------
       
    85 // Gets handle to video stream with RTP sink.
       
    86 // -----------------------------------------------------------------------------
       
    87 //
       
    88 CMceVideoStream* MusEngMceUtils::GetVideoOutStreamL( CMceSession& aSession )
       
    89     {
       
    90     MUS_LOG( "mus: [ENGINE]  -> MusEngMceUtils::GetVideoOutStreamL()" )
       
    91 
       
    92     const RPointerArray<CMceMediaStream>& streams = aSession.Streams();
       
    93 
       
    94     CMceVideoStream* videoOut = NULL;
       
    95 
       
    96     for ( TInt i = 0; i < streams.Count(); ++i )
       
    97         {
       
    98         if ( MusEngMceUtils::IsVideoOutStream( *streams[i] ) )      
       
    99             {
       
   100             __ASSERT_ALWAYS( !videoOut, User::Leave( KErrOverflow ) );
       
   101             
       
   102             videoOut = static_cast<CMceVideoStream*>( streams[i] );
       
   103             }
       
   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             }   
       
   114         }
       
   115 
       
   116     __ASSERT_ALWAYS( videoOut, User::Leave( KErrNotFound ) );
       
   117 
       
   118     MUS_LOG( "mus: [ENGINE]  <- MusEngMceUtils::GetVideoOutStreamL()" )
       
   119 
       
   120     return videoOut;
       
   121     }
       
   122 
       
   123 
       
   124 // -----------------------------------------------------------------------------
       
   125 // Gets handle to video stream with RTP source.
       
   126 // -----------------------------------------------------------------------------
       
   127 //
       
   128 CMceVideoStream* MusEngMceUtils::GetVideoInStreamL( CMceSession& aSession )
       
   129     {
       
   130     MUS_LOG( "mus: [ENGINE]  -> MusEngMceUtils::GetVideoInStreamL()" )
       
   131 
       
   132     const RPointerArray<CMceMediaStream>& streams = aSession.Streams();
       
   133 
       
   134     CMceVideoStream* videoIn = NULL;
       
   135 
       
   136     for ( TInt i = 0; i < streams.Count(); ++i )
       
   137         {
       
   138         if ( MusEngMceUtils::IsVideoInStream( *streams[i] ) )
       
   139             
       
   140             {
       
   141             __ASSERT_ALWAYS( !videoIn, User::Leave( KErrOverflow ) );
       
   142 
       
   143             videoIn = static_cast<CMceVideoStream*>( streams[i] );
       
   144             }
       
   145             
       
   146         // Check if bound stream is a video stream with RTP souce.
       
   147         if ( streams[i]->BoundStream() &&
       
   148              MusEngMceUtils::IsVideoInStream( streams[i]->BoundStreamL() ) )
       
   149             {
       
   150             __ASSERT_ALWAYS( !videoIn, User::Leave( KErrOverflow ) );
       
   151 
       
   152             videoIn = static_cast<CMceVideoStream*>( 
       
   153                                     &streams[i]->BoundStreamL() );
       
   154             }       
       
   155         }
       
   156 
       
   157     __ASSERT_ALWAYS( videoIn, User::Leave( KErrNotFound ) );
       
   158 
       
   159     MUS_LOG( "mus: [ENGINE]  <- MusEngMceUtils::GetVideoInStreamL()" )
       
   160 
       
   161     return videoIn;
       
   162     }
       
   163 
       
   164 
       
   165 // -----------------------------------------------------------------------------
       
   166 // Gets handle to video stream with file sink
       
   167 // -----------------------------------------------------------------------------
       
   168 //
       
   169 CMceVideoStream* MusEngMceUtils::GetRecordingStream( CMceSession& aSession )
       
   170     {
       
   171     MUS_LOG( "mus: [ENGINE]  -> MusEngMceUtils::GetRecordingStreamL()" )
       
   172     
       
   173     const RPointerArray<CMceMediaStream>& streams = aSession.Streams();
       
   174 
       
   175     CMceVideoStream* recordingStream = NULL;
       
   176 
       
   177     for ( TInt i = 0; i < streams.Count(); ++i )
       
   178         {
       
   179         if ( streams[i]->Type() == KMceVideo )
       
   180             {
       
   181             if ( MusEngMceUtils::GetMediaSink( *streams[i], KMceFileSink ) )
       
   182                 {
       
   183                 recordingStream = static_cast<CMceVideoStream*>( streams[i] );
       
   184                 }
       
   185             }
       
   186         }
       
   187     
       
   188     MUS_LOG( "mus: [ENGINE]  <- MusEngMceUtils::GetRecordingStreamL()" )
       
   189     
       
   190     return recordingStream;
       
   191     }
       
   192 
       
   193 
       
   194 // -----------------------------------------------------------------------------
       
   195 // Gets handle to a media sink of spesified type contained by a mediastream.
       
   196 // -----------------------------------------------------------------------------
       
   197 //
       
   198 CMceMediaSink* MusEngMceUtils::GetMediaSink( CMceMediaStream& aStream,
       
   199                                              TMceSinkType aType,
       
   200                                              TMceSourceType aAssociatedSourceType )
       
   201     {
       
   202     const RPointerArray<CMceMediaSink>& sinks = aStream.Sinks();
       
   203     for ( TInt i = 0; i < sinks.Count(); ++i )
       
   204         {
       
   205         if ( sinks[i]->Type() == aType && 
       
   206            ( aAssociatedSourceType == KMusEngNoAssociatedSourceType || 
       
   207              aStream.Source()->Type() == aAssociatedSourceType ) )
       
   208             {
       
   209             return sinks[i];
       
   210             }
       
   211         }
       
   212         
       
   213     return NULL;
       
   214     }
       
   215 
       
   216 
       
   217 // -----------------------------------------------------------------------------
       
   218 // Gets handle to a media sink of spesified type contained by a mediastream.
       
   219 // -----------------------------------------------------------------------------
       
   220 //
       
   221 CMceMediaSink* MusEngMceUtils::GetMediaSinkL( CMceMediaStream& aStream,
       
   222                                               TMceSinkType aType,
       
   223                                               TMceSourceType aAssociatedSourceType )
       
   224     {
       
   225 
       
   226     CMceMediaSink* sink = MusEngMceUtils::GetMediaSink( aStream, aType, aAssociatedSourceType );
       
   227 
       
   228     __ASSERT_ALWAYS( sink, User::Leave( KErrNotFound ) );
       
   229 
       
   230     return sink;
       
   231     }
       
   232 
       
   233 
       
   234 // -----------------------------------------------------------------------------
       
   235 // Gets handle to a media sink of spesified type contained by a session.
       
   236 // -----------------------------------------------------------------------------
       
   237 //
       
   238 CMceMediaSink* MusEngMceUtils::GetMediaSink( CMceSession& aSession,
       
   239                                              TMceSinkType aType,
       
   240                                              TMceSourceType aAssociatedSourceType,
       
   241                                              TBool aStrictMatch )
       
   242     {
       
   243     CMceMediaSink* sink = NULL;
       
   244 
       
   245     TRAP_IGNORE( sink = MusEngMceUtils::GetMediaSinkL( 
       
   246             aSession, aType, aAssociatedSourceType, aStrictMatch ) )
       
   247 
       
   248     return sink;
       
   249     }
       
   250 
       
   251 
       
   252 // -----------------------------------------------------------------------------
       
   253 // Gets handle to a media sink of spesified type contained by a session.
       
   254 // -----------------------------------------------------------------------------
       
   255 //
       
   256 CMceMediaSink* MusEngMceUtils::GetMediaSinkL( CMceSession& aSession,
       
   257                                               TMceSinkType aType,
       
   258                                               TMceSourceType aAssociatedSourceType,
       
   259                                               TBool aStrictMatch )
       
   260     {
       
   261     CMceMediaSink* sink = NULL;
       
   262     
       
   263     const RPointerArray<CMceMediaStream>& streams = aSession.Streams();
       
   264 
       
   265     for ( TInt i = 0; i < streams.Count(); ++i )
       
   266         {
       
   267         sink = MusEngMceUtils::GetMediaSink( *streams[i], aType, aAssociatedSourceType );
       
   268         if ( sink )
       
   269             {
       
   270             return sink;
       
   271             }
       
   272         
       
   273         if ( streams[i]->BoundStream() )
       
   274             {
       
   275             sink = MusEngMceUtils::GetMediaSink( streams[i]->BoundStreamL(), 
       
   276                                                  aType,
       
   277                                                  aAssociatedSourceType );
       
   278             if ( sink )
       
   279                 {
       
   280                 return sink;
       
   281                 }
       
   282             }
       
   283         }
       
   284     
       
   285     if ( !sink && aAssociatedSourceType != KMusEngNoAssociatedSourceType && !aStrictMatch )
       
   286         {
       
   287         // No preferred match, try without source preference
       
   288         sink = GetMediaSinkL( aSession, aType );
       
   289         }
       
   290 
       
   291     __ASSERT_ALWAYS( sink, User::Leave( KErrNotFound ) );
       
   292 
       
   293     return sink;
       
   294     }
       
   295 
       
   296 
       
   297 // -----------------------------------------------------------------------------
       
   298 // Gets handle to a speaker sink contained by specified stream or bound stream.
       
   299 // -----------------------------------------------------------------------------
       
   300 //
       
   301 CMceSpeakerSink* MusEngMceUtils::GetSpeaker( CMceMediaStream& aStream )
       
   302     {
       
   303     MUS_LOG( "mus: [ENGINE]  -> MusEngMceUtils::GetSpeaker()" )
       
   304 
       
   305     CMceSpeakerSink* speaker = NULL;
       
   306     
       
   307     if ( aStream.Type() == KMceAudio )
       
   308         {
       
   309         speaker = static_cast<CMceSpeakerSink*>(
       
   310                     MusEngMceUtils::GetMediaSink( aStream, KMceSpeakerSink ) );
       
   311     
       
   312         if ( !speaker && aStream.BoundStream() )
       
   313             {
       
   314             CMceMediaStream* boundStream = NULL;
       
   315             TRAPD( error, boundStream = &aStream.BoundStreamL() )
       
   316             
       
   317             if ( error == KErrNone )
       
   318                 {
       
   319                 speaker = static_cast<CMceSpeakerSink*>(
       
   320                             MusEngMceUtils::GetMediaSink( *boundStream, 
       
   321                                                           KMceSpeakerSink ) );
       
   322                 }
       
   323             }
       
   324         }
       
   325     
       
   326     MUS_LOG( "mus: [ENGINE]  <- MusEngMceUtils::GetSpeaker()" )
       
   327 
       
   328     return speaker;
       
   329     }
       
   330     
       
   331 
       
   332 // -----------------------------------------------------------------------------
       
   333 // Gets handle to a camera source.
       
   334 // -----------------------------------------------------------------------------
       
   335 //
       
   336 CMceCameraSource* MusEngMceUtils::GetCameraL( CMceSession& aSession )
       
   337     {
       
   338     // Camera can be only in out stream
       
   339     MUS_LOG( "mus: [ENGINE]  -> MusEngMceUtils::GetCameraL()" )
       
   340 
       
   341     CMceVideoStream* videoOut = MusEngMceUtils::GetVideoOutStreamL( aSession );
       
   342 
       
   343     if ( !( videoOut->Source() &&
       
   344             videoOut->Source()->Type() == KMceCameraSource ) )
       
   345         {
       
   346         User::Leave( KErrNotFound );
       
   347         }
       
   348 
       
   349     MUS_LOG( "mus: [ENGINE]  <- MusEngMceUtils::GetCameraL()" )
       
   350     return static_cast<CMceCameraSource*>( videoOut->Source() );
       
   351     }
       
   352 
       
   353 
       
   354 // -----------------------------------------------------------------------------
       
   355 // Gets handle to a file source.
       
   356 // -----------------------------------------------------------------------------
       
   357 //
       
   358 CMceFileSource* MusEngMceUtils::GetFileSourceL( CMceSession& aSession )
       
   359     {
       
   360     MUS_LOG( "mus: [ENGINE]  -> MusEngMceUtils::GetFileSourceL()" )
       
   361 
       
   362     CMceVideoStream* videoOut = MusEngMceUtils::GetVideoOutStreamL( aSession );
       
   363 
       
   364     if ( !( videoOut->Source() &&
       
   365             videoOut->Source()->Type() == KMceFileSource ) )
       
   366         {
       
   367         User::Leave( KErrNotFound );
       
   368         }
       
   369 
       
   370     MUS_LOG( "mus: [ENGINE]  <- MusEngMceUtils::GetFileSourceL()" )
       
   371     return static_cast<CMceFileSource*>( videoOut->Source() );
       
   372     }
       
   373 
       
   374 
       
   375 // -----------------------------------------------------------------------------
       
   376 // Gets handle to a display sink.
       
   377 // -----------------------------------------------------------------------------
       
   378 //
       
   379 CMceDisplaySink* MusEngMceUtils::GetDisplay( 
       
   380     CMceSession& aSession, TBool aPreferViewFinder  )
       
   381     {
       
   382     MUS_LOG( "mus: [ENGINE]  -> MusEngMceUtils::GetDisplay()" )
       
   383     MUS_LOG( "mus: [ENGINE]  <- MusEngMceUtils::GetDisplay()" )
       
   384     TMceSourceType preferredSource = 
       
   385         aPreferViewFinder ? KMceCameraSource : KMusEngNoAssociatedSourceType;
       
   386     return static_cast<CMceDisplaySink*>(
       
   387             MusEngMceUtils::GetMediaSink( aSession, KMceDisplaySink, preferredSource ) );
       
   388 
       
   389     }
       
   390 
       
   391 
       
   392 // -----------------------------------------------------------------------------
       
   393 // Gets handle to a display sink.
       
   394 // -----------------------------------------------------------------------------
       
   395 //
       
   396 CMceDisplaySink* MusEngMceUtils::GetDisplayL( 
       
   397     CMceSession& aSession, TBool aPreferViewFinder )
       
   398     {
       
   399     MUS_LOG( "mus: [ENGINE]  -> MusEngMceUtils::GetDisplayL()" )
       
   400 
       
   401     CMceDisplaySink* display = MusEngMceUtils::GetDisplay( aSession, aPreferViewFinder );
       
   402 
       
   403     __ASSERT_ALWAYS( display, User::Leave( KErrNotFound ) );
       
   404 
       
   405     MUS_LOG( "mus: [ENGINE]  <- MusEngMceUtils::GetDisplayL()" )
       
   406     return display;
       
   407     }
       
   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     }
       
   454 
       
   455 // -----------------------------------------------------------------------------
       
   456 // Adds display sink to specified stream if one does not exist already.
       
   457 // Display rect is set in both cases.
       
   458 // -----------------------------------------------------------------------------
       
   459 //
       
   460 void MusEngMceUtils::AddDisplayL( CMceMediaStream& aStream, 
       
   461                                   CMceManager& aManager,
       
   462                                   const TRect& aDisplayRect )
       
   463     {
       
   464     MUS_LOG( "mus: [ENGINE]  -> MusEngMceUtils::AddDisplayL()" )
       
   465     
       
   466     __ASSERT_ALWAYS( aStream.Type() == KMceVideo, User::Leave( KErrArgument ) );
       
   467 
       
   468     CMceDisplaySink* display = static_cast<CMceDisplaySink*>(
       
   469                                     MusEngMceUtils::GetMediaSink( 
       
   470                                                             aStream,
       
   471                                                             KMceDisplaySink ) );
       
   472 
       
   473     if ( !display )
       
   474         {
       
   475         display = CMceDisplaySink::NewLC( aManager );
       
   476         aStream.AddSinkL( display );
       
   477         CleanupStack::Pop( display );
       
   478         }
       
   479 
       
   480     display->SetDisplayRectL( aDisplayRect );
       
   481     
       
   482     MUS_LOG( "mus: [ENGINE]  <- MusEngMceUtils::AddDisplayL()" )
       
   483     }
       
   484 
       
   485 
       
   486 // -----------------------------------------------------------------------------
       
   487 // Adds display sink to specified stream if one does not exist already.
       
   488 // -----------------------------------------------------------------------------
       
   489 //
       
   490 void MusEngMceUtils::AddSpeakerL( CMceMediaStream& aStream )
       
   491     {
       
   492     MUS_LOG( "mus: [ENGINE]  -> MusEngMceUtils::AddSpeakerL()" )
       
   493     
       
   494     __ASSERT_ALWAYS( aStream.Type() == KMceAudio, User::Leave( KErrArgument ) );
       
   495 
       
   496     CMceSpeakerSink* speaker = static_cast<CMceSpeakerSink*>(
       
   497                                     MusEngMceUtils::GetMediaSink( 
       
   498                                                             aStream,
       
   499                                                             KMceSpeakerSink ) );
       
   500 
       
   501     if ( !speaker )
       
   502         {
       
   503         speaker = CMceSpeakerSink::NewLC();
       
   504         aStream.AddSinkL( speaker );
       
   505         CleanupStack::Pop( speaker );
       
   506         }
       
   507     
       
   508     MUS_LOG( "mus: [ENGINE]  <- MusEngMceUtils::AddSpeakerL()" )
       
   509     }
       
   510 
       
   511 
       
   512 // -----------------------------------------------------------------------------
       
   513 // Disables parameter stream, its' source and all the sinks.
       
   514 // -----------------------------------------------------------------------------
       
   515 //
       
   516 void MusEngMceUtils::DisableStreamL( CMceMediaStream& aStream )
       
   517     {
       
   518     MUS_LOG( "mus: [ENGINE]  -> MusEngMceUtils::DisableStreamL()" )
       
   519     
       
   520     aStream.DisableL();
       
   521     
       
   522     if ( aStream.Source() )
       
   523         {
       
   524         aStream.Source()->DisableL();
       
   525         }
       
   526         
       
   527     for ( TInt sinkIndex = 0; sinkIndex < aStream.Sinks().Count(); ++sinkIndex )
       
   528         {
       
   529         aStream.Sinks()[ sinkIndex ]->DisableL();
       
   530         }
       
   531         
       
   532     MUS_LOG( "mus: [ENGINE]  -> MusEngMceUtils::DisableStreamL()" )
       
   533     }
       
   534 
       
   535 // -----------------------------------------------------------------------------
       
   536 // 
       
   537 // -----------------------------------------------------------------------------
       
   538 //
       
   539 void MusEngMceUtils::DoEnableDisplayL( CMceDisplaySink& aDisplay, TBool aEnable )
       
   540     {
       
   541     MUS_LOG1( "mus: [ENGINE]     -> MusEngMceUtils::DoEnableDisplayL() %d", 
       
   542               aEnable )
       
   543     
       
   544     if ( aEnable )
       
   545         {
       
   546         if ( !aDisplay.IsEnabled() )
       
   547             {
       
   548             aDisplay.EnableL();
       
   549             MUS_LOG( "                  Display enabled" )
       
   550             }
       
   551         else
       
   552             {
       
   553             MUS_LOG( "                  Display already enabled, ignore" )
       
   554             }
       
   555         }
       
   556     else
       
   557         {
       
   558         if ( aDisplay.IsEnabled() )
       
   559             {
       
   560             aDisplay.DisableL();
       
   561             MUS_LOG( "                  Display disabled" )
       
   562             }
       
   563         else
       
   564             {
       
   565             MUS_LOG( "                  Display already disabled, ignore" )
       
   566             }
       
   567         }  
       
   568         
       
   569     MUS_LOG( "mus: [ENGINE]  <- MusEngMceUtils::DoEnableDisplayL()")
       
   570     }
       
   571 
       
   572 // -----------------------------------------------------------------------------
       
   573 // 
       
   574 // -----------------------------------------------------------------------------
       
   575 //
       
   576 TInt MusEngMceUtils::EnableInactivityTimer( 
       
   577     CMceSession& aSession, 
       
   578     TUint32 aInactivityTimeout )
       
   579     {
       
   580     TInt err( KErrNotFound );
       
   581     CMceVideoStream* stream = NULL;
       
   582     TRAP_IGNORE( stream = MusEngMceUtils::GetVideoInStreamL( aSession ) )
       
   583     if ( stream )
       
   584         {
       
   585         // Instream has always RTP source
       
   586         err = KErrNone;
       
   587         CMceRtpSource* rtpSource = static_cast<CMceRtpSource*>( stream->Source() );
       
   588         TRAP( err, rtpSource->EnableInactivityTimerL( aInactivityTimeout ) ) 
       
   589         }
       
   590     
       
   591     return err;
       
   592     }
       
   593       
       
   594 // End of file