diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-08-17 03:00:51 +0200 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-08-17 03:00:51 +0200 |
commit | a31d981b08519922b4c9c17b17122c02c1734ef4 (patch) | |
tree | bf2068df8fa1158aa1c1d7eef3cf17dd13cc363d /src/gsttools | |
parent | f49bfa05d1f67327a33d2b66e9ff1bcc32ad8d05 (diff) | |
parent | 7b1bb300166aa19dc0f4c6838eb6d284af73236c (diff) |
Merge remote-tracking branch 'origin/5.13' into dev
Change-Id: I09f511d894db5e9987ac2b9e42266bb87ef0161d
Diffstat (limited to 'src/gsttools')
-rw-r--r-- | src/gsttools/qgstcodecsinfo.cpp | 11 | ||||
-rw-r--r-- | src/gsttools/qgstreamerplayercontrol.cpp | 6 | ||||
-rw-r--r-- | src/gsttools/qgstvideorenderersink.cpp | 24 |
3 files changed, 38 insertions, 3 deletions
diff --git a/src/gsttools/qgstcodecsinfo.cpp b/src/gsttools/qgstcodecsinfo.cpp index 512bb828d..c6e61f824 100644 --- a/src/gsttools/qgstcodecsinfo.cpp +++ b/src/gsttools/qgstcodecsinfo.cpp @@ -263,7 +263,16 @@ GList *QGstCodecsInfo::elementFactories(ElementType elementType) const break; } - return gst_element_factory_list_get_elements(gstElementType, GST_RANK_MARGINAL); + GList *list = gst_element_factory_list_get_elements(gstElementType, GST_RANK_MARGINAL); + if (elementType == AudioEncoder) { + // Manually add "audioconvert" to the list + // to allow linking with various containers. + auto factory = gst_element_factory_find("audioconvert"); + if (factory) + list = g_list_prepend(list, factory); + } + + return list; #else GList *result = gst_registry_feature_filter(gst_registry_get_default(), element_filter, diff --git a/src/gsttools/qgstreamerplayercontrol.cpp b/src/gsttools/qgstreamerplayercontrol.cpp index 03350a432..5075b098a 100644 --- a/src/gsttools/qgstreamerplayercontrol.cpp +++ b/src/gsttools/qgstreamerplayercontrol.cpp @@ -225,6 +225,10 @@ void QGstreamerPlayerControl::pause() qDebug() << Q_FUNC_INFO; #endif m_userRequestedState = QMediaPlayer::PausedState; + // If the playback has not been started yet but pause is requested. + // Seek to the beginning to show first frame. + if (m_pendingSeekPosition == -1 && m_session->position() == 0) + m_pendingSeekPosition = 0; playOrPause(QMediaPlayer::PausedState); } @@ -354,7 +358,7 @@ void QGstreamerPlayerControl::setMedia(const QMediaContent &content, QIODevice * m_currentState = QMediaPlayer::StoppedState; QMediaContent oldMedia = m_currentResource; - m_pendingSeekPosition = 0; + m_pendingSeekPosition = -1; m_session->showPrerollFrames(false); // do not show prerolled frames until pause() or play() explicitly called m_setMediaPending = false; diff --git a/src/gsttools/qgstvideorenderersink.cpp b/src/gsttools/qgstvideorenderersink.cpp index 5f71d342c..adcc9a6ce 100644 --- a/src/gsttools/qgstvideorenderersink.cpp +++ b/src/gsttools/qgstvideorenderersink.cpp @@ -656,13 +656,35 @@ void QGstVideoRendererSink::base_init(gpointer g_class) GST_ELEMENT_CLASS(g_class), gst_static_pad_template_get(&sink_pad_template)); } +struct NullSurface : QAbstractVideoSurface +{ + NullSurface(QObject *parent = nullptr) : QAbstractVideoSurface(parent) { } + + QList<QVideoFrame::PixelFormat> supportedPixelFormats(QAbstractVideoBuffer::HandleType) const override + { + return QList<QVideoFrame::PixelFormat>() << QVideoFrame::Format_RGB32; + } + + bool present(const QVideoFrame &) override + { + return true; + } +}; + void QGstVideoRendererSink::instance_init(GTypeInstance *instance, gpointer g_class) { + Q_UNUSED(g_class); VO_SINK(instance); - Q_UNUSED(g_class); + if (!current_surface) { + qWarning() << "Using qtvideosink element without video surface"; + static NullSurface nullSurface; + current_surface = &nullSurface; + } + sink->delegate = new QVideoSurfaceGstDelegate(current_surface); sink->delegate->moveToThread(current_surface->thread()); + current_surface = nullptr; } void QGstVideoRendererSink::finalize(GObject *object) |