FreeBSD emulation of Linux V4L

About

The files here enable Linux ports that wish to access a FreeBSD webcam to do so. This is tested and works with the net/skype port and a camera that uses the pwc(4) driver in the multimedia/pwcbsd port.

It also allows browser-based Flash apps to access the camera. This is tested using www/firefox35 and www/linux-f10-flashplugin10 together with www/nspluginwrapper.

Contacting Me

By email here: fbsd@opal.com.

Files

The files below have been tested and work on 7.2, 8.0 and 9-current.

On 9-current, where versions of these have been committed, you only need to update linux_ioctl.c; the other files are unchanged from the committed versions. For an explanation of the changes between this version and the committed version, see Video Clipping below.

On 7.2 and 8.0, you will need to apply this diff:

In the directory /usr/src/sys/compat/linux:

Filename Size Last Updated
linux_video.diff264492009/12/19 13:50:31 UTC

On 8.0, you can just copy these four files if you prefer:
Filename Size Last Updated
linux_ioctl.c770802009/12/19 13:50:31 UTC
linux_ioctl.h188512009/11/19 20:10:18 UTC
linux_videodev.h118432009/11/19 20:11:04 UTC
linux_videodev_compat.h10932009/12/02 19:44:48 UTC

Notes

Video Clipping

The version committed to 9-current works but does not support video clipping. The version here does include video clipping support but with the caveats below.

Video clipping allows the user to provide either a series of clip rectangles or a clip bitmap to the driver and have the driver mask the video according to the clipping specs provided.

Adding support for clipping to the FreeBSD Linux emulator is problematic because it seems that this feature is not supported by many drivers and therefore it is ignored by many applications. Unfortunately, when not using it, rather than passing in a null clipping list, some apps leave the clipping fields uninitialized, casuing random values to be passed in. In the case where the driver does not use the clipping info, this is not a problem (although it is bad form). But the Linux emulator does not know which drivers will use this and which won't, so the Linux emulator must try to handle this clip list, and deal gracefully with cases where the values seem to be uninitialized.

Video clipping info is passed in using the VIDIOCSWIN ioctl in two fields in the video_window structure: the integer clipcount and the pointer clips.

The emulator code currently handles the clip data as follows:

Feedback from folk familiar with the use of the clipping list is requested, regarding whether the above handling seems appropriate.

It should be noted that, at the time of developing this V4L emulator code, the pwc(4) V4L driver does not support clipping.

TUNER, FBUF and MICROCODE support

These are supported, but untested due to lack of FreeBSD driver support for them.