V4L/DVB support
Video4Linux(V4L) and its associated digital video API (DVB) are the de facto open-source audio/video capture frameworks. Most popular recording applications (e.g. MythTV and Freevo) are designed around these APIs, and many other applications, such as VLC, provide specialized features that can talk directly to V4L/DVB-compliant devices. Therefore, it would be beneficial to add V4L/DVB API support to the cx88 drivers so that all of these applications could (hopefully) "just work".
Unfortunately, this isn't a straightforward task. While V4L/DVB are reasonably flexible APIs, they do make one big assumption that isn't necessarily compatible with modern driver design--they are entirely ioctl(2) based. This essentially requires a kernel presence for every V4L/DVB-compliant driver, even though some drivers (such as those for simple USB video devices) could otherwise be implemented entirely in userspace. The cx88 driver is a hybrid, in that it requires a kernel presence for hardware protection, register access, DMA control, and interrupt processing, but all peripheral control is performed in userspace. Moving highly-variable and non-performance-critical components like these to userspace seems to be the way forward, for reasons such as the following:
- Reduced kernel bloat
- Increased fault tolerance (think segfault vs. kernel panic)
- Increased programming flexibility:
- Many frontend operations, such as tuner/demodulator signal-to-noise ratio calculations, require complex floating-point operations, which must be approximated using fixed-point when in kernel mode
- Firmware files can be loaded directly from the filesystem instead of requiring a specialized kernel firmware loading framework.
- Lower barriers to entry for contributors--familiarity with kernel driver design principles and restrictions is not necessary
The most likely course of action for adding V4L/DVB support to the cx88 driver stack is to have the kernel drivers create additional devices that conform to V4L/DVB naming conventions, and then process V4L/DVB ioctls on these devices. Those ioctls that can be handled entirely in kernel mode, such as buffer control ioctls, will be translated directly into calls to the underlying cx88 hardware control routines. Tuning and peripheral control ioctls will more than likely need to be bounced to userspace daemon which will interact with userspace driver frameworks like libtuner to perform the necessary frontend operations.