diff options
author | He Junyan <junyan.he@intel.com> | 2020-12-30 23:14:01 +0800 |
---|---|---|
committer | Víctor Manuel Jáquez Leal <vjaquez@igalia.com> | 2021-01-04 13:09:01 +0000 |
commit | 41d2edc964cb165f8c1c365415594201ec7a4213 (patch) | |
tree | 01a4e42589a8b26de0c39e776d138bd140485e02 /gst-libs | |
parent | b2b0483d03b0ae08e6df54dc2bf24f4e387bd72b (diff) | |
download | gstreamer-plugins-bad-41d2edc964cb165f8c1c365415594201ec7a4213.tar.gz |
codecs: mpeg2decoder: Creating the field based on its arriving time.
Spec says:
In a frame picture top_field_first being set to ‘1’ indicates that the
top field of the reconstructed frame is the first field output by the
decoding process. top_field_first being set to ‘0’ indicates that the
bottom field of the reconstructed frame is the first field output by
decoding process.
Here, the "output" should be interpreted just as the output order, not
including the decoding order. The field should be decoded as the order
they comes in the stream. Namely, no matter top_field_first is 0 or 1,
the first coming field is the first one to be decoded.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1929>
Diffstat (limited to 'gst-libs')
-rw-r--r-- | gst-libs/gst/codecs/gstmpeg2decoder.c | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/gst-libs/gst/codecs/gstmpeg2decoder.c b/gst-libs/gst/codecs/gstmpeg2decoder.c index 49e88b393..495d68475 100644 --- a/gst-libs/gst/codecs/gstmpeg2decoder.c +++ b/gst-libs/gst/codecs/gstmpeg2decoder.c @@ -779,11 +779,7 @@ gst_mpeg2_decoder_ensure_current_picture (GstMpeg2Decoder * decoder, picture->structure = GST_MPEG_VIDEO_PICTURE_STRUCTURE_FRAME; } else { - gboolean is_first_field = (priv->pic_ext.picture_structure == - GST_MPEG_VIDEO_PICTURE_STRUCTURE_TOP_FIELD) ^ - (priv->pic_ext.top_field_first == 0); - - if (is_first_field) { + if (!priv->first_field) { picture = gst_mpeg2_picture_new (); if (klass->new_picture) ret = klass->new_picture (decoder, priv->current_frame, picture); @@ -796,17 +792,8 @@ gst_mpeg2_decoder_ensure_current_picture (GstMpeg2Decoder * decoder, } else { picture = gst_mpeg2_picture_new (); - if (priv->first_field == NULL) { - GST_WARNING_OBJECT (decoder, "Missing the first field"); - if (klass->new_picture) - ret = klass->new_picture (decoder, priv->current_frame, picture); - } else { - if (klass->new_field_picture) - ret = klass->new_field_picture (decoder, priv->first_field, picture); - - if (ret) - picture->first_field = gst_mpeg2_picture_ref (priv->first_field); - } + if (klass->new_field_picture) + ret = klass->new_field_picture (decoder, priv->first_field, picture); if (!ret) { GST_ERROR_OBJECT (decoder, @@ -815,6 +802,8 @@ gst_mpeg2_decoder_ensure_current_picture (GstMpeg2Decoder * decoder, return FALSE; } + picture->first_field = gst_mpeg2_picture_ref (priv->first_field); + /* At this moment, this picture should be interlaced */ picture->buffer_flags |= GST_VIDEO_BUFFER_FLAG_INTERLACED; if (priv->pic_ext.top_field_first) |