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 723446 - v4l2src: Should detect support for mplanar formats during runtime
v4l2src: Should detect support for mplanar formats during runtime
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
git master
Other Linux
: Normal blocker
: 1.3.1
Assigned To: Nicolas Dufresne (ndufresne)
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-02-02 01:14 UTC by Dan Kegel
Modified: 2014-03-28 19:37 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch 1/2: Remove an obsolete section from configure.ac (1.34 KB, patch)
2014-02-02 01:14 UTC, Dan Kegel
needs-work Details | Review
patch 2/2: update header up-to-date check for v4l2 (1.55 KB, patch)
2014-02-02 01:15 UTC, Dan Kegel
needs-work Details | Review
patch 1/2: Remove an obsolete section from configure.ac (try 2) (1.33 KB, patch)
2014-02-02 19:06 UTC, Dan Kegel
committed Details | Review
patch 2/2: update header up-to-date check for v4l2 (try 2) (1.52 KB, patch)
2014-02-02 19:07 UTC, Dan Kegel
needs-work Details | Review
3rd try. AC_CHECK_TYPE argument order now correct. Build verified on ubuntu 10.04 against g62f5a27. (1.12 KB, patch)
2014-02-21 19:30 UTC, Dan Kegel
committed Details | Review

Description Dan Kegel 2014-02-02 01:14:36 UTC
Created attachment 267816 [details] [review]
patch 1/2: Remove an obsolete section from configure.ac

(Our shop supports the two most recent Ubuntu LTS releases, but uses
bleeding edge gstreamer, so we still care about ubuntu 10.04 for
a few more months.)

Since commit 
http://cgit.freedesktop.org/gstreamer/gst-plugins-good/commit/sys/v4l2/gstv4l2bufferpool.h?id=61ae84b50dc319a53b513e5474c1578d7127c67c
(which fixed bug 712754 ),
gst-plugins-good fails to build on Ubuntu 10.04 because symbol
struct v4l2_plane is defined /usr/include/linux/videodev2.h
from package linux-libc-dev in Ubuntu 12.04, but not in Ubuntu 10.04.

Here's a two part series that addresses the build breakage
by skipping v4l2 if the header is too old, and removes
a related but obsolete section in configure.ac.
Comment 1 Dan Kegel 2014-02-02 01:15:09 UTC
Created attachment 267817 [details] [review]
patch 2/2: update header up-to-date check for v4l2
Comment 2 Tim-Philipp Müller 2014-02-02 12:09:52 UTC
Please fix the first patch that removes the obsolete check so that things still build after it (it looks like the second patches fixes up the superfluous 'fi' then).
Comment 3 Dan Kegel 2014-02-02 19:06:40 UTC
Created attachment 267861 [details] [review]
patch 1/2: Remove an obsolete section from configure.ac (try 2)

That *was* crap, wasn't it?  This should look better.
Comment 4 Dan Kegel 2014-02-02 19:07:14 UTC
Created attachment 267862 [details] [review]
patch 2/2: update header up-to-date check for v4l2 (try 2)
Comment 5 Sebastian Dröge (slomo) 2014-02-04 13:09:05 UTC
Comment on attachment 267862 [details] [review]
patch 2/2: update header up-to-date check for v4l2 (try 2)

Nope, this breaks here on Debian/unstable:

configure:29842: checking linux/videodev2.h usability
configure:29842: gcc-4.8 -std=gnu99 -c -g -O2  conftest.c >&5
configure:29842: $? = 0
configure:29842: result: yes
configure:29842: checking linux/videodev2.h presence
configure:29842: cpp-4.8  conftest.c
configure:29842: $? = 0
configure:29842: result: yes
configure:29842: checking for linux/videodev2.h
configure:29842: result: yes
configure:29859: WARNING: video4linux2 headers were found, but they're old.
configure:29861: WARNING: Please update v4l2 to compile the v4l2 plugins
configure:29996: *** These plugins will not be built: v4l2src
Comment 6 Sebastian Dröge (slomo) 2014-02-04 13:10:47 UTC
Problem is that the test program created is broken, note the first line:

| HAVE_V4L2_PLANE=yes
| 
| int
| main ()
| {
| if (sizeof (struct v4l2_plane))
| 	 return 0;
|   ;
|   return 0;
| }
Comment 7 Sebastian Dröge (slomo) 2014-02-04 13:11:27 UTC
Comment on attachment 267861 [details] [review]
patch 1/2: Remove an obsolete section from configure.ac (try 2)

commit 99bf36b55d33de8c46fc4722540297417b6b72c6
Author: Dan Kegel <dank@kegel.com>
Date:   Sun Feb 2 09:57:03 2014 -0800

    v4l2: Remove obsolete definition GST_V4L2_MISSING_BUFDECL
    
    The only use was removed by 9edc0c0365f79ab07ff2e65461c6696e3931a3f0
    
    https://bugzilla.gnome.org/show_bug.cgi?id=723446
Comment 8 Sebastian Dröge (slomo) 2014-02-10 16:08:29 UTC
*** Bug 724045 has been marked as a duplicate of this bug. ***
Comment 9 Sebastian Dröge (slomo) 2014-02-10 16:10:35 UTC
Dan, any plans to update your patch?
Comment 10 Dan Kegel 2014-02-10 16:19:25 UTC
Yes, I should get to it in the next couple days when I update to
1.2.3.
Comment 11 Dan Kegel 2014-02-21 19:30:44 UTC
Created attachment 269942 [details] [review]
3rd try.  AC_CHECK_TYPE argument order now correct.  Build verified on ubuntu 10.04 against g62f5a27.

Patch with AC_CHECK_TYPE usage corrected (thanks for the review!)
Comment 12 Sebastian Dröge (slomo) 2014-02-22 15:03:24 UTC
Comment on attachment 269942 [details] [review]
3rd try.  AC_CHECK_TYPE argument order now correct.  Build verified on ubuntu 10.04 against g62f5a27.

So this would only allow building the v4l2 plugin if "struct v4l2_plane" is available, right?

Can we maybe just simplify all these checks a bit more to just check if linux/videodev2.h works, has a non-ancient version and struct v4l2_plane is available? The current checks seem just too convoluted...
Comment 13 Dan Kegel 2014-02-22 15:19:40 UTC
So you'd prefer not issuing the 
"Please update v4l2 to compile the v4l2 plugins"
warning, and just saying
"video4linux2 was not found"
for both "v4l not found" and "v4l too old"?
Comment 14 Nicolas Dufresne (ndufresne) 2014-02-22 17:08:16 UTC
I think the goal is to make the v4l2_plane stuff out-compilable, or we could just copy paste that part of the header, so we keep the code clean. Probing will tell us if mplane is actually supported or not.

Note that I've seen a lot of V4L2 based project that just copy the latest header in their project, and completely rely on probing for the rest. This would cleanup the code from all the ifdef, but may require some review of the error handling.
Comment 15 Dan Kegel 2014-02-22 17:35:08 UTC
I think I'm happy with my current patch for now; it seems correct, and I'm not sure what the right path is to improve it.
Comment 16 Sebastian Dröge (slomo) 2014-02-23 09:37:29 UTC
(In reply to comment #14)
> I think the goal is to make the v4l2_plane stuff out-compilable, or we could
> just copy paste that part of the header, so we keep the code clean. Probing
> will tell us if mplane is actually supported or not.
> 
> Note that I've seen a lot of V4L2 based project that just copy the latest
> header in their project, and completely rely on probing for the rest. This
> would cleanup the code from all the ifdef, but may require some review of the
> error handling.

Nicolas, will you put that on your list and make that work before 1.4? I'll include this patch for the time being.
Comment 17 Nicolas Dufresne (ndufresne) 2014-02-23 21:05:46 UTC
Ok.
Comment 18 Nicolas Dufresne (ndufresne) 2014-03-12 03:38:32 UTC
Ok, just experimenting, but I made a patch where we not longer depend on system installed v4l2 headers, let's me know what you think, I still need to cleanup the configure.ac.

http://cgit.collabora.com/git/user/nicolas/gst-plugins-good.git/commit/?h=v4l2-cleanup&id=f58f1a3a9ffca07f1bc4b67e528d5eda32ff38c5
Comment 19 Nicolas Dufresne (ndufresne) 2014-03-15 12:57:26 UTC
This should fix the compilation issues. Let me know if some improvement is needed on top of that.

commit 418a4940a8c41411cef33a0054879cbd4c9bd181
Author: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Date:   Sat Mar 15 11:13:05 2014 +0100

    v4l2: Use a copy of videodev2.h header
    
    With years the amount of ifdef have grown up and we are not even sure if the
    old code path compiles. Each time we need to update the v4l2 framework to add
    the new feature, we break compilation on older kernel. With exception of two
    controls in the video orientation control, this patch get rid of all ifdef by
    including the latest version of videodev2.h inside GStreamer.
    
    Fixes https://bugzilla.gnome.org/show_bug.cgi?id=723446
Comment 20 Nicolas Dufresne (ndufresne) 2014-03-28 19:02:59 UTC
Ping, does it work for you now ?
Comment 21 Dan Kegel 2014-03-28 19:08:57 UTC
I'm probably unable to try it for a few weeks (we are entering code freeze at
the moment).
Comment 22 Nicolas Dufresne (ndufresne) 2014-03-28 19:37:13 UTC
n FreeBSD so andI'll assume it works. The offending check is completely gone. If anything, feel free to reopen.