From a7c64556ff25eae0ca3325dbbe166352b9b03006 Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Mon, 20 Jul 2009 12:25:15 +0100 Subject: [PATCH] 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). --- ext/kate/gstkateenc.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/ext/kate/gstkateenc.c b/ext/kate/gstkateenc.c index 6cc1f492fe..b9db9cda8b 100644 --- a/ext/kate/gstkateenc.c +++ b/ext/kate/gstkateenc.c @@ -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 gst_kate_enc_send_headers (GstKateEnc * ke) { @@ -559,7 +577,7 @@ gst_kate_enc_send_headers (GstKateEnc * ke) } 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, gst_caps_from_string ("subtitle/x-kate"), headers); } else { -- 2.34.1