diff options
author | Mathieu Duponchelle <mathieu@centricular.com> | 2020-09-04 02:38:58 +0200 |
---|---|---|
committer | Mathieu Duponchelle <mathieu@centricular.com> | 2020-09-09 19:38:58 +0200 |
commit | c07e2a89ba96350965c59a97eaa4b442183fbe6f (patch) | |
tree | 1fae1cb316a556be930d9d1ce7ccf5c54bcf84b2 /ext/closedcaption | |
parent | 1d416750d197473d116689185aa85d0503417a1c (diff) | |
download | gstreamer-plugins-bad-c07e2a89ba96350965c59a97eaa4b442183fbe6f.tar.gz |
line21enc: heavily constrain video height
We can only determine a correct placement for the CC line
with:
* height == 525 (standard NTSC, line 21 / 22)
* height == 486 (NTSC usable lines + 6 lines for VBI, line 1 / 2)
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1554>
Diffstat (limited to 'ext/closedcaption')
-rw-r--r-- | ext/closedcaption/gstline21enc.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/ext/closedcaption/gstline21enc.c b/ext/closedcaption/gstline21enc.c index 424b625c8..6c9d13c09 100644 --- a/ext/closedcaption/gstline21enc.c +++ b/ext/closedcaption/gstline21enc.c @@ -39,7 +39,8 @@ GST_DEBUG_CATEGORY_STATIC (gst_line_21_encoder_debug); #define GST_CAT_DEFAULT gst_line_21_encoder_debug -#define CAPS "video/x-raw, format={ I420, YUY2, YVYU, UYVY, VYUY }, width=(int)720, height=(int)[ 23, MAX ], interlace-mode=interleaved" +/* FIXME: add and test support for PAL resolutions */ +#define CAPS "video/x-raw, format={ I420, YUY2, YVYU, UYVY, VYUY }, width=(int)720, height=(int){ 525, 486 }, interlace-mode=interleaved" static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, @@ -370,6 +371,7 @@ gst_line_21_encoder_transform_ip (GstVideoFilter * filter, vbi_sliced sliced[2]; gpointer iter = NULL; GstFlowReturn ret = GST_FLOW_ERROR; + guint offset; sliced[0].id = VBI_SLICED_CAPTION_525_F1; sliced[0].line = self->sp.start[0]; @@ -447,9 +449,14 @@ gst_line_21_encoder_transform_ip (GstVideoFilter * filter, if (cc_meta) gst_buffer_remove_meta (frame->buffer, (GstMeta *) cc_meta); + /* When dealing with standard NTSC resolution, field 1 goes at line 21, + * when dealing with a reduced height the image has 3 VBI lines at the + * top and 3 at the bottom, and field 1 goes at line 1 */ + offset = self->info.height == 525 ? 21 : 1; + buf = (guint8 *) GST_VIDEO_FRAME_PLANE_DATA (frame, - 0) + 21 * GST_VIDEO_INFO_COMP_STRIDE (&self->info, 0); + 0) + offset * GST_VIDEO_INFO_COMP_STRIDE (&self->info, 0); if (!vbi_raw_video_image (buf, GST_VIDEO_INFO_COMP_STRIDE (&self->info, 0) * 2, &self->sp, 0, 0, 0, 0x000000FF, 0, sliced, 2)) { |