From 79f2c06883701dcdfeb4f4fdf92d504973caf3aa Mon Sep 17 00:00:00 2001 From: Julien Isorce Date: Tue, 31 Dec 2013 16:38:09 +0000 Subject: [PATCH] v4l2object: check if translated format is valid Also add a FIXME in gst_v4l2_object_setup_format to note that the whole function has to be improved in order to support ENCODED formats. It requires to have an encoder device which we do not have right now. https://bugzilla.gnome.org/show_bug.cgi?id=720568 --- sys/v4l2/gstv4l2object.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c index 572ad9eb61..0ecd7b293e 100644 --- a/sys/v4l2/gstv4l2object.c +++ b/sys/v4l2/gstv4l2object.c @@ -2919,9 +2919,6 @@ gst_v4l2_object_setup_format (GstV4l2Object * v4l2object, if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_G_FMT, &fmt) < 0) goto get_fmt_failed; - if (fmt.fmt.pix.width == 0 || fmt.fmt.pix.height == 0) - goto invalid_dimensions; - fmtdesc = gst_v4l2_object_get_format_from_fourcc (v4l2object, fmt.fmt.pix.pixelformat); if (fmtdesc == NULL) @@ -2929,6 +2926,20 @@ gst_v4l2_object_setup_format (GstV4l2Object * v4l2object, /* No need to care about mplane, the four first params are the same */ format = gst_v4l2_object_v4l2fourcc_to_video_format (fmt.fmt.pix.pixelformat); + + /* FIXME do more work in the whole function if + * format is GST_VIDEO_FORMAT_ENCODED + * Also gst_v4l2_object_v4l2fourcc_to_video_format should be improved + * because for now it never returns GST_VIDEO_FORMAT_ENCODED + */ + + /* fails if we do no translate the fmt.pix.pixelformat to GstVideoFormat */ + if (format == GST_VIDEO_FORMAT_UNKNOWN) + goto unsupported_format; + + if (fmt.fmt.pix.width == 0 || fmt.fmt.pix.height == 0) + goto invalid_dimensions; + width = fmt.fmt.pix.width; height = fmt.fmt.pix.height;