mpeg2dec: do not reset the whole video info when setting size
authorVincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Fri, 17 Jan 2014 10:46:50 +0000 (10:46 +0000)
committerVincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Fri, 4 Apr 2014 10:04:03 +0000 (11:04 +0100)
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).

ext/mpeg2dec/gstmpeg2dec.c

index 811e0525595d6af8dd78166396e560a2fe3776df..55ed1441796e08b13b6704aaf4f68ecf0d2c5fb4 100644 (file)
@@ -589,6 +589,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;
@@ -759,7 +760,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 */