camcordermmfplugin/controller/Src/CamCController.cpp
changeset 15 50d5061ee01e
parent 0 9b3e960ffc8a
child 42 605672cc2a86
equal deleted inserted replaced
14:34024902876b 15:50d5061ee01e
    38 #define PRINT(x) RDebug::Print x;
    38 #define PRINT(x) RDebug::Print x;
    39 #else
    39 #else
    40 #define PRINT(x)
    40 #define PRINT(x)
    41 #endif
    41 #endif
    42 
    42 
       
    43 #include "OstTraceDefinitions.h"
       
    44 #ifdef OST_TRACE_COMPILER_IN_USE
       
    45 #include "CamCControllerTraces.h"
       
    46 #endif
    43 // ============================ MEMBER FUNCTIONS ===============================
    47 // ============================ MEMBER FUNCTIONS ===============================
    44 
    48 
    45 // -----------------------------------------------------------------------------
    49 // -----------------------------------------------------------------------------
    46 // CCamCController::NewL
    50 // CCamCController::NewL
    47 // Two-phased constructor.
    51 // Two-phased constructor.
    67 // (other items were commented in a header).
    71 // (other items were commented in a header).
    68 // -----------------------------------------------------------------------------
    72 // -----------------------------------------------------------------------------
    69 //
    73 //
    70 CCamCController::~CCamCController()
    74 CCamCController::~CCamCController()
    71     {
    75     {
       
    76     OstTrace0( CAMERASRV_PERFORMANCE, CCAMCCONTROLLER_CCAMCCONTROLLER, "e_CCamCController::~CCamCController 1" );
    72     PRINT((_L("CCamCController::~CCamCController enter      ")));
    77     PRINT((_L("CCamCController::~CCamCController enter      ")));
    73 
    78 
    74     delete iMediaRecorder;
    79     delete iMediaRecorder;
    75     iMediaRecorder = NULL;
    80     iMediaRecorder = NULL;
    76 
    81 
    93 
    98 
    94     iSupportedAudioTypes.Close();
    99     iSupportedAudioTypes.Close();
    95     delete iIdleStop;
   100     delete iIdleStop;
    96 
   101 
    97     PRINT((_L("CCamCController::~CCamCController exit      ")));
   102     PRINT((_L("CCamCController::~CCamCController exit      ")));
       
   103     OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAMCCONTROLLER_CCAMCCONTROLLER, "e_CCamCController::~CCamCController 0" );
    98     }
   104     }
    99 
   105 
   100 // -----------------------------------------------------------------------------
   106 // -----------------------------------------------------------------------------
   101 // CCamCController::ConstructL
   107 // CCamCController::ConstructL
   102 // Symbian 2nd phase constructor can leave.
   108 // Symbian 2nd phase constructor can leave.
   103 // (other items were commented in a header).
   109 // (other items were commented in a header).
   104 // -----------------------------------------------------------------------------
   110 // -----------------------------------------------------------------------------
   105 //
   111 //
   106 void CCamCController::ConstructL()
   112 void CCamCController::ConstructL()
   107     {
   113     {
       
   114     OstTrace0( CAMERASRV_PERFORMANCE, CCAMCCONTROLLER_CONSTRUCTL, "e_CCamCController::ConstructL 1" );
   108     PRINT((_L("CCamCController::ConstructL() in")));
   115     PRINT((_L("CCamCController::ConstructL() in")));
   109 
   116 
   110     iMediaRecorder = NULL;
   117     iMediaRecorder = NULL;
   111     iFileComposer = NULL;
   118     iFileComposer = NULL;
   112     iState = EStateNone;
   119     iState = EStateNone;
   147 
   154 
   148     // Idle priority Active object for async video stop operation
   155     // Idle priority Active object for async video stop operation
   149     iIdleStop = CIdle::NewL( CActive::EPriorityIdle );
   156     iIdleStop = CIdle::NewL( CActive::EPriorityIdle );
   150 
   157 
   151     PRINT((_L("CCamCController::ConstructL() out")));
   158     PRINT((_L("CCamCController::ConstructL() out")));
       
   159     OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAMCCONTROLLER_CONSTRUCTL, "e_CCamCController::ConstructL 0" );
   152     }
   160     }
   153 
   161 
   154 // -----------------------------------------------------------------------------
   162 // -----------------------------------------------------------------------------
   155 // CCamCController::AddDataSourceL
   163 // CCamCController::AddDataSourceL
   156 // Add data source to controller.
   164 // Add data source to controller.
   273 // Start recording.
   281 // Start recording.
   274 // (other items were commented in a header).
   282 // (other items were commented in a header).
   275 //
   283 //
   276 void CCamCController::PlayL()
   284 void CCamCController::PlayL()
   277     {
   285     {
       
   286     OstTrace0( CAMERASRV_PERFORMANCE, CCAMCCONTROLLER_PLAYL, "e_CCamCController::PlayL 1" );
   278     PRINT((_L("CCamCController::PlayL() in")));
   287     PRINT((_L("CCamCController::PlayL() in")));
   279 
   288 
   280     if ( iState == EStateRecording )
   289     if ( iState == EStateRecording )
   281         {
   290         {
       
   291         OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAMCCONTROLLER_PLAYL, "e_CCamCController::PlayL 0" );
   282         return;
   292         return;
   283         }
   293         }
   284 
   294 
   285     if ( ( iState != EStatePrepared ) && ( iState != EStatePaused ) )
   295     if ( ( iState != EStatePrepared ) && ( iState != EStatePaused ) )
   286         {
   296         {
   327         {
   337         {
   328         iMediaRecorder->ResumeL();
   338         iMediaRecorder->ResumeL();
   329         }
   339         }
   330     iState = EStateRecording;
   340     iState = EStateRecording;
   331     PRINT((_L("CCamCController::PlayL() out")));
   341     PRINT((_L("CCamCController::PlayL() out")));
       
   342     OstTrace0( CAMERASRV_PERFORMANCE, DUP2_CCAMCCONTROLLER_PLAYL, "e_CCamCController::PlayL 0" );
   332     }
   343     }
   333 
   344 
   334 // -----------------------------------------------------------------------------
   345 // -----------------------------------------------------------------------------
   335 // CCamCController::PauseL
   346 // CCamCController::PauseL
   336 // Pause recording.
   347 // Pause recording.
   354 // Stop recording.
   365 // Stop recording.
   355 // (other items were commented in a header).
   366 // (other items were commented in a header).
   356 //
   367 //
   357 void CCamCController::StopL()
   368 void CCamCController::StopL()
   358     {
   369     {
       
   370     OstTrace0( CAMERASRV_PERFORMANCE, CCAMCCONTROLLER_STOPL, "e_CCamCController::StopL 1" );
   359     PRINT((_L("CCamCController::StopL() in")));
   371     PRINT((_L("CCamCController::StopL() in")));
   360 
   372 
   361     if ( ( iState != EStateRecording ) && ( iState != EStatePaused ) )
   373     if ( ( iState != EStateRecording ) && ( iState != EStatePaused ) )
   362         {
   374         {
   363         PRINT((_L("CCamCController::StopL() out - not recording")));
   375         PRINT((_L("CCamCController::StopL() out - not recording")));
   422 		    }
   434 		    }
   423         iFileComposerReady = EFalse;
   435         iFileComposerReady = EFalse;
   424         }
   436         }
   425 
   437 
   426     PRINT((_L("CCamCController::StopL() out")));
   438     PRINT((_L("CCamCController::StopL() out")));
       
   439     OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAMCCONTROLLER_STOPL, "e_CCamCController::StopL 0" );
   427     }
   440     }
   428 
   441 
   429 // -----------------------------------------------------------------------------
   442 // -----------------------------------------------------------------------------
   430 // CCamCController::PositionL
   443 // CCamCController::PositionL
   431 // Returns current recording position.
   444 // Returns current recording position.
   505 // Handle custom commands to controller.
   518 // Handle custom commands to controller.
   506 // (other items were commented in a header).
   519 // (other items were commented in a header).
   507 //
   520 //
   508 void CCamCController::CustomCommand( TMMFMessage& aMessage )
   521 void CCamCController::CustomCommand( TMMFMessage& aMessage )
   509     {
   522     {
       
   523     OstTrace0( CAMERASRV_PERFORMANCE, CCAMCCONTROLLER_CUSTOMCOMMAND, "e_CCamCController::CustomCommand 1" );
   510     PRINT((_L("CCamCController::CustomCommand() in")));
   524     PRINT((_L("CCamCController::CustomCommand() in")));
   511     if ( aMessage.Destination().InterfaceId().iUid != KCamCUidControllerImplementation )
   525     if ( aMessage.Destination().InterfaceId().iUid != KCamCUidControllerImplementation )
   512         {
   526         {
   513         aMessage.Complete(KErrNotSupported);
   527         aMessage.Complete(KErrNotSupported);
   514         PRINT((_L("CCamCController::CustomCommand() KErrNotSupported out")));
   528         PRINT((_L("CCamCController::CustomCommand() KErrNotSupported out")));
   542             aMessage.Complete(error);
   556             aMessage.Complete(error);
   543             break;
   557             break;
   544             }
   558             }
   545         }
   559         }
   546     PRINT((_L("CCamCController::CustomCommand() out")));
   560     PRINT((_L("CCamCController::CustomCommand() out")));
       
   561     OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAMCCONTROLLER_CUSTOMCOMMAND, "e_CCamCController::CustomCommand 0" );
   547     }
   562     }
   548 
   563 
   549 // -----------------------------------------------------------------------------
   564 // -----------------------------------------------------------------------------
   550 // CCamCController::GetNumberOfMetaDataEntriesL
   565 // CCamCController::GetNumberOfMetaDataEntriesL
   551 // Get number of metadata entries.
   566 // Get number of metadata entries.
   572 // Called when mediarecorder has completed prepare command.
   587 // Called when mediarecorder has completed prepare command.
   573 // (other items were commented in a header).
   588 // (other items were commented in a header).
   574 //
   589 //
   575 void CCamCController::MmroPrepareComplete(TInt aError)
   590 void CCamCController::MmroPrepareComplete(TInt aError)
   576     {
   591     {
       
   592     OstTrace0( CAMERASRV_PERFORMANCE, CCAMCCONTROLLER_MMROPREPARECOMPLETE, "e_CCamCController::MmroPrepareComplete 1" );
   577     PRINT((_L("CCamCController::MmroPrepareComplete() error= %d      "), aError));
   593     PRINT((_L("CCamCController::MmroPrepareComplete() error= %d      "), aError));
   578 
   594 
   579     if ( aError == KErrNone )
   595     if ( aError == KErrNone )
   580         {
   596         {
   581         iState = EStatePrepared;
   597         iState = EStatePrepared;
   583 	if ( iFileComposerReady && !iMRPrepareCompleteSent )
   599 	if ( iFileComposerReady && !iMRPrepareCompleteSent )
   584 		{
   600 		{
   585 	    iMRPrepareCompleteSent = ETrue;
   601 	    iMRPrepareCompleteSent = ETrue;
   586 	    DoSendEventToClient(TMMFEvent(KMMFEventCategoryVideoPrepareComplete, aError));
   602 	    DoSendEventToClient(TMMFEvent(KMMFEventCategoryVideoPrepareComplete, aError));
   587 		}
   603 		}
       
   604     OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAMCCONTROLLER_MMROPREPARECOMPLETE, "e_CCamCController::MmroPrepareComplete 0" );
   588     }
   605     }
   589 
   606 
   590 // -----------------------------------------------------------------------------
   607 // -----------------------------------------------------------------------------
   591 // CCamCController::MmroStateChange
   608 // CCamCController::MmroStateChange
   592 // Called when mediarecorder has changed state.
   609 // Called when mediarecorder has changed state.
  1195 // Prepare camcorder for recording.
  1212 // Prepare camcorder for recording.
  1196 // (other items were commented in a header).
  1213 // (other items were commented in a header).
  1197 //
  1214 //
  1198 void CCamCController::MvrcPrepareL()
  1215 void CCamCController::MvrcPrepareL()
  1199     {
  1216     {
       
  1217     OstTrace0( CAMERASRV_PERFORMANCE, CCAMCCONTROLLER_MVRCPREPAREL, "e_CCamCController::MvrcPrepareL 1" );
  1200     PRINT((_L("CCamCController::MvrcPrepareL() in")));
  1218     PRINT((_L("CCamCController::MvrcPrepareL() in")));
  1201 
  1219 
  1202     if ( iState == EStatePrepared )
  1220     if ( iState == EStatePrepared )
  1203         {
  1221         {
  1204         DoSendEventToClient(TMMFEvent(KMMFEventCategoryVideoPrepareComplete, KErrNone));
  1222         DoSendEventToClient(TMMFEvent(KMMFEventCategoryVideoPrepareComplete, KErrNone));
  1254         {
  1272         {
  1255         iFileComposerReady = ETrue;
  1273         iFileComposerReady = ETrue;
  1256         }
  1274         }
  1257 
  1275 
  1258     PRINT((_L("CCamCController::MvrcPrepareL() out")));
  1276     PRINT((_L("CCamCController::MvrcPrepareL() out")));
       
  1277     OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAMCCONTROLLER_MVRCPREPAREL, "e_CCamCController::MvrcPrepareL 0" );
  1259     }
  1278     }
  1260 
  1279 
  1261 // -----------------------------------------------------------------------------
  1280 // -----------------------------------------------------------------------------
  1262 // CCamCController::MvrcSetCameraHandleL
  1281 // CCamCController::MvrcSetCameraHandleL
  1263 // Set camera handle.
  1282 // Set camera handle.
  1399 // Handle custom commands NewFilename to controller.
  1418 // Handle custom commands NewFilename to controller.
  1400 // (other items were commented in a header).
  1419 // (other items were commented in a header).
  1401 //
  1420 //
  1402 void CCamCController::NewFilenameL( TMMFMessage& aMessage )
  1421 void CCamCController::NewFilenameL( TMMFMessage& aMessage )
  1403     {
  1422     {
       
  1423     OstTrace0( CAMERASRV_PERFORMANCE, CCAMCCONTROLLER_NEWFILENAMEL, "e_CCamCController::NewFilenameL 1" );
  1404     PRINT((_L("CCamCController::NewFilename() in")));
  1424     PRINT((_L("CCamCController::NewFilename() in")));
  1405 
  1425 
  1406     if ( iState == EStatePrepared )
  1426     if ( iState == EStatePrepared )
  1407         {
  1427         {
  1408         iState = EStateOpen;
  1428         iState = EStateOpen;
  1430 
  1450 
  1431     iFileName.Copy( parser.FullName() );
  1451     iFileName.Copy( parser.FullName() );
  1432     iForceDataSinkFileName = ETrue;
  1452     iForceDataSinkFileName = ETrue;
  1433 
  1453 
  1434     PRINT((_L("CCamCController::NewFilename() out")));
  1454     PRINT((_L("CCamCController::NewFilename() out")));
       
  1455     OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAMCCONTROLLER_NEWFILENAMEL, "e_CCamCController::NewFilenameL 0" );
  1435     }
  1456     }
  1436 
  1457 
  1437 // -----------------------------------------------------------------------------
  1458 // -----------------------------------------------------------------------------
  1438 // CCamCController::ReadyToOpenSource
  1459 // CCamCController::ReadyToOpenSource
  1439 // Check if controller is ready to open mediarecorder and filecomposer
  1460 // Check if controller is ready to open mediarecorder and filecomposer
  1492 // CCamCController::DoIdleStop
  1513 // CCamCController::DoIdleStop
  1493 // ---------------------------------------------------------------------------
  1514 // ---------------------------------------------------------------------------
  1494 //
  1515 //
  1495 void CCamCController::DoIdleStop()
  1516 void CCamCController::DoIdleStop()
  1496     {
  1517     {
       
  1518     OstTrace0( CAMERASRV_PERFORMANCE, CCAMCCONTROLLER_DOIDLESTOP, "e_CCamCController::DoIdleStop 1" );
  1497     PRINT((_L("CCamCController::DoIdleStop() in")));
  1519     PRINT((_L("CCamCController::DoIdleStop() in")));
  1498     TInt error = KErrNone;
  1520     TInt error = KErrNone;
  1499 
  1521 
  1500     TRAP( error, iFileComposer->SinkStopL() );
  1522     TRAP( error, iFileComposer->SinkStopL() );
  1501     if ( error != KErrNone )
  1523     if ( error != KErrNone )
  1518 		iState = EStateOpen;
  1540 		iState = EStateOpen;
  1519 		}
  1541 		}
  1520     iFileComposerReady = EFalse;
  1542     iFileComposerReady = EFalse;
  1521     iAsyncStop = EFalse;
  1543     iAsyncStop = EFalse;
  1522     PRINT((_L("CCamCController::DoIdleStop() out")));
  1544     PRINT((_L("CCamCController::DoIdleStop() out")));
       
  1545     OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAMCCONTROLLER_DOIDLESTOP, "e_CCamCController::DoIdleStop 0" );
  1523     }
  1546     }
  1524 
  1547 
  1525 
  1548 
  1526 //  End of File
  1549 //  End of File