equal
deleted
inserted
replaced
179 mViewfinderControl.stop(); |
179 mViewfinderControl.stop(); |
180 |
180 |
181 // stop video-recording in-case if its ongoing. |
181 // stop video-recording in-case if its ongoing. |
182 stop(); |
182 stop(); |
183 |
183 |
|
184 // Check if state is stopping, in which case we have to inform the |
|
185 // file harvester that a file is to be completed. We would not |
|
186 // call harvestFile otherwise in this case. |
|
187 // Otherwise the video will not be found from videos app. |
|
188 if (state() == Stopping) { |
|
189 emit videoComposed(CxeError::None, mCurrentFilename); |
|
190 } |
|
191 |
184 mSnapshotControl.stop(); |
192 mSnapshotControl.stop(); |
185 |
193 |
186 if (mVideoRecorder) { |
194 if (mVideoRecorder) { |
187 mVideoRecorder->close(); |
195 mVideoRecorder->close(); |
188 } |
196 } |
189 |
|
190 mCurrentFilename = QString(""); |
|
191 |
197 |
192 setState(Idle); |
198 setState(Idle); |
193 |
199 |
194 OstTrace0( camerax_performance, DUP1_CXEVIDEOCAPTURECONTROLSYMBIAN_DEINIT, "msg: e_CX_VIDEO_CAPCONT_DEINIT 0" ); |
200 OstTrace0( camerax_performance, DUP1_CXEVIDEOCAPTURECONTROLSYMBIAN_DEINIT, "msg: e_CX_VIDEO_CAPCONT_DEINIT 0" ); |
195 } |
201 } |
451 setState(Stopping); |
457 setState(Stopping); |
452 } catch (const std::exception &e) { |
458 } catch (const std::exception &e) { |
453 CX_DEBUG(("CxeVideoCaptureControlSymbian - async stop failed, try sync..")); |
459 CX_DEBUG(("CxeVideoCaptureControlSymbian - async stop failed, try sync..")); |
454 try { |
460 try { |
455 mVideoRecorder->stop(false); |
461 mVideoRecorder->stop(false); |
456 // stop operation went fine, set back the state to Initialized. |
462 // stopping went ok |
457 setState(Initialized); |
463 emulateNormalStopping(); |
458 // must increment counter now since no callback is coming in sync stop |
|
459 mFilenameGenerator.raiseCounterValue(); |
|
460 } catch (const std::exception &e) { |
464 } catch (const std::exception &e) { |
461 // Even synchronous stopping failed -> release resources. |
465 // Even synchronous stopping failed -> release resources. |
462 CX_DEBUG(("CxeVideoCaptureControlSymbian - sync stop failed, too!")); |
466 CX_DEBUG(("CxeVideoCaptureControlSymbian - sync stop failed, too!")); |
463 handleComposeFailed(qt_symbian_exception2Error(e)); |
467 handleComposeFailed(qt_symbian_exception2Error(e)); |
464 } |
468 } |
521 setState(CxeVideoCaptureControl::Ready); |
525 setState(CxeVideoCaptureControl::Ready); |
522 } else if (aError == KErrCompletion) { |
526 } else if (aError == KErrCompletion) { |
523 // KErrCompletion is received when video recording stops |
527 // KErrCompletion is received when video recording stops |
524 // because of maximum clip size is reached. Emulate |
528 // because of maximum clip size is reached. Emulate |
525 // normal stopping. |
529 // normal stopping. |
526 setState(Stopping); |
530 emulateNormalStopping(); |
527 MvruoEvent(TMMFEvent(KCamCControllerCCVideoRecordStopped, KErrNone)); |
|
528 MvruoEvent(TMMFEvent(KCamCControllerCCVideoFileComposed, KErrNone)); |
|
529 } |
531 } |
530 else { |
532 else { |
531 // error during recording, report to client |
533 // error during recording, report to client |
532 handleComposeFailed(aError); |
534 handleComposeFailed(aError); |
533 } |
535 } |
628 */ |
630 */ |
629 void CxeVideoCaptureControlSymbian::releaseResources() |
631 void CxeVideoCaptureControlSymbian::releaseResources() |
630 { |
632 { |
631 CX_DEBUG_ENTER_FUNCTION(); |
633 CX_DEBUG_ENTER_FUNCTION(); |
632 |
634 |
633 // Save the state and filename before releasing. |
|
634 QString filenameCopy(filename()); |
|
635 CxeVideoCaptureControl::State stateCopy(state()); |
|
636 |
|
637 // first de-init videocapture control |
635 // first de-init videocapture control |
638 deinit(); |
636 deinit(); |
639 reset(); |
637 reset(); |
640 |
|
641 // Check if state is stopping, in which case we have to inform the |
|
642 // file harvester that a file is to be completed. We would not |
|
643 // call harvestFile otherwise in this case. |
|
644 // Otherwise the video will not be found from videos app. |
|
645 if (stateCopy == CxeVideoCaptureControl::Stopping) { |
|
646 emit videoComposed(CxeError::None, filenameCopy); |
|
647 } |
|
648 |
638 |
649 delete mVideoRecorder; |
639 delete mVideoRecorder; |
650 mVideoRecorder = NULL; |
640 mVideoRecorder = NULL; |
651 |
641 |
652 CX_DEBUG_EXIT_FUNCTION(); |
642 CX_DEBUG_EXIT_FUNCTION(); |
933 emit videoComposed(CxeErrorHandlingSymbian::map(error), filename()); |
923 emit videoComposed(CxeErrorHandlingSymbian::map(error), filename()); |
934 // Cleanup |
924 // Cleanup |
935 deinit(); |
925 deinit(); |
936 CX_DEBUG_EXIT_FUNCTION(); |
926 CX_DEBUG_EXIT_FUNCTION(); |
937 } |
927 } |
|
928 |
|
929 /*! |
|
930 * Helper method to emulate video stopping events. |
|
931 */ |
|
932 void CxeVideoCaptureControlSymbian::emulateNormalStopping() |
|
933 { |
|
934 CX_DEBUG_ENTER_FUNCTION(); |
|
935 |
|
936 setState(Stopping); |
|
937 MvruoEvent(TMMFEvent(KCamCControllerCCVideoRecordStopped, KErrNone)); |
|
938 MvruoEvent(TMMFEvent(KCamCControllerCCVideoFileComposed, KErrNone)); |
|
939 |
|
940 CX_DEBUG_EXIT_FUNCTION(); |
|
941 } |
938 // End of file |
942 // End of file |