Android: correctly report QMediaRecorder actual output location.
authorYoann Lopes <yoann.lopes@digia.com>
Thu, 13 Mar 2014 15:25:52 +0000 (16:25 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Mon, 17 Mar 2014 12:47:41 +0000 (13:47 +0100)
Report the recorded media location to have changed only when
recording is finished and successful.

Change-Id: Iee7565b9ba12d9de09f86dffb34c40936fee198c
Reviewed-by: Christian Stromme <christian.stromme@digia.com>
src/plugins/android/src/mediacapture/qandroidcapturesession.cpp
src/plugins/android/src/mediacapture/qandroidcapturesession.h

index fef2a5b..3e5c261 100644 (file)
@@ -130,7 +130,6 @@ bool QAndroidCaptureSession::setOutputLocation(const QUrl &location)
 
     if (m_requestedOutputLocation.isValid()
             && (m_requestedOutputLocation.isLocalFile() || m_requestedOutputLocation.isRelative())) {
-        emit actualLocationChanged(m_requestedOutputLocation);
         return true;
     }
 
@@ -221,10 +220,7 @@ bool QAndroidCaptureSession::start()
                                 : QLatin1String("REC_"),
                 m_containerFormat);
 
-    m_actualOutputLocation = QUrl::fromLocalFile(filePath);
-    if (m_actualOutputLocation != m_requestedOutputLocation)
-        emit actualLocationChanged(m_actualOutputLocation);
-
+    m_usedOutputLocation = QUrl::fromLocalFile(filePath);
     m_mediaRecorder->setOutputFile(filePath);
 
     if (!m_mediaRecorder->prepare()) {
@@ -282,8 +278,10 @@ void QAndroidCaptureSession::stop(bool error)
                                               : JMultimediaUtils::getDefaultMediaDirectory(JMultimediaUtils::Sounds);
         if (mediaPath.startsWith(standardLoc))
             JMultimediaUtils::registerMediaFile(mediaPath);
-    }
 
+        m_actualOutputLocation = m_usedOutputLocation;
+        emit actualLocationChanged(m_actualOutputLocation);
+    }
 }
 
 void QAndroidCaptureSession::setStatus(QMediaRecorder::Status status)
index deee505..fc8300d 100644 (file)
@@ -160,6 +160,7 @@ private:
     QMediaRecorder::State m_state;
     QMediaRecorder::Status m_status;
     QUrl m_requestedOutputLocation;
+    QUrl m_usedOutputLocation;
     QUrl m_actualOutputLocation;
 
     CaptureProfile m_defaultSettings;