codecs: Add buffer_flags for mpeg2 picture.

We need to store the buffer flags such as GST_VIDEO_BUFFER_FLAG_INTERLACED
and GST_VIDEO_BUFFER_FLAG_TFF for interlaced video. Without these flags,
the VPP and display elements can not apply filter correctly.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1929>
This commit is contained in:
He Junyan 2021-01-01 15:56:03 +08:00 committed by Víctor Manuel Jáquez Leal
parent 339a816c81
commit 459abad096
2 changed files with 8 additions and 0 deletions

View file

@ -814,6 +814,11 @@ gst_mpeg2_decoder_ensure_current_picture (GstMpeg2Decoder * decoder,
gst_mpeg2_picture_unref (picture);
return FALSE;
}
/* At this moment, this picture should be interlaced */
picture->buffer_flags |= GST_VIDEO_BUFFER_FLAG_INTERLACED;
if (priv->pic_ext.top_field_first)
picture->buffer_flags |= GST_VIDEO_BUFFER_FLAG_TFF;
}
picture->structure = priv->pic_ext.picture_structure;

View file

@ -23,6 +23,7 @@
#include <gst/codecs/codecs-prelude.h>
#include <gst/codecparsers/gstmpegvideoparser.h>
#include <gst/video/video.h>
G_BEGIN_DECLS
@ -82,6 +83,8 @@ struct _GstMpeg2Picture
/* For interlaced streams */
GstMpeg2Picture *first_field;
GstVideoBufferFlags buffer_flags;
gint pic_order_cnt;
gint tsn;
GstMpegVideoPictureStructure structure;