From 8478aa7aed5e8fff021501cb4986bcd20f062e6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 16 Aug 2019 11:58:28 +0300 Subject: [PATCH] video-frame: Take TFF flag from the video info if it was set in there The caps and thus the video info have preference. If the field order is set in there then it applies to all frames. This works around issues where the tff field order is only set in the caps but not additionally in the buffer flags. --- gst-libs/gst/video/video-frame.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/gst-libs/gst/video/video-frame.c b/gst-libs/gst/video/video-frame.c index cb385ce6af..6cef04a8b3 100644 --- a/gst-libs/gst/video/video-frame.c +++ b/gst-libs/gst/video/video-frame.c @@ -138,15 +138,21 @@ gst_video_frame_map_id (GstVideoFrame * frame, GstVideoInfo * info, if (GST_BUFFER_FLAG_IS_SET (buffer, GST_VIDEO_BUFFER_FLAG_INTERLACED)) { frame->flags |= GST_VIDEO_FRAME_FLAG_INTERLACED; } - } else + } else { frame->flags |= GST_VIDEO_FRAME_FLAG_INTERLACED; + } - if (GST_BUFFER_FLAG_IS_SET (buffer, GST_VIDEO_BUFFER_FLAG_TFF)) + if (GST_VIDEO_INFO_FIELD_ORDER (info) == + GST_VIDEO_FIELD_ORDER_TOP_FIELD_FIRST) { frame->flags |= GST_VIDEO_FRAME_FLAG_TFF; - if (GST_BUFFER_FLAG_IS_SET (buffer, GST_VIDEO_BUFFER_FLAG_RFF)) - frame->flags |= GST_VIDEO_FRAME_FLAG_RFF; - if (GST_BUFFER_FLAG_IS_SET (buffer, GST_VIDEO_BUFFER_FLAG_ONEFIELD)) - frame->flags |= GST_VIDEO_FRAME_FLAG_ONEFIELD; + } else { + if (GST_BUFFER_FLAG_IS_SET (buffer, GST_VIDEO_BUFFER_FLAG_TFF)) + frame->flags |= GST_VIDEO_FRAME_FLAG_TFF; + if (GST_BUFFER_FLAG_IS_SET (buffer, GST_VIDEO_BUFFER_FLAG_RFF)) + frame->flags |= GST_VIDEO_FRAME_FLAG_RFF; + if (GST_BUFFER_FLAG_IS_SET (buffer, GST_VIDEO_BUFFER_FLAG_ONEFIELD)) + frame->flags |= GST_VIDEO_FRAME_FLAG_ONEFIELD; + } } return TRUE;