camerauis/cameraxui/cxengine/src/cxevideocapturecontrolsymbian.cpp
changeset 24 2094593137f5
parent 21 fa6d9f75d6a6
child 29 699651f2666f
equal deleted inserted replaced
21:fa6d9f75d6a6 24:2094593137f5
   124 
   124 
   125     // enabling setting change callbacks to videocapturecontrol
   125     // enabling setting change callbacks to videocapturecontrol
   126     connect(&mSettings, SIGNAL(settingValueChanged(const QString&,QVariant)),
   126     connect(&mSettings, SIGNAL(settingValueChanged(const QString&,QVariant)),
   127             this, SLOT(handleSettingValueChanged(const QString&,QVariant)));
   127             this, SLOT(handleSettingValueChanged(const QString&,QVariant)));
   128 
   128 
       
   129     connect(&mSettings, SIGNAL(sceneChanged(CxeScene&)), this, SLOT(handleSceneChanged(CxeScene&)));
       
   130 
   129     OstTrace0(camerax_performance, CXEVIDEOCAPTURECONTROLSYMBIAN_CREATE_M2, "msg: e_CX_ENGINE_CONNECT_SIGNALS 0");
   131     OstTrace0(camerax_performance, CXEVIDEOCAPTURECONTROLSYMBIAN_CREATE_M2, "msg: e_CX_ENGINE_CONNECT_SIGNALS 0");
   130 
   132 
   131     OstTrace0(camerax_performance, CXEVIDEOCAPTURECONTROLSYMBIAN_CREATE_OUT, "msg: e_CX_VIDEOCAPTURECONTROL_NEW 0");
   133     OstTrace0(camerax_performance, CXEVIDEOCAPTURECONTROLSYMBIAN_CREATE_OUT, "msg: e_CX_VIDEOCAPTURECONTROL_NEW 0");
   132     CX_DEBUG_EXIT_FUNCTION();
   134     CX_DEBUG_EXIT_FUNCTION();
   133 }
   135 }
   370     }
   372     }
   371 
   373 
   372     CX_DEBUG(("Video resoulution (%d,%d)", mCurrentVideoDetails.mWidth,
   374     CX_DEBUG(("Video resoulution (%d,%d)", mCurrentVideoDetails.mWidth,
   373                                            mCurrentVideoDetails.mHeight));
   375                                            mCurrentVideoDetails.mHeight));
   374     CX_DEBUG(("Video bitrate = %d)", mCurrentVideoDetails.mVideoBitRate));
   376     CX_DEBUG(("Video bitrate = %d)", mCurrentVideoDetails.mVideoBitRate));
   375     CX_DEBUG(("Video frame rate = %f)", mCurrentVideoDetails.mVideoFrameRate));
       
   376 
   377 
   377     OstTrace0(camerax_performance, CXEVIDEOCAPTURECONTROLSYMBIAN_PREPARE, "msg: e_CX_VIDCAPCONT_PREPARE 1");
   378     OstTrace0(camerax_performance, CXEVIDEOCAPTURECONTROLSYMBIAN_PREPARE, "msg: e_CX_VIDCAPCONT_PREPARE 1");
   378     TSize frameSize;
   379     TSize frameSize;
   379     frameSize.SetSize(mCurrentVideoDetails.mWidth, mCurrentVideoDetails.mHeight);
   380     frameSize.SetSize(mCurrentVideoDetails.mWidth, mCurrentVideoDetails.mHeight);
   380 
   381 
   381     int muteSetting = 0; // audio enabled
   382     int muteSetting = 0; // audio enabled
   382     mSettings.get(CxeSettingIds::VIDEO_MUTE_SETTING, muteSetting);
   383     mSettings.get(CxeSettingIds::VIDEO_MUTE_SETTING, muteSetting);
   383 
   384 
       
   385     // Check if scene defines frame rate.
       
   386     // Use generic frame rate defined in video details, if no value is set in scene.
       
   387     int frameRate = 0;
       
   388     mSettings.get(CxeSettingIds::FRAME_RATE, frameRate);
       
   389     if (frameRate <= 0) {
       
   390         frameRate = mCurrentVideoDetails.mVideoFrameRate;
       
   391     }
       
   392 
       
   393     CX_DEBUG(("Video frame rate = %d)", frameRate));
       
   394 
   384     TRAPD(err,
   395     TRAPD(err,
   385               {
   396               {
   386               mVideoRecorder->SetVideoFrameSizeL(frameSize);
   397               mVideoRecorder->SetVideoFrameSizeL(frameSize);
   387               mVideoRecorder->SetVideoFrameRateL(mCurrentVideoDetails.mVideoFrameRate);
   398               mVideoRecorder->SetVideoFrameRateL(frameRate);
   388               mVideoRecorder->SetVideoBitRateL(mCurrentVideoDetails.mVideoBitRate);
   399               mVideoRecorder->SetVideoBitRateL(mCurrentVideoDetails.mVideoBitRate);
   389               mVideoRecorder->SetAudioEnabledL(muteSetting == 0);
   400               mVideoRecorder->SetAudioEnabledL(muteSetting == 0);
   390               // "No limit" value is handled in video recorder wrapper.
   401               // "No limit" value is handled in video recorder wrapper.
   391               mVideoRecorder->SetMaxClipSizeL(mCurrentVideoDetails.mMaximumSizeInBytes);
   402               mVideoRecorder->SetMaxClipSizeL(mCurrentVideoDetails.mMaximumSizeInBytes);
   392               }
   403               }
   663 {
   674 {
   664     CX_DEBUG_ENTER_FUNCTION();
   675     CX_DEBUG_ENTER_FUNCTION();
   665 
   676 
   666     setState(CxeVideoCaptureControl::Paused);
   677     setState(CxeVideoCaptureControl::Paused);
   667     TRAPD(pauseErr, mVideoRecorder->PauseL());
   678     TRAPD(pauseErr, mVideoRecorder->PauseL());
       
   679     // play the sound, but not changing the state
       
   680     mVideoStopSoundPlayer->play();
   668     if (pauseErr) {
   681     if (pauseErr) {
   669         CX_DEBUG(("[WARNING] Error %d pausing!", pauseErr));
   682         CX_DEBUG(("[WARNING] Error %d pausing!", pauseErr));
   670         //pause operation failed, report it
   683         //pause operation failed, report it
   671         emit videoComposed(CxeErrorHandlingSymbian::map(pauseErr), filename());
   684         emit videoComposed(CxeErrorHandlingSymbian::map(pauseErr), filename());
   672         // release resources.
   685         // release resources.
  1076 */
  1089 */
  1077 void CxeVideoCaptureControlSymbian::remainingTime(int &time)
  1090 void CxeVideoCaptureControlSymbian::remainingTime(int &time)
  1078 {
  1091 {
  1079     CX_DEBUG_ENTER_FUNCTION();
  1092     CX_DEBUG_ENTER_FUNCTION();
  1080 
  1093 
  1081     if (state() == CxeVideoCaptureControl::Recording) {
  1094     if (state() == CxeVideoCaptureControl::Recording ||
       
  1095         state() == CxeVideoCaptureControl::Paused) {
  1082         TTimeIntervalMicroSeconds remaining = 0;
  1096         TTimeIntervalMicroSeconds remaining = 0;
  1083         remaining = mVideoRecorder->RecordTimeAvailable();
  1097         remaining = mVideoRecorder->RecordTimeAvailable();
  1084         time = remaining.Int64() * 1.0 / KOneSecond;
  1098         time = remaining.Int64() * 1.0 / KOneSecond;
  1085         CX_DEBUG(( "timeRemaining2: %d", time ));
  1099         CX_DEBUG(( "timeRemaining2: %d", time ));
  1086     } else {
  1100     } else {
  1173 {
  1187 {
  1174     CX_DEBUG_ENTER_FUNCTION();
  1188     CX_DEBUG_ENTER_FUNCTION();
  1175 
  1189 
  1176     TTimeIntervalMicroSeconds timeElapsed = 0;
  1190     TTimeIntervalMicroSeconds timeElapsed = 0;
  1177     bool ok = false;
  1191     bool ok = false;
  1178     if (state() == CxeVideoCaptureControl::Recording) {
  1192     if (state() == CxeVideoCaptureControl::Recording ||
       
  1193         state() == CxeVideoCaptureControl::Paused) {
  1179         TRAPD( err, timeElapsed = mVideoRecorder->DurationL() );
  1194         TRAPD( err, timeElapsed = mVideoRecorder->DurationL() );
  1180         if (!err) {
  1195         if (!err) {
  1181             time = timeElapsed.Int64() * 1.0 / KOneSecond;
  1196             time = timeElapsed.Int64() * 1.0 / KOneSecond;
  1182             CX_DEBUG(("timeElapsed2: %d", time));
  1197             CX_DEBUG(("timeElapsed2: %d", time));
  1183             ok = true;
  1198             ok = true;
  1230             }
  1245             }
  1231         } else if (settingId == CxeSettingIds::VIDEO_MUTE_SETTING) {
  1246         } else if (settingId == CxeSettingIds::VIDEO_MUTE_SETTING) {
  1232             // mute setting changed, apply the new setting and re-prepare.
  1247             // mute setting changed, apply the new setting and re-prepare.
  1233             setState(Preparing);
  1248             setState(Preparing);
  1234             prepare();
  1249             prepare();
       
  1250         } else if (settingId == CxeSettingIds::FRAME_RATE){
       
  1251             // Frame rate setting changed. Need to re-prepare if we are prepared already.
       
  1252             // Otherwise can wait for next init call.
       
  1253             if (state() == Ready) {
       
  1254                 setState(Preparing);
       
  1255                 prepare();
       
  1256             }
  1235         } else {
  1257         } else {
  1236             // Setting not relevant to video mode
  1258             // Setting not relevant to video mode
  1237         }
  1259         }
  1238     }
  1260     }
  1239 
  1261 
       
  1262     CX_DEBUG_EXIT_FUNCTION();
       
  1263 }
       
  1264 
       
  1265 /*!
       
  1266  * Scene mode changed. We need to know about it because frame rate
       
  1267  * might have changed.
       
  1268  */
       
  1269 void CxeVideoCaptureControlSymbian::handleSceneChanged(CxeScene& scene)
       
  1270 {
       
  1271     CX_DEBUG_ENTER_FUNCTION();
       
  1272 
       
  1273     // make sure we are in video mode
       
  1274     if (mCameraDeviceControl.mode() == Cxe::VideoMode) {
       
  1275         // Frame rate setting might have changed so re-prepare.
       
  1276         if (state() == Ready) {
       
  1277             setState(Preparing);
       
  1278             prepare();
       
  1279         }
       
  1280 
       
  1281     }
  1240     CX_DEBUG_EXIT_FUNCTION();
  1282     CX_DEBUG_EXIT_FUNCTION();
  1241 }
  1283 }
  1242 
  1284 
  1243 /*!
  1285 /*!
  1244 * Disk space changed.
  1286 * Disk space changed.