camerasrv_plat/media_recorder_api/tsrc/src/camcTestClient_9.cpp
changeset 0 9b3e960ffc8a
child 42 605672cc2a86
equal deleted inserted replaced
-1:000000000000 0:9b3e960ffc8a
       
     1 /*
       
     2 * Copyright (c) 2002 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:  Camcorder MMF API Test DLL
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 
       
    22 #include "camctestclient_9.h"
       
    23 #include "CamCControllerCustomCommands.h"
       
    24 #include <mmf/common/mmfstandardcustomcommands.h>
       
    25 #include <mmf/server/mmffile.h>
       
    26 #include <AudioPreference.h>
       
    27 #include "camcTest.h"
       
    28 
       
    29 
       
    30 // EXTERNAL DATA STRUCTURES
       
    31 
       
    32 // EXTERNAL FUNCTION PROTOTYPES 
       
    33  
       
    34 // CONSTANTS
       
    35 
       
    36 const TInt KMaxVideoLength = 3600;
       
    37 
       
    38 // MACROS
       
    39 // Debug print macro
       
    40 #ifdef _DEBUG
       
    41 #include <e32svr.h>
       
    42 #define PRINT(x) RDebug::Print x
       
    43 #else
       
    44 #define PRINT(x)
       
    45 #endif
       
    46 
       
    47 
       
    48 // LOCAL CONSTANTS AND MACROS
       
    49 
       
    50 // MODULE DATA STRUCTURES
       
    51 
       
    52 // LOCAL FUNCTION PROTOTYPES
       
    53 
       
    54 // FORWARD DECLARATIONS
       
    55 
       
    56 
       
    57 CCamcTestClient_9::CCamcTestClient_9 () : CTimer(CActive::EPriorityHigh)
       
    58     {
       
    59     }
       
    60 
       
    61 
       
    62 CCamcTestClient_9::~CCamcTestClient_9 ()
       
    63     {
       
    64     Cancel();
       
    65     delete iCamc;
       
    66     }
       
    67 
       
    68 CCamcTestClient_9* CCamcTestClient_9::NewL()
       
    69     {
       
    70     CCamcTestClient_9* self = new(ELeave) CCamcTestClient_9;
       
    71     CleanupStack::PushL(self);
       
    72     self->ConstructL( );
       
    73     CleanupStack::Pop(self);
       
    74     return self;
       
    75     }
       
    76 
       
    77 void CCamcTestClient_9::ConstructL( )
       
    78     {
       
    79     iCamc = CVideoRecorderUtility::NewL( *this, KAudioPriorityVideoRecording, EMdaPriorityPreferenceTimeAndQuality );
       
    80     iOpenReady = EFalse;
       
    81     iPrepareReady = EFalse;
       
    82     iRecordingReady = EFalse;
       
    83     iPaused = EFalse;
       
    84     iNewFileName = EFalse;
       
    85     iRecord2ndTime = EFalse;
       
    86     
       
    87     CTimer::ConstructL();
       
    88     iTimeout = 0;
       
    89     iClosed = 0;
       
    90     CActiveScheduler::Add(this);
       
    91     }
       
    92 
       
    93 
       
    94 void CCamcTestClient_9::Start_Active_ObjectL ( TestClient9Actions aAction, TInt aCameraHandle )
       
    95     {
       
    96     
       
    97     TFileName file;
       
    98     TInt camHandle = aCameraHandle;
       
    99     TUid controllerUid = {0x101F8503};	//implementation uid
       
   100     TUid formatUid = {0};
       
   101     TUid formatUidG2 = {0x101F86D6};
       
   102     TUid formatUidMP4 = {0x101F873D};
       
   103     
       
   104     
       
   105     iAction = aAction;                  //iAction might be set to NULL after action has been executed
       
   106     iSavedAction = aAction;             //SavedAction will never be changed.
       
   107     //	iTimeout = aTimeout;
       
   108     iTimeout = 1500000;
       
   109     
       
   110     if ( iAction == K_TC9_NewFileNameWhenRecordSecondTimeDiffFileFormat )
       
   111         {
       
   112         AddDriveLetterToPath(_L("recordQCIF.3g2"), file);
       
   113         
       
   114         TRAPD(err,
       
   115             iCamc->OpenFileL( file, camHandle, 
       
   116             controllerUid,
       
   117             formatUidG2,
       
   118             _L8("video/H263-2000"),
       
   119             TFourCC(' ', 'A', 'M', 'R') ));
       
   120         
       
   121         if (err)
       
   122             {
       
   123             User::Leave(99);
       
   124             }
       
   125         }
       
   126     else if ( iAction == K_TC9_NewFileNameWhenRecordSecondTimeMPEG4FileFormat )
       
   127         {
       
   128         AddDriveLetterToPath(_L("recordQCIF.mp4"), file);
       
   129         
       
   130         TRAPD(err,
       
   131             iCamc->OpenFileL( file, camHandle, 
       
   132             controllerUid,
       
   133             formatUidMP4,
       
   134             _L8("video/mp4v-es; profile-level-id=3"),
       
   135             TFourCC(' ', 'A', 'A', 'C') ));
       
   136         
       
   137         if (err)
       
   138             {
       
   139             User::Leave(99);
       
   140             }
       
   141         }
       
   142     else
       
   143         {       
       
   144         AddDriveLetterToPath(_L("recordQCIF.3gp"), file);
       
   145         
       
   146         TRAPD(err,
       
   147             iCamc->OpenFileL( file, camHandle, 
       
   148             controllerUid,
       
   149             formatUid,
       
   150             _L8("video/H263-2000"),
       
   151             TFourCC(' ', 'A', 'M', 'R') ));
       
   152         
       
   153         if (err)
       
   154             {
       
   155             User::Leave(99);
       
   156             }
       
   157         }
       
   158     iOpenReady = EFalse;
       
   159     
       
   160     // Main part of program is a wait loop
       
   161     // This function completes when the scheduler stops
       
   162     CActiveScheduler::Start();
       
   163     
       
   164     if ( iError )
       
   165         {
       
   166         User::Leave( iError );
       
   167         }
       
   168     }
       
   169 
       
   170 void CCamcTestClient_9::RunL()
       
   171     {
       
   172     
       
   173     // Trap RunL, to catch if the AO leaves.
       
   174     // A Walkaround...
       
   175     // RunError() should be used in this case, but
       
   176     // Apparently, it is not possible to use the AO RunError() virtual function
       
   177     // for that purpose, it is not called.
       
   178     
       
   179     TRAPD( err,RunLTrappedL() );
       
   180     if ( err ) 
       
   181         {
       
   182         SomethingInActiveObjectIsLeaving(err);
       
   183         }
       
   184     }
       
   185 
       
   186 void CCamcTestClient_9::RunLTrappedL()
       
   187     {
       
   188     if ( iOpenReady )  
       
   189         { 
       
   190         iOpenReady = EFalse;
       
   191         switch ( iAction )
       
   192             {
       
   193             case K_Tc9_PrepareWhenControllerReadyWhitoutSetting:
       
   194             case K_Tc9_PrepareWhenControllerReadyOnlyVideoBitRateSetting:
       
   195             case K_Tc9_PrepareWhenControllerReadyOnlyVideoFrameSizeSetting:
       
   196                 {
       
   197                 break;
       
   198                 }
       
   199             case K_TC9_NewFileNameWhenInternalStop:
       
   200                 {
       
   201                 iCamc->SetMaxClipSizeL(TC9_FILE_SIZE_LIMIT) ; 
       
   202                 break;
       
   203                 }
       
   204             case K_TC9_NewFileNameWhenRecordSecondTimeMPEG4FileFormat:
       
   205                 {
       
   206                 iCamc->SetVideoFrameSizeL(TSize(352,288));
       
   207                 iCamc->SetVideoFrameRateL(TReal32(15));
       
   208                 iCamc->SetVideoBitRateL( TC9_VIDEO_BIT_RATE );
       
   209                 iCamc->SetAudioBitRateL(TInt( TC9_AUDIO_BIT_RATE_AAC ));
       
   210                 break;
       
   211                 }
       
   212             default:
       
   213                 {
       
   214                 // Set default parameters. They can be overwritten depending on the test case. 
       
   215                 iCamc->SetVideoFrameSizeL(TSize(176,144));
       
   216                 iCamc->SetVideoFrameRateL(TReal32(15));
       
   217                 iCamc->SetVideoBitRateL( TC9_VIDEO_BIT_RATE );
       
   218                 iCamc->SetAudioBitRateL(TInt( TC9_AUDIO_BIT_RATE ));
       
   219                 break;
       
   220                 }
       
   221 
       
   222             }
       
   223         
       
   224         switch ( iAction )
       
   225             {
       
   226             case  K_Tc9_PrepareWhenControllerReadyWhitoutSetting:
       
   227                 {
       
   228                 break;
       
   229                 }
       
   230             case K_Tc9_PrepareWhenControllerReadyOnlyVideoBitRateSetting:
       
   231                 {
       
   232                 iCamc->SetVideoBitRateL(TInt(50000));
       
   233                 break;
       
   234                 }
       
   235             case K_Tc9_PrepareWhenControllerReadyOnlyVideoFrameSizeSetting:
       
   236                 {
       
   237                 iCamc->SetVideoFrameSizeL(TSize(176,144));
       
   238                 break;
       
   239                 }
       
   240             case K_Tc9_SetMaxClipSizeLWhenControllerReadySize0:
       
   241                 {
       
   242                 iCamc->SetMaxClipSizeL( 0 );
       
   243                 break;
       
   244                 }
       
   245             case K_Tc9_SetMaxClipSizeLWhenControllerReadyKMMFNoMaxClipSize:
       
   246                 {
       
   247                 iCamc->SetMaxClipSizeL( KMMFNoMaxClipSize );
       
   248                 break;
       
   249                 }
       
   250             case K_Tc9_OpenFileInAFolderNonExistent:
       
   251                 {               
       
   252                 AddDriveLetterToPath(_L("non-existent-folder\\recordQCIF.3gp"), iFileName);
       
   253                 TMMFFileParams params;
       
   254                 params.iPath = iFileName;
       
   255                 TPckgC<TMMFFileParams> pckg(params);
       
   256                     
       
   257                 TUid controllerUid = {0x101F8503};	// controller implementation interface uid
       
   258                 TInt ret = iCamc->CustomCommandSync( TMMFMessageDestination( controllerUid, KMMFObjectHandleController ), ECamCControllerCCNewFilename, pckg, KNullDesC8);
       
   259                 if (ret != 0)
       
   260                     {
       
   261                     User::Leave(K_Tc9_ValueNotExpected);
       
   262                     }
       
   263                 iAction = K_Tc9_none;
       
   264                 break;
       
   265                 }
       
   266             default:
       
   267                 {
       
   268                 break;
       
   269                 }
       
   270             }
       
   271         iCamc->Prepare();
       
   272             
       
   273         }
       
   274     else if ( iPrepareReady ) 
       
   275         {
       
   276         TBool record = EFalse;
       
   277         switch ( iAction )
       
   278             {
       
   279             case K_Tc9_SetMaxClipSizeLWhenControllerReadySize0:
       
   280             case K_Tc9_SetMaxClipSizeLWhenControllerReadyKMMFNoMaxClipSize:
       
   281                 {
       
   282                 iPrepareReady = EFalse;
       
   283                 iCamc->Record();
       
   284                 record = EFalse;
       
   285                 break;
       
   286                 }
       
   287             case K_TC9_NewFileNameWhenPreparedNotRecording:
       
   288                 {
       
   289                 if (!iNewFileName)
       
   290                     {
       
   291                     AddDriveLetterToPath(_L("NewFileName.3gp"),iFileName);
       
   292                     
       
   293                     TMMFFileParams params;
       
   294                     params.iPath = iFileName;
       
   295                     TPckgC<TMMFFileParams> pckg(params);
       
   296                     
       
   297                     TUid controllerUid = {0x101F8503};	// controller implementation interface uid
       
   298                     TInt ret = iCamc->CustomCommandSync( TMMFMessageDestination( controllerUid, KMMFObjectHandleController ), ECamCControllerCCNewFilename, pckg, KNullDesC8);
       
   299                     if (ret != 0)
       
   300                         {
       
   301                         User::Leave(K_Tc9_ValueNotExpected);
       
   302                         }
       
   303 
       
   304                     iCamc->Prepare();
       
   305                     iAction = K_Tc9_none;
       
   306                     }
       
   307                 break;
       
   308                 }
       
   309             case K_TC9_NewFileNameWhenInternalStop :
       
   310                 {
       
   311                 iPrepareReady = EFalse;
       
   312                 iCamc->Record(); // No timer need, will eventually stop because of filesize limit.
       
   313                 break;
       
   314                 }
       
   315             
       
   316             default:
       
   317                 {
       
   318                 record = ETrue;
       
   319                 break;
       
   320                 }
       
   321             }
       
   322         if ( record )
       
   323             {
       
   324             iPrepareReady = EFalse;
       
   325             iCamc->Record();
       
   326             CTimer::After( iTimeout );
       
   327             }
       
   328         }
       
   329     
       
   330     else if ( iRecordingReady )
       
   331         {
       
   332         TBool close = EFalse;
       
   333         iRecordingReady = EFalse;
       
   334 
       
   335         TMMFFileParams params;
       
   336         switch ( iAction )
       
   337             {
       
   338             case K_Tc9_RecordTimeAvailWhenRecordingReady:
       
   339                 {
       
   340                 // Compare if default size limit is correctly returned by 
       
   341                 // a RecordTimeAvailableL      
       
   342                 TTimeIntervalMicroSeconds timeRemaining = iCamc->RecordTimeAvailable();
       
   343                 TInt64 timeRemainingInSec = timeRemaining.Int64()/1E6; //Max time is 3600s = 60min
       
   344                 
       
   345                 PRINT((_L("CCamCTest_9::RecordTimeAvailable5: timeRemainingInSec: %d "), I64INT(timeRemainingInSec  )));
       
   346                 
       
   347                 
       
   348                 
       
   349                 // Duration value depends on available disk drive space.
       
   350                 // Get the free space of the disk drive:
       
   351 
       
   352                 RFs fsSession;
       
   353                 fsSession.Connect();
       
   354                 TVolumeInfo volumeInfo;
       
   355                 TInt err = fsSession.Volume(volumeInfo,EDriveC);
       
   356                 fsSession.Close();
       
   357                 if (err)
       
   358                     {
       
   359                     User::Leave( KErrGeneral) ;
       
   360                     }
       
   361 
       
   362                 // Possible duration = available disk space/videobitrate
       
   363                 TInt64 calculatedDuration = volumeInfo.iFree / TInt64((TC9_VIDEO_BIT_RATE+TC9_AUDIO_BIT_RATE)/8);
       
   364                 
       
   365                 // If there is more space than the max length of the video -> 
       
   366                 // set the calculatedDuration to max length
       
   367                 if ( calculatedDuration > KMaxVideoLength) 
       
   368                     {
       
   369                     calculatedDuration = KMaxVideoLength;
       
   370                     }
       
   371                 
       
   372                 RDebug::Print(_L("CCamcTest_9::RecordTimeAvailable5 timeRemaining is %d "), I64INT(timeRemainingInSec ));
       
   373                 RDebug::Print(_L("CCamcTest_9::RecordTimeAvailable5 calculatedDuration is %d "), I64INT(calculatedDuration ) );
       
   374                 // Allows 5% error margin:
       
   375                 if ( ( timeRemainingInSec > calculatedDuration*1.05 ) ||
       
   376                     ( timeRemainingInSec < calculatedDuration*0.95 ) )
       
   377                     {
       
   378                     RDebug::Print(_L("CCamcTest_9::RecordTimeAvailable5 is leaving, because timeRemaining != Calculated ") );          
       
   379                     User::Leave( K_Tc9_ValueNotWithinRange ) ; 
       
   380                     }
       
   381                 close = ETrue;
       
   382                 break;
       
   383                 }
       
   384                 
       
   385             case K_TC9_NewFileNameWhenRecordSecondTime : 
       
   386                 {
       
   387                 if (!iRecord2ndTime)
       
   388                     {
       
   389                     iRecord2ndTime =ETrue;
       
   390                     AddDriveLetterToPath(_L("NewFileName.3gp"), iFileName );
       
   391                     
       
   392                     params.iPath = iFileName;
       
   393                     TPckgC<TMMFFileParams> pckg(params);
       
   394                     
       
   395                     TUid controllerUid = {0x101F8503};	// controller implementation interface uid
       
   396                     TInt ret = iCamc->CustomCommandSync( TMMFMessageDestination( controllerUid, KMMFObjectHandleController ), ECamCControllerCCNewFilename, pckg, KNullDesC8);
       
   397                     if (ret != 0)
       
   398                         {
       
   399                         User::Leave(K_Tc9_ValueNotExpected);
       
   400                         }
       
   401                     iCamc->Prepare();
       
   402                     iAction = K_Tc9_none;
       
   403                     }
       
   404                 break;          
       
   405                 }
       
   406 
       
   407             case K_TC9_NewFileNameWhenRecordSecondTimeDiffFileFormat : 
       
   408                 {
       
   409                 if (!iRecord2ndTime)
       
   410                     {
       
   411                     iRecord2ndTime =ETrue;
       
   412                     AddDriveLetterToPath(_L("NewFileName.3g2"), iFileName );
       
   413                     
       
   414                     params.iPath = iFileName;
       
   415                     TPckgC<TMMFFileParams> pckg(params);
       
   416                     
       
   417                     TUid controllerUid = {0x101F8503};	// controller implementation interface uid
       
   418                     TInt ret = iCamc->CustomCommandSync( TMMFMessageDestination( controllerUid, KMMFObjectHandleController ), ECamCControllerCCNewFilename, pckg, KNullDesC8);
       
   419                     if (ret != 0)
       
   420                         {
       
   421                         User::Leave(K_Tc9_ValueNotExpected);
       
   422                         }
       
   423                     iCamc->Prepare();
       
   424                     iAction = K_Tc9_none;
       
   425                     }
       
   426                 break;          
       
   427                 }
       
   428 
       
   429             case K_TC9_NewFileNameWhenRecordSecondTimeMPEG4FileFormat : 
       
   430                 {
       
   431                 if (!iRecord2ndTime)
       
   432                     {
       
   433                     iRecord2ndTime =ETrue;
       
   434                     AddDriveLetterToPath(_L("NewFileName.mp4"), iFileName );
       
   435                     
       
   436                     params.iPath = iFileName;
       
   437                     TPckgC<TMMFFileParams> pckg(params);
       
   438                     
       
   439                     TUid controllerUid = {0x101F8503};	// controller implementation interface uid
       
   440                     TInt ret = iCamc->CustomCommandSync( TMMFMessageDestination( controllerUid, KMMFObjectHandleController ), ECamCControllerCCNewFilename, pckg, KNullDesC8);
       
   441                     if (ret != 0)
       
   442                         {
       
   443                         User::Leave(K_Tc9_ValueNotExpected);
       
   444                         }
       
   445                     iCamc->Prepare();
       
   446                     iAction = K_Tc9_none;
       
   447                     }
       
   448                 break;          
       
   449                 }
       
   450 
       
   451             case K_TC9_NewFileNameWhenInternalStop : 
       
   452                 {             
       
   453                 if (!iRecord2ndTime)
       
   454                     {
       
   455                     iRecord2ndTime =ETrue;
       
   456                     AddDriveLetterToPath(_L("NewFileName.3gp"), iFileName );
       
   457 
       
   458                     params.iPath = iFileName;
       
   459                     TPckgC<TMMFFileParams> pckg(params);
       
   460                     
       
   461                     TUid controllerUid = {0x101F8503};	// controller implementation interface uid
       
   462                     TInt ret = iCamc->CustomCommandSync( TMMFMessageDestination( controllerUid, KMMFObjectHandleController ), ECamCControllerCCNewFilename, pckg, KNullDesC8);
       
   463                     if (ret != 0)
       
   464                         {
       
   465                         User::Leave(K_Tc9_ValueNotExpected);
       
   466                         }
       
   467 
       
   468                     iCamc->Prepare();
       
   469                     }
       
   470                 else
       
   471                     {
       
   472                     close = ETrue;
       
   473                     }
       
   474                 break;
       
   475 
       
   476                 }               
       
   477             default:
       
   478                 {
       
   479                 close = ETrue;
       
   480                 break;
       
   481                 }
       
   482             }
       
   483         if (close)
       
   484             {
       
   485             iCamc->Close();
       
   486             iClosed = ETrue;
       
   487             CTimer::After( 1000 );
       
   488             }
       
   489         }
       
   490 
       
   491     else 
       
   492         {
       
   493           RunLContinuedL();
       
   494         }
       
   495         
       
   496     if ( iClosed )
       
   497         {
       
   498         iCamc->Stop();
       
   499         CActiveScheduler::Stop();
       
   500         }
       
   501     }
       
   502 
       
   503 void CCamcTestClient_9::RunLContinuedL()
       
   504 // This function exist to skip a MS VC6 bug/feature
       
   505 // Without this, VC6 would complains about stack abuse. 
       
   506     {
       
   507         if ( iPaused ) //resume
       
   508         {
       
   509         switch ( iAction )
       
   510             {
       
   511             case K_TC9_NewFileNameWhenPaused : 
       
   512                 {
       
   513                     
       
   514                 AddDriveLetterToPath(_L("NewFileName.3gp"), iFileName );
       
   515                     
       
   516                 iAction=K_Tc9_none;     
       
   517                 
       
   518                 TMMFFileParams params;
       
   519                 params.iPath = iFileName;
       
   520                 TPckgC<TMMFFileParams> pckg(params);
       
   521                 
       
   522                 TUid controllerUid = {0x101F8503};	// controller implementation interface uid
       
   523                 TInt err = iCamc->CustomCommandSync( TMMFMessageDestination( controllerUid, KMMFObjectHandleController ), ECamCControllerCCNewFilename, pckg, KNullDesC8);
       
   524                 if (err)
       
   525                     {
       
   526                     User::Leave(err);
       
   527                     }
       
   528                 break;
       
   529                 }
       
   530             default:   
       
   531                 iPaused = EFalse;
       
   532                 iCamc->Record();
       
   533             }
       
   534         }
       
   535     
       
   536     else //timer
       
   537         {
       
   538         switch ( iAction )
       
   539             {
       
   540             case K_TC9_NewFileNameWhenRecording : 
       
   541                 {
       
   542                 AddDriveLetterToPath(_L("NewFileName.3gp"), iFileName );
       
   543                 
       
   544                 TMMFFileParams params;
       
   545                 params.iPath = iFileName;
       
   546                 TPckgC<TMMFFileParams> pckg(params);
       
   547                 
       
   548                 TUid controllerUid = {0x101F8503};	// controller implementation interface uid
       
   549                 TInt err = iCamc->CustomCommandSync( TMMFMessageDestination( controllerUid, KMMFObjectHandleController ), ECamCControllerCCNewFilename, pckg, KNullDesC8);
       
   550                 if (err)
       
   551                     {
       
   552                     User::Leave(err);
       
   553                     }
       
   554                 break;
       
   555                 }            
       
   556             case K_TC9_NewFileNameWhenPaused:
       
   557                 {
       
   558                 iCamc->PauseL();
       
   559                 CTimer::After(2 * TInt32 ( 1E6 ) ); // Pause for 2 seconds.
       
   560                 iPaused=ETrue;
       
   561                 break;
       
   562                 }
       
   563             default:
       
   564                 iCamc->Stop();        // Simulates that iRecording has been completed through the 
       
   565                 // MvruoRecordComplete callback
       
   566                 iRecordingReady=ETrue;				
       
   567                 CTimer::After( 1000 );
       
   568             }       
       
   569         }
       
   570     
       
   571     
       
   572     }
       
   573 
       
   574 
       
   575 
       
   576 void CCamcTestClient_9::DoCancel()
       
   577     {
       
   578     iCamc->Stop();
       
   579     iCamc->Close();
       
   580     delete iCamc;
       
   581     iCamc = NULL;
       
   582     }
       
   583 
       
   584 
       
   585 void CCamcTestClient_9::MvruoOpenComplete( TInt aError )
       
   586     {
       
   587     if (aError)
       
   588         {        
       
   589         SomethingInActiveObjectIsLeaving(aError);
       
   590         }
       
   591     else
       
   592         {
       
   593         iOpenReady = ETrue;
       
   594         RunL();
       
   595         }
       
   596     }
       
   597 
       
   598 void CCamcTestClient_9::MvruoPrepareComplete( TInt aError )
       
   599     {    
       
   600     if (aError)
       
   601         {
       
   602          SomethingInActiveObjectIsLeaving(aError);
       
   603         }
       
   604     else
       
   605         {
       
   606         iPrepareReady = ETrue;
       
   607         RunL();
       
   608         }
       
   609     }
       
   610 
       
   611 void CCamcTestClient_9::MvruoRecordComplete( TInt aError )
       
   612     {
       
   613     switch( iAction)
       
   614         {
       
   615         case K_Tc9_SetMaxClipSizeLWhenControllerReadySize0 :
       
   616         case K_Tc9_SetMaxClipSizeLWhenControllerReadyKMMFNoMaxClipSize :
       
   617             {
       
   618             if ( (aError ==  KErrDiskFull) || (aError == KErrCompletion ) )
       
   619                 {
       
   620                 // KErrCompletion if there is more space than needed for 60 min recording.
       
   621                 // Otherwise KErrDiskFull
       
   622                 aError = KErrNone;
       
   623                 }
       
   624             else
       
   625                 {
       
   626                 aError = KErrGeneral;
       
   627                 }
       
   628             break;
       
   629             }
       
   630         case K_TC9_NewFileNameWhenInternalStop :
       
   631             {
       
   632             if (aError == KErrCompletion)
       
   633                 {
       
   634                 // That's expected case.
       
   635                 aError = KErrNone;
       
   636                 }
       
   637             else
       
   638                 {
       
   639                 aError = KErrGeneral;
       
   640                 }
       
   641             break;
       
   642             }
       
   643         }
       
   644 
       
   645     if (aError)
       
   646         {
       
   647          SomethingInActiveObjectIsLeaving(aError);
       
   648         }
       
   649     else
       
   650         {
       
   651         iRecordingReady = ETrue;
       
   652         RunL();
       
   653         }
       
   654     }
       
   655 
       
   656 void CCamcTestClient_9::MvruoEvent(const TMMFEvent& /*aEvent*/) 
       
   657     {
       
   658     /* Should be never called ... */  
       
   659     SomethingInActiveObjectIsLeaving(99);
       
   660     }
       
   661 
       
   662 void CCamcTestClient_9::SomethingInActiveObjectIsLeaving (TInt aError)
       
   663     {
       
   664     // Something in the active object is leaving
       
   665     // or a fatal error has been found.
       
   666 
       
   667     // Stop the active object scheduler.
       
   668         iError=aError;
       
   669         iCamc->Stop();
       
   670         CActiveScheduler::Stop();
       
   671     }
       
   672 
       
   673