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 628118 - wrong format detection in gstv4l2object.c
wrong format detection in gstv4l2object.c
Status: RESOLVED INCOMPLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
0.10.28
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2010-08-27 12:29 UTC by Jean-Philippe Francois
Modified: 2010-12-08 02:40 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Jean-Philippe Francois 2010-08-27 12:29:10 UTC
I have a v4l2 camera, which supports only the UYVY format.
When using the v4l2src source element, the format detection loop in

gst_v4l2_object_fill_format_list :

  /* format enumeration */
  for (n = 0;; n++) {
    format = g_new0 (struct v4l2_fmtdesc, 1);

    format->index = n;
    format->type = v4l2object->type;

    if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_ENUM_FMT, format) < 0) {
      if (errno == EINVAL) {
        g_free (format);
        break;                  /* end of enumeration */
      } else {
        goto failed;
      }
    }
    ---- some logging ---
    v4l2object->formats = g_slist_insert_sorted (v4l2object->formats, format,
        (GCompareFunc) format_cmp_func);
  }


On the "kernel side", ie using printk and strace, I see only one  (successful) call to ENUM_FMT.

On the library side, however, the code is looping five time. In GDB, i can see n being incremented to 5, but it seems the ioctl line is skipped after the first loop. If logging is enabled, I can also see the log output five time, and finally, when looking at the caps of the source pad, I can see the good format, plus the other four ones.

What is more strange is that the loop exits without an invalid ENUM_FMT ioctl call, 

Since the code (as I understand it) and the program behaviour disagree, I am stuck here.

This is with gstreamer 0.10.28, the plugin-good version is 0.10.21, and all
this is from the ubuntu 10.04 gstreamer packages
Comment 1 Jean-Philippe Francois 2010-08-27 12:50:10 UTC
If I manually compile version 0.10.21, using the source tarball, and configure / make, the libgstvideo4linux2.so generated behave correctly, so it looks like an ubuntu bug.

However it now spits message like :
(gst-plugin-scanner:8643): GLib-GObject-WARNING **: cannot register existing type `GstV4l2Src'

(gst-plugin-scanner:8643): GLib-GObject-CRITICAL **: g_type_add_interface_static: assertion `G_TYPE_IS_INSTANTIATABLE (instance_type)' failed

(gst-plugin-scanner:8643): GLib-GObject-CRITICAL **: g_type_add_interface_static: assertion `G_TYPE_IS_INSTANTIATABLE (instance_type)' failed

(gst-plugin-scanner:8643): GLib-GObject-CRITICAL **: g_type_add_interface_static: assertion `G_TYPE_IS_INSTANTIATABLE (instance_type)' failed

(gst-plugin-scanner:8643): GLib-GObject-CRITICAL **: g_type_add_interface_static: assertion `G_TYPE_IS_INSTANTIATABLE (instance_type)' failed

(gst-plugin-scanner:8643): GLib-GObject-CRITICAL **: g_type_add_interface_static: assertion `G_TYPE_IS_INSTANTIATABLE (instance_type)' failed

(gst-plugin-scanner:8643): GLib-GObject-CRITICAL **: g_type_add_interface_static: assertion `G_TYPE_IS_INSTANTIATABLE (instance_type)' failed

(gst-plugin-scanner:8643): GLib-CRITICAL **: g_once_init_leave: assertion `initialization_value != 0' failed

(gst-plugin-scanner:8643): GStreamer-CRITICAL **: gst_element_register: assertion `g_type_is_a (type, GST_TYPE_ELEMENT)' failed


How can I get rid of them ?
Comment 2 Sebastian Dröge (slomo) 2010-08-30 13:26:13 UTC
This is probably caused by libv4l then. The Ubuntu packages use libv4l, which abstracts the v4l interface and probably has some magic for the format enumeration.

I assume your own compiled version doesn't use libv4l?


(You can get rid of the warnings if you don't have two versions of the v4l plugin installed)
Comment 3 Tim-Philipp Müller 2010-08-30 17:33:32 UTC
> This is with gstreamer 0.10.28, the plugin-good version is 0.10.21, and all
> this is from the ubuntu 10.04 gstreamer packages

I'm not really sure what problem/bug you're trying to solve here exact, but whatever it is, you should probably try the lastest pre-release, or at least the last release first..
Comment 4 Jean-Philippe Francois 2010-08-31 07:53:32 UTC
It seems to be an ubuntu specific problem, since compiling from source
gives me a working enumeration
Comment 5 Sebastian Dröge (slomo) 2010-08-31 08:16:42 UTC
(In reply to comment #4)
> It seems to be an ubuntu specific problem, since compiling from source
> gives me a working enumeration

Is your own compilation using libv4l too?
Comment 6 Fabio Durán Verdugo 2010-12-08 02:40:51 UTC
Closing this bug report as no further information has been provided. Please feel free to reopen this bug if you can provide the information asked for.
Thanks!