After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 569820 - In some cases v4l2src element does not return correct norm
In some cases v4l2src element does not return correct norm
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
0.10.10
Other Linux
: Normal normal
: 0.10.14
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2009-01-30 13:31 UTC by Brijesh Singh
Modified: 2009-01-30 13:43 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to fix the reported issue (592 bytes, patch)
2009-01-30 13:35 UTC, Brijesh Singh
committed Details | Review

Description Brijesh Singh 2009-01-30 13:31:56 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;
  }
Comment 1 Brijesh Singh 2009-01-30 13:35:10 UTC
Created attachment 127537 [details] [review]
Patch to fix the reported issue
Comment 2 Sebastian Dröge (slomo) 2009-01-30 13:43:23 UTC
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.