rdieter pushed to qt5-qtmultimedia (el6). "Update to 5.4.2"

notifications at fedoraproject.org notifications at fedoraproject.org
Tue Jun 9 14:06:39 UTC 2015


From c4411d132521e377bd02d09eecdf979ac9aade1b Mon Sep 17 00:00:00 2001
From: Jan Grulich <jgrulich at redhat.com>
Date: Wed, 3 Jun 2015 14:54:38 +0200
Subject: Update to 5.4.2


diff --git a/.gitignore b/.gitignore
index 79f4751..bb3a7e1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
 /qtmultimedia-opensource-src-5.3.2.tar.xz
 /qtmultimedia-opensource-src-5.4.0.tar.xz
 /qtmultimedia-opensource-src-5.4.1.tar.xz
+/qtmultimedia-opensource-src-5.4.2.tar.xz
diff --git a/0006-GStreamer-port-to-1.0.patch b/0006-GStreamer-port-to-1.0.patch
index 606d947..749ab6f 100644
--- a/0006-GStreamer-port-to-1.0.patch
+++ b/0006-GStreamer-port-to-1.0.patch
@@ -4,7 +4,7 @@ index 02a7e34..6b9843a 100644
 +++ b/config.tests/gstreamer/gstreamer.pro
 @@ -3,11 +3,10 @@ SOURCES += main.cpp
  CONFIG += link_pkgconfig
-
+ 
  PKGCONFIG += \
 -    gstreamer-0.10 \
 -    gstreamer-base-0.10 \
@@ -17,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 \
@@ -45,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 \
@@ -55,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 \
@@ -68,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 \
@@ -85,33 +85,34 @@ 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
+index cf97e64..48a71ce 100644
 --- a/qtmultimedia.pro
 +++ b/qtmultimedia.pro
-@@ -17,11 +17,27 @@ win32 {
+@@ -17,12 +17,27 @@ win32 {
  } else {
-     qtCompileTest(alsa)
-     qtCompileTest(pulseaudio)
+     contains(QT_CONFIG, alsa):qtCompileTest(alsa)
+     contains(QT_CONFIG, pulseaudio):qtCompileTest(pulseaudio)
 -    qtCompileTest(gstreamer) {
 -        qtCompileTest(gstreamer_photography)
 -        qtCompileTest(gstreamer_encodingprofiles)
 -        qtCompileTest(gstreamer_appsrc)
 -        qtCompileTest(linux_v4l)
+-    }
 +    !done_config_gstreamer {
 +        gstver=0.10
 +        !isEmpty(GST_VERSION): gstver=$$GST_VERSION
@@ -133,25 +134,25 @@ index 3cec526..84f2548 100644
 +                qtCompileTest(linux_v4l)
 +            }
 +        }
-     }
      qtCompileTest(resourcepolicy)
      qtCompileTest(gpu_vivante)
+ }
 diff --git a/src/gsttools/gsttools.pro b/src/gsttools/gsttools.pro
 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 \
@@ -165,13 +166,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 {
@@ -180,7 +181,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 \
@@ -198,7 +199,7 @@ index 7c809a7..7c41f1a 100644
      qgstreamervideoprobecontrol_p.h \
      qgstreameraudioprobecontrol_p.h \
      qgstreamervideowindow_p.h
-
+ 
  SOURCES += \
 -    qgstbufferpoolinterface.cpp \
      qgstreamerbushelper.cpp \
@@ -219,7 +220,7 @@ index 7c809a7..7c41f1a 100644
 @@ -79,25 +80,54 @@ qtHaveModule(widgets) {
          qgstreamervideowidget.cpp
  }
-
+ 
 -maemo6 {
 -    PKGCONFIG_PRIVATE += qmsystem2
 +equals(GST_VERSION,"0.10") {
@@ -251,7 +252,7 @@ index 7c809a7..7c41f1a 100644
 +        qgstvideorendererplugin.cpp \
 +        qgstvideorenderersink.cpp
 +}
-
+ 
 +mir: {
      contains(QT_CONFIG, opengles2):qtHaveModule(widgets) {
 -        PRIVATE_HEADERS += qgstreamergltexturerenderer_p.h
@@ -265,19 +266,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
@@ -285,7 +286,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);
@@ -303,7 +304,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
@@ -338,26 +339,26 @@ index f584fbe..888722a 100644
 +++ b/src/gsttools/qgstcodecsinfo.cpp
 @@ -32,7 +32,7 @@
  ****************************************************************************/
-
+ 
  #include "qgstcodecsinfo_p.h"
 -
 +#include "qgstutils_p.h"
  #include <QtCore/qset.h>
-
+ 
  #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
@@ -376,12 +377,12 @@ index 3baca53..9670d0f 100644
  {
 -
  }
-
+ 
  QGstreamerAudioProbeControl::~QGstreamerAudioProbeControl()
  {
 -
  }
-
+ 
 -void QGstreamerAudioProbeControl::bufferProbed(GstBuffer* buffer)
 +void QGstreamerAudioProbeControl::probeCaps(GstCaps *caps)
  {
@@ -393,12 +394,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;
@@ -432,7 +433,7 @@ index 3baca53..9670d0f 100644
 +
 +    return true;
  }
-
+ 
  void QGstreamerAudioProbeControl::bufferProbed()
 @@ -73,6 +89,7 @@ void QGstreamerAudioProbeControl::bufferProbed()
          if (!m_pendingBuffer.isValid())
@@ -637,7 +638,7 @@ index 84eda46..eb1fc36 100644
 +#endif
      gst_object_ref(GST_OBJECT(bus));
  }
-
+ 
  QGstreamerBusHelper::~QGstreamerBusHelper()
  {
 +#if GST_CHECK_VERSION(1,0,0)
@@ -647,7 +648,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
@@ -1011,13 +1012,13 @@ index a78a9da..71a402d 100644
 +++ b/src/gsttools/qgstreamervideoprobecontrol.cpp
 @@ -32,7 +32,8 @@
  ****************************************************************************/
-
+ 
  #include "qgstreamervideoprobecontrol_p.h"
 -#include <private/qvideosurfacegstsink_p.h>
 +
 +#include "qgstutils_p.h"
  #include <private/qgstvideobuffer_p.h>
-
+ 
  QGstreamerVideoProbeControl::QGstreamerVideoProbeControl(QObject *parent)
 @@ -40,12 +41,10 @@ QGstreamerVideoProbeControl::QGstreamerVideoProbeControl(QObject *parent)
      , m_flushing(false)
@@ -1025,17 +1026,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)
  {
@@ -1048,7 +1049,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
@@ -1071,7 +1072,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(
@@ -1082,12 +1083,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;
@@ -1098,7 +1099,7 @@ index a78a9da..71a402d 100644
 +
 +    return true;
  }
-
+ 
  void QGstreamerVideoProbeControl::frameProbed()
 @@ -104,6 +119,7 @@ void QGstreamerVideoProbeControl::frameProbed()
          if (!m_pendingFrame.isValid())
@@ -1119,16 +1120,16 @@ index 2b66f76..804dce9 100644
 -
 -#include <QDebug>
 +#include <QtCore/qdebug.h>
-
+ 
  #include <gst/gst.h>
-
+ 
 diff --git a/src/gsttools/qgstreamervideowidget.cpp b/src/gsttools/qgstreamervideowidget.cpp
-index aa2e2a3..1ae57a0 100644
+index b26369a..72a5a12 100644
 --- a/src/gsttools/qgstreamervideowidget.cpp
 +++ b/src/gsttools/qgstreamervideowidget.cpp
 @@ -40,8 +40,13 @@
  #include <QtGui/qpainter.h>
-
+ 
  #include <gst/gst.h>
 +
 +#if !GST_CHECK_VERSION(1,0,0)
@@ -1137,22 +1138,13 @@ index aa2e2a3..1ae57a0 100644
 +#else
 +#include <gst/video/videooverlay.h>
 +#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
+ 
+@@ -161,9 +166,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")) {
@@ -1164,8 +1156,8 @@ index aa2e2a3..1ae57a0 100644
          setOverlay();
          QMetaObject::invokeMethod(this, "updateNativeVideoSize", Qt::QueuedConnection);
          return true;
-@@ -199,17 +206,24 @@ bool QGstreamerVideoWidgetControl::processBusMessage(const QGstreamerMessage &me
-
+@@ -191,17 +200,24 @@ bool QGstreamerVideoWidgetControl::processBusMessage(const QGstreamerMessage &me
+ 
  void QGstreamerVideoWidgetControl::setOverlay()
  {
 +#if !GST_CHECK_VERSION(1,0,0)
@@ -1178,7 +1170,7 @@ index aa2e2a3..1ae57a0 100644
 +    }
 +#endif
  }
-
+ 
  void QGstreamerVideoWidgetControl::updateNativeVideoSize()
  {
      if (m_videoSink) {
@@ -1189,10 +1181,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()
-
+@@ -217,8 +233,13 @@ void QGstreamerVideoWidgetControl::updateNativeVideoSize()
+ 
  void QGstreamerVideoWidgetControl::windowExposed()
  {
 +#if !GST_CHECK_VERSION(1,0,0)
@@ -1203,7 +1195,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
@@ -1211,7 +1203,7 @@ index a373dcc..8011349 100644
 +++ b/src/gsttools/qgstreamervideowindow.cpp
 @@ -37,36 +37,49 @@
  #include <QtCore/qdebug.h>
-
+ 
  #include <gst/gst.h>
 +
 +#if !GST_CHECK_VERSION(1,0,0)
@@ -1220,8 +1212,8 @@ index a373dcc..8011349 100644
 +#else
 +#include <gst/video/videooverlay.h>
 +#endif
-
-
+ 
+ 
  QGstreamerVideoWindow::QGstreamerVideoWindow(QObject *parent, const char *elementName)
      : QVideoWindowControl(parent)
 +    , QGstreamerBufferProbe(QGstreamerBufferProbe::ProbeCaps)
@@ -1238,10 +1230,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");
@@ -1251,7 +1243,7 @@ index a373dcc..8011349 100644
 +    else
 +        qDebug() << "No m_videoSink available!";
  }
-
+ 
  QGstreamerVideoWindow::~QGstreamerVideoWindow()
  {
 -    if (m_videoSink)
@@ -1262,11 +1254,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)
@@ -1281,7 +1273,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)
  {
@@ -1293,16 +1285,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));
@@ -1313,7 +1305,7 @@ index a373dcc..8011349 100644
 +#endif
      return false;
  }
-
+ 
 @@ -122,7 +145,19 @@ QRect QGstreamerVideoWindow::displayRect() const
  void QGstreamerVideoWindow::setDisplayRect(const QRect &rect)
  {
@@ -1341,10 +1333,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)
@@ -1366,12 +1358,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)
  {
@@ -1385,7 +1377,7 @@ index a373dcc..8011349 100644
 +                Qt::QueuedConnection,
 +                Q_ARG(QSize, resolution));
  }
-
+ 
 -void QGstreamerVideoWindow::updateNativeVideoSize()
 +void QGstreamerVideoWindow::updateNativeVideoSize(const QSize &size)
  {
@@ -1410,28 +1402,13 @@ index a373dcc..8011349 100644
          emit nativeSizeChanged();
 +    }
  }
-
+ 
  GstElement *QGstreamerVideoWindow::videoSink()
 diff --git a/src/gsttools/qgstutils.cpp b/src/gsttools/qgstutils.cpp
-index 1281d3f..86d9404 100644
+index 465f439..b1161f7 100644
 --- a/src/gsttools/qgstutils.cpp
 +++ b/src/gsttools/qgstutils.cpp
-@@ -40,7 +40,14 @@
- #include <QtCore/qsize.h>
- #include <QtCore/qset.h>
- #include <QtCore/qstringlist.h>
-+#include <QtGui/qimage.h>
- #include <qaudioformat.h>
-+#include <QtMultimedia/qvideosurfaceformat.h>
-+
-+#include <gst/audio/audio.h>
-+#include <gst/video/video.h>
-+
-+template<typename T, int N> static int lengthOf(const T (&)[N]) { return N; }
-
- #ifdef USE_V4L
- #  include <private/qcore_unix_p.h>
-@@ -82,15 +89,24 @@ static void addTagToMap(const GstTagList *list,
+@@ -83,15 +83,24 @@ static void addTagToMap(const GstTagList *list,
              map->insert(QByteArray(tag), g_value_get_boolean(&val));
              break;
          case G_TYPE_CHAR:
@@ -1456,10 +1433,10 @@ index 1281d3f..86d9404 100644
                  if (g_date_valid(date)) {
                      int year = g_date_get_year(date);
                      int month = g_date_get_month(date);
-@@ -169,6 +185,42 @@ QSize QGstUtils::capsCorrectedResolution(const GstCaps *caps)
+@@ -170,6 +179,42 @@ QSize QGstUtils::capsCorrectedResolution(const GstCaps *caps)
      return size;
  }
-
+ 
 +
 +#if GST_CHECK_VERSION(1,0,0)
 +namespace {
@@ -1499,8 +1476,8 @@ index 1281d3f..86d9404 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)
-
+@@ -177,9 +222,26 @@ QSize QGstUtils::capsCorrectedResolution(const GstCaps *caps)
+ 
  QAudioFormat QGstUtils::audioFormatForCaps(const GstCaps *caps)
  {
 -    const GstStructure *structure = gst_caps_get_structure(caps, 0);
@@ -1525,10 +1502,10 @@ index 1281d3f..86d9404 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)
+ 
+@@ -250,16 +312,28 @@ QAudioFormat QGstUtils::audioFormatForCaps(const GstCaps *caps)
      } else {
          return QAudioFormat();
      }
@@ -1536,7 +1513,7 @@ index 1281d3f..86d9404 100644
 +#endif
      return format;
  }
-
+ 
 +#if GST_CHECK_VERSION(1,0,0)
 +/*!
 +  Returns audio format for a sample.
@@ -1547,7 +1524,7 @@ index 1281d3f..86d9404 100644
 +    GstCaps* caps = gst_sample_get_caps(sample);
 +    if (!caps)
 +        return QAudioFormat();
-
+ 
 +    return QGstUtils::audioFormatForCaps(caps);
 +}
 +#else
@@ -1559,19 +1536,19 @@ index 1281d3f..86d9404 100644
  QAudioFormat QGstUtils::audioFormatForBuffer(GstBuffer *buffer)
  {
      GstCaps* caps = gst_buffer_get_caps(buffer);
-@@ -269,7 +350,7 @@ QAudioFormat QGstUtils::audioFormatForBuffer(GstBuffer *buffer)
+@@ -270,7 +344,7 @@ QAudioFormat QGstUtils::audioFormatForBuffer(GstBuffer *buffer)
      gst_caps_unref(caps);
      return format;
  }
 -
 +#endif
-
+ 
  /*!
    Builds GstCaps for an audio format.
-@@ -277,8 +358,32 @@ QAudioFormat QGstUtils::audioFormatForBuffer(GstBuffer *buffer)
+@@ -278,8 +352,32 @@ QAudioFormat QGstUtils::audioFormatForBuffer(GstBuffer *buffer)
    Caller must unref GstCaps.
  */
-
+ 
 -GstCaps *QGstUtils::capsForAudioFormat(QAudioFormat format)
 +GstCaps *QGstUtils::capsForAudioFormat(const QAudioFormat &format)
  {
@@ -1600,20 +1577,20 @@ index 1281d3f..86d9404 100644
 +    return 0;
 +#else
      GstStructure *structure = 0;
-
+ 
      if (format.isValid()) {
-@@ -313,6 +418,7 @@ GstCaps *QGstUtils::capsForAudioFormat(QAudioFormat format)
+@@ -314,6 +412,7 @@ GstCaps *QGstUtils::capsForAudioFormat(QAudioFormat format)
      }
-
+ 
      return caps;
 +#endif
  }
-
+ 
  void QGstUtils::initializeGst()
-@@ -578,10 +684,629 @@ QByteArray QGstUtils::cameraDriver(const QString &device, GstElementFactory *fac
+@@ -585,10 +684,629 @@ QByteArray QGstUtils::cameraDriver(const QString &device, GstElementFactory *fac
      return QByteArray();
  }
-
+ 
 +QSet<QString> QGstUtils::supportedMimeTypes(bool (*isValidFactory)(GstElementFactory *factory))
 +{
 +    QSet<QString> supportedMimeTypes;
@@ -2233,7 +2210,7 @@ index 1281d3f..86d9404 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)
@@ -2241,10 +2218,10 @@ index 1281d3f..86d9404 100644
      gst_object_ref_sink(object);
  #else
      g_return_if_fail (GST_IS_OBJECT(object));
-@@ -597,4 +1322,50 @@ void qt_gst_object_ref_sink(gpointer object)
+@@ -604,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)
@@ -2297,9 +2274,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)
@@ -2315,7 +2292,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,
@@ -2335,18 +2312,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])
@@ -2393,7 +2370,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;
      }
@@ -2413,7 +2390,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
@@ -3091,16 +3068,16 @@ index f3e2d88..147db66 100644
 @@ -41,8 +41,13 @@
  #include <private/qmediapluginloader_p.h>
  #include "qgstvideobuffer_p.h"
-
+ 
 +#include "qgstutils_p.h"
  #include "qvideosurfacegstsink_p.h"
-
+ 
 +#if GST_VERSION_MAJOR >=1
 +#include <gst/video/video.h>
 +#endif
 +
  //#define DEBUG_VIDEO_SURFACE_SINK
-
+ 
  QT_BEGIN_NAMESPACE
 @@ -62,10 +67,12 @@ QVideoSurfaceGstDelegate::QVideoSurfaceGstDelegate(
      if (m_surface) {
@@ -3118,12 +3095,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);
@@ -3135,7 +3112,7 @@ index f3e2d88..147db66 100644
 @@ -283,90 +292,6 @@ void QVideoSurfaceGstDelegate::updateSupportedFormats()
      }
  }
-
+ 
 -struct YuvFormat
 -{
 -    QVideoFrame::PixelFormat pixelFormat;
@@ -3221,12 +3198,12 @@ index f3e2d88..147db66 100644
 -}
 -
  static GstVideoSinkClass *sink_parent_class;
-
+ 
  #define VO_SINK(s) QVideoSurfaceGstSink *sink(reinterpret_cast<QVideoSurfaceGstSink *>(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
@@ -3243,7 +3220,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);
 -
@@ -3287,20 +3264,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:";
@@ -3310,7 +3287,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);
@@ -3396,32 +3373,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)
  {
@@ -3429,22 +3406,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 <gst/gst.h>
  #include <gst/app/gstappsrc.h>
 +
 +#if GST_VERSION_MAJOR < 1
  #include <gst/app/gstappbuffer.h>
 +#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
@@ -3456,9 +3433,9 @@ index 34669b8..571a7ce 100644
 +#include <qshareddata.h>
 +
 +#include <private/qgstreamerbufferprobe_p.h>
-
+ 
  QT_BEGIN_NAMESPACE
-
+ 
 -class QGstreamerAudioProbeControl : public QMediaAudioProbeControl
 +class QGstreamerAudioProbeControl
 +    : public QMediaAudioProbeControl
@@ -3469,21 +3446,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
@@ -3690,7 +3667,7 @@ index 49064f9..f035f65 100644
 +++ b/src/multimedia/gsttools_headers/qgstreamervideoprobecontrol_p.h
 @@ -35,20 +35,29 @@
  #define QGSTREAMERVIDEOPROBECONTROL_H
-
+ 
  #include <gst/gst.h>
 +#include <gst/video/video.h>
  #include <qmediavideoprobecontrol.h>
@@ -3699,9 +3676,9 @@ index 49064f9..f035f65 100644
 +#include <qvideosurfaceformat.h>
 +
 +#include <private/qgstreamerbufferprobe_p.h>
-
+ 
  QT_BEGIN_NAMESPACE
-
+ 
 -class QGstreamerVideoProbeControl : public QMediaVideoProbeControl
 +class QGstreamerVideoProbeControl
 +    : public QMediaVideoProbeControl
@@ -3712,17 +3689,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
@@ -3737,22 +3714,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 <private/qgstreamerbushelper_p.h>
 +#include <private/qgstreamerbufferprobe_p.h>
  #include <QtGui/qcolor.h>
-
+ 
  QT_BEGIN_NAMESPACE
 @@ -45,7 +46,8 @@ class QAbstractVideoSurface;
-
+ 
  class QGstreamerVideoWindow : public QVideoWindowControl,
          public QGstreamerVideoRendererInterface,
 -        public QGstreamerSyncMessageFilter
@@ -3763,15 +3740,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:
@@ -3780,7 +3757,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
@@ -3808,15 +3785,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 {
@@ -3863,7 +3840,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);
@@ -3871,21 +3848,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 <QtCore/qvariant.h>
-
+ 
  #include <gst/gst.h>
 +#include <gst/video/video.h>
-
+ 
  QT_BEGIN_NAMESPACE
-
+ 
 +#if GST_CHECK_VERSION(1,0,0)
 +class QGstVideoBuffer : public QAbstractPlanarVideoBuffer
 +{
@@ -3903,9 +3880,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
@@ -3913,7 +3890,7 @@ index 1e0fda8..00aca48 100644
 +#endif
 +
      void unmap();
-
+ 
      QVariant handle() const { return m_handle; }
  private:
 -    GstBuffer *m_buffer;
@@ -4240,7 +4217,7 @@ index 11b305d..0ea18c0 100644
 @@ -45,6 +45,18 @@
  // We mean it.
  //
-
+ 
 +#include <gst/gst.h>
 +
 +#if GST_CHECK_VERSION(1,0,0)
@@ -4254,30 +4231,30 @@ index 11b305d..0ea18c0 100644
 +#else
 +
  #include <gst/video/gstvideosink.h>
-
+ 
  #include <QtCore/qlist.h>
 @@ -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
@@ -4293,7 +4270,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
@@ -4301,7 +4278,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)
  {
@@ -4381,7 +4358,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();
@@ -4394,7 +4371,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
@@ -4406,13 +4383,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;
 +
@@ -4450,19 +4427,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<QGstreamerAudioDecoderSession*>(user_data);
 @@ -531,7 +550,11 @@ void QGstreamerAudioDecoderSession::addAppSink()
-
+ 
      GstAppSinkCallbacks callbacks;
      memset(&callbacks, 0, sizeof(callbacks));
 -    callbacks.new_buffer = &new_buffer;
@@ -4475,17 +4452,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
@@ -4494,10 +4471,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
@@ -4507,19 +4484,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;
@@ -4543,7 +4520,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;
@@ -4556,15 +4533,15 @@ index a235de2..795fd42 100644
 --- a/src/plugins/gstreamer/camerabin/camerabinexposure.cpp
 +++ b/src/plugins/gstreamer/camerabin/camerabinexposure.cpp
 @@ -37,6 +37,10 @@
-
+ 
  #include <QDebug>
-
+ 
 +#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
      }
@@ -4573,7 +4550,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:
@@ -4582,40 +4559,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 <QDebug>
-
+ 
 +#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
@@ -4624,7 +4601,7 @@ index 665e204..061c680 100644
 @@ -39,6 +39,12 @@
  #include <QDebug>
  #include <QtCore/qmetaobject.h>
-
+ 
 +#include <private/qgstutils_p.h>
 +
 +#if !GST_CHECK_VERSION(1,0,0)
@@ -4632,15 +4609,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
@@ -4655,7 +4632,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) {
@@ -4670,7 +4647,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)
@@ -4688,7 +4665,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(
@@ -4718,7 +4695,7 @@ index 6952155..8b51306 100644
 +    return TRUE;
 +#endif
 +}
-
+ 
 -    return true;
 +void CameraBinImageCapture::EncoderProbe::probeCaps(GstCaps *caps)
 +{
@@ -4731,22 +4708,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);
@@ -4761,7 +4738,7 @@ index 6952155..8b51306 100644
 +#else
 +            QGstVideoBuffer *videoBuffer = new QGstVideoBuffer(buffer, capture->m_bytesPerLine);
 +#endif
-
+ 
 -            QVideoFrame frame(videoBuffer,
 -                              format.frameSize(),
 -                              format.pixelFormat());
@@ -4769,7 +4746,7 @@ index 6952155..8b51306 100644
 +                        videoBuffer,
 +                        capture->m_bufferFormat.frameSize(),
 +                        capture->m_bufferFormat.pixelFormat());
-
+ 
 -            QMetaObject::invokeMethod(self, "imageAvailable",
 +            QMetaObject::invokeMethod(capture, "imageAvailable",
                                        Qt::QueuedConnection,
@@ -4781,7 +4758,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)
  {
@@ -4789,22 +4766,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:
@@ -4831,7 +4808,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
@@ -4848,7 +4825,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;
 +
@@ -4857,14 +4834,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);
@@ -4895,7 +4872,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") ||
@@ -4927,7 +4904,7 @@ index c2e26f5..9a52dd9 100644
 @@ -38,6 +38,14 @@
  #include <qcameraimagecapturecontrol.h>
  #include "camerabinsession.h"
-
+ 
 +#include <qvideosurfaceformat.h>
 +
 +#include <private/qgstreamerbufferprobe_p.h>
@@ -4937,11 +4914,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 *);
@@ -4969,7 +4946,7 @@ index c2e26f5..9a52dd9 100644
 +        MuxerProbe(CameraBinImageCapture *capture) : capture(capture) {}
 +        void probeCaps(GstCaps *caps);
 +        bool probeBuffer(GstBuffer *buffer);
-
+ 
 +    private:
 +        CameraBinImageCapture * const capture;
 +
@@ -4990,20 +4967,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<QSize> 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
@@ -5011,16 +4988,16 @@ index ebfb087..811225f 100644
 @@ -34,7 +34,11 @@
  #include "camerabinimageprocessing.h"
  #include "camerabinsession.h"
-
+ 
 -#include <gst/interfaces/colorbalance.h>
 +#if GST_CHECK_VERSION(1,0,0)
 +# include <gst/video/colorbalance.h>
 +#else
 +# include <gst/interfaces/colorbalance.h>
 +#endif
-
+ 
  QT_BEGIN_NAMESPACE
-
+ 
 @@ -126,7 +130,7 @@ bool CameraBinImageProcessing::setColorBalanceValue(const QString& channel, qrea
  QCameraImageProcessing::WhiteBalanceMode CameraBinImageProcessing::whiteBalanceMode() const
  {
@@ -5036,7 +5013,7 @@ index dcefcd0..2c6347f 100644
 +++ b/src/plugins/gstreamer/camerabin/camerabinimageprocessing.h
 @@ -41,7 +41,10 @@
  #include <glib.h>
-
+ 
  #ifdef HAVE_GST_PHOTOGRAPHY
 -#include <gst/interfaces/photography.h>
 +# include <gst/interfaces/photography.h>
@@ -5044,7 +5021,7 @@ index dcefcd0..2c6347f 100644
 +typedef GstWhiteBalanceMode GstPhotographyWhiteBalanceMode;
 +# endif
  #endif
-
+ 
  QT_BEGIN_NAMESPACE
 @@ -73,7 +76,7 @@ private:
      CameraBinSession *m_session;
@@ -5054,7 +5031,7 @@ index dcefcd0..2c6347f 100644
 +    QMap<GstPhotographyWhiteBalanceMode, QCameraImageProcessing::WhiteBalanceMode> 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
@@ -5094,19 +5071,19 @@ 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
+index e4aa594..e669a57 100644
 --- a/src/plugins/gstreamer/camerabin/camerabinservice.cpp
 +++ b/src/plugins/gstreamer/camerabin/camerabinservice.cpp
 @@ -56,11 +56,11 @@
@@ -5114,33 +5091,25 @@ index 969955f..388f2fd 100644
  #include "camerabinviewfindersettings.h"
  #include <private/qgstreamerbushelper_p.h>
 +#include <private/qgstutils_p.h>
-
+ 
  #include <private/qgstreameraudioinputselector_p.h>
  #include <private/qgstreamervideoinputdevicecontrol_p.h>
-
+ 
 -
  #if defined(HAVE_WIDGETS)
  #include <private/qgstreamervideowidget_p.h>
  #endif
-@@ -121,7 +121,6 @@ CameraBinService::CameraBinService(GstElementFactory *sourceFactory, QObject *pa
- #else
-     m_videoWindow = new QGstreamerVideoWindow(this);
- #endif
--
- #if defined(HAVE_WIDGETS)
-     m_videoWidgetControl = new QGstreamerVideoWidgetControl(this);
- #endif
-@@ -150,8 +149,6 @@ QMediaControl *CameraBinService::requestControl(const char *name)
+@@ -164,8 +164,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)
-
+@@ -263,7 +261,7 @@ void CameraBinService::releaseControl(QMediaControl *control)
+ 
  bool CameraBinService::isCameraBinAvailable()
  {
 -    GstElementFactory *factory = gst_element_factory_find("camerabin2");
@@ -5157,7 +5126,7 @@ index 1ed663b..b62fbbf 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);
@@ -5165,7 +5134,7 @@ index 1ed663b..b62fbbf 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",
@@ -5189,14 +5158,14 @@ index 1ed663b..b62fbbf 100644
 @@ -251,61 +260,27 @@ bool CameraBinSession::setupCameraBin()
      return true;
  }
-
+ 
 -static GstCaps *resolutionToCaps(const QSize &resolution, const QPair<int, int> &rate = qMakePair<int,int>(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",
@@ -5265,7 +5234,7 @@ index 1ed663b..b62fbbf 100644
 +                    "framerate", GST_TYPE_FRACTION, numerator, denominator,
 +                    NULL);
      }
-
+ 
      return caps;
 @@ -314,28 +289,29 @@ static GstCaps *resolutionToCaps(const QSize &resolution, const QPair<int, int>
  void CameraBinSession::setupCaptureResolution()
@@ -5286,7 +5255,7 @@ index 1ed663b..b62fbbf 100644
 +        if (caps)
 +            gst_caps_unref(caps);
      }
-
+ 
 +    const QSize viewfinderResolution = m_viewfinderSettingsControl->resolution();
      resolution = m_videoEncodeControl->actualVideoSettings().resolution();
 -    //qreal framerate = m_videoEncodeControl->videoSettings().frameRate();
@@ -5307,12 +5276,12 @@ index 1ed663b..b62fbbf 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())
@@ -5338,12 +5307,12 @@ index 1ed663b..b62fbbf 100644
 +       if (caps)
 +           gst_caps_unref(caps);
      }
-
+ 
      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
@@ -5371,7 +5340,7 @@ index 1ed663b..b62fbbf 100644
 @@ -831,129 +810,57 @@ void CameraBinSession::setMetaData(const QMap<QByteArray, QVariant> &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;
@@ -5428,14 +5397,14 @@ index 1ed663b..b62fbbf 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")) {
@@ -5470,7 +5439,7 @@ index 1ed663b..b62fbbf 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) &&
@@ -5561,7 +5530,7 @@ index 1ed663b..b62fbbf 100644
 +                    "width", G_TYPE_INT, frameSize.width(),
 +                    "height", G_TYPE_INT, frameSize.height(),
 +                     NULL);
-
+ 
          caps = gst_caps_intersect(supportedCaps, filter);
          gst_caps_unref(filter);
 @@ -1169,7 +1068,7 @@ QList< QPair<int,int> > CameraBinSession::supportedFrameRates(const QSize &frame
@@ -5583,22 +5552,22 @@ index 1ed663b..b62fbbf 100644
      gst_caps_do_simplify(caps);
 -
 +#endif
-
+ 
      for (uint i=0; i<gst_caps_get_size(caps); i++) {
          GstStructure *structure = gst_caps_get_structure(caps, i);
 @@ -1190,7 +1092,7 @@ QList< QPair<int,int> > 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
-
+ 
 @@ -1249,31 +1151,24 @@ QList<QSize> CameraBinSession::supportedResolutions(QPair<int,int> rate,
                       SUPPORTED_IMAGE_CAPTURE_CAPS_PROPERTY : SUPPORTED_VIDEO_CAPTURE_CAPS_PROPERTY,
                   &supportedCaps, NULL);
-
+ 
 -    if (!supportedCaps)
 -        return res;
 -
@@ -5606,13 +5575,13 @@ index 1ed663b..b62fbbf 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 {
@@ -5656,7 +5625,7 @@ index 1ed663b..b62fbbf 100644
      gst_caps_do_simplify(caps);
 +#endif
 +
-
+ 
      for (uint i=0; i<gst_caps_get_size(caps); i++) {
          GstStructure *structure = gst_caps_get_structure(caps, i);
 diff --git a/src/plugins/gstreamer/common.pri b/src/plugins/gstreamer/common.pri
@@ -5665,7 +5634,7 @@ index 8b421b8..eb6a299 100644
 +++ b/src/plugins/gstreamer/common.pri
 @@ -12,14 +12,18 @@ LIBS += -lqgsttools_p
  CONFIG += link_pkgconfig
-
+ 
  PKGCONFIG += \
 -    gstreamer-0.10 \
 -    gstreamer-base-0.10 \
@@ -5684,14 +5653,14 @@ index 8b421b8..eb6a299 100644
 +mir: {
 +    DEFINES += HAVE_MIR
 +}
-
+ 
 -maemo*:PKGCONFIG +=gstreamer-plugins-bad-0.10
-
+ 
  config_resourcepolicy {
      DEFINES += HAVE_RESOURCE_POLICY
 @@ -27,8 +31,8 @@ config_resourcepolicy {
  }
-
+ 
  config_gstreamer_appsrc {
 -    PKGCONFIG += gstreamer-app-0.10
 +    PKGCONFIG += gstreamer-app-$$GST_VERSION
@@ -5699,20 +5668,20 @@ index 8b421b8..eb6a299 100644
 -    LIBS += -lgstapp-0.10
 +    LIBS += -lgstapp-$$GST_VERSION
  }
-
+ 
 diff --git a/src/plugins/gstreamer/gstreamer.pro b/src/plugins/gstreamer/gstreamer.pro
 index 7649010..0ff3510 100644
 --- a/src/plugins/gstreamer/gstreamer.pro
 +++ b/src/plugins/gstreamer/gstreamer.pro
 @@ -2,8 +2,8 @@ TEMPLATE = subdirs
-
+ 
  SUBDIRS += \
      audiodecoder \
 -    mediacapture \
 -    mediaplayer
 +    mediaplayer \
 +    mediacapture
-
+ 
  config_gstreamer_encodingprofiles {
      SUBDIRS += camerabin
 diff --git a/src/plugins/gstreamer/mediacapture/mediacapturecamera.json b/src/plugins/gstreamer/mediacapture/mediacapturecamera.json
@@ -5734,26 +5703,26 @@ index d05df49..8881445 100644
  #include "qgstreamercapturesession.h"
  #include "qgstreamermediacontainercontrol.h"
 +#include <private/qgstutils_p.h>
-
+ 
  #include <QtCore/qdebug.h>
-
+ 
 @@ -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
-index 97a165d..1ab98cd 100644
+index e77feeb..04e2966 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)
 -{
@@ -5793,9 +5762,9 @@ index 97a165d..1ab98cd 100644
      if (service == Q_MEDIASERVICE_AUDIOSOURCE) {
          m_captureSession = new QGstreamerCaptureSession(QGstreamerCaptureSession::Audio, this);
      }
-@@ -163,12 +161,12 @@ QMediaControl *QGstreamerCaptureService::requestControl(const char *name)
+@@ -178,12 +176,12 @@ QMediaControl *QGstreamerCaptureService::requestControl(const char *name)
          return m_imageCaptureControl;
-
+ 
      if (qstrcmp(name,QMediaAudioProbeControl_iid) == 0) {
 -        if (m_captureSession) {
 -            QGstreamerAudioProbeControl *probe = new QGstreamerAudioProbeControl(this);
@@ -5809,10 +5778,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)
-
+@@ -209,17 +207,15 @@ QMediaControl *QGstreamerCaptureService::requestControl(const char *name)
+ 
  void QGstreamerCaptureService::releaseControl(QMediaControl *control)
  {
 -    if (control && control == m_videoOutput) {
@@ -5835,27 +5804,27 @@ 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
+index e5166d1..d6a5843 100644
 --- a/src/plugins/gstreamer/mediacapture/qgstreamercaptureservice.h
 +++ b/src/plugins/gstreamer/mediacapture/qgstreamercaptureservice.h
 @@ -43,6 +43,7 @@ QT_BEGIN_NAMESPACE
  class QAudioInputSelectorControl;
  class QVideoDeviceSelectorControl;
-
+ 
 +class QGstreamerAudioProbeControl;
  class QGstreamerCaptureSession;
  class QGstreamerCameraControl;
  class QGstreamerMessage;
-@@ -86,6 +87,8 @@ private:
-     QMediaControl *m_videoWidgetControl;
+@@ -87,6 +88,8 @@ private:
+     QGstreamerVideoWidgetControl *m_videoWidgetControl;
  #endif
      QGstreamerImageCaptureControl *m_imageCaptureControl;
 +
 +    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
@@ -5864,7 +5833,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)
 +{
@@ -5958,18 +5927,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 <gst/gsttagsetter.h>
  #include <gst/gstversion.h>
 +#include <gst/video/video.h>
-
+ 
  #include <QtCore/qdebug.h>
  #include <QtCore/qurl.h>
 @@ -52,7 +53,6 @@
@@ -5978,7 +5947,7 @@ index a2bd80d..af5b339 100644
  #include <QtCore/qfile.h>
 -
  #include <QtGui/qimage.h>
-
+ 
  QT_BEGIN_NAMESPACE
 @@ -64,7 +64,7 @@ QGstreamerCaptureSession::QGstreamerCaptureSession(QGstreamerCaptureSession::Cap
       m_waitingForEos(false),
@@ -5990,27 +5959,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;
@@ -6027,7 +5996,7 @@ index a2bd80d..af5b339 100644
 -                if (frameRate > 0.001) {
 -                    QPair<int,int> 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);
@@ -6035,26 +6004,26 @@ index a2bd80d..af5b339 100644
 +        }
 +        if (frameRate > 0.001) {
 +            QPair<int,int> 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()
@@ -6069,7 +6038,7 @@ index a2bd80d..af5b339 100644
 @@ -360,101 +349,49 @@ GstElement *QGstreamerCaptureSession::buildVideoPreview()
      return previewElement;
  }
-
+ 
 -
 -static gboolean passImageFilter(GstElement *element,
 -                                GstBuffer *buffer,
@@ -6115,7 +6084,7 @@ index a2bd80d..af5b339 100644
 +    Q_UNUSED(caps);
 +#endif
 +}
-
+ 
 -                            for (int y=0; y<height; y+=2) {
 -                                const uchar *yLine = data + y*width;
 -                                const uchar *uLine = data + width*height + y*width/4;
@@ -6125,7 +6094,7 @@ index a2bd80d..af5b339 100644
 +    if (m_passPrerollImage) {
 +        m_passImage = false;
 +        m_passPrerollImage = false;
-
+ 
 -                                for (int x=0; x<width; x+=2) {
 -                                    const qreal Y = 1.164*(yLine[x]-16);
 -                                    const int U = uLine[x/2]-128;
@@ -6134,12 +6103,12 @@ index a2bd80d..af5b339 100644
 +    } else  if (!m_passImage) {
 +        return false;
 +    }
-
+ 
 -                                    int b = qBound(0, int(Y + 2.018*U), 255);
 -                                    int g = qBound(0, int(Y - 0.813*V - 0.391*U), 255);
 -                                    int r = qBound(0, int(Y + 1.596*V), 255);
 +    m_passImage = false;
-
+ 
 -                                    img.setPixel(x/2,y/2,qRgb(r,g,b));
 -                                }
 -                            }
@@ -6149,7 +6118,7 @@ index a2bd80d..af5b339 100644
 +#else
 +    QImage img = QGstUtils::bufferToImage(buffer);
 +#endif
-
+ 
 -                    } else if (qstrcmp(gst_structure_get_name(structure), "video/x-raw-rgb") == 0) {
 -                        QImage::Format format = QImage::Format_Invalid;
 -                        int bpp = 0;
@@ -6173,7 +6142,7 @@ index a2bd80d..af5b339 100644
 -        }
 +    if (img.isNull())
 +        return true;
-
+ 
 -        static QMetaMethod exposedSignal = QMetaMethod::fromSignal(&QGstreamerCaptureSession::imageExposed);
 -        exposedSignal.invoke(session,
 -                             Qt::QueuedConnection,
@@ -6182,7 +6151,7 @@ index a2bd80d..af5b339 100644
 +    exposedSignal.invoke(this,
 +                         Qt::QueuedConnection,
 +                         Q_ARG(int,m_imageRequestId));
-
+ 
 -        static QMetaMethod capturedSignal = QMetaMethod::fromSignal(&QGstreamerCaptureSession::imageCaptured);
 -        capturedSignal.invoke(session,
 -                              Qt::QueuedConnection,
@@ -6193,14 +6162,14 @@ index a2bd80d..af5b339 100644
 +                          Qt::QueuedConnection,
 +                          Q_ARG(int,m_imageRequestId),
 +                          Q_ARG(QImage,img));
-
+ 
 -        return TRUE;
 -    } else {
 -        return FALSE;
 -    }
 +    return true;
  }
-
+ 
  static gboolean saveImageFilter(GstElement *element,
 @@ -471,7 +408,15 @@ static gboolean saveImageFilter(GstElement *element,
      if (!fileName.isEmpty()) {
@@ -6217,7 +6186,7 @@ index a2bd80d..af5b339 100644
 +            f.write(reinterpret_cast<const char *>(buffer->data), buffer->size);
 +#endif
              f.close();
-
+ 
              static QMetaMethod savedSignal = QMetaMethod::fromSignal(&QGstreamerCaptureSession::imageSaved);
 @@ -489,18 +434,19 @@ GstElement *QGstreamerCaptureSession::buildImageCapture()
  {
@@ -6227,7 +6196,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);
@@ -6235,12 +6204,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)
@@ -6251,9 +6220,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;
@@ -6268,7 +6237,7 @@ index a2bd80d..af5b339 100644
 @@ -896,50 +842,8 @@ void QGstreamerCaptureSession::setMetaData(const QMap<QByteArray, QVariant> &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;
@@ -6316,10 +6285,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);
@@ -6332,7 +6301,7 @@ index a2bd80d..af5b339 100644
 +    m_audioProbe = probe;
 +    addAudioBufferProbe();
  }
-
+ 
  void QGstreamerCaptureSession::removeProbe(QGstreamerAudioProbeControl* probe)
  {
 -    QMutexLocker locker(&m_audioProbeMutex);
@@ -6357,16 +6326,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);
@@ -6377,13 +6346,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);
@@ -6392,26 +6361,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 <QtCore/qurl.h>
-
+ 
  #include <gst/gst.h>
 +#include <gst/video/video.h>
-
+ 
  #include <private/qgstreamerbushelper_p.h>
 +#include <private/qgstreamerbufferprobe_p.h>
-
+ 
  QT_BEGIN_NAMESPACE
-
+ 
 @@ -70,7 +72,10 @@ public:
      virtual QList<QSize> supportedResolutions(qreal frameRate = -1) const = 0;
  };
-
+ 
 -class QGstreamerCaptureSession : public QObject, public QGstreamerBusMessageFilter
 +class QGstreamerCaptureSession
 +        : public QObject
@@ -6421,38 +6390,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<QByteArray, QVariant> m_metaData;
-
+ 
 -    QList<QGstreamerAudioProbeControl*> 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
@@ -6471,20 +6440,20 @@ index 2f0d0ee..81b85d7 100644
 -
 +#include <private/qgstutils_p.h>
  #include <QtCore/qdebug.h>
-
+ 
  #include <math.h>
 @@ -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;
@@ -6514,7 +6483,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<int,int> rate = rateAsRational();
@@ -6523,14 +6492,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
 -
@@ -6541,18 +6510,18 @@ 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) {
  #else
 diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.cpp b/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.cpp
-index ce267d7..84805b6 100644
+index ddc828e..1fee6bf 100644
 --- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.cpp
 +++ b/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.cpp
 @@ -51,7 +51,11 @@
  #include <private/qgstreamervideorenderer_p.h>
-
+ 
  #if defined(Q_WS_MAEMO_6) && defined(__arm__)
 -#include "qgstreamergltexturerenderer.h"
 +#include "private/qgstreamergltexturerenderer.h"
@@ -6561,10 +6530,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)
@@ -6573,7 +6542,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__)
@@ -6581,10 +6550,10 @@ index ce267d7..84805b6 100644
  #else
      m_videoRenderer = new QGstreamerVideoRenderer(this);
  #endif
-@@ -115,23 +123,23 @@ QMediaControl *QGstreamerPlayerService::requestControl(const char *name)
+@@ -129,23 +137,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);
@@ -6600,7 +6569,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);
@@ -6615,10 +6584,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)
-
+@@ -170,28 +178,21 @@ QMediaControl *QGstreamerPlayerService::requestControl(const char *name)
+ 
  void QGstreamerPlayerService::releaseControl(QMediaControl *control)
  {
 -    if (control == m_videoOutput) {
@@ -6657,30 +6626,30 @@ 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
+index 0c5b406..a5dbe98 100644
 --- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.h
 +++ b/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.h
-@@ -52,6 +52,8 @@ class QGstreamerStreamsControl;
- class QGstreamerVideoRenderer;
+@@ -53,6 +53,8 @@ class QGstreamerVideoRenderer;
+ class QGstreamerVideoWindow;
  class QGstreamerVideoWidgetControl;
  class QGStreamerAvailabilityControl;
 +class QGstreamerAudioProbeControl;
 +class QGstreamerVideoProbeControl;
-
+ 
  class QGstreamerPlayerService : public QMediaService
  {
-@@ -70,6 +72,9 @@ private:
+@@ -71,6 +73,9 @@ private:
      QGstreamerStreamsControl *m_streamsControl;
      QGStreamerAvailabilityControl *m_availabilityControl;
-
+ 
 +    QGstreamerAudioProbeControl *m_audioProbeControl;
 +    QGstreamerVideoProbeControl *m_videoProbeControl;
 +
      QMediaControl *m_videoOutput;
      QMediaControl *m_videoRenderer;
-     QMediaControl *m_videoWindow;
+     QGstreamerVideoWindow *m_videoWindow;
 diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerserviceplugin.cpp b/src/plugins/gstreamer/mediaplayer/qgstreamerplayerserviceplugin.cpp
 index 7d20b6d..f1fd421 100644
 --- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerserviceplugin.cpp
@@ -6688,7 +6657,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)
  {
@@ -6767,7 +6736,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();
@@ -6780,7 +6749,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
@@ -6799,7 +6768,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; " \
@@ -6811,7 +6780,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)
@@ -6838,7 +6807,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);
@@ -6865,29 +6834,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;
@@ -6900,23 +6869,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
@@ -6939,11 +6908,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),
@@ -6953,7 +6922,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);
@@ -6962,13 +6931,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)
@@ -6984,11 +6953,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)
@@ -6997,11 +6966,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,
@@ -7012,12 +6981,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);
@@ -7033,9 +7002,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)
@@ -7048,7 +7017,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()
@@ -7066,22 +7035,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);
@@ -7092,7 +7061,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*/),
@@ -7101,7 +7070,7 @@ index 15924a6..b5c354d 100644
                                    "playbin_finish");
  #endif
  }
-
+ 
 +#if !GST_CHECK_VERSION(1,0,0)
 +
  void QGstreamerPlayerSession::insertColorSpaceElement(GstElement *element, gpointer data)
@@ -7110,9 +7079,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()
@@ -7169,39 +7138,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
@@ -7213,7 +7182,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
@@ -7239,7 +7208,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);
@@ -7252,7 +7221,7 @@ index 15924a6..b5c354d 100644
 +    m_videoProbe = probe;
 +    addVideoBufferProbe();
  }
-
+ 
  void QGstreamerPlayerSession::removeProbe(QGstreamerVideoProbeControl* probe)
  {
 -    QMutexLocker locker(&m_videoProbeMutex);
@@ -7279,7 +7248,7 @@ index 15924a6..b5c354d 100644
 +    removeVideoBufferProbe();
 +    m_videoProbe = 0;
  }
-
+ 
  void QGstreamerPlayerSession::addProbe(QGstreamerAudioProbeControl* probe)
  {
 -    QMutexLocker locker(&m_audioProbeMutex);
@@ -7292,7 +7261,7 @@ index 15924a6..b5c354d 100644
 +    m_audioProbe = probe;
 +    addAudioBufferProbe();
  }
-
+ 
  void QGstreamerPlayerSession::removeProbe(QGstreamerAudioProbeControl* probe)
  {
 -    QMutexLocker locker(&m_audioProbeMutex);
@@ -7317,16 +7286,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;
@@ -7341,14 +7310,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);
@@ -7356,7 +7325,7 @@ index 15924a6..b5c354d 100644
          gst_object_unref(GST_OBJECT(pad));
      }
  }
-
+ 
  void QGstreamerPlayerSession::removeAudioBufferProbe()
  {
 -    if (m_audioBufferProbeId == -1)
@@ -7367,7 +7336,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);
@@ -7377,14 +7346,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);
@@ -7392,7 +7361,7 @@ index 15924a6..b5c354d 100644
          gst_object_unref(GST_OBJECT(pad));
      }
  }
-
+ 
  void QGstreamerPlayerSession::flushVideoProbes()
  {
 -    QMutexLocker locker(&m_videoProbeMutex);
@@ -7401,7 +7370,7 @@ index 15924a6..b5c354d 100644
 +    if (m_videoProbe)
 +        m_videoProbe->startFlushing();
  }
-
+ 
  void QGstreamerPlayerSession::resumeVideoProbes()
  {
 -    QMutexLocker locker(&m_videoProbeMutex);
@@ -7410,23 +7379,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);
@@ -7438,17 +7407,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);
@@ -7462,7 +7431,7 @@ index f2e760a..92b4a0c 100644
 @@ -194,11 +194,14 @@ private:
      QGstreamerBusHelper* m_busHelper;
      GstElement* m_playbin;
-
+ 
 +    GstElement* m_videoSink;
 +
      GstElement* m_videoOutputBin;
@@ -7474,11 +7443,11 @@ index f2e760a..92b4a0c 100644
 +#endif
      GstElement* m_pendingVideoSink;
      GstElement* m_nullVideoSink;
-
+ 
 @@ -218,13 +221,8 @@ private:
      QList<QMediaStreamsControl::StreamType> m_streamTypes;
      QMap<QMediaStreamsControl::StreamType, int> m_playbin2StreamOffset;
-
+ 
 -    QList<QGstreamerVideoProbeControl*> m_videoProbes;
 -    QMutex m_videoProbeMutex;
 -    int m_videoBufferProbeId;
@@ -7488,16 +7457,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
@@ -7506,7 +7475,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
@@ -7515,18 +7484,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<QCamera> 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);
@@ -7534,14 +7503,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;
@@ -7550,7 +7519,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;
diff --git a/sources b/sources
index 707518a..d7674a3 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-7412a5c62da71b44b9f29e29fdc6af4d  qtmultimedia-opensource-src-5.4.1.tar.xz
+b94baed3effda9187d71300b3e37d2d5  qtmultimedia-opensource-src-5.4.2.tar.xz
-- 
cgit v0.10.2


	http://pkgs.fedoraproject.org/cgit/qt5-qtmultimedia.git/commit/?h=el6&id=c4411d132521e377bd02d09eecdf979ac9aade1b


More information about the scm-commits mailing list