diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2020-01-21 03:01:46 +0100 |
---|---|---|
committer | VaL Doroshchuk <valentyn.doroshchuk@qt.io> | 2020-01-21 08:52:14 +0000 |
commit | 3a27739539638c5dd7c11262f2238eb02b14616e (patch) | |
tree | 2f10d3bbd4cef4e0572321e75cc925829d6ccc6c /src/multimedia | |
parent | 91679ad2b392db83dd723463b7d1f715ad5f2d8e (diff) | |
parent | 8517f09af1536502011618d2b0c37537d1eb12ee (diff) |
Merge remote-tracking branch 'origin/5.15' into dev
Conflicts:
src/imports/multimedia/multimedia.cpp
Change-Id: I5b395bce97f2d2edc45294db046929cb9d9cd7b9
Diffstat (limited to 'src/multimedia')
-rw-r--r-- | src/multimedia/configure.json | 3 | ||||
-rw-r--r-- | src/multimedia/doc/snippets/multimedia-snippets/video.cpp | 23 | ||||
-rw-r--r-- | src/multimedia/video/qvideosurfaces.cpp | 13 |
3 files changed, 37 insertions, 2 deletions
diff --git a/src/multimedia/configure.json b/src/multimedia/configure.json index 0e9cfc9f7..e9480dfc5 100644 --- a/src/multimedia/configure.json +++ b/src/multimedia/configure.json @@ -3,6 +3,7 @@ "depends": [ "gui" ], + "condition": "module.gui", "testDir": "../../config.tests", "commandline": { @@ -256,7 +257,7 @@ }, "gstreamer_gl": { "label": "GStreamer OpenGL", - "condition": "features.gstreamer_1_0 && libs.gstreamer_gl_1_0", + "condition": "features.opengl && features.gstreamer_1_0 && libs.gstreamer_gl_1_0", "output": [ "privateFeature" ] }, "gstreamer_imxcommon": { diff --git a/src/multimedia/doc/snippets/multimedia-snippets/video.cpp b/src/multimedia/doc/snippets/multimedia-snippets/video.cpp index 3c14f7009..46327e3d6 100644 --- a/src/multimedia/doc/snippets/multimedia-snippets/video.cpp +++ b/src/multimedia/doc/snippets/multimedia-snippets/video.cpp @@ -117,6 +117,7 @@ public: void VideoWidget(); void VideoWindowControl(); void VideoWidgetControl(); + void VideoSurface(); private: // Common naming @@ -163,6 +164,28 @@ void VideoExample::VideoWidget() //! [Setting surface in player] } +void VideoExample::VideoSurface() +{ + //! [Widget Surface] + QImage img = QImage("images/qt-logo.png").convertToFormat(QImage::Format_ARGB32); + QVideoSurfaceFormat format(img.size(), QVideoFrame::Format_ARGB32); + videoWidget = new QVideoWidget; + videoWidget->videoSurface()->start(format); + videoWidget->videoSurface()->present(img); + videoWidget->show(); + //! [Widget Surface] + + //! [GraphicsVideoItem Surface] + QGraphicsVideoItem *item = new QGraphicsVideoItem; + graphicsView->scene()->addItem(item); + graphicsView->show(); + QImage img = QImage("images/qt-logo.png").convertToFormat(QImage::Format_ARGB32); + QVideoSurfaceFormat format(img.size(), QVideoFrame::Format_ARGB32); + item->videoSurface()->start(format); + item->videoSurface()->present(img); + //! [GraphicsVideoItem Surface] +} + void VideoExample::VideoWidgetControl() { //! [Video widget control] diff --git a/src/multimedia/video/qvideosurfaces.cpp b/src/multimedia/video/qvideosurfaces.cpp index c7de5ea12..793879382 100644 --- a/src/multimedia/video/qvideosurfaces.cpp +++ b/src/multimedia/video/qvideosurfaces.cpp @@ -45,6 +45,15 @@ QVideoSurfaces::QVideoSurfaces(const QVector<QAbstractVideoSurface *> &s, QObjec : QAbstractVideoSurface(parent) , m_surfaces(s) { + for (auto a : s) { + connect(a, &QAbstractVideoSurface::supportedFormatsChanged, this, [this, a] { + auto context = property("GLContext").value<QObject *>(); + if (!context) + setProperty("GLContext", a->property("GLContext")); + + emit supportedFormatsChanged(); + }); + } } QVideoSurfaces::~QVideoSurfaces() @@ -71,13 +80,15 @@ bool QVideoSurfaces::start(const QVideoSurfaceFormat &format) for (auto &s : m_surfaces) result &= s->start(format); - return result; + return result && QAbstractVideoSurface::start(format); } void QVideoSurfaces::stop() { for (auto &s : m_surfaces) s->stop(); + + QAbstractVideoSurface::stop(); } bool QVideoSurfaces::present(const QVideoFrame &frame) |