camerauis/cameraxui/cxengine/src/cxevideocapturecontrolsymbian.cpp
changeset 37 64817133cd1d
parent 32 5c1e3c6aa4ef
child 48 42ba2d16bf40
equal deleted inserted replaced
36:b12f3922a74f 37:64817133cd1d
     1 /*
     1 /*
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    90 
    90 
    91     qRegisterMetaType<CxeVideoCaptureControl::State> ();
    91     qRegisterMetaType<CxeVideoCaptureControl::State> ();
    92     initializeStates();
    92     initializeStates();
    93 
    93 
    94     mVideoStopSoundPlayer = new
    94     mVideoStopSoundPlayer = new
    95              CxeSoundPlayerSymbian(CxeSoundPlayerSymbian::VideoCaptureStop);
    95              CxeSoundPlayerSymbian(CxeSoundPlayerSymbian::VideoCaptureStop,
       
    96                                    mSettings);
    96     mVideoStartSoundPlayer = new
    97     mVideoStartSoundPlayer = new
    97              CxeSoundPlayerSymbian(CxeSoundPlayerSymbian::VideoCaptureStart);
    98              CxeSoundPlayerSymbian(CxeSoundPlayerSymbian::VideoCaptureStart,
       
    99                                    mSettings);
    98 
   100 
    99     // If camera is already allocated, call the slot ourselves.
   101     // If camera is already allocated, call the slot ourselves.
   100     if (mCameraDevice.camera()) {
   102     if (mCameraDevice.camera()) {
   101         handleCameraAllocated(CxeError::None);
   103         handleCameraAllocated(CxeError::None);
   102     }
   104     }
   113     // connect playing sound signals
   115     // connect playing sound signals
   114     connect(mVideoStartSoundPlayer, SIGNAL(playComplete(int)),
   116     connect(mVideoStartSoundPlayer, SIGNAL(playComplete(int)),
   115             this, SLOT(handleSoundPlayed()));
   117             this, SLOT(handleSoundPlayed()));
   116 
   118 
   117     // connect snapshot ready signal
   119     // connect snapshot ready signal
   118     connect(&mSnapshotControl, SIGNAL(snapshotReady(CxeError::Id, const QPixmap&)),
   120     connect(&mSnapshotControl, SIGNAL(snapshotReady(CxeError::Id, const QImage&)),
   119             this, SLOT(handleSnapshotReady(CxeError::Id, const QPixmap&)));
   121             this, SLOT(handleSnapshotReady(CxeError::Id, const QImage&)));
   120 
   122 
   121     // enabling setting change callbacks to videocapturecontrol
   123     // enabling setting change callbacks to videocapturecontrol
   122     connect(&mSettings, SIGNAL(settingValueChanged(const QString&,QVariant)),
   124     connect(&mSettings, SIGNAL(settingValueChanged(const QString&,QVariant)),
   123             this, SLOT(handleSettingValueChanged(const QString&,QVariant)));
   125             this, SLOT(handleSettingValueChanged(const QString&,QVariant)));
   124     connect(&mSettings, SIGNAL(sceneChanged(CxeScene&)),
   126     connect(&mSettings, SIGNAL(sceneChanged(CxeScene&)),
   162 
   164 
   163     OstTrace0( camerax_performance, DUP1_CXEVIDEOCAPTURECONTROLSYMBIAN_INIT, "msg: e_CX_VIDEO_CAPCONT_INIT 0" );
   165     OstTrace0( camerax_performance, DUP1_CXEVIDEOCAPTURECONTROLSYMBIAN_INIT, "msg: e_CX_VIDEO_CAPCONT_INIT 0" );
   164     CX_DEBUG_EXIT_FUNCTION();
   166     CX_DEBUG_EXIT_FUNCTION();
   165 }
   167 }
   166 
   168 
   167 /*
   169 /*!
   168 * Releases all resources
   170 * Releases all resources
   169 */
   171 */
   170 void CxeVideoCaptureControlSymbian::deinit()
   172 void CxeVideoCaptureControlSymbian::deinit()
   171 {
   173 {
   172     CX_DEBUG_ENTER_FUNCTION();
   174     CX_DEBUG_ENTER_FUNCTION();
   328         mVideoRecorder->prepare();
   330         mVideoRecorder->prepare();
   329 
   331 
   330         // Prepare snapshot. Snapshot control throws error if problems.
   332         // Prepare snapshot. Snapshot control throws error if problems.
   331         QSize snapshotSize = mSnapshotControl.calculateSnapshotSize(
   333         QSize snapshotSize = mSnapshotControl.calculateSnapshotSize(
   332                                 mViewfinderControl.deviceDisplayResolution(),
   334                                 mViewfinderControl.deviceDisplayResolution(),
   333                                 QSize(mCurrentVideoDetails.mWidth, mCurrentVideoDetails.mHeight));
   335                                 mCurrentVideoDetails.mAspectRatio);
   334         mSnapshotControl.start(snapshotSize);
   336         mSnapshotControl.start(snapshotSize);
   335 
   337 
   336         // Prepare zoom only when there are no errors during prepare.
   338         // Prepare zoom only when there are no errors during prepare.
   337         emit prepareZoomForVideo();
   339         emit prepareZoomForVideo();
   338         emit videoPrepareComplete(CxeError::None);
   340         emit videoPrepareComplete(CxeError::None);
   707     }
   709     }
   708 
   710 
   709     CX_DEBUG_EXIT_FUNCTION();
   711     CX_DEBUG_EXIT_FUNCTION();
   710 }
   712 }
   711 
   713 
   712 /*
   714 /*!
   713 * calculates remaining video recording time.
   715 * calculates remaining video recording time.
   714 */
   716 */
   715 void CxeVideoCaptureControlSymbian::remainingTime(int &time)
   717 void CxeVideoCaptureControlSymbian::remainingTime(int &time)
   716 {
   718 {
   717     CX_DEBUG_ENTER_FUNCTION();
   719     CX_DEBUG_ENTER_FUNCTION();
   791 /*!
   793 /*!
   792 * Handle new snapshot.
   794 * Handle new snapshot.
   793 * @param status Status code for getting the snapshot.
   795 * @param status Status code for getting the snapshot.
   794 * @param snapshot Snapshot pixmap. Empty if error code reported.
   796 * @param snapshot Snapshot pixmap. Empty if error code reported.
   795 */
   797 */
   796 void CxeVideoCaptureControlSymbian::handleSnapshotReady(CxeError::Id status, const QPixmap& snapshot)
   798 void CxeVideoCaptureControlSymbian::handleSnapshotReady(CxeError::Id status, const QImage &snapshot)
   797 {
   799 {
   798     CX_DEBUG_ENTER_FUNCTION();
   800     CX_DEBUG_ENTER_FUNCTION();
   799 
   801 
   800     if (mCameraDeviceControl.mode() == Cxe::VideoMode) {
   802     if (mCameraDeviceControl.mode() == Cxe::VideoMode) {
   801         // Need to store snapshot for ui to be able to get it also later.
   803         // Need to store snapshot for ui to be able to get it also later.
   802         mSnapshot = snapshot;
   804         mSnapshot = QPixmap::fromImage(snapshot);
   803         emit snapshotReady(status, snapshot, filename());
   805         emit snapshotReady(status, snapshot, filename());
   804     }
   806     }
   805 
   807 
   806     CX_DEBUG_EXIT_FUNCTION();
   808     CX_DEBUG_EXIT_FUNCTION();
   807 }
   809 }