Include field-order in the caps for interlaced formats

This commit is contained in:
Sebastian Dröge 2021-12-10 11:05:55 +02:00
parent 083aa0bc86
commit a122044e2c
2 changed files with 23 additions and 0 deletions

View file

@ -266,6 +266,7 @@ bool gst_video_info_from_ntv2_video_format(GstVideoInfo *info,
NTV2VideoFormat format) {
if (format == NTV2_FORMAT_UNKNOWN) return false;
NTV2Standard standard = ::GetNTV2StandardFromVideoFormat(format);
guint width = ::GetDisplayWidth(format);
guint height = ::GetDisplayHeight(format);
NTV2FrameRate fps = ::GetNTV2FrameRateFromVideoFormat(format);
@ -286,6 +287,17 @@ bool gst_video_info_from_ntv2_video_format(GstVideoInfo *info,
? GST_VIDEO_INTERLACE_MODE_INTERLEAVED
: GST_VIDEO_INTERLACE_MODE_PROGRESSIVE;
if (!::IsProgressiveTransport(format)) {
NTV2SmpteLineNumber line_number = ::GetSmpteLineNumber(standard);
if (line_number.firstFieldTop) {
GST_VIDEO_INFO_FIELD_ORDER(info) = GST_VIDEO_FIELD_ORDER_TOP_FIELD_FIRST;
} else {
GST_VIDEO_INFO_FIELD_ORDER(info) =
GST_VIDEO_FIELD_ORDER_BOTTOM_FIELD_FIRST;
}
}
return true;
}

View file

@ -1818,6 +1818,17 @@ static GstFlowReturn gst_aja_src_create(GstPushSrc *psrc, GstBuffer **buffer) {
gst_caps_unref(caps);
}
if (self->configured_info.interlace_mode !=
GST_VIDEO_INTERLACE_MODE_PROGRESSIVE) {
GST_BUFFER_FLAG_SET(*buffer, GST_VIDEO_BUFFER_FLAG_INTERLACED);
switch (GST_VIDEO_INFO_FIELD_ORDER(&self->configured_info)) {
case GST_VIDEO_FIELD_ORDER_TOP_FIELD_FIRST:
GST_BUFFER_FLAG_SET(*buffer, GST_VIDEO_BUFFER_FLAG_TFF);
default:
break;
}
}
GST_TRACE_OBJECT(self, "Outputting buffer %" GST_PTR_FORMAT, *buffer);
return flow_ret;