v4l2: always generate video info from caps
authorMichael Olbrich <m.olbrich@pengutronix.de>
Fri, 3 May 2013 10:46:37 +0000 (12:46 +0200)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Fri, 3 May 2013 11:14:58 +0000 (13:14 +0200)
In the past gst_video_info_from_caps() only video/x-raw. Now it also
supports other video/* and image/* formats.
With this patch the format won't be GST_VIDEO_FORMAT_UNKOWN and
gst_v4l2_buffer_pool_set_config() handles strides correctly.

https://bugzilla.gnome.org/show_bug.cgi?id=699570

sys/v4l2/gstv4l2object.c

index dd9f79b..054505d 100644 (file)
@@ -1423,11 +1423,10 @@ gst_v4l2_object_get_caps_info (GstV4l2Object * v4l2object, GstCaps * caps,
 
   mimetype = gst_structure_get_name (structure);
 
-  if (g_str_equal (mimetype, "video/x-raw")) {
-    /* raw caps, parse into video info */
-    if (!gst_video_info_from_caps (info, caps))
-      goto invalid_format;
+  if (!gst_video_info_from_caps (info, caps))
+    goto invalid_format;
 
+  if (g_str_equal (mimetype, "video/x-raw")) {
     switch (GST_VIDEO_INFO_FORMAT (info)) {
       case GST_VIDEO_FORMAT_I420:
         fourcc = V4L2_PIX_FMT_YUV420;
@@ -1491,9 +1490,6 @@ gst_v4l2_object_get_caps_info (GstV4l2Object * v4l2object, GstCaps * caps,
   } else {
     gboolean dimensions = TRUE;
 
-    /* no video caps, construct videoinfo ourselves */
-    gst_video_info_init (info);
-
     if (g_str_equal (mimetype, "video/mpegts")) {
       fourcc = V4L2_PIX_FMT_MPEG;
       dimensions = FALSE;