From c1d33126aa1778012f9c7665eb64bf3f9b52cb6f Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Tue, 20 Feb 2024 16:04:09 +0100 Subject: [PATCH] playbin3: Inform (uri)decodebin3 of the subtitle caps from playsink Subtitles are better handled by overlayers/renderers within playsink. By informing (uri)decodebin3 of the formats that can be handled we can avoid those being "decoded" too early. Fixes #1081 Part-of: --- .../gst-plugins-base/gst/playback/gstplaybin3.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/subprojects/gst-plugins-base/gst/playback/gstplaybin3.c b/subprojects/gst-plugins-base/gst/playback/gstplaybin3.c index 51cf97b8a1..047f558954 100644 --- a/subprojects/gst-plugins-base/gst/playback/gstplaybin3.c +++ b/subprojects/gst-plugins-base/gst/playback/gstplaybin3.c @@ -1058,6 +1058,8 @@ colorbalance_value_changed_cb (GstColorBalance * balance, static void gst_play_bin3_init (GstPlayBin3 * playbin) { + GstCaps *uridecodebin_caps, *subtitle_caps; + g_rec_mutex_init (&playbin->lock); /* assume we can create an input-selector */ @@ -1073,6 +1075,14 @@ gst_play_bin3_init (GstPlayBin3 * playbin) gst_bin_add (GST_BIN_CAST (playbin), GST_ELEMENT_CAST (playbin->uridecodebin)); + /* Make sure uridecodebin3 knows of all the subtitle formats that playsink can + * handle as-is */ + subtitle_caps = gst_subtitle_overlay_create_factory_caps (); + g_object_get (playbin->uridecodebin, "caps", &uridecodebin_caps, NULL); + uridecodebin_caps = gst_caps_merge (uridecodebin_caps, subtitle_caps); + g_object_set (playbin->uridecodebin, "caps", uridecodebin_caps, NULL); + gst_caps_unref (uridecodebin_caps); + g_signal_connect (playbin->uridecodebin, "pad-added", G_CALLBACK (pad_added_cb), playbin); g_signal_connect (playbin->uridecodebin, "pad-removed",