4/19/2008

V4L2 Radio

+ Video I/O
Radio devices have no video inputs or outputs.

+ Audio I/O
Radio devices have no audio inputs or outputs. They have exactly one tuner which in fact is an audio source, but this API associates tuners with video
inputs or outputs only, and radio devices have none of these.5

+Tuners
Radio devices have exactly one tuner with index zero, no video inputs.
To query and change tuner properties applications use the VIDIOC_G_TUNER and VIDIOC_S_TUNER ioctl, respectively. The struct v4l2_tuner returned by VIDIOC_G_TUNER also contains signal status information applicable when the tuner of the current video input, or a radio tuner is queried. Note
that VIDIOC_S_TUNER does not switch the current tuner, when there is more than one at all. Drivers must support both ioctls and set the V4L2_CAP_TUNER flag in the struct v4l2_capability returned by the VIDIOC_QUERYCAP ioctl when the device has one or more tuners.

Actually struct v4l2_audio ought to have a tuner field like struct v4l2_input, not only making the API more consistent but also permitting radio devices with multiple tuners.

+Radio Interface
This interface is intended for AM and FM (analog) radio receivers. Conventionally V4L2 radio devices are accessed through character device special files named /dev/radio and /dev/radio0 to /dev/radio63 with major number 81 and minor numbers 64 to 127.
++Querying Capabilities
Devices supporting the radio interface set the V4L2_CAP_RADIO and V4L2_CAP_TUNER flag in the capabilities field of struct v4l2_capability returned by the VIDIOC_QUERYCAP ioctl. Other combinations of capability flags are reserved for future extensions.
++ Supplemental Functions
Radio devices can support controls, and must support the tuner ioctls.
They do not support the video input or output, audio input or output, video standard, cropping and scaling, compression and streaming parameter, or overlay ioctls. All other ioctls and I/O methods are reserved for future extensions.
++ Programming
Radio devices may have a couple audio controls such as a volume control, possibly custom controls. Further all radio devices have one tuner with index number zero to select the radio frequency and to determine if a monaural or FM stereo program is received. Drivers switch automatically between AM and FM depending on the selected frequency. The VIDIOC_G_TUNER ioctl reports the supported frequency range.

+Modulators
The V4L2 spec does not define radio output devices.

+Radio frequency
To get and set the tuner or modulator radio frequency applications use the VIDIOC_G_FREQUENCY and VIDIOC_S_FREQUENCY ioctl which both take a pointer to a struct v4l2_frequency.

+User control
The control ioctls provide the information and a mechanism to create a
nice user interface for these controls that will work correctly with any device.
All controls are accessed using an ID value. V4L2 defines several IDs for specific purposes.The pre-defined control IDs have the prefix V4L2_CID_, and are listed in Table 1-1. The ID is used when querying the attributes of a control, and when getting or setting the current value.
Control values are stored globally, they do not change when switching except to stay within the reported bounds. They also do not change e. g. when the device is opened or closed, when the tuner radio frequency is changed or generally never without application request.
-------------
V4L2_CID_AUDIO_MUTE boolean
Mute audio, i. e. set the volume to zero, however without affecting V4L2_CID_AUDIO_VOLUME.Like ALSA drivers, V4L2 drivers must mute at load time to avoid excessive noise. Actually the entire device should be reset to a low power consumption state.
-------------
V4L2_CID_AUDIO_VOLUME integer
Overall audio volume. Note some drivers also provide an OSS or ALSA mixer interface.
-------------
Applications can enumerate the available controls with the VIDIOC_QUERYCTRL and VIDIOC_QUERYMENU ioctls, get and set a control value with the VIDIOC_G_CTRL and VIDIOC_S_CTRL ioctls. Drivers must implement VIDIOC_QUERYCTRL, VIDIOC_G_CTRL and VIDIOC_S_CTRL when the device has one or more controls, VIDIOC_QUERYMENU when it has one or more menu type controls.

+ API
VIDIOC_QUERYCAP — Query device capabilities
VIDIOC_G_FREQUENCY, VIDIOC_S_FREQUENCY-- set or set tuner or modulator radio frequency
VIDIOC_G_TUNER, VIDIOC_S_TUNER — Get or set tuner attributes
VIDIOC_G_MODULATOR, VIDIOC_S_MODULATOR — Get or set modulator attributes

没有评论: