v4l2object: Don't validate dimension for encoded format

We set the dimensions just in case but don't validate them
afterwards. For some codecs the dimensions are *not* in the
bitstream, IIRC VC1 in ASF mode for example.

https://bugzilla.gnome.org/show_bug.cgi?id=720568
This commit is contained in:
Nicolas Dufresne 2013-12-02 15:26:50 -05:00
parent 4a85f90c79
commit b80169a16a

View file

@ -2604,13 +2604,18 @@ gst_v4l2_object_set_format (GstV4l2Object * v4l2object, GstCaps * caps)
format.fmt.pix_mp.plane_fmt[i].bytesperline); format.fmt.pix_mp.plane_fmt[i].bytesperline);
#endif #endif
if (format.fmt.pix_mp.width != width
|| format.fmt.pix_mp.height != height)
goto invalid_dimensions;
if (format.fmt.pix_mp.pixelformat != pixelformat) if (format.fmt.pix_mp.pixelformat != pixelformat)
goto invalid_pixelformat; goto invalid_pixelformat;
/* we set the dimensions just in case but don't validate them afterwards
* For some codecs the dimensions are *not* in the bitstream, IIRC VC1
* in ASF mode for example. */
if (info.finfo->format != GST_VIDEO_FORMAT_ENCODED) {
if (format.fmt.pix_mp.width != width
|| format.fmt.pix_mp.height != height)
goto invalid_dimensions;
}
if (format.fmt.pix_mp.num_planes != n_v4l_planes) if (format.fmt.pix_mp.num_planes != n_v4l_planes)
goto invalid_planes; goto invalid_planes;
} }
@ -2659,8 +2664,13 @@ gst_v4l2_object_set_format (GstV4l2Object * v4l2object, GstCaps * caps)
format.fmt.pix.height, GST_FOURCC_ARGS (format.fmt.pix.pixelformat), format.fmt.pix.height, GST_FOURCC_ARGS (format.fmt.pix.pixelformat),
format.fmt.pix.bytesperline); format.fmt.pix.bytesperline);
if (format.fmt.pix.width != width || format.fmt.pix.height != height) /* we set the dimensions just in case but don't validate them afterwards
goto invalid_dimensions; * For some codecs the dimensions are *not* in the bitstream, IIRC VC1
* in ASF mode for example. */
if (info.finfo->format != GST_VIDEO_FORMAT_ENCODED) {
if (format.fmt.pix.width != width || format.fmt.pix.height != height)
goto invalid_dimensions;
}
if (format.fmt.pix.pixelformat != pixelformat) if (format.fmt.pix.pixelformat != pixelformat)
goto invalid_pixelformat; goto invalid_pixelformat;