v4l_tools


v4l_tools-0.1.tar.gz

What are thoses tools and why I wrote them:

v4l_tools is a small set of programs(v4l_dump, v4l_probe_palettes, v4l_set_palette) that may be useful to debug video4linux drivers and software.

I first wrote v4l_dump to fix a problem with my tv card (bt878, pci-id 109e:0878). The problem was that when the system is freshly booted, the palette in struct video_picture was set to 0. 0 not beeing a valid palette, some programs that did not set the palette would not work or would produce incorrect output. To know which palette was valid (so I can set it correctly), I wrote v4l_probe_palette, and finally, to set the palette at boot time, I wrote the tool v4l_set_palette. Following is a detailed explaination of each program:

v4l_dump: Prints on the screen the current settings(struct video_picture, struct video_channel, struct video_capabilities) for a device. This programs does simple ioctls to read the information.
Output sample:

eye:~/v4l_tools/v4l_dump# ./v4l_dump
Using device /dev/video0
struct video_capability
{
        name='BT878(Hauppauge (bt878))'
        channels=4
        audios=1
        maxwidth=924
        maxheight=576
        minwidth=48
        minheight=32
}
VIDIOCGCHAN: Invalid argument
struct video_picture
{
        brightness=32768
        hue=32768
        colour=32512
        contrast=27648
        whiteness=0
        depth=0
        palette=2
}

v4l_probe_palettes: Try each palette defined in videodev.h by setting struct video_picture, and print wheather it was successful or not. The original palette setting is restored at the end. This tool is useful to get a quick overview of palettes supported by a device.
Output sample:

eye:~/v4l_tools/v4l_probe_palettes# ./v4l_probe_palettes
Using device /dev/video0
Supported palettes:

VIDEO_PALETTE_GREY: YES
VIDEO_PALETTE_HI240: YES
VIDEO_PALETTE_RGB565: YES
VIDEO_PALETTE_RGB24: YES
VIDEO_PALETTE_RGB32: YES
VIDEO_PALETTE_RGB555: YES
VIDEO_PALETTE_YUV422: YES
VIDEO_PALETTE_YUV411: NO
VIDEO_PALETTE_RAW: YES
VIDEO_PALETTE_YUV422P: YES
VIDEO_PALETTE_YUV411P: YES
VIDEO_PALETTE_YUV420P: YES
VIDEO_PALETTE_YUV410P: YES

v4l_set_palette: Set the palette. This tool accepts any palette defined in videodev.h (eg: VIDEO_PALETTE_RGB24).
Usage sample:

eye:~/v4l_tools/v4l_set_palette# ./v4l_set_palette VIDEO_PALETTE_RGB24
Using device /dev/video0
Setting palette VIDEO_PALETTE_RGB24
eye:~/v4l_tools/v4l_set_palette# ./v4l_set_palette VIDEO_PALETTE_YUV411
Using device /dev/video0
Setting palette VIDEO_PALETTE_YUV411
Could not set palette


By Raphael Assenat, raph@raphnet.net
www.raphnet.net