vtuis/lcvtplugin/src/control/clcvtlocalvideoplayer.cpp
branchRCL_3
changeset 24 f15ac8e65a02
equal deleted inserted replaced
23:890b5dd735f8 24:f15ac8e65a02
       
     1 /*
       
     2 * Copyright (c) 2008 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:  LiveComm Videotelephony's Local Video Player
       
    15 *
       
    16 */
       
    17 
       
    18 #include "clcvtlocalvideoplayer.h"
       
    19 #include "tlcvtcamerahandler.h"
       
    20 #include "lcvtplugincommand.h"
       
    21 
       
    22 // -----------------------------------------------------------------------------
       
    23 //
       
    24 // -----------------------------------------------------------------------------
       
    25 //
       
    26 
       
    27 CLcVtLocalVideoPlayer* CLcVtLocalVideoPlayer::NewL( 
       
    28     CLcVtSession* avtSession,
       
    29     MLcAudioControl& aLcAudioControl,
       
    30     TVtCameraHandler& aCameraHandler)
       
    31     {
       
    32     CLcVtLocalVideoPlayer* self = 
       
    33         new( ELeave )CLcVtLocalVideoPlayer( 
       
    34             avtSession,
       
    35             aLcAudioControl, 
       
    36             aCameraHandler);
       
    37     CleanupStack::PushL( self );
       
    38     self->ConstructL();
       
    39     CleanupStack::Pop( self );
       
    40     return self;
       
    41     }
       
    42 
       
    43 // -----------------------------------------------------------------------------
       
    44 //
       
    45 // -----------------------------------------------------------------------------
       
    46 //
       
    47 CLcVtLocalVideoPlayer::CLcVtLocalVideoPlayer( 
       
    48     CLcVtSession* avtSession,
       
    49     MLcAudioControl& aLcAudioControl,
       
    50     TVtCameraHandler& aCameraHandler) :
       
    51     CLcVtVideoPlayerBase( avtSession, aLcAudioControl ),
       
    52     iCameraHandler( aCameraHandler ) 
       
    53     {
       
    54     iOrientationChanged = EFalse;
       
    55     }
       
    56 
       
    57 // -----------------------------------------------------------------------------
       
    58 //
       
    59 // -----------------------------------------------------------------------------
       
    60 //
       
    61 void CLcVtLocalVideoPlayer::ConstructL()
       
    62     {
       
    63     }
       
    64 
       
    65 // -----------------------------------------------------------------------------
       
    66 //
       
    67 // -----------------------------------------------------------------------------
       
    68 //
       
    69 CLcVtLocalVideoPlayer::~CLcVtLocalVideoPlayer()
       
    70     {
       
    71     }
       
    72 
       
    73 // -----------------------------------------------------------------------------
       
    74 // From MLcVideoPlayer
       
    75 // -----------------------------------------------------------------------------
       
    76 //
       
    77 MLcVideoPlayer::TLcVideoPlayerState 
       
    78 CLcVtLocalVideoPlayer::LcVideoPlayerState() const
       
    79     {
       
    80     TLcVideoPlayerState playerState;
       
    81     if ( ivtSession->LcVtStates().MediaState().IsVideo() )
       
    82         {
       
    83         playerState = MLcVideoPlayer::EPlaying;
       
    84         }
       
    85     else
       
    86         {
       
    87         playerState = MLcVideoPlayer::EPaused;
       
    88         }
       
    89     __VTPRINT2( DEBUG_GEN, "CLcVtLocalVideoPlayer.LcVideoPlayerState = %d", playerState )
       
    90     return playerState;
       
    91     }
       
    92 
       
    93 // -----------------------------------------------------------------------------
       
    94 // From MLcVideoPlayer
       
    95 // -----------------------------------------------------------------------------
       
    96 //
       
    97 TBool CLcVtLocalVideoPlayer::LcIsPlayingL()
       
    98     {         
       
    99     TBool result = (LcVideoPlayerState() == MLcVideoPlayer::EPlaying);
       
   100     __VTPRINT2( DEBUG_GEN, "CLcVtLocalVideoPlayer.LcIsPlayingL = %d", result )
       
   101     return result;
       
   102     }
       
   103 
       
   104 // -----------------------------------------------------------------------------
       
   105 // From MLcVideoPlayer
       
   106 // -----------------------------------------------------------------------------
       
   107 //
       
   108 void CLcVtLocalVideoPlayer::LcPlayL(TLcVideoPlayerSource /*aSource*/)
       
   109     {
       
   110     __VTPRINT( DEBUG_GEN, "CLcVtLocalVideoPlayer.LcPlayL" )
       
   111     ivtSession->HandleCommandL(EPluginCmdEnableVideo);
       
   112     }
       
   113 
       
   114 // -----------------------------------------------------------------------------
       
   115 // From MLcVideoPlayer
       
   116 // -----------------------------------------------------------------------------
       
   117 //
       
   118 void CLcVtLocalVideoPlayer::LcPauseL()
       
   119     {
       
   120     __VTPRINT( DEBUG_GEN, "CLcVtLocalVideoPlayer.LcPauseL" )
       
   121     ivtSession->HandleCommandL(EPluginCmdDisableVideo);
       
   122     }
       
   123 
       
   124 // -----------------------------------------------------------------------------
       
   125 // From MLcVideoPlayer
       
   126 // -----------------------------------------------------------------------------
       
   127 //
       
   128 MLcCameraControl* CLcVtLocalVideoPlayer::LcCameraControl()
       
   129     {
       
   130     return &iCameraHandler;
       
   131     }
       
   132 
       
   133 
       
   134 // -----------------------------------------------------------------------------
       
   135 // From MLcVideoPlayer
       
   136 // -----------------------------------------------------------------------------
       
   137 //
       
   138 MLcZoomControl* CLcVtLocalVideoPlayer::LcZoomControl()
       
   139     {
       
   140     return &iCameraHandler;
       
   141     }
       
   142 
       
   143 // -----------------------------------------------------------------------------
       
   144 // From MLcVideoPlayer
       
   145 // -----------------------------------------------------------------------------
       
   146 //
       
   147 MLcBrightnessControl* CLcVtLocalVideoPlayer::LcBrightnessControl()
       
   148     {
       
   149     return &iCameraHandler;
       
   150     }
       
   151 
       
   152 // -----------------------------------------------------------------------------
       
   153 // From MLcWindow
       
   154 // -----------------------------------------------------------------------------
       
   155 //
       
   156 void CLcVtLocalVideoPlayer::SetLcWindowRectL( TRect aRect )
       
   157     {
       
   158     __VTPRINT2( DEBUG_MEDIA , "    LocalVideoPlayer.RMRect.iTl.iX: %d", aRect.iTl.iX )
       
   159     __VTPRINT2( DEBUG_MEDIA , "    LocalVideoPlayer.RMRect.iTl.iY: %d", aRect.iTl.iY )
       
   160     __VTPRINT2( DEBUG_MEDIA , "    LocalVideoPlayer.RMRect.iWidth: %d", aRect.Width() )
       
   161     __VTPRINT2( DEBUG_MEDIA , "    LocalVideoPlayer.RMRect.iHeight: %d", aRect.Height() ) 
       
   162     
       
   163     CLcVtVideoPlayerBase::SetLcWindowRectL( aRect );    
       
   164     }
       
   165 
       
   166 // -----------------------------------------------------------------------------
       
   167 // From MLcWindow
       
   168 // -----------------------------------------------------------------------------
       
   169 //
       
   170 void CLcVtLocalVideoPlayer::SetLcWindowOrientationL( TLcWindowOrientation aOrientation )
       
   171     {    
       
   172     __VTPRINT2( DEBUG_MEDIA , "CLcVtLocalVideoPlayer.SetLcWindowOrientationL: %d", aOrientation ) 
       
   173     iOrientationChanged = EFalse;    
       
   174     if( aOrientation != iWindowOrientation )
       
   175         iOrientationChanged = ETrue;    
       
   176     CLcVtVideoPlayerBase::SetLcWindowOrientationL( aOrientation );    
       
   177     }
       
   178 
       
   179 TBool CLcVtLocalVideoPlayer::IsOrientationChanged()
       
   180     {
       
   181     return iOrientationChanged;
       
   182     }