mpeg2dec: Correctly flag output buffer interlaced state

If the sequence is not flagged as progressive its buffers are marked
interlace mode mixed. There is an individual picture flag indicating
whether picture in the sequence are interlaced or not. This is used
along with the new GST_VIDEO_BUFFER_FLAG_INTERLACED to correctly and
completely indicate the buffer's interlaced state.

Also, TFF and RFF should only be set if the sequence is not progressive.
This commit is contained in:
Robert Swain 2012-07-23 11:13:05 +02:00
parent a20ba81f9a
commit 870fe4e7ec

View file

@ -813,15 +813,21 @@ handle_picture (GstMpeg2dec * mpeg2dec, const mpeg2_info_t * info,
GST_DEBUG_OBJECT (mpeg2dec, "picture %s, frame %i",
key_frame ? ", kf," : " ", frame->system_frame_number);
if (GST_VIDEO_INFO_IS_INTERLACED (&frame->info)) {
// This implies SEQ_FLAG_PROGRESSIVE_SEQUENCE is not set
if (picture->flags & PIC_FLAG_TOP_FIELD_FIRST) {
GST_BUFFER_FLAG_SET (buffer, GST_VIDEO_BUFFER_FLAG_TFF);
}
if (!(picture->flags & PIC_FLAG_PROGRESSIVE_FRAME)) {
GST_BUFFER_FLAG_SET (buffer, GST_VIDEO_BUFFER_FLAG_INTERLACED);
}
#if MPEG2_RELEASE >= MPEG2_VERSION(0,5,0)
/* repeat field introduced in 0.5.0 */
if (picture->flags & PIC_FLAG_REPEAT_FIRST_FIELD) {
GST_BUFFER_FLAG_SET (buffer, GST_VIDEO_BUFFER_FLAG_RFF);
}
#endif
}
if (mpeg2dec->discont_state == MPEG2DEC_DISC_NEW_PICTURE && key_frame) {
mpeg2dec->discont_state = MPEG2DEC_DISC_NEW_KEYFRAME;