gstavviddec doesn't set top field first and repeat field flags in some cases
Submitted by Michael Rubinstein
Link to original bug (#687684)
Description
We're using avdec_mpeg2video to decode MPEG2 from a broadcast encoder. All are content is interlaced. We find that the "top field first" and "repeat first field" flags are not always set in the decoded buffers.
gstavviddec.c only sets GST_VIDEO_BUFFER_FLAG_TFF and GST_VIDEO_BUFFER_FLAG_RFF when it thinks that the content is interlaced.
The code in question is in gst_ffmpegviddec_video_frame().
if (ffmpegdec->ctx_interlaced) {
/* set interlaced flags */
if (ffmpegdec->picture->repeat_pict)
GST_BUFFER_FLAG_SET (out_frame->output_buffer, GST_VIDEO_BUFFER_FLAG_RFF);
if (ffmpegdec->picture->top_field_first)
GST_BUFFER_FLAG_SET (out_frame->output_buffer, GST_VIDEO_BUFFER_FLAG_TFF);
if (ffmpegdec->picture->interlaced_frame)
GST_BUFFER_FLAG_SET (out_frame->output_buffer,
GST_VIDEO_BUFFER_FLAG_INTERLACED);
}
The frames in question have these variables:
progressive_sequence=0
picture_structure=3 (Frame)
progressive_frame=1
The MPEG spec. says that TFF and RFF have meaning in this case.
mpegvideo.c contains this line:
s->current_picture_ptr->f.interlaced_frame = !s->progressive_frame &&
!s->progressive_sequence;
Also, the above definition of interlaced causes our system to renegotiate frequently.
I'm not sure if these frames should be called "interlaced" but the flags should be set. IMHO I don't think we should renegotiate.
Version: 1.0.2