diff --git a/.gitignore b/.gitignore index 00ed35e..79f4751 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /qtmultimedia-opensource-src-5.3.2.tar.xz /qtmultimedia-opensource-src-5.4.0.tar.xz +/qtmultimedia-opensource-src-5.4.1.tar.xz diff --git a/0006-GStreamer-port-to-1.0.patch b/0006-GStreamer-port-to-1.0.patch index 6ff377e..606d947 100644 --- a/0006-GStreamer-port-to-1.0.patch +++ b/0006-GStreamer-port-to-1.0.patch @@ -1,109 +1,10 @@ -From 108dda7a90bd0f0337358b0db47ae55acd16dea6 Mon Sep 17 00:00:00 2001 -From: Yoann Lopes -Date: Thu, 20 Nov 2014 17:54:18 +0100 -Subject: [PATCH 06/12] GStreamer: port to 1.0. - -0.10 is still used by default. -To enable GStreamer 1.0, pass GST_VERSION=1.0 to qmake -for qtmultimedia.pro. - -Contributions from: -Andrew den Exter -Ilya Smelykh -Jim Hodapp -Sergio Schvezov - -Change-Id: I72a46d1170a8794a149bdb5e20767afcc5b7587c -Reviewed-by: Andrew den Exter ---- - config.tests/gstreamer/gstreamer.pro | 11 +- - config.tests/gstreamer_appsrc/gstreamer_appsrc.pro | 13 +- - .../gstreamer_encodingprofiles.pro | 13 +- - .../gstreamer_photography.pro | 15 +- - .../declarative-camera/declarative-camera.qml | 2 +- - qtmultimedia.pro | 26 +- - src/gsttools/gsttools.pro | 72 +- - src/gsttools/qgstappsrc.cpp | 29 +- - src/gsttools/qgstcodecsinfo.cpp | 8 +- - src/gsttools/qgstreameraudioprobecontrol.cpp | 47 +- - src/gsttools/qgstreamerbufferprobe.cpp | 174 +++++ - src/gsttools/qgstreamerbushelper.cpp | 8 + - src/gsttools/qgstreamermirtexturerenderer.cpp | 351 +++++++++ - src/gsttools/qgstreamervideoprobecontrol.cpp | 58 +- - src/gsttools/qgstreamervideorenderer.cpp | 3 +- - src/gsttools/qgstreamervideowidget.cpp | 29 +- - src/gsttools/qgstreamervideowindow.cpp | 105 ++- - src/gsttools/qgstutils.cpp | 785 ++++++++++++++++++++- - src/gsttools/qgstvideobuffer.cpp | 70 +- - src/gsttools/qgstvideorendererplugin.cpp | 53 ++ - src/gsttools/qgstvideorenderersink.cpp | 605 ++++++++++++++++ - src/gsttools/qvideosurfacegstsink.cpp | 232 +----- - src/multimedia/gsttools_headers/qgstappsrc_p.h | 3 + - .../qgstreameraudioprobecontrol_p.h | 13 +- - .../gsttools_headers/qgstreamerbufferprobe_p.h | 86 +++ - .../qgstreamermirtexturerenderer_p.h | 102 +++ - .../qgstreamervideoprobecontrol_p.h | 23 +- - .../gsttools_headers/qgstreamervideowindow_p.h | 9 +- - src/multimedia/gsttools_headers/qgstutils_p.h | 55 +- - .../gsttools_headers/qgstvideobuffer_p.h | 23 +- - .../gsttools_headers/qgstvideorendererplugin_p.h | 111 +++ - .../gsttools_headers/qgstvideorenderersink_p.h | 183 +++++ - .../gsttools_headers/qvideosurfacegstsink_p.h | 19 +- - src/multimedia/multimedia.pro | 2 + - .../qgstreameraudiodecoderserviceplugin.cpp | 89 +-- - .../audiodecoder/qgstreameraudiodecodersession.cpp | 36 +- - .../audiodecoder/qgstreameraudiodecodersession.h | 2 +- - src/plugins/gstreamer/camerabin/camerabin.pro | 2 +- - .../gstreamer/camerabin/camerabincontainer.cpp | 2 +- - .../gstreamer/camerabin/camerabincontrol.cpp | 7 +- - .../gstreamer/camerabin/camerabinexposure.cpp | 8 +- - src/plugins/gstreamer/camerabin/camerabinflash.cpp | 8 +- - src/plugins/gstreamer/camerabin/camerabinfocus.cpp | 15 +- - .../gstreamer/camerabin/camerabinimagecapture.cpp | 146 ++-- - .../gstreamer/camerabin/camerabinimagecapture.h | 50 +- - .../gstreamer/camerabin/camerabinimageencoder.cpp | 1 - - .../camerabin/camerabinimageprocessing.cpp | 8 +- - .../gstreamer/camerabin/camerabinimageprocessing.h | 7 +- - .../gstreamer/camerabin/camerabinmetadata.cpp | 5 +- - .../gstreamer/camerabin/camerabinrecorder.cpp | 9 +- - .../gstreamer/camerabin/camerabinservice.cpp | 7 +- - .../gstreamer/camerabin/camerabinsession.cpp | 339 ++++----- - src/plugins/gstreamer/common.pri | 22 +- - src/plugins/gstreamer/gstreamer.pro | 4 +- - .../gstreamer/mediacapture/mediacapturecamera.json | 2 +- - .../mediacapture/qgstreameraudioencode.cpp | 3 +- - .../mediacapture/qgstreamercaptureservice.cpp | 58 +- - .../mediacapture/qgstreamercaptureservice.h | 3 + - .../qgstreamercaptureserviceplugin.cpp | 90 +-- - .../mediacapture/qgstreamercapturesession.cpp | 285 +++----- - .../mediacapture/qgstreamercapturesession.h | 19 +- - .../mediacapture/qgstreamervideoencode.cpp | 39 +- - src/plugins/gstreamer/mediaplayer/mediaplayer.pro | 1 - - .../mediaplayer/qgstreamerplayercontrol.cpp | 1 - - .../mediaplayer/qgstreamerplayerservice.cpp | 65 +- - .../mediaplayer/qgstreamerplayerservice.h | 5 + - .../mediaplayer/qgstreamerplayerserviceplugin.cpp | 88 +-- - .../mediaplayer/qgstreamerplayersession.cpp | 238 ++++--- - .../mediaplayer/qgstreamerplayersession.h | 19 +- - .../qcamerabackend/tst_qcamerabackend.cpp | 10 +- - .../tst_qmediaplayerbackend.cpp | 4 +- - 71 files changed, 3661 insertions(+), 1374 deletions(-) - create mode 100644 src/gsttools/qgstreamerbufferprobe.cpp - create mode 100644 src/gsttools/qgstreamermirtexturerenderer.cpp - create mode 100644 src/gsttools/qgstvideorendererplugin.cpp - create mode 100644 src/gsttools/qgstvideorenderersink.cpp - create mode 100644 src/multimedia/gsttools_headers/qgstreamerbufferprobe_p.h - create mode 100644 src/multimedia/gsttools_headers/qgstreamermirtexturerenderer_p.h - create mode 100644 src/multimedia/gsttools_headers/qgstvideorendererplugin_p.h - create mode 100644 src/multimedia/gsttools_headers/qgstvideorenderersink_p.h - diff --git a/config.tests/gstreamer/gstreamer.pro b/config.tests/gstreamer/gstreamer.pro index 02a7e34..6b9843a 100644 --- a/config.tests/gstreamer/gstreamer.pro +++ b/config.tests/gstreamer/gstreamer.pro @@ -3,11 +3,10 @@ SOURCES += main.cpp CONFIG += link_pkgconfig - + PKGCONFIG += \ - gstreamer-0.10 \ - gstreamer-base-0.10 \ @@ -116,15 +17,15 @@ index 02a7e34..6b9843a 100644 + gstreamer-audio-$$GST_VERSION \ + gstreamer-video-$$GST_VERSION \ + gstreamer-pbutils-$$GST_VERSION - - + + diff --git a/config.tests/gstreamer_appsrc/gstreamer_appsrc.pro b/config.tests/gstreamer_appsrc/gstreamer_appsrc.pro index 9f61703..0f3ca2b 100644 --- a/config.tests/gstreamer_appsrc/gstreamer_appsrc.pro +++ b/config.tests/gstreamer_appsrc/gstreamer_appsrc.pro @@ -3,11 +3,8 @@ SOURCES += main.cpp CONFIG += link_pkgconfig - + PKGCONFIG += \ - gstreamer-0.10 \ - gstreamer-base-0.10 \ @@ -144,9 +45,9 @@ index 7e8a9e7..fad40b0 100644 --- a/config.tests/gstreamer_encodingprofiles/gstreamer_encodingprofiles.pro +++ b/config.tests/gstreamer_encodingprofiles/gstreamer_encodingprofiles.pro @@ -2,11 +2,10 @@ SOURCES += main.cpp - + CONFIG += link_pkgconfig - + -PKGCONFIG += \ - gstreamer-0.10 \ - gstreamer-base-0.10 \ @@ -154,7 +55,7 @@ index 7e8a9e7..fad40b0 100644 - gstreamer-audio-0.10 \ - gstreamer-video-0.10 \ - gstreamer-pbutils-0.10 - + +PKGCONFIG += \ + gstreamer-$$GST_VERSION \ + gstreamer-base-$$GST_VERSION \ @@ -167,7 +68,7 @@ index 6b530cb..975991f 100644 +++ b/config.tests/gstreamer_photography/gstreamer_photography.pro @@ -3,12 +3,11 @@ SOURCES += main.cpp CONFIG += link_pkgconfig - + PKGCONFIG += \ - gstreamer-0.10 \ - gstreamer-base-0.10 \ @@ -184,20 +85,20 @@ index 6b530cb..975991f 100644 + gstreamer-pbutils-$$GST_VERSION + +LIBS += -lgstphotography-$$GST_VERSION - + diff --git a/examples/multimedia/declarative-camera/declarative-camera.qml b/examples/multimedia/declarative-camera/declarative-camera.qml index 751b38d..251df34 100644 --- a/examples/multimedia/declarative-camera/declarative-camera.qml +++ b/examples/multimedia/declarative-camera/declarative-camera.qml @@ -96,7 +96,7 @@ Rectangle { - + videoRecorder { resolution: "640x480" - frameRate: 15 + frameRate: 30 } } - + diff --git a/qtmultimedia.pro b/qtmultimedia.pro index 3cec526..84f2548 100644 --- a/qtmultimedia.pro @@ -240,17 +141,17 @@ index 7c809a7..7c41f1a 100644 --- a/src/gsttools/gsttools.pro +++ b/src/gsttools/gsttools.pro @@ -2,6 +2,7 @@ TEMPLATE = lib - + TARGET = qgsttools_p QPRO_PWD = $$PWD + QT = core-private multimedia-private gui-private - + !static:DEFINES += QT_MAKEDLL @@ -15,15 +16,17 @@ LIBS_PRIVATE += \ - + CONFIG += link_pkgconfig - + -PKGCONFIG_PRIVATE += \ - gstreamer-0.10 \ - gstreamer-base-0.10 \ @@ -264,13 +165,13 @@ index 7c809a7..7c41f1a 100644 + gstreamer-audio-$$GST_VERSION \ + gstreamer-video-$$GST_VERSION \ + gstreamer-pbutils-$$GST_VERSION - + -maemo*: PKGCONFIG_PRIVATE +=gstreamer-plugins-bad-0.10 +equals(GST_VERSION,"0.10") { + PKGCONFIG_PRIVATE += gstreamer-interfaces-0.10 + maemo*: PKGCONFIG_PRIVATE +=gstreamer-plugins-bad-0.10 +} - + config_resourcepolicy { DEFINES += HAVE_RESOURCE_POLICY @@ -33,38 +36,36 @@ config_resourcepolicy { @@ -279,7 +180,7 @@ index 7c809a7..7c41f1a 100644 INCLUDEPATH += ../multimedia/gsttools_headers/ +INCLUDEPATH += ../plugins/gstreamer/mediaplayer/ VPATH += ../multimedia/gsttools_headers/ - + PRIVATE_HEADERS += \ - qgstbufferpoolinterface_p.h \ qgstreamerbushelper_p.h \ @@ -297,7 +198,7 @@ index 7c809a7..7c41f1a 100644 qgstreamervideoprobecontrol_p.h \ qgstreameraudioprobecontrol_p.h \ qgstreamervideowindow_p.h - + SOURCES += \ - qgstbufferpoolinterface.cpp \ qgstreamerbushelper.cpp \ @@ -318,7 +219,7 @@ index 7c809a7..7c41f1a 100644 @@ -79,25 +80,54 @@ qtHaveModule(widgets) { qgstreamervideowidget.cpp } - + -maemo6 { - PKGCONFIG_PRIVATE += qmsystem2 +equals(GST_VERSION,"0.10") { @@ -350,7 +251,7 @@ index 7c809a7..7c41f1a 100644 + qgstvideorendererplugin.cpp \ + qgstvideorenderersink.cpp +} - + +mir: { contains(QT_CONFIG, opengles2):qtHaveModule(widgets) { - PRIVATE_HEADERS += qgstreamergltexturerenderer_p.h @@ -364,19 +265,19 @@ index 7c809a7..7c41f1a 100644 } + DEFINES += HAVE_MIR } - + config_gstreamer_appsrc { - PKGCONFIG_PRIVATE += gstreamer-app-0.10 + PKGCONFIG_PRIVATE += gstreamer-app-$$GST_VERSION PRIVATE_HEADERS += qgstappsrc_p.h SOURCES += qgstappsrc.cpp - + DEFINES += HAVE_GST_APPSRC - + - LIBS_PRIVATE += -lgstapp-0.10 + LIBS_PRIVATE += -lgstapp-$$GST_VERSION } - + config_linux_v4l: DEFINES += USE_V4L diff --git a/src/gsttools/qgstappsrc.cpp b/src/gsttools/qgstappsrc.cpp index 561a96f..178e118 100644 @@ -384,7 +285,7 @@ index 561a96f..178e118 100644 +++ b/src/gsttools/qgstappsrc.cpp @@ -147,23 +147,44 @@ void QGstAppSrc::pushDataToAppSrc() size = qMin(m_stream->bytesAvailable(), (qint64)m_dataRequestSize); - + if (size) { - void *data = g_malloc(size); - GstBuffer* buffer = gst_app_buffer_new(data, size, g_free, data); @@ -402,7 +303,7 @@ index 561a96f..178e118 100644 - qint64 bytesRead = m_stream->read((char*)GST_BUFFER_DATA(buffer), size); + qint64 bytesRead = m_stream->read((char*)bufferData, size); buffer->offset_end = buffer->offset + bytesRead - 1; - + +#if GST_CHECK_VERSION(1,0,0) + gst_buffer_unmap(buffer, &mapInfo); +#endif @@ -437,26 +338,26 @@ index f584fbe..888722a 100644 +++ b/src/gsttools/qgstcodecsinfo.cpp @@ -32,7 +32,7 @@ ****************************************************************************/ - + #include "qgstcodecsinfo_p.h" - +#include "qgstutils_p.h" #include - + #ifdef QMEDIA_GSTREAMER_CAMERABIN @@ -146,7 +146,7 @@ GstCaps* QGstCodecsInfo::supportedElementCaps(GstElementFactoryListType elementT if (fakeEncoderMimeTypes.contains(gst_structure_get_name(structure))) continue; - + - GstStructure *newStructure = gst_structure_new(gst_structure_get_name(structure), NULL); + GstStructure *newStructure = qt_gst_structure_new_empty(gst_structure_get_name(structure)); - + //add structure fields to distinguish between formats with similar mime types, //like audio/mpeg @@ -166,7 +166,11 @@ GstCaps* QGstCodecsInfo::supportedElementCaps(GstElementFactoryListType elementT } } - + +#if GST_CHECK_VERSION(1,0,0) + res = +#endif @@ -475,12 +376,12 @@ index 3baca53..9670d0f 100644 { - } - + QGstreamerAudioProbeControl::~QGstreamerAudioProbeControl() { - } - + -void QGstreamerAudioProbeControl::bufferProbed(GstBuffer* buffer) +void QGstreamerAudioProbeControl::probeCaps(GstCaps *caps) { @@ -492,12 +393,12 @@ index 3baca53..9670d0f 100644 - gst_caps_unref(caps); - if (!format.isValid()) - return; - + - QAudioBuffer audioBuffer = QAudioBuffer(QByteArray((const char*)buffer->data, buffer->size), format); + QMutexLocker locker(&m_bufferMutex); + m_format = format; +} - + - { - QMutexLocker locker(&m_bufferMutex); - m_pendingBuffer = audioBuffer; @@ -531,7 +432,7 @@ index 3baca53..9670d0f 100644 + + return true; } - + void QGstreamerAudioProbeControl::bufferProbed() @@ -73,6 +89,7 @@ void QGstreamerAudioProbeControl::bufferProbed() if (!m_pendingBuffer.isValid()) @@ -736,7 +637,7 @@ index 84eda46..eb1fc36 100644 +#endif gst_object_ref(GST_OBJECT(bus)); } - + QGstreamerBusHelper::~QGstreamerBusHelper() { +#if GST_CHECK_VERSION(1,0,0) @@ -746,7 +647,7 @@ index 84eda46..eb1fc36 100644 +#endif gst_object_unref(GST_OBJECT(d->bus())); } - + diff --git a/src/gsttools/qgstreamermirtexturerenderer.cpp b/src/gsttools/qgstreamermirtexturerenderer.cpp new file mode 100644 index 0000000..39e0db7 @@ -1110,13 +1011,13 @@ index a78a9da..71a402d 100644 +++ b/src/gsttools/qgstreamervideoprobecontrol.cpp @@ -32,7 +32,8 @@ ****************************************************************************/ - + #include "qgstreamervideoprobecontrol_p.h" -#include + +#include "qgstutils_p.h" #include - + QGstreamerVideoProbeControl::QGstreamerVideoProbeControl(QObject *parent) @@ -40,12 +41,10 @@ QGstreamerVideoProbeControl::QGstreamerVideoProbeControl(QObject *parent) , m_flushing(false) @@ -1124,17 +1025,17 @@ index a78a9da..71a402d 100644 { - } - + QGstreamerVideoProbeControl::~QGstreamerVideoProbeControl() { - } - + void QGstreamerVideoProbeControl::startFlushing() @@ -67,33 +66,49 @@ void QGstreamerVideoProbeControl::stopFlushing() m_flushing = false; } - + -void QGstreamerVideoProbeControl::bufferProbed(GstBuffer* buffer) +void QGstreamerVideoProbeControl::probeCaps(GstCaps *caps) { @@ -1147,7 +1048,7 @@ index a78a9da..71a402d 100644 +#if GST_CHECK_VERSION(1,0,0) + GstVideoInfo videoInfo; + QVideoSurfaceFormat format = QGstUtils::formatForCaps(caps, &videoInfo); - + + QMutexLocker locker(&m_frameMutex); + m_videoInfo = videoInfo; +#else @@ -1170,7 +1071,7 @@ index a78a9da..71a402d 100644 + + if (m_flushing || !m_format.isValid()) + return true; - + - QVideoFrame frame = QVideoFrame(new QGstVideoBuffer(buffer, bytesPerLine), - format.frameSize(), format.pixelFormat()); + QVideoFrame frame( @@ -1181,12 +1082,12 @@ index a78a9da..71a402d 100644 +#endif + m_format.frameSize(), + m_format.pixelFormat()); - + - QVideoSurfaceGstSink::setFrameTimeStamps(&frame, buffer); + QGstUtils::setFrameTimeStamps(&frame, buffer); - + m_frameProbed = true; - + - { - QMutexLocker locker(&m_frameMutex); - m_pendingFrame = frame; @@ -1197,7 +1098,7 @@ index a78a9da..71a402d 100644 + + return true; } - + void QGstreamerVideoProbeControl::frameProbed() @@ -104,6 +119,7 @@ void QGstreamerVideoProbeControl::frameProbed() if (!m_pendingFrame.isValid()) @@ -1218,16 +1119,16 @@ index 2b66f76..804dce9 100644 - -#include +#include - + #include - + diff --git a/src/gsttools/qgstreamervideowidget.cpp b/src/gsttools/qgstreamervideowidget.cpp index aa2e2a3..1ae57a0 100644 --- a/src/gsttools/qgstreamervideowidget.cpp +++ b/src/gsttools/qgstreamervideowidget.cpp @@ -40,8 +40,13 @@ #include - + #include + +#if !GST_CHECK_VERSION(1,0,0) @@ -1236,22 +1137,22 @@ index aa2e2a3..1ae57a0 100644 +#else +#include +#endif - + QT_BEGIN_NAMESPACE - + @@ -130,8 +135,6 @@ void QGstreamerVideoWidgetControl::createVideoWidget() m_videoSink = gst_element_factory_make ("ximagesink", NULL); - + qt_gst_object_ref_sink(GST_OBJECT (m_videoSink)); //Take ownership - - } - + GstElement *QGstreamerVideoWidgetControl::videoSink() @@ -169,9 +172,13 @@ bool QGstreamerVideoWidgetControl::processSyncMessage(const QGstreamerMessage &m { GstMessage* gm = message.rawMessage(); - + +#if !GST_CHECK_VERSION(1,0,0) if (gm && (GST_MESSAGE_TYPE(gm) == GST_MESSAGE_ELEMENT) && gst_structure_has_name(gm->structure, "prepare-xwindow-id")) { @@ -1264,7 +1165,7 @@ index aa2e2a3..1ae57a0 100644 QMetaObject::invokeMethod(this, "updateNativeVideoSize", Qt::QueuedConnection); return true; @@ -199,17 +206,24 @@ bool QGstreamerVideoWidgetControl::processBusMessage(const QGstreamerMessage &me - + void QGstreamerVideoWidgetControl::setOverlay() { +#if !GST_CHECK_VERSION(1,0,0) @@ -1277,7 +1178,7 @@ index aa2e2a3..1ae57a0 100644 + } +#endif } - + void QGstreamerVideoWidgetControl::updateNativeVideoSize() { if (m_videoSink) { @@ -1288,10 +1189,10 @@ index aa2e2a3..1ae57a0 100644 + GstCaps *caps = qt_gst_pad_get_current_caps(pad); + gst_object_unref(GST_OBJECT(pad)); - + if (caps) { @@ -225,8 +239,13 @@ void QGstreamerVideoWidgetControl::updateNativeVideoSize() - + void QGstreamerVideoWidgetControl::windowExposed() { +#if !GST_CHECK_VERSION(1,0,0) @@ -1302,7 +1203,7 @@ index aa2e2a3..1ae57a0 100644 + gst_video_overlay_expose(GST_VIDEO_OVERLAY(m_videoSink)); +#endif } - + QWidget *QGstreamerVideoWidgetControl::videoWidget() diff --git a/src/gsttools/qgstreamervideowindow.cpp b/src/gsttools/qgstreamervideowindow.cpp index a373dcc..8011349 100644 @@ -1310,7 +1211,7 @@ index a373dcc..8011349 100644 +++ b/src/gsttools/qgstreamervideowindow.cpp @@ -37,36 +37,49 @@ #include - + #include + +#if !GST_CHECK_VERSION(1,0,0) @@ -1319,8 +1220,8 @@ index a373dcc..8011349 100644 +#else +#include +#endif - - + + QGstreamerVideoWindow::QGstreamerVideoWindow(QObject *parent, const char *elementName) : QVideoWindowControl(parent) + , QGstreamerBufferProbe(QGstreamerBufferProbe::ProbeCaps) @@ -1337,10 +1238,10 @@ index a373dcc..8011349 100644 + } else { m_videoSink = gst_element_factory_make("xvimagesink", NULL); + } - + if (m_videoSink) { qt_gst_object_ref_sink(GST_OBJECT(m_videoSink)); //Take ownership - + - GstPad *pad = gst_element_get_static_pad(m_videoSink,"sink"); - m_bufferProbeId = gst_pad_add_buffer_probe(pad, G_CALLBACK(padBufferProbe), this); + GstPad *pad = gst_element_get_static_pad(m_videoSink, "sink"); @@ -1350,7 +1251,7 @@ index a373dcc..8011349 100644 + else + qDebug() << "No m_videoSink available!"; } - + QGstreamerVideoWindow::~QGstreamerVideoWindow() { - if (m_videoSink) @@ -1361,11 +1262,11 @@ index a373dcc..8011349 100644 gst_object_unref(GST_OBJECT(m_videoSink)); + } } - + WId QGstreamerVideoWindow::winId() const @@ -82,11 +95,15 @@ void QGstreamerVideoWindow::setWinId(WId id) WId oldId = m_windowId; - + m_windowId = id; - +#if GST_CHECK_VERSION(1,0,0) @@ -1380,7 +1281,7 @@ index a373dcc..8011349 100644 +#endif if (!oldId) emit readyChanged(true); - + @@ -97,20 +114,26 @@ void QGstreamerVideoWindow::setWinId(WId id) bool QGstreamerVideoWindow::processSyncMessage(const QGstreamerMessage &message) { @@ -1392,16 +1293,16 @@ index a373dcc..8011349 100644 + m_videoSink && GST_IS_VIDEO_OVERLAY(m_videoSink)) { + + gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(m_videoSink), m_windowId); - + + return true; + } +#else if ((GST_MESSAGE_TYPE(gm) == GST_MESSAGE_ELEMENT) && gst_structure_has_name(gm->structure, "prepare-xwindow-id") && m_videoSink && GST_IS_X_OVERLAY(m_videoSink)) { - + gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(m_videoSink), m_windowId); - + - GstPad *pad = gst_element_get_static_pad(m_videoSink,"sink"); - m_bufferProbeId = gst_pad_add_buffer_probe(pad, G_CALLBACK(padBufferProbe), this); - gst_object_unref(GST_OBJECT(pad)); @@ -1412,7 +1313,7 @@ index a373dcc..8011349 100644 +#endif return false; } - + @@ -122,7 +145,19 @@ QRect QGstreamerVideoWindow::displayRect() const void QGstreamerVideoWindow::setDisplayRect(const QRect &rect) { @@ -1440,10 +1341,10 @@ index a373dcc..8011349 100644 } +#endif } - + Qt::AspectRatioMode QGstreamerVideoWindow::aspectRatioMode() const @@ -157,6 +193,16 @@ void QGstreamerVideoWindow::setAspectRatioMode(Qt::AspectRatioMode mode) - + void QGstreamerVideoWindow::repaint() { +#if GST_CHECK_VERSION(1,0,0) @@ -1465,12 +1366,12 @@ index a373dcc..8011349 100644 } +#endif } - + QColor QGstreamerVideoWindow::colorKey() const @@ -296,32 +343,22 @@ QSize QGstreamerVideoWindow::nativeSize() const return m_nativeSize; } - + -void QGstreamerVideoWindow::padBufferProbe(GstPad *pad, GstBuffer * /* buffer */, gpointer user_data) +void QGstreamerVideoWindow::probeCaps(GstCaps *caps) { @@ -1484,7 +1385,7 @@ index a373dcc..8011349 100644 + Qt::QueuedConnection, + Q_ARG(QSize, resolution)); } - + -void QGstreamerVideoWindow::updateNativeVideoSize() +void QGstreamerVideoWindow::updateNativeVideoSize(const QSize &size) { @@ -1509,10 +1410,10 @@ index a373dcc..8011349 100644 emit nativeSizeChanged(); + } } - + GstElement *QGstreamerVideoWindow::videoSink() diff --git a/src/gsttools/qgstutils.cpp b/src/gsttools/qgstutils.cpp -index 556fc03..65124c9 100644 +index 1281d3f..86d9404 100644 --- a/src/gsttools/qgstutils.cpp +++ b/src/gsttools/qgstutils.cpp @@ -40,7 +40,14 @@ @@ -1527,7 +1428,7 @@ index 556fc03..65124c9 100644 +#include + +template static int lengthOf(const T (&)[N]) { return N; } - + #ifdef USE_V4L # include @@ -82,15 +89,24 @@ static void addTagToMap(const GstTagList *list, @@ -1558,7 +1459,7 @@ index 556fc03..65124c9 100644 @@ -169,6 +185,42 @@ QSize QGstUtils::capsCorrectedResolution(const GstCaps *caps) return size; } - + + +#if GST_CHECK_VERSION(1,0,0) +namespace { @@ -1599,7 +1500,7 @@ index 556fc03..65124c9 100644 Returns audio format for caps. If caps doesn't have a valid audio format, an empty QAudioFormat is returned. @@ -176,9 +228,26 @@ QSize QGstUtils::capsCorrectedResolution(const GstCaps *caps) - + QAudioFormat QGstUtils::audioFormatForCaps(const GstCaps *caps) { - const GstStructure *structure = gst_caps_get_structure(caps, 0); @@ -1624,9 +1525,9 @@ index 556fc03..65124c9 100644 + } +#else + const GstStructure *structure = gst_caps_get_structure(caps, 0); - + if (qstrcmp(gst_structure_get_name(structure), "audio/x-raw-int") == 0) { - + @@ -249,16 +318,28 @@ QAudioFormat QGstUtils::audioFormatForCaps(const GstCaps *caps) } else { return QAudioFormat(); @@ -1635,7 +1536,7 @@ index 556fc03..65124c9 100644 +#endif return format; } - + +#if GST_CHECK_VERSION(1,0,0) +/*! + Returns audio format for a sample. @@ -1646,7 +1547,7 @@ index 556fc03..65124c9 100644 + GstCaps* caps = gst_sample_get_caps(sample); + if (!caps) + return QAudioFormat(); - + + return QGstUtils::audioFormatForCaps(caps); +} +#else @@ -1664,13 +1565,13 @@ index 556fc03..65124c9 100644 } - +#endif - + /*! Builds GstCaps for an audio format. @@ -277,8 +358,32 @@ QAudioFormat QGstUtils::audioFormatForBuffer(GstBuffer *buffer) Caller must unref GstCaps. */ - + -GstCaps *QGstUtils::capsForAudioFormat(QAudioFormat format) +GstCaps *QGstUtils::capsForAudioFormat(const QAudioFormat &format) { @@ -1699,20 +1600,20 @@ index 556fc03..65124c9 100644 + return 0; +#else GstStructure *structure = 0; - + if (format.isValid()) { @@ -313,6 +418,7 @@ GstCaps *QGstUtils::capsForAudioFormat(QAudioFormat format) } - + return caps; +#endif } - + void QGstUtils::initializeGst() -@@ -576,10 +682,629 @@ QByteArray QGstUtils::cameraDriver(const QString &device, GstElementFactory *fac +@@ -578,10 +684,629 @@ QByteArray QGstUtils::cameraDriver(const QString &device, GstElementFactory *fac return QByteArray(); } - + +QSet QGstUtils::supportedMimeTypes(bool (*isValidFactory)(GstElementFactory *factory)) +{ + QSet supportedMimeTypes; @@ -2332,7 +2233,7 @@ index 556fc03..65124c9 100644 + + return gst_caps_make_writable(gst_static_caps_get(&staticCaps)); +} - + void qt_gst_object_ref_sink(gpointer object) { -#if (GST_VERSION_MAJOR >= 0) && (GST_VERSION_MINOR >= 10) && (GST_VERSION_MICRO >= 24) @@ -2340,10 +2241,10 @@ index 556fc03..65124c9 100644 gst_object_ref_sink(object); #else g_return_if_fail (GST_IS_OBJECT(object)); -@@ -595,4 +1320,50 @@ void qt_gst_object_ref_sink(gpointer object) +@@ -597,4 +1322,50 @@ void qt_gst_object_ref_sink(gpointer object) #endif } - + +GstCaps *qt_gst_pad_get_current_caps(GstPad *pad) +{ +#if GST_CHECK_VERSION(1,0,0) @@ -2396,9 +2297,9 @@ index 18702ec..1ce07ca 100644 --- a/src/gsttools/qgstvideobuffer.cpp +++ b/src/gsttools/qgstvideobuffer.cpp @@ -35,21 +35,35 @@ - + QT_BEGIN_NAMESPACE - + +#if GST_CHECK_VERSION(1,0,0) +QGstVideoBuffer::QGstVideoBuffer(GstBuffer *buffer, const GstVideoInfo &info) + : QAbstractPlanarVideoBuffer(NoHandle) @@ -2414,7 +2315,7 @@ index 18702ec..1ce07ca 100644 { gst_buffer_ref(m_buffer); } - + +#if GST_CHECK_VERSION(1,0,0) +QGstVideoBuffer::QGstVideoBuffer(GstBuffer *buffer, const GstVideoInfo &info, + QGstVideoBuffer::HandleType handleType, @@ -2434,18 +2335,18 @@ index 18702ec..1ce07ca 100644 , m_handle(handle) { @@ -58,6 +72,8 @@ QGstVideoBuffer::QGstVideoBuffer(GstBuffer *buffer, int bytesPerLine, - + QGstVideoBuffer::~QGstVideoBuffer() { + unmap(); + gst_buffer_unref(m_buffer); } - + @@ -67,12 +83,49 @@ QAbstractVideoBuffer::MapMode QGstVideoBuffer::mapMode() const return m_mode; } - + +#if GST_CHECK_VERSION(1,0,0) + +int QGstVideoBuffer::map(MapMode mode, int *numBytes, int bytesPerLine[4], uchar *data[4]) @@ -2492,7 +2393,7 @@ index 18702ec..1ce07ca 100644 - if (bytesPerLine) *bytesPerLine = m_bytesPerLine; - + @@ -83,8 +136,19 @@ uchar *QGstVideoBuffer::map(MapMode mode, int *numBytes, int *bytesPerLine) return 0; } @@ -2512,7 +2413,7 @@ index 18702ec..1ce07ca 100644 +#endif m_mode = NotMapped; } - + diff --git a/src/gsttools/qgstvideorendererplugin.cpp b/src/gsttools/qgstvideorendererplugin.cpp new file mode 100644 index 0000000..5eda85a @@ -3190,16 +3091,16 @@ index f3e2d88..147db66 100644 @@ -41,8 +41,13 @@ #include #include "qgstvideobuffer_p.h" - + +#include "qgstutils_p.h" #include "qvideosurfacegstsink_p.h" - + +#if GST_VERSION_MAJOR >=1 +#include +#endif + //#define DEBUG_VIDEO_SURFACE_SINK - + QT_BEGIN_NAMESPACE @@ -62,10 +67,12 @@ QVideoSurfaceGstDelegate::QVideoSurfaceGstDelegate( if (m_surface) { @@ -3217,12 +3118,12 @@ index f3e2d88..147db66 100644 @@ -191,13 +198,15 @@ GstFlowReturn QVideoSurfaceGstDelegate::render(GstBuffer *buffer) m_format.frameSize(), m_format.pixelFormat()); - + - QVideoSurfaceGstSink::setFrameTimeStamps(&m_frame, buffer); + QGstUtils::setFrameTimeStamps(&m_frame, buffer); - + m_renderReturn = GST_FLOW_OK; - + if (QThread::currentThread() == thread()) { if (!m_surface.isNull()) m_surface->present(m_frame); @@ -3234,7 +3135,7 @@ index f3e2d88..147db66 100644 @@ -283,90 +292,6 @@ void QVideoSurfaceGstDelegate::updateSupportedFormats() } } - + -struct YuvFormat -{ - QVideoFrame::PixelFormat pixelFormat; @@ -3320,12 +3221,12 @@ index f3e2d88..147db66 100644 -} - static GstVideoSinkClass *sink_parent_class; - + #define VO_SINK(s) QVideoSurfaceGstSink *sink(reinterpret_cast(s)) @@ -494,8 +419,6 @@ GstCaps *QVideoSurfaceGstSink::get_caps(GstBaseSink *base) { VO_SINK(base); - + - GstCaps *caps = gst_caps_new_empty(); - // Find the supported pixel formats @@ -3342,7 +3243,7 @@ index f3e2d88..147db66 100644 @@ -513,47 +437,7 @@ GstCaps *QVideoSurfaceGstSink::get_caps(GstBaseSink *base) supportedFormats.append(format); } - + - foreach (QVideoFrame::PixelFormat format, supportedFormats) { - int index = indexOfYuvColor(format); - @@ -3386,20 +3287,20 @@ index f3e2d88..147db66 100644 - return caps; + return QGstUtils::capsForFormats(supportedFormats); } - + gboolean QVideoSurfaceGstSink::set_caps(GstBaseSink *base, GstCaps *caps) @@ -575,7 +459,7 @@ gboolean QVideoSurfaceGstSink::set_caps(GstBaseSink *base, GstCaps *caps) QAbstractVideoBuffer::HandleType handleType = pool ? pool->handleType() : QAbstractVideoBuffer::NoHandle; - + - QVideoSurfaceFormat format = formatForCaps(caps, &bytesPerLine, handleType); + QVideoSurfaceFormat format = QGstUtils::formatForCaps(caps, &bytesPerLine, handleType); - + if (sink->delegate->isActive()) { QVideoSurfaceFormat surfaceFormst = sink->delegate->surfaceFormat(); @@ -592,7 +476,7 @@ gboolean QVideoSurfaceGstSink::set_caps(GstBaseSink *base, GstCaps *caps) sink->lastRequestedCaps = 0; - + #ifdef DEBUG_VIDEO_SURFACE_SINK - qDebug() << "Staring video surface, format:"; + qDebug() << "Starting video surface, format:"; @@ -3409,7 +3310,7 @@ index f3e2d88..147db66 100644 @@ -606,87 +490,6 @@ gboolean QVideoSurfaceGstSink::set_caps(GstBaseSink *base, GstCaps *caps) return FALSE; } - + -QVideoSurfaceFormat QVideoSurfaceGstSink::formatForCaps(GstCaps *caps, int *bytesPerLine, QAbstractVideoBuffer::HandleType handleType) -{ - const GstStructure *structure = gst_caps_get_structure(caps, 0); @@ -3495,32 +3396,32 @@ index f3e2d88..147db66 100644 GstBaseSink *base, guint64 offset, guint size, GstCaps *caps, GstBuffer **buffer) { @@ -731,7 +534,7 @@ GstFlowReturn QVideoSurfaceGstSink::buffer_alloc( - + if (sink->delegate->isActive()) { //if format was changed, restart the surface - QVideoSurfaceFormat format = formatForCaps(intersection); + QVideoSurfaceFormat format = QGstUtils::formatForCaps(intersection); QVideoSurfaceFormat surfaceFormat = sink->delegate->surfaceFormat(); - + if (format.pixelFormat() != surfaceFormat.pixelFormat() || @@ -749,7 +552,7 @@ GstFlowReturn QVideoSurfaceGstSink::buffer_alloc( QAbstractVideoBuffer::HandleType handleType = pool ? pool->handleType() : QAbstractVideoBuffer::NoHandle; - + - QVideoSurfaceFormat format = formatForCaps(intersection, &bytesPerLine, handleType); + QVideoSurfaceFormat format = QGstUtils::formatForCaps(intersection, &bytesPerLine, handleType); - + if (!sink->delegate->start(format, bytesPerLine)) { qWarning() << "failed to start video surface"; @@ -763,7 +566,7 @@ GstFlowReturn QVideoSurfaceGstSink::buffer_alloc( QVideoSurfaceFormat surfaceFormat = sink->delegate->surfaceFormat(); - + if (!pool->isFormatSupported(surfaceFormat)) { - //qDebug() << "sink doesn't support native pool format, skip custom buffers allocation"; + qDebug() << "sink doesn't support native pool format, skip custom buffers allocation"; return GST_FLOW_OK; } - + @@ -787,7 +590,6 @@ GstFlowReturn QVideoSurfaceGstSink::buffer_alloc( gboolean QVideoSurfaceGstSink::start(GstBaseSink *base) { @@ -3528,22 +3429,22 @@ index f3e2d88..147db66 100644 - return TRUE; } - + diff --git a/src/multimedia/gsttools_headers/qgstappsrc_p.h b/src/multimedia/gsttools_headers/qgstappsrc_p.h index 4af9252..0e0fc0a 100644 --- a/src/multimedia/gsttools_headers/qgstappsrc_p.h +++ b/src/multimedia/gsttools_headers/qgstappsrc_p.h @@ -39,7 +39,10 @@ - + #include #include + +#if GST_VERSION_MAJOR < 1 #include +#endif - + QT_BEGIN_NAMESPACE - + diff --git a/src/multimedia/gsttools_headers/qgstreameraudioprobecontrol_p.h b/src/multimedia/gsttools_headers/qgstreameraudioprobecontrol_p.h index 34669b8..571a7ce 100644 --- a/src/multimedia/gsttools_headers/qgstreameraudioprobecontrol_p.h @@ -3555,9 +3456,9 @@ index 34669b8..571a7ce 100644 +#include + +#include - + QT_BEGIN_NAMESPACE - + -class QGstreamerAudioProbeControl : public QMediaAudioProbeControl +class QGstreamerAudioProbeControl + : public QMediaAudioProbeControl @@ -3568,21 +3469,21 @@ index 34669b8..571a7ce 100644 public: explicit QGstreamerAudioProbeControl(QObject *parent); virtual ~QGstreamerAudioProbeControl(); - + - void bufferProbed(GstBuffer* buffer); +protected: + void probeCaps(GstCaps *caps); + bool probeBuffer(GstBuffer *buffer); - + private slots: void bufferProbed(); - + private: QAudioBuffer m_pendingBuffer; + QAudioFormat m_format; QMutex m_bufferMutex; }; - + diff --git a/src/multimedia/gsttools_headers/qgstreamerbufferprobe_p.h b/src/multimedia/gsttools_headers/qgstreamerbufferprobe_p.h new file mode 100644 index 0000000..9240742 @@ -3789,7 +3690,7 @@ index 49064f9..f035f65 100644 +++ b/src/multimedia/gsttools_headers/qgstreamervideoprobecontrol_p.h @@ -35,20 +35,29 @@ #define QGSTREAMERVIDEOPROBECONTROL_H - + #include +#include #include @@ -3798,9 +3699,9 @@ index 49064f9..f035f65 100644 +#include + +#include - + QT_BEGIN_NAMESPACE - + -class QGstreamerVideoProbeControl : public QMediaVideoProbeControl +class QGstreamerVideoProbeControl + : public QMediaVideoProbeControl @@ -3811,17 +3712,17 @@ index 49064f9..f035f65 100644 public: explicit QGstreamerVideoProbeControl(QObject *parent); virtual ~QGstreamerVideoProbeControl(); - + - void bufferProbed(GstBuffer* buffer); + void probeCaps(GstCaps *caps); + bool probeBuffer(GstBuffer *buffer); + void startFlushing(); void stopFlushing(); - + @@ -56,10 +65,16 @@ private slots: void frameProbed(); - + private: - bool m_flushing; - bool m_frameProbed; // true if at least one frame was probed @@ -3836,22 +3737,22 @@ index 49064f9..f035f65 100644 + bool m_flushing; + bool m_frameProbed; // true if at least one frame was probed }; - + QT_END_NAMESPACE diff --git a/src/multimedia/gsttools_headers/qgstreamervideowindow_p.h b/src/multimedia/gsttools_headers/qgstreamervideowindow_p.h index 81e5764..d38156c 100644 --- a/src/multimedia/gsttools_headers/qgstreamervideowindow_p.h +++ b/src/multimedia/gsttools_headers/qgstreamervideowindow_p.h @@ -38,6 +38,7 @@ - + #include "qgstreamervideorendererinterface_p.h" #include +#include #include - + QT_BEGIN_NAMESPACE @@ -45,7 +46,8 @@ class QAbstractVideoSurface; - + class QGstreamerVideoWindow : public QVideoWindowControl, public QGstreamerVideoRendererInterface, - public QGstreamerSyncMessageFilter @@ -3862,15 +3763,15 @@ index 81e5764..d38156c 100644 Q_INTERFACES(QGstreamerVideoRendererInterface QGstreamerSyncMessageFilter) @@ -101,10 +103,10 @@ signals: void readyChanged(bool); - + private slots: - void updateNativeVideoSize(); + void updateNativeVideoSize(const QSize &size); - + private: - static void padBufferProbe(GstPad *pad, GstBuffer *buffer, gpointer user_data); + void probeCaps(GstCaps *caps); - + GstElement *m_videoSink; WId m_windowId; @@ -113,7 +115,6 @@ private: @@ -3879,7 +3780,7 @@ index 81e5764..d38156c 100644 mutable QColor m_colorKey; - int m_bufferProbeId; }; - + QT_END_NAMESPACE diff --git a/src/multimedia/gsttools_headers/qgstutils_p.h b/src/multimedia/gsttools_headers/qgstutils_p.h index 65ff759..71a0a57 100644 @@ -3907,15 +3808,15 @@ index 65ff759..71a0a57 100644 +# define QT_GSTREAMER_COLORCONVERSION_ELEMENT_NAME "ffmpegcolorspace" +# define QT_GSTREAMER_RAW_AUDIO_MIME "audio/x-raw-int" +#endif - + QT_BEGIN_NAMESPACE - + class QSize; class QVariant; class QByteArray; +class QImage; +class QVideoSurfaceFormat; - + namespace QGstUtils { struct CameraInfo @@ -73,8 +91,12 @@ namespace QGstUtils { @@ -3962,7 +3863,7 @@ index 65ff759..71a0a57 100644 + GstCaps *videoFilterCaps(); + } - + void qt_gst_object_ref_sink(gpointer object); +GstCaps *qt_gst_pad_get_current_caps(GstPad *pad); +GstStructure *qt_gst_structure_new_empty(const char *name); @@ -3970,21 +3871,21 @@ index 65ff759..71a0a57 100644 +gboolean qt_gst_element_query_duration(GstElement *element, GstFormat format, gint64 *cur); + +QDebug operator <<(QDebug debug, GstCaps *caps); - + QT_END_NAMESPACE - + diff --git a/src/multimedia/gsttools_headers/qgstvideobuffer_p.h b/src/multimedia/gsttools_headers/qgstvideobuffer_p.h index 1e0fda8..00aca48 100644 --- a/src/multimedia/gsttools_headers/qgstvideobuffer_p.h +++ b/src/multimedia/gsttools_headers/qgstvideobuffer_p.h @@ -49,26 +49,47 @@ #include - + #include +#include - + QT_BEGIN_NAMESPACE - + +#if GST_CHECK_VERSION(1,0,0) +class QGstVideoBuffer : public QAbstractPlanarVideoBuffer +{ @@ -4002,9 +3903,9 @@ index 1e0fda8..00aca48 100644 +#endif + ~QGstVideoBuffer(); - + MapMode mapMode() const; - + +#if GST_CHECK_VERSION(1,0,0) + int map(MapMode mode, int *numBytes, int bytesPerLine[4], uchar *data[4]); +#else @@ -4012,7 +3913,7 @@ index 1e0fda8..00aca48 100644 +#endif + void unmap(); - + QVariant handle() const { return m_handle; } private: - GstBuffer *m_buffer; @@ -4339,7 +4240,7 @@ index 11b305d..0ea18c0 100644 @@ -45,6 +45,18 @@ // We mean it. // - + +#include + +#if GST_CHECK_VERSION(1,0,0) @@ -4353,30 +4254,30 @@ index 11b305d..0ea18c0 100644 +#else + #include - + #include @@ -116,10 +128,6 @@ public: GstVideoSink parent; - + static QVideoSurfaceGstSink *createSink(QAbstractVideoSurface *surface); - static QVideoSurfaceFormat formatForCaps(GstCaps *caps, - int *bytesPerLine = 0, - QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle); - static void setFrameTimeStamps(QVideoFrame *frame, GstBuffer *buffer); - + private: static GType get_type(); @@ -150,7 +158,6 @@ private: QVideoSurfaceFormat *lastSurfaceFormat; }; - + - class QVideoSurfaceGstSinkClass { public: @@ -160,3 +167,5 @@ public: QT_END_NAMESPACE - + #endif + +#endif @@ -4392,7 +4293,7 @@ index b3bdaa8..ff47768 100644 + video/gstvideorenderer \ video/videonode \ playlistformats - + diff --git a/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecoderserviceplugin.cpp b/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecoderserviceplugin.cpp index 3098aab..befbb9a 100644 --- a/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecoderserviceplugin.cpp @@ -4400,7 +4301,7 @@ index 3098aab..befbb9a 100644 @@ -68,89 +68,16 @@ QMultimedia::SupportEstimate QGstreamerAudioDecoderServicePlugin::hasSupport(con return QGstUtils::hasSupport(mimeType, codecs, m_supportedMimeTypeSet); } - + -void QGstreamerAudioDecoderServicePlugin::updateSupportedMimeTypes() const +static bool isDecoderOrDemuxer(GstElementFactory *factory) { @@ -4480,7 +4381,7 @@ index 3098aab..befbb9a 100644 + || gst_element_factory_list_is_type(factory, GST_ELEMENT_FACTORY_TYPE_DECODER + | GST_ELEMENT_FACTORY_TYPE_MEDIA_AUDIO); +} - + -#if defined QT_SUPPORTEDMIMETYPES_DEBUG - QStringList list = m_supportedMimeTypeSet.toList(); - list.sort(); @@ -4493,7 +4394,7 @@ index 3098aab..befbb9a 100644 +{ + m_supportedMimeTypeSet = QGstUtils::supportedMimeTypes(isDecoderOrDemuxer); } - + QStringList QGstreamerAudioDecoderServicePlugin::supportedMimeTypes() const diff --git a/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecodersession.cpp b/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecodersession.cpp index f944a60..69876b9 100644 @@ -4505,13 +4406,13 @@ index f944a60..69876b9 100644 // Create pipeline here - m_playbin = gst_element_factory_make("playbin2", NULL); + m_playbin = gst_element_factory_make(QT_GSTREAMER_PLAYBIN_ELEMENT_NAME, NULL); - + if (m_playbin != 0) { // Sort out messages @@ -446,21 +446,40 @@ QAudioBuffer QGstreamerAudioDecoderSession::read() if (buffersAvailable == 1) emit bufferAvailableChanged(false); - + + const char* bufferData = 0; + int bufferSize = 0; + @@ -4549,19 +4450,19 @@ index f944a60..69876b9 100644 gst_buffer_unref(buffer); +#endif } - + return audioBuffer; @@ -488,7 +507,7 @@ void QGstreamerAudioDecoderSession::processInvalidMedia(QAudioDecoder::Error err emit error(int(errorCode), errorString); } - + -GstFlowReturn QGstreamerAudioDecoderSession::new_buffer(GstAppSink *, gpointer user_data) +GstFlowReturn QGstreamerAudioDecoderSession::new_sample(GstAppSink *, gpointer user_data) { // "Note that the preroll buffer will also be returned as the first buffer when calling gst_app_sink_pull_buffer()." QGstreamerAudioDecoderSession *session = reinterpret_cast(user_data); @@ -531,7 +550,11 @@ void QGstreamerAudioDecoderSession::addAppSink() - + GstAppSinkCallbacks callbacks; memset(&callbacks, 0, sizeof(callbacks)); - callbacks.new_buffer = &new_buffer; @@ -4574,17 +4475,17 @@ index f944a60..69876b9 100644 gst_app_sink_set_max_buffers(m_appSink, MAX_BUFFERS_IN_QUEUE); gst_base_sink_set_sync(GST_BASE_SINK(m_appSink), FALSE); @@ -553,11 +576,10 @@ void QGstreamerAudioDecoderSession::removeAppSink() - + void QGstreamerAudioDecoderSession::updateDuration() { - GstFormat format = GST_FORMAT_TIME; gint64 gstDuration = 0; int duration = -1; - + - if (m_playbin && gst_element_query_duration(m_playbin, &format, &gstDuration)) + if (m_playbin && qt_gst_element_query_duration(m_playbin, GST_FORMAT_TIME, &gstDuration)) duration = gstDuration / 1000000; - + if (m_duration != duration) { diff --git a/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecodersession.h b/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecodersession.h index 0912196..068221c 100644 @@ -4593,10 +4494,10 @@ index 0912196..068221c 100644 @@ -92,7 +92,7 @@ public: qint64 position() const; qint64 duration() const; - + - static GstFlowReturn new_buffer(GstAppSink *sink, gpointer user_data); + static GstFlowReturn new_sample(GstAppSink *sink, gpointer user_data); - + signals: void stateChanged(QAudioDecoder::State newState); diff --git a/src/plugins/gstreamer/camerabin/camerabin.pro b/src/plugins/gstreamer/camerabin/camerabin.pro @@ -4606,19 +4507,19 @@ index bba797f..64fee3e 100644 @@ -79,7 +79,7 @@ config_gstreamer_photography { $$PWD/camerabinlocks.cpp \ $$PWD/camerabinzoom.cpp - + - LIBS += -lgstphotography-0.10 + LIBS += -lgstphotography-$$GST_VERSION DEFINES += GST_USE_UNSTABLE_API #prevents warnings because of unstable photography API } - + diff --git a/src/plugins/gstreamer/camerabin/camerabincontainer.cpp b/src/plugins/gstreamer/camerabin/camerabincontainer.cpp index ebb914b..9531f01 100644 --- a/src/plugins/gstreamer/camerabin/camerabincontainer.cpp +++ b/src/plugins/gstreamer/camerabin/camerabincontainer.cpp @@ -96,7 +96,7 @@ GstEncodingContainerProfile *CameraBinContainer::createProfile() GstCaps *caps; - + if (m_actualFormat.isEmpty()) { - caps = gst_caps_new_any(); + return 0; @@ -4642,7 +4543,7 @@ index 3ec9927..8c6b8b0 100644 emit captureModeChanged(mode); } @@ -299,6 +294,8 @@ bool CameraBinControl::canChangeProperty(PropertyChangeType changeType, QCamera: - + switch (changeType) { case QCameraControl::CaptureMode: + return status != QCamera::ActiveStatus; @@ -4655,15 +4556,15 @@ index a235de2..795fd42 100644 --- a/src/plugins/gstreamer/camerabin/camerabinexposure.cpp +++ b/src/plugins/gstreamer/camerabin/camerabinexposure.cpp @@ -37,6 +37,10 @@ - + #include - + +#if !GST_CHECK_VERSION(1,0,0) +typedef GstSceneMode GstPhotographySceneMode; +#endif + QT_BEGIN_NAMESPACE - + CameraBinExposure::CameraBinExposure(CameraBinSession *session) @@ -119,7 +123,7 @@ QVariant CameraBinExposure::actualValue(ExposureParameter parameter) const } @@ -4672,7 +4573,7 @@ index a235de2..795fd42 100644 - GstSceneMode sceneMode; + GstPhotographySceneMode sceneMode; gst_photography_get_scene_mode(m_session->photography(), &sceneMode); - + switch (sceneMode) { @@ -167,7 +171,7 @@ bool CameraBinExposure::setValue(ExposureParameter parameter, const QVariant& va case QCameraExposureControl::ExposureMode: @@ -4681,40 +4582,40 @@ index a235de2..795fd42 100644 - GstSceneMode sceneMode; + GstPhotographySceneMode sceneMode; gst_photography_get_scene_mode(m_session->photography(), &sceneMode); - + switch (mode) { diff --git a/src/plugins/gstreamer/camerabin/camerabinflash.cpp b/src/plugins/gstreamer/camerabin/camerabinflash.cpp index 2140f66..51bb9a2 100644 --- a/src/plugins/gstreamer/camerabin/camerabinflash.cpp +++ b/src/plugins/gstreamer/camerabin/camerabinflash.cpp @@ -37,6 +37,10 @@ - + #include - + +#if !GST_CHECK_VERSION(1,0,0) +typedef GstFlashMode GstPhotographyFlashMode; +#endif + QT_BEGIN_NAMESPACE - + CameraBinFlash::CameraBinFlash(CameraBinSession *session) @@ -51,7 +55,7 @@ CameraBinFlash::~CameraBinFlash() - + QCameraExposure::FlashModes CameraBinFlash::flashMode() const { - GstFlashMode flashMode; + GstPhotographyFlashMode flashMode; gst_photography_get_flash_mode(m_session->photography(), &flashMode); - + QCameraExposure::FlashModes modes; @@ -70,7 +74,7 @@ QCameraExposure::FlashModes CameraBinFlash::flashMode() const - + void CameraBinFlash::setFlashMode(QCameraExposure::FlashModes mode) { - GstFlashMode flashMode; + GstPhotographyFlashMode flashMode; gst_photography_get_flash_mode(m_session->photography(), &flashMode); - + if (mode.testFlag(QCameraExposure::FlashAuto)) flashMode = GST_PHOTOGRAPHY_FLASH_MODE_AUTO; diff --git a/src/plugins/gstreamer/camerabin/camerabinfocus.cpp b/src/plugins/gstreamer/camerabin/camerabinfocus.cpp index 665e204..061c680 100644 @@ -4723,7 +4624,7 @@ index 665e204..061c680 100644 @@ -39,6 +39,12 @@ #include #include - + +#include + +#if !GST_CHECK_VERSION(1,0,0) @@ -4731,15 +4632,15 @@ index 665e204..061c680 100644 +#endif + //#define CAMERABIN_DEBUG 1 - + QT_BEGIN_NAMESPACE @@ -73,7 +79,7 @@ QCameraFocus::FocusModes CameraBinFocus::focusMode() const - + void CameraBinFocus::setFocusMode(QCameraFocus::FocusModes mode) { - GstFocusMode photographyMode; + GstPhotographyFocusMode photographyMode; - + switch (mode) { case QCameraFocus::AutoFocus: @@ -181,9 +187,10 @@ QCameraFocusZoneList CameraBinFocus::focusZones() const @@ -4754,7 +4655,7 @@ index 665e204..061c680 100644 + gst_structure_get_int (structure, "status", &status); QCamera::LockStatus focusStatus = m_focusStatus; QCamera::LockChangeReason reason = QCamera::UserRequest; - + @@ -243,7 +250,7 @@ void CameraBinFocus::_q_handleCameraStateChange(QCamera::State state) m_cameraState = state; if (state == QCamera::ActiveState) { @@ -4769,7 +4670,7 @@ index 6952155..8b51306 100644 --- a/src/plugins/gstreamer/camerabin/camerabinimagecapture.cpp +++ b/src/plugins/gstreamer/camerabin/camerabinimagecapture.cpp @@ -53,11 +53,13 @@ QT_BEGIN_NAMESPACE - + CameraBinImageCapture::CameraBinImageCapture(CameraBinSession *session) :QCameraImageCaptureControl(session) + , m_encoderProbe(this) @@ -4787,7 +4688,7 @@ index 6952155..8b51306 100644 @@ -108,11 +110,18 @@ void CameraBinImageCapture::updateState() } } - + -gboolean CameraBinImageCapture::metadataEventProbe(GstPad *pad, GstEvent *event, CameraBinImageCapture *self) +#if GST_CHECK_VERSION(1,0,0) +GstPadProbeReturn CameraBinImageCapture::encoderEventProbe( @@ -4817,7 +4718,7 @@ index 6952155..8b51306 100644 + return TRUE; +#endif +} - + - return true; +void CameraBinImageCapture::EncoderProbe::probeCaps(GstCaps *caps) +{ @@ -4830,22 +4731,22 @@ index 6952155..8b51306 100644 + capture->m_bufferFormat = format; +#endif } - + -gboolean CameraBinImageCapture::uncompressedBufferProbe(GstPad *pad, GstBuffer *buffer, CameraBinImageCapture *self) +bool CameraBinImageCapture::EncoderProbe::probeBuffer(GstBuffer *buffer) { - Q_UNUSED(pad); - CameraBinSession *session = self->m_session; + CameraBinSession * const session = capture->m_session; - + #ifdef DEBUG_CAPTURE - qDebug() << "Uncompressed buffer probe" << gst_caps_to_string(GST_BUFFER_CAPS(buffer)); + qDebug() << "Uncompressed buffer probe"; #endif - + QCameraImageCapture::CaptureDestinations destination = @@ -165,21 +188,23 @@ gboolean CameraBinImageCapture::uncompressedBufferProbe(GstPad *pad, GstBuffer * - + if (destination & QCameraImageCapture::CaptureToBuffer) { if (format != QVideoFrame::Format_Jpeg) { - GstCaps *caps = GST_BUFFER_CAPS(buffer); @@ -4860,7 +4761,7 @@ index 6952155..8b51306 100644 +#else + QGstVideoBuffer *videoBuffer = new QGstVideoBuffer(buffer, capture->m_bytesPerLine); +#endif - + - QVideoFrame frame(videoBuffer, - format.frameSize(), - format.pixelFormat()); @@ -4868,7 +4769,7 @@ index 6952155..8b51306 100644 + videoBuffer, + capture->m_bufferFormat.frameSize(), + capture->m_bufferFormat.pixelFormat()); - + - QMetaObject::invokeMethod(self, "imageAvailable", + QMetaObject::invokeMethod(capture, "imageAvailable", Qt::QueuedConnection, @@ -4880,7 +4781,7 @@ index 6952155..8b51306 100644 @@ -192,25 +217,40 @@ gboolean CameraBinImageCapture::uncompressedBufferProbe(GstPad *pad, GstBuffer * return keepBuffer; } - + -gboolean CameraBinImageCapture::jpegBufferProbe(GstPad *pad, GstBuffer *buffer, CameraBinImageCapture *self) +void CameraBinImageCapture::MuxerProbe::probeCaps(GstCaps *caps) { @@ -4888,22 +4789,22 @@ index 6952155..8b51306 100644 - CameraBinSession *session = self->m_session; + capture->m_jpegResolution = QGstUtils::capsCorrectedResolution(caps); +} - + -#ifdef DEBUG_CAPTURE - qDebug() << "Jpeg buffer probe" << gst_caps_to_string(GST_BUFFER_CAPS(buffer)); -#endif +bool CameraBinImageCapture::MuxerProbe::probeBuffer(GstBuffer *buffer) +{ + CameraBinSession * const session = capture->m_session; - + QCameraImageCapture::CaptureDestinations destination = session->captureDestinationControl()->captureDestination(); - + if ((destination & QCameraImageCapture::CaptureToBuffer) && session->captureBufferFormatControl()->bufferFormat() == QVideoFrame::Format_Jpeg) { - QGstVideoBuffer *videoBuffer = new QGstVideoBuffer(buffer, - -1); //bytesPerLine is not available for jpegs - + - QSize resolution = QGstUtils::capsCorrectedResolution(GST_BUFFER_CAPS(buffer)); + QSize resolution = capture->m_jpegResolution; //if resolution is not presented in caps, try to find it from encoded jpeg data: @@ -4930,7 +4831,7 @@ index 6952155..8b51306 100644 @@ -218,20 +258,28 @@ gboolean CameraBinImageCapture::jpegBufferProbe(GstPad *pad, GstBuffer *buffer, resolution = reader.size(); } - + + QGstVideoBuffer *videoBuffer = new QGstVideoBuffer(buffer, + -1); //bytesPerLine is not available for jpegs +#endif @@ -4947,7 +4848,7 @@ index 6952155..8b51306 100644 + Q_ARG(int, capture->m_requestId), Q_ARG(QVideoFrame, frame)); } - + - //drop the buffer if capture to file was disabled - return destination & QCameraImageCapture::CaptureToFile; + @@ -4956,14 +4857,14 @@ index 6952155..8b51306 100644 + // to its idle state. + return true; } - + + bool CameraBinImageCapture::processBusMessage(const QGstreamerMessage &message) { //Install metadata event and buffer probes @@ -252,9 +300,10 @@ bool CameraBinImageCapture::processBusMessage(const QGstreamerMessage &message) return false; - + QString elementName = QString::fromLatin1(gst_element_get_name(element)); +#if !GST_CHECK_VERSION(1,0,0) GstElementClass *elementClass = GST_ELEMENT_GET_CLASS(element); @@ -4994,7 +4895,7 @@ index 6952155..8b51306 100644 - G_CALLBACK(CameraBinImageCapture::uncompressedBufferProbe), - this); + m_encoderProbe.addProbeToPad(sinkpad, true); - + gst_object_unref(sinkpad); - } else if ((elementName.contains("jifmux") || - elementName.startsWith("metadatamux") || @@ -5026,7 +4927,7 @@ index c2e26f5..9a52dd9 100644 @@ -38,6 +38,14 @@ #include #include "camerabinsession.h" - + +#include + +#include @@ -5036,11 +4937,11 @@ index c2e26f5..9a52dd9 100644 +#endif + QT_BEGIN_NAMESPACE - + class CameraBinImageCapture : public QCameraImageCaptureControl, public QGstreamerBusMessageFilter @@ -61,15 +69,47 @@ private slots: void updateState(); - + private: - static gboolean metadataEventProbe(GstPad *pad, GstEvent *event, CameraBinImageCapture *); - static gboolean uncompressedBufferProbe(GstPad *pad, GstBuffer *buffer, CameraBinImageCapture *); @@ -5068,7 +4969,7 @@ index c2e26f5..9a52dd9 100644 + MuxerProbe(CameraBinImageCapture *capture) : capture(capture) {} + void probeCaps(GstCaps *caps); + bool probeBuffer(GstBuffer *buffer); - + + private: + CameraBinImageCapture * const capture; + @@ -5089,20 +4990,20 @@ index c2e26f5..9a52dd9 100644 + int m_requestId; + bool m_ready; }; - + QT_END_NAMESPACE diff --git a/src/plugins/gstreamer/camerabin/camerabinimageencoder.cpp b/src/plugins/gstreamer/camerabin/camerabinimageencoder.cpp index 824f996..739364f 100644 --- a/src/plugins/gstreamer/camerabin/camerabinimageencoder.cpp +++ b/src/plugins/gstreamer/camerabin/camerabinimageencoder.cpp @@ -49,7 +49,6 @@ CameraBinImageEncoder::~CameraBinImageEncoder() - + QList CameraBinImageEncoder::supportedResolutions(const QImageEncoderSettings &, bool *continuous) const { - qDebug() << "CameraBinImageEncoder::supportedResolutions()"; if (continuous) *continuous = false; - + diff --git a/src/plugins/gstreamer/camerabin/camerabinimageprocessing.cpp b/src/plugins/gstreamer/camerabin/camerabinimageprocessing.cpp index ebfb087..811225f 100644 --- a/src/plugins/gstreamer/camerabin/camerabinimageprocessing.cpp @@ -5110,16 +5011,16 @@ index ebfb087..811225f 100644 @@ -34,7 +34,11 @@ #include "camerabinimageprocessing.h" #include "camerabinsession.h" - + -#include +#if GST_CHECK_VERSION(1,0,0) +# include +#else +# include +#endif - + QT_BEGIN_NAMESPACE - + @@ -126,7 +130,7 @@ bool CameraBinImageProcessing::setColorBalanceValue(const QString& channel, qrea QCameraImageProcessing::WhiteBalanceMode CameraBinImageProcessing::whiteBalanceMode() const { @@ -5135,7 +5036,7 @@ index dcefcd0..2c6347f 100644 +++ b/src/plugins/gstreamer/camerabin/camerabinimageprocessing.h @@ -41,7 +41,10 @@ #include - + #ifdef HAVE_GST_PHOTOGRAPHY -#include +# include @@ -5143,7 +5044,7 @@ index dcefcd0..2c6347f 100644 +typedef GstWhiteBalanceMode GstPhotographyWhiteBalanceMode; +# endif #endif - + QT_BEGIN_NAMESPACE @@ -73,7 +76,7 @@ private: CameraBinSession *m_session; @@ -5153,7 +5054,7 @@ index dcefcd0..2c6347f 100644 + QMap m_mappedWbValues; #endif }; - + diff --git a/src/plugins/gstreamer/camerabin/camerabinmetadata.cpp b/src/plugins/gstreamer/camerabin/camerabinmetadata.cpp index 5148135..bc1b260 100644 --- a/src/plugins/gstreamer/camerabin/camerabinmetadata.cpp @@ -5193,16 +5094,16 @@ index 3a04c2f..801c7ab 100644 + ? QMediaRecorder::LoadingStatus + : QMediaRecorder::UnloadedStatus; } - + if (m_state != oldState) @@ -161,8 +162,6 @@ void CameraBinRecorder::applySettings() - + QVideoEncoderSettings videoSettings = videoEncoderControl->videoSettings(); videoSettings.setCodec(candidate[1]); - if (videoSettings.resolution().isEmpty()) - videoSettings.setResolution(640, 480); videoEncoderControl->setActualVideoSettings(videoSettings); - + QAudioEncoderSettings audioSettings = audioEncoderControl->audioSettings(); diff --git a/src/plugins/gstreamer/camerabin/camerabinservice.cpp b/src/plugins/gstreamer/camerabin/camerabinservice.cpp index 969955f..388f2fd 100644 @@ -5213,10 +5114,10 @@ index 969955f..388f2fd 100644 #include "camerabinviewfindersettings.h" #include +#include - + #include #include - + - #if defined(HAVE_WIDGETS) #include @@ -5232,14 +5133,14 @@ index 969955f..388f2fd 100644 @@ -150,8 +149,6 @@ QMediaControl *CameraBinService::requestControl(const char *name) if (!m_captureSession) return 0; - + - //qDebug() << "Request control" << name; - if (!m_videoOutput) { if (qstrcmp(name, QVideoRendererControl_iid) == 0) { m_videoOutput = m_videoRenderer; @@ -249,7 +246,7 @@ void CameraBinService::releaseControl(QMediaControl *control) - + bool CameraBinService::isCameraBinAvailable() { - GstElementFactory *factory = gst_element_factory_find("camerabin2"); @@ -5248,7 +5149,7 @@ index 969955f..388f2fd 100644 gst_object_unref(GST_OBJECT(factory)); return true; diff --git a/src/plugins/gstreamer/camerabin/camerabinsession.cpp b/src/plugins/gstreamer/camerabin/camerabinsession.cpp -index a4038c5..f916b58 100644 +index 1ed663b..b62fbbf 100644 --- a/src/plugins/gstreamer/camerabin/camerabinsession.cpp +++ b/src/plugins/gstreamer/camerabin/camerabinsession.cpp @@ -140,8 +140,8 @@ CameraBinSession::CameraBinSession(GstElementFactory *sourceFactory, QObject *pa @@ -5256,7 +5157,7 @@ index a4038c5..f916b58 100644 if (m_sourceFactory) gst_object_ref(GST_OBJECT(m_sourceFactory)); + m_camerabin = gst_element_factory_make(QT_GSTREAMER_CAMERABIN_ELEMENT_NAME, "camerabin"); - + - m_camerabin = gst_element_factory_make("camerabin2", "camerabin2"); g_signal_connect(G_OBJECT(m_camerabin), "notify::idle", G_CALLBACK(updateBusyStatus), this); g_signal_connect(G_OBJECT(m_camerabin), "element-added", G_CALLBACK(elementAdded), this); @@ -5264,7 +5165,7 @@ index a4038c5..f916b58 100644 @@ -178,7 +178,15 @@ CameraBinSession::CameraBinSession(GstElementFactory *sourceFactory, QObject *pa //post image preview in RGB format g_object_set(G_OBJECT(m_camerabin), POST_PREVIEWS_PROPERTY, TRUE, NULL); - + +#if GST_CHECK_VERSION(1,0,0) + GstCaps *previewCaps = gst_caps_new_simple( + "video/x-raw", @@ -5288,14 +5189,14 @@ index a4038c5..f916b58 100644 @@ -251,61 +260,27 @@ bool CameraBinSession::setupCameraBin() return true; } - + -static GstCaps *resolutionToCaps(const QSize &resolution, const QPair &rate = qMakePair(0,0)) +static GstCaps *resolutionToCaps(const QSize &resolution, qreal frameRate = 0.0) { - if (resolution.isEmpty()) - return gst_caps_new_any(); + GstCaps *caps = QGstUtils::videoFilterCaps(); - + - GstCaps *caps = 0; - if (rate.second > 0) { - caps = gst_caps_new_full(gst_structure_new("video/x-raw-yuv", @@ -5364,13 +5265,14 @@ index a4038c5..f916b58 100644 + "framerate", GST_TYPE_FRACTION, numerator, denominator, + NULL); } - + return caps; -@@ -314,40 +289,40 @@ static GstCaps *resolutionToCaps(const QSize &resolution, const QPair +@@ -314,28 +289,29 @@ static GstCaps *resolutionToCaps(const QSize &resolution, const QPair void CameraBinSession::setupCaptureResolution() { QSize resolution = m_imageEncodeControl->imageSettings().resolution(); - if (!resolution.isEmpty()) { ++ if (!resolution.isEmpty()) + { GstCaps *caps = resolutionToCaps(resolution); #if CAMERABIN_DEBUG @@ -5384,7 +5286,7 @@ index a4038c5..f916b58 100644 + if (caps) + gst_caps_unref(caps); } - + + const QSize viewfinderResolution = m_viewfinderSettingsControl->resolution(); resolution = m_videoEncodeControl->actualVideoSettings().resolution(); - //qreal framerate = m_videoEncodeControl->videoSettings().frameRate(); @@ -5405,7 +5307,12 @@ index a4038c5..f916b58 100644 + if (caps) + gst_caps_unref(caps); } - + + GstElement *mfw_v4lsrc = 0; +@@ -349,15 +325,14 @@ void CameraBinSession::setupCaptureResolution() + } + } + - resolution = m_viewfinderSettingsControl->resolution(); - if (!resolution.isEmpty()) { + if (!viewfinderResolution.isEmpty()) @@ -5418,17 +5325,25 @@ index a4038c5..f916b58 100644 #endif g_object_set(m_camerabin, VIEWFINDER_CAPS_PROPERTY, caps, NULL); - gst_caps_unref(caps); +- + if (mfw_v4lsrc) { + int capMode = 0; + if (resolution == QSize(320, 240)) +@@ -372,8 +347,8 @@ void CameraBinSession::setupCaptureResolution() + capMode = 5; + g_object_set(G_OBJECT(mfw_v4lsrc), "capture-mode", capMode, NULL); + } - } else { - g_object_set(m_camerabin, VIEWFINDER_CAPS_PROPERTY, NULL, NULL); -+ if (caps) -+ gst_caps_unref(caps); ++ if (caps) ++ gst_caps_unref(caps); } - - if (m_videoEncoder) -@@ -363,13 +338,17 @@ void CameraBinSession::setAudioCaptureCaps() + + const qreal maxFps = m_viewfinderSettingsControl->maximumFrameRate(); +@@ -399,13 +374,17 @@ void CameraBinSession::setAudioCaptureCaps() if (sampleRate == -1 && channelCount == -1) return; - + +#if GST_CHECK_VERSION(1,0,0) + GstStructure *structure = gst_structure_new_empty(QT_GSTREAMER_RAW_AUDIO_MIME); +#else @@ -5444,7 +5359,7 @@ index a4038c5..f916b58 100644 if (sampleRate != -1) gst_structure_set(structure, "rate", G_TYPE_INT, sampleRate, NULL); if (channelCount != -1) -@@ -760,7 +739,7 @@ qint64 CameraBinSession::duration() const +@@ -796,7 +775,7 @@ qint64 CameraBinSession::duration() const if (fileSink) { GstFormat format = GST_FORMAT_TIME; gint64 duration = 0; @@ -5453,10 +5368,10 @@ index a4038c5..f916b58 100644 gst_object_unref(GST_OBJECT(fileSink)); if (ret) return duration / 1000000; -@@ -795,129 +774,57 @@ void CameraBinSession::setMetaData(const QMap &data) +@@ -831,129 +810,57 @@ void CameraBinSession::setMetaData(const QMap &data) { m_metaData = data; - + - if (m_camerabin) { - GstIterator *elements = gst_bin_iterate_all_by_interface(GST_BIN(m_camerabin), GST_TYPE_TAG_SETTER); - GstElement *element = 0; @@ -5513,14 +5428,14 @@ index a4038c5..f916b58 100644 + if (m_camerabin) + QGstUtils::setMetaData(m_camerabin, data); } - + bool CameraBinSession::processSyncMessage(const QGstreamerMessage &message) { GstMessage* gm = message.rawMessage(); - const GstStructure *st; - const GValue *image; - GstBuffer *buffer = NULL; - + if (gm && GST_MESSAGE_TYPE(gm) == GST_MESSAGE_ELEMENT) { - if (m_captureMode == QCamera::CaptureStillImage && - gst_structure_has_name(gm->structure, "preview-image")) { @@ -5555,7 +5470,7 @@ index a4038c5..f916b58 100644 + && (sampleValue = gst_structure_get_value(st, "buffer"))) { + GstBuffer * const buffer = gst_value_get_buffer(sampleValue); #endif - + - if (structure && - gst_structure_get_int(structure, "width", &width) && - gst_structure_get_int(structure, "height", &height) && @@ -5622,7 +5537,7 @@ index a4038c5..f916b58 100644 m_cameraFocusControl->handleFocusMessage(gm); #endif } -@@ -1109,20 +1016,12 @@ QList< QPair > CameraBinSession::supportedFrameRates(const QSize &frame +@@ -1145,20 +1052,12 @@ QList< QPair > CameraBinSession::supportedFrameRates(const QSize &frame if (frameSize.isEmpty()) { caps = gst_caps_copy(supportedCaps); } else { @@ -5646,10 +5561,10 @@ index a4038c5..f916b58 100644 + "width", G_TYPE_INT, frameSize.width(), + "height", G_TYPE_INT, frameSize.height(), + NULL); - + caps = gst_caps_intersect(supportedCaps, filter); gst_caps_unref(filter); -@@ -1133,7 +1032,7 @@ QList< QPair > CameraBinSession::supportedFrameRates(const QSize &frame +@@ -1169,7 +1068,7 @@ QList< QPair > CameraBinSession::supportedFrameRates(const QSize &frame caps = gst_caps_make_writable(caps); for (uint i=0; i > CameraBinSession::supportedFrameRates(const QSize &frame +@@ -1178,8 +1077,11 @@ QList< QPair > CameraBinSession::supportedFrameRates(const QSize &frame gst_structure_remove_all_fields(structure); gst_structure_set_value(structure, "framerate", &rate); } @@ -5668,22 +5583,22 @@ index a4038c5..f916b58 100644 gst_caps_do_simplify(caps); - +#endif - + for (uint i=0; i > CameraBinSession::supportedFrameRates(const QSize &frame +@@ -1190,7 +1092,7 @@ QList< QPair > CameraBinSession::supportedFrameRates(const QSize &frame qSort(res.begin(), res.end(), rateLessThan); - + #if CAMERABIN_DEBUG - qDebug() << "Supported rates:" << gst_caps_to_string(caps); + qDebug() << "Supported rates:" << caps; qDebug() << res; #endif - -@@ -1213,31 +1115,24 @@ QList CameraBinSession::supportedResolutions(QPair rate, + +@@ -1249,31 +1151,24 @@ QList CameraBinSession::supportedResolutions(QPair rate, SUPPORTED_IMAGE_CAPTURE_CAPS_PROPERTY : SUPPORTED_VIDEO_CAPTURE_CAPS_PROPERTY, &supportedCaps, NULL); - + - if (!supportedCaps) - return res; - @@ -5691,13 +5606,13 @@ index a4038c5..f916b58 100644 - qDebug() << "Source caps:" << gst_caps_to_string(supportedCaps); + qDebug() << "Source caps:" << supportedCaps; #endif - + + if (!supportedCaps) + return res; + GstCaps *caps = 0; bool isContinuous = false; - + if (rate.first <= 0 || rate.second <= 0) { caps = gst_caps_copy(supportedCaps); } else { @@ -5721,7 +5636,7 @@ index a4038c5..f916b58 100644 caps = gst_caps_intersect(supportedCaps, filter); gst_caps_unref(filter); } -@@ -1247,7 +1142,7 @@ QList CameraBinSession::supportedResolutions(QPair rate, +@@ -1283,7 +1178,7 @@ QList CameraBinSession::supportedResolutions(QPair rate, caps = gst_caps_make_writable(caps); for (uint i=0; i CameraBinSession::supportedResolutions(QPair rate, +@@ -1298,7 +1193,13 @@ QList CameraBinSession::supportedResolutions(QPair rate, gst_structure_set_value(structure, "width", &w); gst_structure_set_value(structure, "height", &h); } @@ -5741,7 +5656,7 @@ index a4038c5..f916b58 100644 gst_caps_do_simplify(caps); +#endif + - + for (uint i=0; i - + #include - + @@ -175,7 +176,7 @@ GstElement *QGstreamerAudioEncode::createEncoder() - + if (m_audioSettings.sampleRate() > 0 || m_audioSettings.channelCount() > 0) { GstCaps *caps = gst_caps_new_empty(); - GstStructure *structure = gst_structure_new("audio/x-raw-int", NULL); + GstStructure *structure = qt_gst_structure_new_empty(QT_GSTREAMER_RAW_AUDIO_MIME); - + if (m_audioSettings.sampleRate() > 0) gst_structure_set(structure, "rate", G_TYPE_INT, m_audioSettings.sampleRate(), NULL ); diff --git a/src/plugins/gstreamer/mediacapture/qgstreamercaptureservice.cpp b/src/plugins/gstreamer/mediacapture/qgstreamercaptureservice.cpp @@ -5836,9 +5751,9 @@ index 97a165d..1ab98cd 100644 --- a/src/plugins/gstreamer/mediacapture/qgstreamercaptureservice.cpp +++ b/src/plugins/gstreamer/mediacapture/qgstreamercaptureservice.cpp @@ -62,27 +62,25 @@ - + QT_BEGIN_NAMESPACE - + -QGstreamerCaptureService::QGstreamerCaptureService(const QString &service, QObject *parent): - QMediaService(parent) -{ @@ -5880,7 +5795,7 @@ index 97a165d..1ab98cd 100644 } @@ -163,12 +161,12 @@ QMediaControl *QGstreamerCaptureService::requestControl(const char *name) return m_imageCaptureControl; - + if (qstrcmp(name,QMediaAudioProbeControl_iid) == 0) { - if (m_captureSession) { - QGstreamerAudioProbeControl *probe = new QGstreamerAudioProbeControl(this); @@ -5894,10 +5809,10 @@ index 97a165d..1ab98cd 100644 + m_audioProbeControl->ref.ref(); + return m_audioProbeControl; } - + if (!m_videoOutput) { @@ -194,17 +192,15 @@ QMediaControl *QGstreamerCaptureService::requestControl(const char *name) - + void QGstreamerCaptureService::releaseControl(QMediaControl *control) { - if (control && control == m_videoOutput) { @@ -5920,7 +5835,7 @@ index 97a165d..1ab98cd 100644 + m_audioProbeControl = 0; } } - + diff --git a/src/plugins/gstreamer/mediacapture/qgstreamercaptureservice.h b/src/plugins/gstreamer/mediacapture/qgstreamercaptureservice.h index 7ff8ce2..e0cf4ee 100644 --- a/src/plugins/gstreamer/mediacapture/qgstreamercaptureservice.h @@ -5928,7 +5843,7 @@ index 7ff8ce2..e0cf4ee 100644 @@ -43,6 +43,7 @@ QT_BEGIN_NAMESPACE class QAudioInputSelectorControl; class QVideoDeviceSelectorControl; - + +class QGstreamerAudioProbeControl; class QGstreamerCaptureSession; class QGstreamerCameraControl; @@ -5940,7 +5855,7 @@ index 7ff8ce2..e0cf4ee 100644 + + QGstreamerAudioProbeControl *m_audioProbeControl; }; - + QT_END_NAMESPACE diff --git a/src/plugins/gstreamer/mediacapture/qgstreamercaptureserviceplugin.cpp b/src/plugins/gstreamer/mediacapture/qgstreamercaptureserviceplugin.cpp index 0ac34ee..85ed687 100644 @@ -5949,7 +5864,7 @@ index 0ac34ee..85ed687 100644 @@ -110,90 +110,16 @@ QMultimedia::SupportEstimate QGstreamerCaptureServicePlugin::hasSupport(const QS return QGstUtils::hasSupport(mimeType, codecs, m_supportedMimeTypeSet); } - + + +static bool isEncoderOrMuxer(GstElementFactory *factory) +{ @@ -6043,18 +5958,18 @@ index 0ac34ee..85ed687 100644 -#endif + m_supportedMimeTypeSet = QGstUtils::supportedMimeTypes(isEncoderOrMuxer); } - + QStringList QGstreamerCaptureServicePlugin::supportedMimeTypes() const diff --git a/src/plugins/gstreamer/mediacapture/qgstreamercapturesession.cpp b/src/plugins/gstreamer/mediacapture/qgstreamercapturesession.cpp index a2bd80d..af5b339 100644 --- a/src/plugins/gstreamer/mediacapture/qgstreamercapturesession.cpp +++ b/src/plugins/gstreamer/mediacapture/qgstreamercapturesession.cpp @@ -45,6 +45,7 @@ - + #include #include +#include - + #include #include @@ -52,7 +53,6 @@ @@ -6063,7 +5978,7 @@ index a2bd80d..af5b339 100644 #include - #include - + QT_BEGIN_NAMESPACE @@ -64,7 +64,7 @@ QGstreamerCaptureSession::QGstreamerCaptureSession(QGstreamerCaptureSession::Cap m_waitingForEos(false), @@ -6075,27 +5990,27 @@ index a2bd80d..af5b339 100644 m_audioPreviewFactory(0), m_videoInputFactory(0), @@ -169,7 +169,7 @@ GstElement *QGstreamerCaptureSession::buildEncodeBin() - + if (m_captureMode & Video) { GstElement *videoQueue = gst_element_factory_make("queue", "video-encode-queue"); - GstElement *colorspace = gst_element_factory_make("ffmpegcolorspace", "ffmpegcolorspace-encoder"); + GstElement *colorspace = gst_element_factory_make(QT_GSTREAMER_COLORCONVERSION_ELEMENT_NAME, "videoconvert-encoder"); GstElement *videoscale = gst_element_factory_make("videoscale","videoscale-encoder"); gst_bin_add_many(GST_BIN(encodeBin), videoQueue, colorspace, videoscale, NULL); - + @@ -280,7 +280,7 @@ GstElement *QGstreamerCaptureSession::buildVideoPreview() - + if (m_viewfinderInterface) { GstElement *bin = gst_bin_new("video-preview-bin"); - GstElement *colorspace = gst_element_factory_make("ffmpegcolorspace", "ffmpegcolorspace-preview"); + GstElement *colorspace = gst_element_factory_make(QT_GSTREAMER_COLORCONVERSION_ELEMENT_NAME, "videoconvert-preview"); GstElement *capsFilter = gst_element_factory_make("capsfilter", "capsfilter-video-preview"); GstElement *preview = m_viewfinderInterface->videoSink(); - + @@ -299,36 +299,25 @@ GstElement *QGstreamerCaptureSession::buildVideoPreview() resolution = m_imageEncodeControl->imageSettings().resolution(); } - + - if (!resolution.isEmpty() || frameRate > 0.001) { - GstCaps *caps = gst_caps_new_empty(); - QStringList structureTypes; @@ -6112,7 +6027,7 @@ index a2bd80d..af5b339 100644 - if (frameRate > 0.001) { - QPair rate = m_videoEncodeControl->rateAsRational(); + GstCaps *caps = QGstUtils::videoFilterCaps(); - + - //qDebug() << "frame rate:" << num << denum; + if (!resolution.isEmpty()) { + gst_caps_set_simple(caps, "width", G_TYPE_INT, resolution.width(), NULL); @@ -6120,26 +6035,26 @@ index a2bd80d..af5b339 100644 + } + if (frameRate > 0.001) { + QPair rate = m_videoEncodeControl->rateAsRational(); - + - gst_structure_set(structure, "framerate", GST_TYPE_FRACTION, rate.first, rate.second, NULL); - } + //qDebug() << "frame rate:" << num << denum; - + - gst_caps_append_structure(caps,structure); - } + gst_caps_set_simple(caps, "framerate", GST_TYPE_FRACTION, rate.first, rate.second, NULL); + } - + - //qDebug() << "set video preview caps filter:" << gst_caps_to_string(caps); + //qDebug() << "set video preview caps filter:" << gst_caps_to_string(caps); - + - g_object_set(G_OBJECT(capsFilter), "caps", caps, NULL); + g_object_set(G_OBJECT(capsFilter), "caps", caps, NULL); - + - gst_caps_unref(caps); - } + gst_caps_unref(caps); - + // add ghostpads GstPad *pad = gst_element_get_static_pad(colorspace, "sink"); @@ -342,7 +331,7 @@ GstElement *QGstreamerCaptureSession::buildVideoPreview() @@ -6154,7 +6069,7 @@ index a2bd80d..af5b339 100644 @@ -360,101 +349,49 @@ GstElement *QGstreamerCaptureSession::buildVideoPreview() return previewElement; } - + - -static gboolean passImageFilter(GstElement *element, - GstBuffer *buffer, @@ -6200,7 +6115,7 @@ index a2bd80d..af5b339 100644 + Q_UNUSED(caps); +#endif +} - + - for (int y=0; y(buffer->data), buffer->size); +#endif f.close(); - + static QMetaMethod savedSignal = QMetaMethod::fromSignal(&QGstreamerCaptureSession::imageSaved); @@ -489,18 +434,19 @@ GstElement *QGstreamerCaptureSession::buildImageCapture() { @@ -6312,7 +6227,7 @@ index a2bd80d..af5b339 100644 + GstElement *colorspace = gst_element_factory_make(QT_GSTREAMER_COLORCONVERSION_ELEMENT_NAME, "videoconvert-image-capture"); GstElement *encoder = gst_element_factory_make("jpegenc", "image-encoder"); GstElement *sink = gst_element_factory_make("fakesink","sink-image-capture"); - + GstPad *pad = gst_element_get_static_pad(queue, "src"); Q_ASSERT(pad); - gst_pad_add_buffer_probe(pad, G_CALLBACK(passImageFilter), this); @@ -6320,12 +6235,12 @@ index a2bd80d..af5b339 100644 + addProbeToPad(pad, false); + gst_object_unref(GST_OBJECT(pad)); - + g_object_set(G_OBJECT(sink), "signal-handoffs", TRUE, NULL); - g_signal_connect(G_OBJECT(sink), "handoff", - G_CALLBACK(saveImageFilter), this); + g_signal_connect(G_OBJECT(sink), "handoff", G_CALLBACK(saveImageFilter), this); - + gst_bin_add_many(GST_BIN(bin), queue, colorspace, encoder, sink, NULL); gst_element_link_many(queue, colorspace, encoder, sink, NULL); @@ -715,6 +661,8 @@ void QGstreamerCaptureSession::dumpGraph(const QString &fileName) @@ -6336,9 +6251,9 @@ index a2bd80d..af5b339 100644 + Q_UNUSED(fileName); #endif } - + @@ -877,10 +825,8 @@ void QGstreamerCaptureSession::setState(QGstreamerCaptureSession::State newState - + qint64 QGstreamerCaptureSession::duration() const { - GstFormat format = GST_FORMAT_TIME; @@ -6353,7 +6268,7 @@ index a2bd80d..af5b339 100644 @@ -896,50 +842,8 @@ void QGstreamerCaptureSession::setMetaData(const QMap &dat //qDebug() << "QGstreamerCaptureSession::setMetaData" << data; m_metaData = data; - + - if (m_encodeBin) { - GstIterator *elements = gst_bin_iterate_all_by_interface(GST_BIN(m_encodeBin), GST_TYPE_TAG_SETTER); - GstElement *element = 0; @@ -6401,10 +6316,10 @@ index a2bd80d..af5b339 100644 + if (m_encodeBin) + QGstUtils::setMetaData(GST_BIN(m_encodeBin), data); } - + bool QGstreamerCaptureSession::processBusMessage(const QGstreamerMessage &message) @@ -1058,34 +962,16 @@ void QGstreamerCaptureSession::setVolume(qreal volume) - + void QGstreamerCaptureSession::addProbe(QGstreamerAudioProbeControl* probe) { - QMutexLocker locker(&m_audioProbeMutex); @@ -6417,7 +6332,7 @@ index a2bd80d..af5b339 100644 + m_audioProbe = probe; + addAudioBufferProbe(); } - + void QGstreamerCaptureSession::removeProbe(QGstreamerAudioProbeControl* probe) { - QMutexLocker locker(&m_audioProbeMutex); @@ -6442,16 +6357,16 @@ index a2bd80d..af5b339 100644 + removeAudioBufferProbe(); + m_audioProbe = 0; } - + GstPad *QGstreamerCaptureSession::getAudioProbePad() @@ -1114,26 +1000,25 @@ GstPad *QGstreamerCaptureSession::getAudioProbePad() - + void QGstreamerCaptureSession::removeAudioBufferProbe() { - if (m_audioBufferProbeId == -1) + if (!m_audioProbe) return; - + GstPad *pad = getAudioProbePad(); if (pad) { - gst_pad_remove_buffer_probe(pad, m_audioBufferProbeId); @@ -6462,13 +6377,13 @@ index a2bd80d..af5b339 100644 - - m_audioBufferProbeId = -1; } - + void QGstreamerCaptureSession::addAudioBufferProbe() { - Q_ASSERT(m_audioBufferProbeId == -1); + if (!m_audioProbe) + return; - + GstPad *pad = getAudioProbePad(); if (pad) { - m_audioBufferProbeId = gst_pad_add_buffer_probe(pad, G_CALLBACK(padAudioBufferProbe), this); @@ -6477,26 +6392,26 @@ index a2bd80d..af5b339 100644 + gst_object_unref(GST_OBJECT(pad)); } } - + diff --git a/src/plugins/gstreamer/mediacapture/qgstreamercapturesession.h b/src/plugins/gstreamer/mediacapture/qgstreamercapturesession.h index a759f22..ad26327 100644 --- a/src/plugins/gstreamer/mediacapture/qgstreamercapturesession.h +++ b/src/plugins/gstreamer/mediacapture/qgstreamercapturesession.h @@ -41,8 +41,10 @@ #include - + #include +#include - + #include +#include - + QT_BEGIN_NAMESPACE - + @@ -70,7 +72,10 @@ public: virtual QList supportedResolutions(qreal frameRate = -1) const = 0; }; - + -class QGstreamerCaptureSession : public QObject, public QGstreamerBusMessageFilter +class QGstreamerCaptureSession + : public QObject @@ -6506,38 +6421,38 @@ index a759f22..ad26327 100644 Q_OBJECT Q_PROPERTY(qint64 duration READ duration NOTIFY durationChanged) @@ -131,7 +136,6 @@ public: - + void addProbe(QGstreamerAudioProbeControl* probe); void removeProbe(QGstreamerAudioProbeControl* probe); - static gboolean padAudioBufferProbe(GstPad *pad, GstBuffer *buffer, gpointer user_data); - + signals: void stateChanged(QGstreamerCaptureSession::State state); @@ -156,6 +160,9 @@ public slots: void setVolume(qreal volume); - + private: + void probeCaps(GstCaps *caps); + bool probeBuffer(GstBuffer *buffer); + enum PipelineMode { EmptyPipeline, PreviewPipeline, RecordingPipeline, PreviewAndRecordingPipeline }; - + GstElement *buildEncodeBin(); @@ -180,9 +187,7 @@ private: QGstreamerCaptureSession::CaptureMode m_captureMode; QMap m_metaData; - + - QList m_audioProbes; - QMutex m_audioProbeMutex; - int m_audioBufferProbeId; + QGstreamerAudioProbeControl *m_audioProbe; - + QGstreamerElementFactory *m_audioInputFactory; QGstreamerElementFactory *m_audioPreviewFactory; @@ -217,6 +222,10 @@ private: - + GstElement *m_encodeBin; - + +#if GST_CHECK_VERSION(1,0,0) + GstVideoInfo m_previewInfo; +#endif @@ -6556,20 +6471,20 @@ index 2f0d0ee..81b85d7 100644 - +#include #include - + #include @@ -147,7 +147,7 @@ GstElement *QGstreamerVideoEncode::createEncoder() GstElement *capsFilter = gst_element_factory_make("capsfilter", "capsfilter-video"); gst_bin_add(encoderBin, capsFilter); - + - GstElement *colorspace = gst_element_factory_make("ffmpegcolorspace", NULL); + GstElement *colorspace = gst_element_factory_make(QT_GSTREAMER_COLORCONVERSION_ELEMENT_NAME, NULL); gst_bin_add(encoderBin, colorspace); gst_bin_add(encoderBin, encoderElement); - + @@ -252,27 +252,22 @@ GstElement *QGstreamerVideoEncode::createEncoder() } - + if (!m_videoSettings.resolution().isEmpty() || m_videoSettings.frameRate() > 0.001) { - GstCaps *caps = gst_caps_new_empty(); - QStringList structureTypes; @@ -6599,7 +6514,7 @@ index 2f0d0ee..81b85d7 100644 + "height", G_TYPE_INT, m_videoSettings.resolution().height(), + NULL); + } - + - gst_caps_append_structure(caps,structure); + if (m_videoSettings.frameRate() > 0.001) { + QPair rate = rateAsRational(); @@ -6608,14 +6523,14 @@ index 2f0d0ee..81b85d7 100644 + "framerate", GST_TYPE_FRACTION, rate.first, rate.second, + NULL); } - + //qDebug() << "set video caps filter:" << gst_caps_to_string(caps); diff --git a/src/plugins/gstreamer/mediaplayer/mediaplayer.pro b/src/plugins/gstreamer/mediaplayer/mediaplayer.pro index 2ca9377..b986fc7 100644 --- a/src/plugins/gstreamer/mediaplayer/mediaplayer.pro +++ b/src/plugins/gstreamer/mediaplayer/mediaplayer.pro @@ -28,4 +28,3 @@ SOURCES += \ - + OTHER_FILES += \ mediaplayer.json - @@ -6626,7 +6541,7 @@ index fed756a..c1fb64a 100644 @@ -425,7 +425,6 @@ void QGstreamerPlayerControl::setMedia(const QMediaContent &content, QIODevice * m_session->loadFromUri(request); #endif - + - #if defined(HAVE_GST_APPSRC) if (!request.url().isEmpty() || userStreamValid) { @@ -6637,7 +6552,7 @@ index ce267d7..84805b6 100644 +++ b/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.cpp @@ -51,7 +51,11 @@ #include - + #if defined(Q_WS_MAEMO_6) && defined(__arm__) -#include "qgstreamergltexturerenderer.h" +#include "private/qgstreamergltexturerenderer.h" @@ -6646,10 +6561,10 @@ index ce267d7..84805b6 100644 +#if defined(HAVE_MIR) && defined (__arm__) +#include "private/qgstreamermirtexturerenderer_p.h" #endif - + #include "qgstreamerstreamscontrol.h" @@ -66,6 +70,8 @@ QT_BEGIN_NAMESPACE - + QGstreamerPlayerService::QGstreamerPlayerService(QObject *parent): QMediaService(parent) + , m_audioProbeControl(0) @@ -6658,7 +6573,7 @@ index ce267d7..84805b6 100644 , m_videoRenderer(0) , m_videoWindow(0) @@ -82,6 +88,8 @@ QGstreamerPlayerService::QGstreamerPlayerService(QObject *parent): - + #if defined(Q_WS_MAEMO_6) && defined(__arm__) m_videoRenderer = new QGstreamerGLTextureRenderer(this); +#elif defined(HAVE_MIR) && defined (__arm__) @@ -6669,7 +6584,7 @@ index ce267d7..84805b6 100644 @@ -115,23 +123,23 @@ QMediaControl *QGstreamerPlayerService::requestControl(const char *name) if (qstrcmp(name, QMediaAvailabilityControl_iid) == 0) return m_availabilityControl; - + - if (qstrcmp(name,QMediaVideoProbeControl_iid) == 0) { - if (m_session) { - QGstreamerVideoProbeControl *probe = new QGstreamerVideoProbeControl(this); @@ -6685,7 +6600,7 @@ index ce267d7..84805b6 100644 + m_videoProbeControl->ref.ref(); + return m_videoProbeControl; } - + - if (qstrcmp(name,QMediaAudioProbeControl_iid) == 0) { - if (m_session) { - QGstreamerAudioProbeControl *probe = new QGstreamerAudioProbeControl(this); @@ -6700,10 +6615,10 @@ index ce267d7..84805b6 100644 + m_audioProbeControl->ref.ref(); + return m_audioProbeControl; } - + if (!m_videoOutput) { @@ -156,28 +164,21 @@ QMediaControl *QGstreamerPlayerService::requestControl(const char *name) - + void QGstreamerPlayerService::releaseControl(QMediaControl *control) { - if (control == m_videoOutput) { @@ -6742,7 +6657,7 @@ index ce267d7..84805b6 100644 + m_audioProbeControl = 0; } } - + diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.h b/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.h index f3081e9..22be262 100644 --- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.h @@ -6753,13 +6668,13 @@ index f3081e9..22be262 100644 class QGStreamerAvailabilityControl; +class QGstreamerAudioProbeControl; +class QGstreamerVideoProbeControl; - + class QGstreamerPlayerService : public QMediaService { @@ -70,6 +72,9 @@ private: QGstreamerStreamsControl *m_streamsControl; QGStreamerAvailabilityControl *m_availabilityControl; - + + QGstreamerAudioProbeControl *m_audioProbeControl; + QGstreamerVideoProbeControl *m_videoProbeControl; + @@ -6773,7 +6688,7 @@ index 7d20b6d..f1fd421 100644 @@ -81,89 +81,15 @@ QMultimedia::SupportEstimate QGstreamerPlayerServicePlugin::hasSupport(const QSt return QGstUtils::hasSupport(mimeType, codecs, m_supportedMimeTypeSet); } - + -void QGstreamerPlayerServicePlugin::updateSupportedMimeTypes() const +static bool isDecoderOrDemuxer(GstElementFactory *factory) { @@ -6852,7 +6767,7 @@ index 7d20b6d..f1fd421 100644 + return gst_element_factory_list_is_type(factory, GST_ELEMENT_FACTORY_TYPE_DEMUXER) + || gst_element_factory_list_is_type(factory, GST_ELEMENT_FACTORY_TYPE_DECODER); +} - + -#if defined QT_SUPPORTEDMIMETYPES_DEBUG - QStringList list = m_supportedMimeTypeSet.toList(); - list.sort(); @@ -6865,7 +6780,7 @@ index 7d20b6d..f1fd421 100644 +{ + m_supportedMimeTypeSet = QGstUtils::supportedMimeTypes(isDecoderOrDemuxer); } - + QStringList QGstreamerPlayerServicePlugin::supportedMimeTypes() const diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp b/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp index 15924a6..b5c354d 100644 @@ -6884,7 +6799,7 @@ index 15924a6..b5c354d 100644 @@ -85,6 +87,7 @@ typedef enum { GST_PLAY_FLAG_BUFFERING = 0x000000100 } GstPlayFlags; - + +#if !GST_CHECK_VERSION(1,0,0) #define DEFAULT_RAW_CAPS \ "video/x-raw-yuv; " \ @@ -6896,7 +6811,7 @@ index 15924a6..b5c354d 100644 + static GstStaticCaps static_RawCaps = GST_STATIC_CAPS(DEFAULT_RAW_CAPS); +#endif - + QGstreamerPlayerSession::QGstreamerPlayerSession(QObject *parent) :QObject(parent), @@ -105,7 +110,9 @@ QGstreamerPlayerSession::QGstreamerPlayerSession(QObject *parent) @@ -6923,7 +6838,7 @@ index 15924a6..b5c354d 100644 @@ -138,8 +145,7 @@ QGstreamerPlayerSession::QGstreamerPlayerSession(QObject *parent) Q_ASSERT(result == TRUE); Q_UNUSED(result); - + - m_playbin = gst_element_factory_make("playbin2", NULL); - + m_playbin = gst_element_factory_make(QT_GSTREAMER_PLAYBIN_ELEMENT_NAME, NULL); @@ -6950,29 +6865,29 @@ index 15924a6..b5c354d 100644 @@ -185,12 +192,16 @@ QGstreamerPlayerSession::QGstreamerPlayerSession(QObject *parent) } } - + +#if GST_CHECK_VERSION(1,0,0) + m_videoIdentity = gst_element_factory_make("identity", NULL); // floating ref +#else m_videoIdentity = GST_ELEMENT(g_object_new(gst_video_connector_get_type(), 0)); // floating ref g_signal_connect(G_OBJECT(m_videoIdentity), "connection-failed", G_CALLBACK(insertColorSpaceElement), (gpointer)this); + m_colorSpace = gst_element_factory_make(QT_GSTREAMER_COLORCONVERSION_ELEMENT_NAME, "ffmpegcolorspace-vo"); - + - m_colorSpace = gst_element_factory_make("ffmpegcolorspace", "ffmpegcolorspace-vo"); // might not get a parent, take ownership to avoid leak qt_gst_object_ref_sink(GST_OBJECT(m_colorSpace)); +#endif - + m_nullVideoSink = gst_element_factory_make("fakesink", NULL); g_object_set(G_OBJECT(m_nullVideoSink), "sync", true, NULL); @@ -206,7 +217,7 @@ QGstreamerPlayerSession::QGstreamerPlayerSession(QObject *parent) - + // add ghostpads GstPad *pad = gst_element_get_static_pad(m_videoIdentity,"sink"); - gst_element_add_pad(GST_ELEMENT(m_videoOutputBin), gst_ghost_pad_new("videosink", pad)); + gst_element_add_pad(GST_ELEMENT(m_videoOutputBin), gst_ghost_pad_new("sink", pad)); gst_object_unref(GST_OBJECT(pad)); - + if (m_playbin != 0) { @@ -244,7 +255,9 @@ QGstreamerPlayerSession::~QGstreamerPlayerSession() delete m_busHelper; @@ -6985,23 +6900,23 @@ index 15924a6..b5c354d 100644 gst_object_unref(GST_OBJECT(m_videoOutputBin)); } @@ -339,12 +352,10 @@ qint64 QGstreamerPlayerSession::duration() const - + qint64 QGstreamerPlayerSession::position() const { - GstFormat format = GST_FORMAT_TIME; gint64 position = 0; - + - if ( m_playbin && gst_element_query_position(m_playbin, &format, &position)) + if (m_playbin && qt_gst_element_query_position(m_playbin, GST_FORMAT_TIME, &position)) m_lastPosition = position / 1000000; - return m_lastPosition; } - + @@ -474,17 +485,26 @@ bool QGstreamerPlayerSession::isAudioAvailable() const return m_audioAvailable; } - + +#if GST_CHECK_VERSION(1,0,0) +static GstPadProbeReturn block_pad_cb(GstPad *pad, GstPadProbeInfo *info, gpointer user_data) +#else @@ -7024,11 +6939,11 @@ index 15924a6..b5c354d 100644 } +#endif } - + void QGstreamerPlayerSession::updateVideoRenderer() @@ -529,7 +549,7 @@ void QGstreamerPlayerSession::setVideoRenderer(QObject *videoOutput) m_renderer = renderer; - + #ifdef DEBUG_VO_BIN_DUMP - _gst_debug_bin_to_dot_file_with_ts(GST_BIN(m_playbin), + gst_debug_bin_to_dot_file_with_ts(GST_BIN(m_playbin), @@ -7038,7 +6953,7 @@ index 15924a6..b5c354d 100644 @@ -570,12 +590,14 @@ void QGstreamerPlayerSession::setVideoRenderer(QObject *videoOutput) gst_element_set_state(m_videoSink, GST_STATE_NULL); gst_element_set_state(m_playbin, GST_STATE_NULL); - + +#if !GST_CHECK_VERSION(1,0,0) if (m_usingColorspaceElement) { gst_element_unlink(m_colorSpace, m_videoSink); @@ -7047,13 +6962,13 @@ index 15924a6..b5c354d 100644 gst_element_unlink(m_videoIdentity, m_videoSink); } +#endif - + removeVideoBufferProbe(); - + @@ -585,8 +607,9 @@ void QGstreamerPlayerSession::setVideoRenderer(QObject *videoOutput) - + gst_bin_add(GST_BIN(m_videoOutputBin), m_videoSink); - + - m_usingColorspaceElement = false; bool linked = gst_element_link(m_videoIdentity, m_videoSink); +#if !GST_CHECK_VERSION(1,0,0) @@ -7069,11 +6984,11 @@ index 15924a6..b5c354d 100644 + + if (!linked) + qWarning() << "Linking video output element failed"; - + if (g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "show-preroll-frame") != 0) { gboolean value = m_displayPrerolledFrame; @@ -633,7 +660,11 @@ void QGstreamerPlayerSession::setVideoRenderer(QObject *videoOutput) - + //block pads, async to avoid locking in paused state GstPad *srcPad = gst_element_get_static_pad(m_videoIdentity, "src"); +#if GST_CHECK_VERSION(1,0,0) @@ -7082,11 +6997,11 @@ index 15924a6..b5c354d 100644 gst_pad_set_blocked_async(srcPad, true, &block_pad_cb, this); +#endif gst_object_unref(GST_OBJECT(srcPad)); - + //Unpause the sink to avoid waiting until the buffer is processed @@ -671,16 +702,22 @@ void QGstreamerPlayerSession::finishVideoOutputChange() } - + if (m_pendingVideoSink == m_videoSink) { + qDebug() << "Abort, no change"; //video output was change back to the current one, @@ -7097,12 +7012,12 @@ index 15924a6..b5c354d 100644 +#else gst_pad_set_blocked_async(srcPad, false, &block_pad_cb, 0); +#endif - + m_pendingVideoSink = 0; gst_object_unref(GST_OBJECT(srcPad)); return; } - + +#if !GST_CHECK_VERSION(1,0,0) if (m_usingColorspaceElement) { gst_element_set_state(m_colorSpace, GST_STATE_NULL); @@ -7118,9 +7033,9 @@ index 15924a6..b5c354d 100644 gst_element_unlink(m_videoIdentity, m_videoSink); } @@ -703,8 +743,9 @@ void QGstreamerPlayerSession::finishVideoOutputChange() - + addVideoBufferProbe(); - + - m_usingColorspaceElement = false; bool linked = gst_element_link(m_videoIdentity, m_videoSink); +#if !GST_CHECK_VERSION(1,0,0) @@ -7133,7 +7048,7 @@ index 15924a6..b5c354d 100644 linked = gst_element_link_many(m_videoIdentity, m_colorSpace, m_videoSink, NULL); } +#endif - + if (!linked) qWarning() << "Linking video output element failed"; @@ -720,6 +762,8 @@ void QGstreamerPlayerSession::finishVideoOutputChange() @@ -7151,22 +7066,22 @@ index 15924a6..b5c354d 100644 ); - +#endif - + GstState state = GST_STATE_VOID_PENDING; - + @@ -743,8 +787,10 @@ void QGstreamerPlayerSession::finishVideoOutputChange() break; } - + +#if !GST_CHECK_VERSION(1,0,0) if (m_usingColorspaceElement) gst_element_set_state(m_colorSpace, state); +#endif - + gst_element_set_state(m_videoSink, state); - + @@ -760,16 +806,23 @@ void QGstreamerPlayerSession::finishVideoOutputChange() - + //don't have to wait here, it will unblock eventually if (gst_pad_is_blocked(srcPad)) - gst_pad_set_blocked_async(srcPad, false, &block_pad_cb, 0); @@ -7177,7 +7092,7 @@ index 15924a6..b5c354d 100644 +#endif + gst_object_unref(GST_OBJECT(srcPad)); - + #ifdef DEBUG_VO_BIN_DUMP - _gst_debug_bin_to_dot_file_with_ts(GST_BIN(m_playbin), - GstDebugGraphDetails(GST_DEBUG_GRAPH_SHOW_ALL /* GST_DEBUG_GRAPH_SHOW_MEDIA_TYPE | GST_DEBUG_GRAPH_SHOW_NON_DEFAULT_PARAMS | GST_DEBUG_GRAPH_SHOW_STATES*/), @@ -7186,7 +7101,7 @@ index 15924a6..b5c354d 100644 "playbin_finish"); #endif } - + +#if !GST_CHECK_VERSION(1,0,0) + void QGstreamerPlayerSession::insertColorSpaceElement(GstElement *element, gpointer data) @@ -7195,9 +7110,9 @@ index 15924a6..b5c354d 100644 @@ -814,6 +867,7 @@ void QGstreamerPlayerSession::insertColorSpaceElement(GstElement *element, gpoin gst_element_set_state(session->m_colorSpace, state); } - + +#endif - + bool QGstreamerPlayerSession::isVideoAvailable() const { @@ -830,6 +884,7 @@ bool QGstreamerPlayerSession::play() @@ -7254,39 +7169,39 @@ index 15924a6..b5c354d 100644 GstPad *pad = gst_element_get_static_pad(m_videoIdentity, "src"); - GstCaps *caps = gst_pad_get_negotiated_caps(pad); + GstCaps *caps = qt_gst_pad_get_current_caps(pad); - + if (caps) { const GstStructure *structure = gst_caps_get_structure(caps, 0); @@ -1407,11 +1463,10 @@ void QGstreamerPlayerSession::updateVideoResolutionTag() - + void QGstreamerPlayerSession::updateDuration() { - GstFormat format = GST_FORMAT_TIME; gint64 gstDuration = 0; int duration = -1; - + - if (m_playbin && gst_element_query_duration(m_playbin, &format, &gstDuration)) + if (m_playbin && qt_gst_element_query_duration(m_playbin, GST_FORMAT_TIME, &gstDuration)) duration = gstDuration / 1000000; - + if (m_duration != duration) { @@ -1467,7 +1522,7 @@ void QGstreamerPlayerSession::playbinNotifySource(GObject *o, GParamSpec *p, gpo - + // The rest if (g_object_class_find_property(G_OBJECT_GET_CLASS(source), "extra-headers") != 0) { - GstStructure *extras = gst_structure_empty_new("extras"); + GstStructure *extras = qt_gst_structure_new_empty("extras"); - + foreach (const QByteArray &rawHeader, self->m_request.rawHeaderList()) { if (rawHeader == userAgentString) // Filter User-Agent @@ -1528,7 +1583,8 @@ void QGstreamerPlayerSession::playbinNotifySource(GObject *o, GParamSpec *p, gpo qDebug() << "Current source is a non-live source"; #endif - + - g_object_set(G_OBJECT(self->m_videoSink), "sync", !self->m_isLiveSource, NULL); + if (self->m_videoSink) + g_object_set(G_OBJECT(self->m_videoSink), "sync", !self->m_isLiveSource, NULL); - + gst_object_unref(source); } @@ -1623,7 +1679,11 @@ GstAutoplugSelectResult QGstreamerPlayerSession::handleAutoplugSelect(GstBin *bi @@ -7298,7 +7213,7 @@ index 15924a6..b5c354d 100644 +#else GstCaps *sinkCaps = gst_pad_get_caps(sinkPad); +#endif - + #if (GST_VERSION_MAJOR == 0) && ((GST_VERSION_MINOR < 10) || (GST_VERSION_MICRO < 33)) if (!factory_can_src_any_caps(factory, sinkCaps)) @@ -1652,8 +1712,10 @@ void QGstreamerPlayerSession::handleElementAdded(GstBin *bin, GstElement *elemen @@ -7324,7 +7239,7 @@ index 15924a6..b5c354d 100644 //Don't touch other bins since they may have unrelated queues g_signal_connect(element, "element-added", @@ -1711,68 +1773,30 @@ void QGstreamerPlayerSession::showPrerollFrames(bool enabled) - + void QGstreamerPlayerSession::addProbe(QGstreamerVideoProbeControl* probe) { - QMutexLocker locker(&m_videoProbeMutex); @@ -7337,7 +7252,7 @@ index 15924a6..b5c354d 100644 + m_videoProbe = probe; + addVideoBufferProbe(); } - + void QGstreamerPlayerSession::removeProbe(QGstreamerVideoProbeControl* probe) { - QMutexLocker locker(&m_videoProbeMutex); @@ -7364,7 +7279,7 @@ index 15924a6..b5c354d 100644 + removeVideoBufferProbe(); + m_videoProbe = 0; } - + void QGstreamerPlayerSession::addProbe(QGstreamerAudioProbeControl* probe) { - QMutexLocker locker(&m_audioProbeMutex); @@ -7377,7 +7292,7 @@ index 15924a6..b5c354d 100644 + m_audioProbe = probe; + addAudioBufferProbe(); } - + void QGstreamerPlayerSession::removeProbe(QGstreamerAudioProbeControl* probe) { - QMutexLocker locker(&m_audioProbeMutex); @@ -7402,16 +7317,16 @@ index 15924a6..b5c354d 100644 + removeAudioBufferProbe(); + m_audioProbe = 0; } - + // This function is similar to stop(), @@ -1797,80 +1821,62 @@ void QGstreamerPlayerSession::endOfMediaReset() - + void QGstreamerPlayerSession::removeVideoBufferProbe() { - if (m_videoBufferProbeId == -1) + if (!m_videoProbe) return; - + - if (!m_videoSink) { - m_videoBufferProbeId = -1; - return; @@ -7426,14 +7341,14 @@ index 15924a6..b5c354d 100644 - - m_videoBufferProbeId = -1; } - + void QGstreamerPlayerSession::addVideoBufferProbe() { - Q_ASSERT(m_videoBufferProbeId == -1); - if (!m_videoSink) + if (!m_videoProbe) return; - + GstPad *pad = gst_element_get_static_pad(m_videoSink, "sink"); if (pad) { - m_videoBufferProbeId = gst_pad_add_buffer_probe(pad, G_CALLBACK(padVideoBufferProbe), this); @@ -7441,7 +7356,7 @@ index 15924a6..b5c354d 100644 gst_object_unref(GST_OBJECT(pad)); } } - + void QGstreamerPlayerSession::removeAudioBufferProbe() { - if (m_audioBufferProbeId == -1) @@ -7452,7 +7367,7 @@ index 15924a6..b5c354d 100644 + if (!m_audioProbe) return; - } - + GstPad *pad = gst_element_get_static_pad(m_audioSink, "sink"); if (pad) { - gst_pad_remove_buffer_probe(pad, m_audioBufferProbeId); @@ -7462,14 +7377,14 @@ index 15924a6..b5c354d 100644 - - m_audioBufferProbeId = -1; } - + void QGstreamerPlayerSession::addAudioBufferProbe() { - Q_ASSERT(m_audioBufferProbeId == -1); - if (!m_audioSink) + if (!m_audioProbe) return; - + GstPad *pad = gst_element_get_static_pad(m_audioSink, "sink"); if (pad) { - m_audioBufferProbeId = gst_pad_add_buffer_probe(pad, G_CALLBACK(padAudioBufferProbe), this); @@ -7477,7 +7392,7 @@ index 15924a6..b5c354d 100644 gst_object_unref(GST_OBJECT(pad)); } } - + void QGstreamerPlayerSession::flushVideoProbes() { - QMutexLocker locker(&m_videoProbeMutex); @@ -7486,7 +7401,7 @@ index 15924a6..b5c354d 100644 + if (m_videoProbe) + m_videoProbe->startFlushing(); } - + void QGstreamerPlayerSession::resumeVideoProbes() { - QMutexLocker locker(&m_videoProbeMutex); @@ -7495,23 +7410,23 @@ index 15924a6..b5c354d 100644 + if (m_videoProbe) + m_videoProbe->stopFlushing(); } - + void QGstreamerPlayerSession::playlistTypeFindFunction(GstTypeFind *find, gpointer userData) @@ -1878,7 +1884,11 @@ void QGstreamerPlayerSession::playlistTypeFindFunction(GstTypeFind *find, gpoint QGstreamerPlayerSession* session = (QGstreamerPlayerSession*)userData; - + const gchar *uri = 0; +#if GST_CHECK_VERSION(1,0,0) + g_object_get(G_OBJECT(session->m_playbin), "current-uri", &uri, NULL); +#else g_object_get(G_OBJECT(session->m_playbin), "uri", &uri, NULL); +#endif - + guint64 length = gst_type_find_get_length(find); if (!length) @@ -1887,7 +1897,7 @@ void QGstreamerPlayerSession::playlistTypeFindFunction(GstTypeFind *find, gpoint length = qMin(length, guint64(1024)); - + while (length > 0) { - guint8 *data = gst_type_find_peek(find, 0, length); + const guint8 *data = gst_type_find_peek(find, 0, length); @@ -7523,17 +7438,17 @@ index f2e760a..92b4a0c 100644 --- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.h +++ b/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.h @@ -119,11 +119,9 @@ public: - + void addProbe(QGstreamerVideoProbeControl* probe); void removeProbe(QGstreamerVideoProbeControl* probe); - static gboolean padVideoBufferProbe(GstPad *pad, GstBuffer *buffer, gpointer user_data); - + void addProbe(QGstreamerAudioProbeControl* probe); void removeProbe(QGstreamerAudioProbeControl* probe); - static gboolean padAudioBufferProbe(GstPad *pad, GstBuffer *buffer, gpointer user_data); - + void endOfMediaReset(); - + @@ -172,7 +170,9 @@ private: static void playbinNotifySource(GObject *o, GParamSpec *p, gpointer d); static void handleVolumeChange(GObject *o, GParamSpec *p, gpointer d); @@ -7547,7 +7462,7 @@ index f2e760a..92b4a0c 100644 @@ -194,11 +194,14 @@ private: QGstreamerBusHelper* m_busHelper; GstElement* m_playbin; - + + GstElement* m_videoSink; + GstElement* m_videoOutputBin; @@ -7559,11 +7474,11 @@ index f2e760a..92b4a0c 100644 +#endif GstElement* m_pendingVideoSink; GstElement* m_nullVideoSink; - + @@ -218,13 +221,8 @@ private: QList m_streamTypes; QMap m_playbin2StreamOffset; - + - QList m_videoProbes; - QMutex m_videoProbeMutex; - int m_videoBufferProbeId; @@ -7573,16 +7488,16 @@ index f2e760a..92b4a0c 100644 - int m_audioBufferProbeId; + QGstreamerVideoProbeControl *m_videoProbe; + QGstreamerAudioProbeControl *m_audioProbe; - + int m_volume; qreal m_playbackRate; @@ -252,6 +250,7 @@ private: bool m_isLiveSource; - + bool m_isPlaylist; + gulong pad_probe_id; }; - + QT_END_NAMESPACE diff --git a/tests/auto/integration/qcamerabackend/tst_qcamerabackend.cpp b/tests/auto/integration/qcamerabackend/tst_qcamerabackend.cpp index 344f1f5..2711ae0 100644 @@ -7591,7 +7506,7 @@ index 344f1f5..2711ae0 100644 @@ -495,6 +495,8 @@ void tst_QCameraBackend::testCaptureToBuffer() QCOMPARE(imageCapture.bufferFormat(), QVideoFrame::Format_Jpeg); } - + + QTRY_VERIFY(imageCapture.isReadyForCapture()); + //Try to capture to both buffer and file @@ -7600,18 +7515,18 @@ index 344f1f5..2711ae0 100644 @@ -651,11 +653,11 @@ void tst_QCameraBackend::testVideoRecording() { QFETCH(QByteArray, device); - + - QCamera *camera = device.isEmpty() ? new QCamera : new QCamera(device); + QScopedPointer camera(device.isEmpty() ? new QCamera : new QCamera(device)); - + - QMediaRecorder recorder(camera); + QMediaRecorder recorder(camera.data()); - + - QSignalSpy errorSignal(camera, SIGNAL(error(QCamera::Error))); + QSignalSpy errorSignal(camera.data(), SIGNAL(error(QCamera::Error))); QSignalSpy recorderErrorSignal(&recorder, SIGNAL(error(QMediaRecorder::Error))); QSignalSpy recorderStatusSignal(&recorder, SIGNAL(statusChanged(QMediaRecorder::Status))); - + @@ -702,8 +704,6 @@ void tst_QCameraBackend::testVideoRecording() camera->setCaptureMode(QCamera::CaptureStillImage); QTRY_COMPARE(recorder.status(), QMediaRecorder::UnloadedStatus); @@ -7619,14 +7534,14 @@ index 344f1f5..2711ae0 100644 - - delete camera; } - + QTEST_MAIN(tst_QCameraBackend) diff --git a/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp b/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp index 0a1441c..ddf438b 100644 --- a/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp +++ b/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp @@ -724,7 +724,7 @@ void tst_QMediaPlayerBackend::seekPauseSeek() - + { QVideoFrame frame = surface->m_frameList.back(); - const qint64 elapsed = frame.startTime() - position; @@ -7635,7 +7550,7 @@ index 0a1441c..ddf438b 100644 QCOMPARE(frame.width(), 160); QCOMPARE(frame.height(), 120); @@ -748,7 +748,7 @@ void tst_QMediaPlayerBackend::seekPauseSeek() - + { QVideoFrame frame = surface->m_frameList.back(); - const qint64 elapsed = frame.startTime() - position; @@ -7643,6 +7558,3 @@ index 0a1441c..ddf438b 100644 QVERIFY2(qAbs(elapsed) < (qint64)500, QByteArray::number(elapsed).constData()); QCOMPARE(frame.width(), 160); QCOMPARE(frame.height(), 120); --- -1.9.3 - diff --git a/qt5-qtmultimedia.spec b/qt5-qtmultimedia.spec index 86f3989..cdf01ed 100644 --- a/qt5-qtmultimedia.spec +++ b/qt5-qtmultimedia.spec @@ -19,7 +19,7 @@ Summary: Qt5 - Multimedia support Name: qt5-%{qt_module} -Version: 5.4.0 +Version: 5.4.1 Release: 1%{?dist} # See LGPL_EXCEPTIONS.txt, LICENSE.GPL3, respectively, for exception details @@ -199,6 +199,9 @@ popd %changelog +* Tue Feb 24 2015 Jan Grulich 5.4.1-1 +- 5.4.1 + * Thu Dec 11 2014 Rex Dieter 5.4.0-1 - 5.4.0 (final) + backported gst1 support from dev/ branch diff --git a/sources b/sources index 69c5717..707518a 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -3a6a415813b54a54cf283a5e2906e012 qtmultimedia-opensource-src-5.4.0.tar.xz +7412a5c62da71b44b9f29e29fdc6af4d qtmultimedia-opensource-src-5.4.1.tar.xz