kateenc: also recognise the new recommended 'SUB' category

Move the check for 'simple' subtitles category to a separate routine
and add in the new recommended SUB category (#525743).
This commit is contained in:
Vincent Penquerc'h 2009-07-20 12:25:15 +01:00 committed by Tim-Philipp Müller
parent 9db1323d31
commit a7c64556ff

View file

@ -525,6 +525,24 @@ gst_kate_enc_set_metadata (GstKateEnc * ke)
} }
} }
static gboolean
gst_kate_enc_is_simple_subtitle_category (GstKateEnc * ke, const char *category)
{
static const char *const simple[] = {
"subtitles",
"SUB",
};
int n;
if (!category)
return FALSE;
for (n = 0; n < G_N_ELEMENTS (simple); ++n) {
if (!strcmp (category, simple[n]))
return TRUE;
}
return FALSE;
}
static GstFlowReturn static GstFlowReturn
gst_kate_enc_send_headers (GstKateEnc * ke) gst_kate_enc_send_headers (GstKateEnc * ke)
{ {
@ -559,7 +577,7 @@ gst_kate_enc_send_headers (GstKateEnc * ke)
} }
if (rflow == GST_FLOW_OK) { if (rflow == GST_FLOW_OK) {
if (ke->category != NULL && strstr (ke->category, "subtitle")) { if (gst_kate_enc_is_simple_subtitle_category (ke, ke->category)) {
caps = gst_kate_util_set_header_on_caps (&ke->element, caps = gst_kate_util_set_header_on_caps (&ke->element,
gst_caps_from_string ("subtitle/x-kate"), headers); gst_caps_from_string ("subtitle/x-kate"), headers);
} else { } else {