summaryrefslogtreecommitdiffstats
path: root/src/multimedia
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2020-03-10 03:05:22 +0100
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2020-03-10 03:05:22 +0100
commit9514bba6c6bb41e304b450544c6e6b69080572a5 (patch)
treec263293631f8a4616e13bf19034e0fa1c314af24 /src/multimedia
parent19477de84a64f412bca9ce2df62ab9adb3859da2 (diff)
parent7f0a20ad066020d913faff636b8a0c5f61d2dfe0 (diff)
Merge remote-tracking branch 'origin/5.14' into 5.15
Diffstat (limited to 'src/multimedia')
-rw-r--r--src/multimedia/doc/snippets/multimedia-snippets/media.cpp31
-rw-r--r--src/multimedia/doc/src/platform-notes-windows.qdoc5
-rw-r--r--src/multimedia/playback/qmediaplayer.cpp13
3 files changed, 47 insertions, 2 deletions
diff --git a/src/multimedia/doc/snippets/multimedia-snippets/media.cpp b/src/multimedia/doc/snippets/multimedia-snippets/media.cpp
index 8ec7cb072..7fd6259ea 100644
--- a/src/multimedia/doc/snippets/multimedia-snippets/media.cpp
+++ b/src/multimedia/doc/snippets/multimedia-snippets/media.cpp
@@ -56,6 +56,7 @@
#include "qaudioprobe.h"
#include "qaudiorecorder.h"
#include "qvideoprobe.h"
+#include <QAbstractVideoSurface>
class MediaExample : public QObject {
Q_OBJECT
@@ -197,6 +198,36 @@ void MediaExample::MediaPlayer()
player->play();
//! [Pipeline]
+ //! [Pipeline Surface]
+ class Surface : public QAbstractVideoSurface
+ {
+ public:
+ Surface(QObject *p) : QAbstractVideoSurface(p) { }
+ QList<QVideoFrame::PixelFormat> supportedPixelFormats(QAbstractVideoBuffer::HandleType) const override
+ {
+ // Make sure that the driver supports this pixel format.
+ return QList<QVideoFrame::PixelFormat>() << QVideoFrame::Format_YUYV;
+ }
+
+ // Video frames are handled here.
+ bool present(const QVideoFrame &) override { return true; }
+ };
+
+ player = new QMediaPlayer;
+ player->setVideoOutput(new Surface(player));
+ player->setMedia(QUrl("gst-pipeline: videotestsrc ! qtvideosink"));
+ player->play();
+ //! [Pipeline Surface]
+
+ //! [Pipeline Widget]
+ player = new QMediaPlayer;
+ videoWidget = new QVideoWidget;
+ videoWidget->show();
+ player->setVideoOutput(videoWidget);
+ player->setMedia(QUrl("gst-pipeline: videotestsrc ! xvimagesink name=\"qtvideosink\""));
+ player->play();
+ //! [Pipeline Widget]
+
//! [Pipeline appsrc]
QImage img("images/qt-logo.png");
img = img.convertToFormat(QImage::Format_ARGB32);
diff --git a/src/multimedia/doc/src/platform-notes-windows.qdoc b/src/multimedia/doc/src/platform-notes-windows.qdoc
index e86d6a276..a69e96d99 100644
--- a/src/multimedia/doc/src/platform-notes-windows.qdoc
+++ b/src/multimedia/doc/src/platform-notes-windows.qdoc
@@ -42,6 +42,11 @@ was introduced in Windows Vista as a replacement for DirectShow and other
multimedia APIs. Consequently, WMF plugin in Qt is supported only for
Windows Vista and later versions of the operating system.
+The environment variable \c QT_MULTIMEDIA_PREFERRED_PLUGINS can be used to
+control the priority of the plugins. For example, setting it to
+"windowsmediafoundation" or "directshow" will cause the corresponding plugin
+to be the preferred one.
+
\section1 Limitations
The WMF plugin in Qt does not currently provide a camera backend. Instead,
diff --git a/src/multimedia/playback/qmediaplayer.cpp b/src/multimedia/playback/qmediaplayer.cpp
index 0ccc18401..3773cfe64 100644
--- a/src/multimedia/playback/qmediaplayer.cpp
+++ b/src/multimedia/playback/qmediaplayer.cpp
@@ -1028,8 +1028,17 @@ void QMediaPlayer::setPlaybackRate(qreal rate)
\snippet multimedia-snippets/media.cpp Pipeline
- If the pipeline contains a video sink element named \c qtvideosink,
- current QVideoWidget can be used to render the video.
+ If QAbstractVideoSurface is used as the video output,
+ \c qtvideosink can be used as a video sink element directly in the pipeline.
+ After that the surface will receive the video frames in QAbstractVideoSurface::present().
+
+ \snippet multimedia-snippets/media.cpp Pipeline Surface
+
+ If QVideoWidget is used as the video output
+ and the pipeline contains a video sink element named \c qtvideosink,
+ current QVideoWidget will be used to render the video.
+
+ \snippet multimedia-snippets/media.cpp Pipeline Widget
If the pipeline contains appsrc element, it will be used to push data from \a stream.