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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6153>
This commit is contained in:
Edward Hervey 2024-02-20 16:04:09 +01:00 committed by GStreamer Marge Bot
parent 479c0c5bb4
commit c1d33126aa

View file

@ -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",