Blob Blame History Raw
--- gst-plugins-good-0.10.31/sys/v4l2/gstv4l2object.c	2011-12-30 14:59:13.000000000 +0100
+++ gst-plugins-good-0.10.31.fixed/sys/v4l2/gstv4l2object.c	2012-06-05 23:45:16.670981047 +0200
@@ -1583,6 +1583,7 @@
 
   if (ival.type == V4L2_FRMIVAL_TYPE_DISCRETE) {
     GValue rate = { 0, };
+    guint i;
 
     g_value_init (&rates, GST_TYPE_LIST);
     g_value_init (&rate, GST_TYPE_FRACTION);
@@ -1602,7 +1603,16 @@
 
       /* swap to get the framerate */
       gst_value_set_fraction (&rate, denom, num);
-      gst_value_list_append_value (&rates, &rate);
+      /* avoid duplicate framerates, yes some hw reports duplicates :( */
+      for (i = 0; i < gst_value_list_get_size(&rates); i++) {
+        const GValue *val = gst_value_list_get_value(&rates, i);
+        if (gst_value_compare(val, &rate) == GST_VALUE_EQUAL) {
+          break;
+        }
+      }
+      if (i == gst_value_list_get_size(&rates)) {
+        gst_value_list_append_value(&rates, &rate);
+      }
 
       ival.index++;
     } while (v4l2_ioctl (fd, VIDIOC_ENUM_FRAMEINTERVALS, &ival) >= 0);