|
libvideo
This page presents libvideo, its raison d'ĂȘtre and its features.
Featured IntroductionThe goal of v4l4j is to provide a simple-to-use Java API allowing access to video streaming hardware under Linux. Besides capturing frames, I also wanted v4l4j to make it possible to discover available controls and use them. Both of these should require as little knowledge as possible about the underlying hardware. All the required low-level information should be provided dynamically at run time so applications could adjust accordingly. I quickly realised that the first step in writing v4l4j would involved designing and writing some form of abstraction layer first, due to the many differences involved in access video hardware. Providing seamless access to ANY V4L devices from user space isn't an easy task. There are several hurdles to overcome in order to create a video stream, or access video controls: First, video capture in Linux is done through the V4L API of the Linux kernel, which comes in two (incompatible) versions 1 (now deprecated) and 2. Which version of V4L is used depends on the hardware device itself and its driver. To this date, there are still a few V4L1-only drivers out there. The problem is that the semantics and usage of the two APIs is very different. Usual tasks involved in capturing frames (setting up the video device, intialising capture buffers, and so on) are done in different ways, using different data structures and ioctl calls. Second, there are several ways to control a video device, which again, depends on which version of V4L is used:
Last, different video devices support different image formats. An image format defines how bytes are organised in an image buffer returned by V4L. It specifies the layout of the image in the buffer, the number of components, the color depth ... . There are *MANY* different image formats out there and a few color spaces also. Creating a video stream implies negotiating a video format supported by hardware and suitable to the application. Which brings me back to my first point: Providing seamless access to V4L devices from user space isn't an easy task. This is why instead of creating java code to directly interact with V4L, I have created an intermediate layer: libvideo. v4l4j relies on libvideo to "smooth out" the rough edges of dealing with V4L. Featureslibvideo is a C library of functions which facilitates interactions with the capture interface of the V4L API. libvideo masks the differences between V4L1 and V4L2 and provides a unique API regardless of which version of V4L is used underneath.
ContentsInformation on libvideo is split across multiple pages:
| |