GNOME Bugzilla – Bug 569820
In some cases v4l2src element does not return correct norm
Last modified: 2009-01-30 13:43:23 UTC
I was porting v4l2src element on TI Davinci platform and found a possible bug in v4l2src element. v4l2src creates a list of supported norms by using VIDIOC_ENUMSTD ioctl and then it calls gst_v4l2_get_norm() to get the current norms and finally compares "if (norm == GST_V4L2_TUNER_NORM (item->data)->index)" to return the select norm object/ This comparison will not always return correct standard probed via the driver. because its possible that driver returns the subset of a known standard instead of the real-standard. e.g NTSC instead of NTSC_M. see v4l2 spec on why: http://www.linuxtv.org/downloads/video4linux/API/V4L2_API/spec-single/v4l2.html#STANDARD The spec has a example showing how the comparison is done. A very small patch to fix this: diff -uNr orig/gst-plugins-good-0.10.10/sys/v4l2/gstv4l2tuner.c gst-plugins-good-0.10.10/sys/v4l2/gstv4l2tuner.c --- orig/gst-plugins-good-0.10.10/sys/v4l2/gstv4l2tuner.c 2007-07-18 06:42:33.000000000 -0500 +++ gst-plugins-good-0.10.10/sys/v4l2/gstv4l2tuner.c 2009-01-29 16:11:21.000000000 -0600 @@ -244,7 +244,7 @@ gst_v4l2_get_norm (v4l2object, &norm); for (item = v4l2object->norms; item != NULL; item = item->next) { - if (norm == GST_V4L2_TUNER_NORM (item->data)->index) + if (norm & GST_V4L2_TUNER_NORM (item->data)->index) return (GstTunerNorm *) item->data; }
Created attachment 127537 [details] [review] Patch to fix the reported issue
commit 74f84ae47fb4a82682769aff7ce63f181b70d483 Author: Brijesh Singh <brijesh.ksingh@gmail.com> Date: Fri Jan 30 14:40:51 2009 +0100 Fix comparison of the tuner norms The V4L2 tuner norms that a device supports could be a subset of some norm (e.g. NTSC instead of NTSC_M). The comparison should be done by & instead of ==. See http://www.linuxtv.org/downloads/video4linux/API/V4L2_API/spec-single/v4l2.html#STANDARD Fixes bug #569820.