summaryrefslogtreecommitdiffstats
path: root/src/gsttools
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-08-13 03:01:49 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-08-13 03:01:49 +0200
commit97213e13cd7f2ccae1d5215bbb503f8f59c0ad22 (patch)
treef5586f079726cf909b48bd9e55fa1b5e18381801 /src/gsttools
parent2da4e162516830f4976f30c789a3fd9511dde932 (diff)
parent075fa6203856bdf9f58e737ee2f5d2a843a85cad (diff)
Merge remote-tracking branch 'origin/5.12' into 5.13
Diffstat (limited to 'src/gsttools')
-rw-r--r--src/gsttools/qgstcodecsinfo.cpp11
-rw-r--r--src/gsttools/qgstreamerplayercontrol.cpp6
-rw-r--r--src/gsttools/qgstvideorenderersink.cpp24
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 73f43f0b9..d49b09af4 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 c3a7a5988..597b97410 100644
--- a/src/gsttools/qgstvideorenderersink.cpp
+++ b/src/gsttools/qgstvideorenderersink.cpp
@@ -486,13 +486,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)