xpra icon
Bug tracker and wiki

Opened 11 months ago

Closed 11 months ago

Last modified 10 months ago

#1223 closed defect (fixed)

v4l2 on NetBSD

Reported by: Thomas Klausner Owned by: Thomas Klausner
Priority: major Milestone: 1.0
Component: encodings Version: 0.17.x
Keywords: Cc:

Description

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.

Attachments (1)

patch-xpra_codecs_v4l2_pusher.c (1.5 KB) - added by Thomas Klausner 11 months ago.
Patch for the generated file pusher.c to make it compile on NetBSD.

Download all attachments as: .zip

Change History (10)

Changed 11 months ago by Thomas Klausner

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

comment:1 Changed 11 months ago by Antoine Martin

Owner: changed from Antoine Martin to Thomas Klausner

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.

comment:2 Changed 11 months ago by 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.

comment:3 Changed 11 months ago by 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.

comment:4 Changed 11 months ago by Antoine Martin

r12759 should comment out the correct defines.

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

comment:5 Changed 11 months ago by Thomas Klausner

Resolution: fixed
Status: newclosed

Thank you, works!

comment:6 Changed 10 months ago by 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?

comment:7 Changed 10 months ago by Thomas Klausner

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

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

comment:8 Changed 10 months ago by 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..

comment:9 Changed 10 months ago by Antoine Martin

Milestone: 0.181.0

Milestone renamed

Note: See TracTickets for help on using tickets.