diff options
author | Tim Blechmann <tim@klingt.org> | 2024-04-02 10:26:05 +0800 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2024-04-04 09:27:15 +0000 |
commit | f200769f1d9db045780632bbd47031076c163591 (patch) | |
tree | ff6b78fc259a61b93e499ac2ceb5336b0b58a36c | |
parent | 8d099d2a7984867e84c90b7801aa202050bf5d11 (diff) |
GStreamer: fix playbin to pipeline cast
we need to install the `pipeline-private` handler if we want to install
message filters
Pick-to: 6.5
Change-Id: Ie423abc43fb835273877866e2916f0d8f99f0c2e
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
(cherry picked from commit 72b13de749fb94520fb211b81c3d70a27d99cca0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 9a203acf0de715056392f4d21c6988f5775d4751)
3 files changed, 8 insertions, 3 deletions
diff --git a/src/plugins/multimedia/gstreamer/audio/qgstreameraudiodecoder.cpp b/src/plugins/multimedia/gstreamer/audio/qgstreameraudiodecoder.cpp index 9c1983d7a..a0d054b27 100644 --- a/src/plugins/multimedia/gstreamer/audio/qgstreameraudiodecoder.cpp +++ b/src/plugins/multimedia/gstreamer/audio/qgstreameraudiodecoder.cpp @@ -43,9 +43,8 @@ QMaybe<QPlatformAudioDecoder *> QGstreamerAudioDecoder::create(QAudioDecoder *pa if (!audioconvert) return errorMessageCannotFindElement("audioconvert"); - QGstPipeline playbin( - GST_PIPELINE_CAST(QGstElement::createFromFactory("playbin", "playbin").element()), - QGstPipeline::NeedsRef); + QGstPipeline playbin = QGstPipeline::adopt( + GST_PIPELINE_CAST(QGstElement::createFromFactory("playbin", "playbin").element())); if (!playbin) return errorMessageCannotFindElement("playbin"); diff --git a/src/plugins/multimedia/gstreamer/common/qgstpipeline.cpp b/src/plugins/multimedia/gstreamer/common/qgstpipeline.cpp index 04852c542..f28eccc00 100644 --- a/src/plugins/multimedia/gstreamer/common/qgstpipeline.cpp +++ b/src/plugins/multimedia/gstreamer/common/qgstpipeline.cpp @@ -158,7 +158,11 @@ void QGstPipelinePrivate::removeMessageFilter(QGstreamerBusMessageFilter *filter QGstPipeline QGstPipeline::create(const char *name) { GstPipeline *pipeline = qGstCheckedCast<GstPipeline>(gst_pipeline_new(name)); + return adopt(pipeline); +} +QGstPipeline QGstPipeline::adopt(GstPipeline *pipeline) +{ QGstPipelinePrivate *d = new QGstPipelinePrivate(gst_pipeline_get_bus(pipeline)); g_object_set_data_full(qGstCheckedCast<GObject>(pipeline), "pipeline-private", d, [](gpointer ptr) { diff --git a/src/plugins/multimedia/gstreamer/common/qgstpipeline_p.h b/src/plugins/multimedia/gstreamer/common/qgstpipeline_p.h index d04bd84d8..23610dd00 100644 --- a/src/plugins/multimedia/gstreamer/common/qgstpipeline_p.h +++ b/src/plugins/multimedia/gstreamer/common/qgstpipeline_p.h @@ -50,7 +50,9 @@ public: QGstPipeline(GstPipeline *, RefMode mode); ~QGstPipeline(); + // installs QGstPipelinePrivate as "pipeline-private" gobject property static QGstPipeline create(const char *name); + static QGstPipeline adopt(GstPipeline *); // This is needed to help us avoid sending QVideoFrames or audio buffers to the // application while we're prerolling the pipeline. |