Can't play back WebVTT embedded in WebM/MKV
Originally from: https://gitlab.gnome.org/GNOME/totem/-/issues/511
I made the following changes to GStreamer to get past the "unknown decoder" error, but:
diff --git a/subprojects/gst-plugins-good/gst/matroska/matroska-demux.c b/subprojects/gst-plugins-good/gst/matroska/matroska-demux.c
index 64cc6be60b..9d08fe72fa 100644
--- a/subprojects/gst-plugins-good/gst/matroska/matroska-demux.c
+++ b/subprojects/gst-plugins-good/gst/matroska/matroska-demux.c
@@ -7342,6 +7342,10 @@ gst_matroska_demux_subtitle_caps (GstMatroskaTrackSubtitleContext *
caps = gst_caps_new_empty_simple ("application/x-usf");
context->postprocess_frame = gst_matroska_demux_check_subtitle_buffer;
subtitlecontext->check_markup = FALSE;
+ } else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_SUBTITLE_VTT)) {
+ caps = gst_caps_new_empty_simple ("application/x-subtitle-vtt");
+ context->postprocess_frame = gst_matroska_demux_check_subtitle_buffer;
+ subtitlecontext->check_markup = FALSE;
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_SUBTITLE_VOBSUB)) {
caps = gst_caps_new_empty_simple ("subpicture/x-dvd");
((GstMatroskaTrackContext *) subtitlecontext)->send_dvd_event = TRUE;
diff --git a/subprojects/gst-plugins-good/gst/matroska/matroska-ids.h b/subprojects/gst-plugins-good/gst/matroska/matroska-ids.h
index c4fc73caad..74f2885978 100644
--- a/subprojects/gst-plugins-good/gst/matroska/matroska-ids.h
+++ b/subprojects/gst-plugins-good/gst/matroska/matroska-ids.h
@@ -422,6 +422,7 @@
#define GST_MATROSKA_CODEC_ID_SUBTITLE_SSA "S_TEXT/SSA"
#define GST_MATROSKA_CODEC_ID_SUBTITLE_ASS "S_TEXT/ASS"
#define GST_MATROSKA_CODEC_ID_SUBTITLE_USF "S_TEXT/USF"
+#define GST_MATROSKA_CODEC_ID_SUBTITLE_VTT "D_WEBVTT/SUBTITLES"
#define GST_MATROSKA_CODEC_ID_SUBTITLE_VOBSUB "S_VOBSUB"
#define GST_MATROSKA_CODEC_ID_SUBTITLE_HDMVPGS "S_HDMV/PGS"
#define GST_MATROSKA_CODEC_ID_SUBTITLE_BMP "S_IMAGE/BMP"
But subparse still complains that:
subparse gstsubparseelement.c:205:gst_sub_parse_data_format_autodetect:^[[00m no subtitle format detected
subparse gstsubparse.c:1459:gst_sub_parse_format_autodetect:<parser>^[[00m error: The input is not a valid/supported subtitle file
Because we're missing the re-adding of a header for the purpose of detection, like was done in the qtdemux: https://gitlab.freedesktop.org/hadess/gstreamer/blob/main/subprojects/gst-plugins-good/gst/isomp4/qtdemux.c#L15148-L15151
No idea how to do that with the Matroska demuxer...