Xpra: Ticket #1223: v4l2 on NetBSD

NetBSD supports the v4l2 API, but it uses different headers and does not provide all the symbols.

In particular, for xpra, the following changes are needed:

  1. include sys/videoio.h instead of linux/videodev2.h
  2. do not expect V4L2_FIELD_INTERLACED_BT nor V4L2_FIELD_INTERLACED_TB

I'll attach a patch for (the generated file) xpra/codecs/v4l2/pusher.c, but I don't know what the corresponding changes to the pyx file look like.



Mon, 06 Jun 2016 12:40:44 GMT - Thomas Klausner: attachment set

Patch for the generated file pusher.c to make it compile on NetBSD.


Mon, 06 Jun 2016 12:58:11 GMT - Antoine Martin: owner changed

r12754 should make it easier for you. You need to patch the pyx file and not the generated C file. (though the end result is the same) Replace:

cdef extern from "linux/videodev2.h":

with:

cdef extern from "sys/videoio.h":

This cannot be made conditional from cython, so you will have to carry that patch on the netbsd side. The only alternative is to create our own header file, which contains the required pairs of ifdefs, then we can include that one (untested). ie: something like this should work:

cat > video.h <<EOF
#ifdef __NetBSD__
#include <sys/videoio.h>
#endif
#ifdef __Linux__
#include "linux/videodev2.h"
#endif
EOF

If you're OK with the patch approach, please close this ticket. Otherwise, please test the header file approach.


Tue, 07 Jun 2016 02:51:56 GMT - Antoine Martin:

r12755 uses the header file approach and should allow netbsd to compile out of the box. (no idea what the correct header file names are for freebsd and others.. those can be added later)

Please close if that works for you.


Wed, 08 Jun 2016 16:56:58 GMT - Thomas Klausner:

Thank you, r12755 did make it much better. r12754 commented out the wrong defines though. When I comment out V4L2_FIELD_INTERLACED_TB and V4L2_FIELD_INTERLACED_BT in pusher.pyx (two places) the build succeeds.


Thu, 09 Jun 2016 04:09:30 GMT - Antoine Martin:

r12759 should comment out the correct defines.

Please close if this builds out of the box for you.


Sun, 12 Jun 2016 20:08:13 GMT - Thomas Klausner: status changed; resolution set

Thank you, works!


Tue, 28 Jun 2016 05:14:20 GMT - Antoine Martin:

I'm afraid that I've probably broken it again in fixing trunk build for centos, see r12930. Can you please post your header file so that I can see where we need to ifdef contants?


Tue, 28 Jun 2016 06:57:29 GMT - Thomas Klausner:

Sure, here's the link to the NetBSD header file:

https://github.com/jsonn/src/blob/trunk/sys/sys/videoio.h


Tue, 28 Jun 2016 10:14:38 GMT - Antoine Martin:

Made some mistakes along the way.. but as of r12935, we should get the new "device_caps" support on newer linux systems and still be able to build on older ones (including centos6, and I hope netbsd). Feel free to comment or re-open if I've broken it again..


Tue, 12 Jul 2016 16:52:22 GMT - Antoine Martin: milestone changed

Milestone renamed


Sat, 23 Jan 2021 05:18:20 GMT - migration script:

this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/1223