From ff3cce38b6ac54feb19bb93d36ed0337c7c15442 Mon Sep 17 00:00:00 2001 From: Mathieu Duponchelle Date: Fri, 22 Jan 2021 23:54:50 +0100 Subject: line21dec: relax caps requirements Instead of requiring interlaced video, simply skip CC detection when the input is progressive. This allows placing line21decoder unconditionally in pipelines, without having to worry about whether the input stream will be interlaced, or even worse interlacing just in case! + update doc cache Part-of: --- docs/plugins/gst_plugins_cache.json | 51 ++++++++++++++++++++++++++++++++++--- ext/closedcaption/gstline21dec.c | 10 +++++++- 2 files changed, 57 insertions(+), 4 deletions(-) diff --git a/docs/plugins/gst_plugins_cache.json b/docs/plugins/gst_plugins_cache.json index 02da7405d..9a484b301 100644 --- a/docs/plugins/gst_plugins_cache.json +++ b/docs/plugins/gst_plugins_cache.json @@ -3451,17 +3451,42 @@ "long-name": "Line 21 CC Decoder", "pad-templates": { "sink": { - "caps": "video/x-raw:\n format: { I420, YUY2, YVYU, UYVY, VYUY, v210 }\n interlace-mode: interleaved\n", + "caps": "video/x-raw:\n format: { I420, YUY2, YVYU, UYVY, VYUY, v210 }\n", "direction": "sink", "presence": "always" }, "src": { - "caps": "video/x-raw:\n format: { I420, YUY2, YVYU, UYVY, VYUY, v210 }\n interlace-mode: interleaved\n", + "caps": "video/x-raw:\n format: { I420, YUY2, YVYU, UYVY, VYUY, v210 }\n", "direction": "src", "presence": "always" } }, - "properties": {}, + "properties": { + "mode": { + "blurb": "Control whether and how detected CC meta should be inserted in the list of existing CC meta on a frame (if any).", + "conditionally-available": false, + "construct": false, + "construct-only": false, + "controllable": false, + "default": "add (0)", + "mutable": "null", + "readable": true, + "type": "GstLine21DecoderMode", + "writable": true + }, + "ntsc-only": { + "blurb": "Whether line 21 decoding should only be attempted when the input resolution matches NTSC", + "conditionally-available": false, + "construct": false, + "construct-only": false, + "controllable": false, + "default": "false", + "mutable": "null", + "readable": true, + "type": "gboolean", + "writable": true + } + }, "rank": "none" }, "line21encoder": { @@ -3554,6 +3579,26 @@ "value": "3" } ] + }, + "GstLine21DecoderMode": { + "kind": "enum", + "values": [ + { + "desc": "add new CC meta on top of other CC meta, if any", + "name": "add", + "value": "0" + }, + { + "desc": "ignore CC if a CC meta was already present", + "name": "drop", + "value": "1" + }, + { + "desc": "replace existing CC meta", + "name": "replace", + "value": "2" + } + ] } }, "package": "GStreamer Bad Plug-ins", diff --git a/ext/closedcaption/gstline21dec.c b/ext/closedcaption/gstline21dec.c index 489bd0098..4e5b7702c 100644 --- a/ext/closedcaption/gstline21dec.c +++ b/ext/closedcaption/gstline21dec.c @@ -56,7 +56,7 @@ enum #define DEFAULT_NTSC_ONLY FALSE #define DEFAULT_MODE GST_LINE_21_DECODER_MODE_ADD -#define CAPS "video/x-raw, format={ I420, YUY2, YVYU, UYVY, VYUY, v210 }, interlace-mode=interleaved" +#define CAPS "video/x-raw, format={ I420, YUY2, YVYU, UYVY, VYUY, v210 }" static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, @@ -216,6 +216,8 @@ gst_line_21_decoder_class_init (GstLine21DecoderClass * klass) GST_DEBUG_CATEGORY_INIT (gst_line_21_decoder_debug, "line21decoder", 0, "Line 21 CC Decoder"); vbi_initialize_gst_debug (); + + gst_type_mark_as_plugin_api (GST_TYPE_LINE_21_DECODER_MODE, 0); } static void @@ -288,6 +290,12 @@ gst_line_21_decoder_set_info (GstVideoFilter * filter, /* Scan the next frame from the first line */ self->line21_offset = -1; + if (!GST_VIDEO_INFO_IS_INTERLACED (in_info)) { + GST_DEBUG_OBJECT (filter, "Only interlaced formats are supported"); + self->compatible_format = FALSE; + return TRUE; + } + if (GST_VIDEO_INFO_WIDTH (in_info) != 720) { GST_DEBUG_OBJECT (filter, "Only 720 pixel wide formats are supported"); self->compatible_format = FALSE; -- cgit v1.2.1