discoverer: Consider closedcaption/ as subtitles and improve subtitle caps detection

Generally all subtitle/, subpicture/, text/, closedcaption/ and
application/x-subtitle caps instead of hardcoding a small set of caps.

https://bugzilla.gnome.org/show_bug.cgi?id=797072
This commit is contained in:
Sebastian Dröge 2018-09-04 11:55:03 +03:00
parent 595dd27ede
commit 14031f1c63

View file

@ -544,17 +544,30 @@ _event_probe (GstPad * pad, GstPadProbeInfo * info, PrivateStream * ps)
return GST_PAD_PROBE_OK;
}
static GstStaticCaps subtitle_caps = GST_STATIC_CAPS ("text/x-raw; "
"subpicture/x-pgs; subpicture/x-dvb; subpicture/x-dvd; "
"application/x-subtitle-unknown; application/x-ssa; application/x-ass; "
"subtitle/x-kate; application/x-kate; subpicture/x-xsub");
static GstStaticCaps subtitle_caps =
GST_STATIC_CAPS
("application/x-ssa; application/x-ass; application/x-kate");
static gboolean
is_subtitle_caps (const GstCaps * caps)
{
GstCaps *subs_caps;
GstStructure *s;
const gchar *name;
gboolean ret;
s = gst_caps_get_structure (caps, 0);
if (!s)
return FALSE;
name = gst_structure_get_name (s);
if (g_str_has_prefix (name, "text/") ||
g_str_has_prefix (name, "subpicture/") ||
g_str_has_prefix (name, "subtitle/") ||
g_str_has_prefix (name, "closedcaption/") ||
g_str_has_prefix (name, "application/x-subtitle"))
return TRUE;
subs_caps = gst_static_caps_get (&subtitle_caps);
ret = gst_caps_can_intersect (caps, subs_caps);
gst_caps_unref (subs_caps);