mpeg2dec: do not reset the whole video info when setting size

New changes to gstvideo will reset all the video info state
when calling _set_format, overwriting what was previously set
in the preceding code.

The comment says the following code is meant to preserve the
pre-crop size, so let's just keep the size and related data
 as this does not seem to break anything else (this is what
the _set_format call would have set before the change that
reset all data, except the colorimetry).
This commit is contained in:
Vincent Penquerc'h 2014-01-17 10:46:50 +00:00
parent fffcbfc127
commit 6b887060b1

View file

@ -590,6 +590,7 @@ handle_sequence (GstMpeg2dec * mpeg2dec, const mpeg2_info_t * info)
GstVideoCodecState *state;
GstVideoInfo *dinfo = &mpeg2dec->decoded_info;
GstVideoInfo *vinfo;
GstVideoInfo pre_crop_info;
GstVideoFormat format;
sequence = info->sequence;
@ -760,7 +761,13 @@ handle_sequence (GstMpeg2dec * mpeg2dec, const mpeg2_info_t * info)
/* we store the codec size before cropping */
*dinfo = *vinfo;
gst_video_info_set_format (dinfo, format, sequence->width, sequence->height);
gst_video_info_set_format (&pre_crop_info, format, sequence->width,
sequence->height);
dinfo->width = sequence->width;
dinfo->height = sequence->height;
dinfo->size = pre_crop_info.size;
memcpy (dinfo->stride, pre_crop_info.stride, sizeof (pre_crop_info.stride));
memcpy (dinfo->offset, pre_crop_info.offset, sizeof (pre_crop_info.offset));
/* Mpeg2dec has 2 frame latency to produce a picture and 1 frame latency in
* it's parser */