mmsharing/mmshengine/src/musenglocalvideoplayer.cpp
branchRCL_3
changeset 33 bc78a40cd63c
parent 32 73a1feb507fb
child 35 6c57ef9392d2
equal deleted inserted replaced
32:73a1feb507fb 33:bc78a40cd63c
     1 /*
       
     2 * Copyright (c) 2009 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 // USER
       
    19 #include "musenglocalvideoplayer.h"
       
    20 #include "musengmceutils.h"
       
    21 #include "musengdisplayhandler.h"
       
    22 
       
    23 // SYSTEM
       
    24 #include <mcesession.h>
       
    25 #include <mcevideostream.h>
       
    26 
       
    27 
       
    28 // -----------------------------------------------------------------------------
       
    29 //
       
    30 // -----------------------------------------------------------------------------
       
    31 //
       
    32 CMusEngLocalVideoPlayer::CMusEngLocalVideoPlayer( 
       
    33     MMusEngDisplayHandler& aDisplayHandler,
       
    34     MLcAudioControl& aLcAudioControl ) :
       
    35     CMusEngVideoPlayerBase( aDisplayHandler, aLcAudioControl )
       
    36     {
       
    37     }
       
    38 
       
    39 // -----------------------------------------------------------------------------
       
    40 //
       
    41 // -----------------------------------------------------------------------------
       
    42 //
       
    43 CMusEngLocalVideoPlayer::~CMusEngLocalVideoPlayer()
       
    44     {
       
    45     }
       
    46 
       
    47 // -----------------------------------------------------------------------------
       
    48 // From MLcVideoPlayer
       
    49 // -----------------------------------------------------------------------------
       
    50 //
       
    51 MLcVideoPlayer::TLcVideoPlayerState 
       
    52 CMusEngLocalVideoPlayer::LcVideoPlayerState() const
       
    53     {
       
    54     if ( !iMceSession )
       
    55         {
       
    56         return MLcVideoPlayer::EUnavailable;
       
    57         }
       
    58     CMceVideoStream* stream = NULL;
       
    59     TRAPD( err, stream = MusEngMceUtils::GetVideoOutStreamL( *iMceSession ) )
       
    60     TLcVideoPlayerState playerState = MLcVideoPlayer::EUnavailable;
       
    61     if ( err == KErrNone && stream )
       
    62           {
       
    63           switch ( stream->State() )
       
    64               {
       
    65               case CMceMediaStream::EInitialized:
       
    66                   {
       
    67                   playerState = MLcVideoPlayer::EInit; 
       
    68                   break;
       
    69                   }
       
    70               case CMceMediaStream::EBuffering:
       
    71                   {
       
    72                   playerState = MLcVideoPlayer::EBuffering; 
       
    73                   break;
       
    74                   }
       
    75               case CMceMediaStream::EIdle:
       
    76               case CMceMediaStream::EDisabled:
       
    77                   {
       
    78                   playerState = MLcVideoPlayer::EPaused; 
       
    79                   break;
       
    80                   }
       
    81               case CMceMediaStream::EStreaming:
       
    82                   {
       
    83                   playerState = MLcVideoPlayer::EPlaying; 
       
    84                   break;
       
    85                   }
       
    86               default: // Other MCE stream states: MLcVideoPlayer::EUnavailable
       
    87                  {
       
    88                  break;
       
    89                  }
       
    90               }
       
    91           }
       
    92     return playerState;
       
    93     }
       
    94 
       
    95 
       
    96 // -----------------------------------------------------------------------------
       
    97 // From MLcWindow
       
    98 // -----------------------------------------------------------------------------
       
    99 //
       
   100 void CMusEngLocalVideoPlayer::SetLcWindowRectL( TRect aRect )
       
   101     {
       
   102     iDisplayHandler.SetSecondaryRectL( aRect );
       
   103     }
       
   104 
       
   105 
       
   106 // -----------------------------------------------------------------------------
       
   107 // From MLcWindow
       
   108 // -----------------------------------------------------------------------------
       
   109 //
       
   110 TRect CMusEngLocalVideoPlayer::LcWindowRect()
       
   111     {
       
   112     return iDisplayHandler.SecondaryRect();
       
   113     }