camappengine/Engine/Src/CaeEngineImpVideoRecording.cpp
branchRCL_3
changeset 10 6bc4220d7f67
parent 0 9b3e960ffc8a
child 11 88688c05574c
equal deleted inserted replaced
6:bcdc0181a9f1 10:6bc4220d7f67
    29 
    29 
    30 #ifdef CAE_TEST_VERSION
    30 #ifdef CAE_TEST_VERSION
    31 #include "CaeEngineImpTestErrors.h"         // For TEST_VERSION compilation only
    31 #include "CaeEngineImpTestErrors.h"         // For TEST_VERSION compilation only
    32 #endif
    32 #endif
    33 
    33 
       
    34 #include "OstTraceDefinitions.h"
       
    35 #ifdef OST_TRACE_COMPILER_IN_USE
       
    36 #include "CaeEngineImpVideoRecordingTraces.h"
       
    37 #endif
    34 
    38 
    35 // ============================ MEMBER FUNCTIONS ===============================
    39 // ============================ MEMBER FUNCTIONS ===============================
    36 
    40 
    37 
    41 
    38 // -----------------------------------------------------------------------------
    42 // -----------------------------------------------------------------------------
    40 // Initialise the engine for video recording using default parameters.
    44 // Initialise the engine for video recording using default parameters.
    41 // -----------------------------------------------------------------------------
    45 // -----------------------------------------------------------------------------
    42 //
    46 //
    43 void CCaeEngineImp::InitVideoRecorderL()
    47 void CCaeEngineImp::InitVideoRecorderL()
    44     {
    48     {
       
    49     OstTrace0( CAMERASRV_PERFORMANCE, CCAEENGINEIMP_INITVIDEORECORDERL, "e_CAM_CAE_INITVIDEORECORDER 1" );
    45     LOGTEXT( _L( "Cae: CCaeEngineImp::InitVideoRecorderL() entering" ) );
    50     LOGTEXT( _L( "Cae: CCaeEngineImp::InitVideoRecorderL() entering" ) );
    46 
    51 
    47     iVideoInitialized = EFalse;
    52     iVideoInitialized = EFalse;
    48 
    53 
    49     // Close video recording if previously opened/prepared.
    54     // Close video recording if previously opened/prepared.
    92         iVideoQualityLevelsCont->InitDefaultsL();
    97         iVideoQualityLevelsCont->InitDefaultsL();
    93 
    98 
    94     iVideoInitialized = ETrue;
    99     iVideoInitialized = ETrue;
    95 
   100 
    96     LOGTEXT( _L( "Cae: CCaeEngineImp::InitVideoRecorderL() returning" ) );
   101     LOGTEXT( _L( "Cae: CCaeEngineImp::InitVideoRecorderL() returning" ) );
       
   102     OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAEENGINEIMP_INITVIDEORECORDERL, "e_CAM_CAE_INITVIDEORECORDER 0" );
    97     }
   103     }
    98 
   104 
    99 
   105 
   100 // -----------------------------------------------------------------------------
   106 // -----------------------------------------------------------------------------
   101 // CCaeEngineImp::InitVideoRecorderL
   107 // CCaeEngineImp::InitVideoRecorderL
   208     const TDesC8& aMimeType, 
   214     const TDesC8& aMimeType, 
   209     const TDesC&  aPreferredSupplier, 
   215     const TDesC&  aPreferredSupplier, 
   210     const TDesC8& aVideoType, 
   216     const TDesC8& aVideoType, 
   211     const TDesC8& aAudioType )
   217     const TDesC8& aAudioType )
   212     {
   218     {
       
   219     OstTrace0( CAMERASRV_PERFORMANCE, CCAEENGINEIMP_PREPAREVIDEORECORDINGL, "e_CAM_CAE_PREPAREVIDEORECORDING 1" );
   213     LOGTEXT3( _L( "Cae: CCaeEngineImp::PrepareVideoRecordingL() entering aFrameSize wxh=%dx%d" ),
   220     LOGTEXT3( _L( "Cae: CCaeEngineImp::PrepareVideoRecordingL() entering aFrameSize wxh=%dx%d" ),
   214             aFrameSize.iWidth, aFrameSize.iHeight );
   221             aFrameSize.iWidth, aFrameSize.iHeight );
   215 
   222 
   216     // Leave if not initialized properly or busy doing something else.
   223     // Leave if not initialized properly or busy doing something else.
   217     if ( !iVideoInitialized || 
   224     if ( !iVideoInitialized || 
   255 
   262 
   256     // Open video recorder.
   263     // Open video recorder.
   257     iVideoOpened = ETrue; // This is always set to ETrue when 
   264     iVideoOpened = ETrue; // This is always set to ETrue when 
   258                           // OpenFileL has been called to allow 
   265                           // OpenFileL has been called to allow 
   259                           // freeing resources by CloseVideoRecording().
   266                           // freeing resources by CloseVideoRecording().
       
   267     OstTrace0( CAMERASRV_PERFORMANCE, DUP2_CCAEENGINEIMP_PREPAREVIDEORECORDINGL, "e_CAM_CAE_VIDEORECORDER_OPENFILE 1" );
   260     iVideoRecorder->OpenFileL( iVideoClipFileName->Des(),
   268     iVideoRecorder->OpenFileL( iVideoClipFileName->Des(),
   261                                iCameraHandle,
   269                                iCameraHandle,
   262                                iVideoControllerUid,
   270                                iVideoControllerUid,
   263                                iVideoFormatUid, 
   271                                iVideoFormatUid, 
   264                                iVideoType->Des(),  
   272                                iVideoType->Des(),  
   265                                iVideoAudioType );
   273                                iVideoAudioType );
       
   274     OstTrace0( CAMERASRV_PERFORMANCE, DUP3_CCAEENGINEIMP_PREPAREVIDEORECORDINGL, "e_CAM_CAE_VIDEORECORDER_OPENFILE 0" );
   266     
   275     
   267     LOGTEXT( _L( "Cae: CCaeEngineImp::PrepareVideoRecordingL() returning" ) );
   276     LOGTEXT( _L( "Cae: CCaeEngineImp::PrepareVideoRecordingL() returning" ) );
       
   277     OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAEENGINEIMP_PREPAREVIDEORECORDINGL, "e_CAM_CAE_PREPAREVIDEORECORDING 0" );
   268     }
   278     }
   269 
   279 
   270 
   280 
   271 // -----------------------------------------------------------------------------
   281 // -----------------------------------------------------------------------------
   272 // CCaeEngineImp::CloseVideoRecording
   282 // CCaeEngineImp::CloseVideoRecording
   273 // -----------------------------------------------------------------------------
   283 // -----------------------------------------------------------------------------
   274 //
   284 //
   275 void CCaeEngineImp::CloseVideoRecording()
   285 void CCaeEngineImp::CloseVideoRecording()
   276     {
   286     {
       
   287     OstTrace0( CAMERASRV_PERFORMANCE, CCAEENGINEIMP_CLOSEVIDEORECORDING, "e_CAM_CAE_CLOSEVIDEORECORDING 1" );
   277     LOGTEXT( _L( "Cae: CCaeEngineImp::CloseVideoRecording() entering" ) );
   288     LOGTEXT( _L( "Cae: CCaeEngineImp::CloseVideoRecording() entering" ) );
   278 
   289 
   279     if ( iVideoPrepared ) 
   290     if ( iVideoPrepared ) 
   280         {
   291         {
   281         CancelVideoRecording();
   292         CancelVideoRecording();
   282         iVideoPrepared = EFalse;
   293         iVideoPrepared = EFalse;
   283         }
   294         }
   284 
   295 
   285     if ( iVideoOpened )
   296     if ( iVideoOpened )
   286         {
   297         {
       
   298         OstTrace0( CAMERASRV_PERFORMANCE, DUP2_CCAEENGINEIMP_CLOSEVIDEORECORDING, "e_CAM_CAE_VIDEORECORDER_CLOSE 1" );
   287         iVideoRecorder->Close();
   299         iVideoRecorder->Close();
       
   300         OstTrace0( CAMERASRV_PERFORMANCE, DUP3_CCAEENGINEIMP_CLOSEVIDEORECORDING, "e_CAM_CAE_VIDEORECORDER_CLOSE 0" );
   288         iVideoOpened = EFalse;
   301         iVideoOpened = EFalse;
   289         }
   302         }
   290 
   303 
   291     LOGTEXT( _L( "Cae: CCaeEngineImp::CloseVideoRecording() returning" ) );
   304     LOGTEXT( _L( "Cae: CCaeEngineImp::CloseVideoRecording() returning" ) );
       
   305     OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAEENGINEIMP_CLOSEVIDEORECORDING, "e_CAM_CAE_CLOSEVIDEORECORDING 0" );
   292     }
   306     }
   293 
   307 
   294 
   308 
   295 // -----------------------------------------------------------------------------
   309 // -----------------------------------------------------------------------------
   296 // CCaeEngineImp::VideoQualityIndex
   310 // CCaeEngineImp::VideoQualityIndex
   394 
   408 
   395     if ( iVideoPrepared )
   409     if ( iVideoPrepared )
   396         {
   410         {
   397         iPrepPars = ETrue;
   411         iPrepPars = ETrue;
   398         iVideoRecorder->SetMaxClipSizeL( iMaxClipSizeInBytesPrep );
   412         iVideoRecorder->SetMaxClipSizeL( iMaxClipSizeInBytesPrep );
       
   413         OstTrace0( CAMERASRV_PERFORMANCE, CCAEENGINEIMP_SETVIDEOCLIPMAXSIZEL, "e_CAM_CAE_VIDEORECORDER_PREPARE 1" );
   399         iVideoRecorder->Prepare();
   414         iVideoRecorder->Prepare();
       
   415         OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAEENGINEIMP_SETVIDEOCLIPMAXSIZEL, "e_CAM_CAE_VIDEORECORDER_PREPARE 0" );
   400         }
   416         }
   401 
   417 
   402     LOGTEXT( _L( "Cae: CCaeEngineImp::SetVideoClipMaxSizeL() returning" ) );
   418     LOGTEXT( _L( "Cae: CCaeEngineImp::SetVideoClipMaxSizeL() returning" ) );
   403     }
   419     }
   404 
   420 
   438         }
   454         }
   439 
   455 
   440     iVideoAudioEnabledPrep = aAudioEnabled;
   456     iVideoAudioEnabledPrep = aAudioEnabled;
   441     iVideoRecorder->SetAudioEnabledL( iVideoAudioEnabledPrep );
   457     iVideoRecorder->SetAudioEnabledL( iVideoAudioEnabledPrep );
   442     iPrepPars = ETrue;
   458     iPrepPars = ETrue;
       
   459     OstTrace0( CAMERASRV_PERFORMANCE, CCAEENGINEIMP_SETVIDEOAUDIOL, "e_CAM_CAE_VIDEORECORDER_PREPARE 1" );
   443     iVideoRecorder->Prepare();
   460     iVideoRecorder->Prepare();
       
   461     OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAEENGINEIMP_SETVIDEOAUDIOL, "e_CAM_CAE_VIDEORECORDER_PREPARE 0" );
   444 
   462 
   445     LOGTEXT( _L( "Cae: CCaeEngineImp::SetVideoAudioL() returning" ) );
   463     LOGTEXT( _L( "Cae: CCaeEngineImp::SetVideoAudioL() returning" ) );
   446     }
   464     }
   447 
   465 
   448 
   466 
   522 // Finally calls McaeoVideoRecordingOn().
   540 // Finally calls McaeoVideoRecordingOn().
   523 // -----------------------------------------------------------------------------
   541 // -----------------------------------------------------------------------------
   524 //
   542 //
   525 void CCaeEngineImp::StartVideoRecording()
   543 void CCaeEngineImp::StartVideoRecording()
   526     {
   544     {
       
   545     OstTrace0( CAMERASRV_PERFORMANCE, CCAEENGINEIMP_STARTVIDEORECORDING, "e_CAM_CAE_STARTVIDEORECORDING 1" );
   527     LOGTEXT( _L( "Cae: CCaeEngineImp::StartVideoRecording() entering" ) );
   546     LOGTEXT( _L( "Cae: CCaeEngineImp::StartVideoRecording() entering" ) );
   528 
   547 
   529     TInt error( KErrNone );
   548     TInt error( KErrNone );
   530 
   549 
   531     if ( iVideoPrepared && !iVideoRecordingRunning ) 
   550     if ( iVideoPrepared && !iVideoRecordingRunning ) 
   536  		// Reset previous time information
   555  		// Reset previous time information
   537     	iPrevTimeElapsed = 0;
   556     	iPrevTimeElapsed = 0;
   538     	iPrevTimeRemaining = 0;
   557     	iPrevTimeRemaining = 0;
   539     	
   558     	
   540        // Start video recording.
   559        // Start video recording.
       
   560         OstTrace0( CAMERASRV_PERFORMANCE, DUP2_CCAEENGINEIMP_STARTVIDEORECORDING, "e_CAM_CAE_VIDEORECORDER_RECORD 1" );
   541         iVideoRecorder->Record();
   561         iVideoRecorder->Record();
       
   562         OstTrace0( CAMERASRV_PERFORMANCE, DUP3_CCAEENGINEIMP_STARTVIDEORECORDING, "e_CAM_CAE_VIDEORECORDER_RECORD 0" );
   542         if ( iVideoTimesInterval > TTimeIntervalMicroSeconds32( 0 ) ) 
   563         if ( iVideoTimesInterval > TTimeIntervalMicroSeconds32( 0 ) ) 
   543             {
   564             {
   544             // Start generating video recording time information for the client.
   565             // Start generating video recording time information for the client.
   545             iVideoTimes->Start( KVideoTimesDelay,       // delay
   566             iVideoTimes->Start( KVideoTimesDelay,       // delay
   546                                 iVideoTimesInterval,    // interval
   567                                 iVideoTimesInterval,    // interval
   551         {
   572         {
   552         error = KErrNotReady;
   573         error = KErrNotReady;
   553         }
   574         }
   554 
   575 
   555 
   576 
       
   577     OstTrace0( CAMERASRV_PERFORMANCE, DUP4_CCAEENGINEIMP_STARTVIDEORECORDING, "e_CAM_CAE_MCAEOVIDEORECORDINGON 1" );
   556     iCaeObserver->McaeoVideoRecordingOn( error );
   578     iCaeObserver->McaeoVideoRecordingOn( error );
       
   579     OstTrace0( CAMERASRV_PERFORMANCE, DUP5_CCAEENGINEIMP_STARTVIDEORECORDING, "e_CAM_CAE_MCAEOVIDEORECORDINGON 0" ); 
   557 
   580 
   558     LOGTEXT( _L( "Cae: CCaeEngineImp::StartVideoRecording() returning" ) );
   581     LOGTEXT( _L( "Cae: CCaeEngineImp::StartVideoRecording() returning" ) );
       
   582     OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAEENGINEIMP_STARTVIDEORECORDING, "e_CAM_CAE_STARTVIDEORECORDING 0" );
   559     }
   583     }
   560 
   584 
   561 
   585 
   562 // -----------------------------------------------------------------------------
   586 // -----------------------------------------------------------------------------
   563 // CCaeEngineImp::StopVideoRecording
   587 // CCaeEngineImp::StopVideoRecording
   568 // Finally calls McaeoVideoRecordingComplete().
   592 // Finally calls McaeoVideoRecordingComplete().
   569 // -----------------------------------------------------------------------------
   593 // -----------------------------------------------------------------------------
   570 //
   594 //
   571 void CCaeEngineImp::StopVideoRecording()
   595 void CCaeEngineImp::StopVideoRecording()
   572     {
   596     {
       
   597     OstTrace0( CAMERASRV_PERFORMANCE, CCAEENGINEIMP_STOPVIDEORECORDING, "e_CAM_CAE_STOPVIDEORECORDING 1" );
   573     LOGTEXT( _L( "Cae: CCaeEngineImp::StopVideoRecording() entering" ) );
   598     LOGTEXT( _L( "Cae: CCaeEngineImp::StopVideoRecording() entering" ) );
   574         
   599         
   575     TInt stoppingError( KErrNone );
   600     TInt stoppingError( KErrNone );
   576     TInt asyncStopErr( KErrNone );
   601     TInt asyncStopErr( KErrNone );
   577     
   602     
   594                     
   619                     
   595         // Stop video recording.
   620         // Stop video recording.
   596         if ( iAsyncVideoStopEnabled )
   621         if ( iAsyncVideoStopEnabled )
   597             {
   622             {
   598        		LOGTEXT( _L( "Cae: CCaeEngineImp::StopVideoRecording(). using custom command ECamCControllerCCVideoStopAsync" )); 
   623        		LOGTEXT( _L( "Cae: CCaeEngineImp::StopVideoRecording(). using custom command ECamCControllerCCVideoStopAsync" )); 
       
   624             OstTrace0( CAMERASRV_PERFORMANCE, DUP2_CCAEENGINEIMP_STOPVIDEORECORDING, "e_CAM_CAE_VIDEORECORDER_STOP_ASYNC 1" );
   599             asyncStopErr = iVideoRecorder->CustomCommandSync( TMMFMessageDestination( iVideoControllerUid, KMMFObjectHandleController ), 
   625             asyncStopErr = iVideoRecorder->CustomCommandSync( TMMFMessageDestination( iVideoControllerUid, KMMFObjectHandleController ), 
   600                                                         ECamCControllerCCVideoStopAsync, 
   626                                                         ECamCControllerCCVideoStopAsync, 
   601                                                         KNullDesC8, 
   627                                                         KNullDesC8, 
   602                                                         KNullDesC8 );
   628                                                         KNullDesC8 );
       
   629        		OstTrace0( CAMERASRV_PERFORMANCE, DUP3_CCAEENGINEIMP_STOPVIDEORECORDING, "e_CAM_CAE_VIDEORECORDER_STOP_ASYNC 0" );
   603        		if ( asyncStopErr ) // async stop was not supported, use sync stop
   630        		if ( asyncStopErr ) // async stop was not supported, use sync stop
   604        		    {
   631        		    {
   605            		LOGTEXT2( _L( "Cae: CCaeEngineImp::StopVideoRecording(). async stop err=%d, using sync stop" ), asyncStopErr); 
   632            		LOGTEXT2( _L( "Cae: CCaeEngineImp::StopVideoRecording(). async stop err=%d, using sync stop" ), asyncStopErr); 
       
   633                 OstTrace0( CAMERASRV_PERFORMANCE, DUP4_CCAEENGINEIMP_STOPVIDEORECORDING, "e_CAM_CAE_VIDEORECORDER_STOP 1" );
   606                 stoppingError = iVideoRecorder->Stop();
   634                 stoppingError = iVideoRecorder->Stop();
       
   635                 OstTrace0( CAMERASRV_PERFORMANCE, DUP5_CCAEENGINEIMP_STOPVIDEORECORDING, "e_CAM_CAE_VIDEORECORDER_STOP 0" );
       
   636                 OstTrace0( CAMERASRV_PERFORMANCE, DUP8_CCAEENGINEIMP_STOPVIDEORECORDING, "e_CAM_CAE_MCAEOVIDEORECORDINGSTOPPED 1" );
   607                 iCaeObserver->McaeoVideoRecordingStopped();
   637                 iCaeObserver->McaeoVideoRecordingStopped();
       
   638        		    OstTrace0( CAMERASRV_PERFORMANCE, DUP9_CCAEENGINEIMP_STOPVIDEORECORDING, "e_CAM_CAE_MCAEOVIDEORECORDINGSTOPPED 0" );
   608        		    }
   639        		    }
   609             }
   640             }
   610         else
   641         else
   611             {
   642             {
   612             // Synchronous, quaranteed that video recording is stopped when returning.
   643             // Synchronous, quaranteed that video recording is stopped when returning.
       
   644             OstTrace0( CAMERASRV_PERFORMANCE, DUP6_CCAEENGINEIMP_STOPVIDEORECORDING, "e_CAM_CAE_VIDEORECORDER_STOP 1" );
   613             stoppingError = iVideoRecorder->Stop();
   645             stoppingError = iVideoRecorder->Stop();
       
   646             OstTrace0( CAMERASRV_PERFORMANCE, DUP7_CCAEENGINEIMP_STOPVIDEORECORDING, "e_CAM_CAE_VIDEORECORDER_STOP 0" );
   614             }
   647             }
   615         
   648         
   616         // Can't be paused anymore.
   649         // Can't be paused anymore.
   617         iVideoRecordingPaused = EFalse;
   650         iVideoRecordingPaused = EFalse;
   618 
   651 
   657     iPrevTimeElapsed = 0;
   690     iPrevTimeElapsed = 0;
   658     iPrevTimeRemaining = 0;
   691     iPrevTimeRemaining = 0;
   659 
   692 
   660     if ( !iAsyncVideoStopEnabled || asyncStopErr )
   693     if ( !iAsyncVideoStopEnabled || asyncStopErr )
   661         {
   694         {
       
   695         OstTrace0( CAMERASRV_PERFORMANCE, DUP10_CCAEENGINEIMP_STOPVIDEORECORDING, "e_CAM_CAE_MCAEOVIDEORECORDINGCOMPLETE 1" );
   662         iCaeObserver->McaeoVideoRecordingComplete( stoppingError );
   696         iCaeObserver->McaeoVideoRecordingComplete( stoppingError );
       
   697         OstTrace0( CAMERASRV_PERFORMANCE, DUP11_CCAEENGINEIMP_STOPVIDEORECORDING, "e_CAM_CAE_MCAEOVIDEORECORDINGCOMPLETE 0" );
   663         }
   698         }
   664 
   699 
   665 
   700 
   666     LOGTEXT( _L( "Cae: CCaeEngineImp::StopVideoRecording() returning" ) );
   701     LOGTEXT( _L( "Cae: CCaeEngineImp::StopVideoRecording() returning" ) );
       
   702     OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAEENGINEIMP_STOPVIDEORECORDING, "e_CAM_CAE_STOPVIDEORECORDING 0" );
   667     }
   703     }
   668 
   704 
   669 
   705 
   670 // -----------------------------------------------------------------------------
   706 // -----------------------------------------------------------------------------
   671 // CCaeEngineImp::PauseVideoRecording
   707 // CCaeEngineImp::PauseVideoRecording
   725     TInt error( KErrNone );
   761     TInt error( KErrNone );
   726 
   762 
   727     if ( iVideoRecordingRunning && iVideoRecordingPaused ) 
   763     if ( iVideoRecordingRunning && iVideoRecordingPaused ) 
   728         {
   764         {
   729         // Start video recording.
   765         // Start video recording.
       
   766         OstTrace0( CAMERASRV_PERFORMANCE, CCAEENGINEIMP_RESUMEVIDEORECORDING, "e_CAM_CAE_VIDEORECORDER_RECORD 1" );
   730         iVideoRecorder->Record();
   767         iVideoRecorder->Record();
       
   768         OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAEENGINEIMP_RESUMEVIDEORECORDING, "e_CAM_CAE_VIDEORECORDER_RECORD 0" );
   731         iVideoRecordingPaused = EFalse;
   769         iVideoRecordingPaused = EFalse;
   732         if ( iVideoTimesInterval > TTimeIntervalMicroSeconds32( 0 ) ) 
   770         if ( iVideoTimesInterval > TTimeIntervalMicroSeconds32( 0 ) ) 
   733             {
   771             {
   734             // Start generating video recording time information for the client.
   772             // Start generating video recording time information for the client.
   735             iVideoTimes->Start( KVideoTimesDelay,       // delay
   773             iVideoTimes->Start( KVideoTimesDelay,       // delay
   790     const TDesC8& aMimeType, 
   828     const TDesC8& aMimeType, 
   791     const TDesC&  aPreferredSupplier, 
   829     const TDesC&  aPreferredSupplier, 
   792     const TDesC8& aVideoType, 
   830     const TDesC8& aVideoType, 
   793     const TDesC8& aAudioType )
   831     const TDesC8& aAudioType )
   794     {
   832     {
       
   833     OstTrace0( CAMERASRV_PERFORMANCE, DUP4_CCAEENGINEIMP_PREPAREVIDEORECORDINGL, "e_CAM_CAE_PREPAREVIDEORECORDINGL 1" );
   795     // Memorize video audio bit rate value to be prepared.
   834     // Memorize video audio bit rate value to be prepared.
   796     iVideoAudioBitRatePrep = aAudioBitRate;
   835     iVideoAudioBitRatePrep = aAudioBitRate;
   797     // Force audio bit rate preparation.
   836     // Force audio bit rate preparation.
   798     iPrepareVideoAudioBitRate = ETrue;
   837     iPrepareVideoAudioBitRate = ETrue;
   799 
   838 
   806                             aAudioEnabled, 
   845                             aAudioEnabled, 
   807                             aMimeType, 
   846                             aMimeType, 
   808                             aPreferredSupplier, 
   847                             aPreferredSupplier, 
   809                             aVideoType, 
   848                             aVideoType, 
   810                             aAudioType );
   849                             aAudioType );
       
   850     OstTrace0( CAMERASRV_PERFORMANCE, DUP5_CCAEENGINEIMP_PREPAREVIDEORECORDINGL, "e_CAM_CAE_PREPAREVIDEORECORDINGL 0" );
   811     }
   851     }
   812 
   852 
   813 
   853 
   814 // -----------------------------------------------------------------------------
   854 // -----------------------------------------------------------------------------
   815 // CCaeEngineImp::MvruoOpenComplete
   855 // CCaeEngineImp::MvruoOpenComplete
   835         // (ignore possible error)
   875         // (ignore possible error)
   836         // Prepare settings only if no errors in opening.
   876         // Prepare settings only if no errors in opening.
   837         TRAP( aError, PrepareVideoSettingsL() );
   877         TRAP( aError, PrepareVideoSettingsL() );
   838         if ( aError != KErrNone ) 
   878         if ( aError != KErrNone ) 
   839             {
   879             {
       
   880             OstTrace0( CAMERASRV_PERFORMANCE, CCAEENGINEIMP_MVRUOOPENCOMPLETE, "e_CAM_CAE_MCAEOVIDEOPREPARECOMPLETE 1" );
   840             iCaeObserver->McaeoVideoPrepareComplete( aError );
   881             iCaeObserver->McaeoVideoPrepareComplete( aError );
       
   882             OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAEENGINEIMP_MVRUOOPENCOMPLETE, "e_CAM_CAE_MCAEOVIDEOPREPARECOMPLETE 0" );
   841             }
   883             }
   842         }
   884         }
   843     else
   885     else
   844         {
   886         {
       
   887         OstTrace0( CAMERASRV_PERFORMANCE, DUP2_CCAEENGINEIMP_MVRUOOPENCOMPLETE, "e_CAM_CAE_MCAEOVIDEOPREPARECOMPLETE 1" );
   845         iCaeObserver->McaeoVideoPrepareComplete( aError );
   888         iCaeObserver->McaeoVideoPrepareComplete( aError );
       
   889         OstTrace0( CAMERASRV_PERFORMANCE, DUP3_CCAEENGINEIMP_MVRUOOPENCOMPLETE, "e_CAM_CAE_MCAEOVIDEOPREPARECOMPLETE 0" );
   846         }
   890         }
   847 
   891 
   848     LOGTEXT( _L( "Cae: CCaeEngineImp::MvruoOpenComplete() returning" ) );
   892     LOGTEXT( _L( "Cae: CCaeEngineImp::MvruoOpenComplete() returning" ) );
   849     }
   893     }
   850 
   894 
   894             iVideoAudioBitRatePrep  = iVideoAudioBitRate;
   938             iVideoAudioBitRatePrep  = iVideoAudioBitRate;
   895             iMaxClipSizeInBytesPrep = iMaxClipSizeInBytes;
   939             iMaxClipSizeInBytesPrep = iMaxClipSizeInBytes;
   896             }
   940             }
   897         }
   941         }
   898 
   942 
       
   943     OstTrace0( CAMERASRV_PERFORMANCE, CCAEENGINEIMP_MVRUOPREPARECOMPLETE, "e_CAM_CAE_MCAEOVIDEOPREPARECOMPLETE 1" );
   899     iCaeObserver->McaeoVideoPrepareComplete( aError );
   944     iCaeObserver->McaeoVideoPrepareComplete( aError );
       
   945     OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAEENGINEIMP_MVRUOPREPARECOMPLETE, "e_CAM_CAE_MCAEOVIDEOPREPARECOMPLETE 0" );
   900 
   946 
   901     LOGTEXT( _L( "Cae: CCaeEngineImp::MvruoPrepareComplete() returning" ) );
   947     LOGTEXT( _L( "Cae: CCaeEngineImp::MvruoPrepareComplete() returning" ) );
   902     }
   948     }
   903 
   949 
   904 
   950 
   940         	}
   986         	}
   941         	
   987         	
   942         // In async stop mode call also the other call-back to play stop sound
   988         // In async stop mode call also the other call-back to play stop sound
   943         if ( iAsyncVideoStopEnabled )
   989         if ( iAsyncVideoStopEnabled )
   944             {
   990             {
       
   991             OstTrace0( CAMERASRV_PERFORMANCE, CCAEENGINEIMP_MVRUORECORDCOMPLETE, "e_CAM_CAE_MCAEOVIDEORECORDINGSTOPPED 1" );
   945             iCaeObserver->McaeoVideoRecordingStopped();
   992             iCaeObserver->McaeoVideoRecordingStopped();
   946             }
   993             OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAEENGINEIMP_MVRUORECORDCOMPLETE, "e_CAM_CAE_MCAEOVIDEORECORDINGSTOPPED 0" );
       
   994             }
       
   995         OstTrace0( CAMERASRV_PERFORMANCE, DUP2_CCAEENGINEIMP_MVRUORECORDCOMPLETE, "e_CAM_CAE_MCAEOVIDEORECORDINGCOMPLETE 1" );
   947         iCaeObserver->McaeoVideoRecordingComplete( aError );
   996         iCaeObserver->McaeoVideoRecordingComplete( aError );
       
   997         OstTrace0( CAMERASRV_PERFORMANCE, DUP3_CCAEENGINEIMP_MVRUORECORDCOMPLETE, "e_CAM_CAE_MCAEOVIDEORECORDINGCOMPLETE 0" );
   948         }
   998         }
   949     
   999     
   950     LOGTEXT( _L( "Cae: CCaeEngineImp::MvruoRecordComplete() returning" ) );
  1000     LOGTEXT( _L( "Cae: CCaeEngineImp::MvruoRecordComplete() returning" ) );
   951     }
  1001     }
   952 
  1002 
   962     {
  1012     {
   963     LOGTEXT3( _L( "Cae: CCaeEngineImp::MvruoEvent() entering, uid=%x, err=%d" ), aEvent.iEventType.iUid, aEvent.iErrorCode );
  1013     LOGTEXT3( _L( "Cae: CCaeEngineImp::MvruoEvent() entering, uid=%x, err=%d" ), aEvent.iEventType.iUid, aEvent.iErrorCode );
   964     
  1014     
   965     if ( aEvent.iEventType.iUid == KCamCControllerCCVideoRecordStopped.iUid )
  1015     if ( aEvent.iEventType.iUid == KCamCControllerCCVideoRecordStopped.iUid )
   966         {
  1016         {
       
  1017         OstTrace0( CAMERASRV_PERFORMANCE, CCAEENGINEIMP_MVRUOEVENT, "e_CAM_CAE_MCAEOVIDEORECORDINGSTOPPED 1" );
   967         iCaeObserver->McaeoVideoRecordingStopped();
  1018         iCaeObserver->McaeoVideoRecordingStopped();
       
  1019         OstTrace0( CAMERASRV_PERFORMANCE, DUP3_CCAEENGINEIMP_MVRUOEVENT, "e_CAM_CAE_MCAEOVIDEORECORDINGSTOPPED 0" );
   968         }
  1020         }
   969     else if ( aEvent.iEventType.iUid == KCamCControllerCCVideoFileComposed.iUid )
  1021     else if ( aEvent.iEventType.iUid == KCamCControllerCCVideoFileComposed.iUid )
   970         {
  1022         {
       
  1023         OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAEENGINEIMP_MVRUOEVENT, "e_CAM_CAE_MCAEOVIDEORECORDINGCOMPLETE 1" );
   971         iCaeObserver->McaeoVideoRecordingComplete( aEvent.iErrorCode );
  1024         iCaeObserver->McaeoVideoRecordingComplete( aEvent.iErrorCode );
       
  1025         OstTrace0( CAMERASRV_PERFORMANCE, DUP2_CCAEENGINEIMP_MVRUOEVENT, "e_CAM_CAE_MCAEOVIDEORECORDINGCOMPLETE 0" );
   972         }
  1026         }
   973     else
  1027     else
   974         {
  1028         {
   975         // Send others events as error to UI 
  1029         // Send others events as error to UI 
   976         iVideoPrepared = EFalse;    // mark that re-preparation is needed 
  1030         iVideoPrepared = EFalse;    // mark that re-preparation is needed 
       
  1031         OstTrace0( CAMERASRV_PERFORMANCE, DUP4_CCAEENGINEIMP_MVRUOEVENT, "e_CAM_CAE_MCAEOVIDEOPREPARECOMPLETE 1" );
   977         iCaeObserver->McaeoVideoPrepareComplete( aEvent.iErrorCode );
  1032         iCaeObserver->McaeoVideoPrepareComplete( aEvent.iErrorCode );
       
  1033         OstTrace0( CAMERASRV_PERFORMANCE, DUP5_CCAEENGINEIMP_MVRUOEVENT, "e_CAM_CAE_MCAEOVIDEOPREPARECOMPLETE 0" );
   978         }
  1034         }
   979     
  1035     
   980     LOGTEXT( _L( "Cae: CCaeEngineImp::MvruoEvent() returning" ) );
  1036     LOGTEXT( _L( "Cae: CCaeEngineImp::MvruoEvent() returning" ) );
   981     }
  1037     }
   982 
  1038 
  1002  		// Reset previous time information
  1058  		// Reset previous time information
  1003     	iPrevTimeElapsed = 0;
  1059     	iPrevTimeElapsed = 0;
  1004     	iPrevTimeRemaining = 0;
  1060     	iPrevTimeRemaining = 0;
  1005     	
  1061     	
  1006         // Stop video recording. Do not call McaeoVideoRecordingComplete()
  1062         // Stop video recording. Do not call McaeoVideoRecordingComplete()
       
  1063         OstTrace0( CAMERASRV_PERFORMANCE, CCAEENGINEIMP_CANCELVIDEORECORDING, "e_CAM_CAE_VIDEORECORDER_STOP 1" );
  1007         (void) iVideoRecorder->Stop();
  1064         (void) iVideoRecorder->Stop();
       
  1065         OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAEENGINEIMP_CANCELVIDEORECORDING, "e_CAM_CAE_VIDEORECORDER_STOP 0" );
  1008         iVideoRecordingPaused = EFalse;
  1066         iVideoRecordingPaused = EFalse;
  1009         }
  1067         }
  1010     
  1068     
  1011     LOGTEXT( _L( "Cae: CCaeEngineImp::CancelVideoRecording() returning" ) );
  1069     LOGTEXT( _L( "Cae: CCaeEngineImp::CancelVideoRecording() returning" ) );
  1012     }
  1070     }
  1017 // Calls Video Recorder API setting methods to set video recording paramaters.
  1075 // Calls Video Recorder API setting methods to set video recording paramaters.
  1018 // -----------------------------------------------------------------------------
  1076 // -----------------------------------------------------------------------------
  1019 //
  1077 //
  1020 void CCaeEngineImp::PrepareVideoSettingsL()
  1078 void CCaeEngineImp::PrepareVideoSettingsL()
  1021     {
  1079     {
       
  1080     OstTrace0( CAMERASRV_PERFORMANCE, CCAEENGINEIMP_PREPAREVIDEOSETTINGSL, "e_CAM_CAE_PREPAREVIDEOSETTINGS 1" );
  1022     LOGTEXT( _L( "Cae: CCaeEngineImp::PrepareVideoSettingsL() entering" ) );
  1081     LOGTEXT( _L( "Cae: CCaeEngineImp::PrepareVideoSettingsL() entering" ) );
  1023 
  1082 
  1024     #ifdef CAE_TEST_VERSION
  1083     #ifdef CAE_TEST_VERSION
  1025     // For simulating errors when compiled as special "test version".
  1084     // For simulating errors when compiled as special "test version".
  1026     CaePrepareVideoSettingsErrorL();
  1085     CaePrepareVideoSettingsErrorL();
  1045     iVideoRecorder->SetGainL( gain );
  1104     iVideoRecorder->SetGainL( gain );
  1046     gain = iVideoRecorder->GainL();
  1105     gain = iVideoRecorder->GainL();
  1047     LOGTEXT2( _L( "Cae: CCaeEngineImp::PrepareVideoSettingsL() GainL set to %d" ), gain );
  1106     LOGTEXT2( _L( "Cae: CCaeEngineImp::PrepareVideoSettingsL() GainL set to %d" ), gain );
  1048 
  1107 
  1049     iPrepPars = ETrue;
  1108     iPrepPars = ETrue;
       
  1109     OstTrace0( CAMERASRV_PERFORMANCE, DUP2_CCAEENGINEIMP_PREPAREVIDEOSETTINGSL, "e_CAM_CAE_VIDEORECORDER_PREPARE 1" );
  1050     iVideoRecorder->Prepare();
  1110     iVideoRecorder->Prepare();
       
  1111     OstTrace0( CAMERASRV_PERFORMANCE, DUP3_CCAEENGINEIMP_PREPAREVIDEOSETTINGSL, "e_CAM_CAE_VIDEORECORDER_PREPARE 0" );
  1051 
  1112 
  1052     LOGTEXT( _L( "Cae: CCaeEngineImp::PrepareVideoSettingsL() returning" ) );
  1113     LOGTEXT( _L( "Cae: CCaeEngineImp::PrepareVideoSettingsL() returning" ) );
       
  1114     OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAEENGINEIMP_PREPAREVIDEOSETTINGSL, "e_CAM_CAE_PREPAREVIDEOSETTINGS 0" );
  1053     }
  1115     }
  1054 
  1116 
  1055 
  1117 
  1056 // -----------------------------------------------------------------------------
  1118 // -----------------------------------------------------------------------------
  1057 // CCaeEngineImp::FindVideoUidsL
  1119 // CCaeEngineImp::FindVideoUidsL