diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-07-10 10:14:36 +0200 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-07-10 10:14:36 +0200 |
commit | 074bd6ab37bbbb4dbba188921783fd98be872555 (patch) | |
tree | 318284e5ce86569c6d0c9c37d143b6f63781eede /src/plugins/gstreamer | |
parent | 4ba4f1a51db14c1df20b27cc375255077f051819 (diff) | |
parent | 8da61153c9b4e505b6f8a0e7a6c630690516d845 (diff) |
Merge remote-tracking branch 'origin/5.3' into dev
Change-Id: I38ebcb3da0e4d2acc9e7108c9579ea98323864e0
Diffstat (limited to 'src/plugins/gstreamer')
3 files changed, 17 insertions, 4 deletions
diff --git a/src/plugins/gstreamer/camerabin/camerabinsession.cpp b/src/plugins/gstreamer/camerabin/camerabinsession.cpp index 6e3448ffe..a835b1ce5 100644 --- a/src/plugins/gstreamer/camerabin/camerabinsession.cpp +++ b/src/plugins/gstreamer/camerabin/camerabinsession.cpp @@ -487,6 +487,11 @@ QUrl CameraBinSession::outputLocation() const bool CameraBinSession::setOutputLocation(const QUrl& sink) { + if (!sink.isRelative() && !sink.isLocalFile()) { + qWarning("Output location must be a local file"); + return false; + } + m_sink = m_actualSink = sink; return true; } @@ -1007,8 +1012,9 @@ void CameraBinSession::recordVideo() if (m_actualSink.isEmpty()) { QString ext = m_mediaContainerControl->suggestedFileExtension(m_mediaContainerControl->actualContainerFormat()); m_actualSink = QUrl::fromLocalFile(generateFileName("clip_", defaultDir(QCamera::CaptureVideo), ext)); - } else if (!m_actualSink.isLocalFile()) { - m_actualSink = QUrl::fromLocalFile(m_actualSink.toEncoded()); + } else { + // Output location was rejected in setOutputlocation() if not a local file + m_actualSink = QUrl::fromLocalFile(QDir::currentPath()).resolved(m_actualSink); } QString fileName = m_actualSink.toLocalFile(); diff --git a/src/plugins/gstreamer/mediacapture/qgstreamercapturesession.cpp b/src/plugins/gstreamer/mediacapture/qgstreamercapturesession.cpp index 518a66bc0..b9114c68d 100644 --- a/src/plugins/gstreamer/mediacapture/qgstreamercapturesession.cpp +++ b/src/plugins/gstreamer/mediacapture/qgstreamercapturesession.cpp @@ -134,8 +134,10 @@ GstElement *QGstreamerCaptureSession::buildEncodeBin() return 0; } + // Output location was rejected in setOutputlocation() if not a local file + QUrl actualSink = QUrl::fromLocalFile(QDir::currentPath()).resolved(m_sink); GstElement *fileSink = gst_element_factory_make("filesink", "filesink"); - g_object_set(G_OBJECT(fileSink), "location", m_sink.toString().toLocal8Bit().constData(), NULL); + g_object_set(G_OBJECT(fileSink), "location", QFile::encodeName(actualSink.toLocalFile()).constData(), NULL); gst_bin_add_many(GST_BIN(encodeBin), muxer, fileSink, NULL); if (!gst_element_link(muxer, fileSink)) { @@ -731,6 +733,11 @@ QUrl QGstreamerCaptureSession::outputLocation() const bool QGstreamerCaptureSession::setOutputLocation(const QUrl& sink) { + if (!sink.isRelative() && !sink.isLocalFile()) { + qWarning("Output location must be a local file"); + return false; + } + m_sink = sink; return true; } diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp b/src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp index ff99aa3ff..99c471b5c 100644 --- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp +++ b/src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp @@ -371,7 +371,7 @@ void QGstreamerPlayerControl::setMedia(const QMediaContent &content, QIODevice * emit bufferStatusChanged(0); } - if (m_stream) { + if (m_stream && m_stream != stream) { if (m_ownStream) delete m_stream; m_stream = 0; |