mmsharing/livecommsui/lcuiengine/tsrc/ut_lcuieng/lcstub/src/lcvideoplayerstub.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 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 
       
    19 // USER
       
    20 #include "lcenginestub.h"
       
    21 #include "lcvideoplayerstub.h"
       
    22 #include "lcvideoplayer.h"
       
    23 #include "lcaudiocontrol.h"
       
    24 #include "lccameracontrol.h"
       
    25 #include "lczoomcontrol.h"
       
    26 #include "lcbrightnesscontrol.h"
       
    27 #include "lcsessionstub.h"
       
    28 #include "lcuiprovider.h"
       
    29 
       
    30 #include <QStringList>
       
    31 
       
    32 static QStringList lcutStub_LcPlayer_calledMethods;
       
    33 static bool lcutStub_LcPlayer_asyncCompletionEnabled = false;
       
    34 
       
    35 // -----------------------------------------------------------------------------
       
    36 //
       
    37 // -----------------------------------------------------------------------------
       
    38 //
       
    39 CLcVideoPlayer* CLcVideoPlayer::NewL()
       
    40     {
       
    41     CLcVideoPlayer* self = new( ELeave )CLcVideoPlayer();
       
    42     CleanupStack::PushL( self );
       
    43     self->ConstructL();
       
    44     CleanupStack::Pop( self );
       
    45     return self;
       
    46     } 
       
    47 // -----------------------------------------------------------------------------
       
    48 //
       
    49 // -----------------------------------------------------------------------------
       
    50 //
       
    51 CLcVideoPlayer::CLcVideoPlayer()
       
    52     : iRect( TRect(10,10,50,100))
       
    53     {
       
    54     }
       
    55 
       
    56 
       
    57 // -----------------------------------------------------------------------------
       
    58 //
       
    59 // -----------------------------------------------------------------------------
       
    60 //
       
    61 void CLcVideoPlayer::ConstructL()
       
    62     {
       
    63     
       
    64     }
       
    65 
       
    66 // -----------------------------------------------------------------------------
       
    67 //
       
    68 // -----------------------------------------------------------------------------
       
    69 //
       
    70 CLcVideoPlayer::~CLcVideoPlayer()
       
    71     {
       
    72     }
       
    73 
       
    74 // -----------------------------------------------------------------------------
       
    75 // From MLcVideoPlayer
       
    76 // -----------------------------------------------------------------------------
       
    77 //
       
    78 MLcVideoPlayer::TLcVideoPlayerState CLcVideoPlayer::LcVideoPlayerState() const
       
    79     {
       
    80     return iState;
       
    81     }
       
    82 // -----------------------------------------------------------------------------
       
    83 // From MLcVideoPlayer
       
    84 // -----------------------------------------------------------------------------
       
    85 //
       
    86 TBool CLcVideoPlayer::LcIsPlayingL()
       
    87     {
       
    88     User::LeaveIfError( lcutStub_LcEngine_failure() );
       
    89     return iPlaying;
       
    90     }
       
    91 
       
    92 // -----------------------------------------------------------------------------
       
    93 // From MLcVideoPlayer
       
    94 // -----------------------------------------------------------------------------
       
    95 //
       
    96 void CLcVideoPlayer::LcPlayL(TLcVideoPlayerSource /*aSource*/)
       
    97     {
       
    98     User::LeaveIfError( lcutStub_LcEngine_failure() );
       
    99     iPlaying = ETrue;
       
   100     iState = MLcVideoPlayer::EPlaying;
       
   101     lcutStub_LcPlayer_calledMethods.insert(0,lcutStub_LcPlayer_LcPlayL );
       
   102     }
       
   103 
       
   104 // -----------------------------------------------------------------------------
       
   105 // From MLcVideoPlayer
       
   106 // -----------------------------------------------------------------------------
       
   107 //
       
   108 void CLcVideoPlayer::LcPauseL()
       
   109     {
       
   110     User::LeaveIfError( lcutStub_LcEngine_failure() );
       
   111     iPlaying = EFalse;
       
   112     iState = MLcVideoPlayer::EPaused;
       
   113     lcutStub_LcPlayer_calledMethods.insert(0,lcutStub_LcPlayer_LcPauseL );
       
   114     }
       
   115 
       
   116 // -----------------------------------------------------------------------------
       
   117 // From MLcVideoPlayer
       
   118 // -----------------------------------------------------------------------------
       
   119 //
       
   120 MLcWindow* CLcVideoPlayer::LcWindow()
       
   121     {
       
   122     return this;
       
   123     }
       
   124 
       
   125 // -----------------------------------------------------------------------------
       
   126 // From MLcVideoPlayer
       
   127 // -----------------------------------------------------------------------------
       
   128 // 
       
   129 MLcCameraControl* CLcVideoPlayer::LcCameraControl()
       
   130     {
       
   131     return this;
       
   132     }
       
   133 
       
   134 // -----------------------------------------------------------------------------
       
   135 // From MLcVideoPlayer
       
   136 // -----------------------------------------------------------------------------
       
   137 //
       
   138 MLcSourceFileControl* CLcVideoPlayer::LcSourceFileControl()
       
   139     {
       
   140     return NULL;
       
   141     }
       
   142 
       
   143 // -----------------------------------------------------------------------------
       
   144 // From MLcVideoPlayer
       
   145 // -----------------------------------------------------------------------------
       
   146 //
       
   147 MLcDestinationFileControl* CLcVideoPlayer::LcDestinationFileControl()
       
   148     {
       
   149     return NULL;
       
   150     }
       
   151 // -----------------------------------------------------------------------------
       
   152 // From MLcVideoPlayer
       
   153 // -----------------------------------------------------------------------------
       
   154 //
       
   155 MLcAudioControl* CLcVideoPlayer::LcAudioControl()
       
   156     {
       
   157     return this;
       
   158     }
       
   159 
       
   160 // -----------------------------------------------------------------------------
       
   161 // From MLcVideoPlayer
       
   162 // -----------------------------------------------------------------------------
       
   163 //
       
   164 MLcZoomControl* CLcVideoPlayer::LcZoomControl()
       
   165     {
       
   166     return this;
       
   167     }
       
   168 
       
   169 // -----------------------------------------------------------------------------
       
   170 // From MLcVideoPlayer
       
   171 // -----------------------------------------------------------------------------
       
   172 //
       
   173 MLcBrightnessControl* CLcVideoPlayer::LcBrightnessControl()
       
   174     {
       
   175     return this;
       
   176     }
       
   177 
       
   178 //-----------------------------------------------------------------------------
       
   179 // From MLcWindow
       
   180 // -----------------------------------------------------------------------------
       
   181 //
       
   182 void CLcVideoPlayer::EnableLcWindowL( TBool aEnable )
       
   183     {
       
   184     User::LeaveIfError( lcutStub_LcEngine_failure() );
       
   185     iWindowEnabled = aEnable;
       
   186     lcutStub_LcPlayer_calledMethods.insert(0,lcutStub_LcPlayer_EnableLcWindowL );
       
   187     }
       
   188 
       
   189 // -----------------------------------------------------------------------------
       
   190 // From MLcWindow
       
   191 // -----------------------------------------------------------------------------
       
   192 //
       
   193 TBool CLcVideoPlayer::IsLcWindowEnabled()
       
   194     {
       
   195     return iWindowEnabled;
       
   196     }
       
   197 
       
   198 // -----------------------------------------------------------------------------
       
   199 // From MLcWindow
       
   200 // -----------------------------------------------------------------------------
       
   201 //
       
   202 void CLcVideoPlayer::SetLcWindowRectL( TRect aRect )
       
   203     {
       
   204     User::LeaveIfError( lcutStub_LcEngine_failure() );
       
   205     iRect = aRect;
       
   206     lcutStub_LcPlayer_calledMethods.insert(0,lcutStub_LcPlayer_SetLcWindowRectL );
       
   207     }
       
   208 
       
   209 // -----------------------------------------------------------------------------
       
   210 // From MLcWindow
       
   211 // -----------------------------------------------------------------------------
       
   212 //
       
   213 TRect CLcVideoPlayer::LcWindowRect()
       
   214     {
       
   215     return iRect;
       
   216     }
       
   217 
       
   218 // -----------------------------------------------------------------------------
       
   219 // From MLcWindow
       
   220 // -----------------------------------------------------------------------------
       
   221 //
       
   222 void CLcVideoPlayer::SetLcWindowOrientationL( 
       
   223     TLcWindowOrientation aOrientation )
       
   224     {
       
   225     User::LeaveIfError( lcutStub_LcEngine_failure() );
       
   226     iOrientation = aOrientation;
       
   227     lcutStub_LcPlayer_calledMethods.insert(0,lcutStub_LcPlayer_SetLcWindowOrientationL );
       
   228     }
       
   229 
       
   230 // -----------------------------------------------------------------------------
       
   231 // From MLcWindow
       
   232 // -----------------------------------------------------------------------------
       
   233 //
       
   234 MLcWindow::TLcWindowOrientation CLcVideoPlayer::LcWindowOrientationL()
       
   235     {
       
   236     User::LeaveIfError( lcutStub_LcEngine_failure() );
       
   237     MLcWindow::TLcWindowOrientation orientation;
       
   238     if ( iOrientation == ELandscape )
       
   239         {
       
   240         orientation = MLcWindow::ELandscape;
       
   241         }
       
   242     else
       
   243         {
       
   244         orientation = MLcWindow::EPortrait;
       
   245         }
       
   246     return orientation;
       
   247     }
       
   248 // -----------------------------------------------------------------------------
       
   249 // From MLcAudioControl
       
   250 // -----------------------------------------------------------------------------
       
   251 //
       
   252 TBool CLcVideoPlayer::IsLcAudioMutedL()
       
   253     {
       
   254     User::LeaveIfError( lcutStub_LcEngine_failure() );
       
   255     return iMuted;
       
   256     }
       
   257 
       
   258 // -----------------------------------------------------------------------------
       
   259 // From MLcAudioControl
       
   260 // -----------------------------------------------------------------------------
       
   261 //
       
   262 void CLcVideoPlayer::MuteLcAudioL( TBool aMute )
       
   263     {
       
   264     User::LeaveIfError( lcutStub_LcEngine_failure() );
       
   265     lcutStub_LcPlayer_calledMethods.insert(0,lcutStub_LcPlayer_MuteLcAudioL );
       
   266     iMuted = aMute;
       
   267     }
       
   268 
       
   269 // -----------------------------------------------------------------------------
       
   270 // From MLcAudioControl
       
   271 // -----------------------------------------------------------------------------
       
   272 //
       
   273 TBool CLcVideoPlayer::IsEnablingLcLoudspeakerAllowed()
       
   274     {
       
   275     return iEnablingLoudspeakerAllowed;
       
   276     }
       
   277 
       
   278 // -----------------------------------------------------------------------------
       
   279 // From MLcAudioControl
       
   280 // -----------------------------------------------------------------------------
       
   281 //
       
   282 TBool CLcVideoPlayer::IsLcMicMutedL()
       
   283     {
       
   284     User::LeaveIfError( lcutStub_LcEngine_failure() );
       
   285     return iMicMuted;
       
   286     }
       
   287 
       
   288 // -----------------------------------------------------------------------------
       
   289 // From MLcAudioControl
       
   290 // -----------------------------------------------------------------------------
       
   291 //
       
   292 void CLcVideoPlayer::MuteLcMicL( TBool aMute )
       
   293     {
       
   294     User::LeaveIfError( lcutStub_LcEngine_failure() );
       
   295     lcutStub_LcPlayer_calledMethods.insert(0,lcutStub_LcPlayer_MuteLcMicL );
       
   296     iMicMuted = aMute;
       
   297     
       
   298     if ( lcutStub_LcPlayer_asyncCompletionEnabled && 
       
   299          lcutStub_LcSession_lcUiProvider() )
       
   300         {
       
   301         lcutStub_LcSession_lcUiProvider()->BlockUi( ETrue );
       
   302         }
       
   303     }
       
   304 
       
   305 // -----------------------------------------------------------------------------
       
   306 // From MLcAudioControl
       
   307 // -----------------------------------------------------------------------------
       
   308 //
       
   309 TBool CLcVideoPlayer::IsLcLoudspeakerEnabled()
       
   310     {
       
   311     return iLoudspeakerEnabled;
       
   312     }
       
   313 
       
   314 // -----------------------------------------------------------------------------
       
   315 // From MLcAudioControl
       
   316 // -----------------------------------------------------------------------------
       
   317 //
       
   318 void CLcVideoPlayer::EnableLcLoudspeakerL( TBool aEnabled )
       
   319     {
       
   320     User::LeaveIfError( lcutStub_LcEngine_failure() );
       
   321     lcutStub_LcPlayer_calledMethods.insert(0,lcutStub_LcPlayer_EnableLcLoudspeakerL );
       
   322     iLoudspeakerEnabled = aEnabled;
       
   323     
       
   324     if ( lcutStub_LcPlayer_asyncCompletionEnabled && 
       
   325          lcutStub_LcSession_lcUiProvider() )
       
   326         {
       
   327         lcutStub_LcSession_lcUiProvider()->BlockUi( ETrue );
       
   328         }
       
   329     }
       
   330 
       
   331 // -----------------------------------------------------------------------------
       
   332 // From MLcAudioControl
       
   333 // -----------------------------------------------------------------------------
       
   334 //
       
   335 TInt CLcVideoPlayer::LcVolumeL()
       
   336     {
       
   337     User::LeaveIfError( lcutStub_LcEngine_failure() );
       
   338     return iVolume;
       
   339     }
       
   340 
       
   341 // -----------------------------------------------------------------------------
       
   342 // From MLcAudioControl
       
   343 // -----------------------------------------------------------------------------
       
   344 //
       
   345 void CLcVideoPlayer::SetLcVolumeL( TInt aValue )
       
   346     {
       
   347     User::LeaveIfError( lcutStub_LcEngine_failure() );
       
   348     iVolume = aValue;
       
   349     }
       
   350 
       
   351 // -----------------------------------------------------------------------------
       
   352 // From MLcAudioControl
       
   353 // -----------------------------------------------------------------------------
       
   354 //
       
   355 void CLcVideoPlayer::IncreaseLcVolumeL()
       
   356     {
       
   357     User::LeaveIfError( lcutStub_LcEngine_failure() );
       
   358     iVolume++;
       
   359     }
       
   360 
       
   361 // -----------------------------------------------------------------------------
       
   362 // From MLcAudioControl
       
   363 // -----------------------------------------------------------------------------
       
   364 //
       
   365 void CLcVideoPlayer::DecreaseLcVolumeL()
       
   366     {
       
   367     User::LeaveIfError( lcutStub_LcEngine_failure() );
       
   368     iVolume--;
       
   369     }
       
   370 
       
   371 TInt CLcVideoPlayer::LcCameraCountL()
       
   372     {
       
   373     User::LeaveIfError( lcutStub_LcEngine_failure() );
       
   374     return 2;
       
   375     }
       
   376 
       
   377 TInt CLcVideoPlayer::CurrentLcCameraIndex()
       
   378     {
       
   379     return 0;
       
   380     }
       
   381 
       
   382 void CLcVideoPlayer::ToggleLcCameraL()
       
   383     {
       
   384     User::LeaveIfError( lcutStub_LcEngine_failure() );
       
   385     lcutStub_LcPlayer_calledMethods.insert(0,lcutStub_LcPlayer_ToggleLcCameraL );
       
   386     }
       
   387 
       
   388 TInt CLcVideoPlayer::MinLcZoomL()
       
   389     {
       
   390     User::LeaveIfError( lcutStub_LcEngine_failure() );
       
   391     return 0;
       
   392     }
       
   393 
       
   394 TInt CLcVideoPlayer::MaxLcZoomL()
       
   395     {
       
   396     User::LeaveIfError( lcutStub_LcEngine_failure() );
       
   397     return 10;
       
   398     }
       
   399 
       
   400 TInt CLcVideoPlayer::LcZoomValueL()
       
   401     {
       
   402     User::LeaveIfError( lcutStub_LcEngine_failure() );
       
   403     return 0;
       
   404     }
       
   405 
       
   406 void CLcVideoPlayer::SetLcZoomValueL( TInt /*aValue*/ )
       
   407     {
       
   408     User::LeaveIfError( lcutStub_LcEngine_failure() );
       
   409     lcutStub_LcPlayer_calledMethods.insert(0,lcutStub_LcPlayer_SetLcZoomValueL );
       
   410     }
       
   411 
       
   412 void CLcVideoPlayer::LcZoomInL()
       
   413     {
       
   414     User::LeaveIfError( lcutStub_LcEngine_failure() );
       
   415     lcutStub_LcPlayer_calledMethods.insert(0,lcutStub_LcPlayer_LcZoomInL );
       
   416     }
       
   417 
       
   418 void CLcVideoPlayer::LcZoomOutL()
       
   419     {
       
   420     User::LeaveIfError( lcutStub_LcEngine_failure() );
       
   421     lcutStub_LcPlayer_calledMethods.insert(0,lcutStub_LcPlayer_LcZoomOutL );
       
   422     }
       
   423 
       
   424 TInt CLcVideoPlayer::MinLcBrightnessL()
       
   425     {
       
   426     User::LeaveIfError( lcutStub_LcEngine_failure() );
       
   427     return 0;
       
   428     }
       
   429 
       
   430 TInt CLcVideoPlayer::MaxLcBrightnessL()
       
   431     {
       
   432     User::LeaveIfError( lcutStub_LcEngine_failure() );
       
   433     return 20; 
       
   434     }
       
   435 
       
   436 TInt CLcVideoPlayer::LcBrightnessL()
       
   437     {
       
   438     User::LeaveIfError( lcutStub_LcEngine_failure() );
       
   439     return 10; 
       
   440     }
       
   441 
       
   442 void CLcVideoPlayer::SetLcBrightnessL( TInt /*aValue*/ )
       
   443     {
       
   444     User::LeaveIfError( lcutStub_LcEngine_failure() );
       
   445     lcutStub_LcPlayer_calledMethods.insert(0,lcutStub_LcPlayer_SetLcBrightnessL );
       
   446     }
       
   447 
       
   448 void CLcVideoPlayer::IncreaseLcBrightnessL()
       
   449     {
       
   450     User::LeaveIfError( lcutStub_LcEngine_failure() );
       
   451     lcutStub_LcPlayer_calledMethods.insert(0,lcutStub_LcPlayer_IncreaseLcBrightnessL );
       
   452     }
       
   453 
       
   454 void CLcVideoPlayer::DecreaseLcBrightnessL()
       
   455     {
       
   456     User::LeaveIfError( lcutStub_LcEngine_failure() );
       
   457     lcutStub_LcPlayer_calledMethods.insert(0,lcutStub_LcPlayer_DecreaseLcBrightnessL );
       
   458     }
       
   459 
       
   460 
       
   461 //stub control
       
   462 
       
   463 bool lcutStub_LcPlayer_expectCall( const QString& call, int callNdx )
       
   464 {
       
   465     if ( callNdx >= lcutStub_LcPlayer_calledMethods.count() ) {
       
   466         return call == lcutStub_LcPlayer_NoCall;
       
   467     }
       
   468     return lcutStub_LcPlayer_calledMethods.count() > 0 ?
       
   469            lcutStub_LcPlayer_calledMethods[callNdx] == call :
       
   470            call == lcutStub_LcPlayer_NoCall;
       
   471 }
       
   472 
       
   473     
       
   474 void lcutStub_LcPlayer_reset()
       
   475 {
       
   476     lcutStub_LcPlayer_calledMethods.clear();
       
   477     lcutStub_LcPlayer_asyncCompletion( false );
       
   478 }
       
   479 
       
   480 void lcutStub_LcPlayer_asyncCompletion( bool async )
       
   481 {
       
   482     lcutStub_LcPlayer_asyncCompletionEnabled = async;
       
   483 }
       
   484 
       
   485 // End of File