diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2019-08-16 11:55:22 +0300 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2019-09-02 12:27:37 +0300 |
commit | 0d1f2113ec9bcea9f8f071c32557f72fb75991c3 (patch) | |
tree | bd7cbba8a8e4034a6891d916316c63f7fc2676da /sys | |
parent | 17edb0e2becb22b6104e9163d06dfe3836a85253 (diff) | |
download | gstreamer-plugins-bad-0d1f2113ec9bcea9f8f071c32557f72fb75991c3.tar.gz |
decklinkvideosrc: Retrieve mode of the ancillary data from the frame
Instead of using the information we stored ourselves for the video frame
itself. Which was also the wrong one: it was the mode from the property,
not the autodetected one.
This fixes vanc extraction with mode=auto
Diffstat (limited to 'sys')
-rw-r--r-- | sys/decklink/gstdecklinkvideosrc.cpp | 19 | ||||
-rw-r--r-- | sys/decklink/gstdecklinkvideosrc.h | 1 |
2 files changed, 15 insertions, 5 deletions
diff --git a/sys/decklink/gstdecklinkvideosrc.cpp b/sys/decklink/gstdecklinkvideosrc.cpp index f048ab3f1..4d0caea4b 100644 --- a/sys/decklink/gstdecklinkvideosrc.cpp +++ b/sys/decklink/gstdecklinkvideosrc.cpp @@ -884,19 +884,24 @@ gst_decklink_video_src_got_frame (GstElement * element, static void extract_cc_from_vbi (GstDecklinkVideoSrc * self, GstBuffer ** buffer, - VideoFrame * vf, const GstDecklinkMode * mode) + VideoFrame * vf) { IDeckLinkVideoFrameAncillary *vanc_frame = NULL; gint fi; guint8 *vancdata; GstVideoFormat videoformat; gboolean found = FALSE; + GstDecklinkModeEnum mode_enum; + const GstDecklinkMode *mode; if (vf->frame->GetAncillaryData (&vanc_frame) != S_OK) return; videoformat = gst_decklink_video_format_from_type (vanc_frame->GetPixelFormat ()); + mode_enum = + gst_decklink_get_mode_enum_from_bmd (vanc_frame->GetDisplayMode ()); + mode = gst_decklink_get_mode (mode_enum); if (videoformat == GST_VIDEO_FORMAT_UNKNOWN) { GST_DEBUG_OBJECT (self, "Unknown video format for Ancillary data"); @@ -904,7 +909,8 @@ extract_cc_from_vbi (GstDecklinkVideoSrc * self, GstBuffer ** buffer, return; } - if (videoformat != self->anc_vformat && self->vbiparser) { + if ((videoformat != self->anc_vformat || mode->width != self->anc_width) + && self->vbiparser) { gst_video_vbi_parser_free (self->vbiparser); self->vbiparser = NULL; } @@ -922,6 +928,7 @@ extract_cc_from_vbi (GstDecklinkVideoSrc * self, GstBuffer ** buffer, if (self->vbiparser == NULL) { self->vbiparser = gst_video_vbi_parser_new (videoformat, mode->width); self->anc_vformat = videoformat; + self->anc_width = mode->width; } GST_DEBUG_OBJECT (self, "Might have data on line %d", fi); gst_video_vbi_parser_add_line (self->vbiparser, vancdata); @@ -1085,6 +1092,7 @@ gst_decklink_video_src_create (GstPushSrc * bsrc, GstBuffer ** buffer) gst_video_vbi_parser_free (self->vbiparser); self->vbiparser = NULL; self->anc_vformat = GST_VIDEO_FORMAT_UNKNOWN; + self->anc_width = 0; } } @@ -1119,12 +1127,10 @@ gst_decklink_video_src_create (GstPushSrc * bsrc, GstBuffer ** buffer) } } - mode = gst_decklink_get_mode (self->mode); - // If we have a format that supports VANC and we are asked to extract CC, // then do it here. if (self->output_cc && mode->vanc && !self->no_signal) - extract_cc_from_vbi (self, buffer, vf, mode); + extract_cc_from_vbi (self, buffer, vf); if (f.no_signal) GST_BUFFER_FLAG_SET (*buffer, GST_BUFFER_FLAG_GAP); @@ -1139,6 +1145,7 @@ gst_decklink_video_src_create (GstPushSrc * bsrc, GstBuffer ** buffer) gst_static_caps_get (&hardware_reference), f.hardware_timestamp, f.hardware_duration); + mode = gst_decklink_get_mode (self->caps_mode); if (mode->interlaced && mode->tff) GST_BUFFER_FLAG_SET (*buffer, GST_VIDEO_BUFFER_FLAG_TFF | GST_VIDEO_BUFFER_FLAG_INTERLACED); @@ -1293,6 +1300,7 @@ gst_decklink_video_src_stop (GstDecklinkVideoSrc * self) gst_video_vbi_parser_free (self->vbiparser); self->vbiparser = NULL; self->anc_vformat = GST_VIDEO_FORMAT_UNKNOWN; + self->anc_width = 0; } return TRUE; @@ -1360,6 +1368,7 @@ gst_decklink_video_src_change_state (GstElement * element, } self->vbiparser = NULL; self->anc_vformat = GST_VIDEO_FORMAT_UNKNOWN; + self->anc_width = 0; break; case GST_STATE_CHANGE_READY_TO_PAUSED: self->flushing = FALSE; diff --git a/sys/decklink/gstdecklinkvideosrc.h b/sys/decklink/gstdecklinkvideosrc.h index 1ac960230..ff651738c 100644 --- a/sys/decklink/gstdecklinkvideosrc.h +++ b/sys/decklink/gstdecklinkvideosrc.h @@ -98,6 +98,7 @@ struct _GstDecklinkVideoSrc GstVideoVBIParser *vbiparser; GstVideoFormat anc_vformat; + gint anc_width; gboolean output_cc; guint last_cc_vbi_line; }; |