LINUX MEDIA INFRASTRUCTURE API

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation. A copy of the license is included in the chapter entitled "GNU Free Documentation License"


Table of Contents

Introduction
I. Video for Linux Two API Specification
1. Common API Elements
Opening and Closing Devices
Device Naming
Related Devices
Multiple Opens
Shared Data Streams
Functions
Querying Capabilities
Application Priority
Video Inputs and Outputs
Audio Inputs and Outputs
Tuners and Modulators
Tuners
Modulators
Radio Frequency
Video Standards
Digital Video (DV) Timings
User Controls
Extended Controls
Introduction
The Extended Control API
Enumerating Extended Controls
Creating Control Panels
Codec Control Reference
Camera Control Reference
FM Transmitter Control Reference
Flash Control Reference
JPEG Control Reference
Image Source Control Reference
Image Process Control Reference
Digital Video Control Reference
FM Receiver Control Reference
Detect Control Reference
RF Tuner Control Reference
Data Formats
Data Format Negotiation
Image Format Enumeration
Single- and multi-planar APIs
Multi-planar formats
Calls that distinguish between single and multi-planar APIs
Image Cropping, Insertion and Scaling
Cropping Structures
Scaling Adjustments
Examples
Experimental API for cropping, composing and scaling
Introduction
Selection targets
Configuration
Comparison with old cropping API
Examples
Streaming Parameters
2. Image Formats
Single-planar format structure
Multi-planar format structures
Standard Image Formats
Colorspaces
Defining Colorspaces in V4L2
Detailed Colorspace Descriptions
Colorspace SMPTE 170M (V4L2_COLORSPACE_SMPTE170M)
Colorspace Rec. 709 (V4L2_COLORSPACE_REC709)
Colorspace sRGB (V4L2_COLORSPACE_SRGB)
Colorspace Adobe RGB (V4L2_COLORSPACE_ADOBERGB)
Colorspace BT.2020 (V4L2_COLORSPACE_BT2020)
Colorspace SMPTE 240M (V4L2_COLORSPACE_SMPTE240M)
Colorspace NTSC 1953 (V4L2_COLORSPACE_470_SYSTEM_M)
Colorspace EBU Tech. 3213 (V4L2_COLORSPACE_470_SYSTEM_BG)
Colorspace JPEG (V4L2_COLORSPACE_JPEG)
Indexed Format
RGB Formats
Packed RGB formats — Packed RGB formats
V4L2_PIX_FMT_SBGGR8 ('BA81') — Bayer RGB format
V4L2_PIX_FMT_SGBRG8 ('GBRG') — Bayer RGB format
V4L2_PIX_FMT_SGRBG8 ('GRBG') — Bayer RGB format
V4L2_PIX_FMT_SRGGB8 ('RGGB') — Bayer RGB format
V4L2_PIX_FMT_SBGGR16 ('BYR2') — Bayer RGB format
V4L2_PIX_FMT_SRGGB10 ('RG10'), V4L2_PIX_FMT_SGRBG10 ('BA10'), V4L2_PIX_FMT_SGBRG10 ('GB10'), V4L2_PIX_FMT_SBGGR10 ('BG10'), — 10-bit Bayer formats expanded to 16 bits
V4L2_PIX_FMT_SRGGB10P ('pRAA'), V4L2_PIX_FMT_SGRBG10P ('pgAA'), V4L2_PIX_FMT_SGBRG10P ('pGAA'), V4L2_PIX_FMT_SBGGR10P ('pBAA'), — 10-bit packed Bayer formats
V4L2_PIX_FMT_SBGGR10ALAW8 ('aBA8'), V4L2_PIX_FMT_SGBRG10ALAW8 ('aGA8'), V4L2_PIX_FMT_SGRBG10ALAW8 ('agA8'), V4L2_PIX_FMT_SRGGB10ALAW8 ('aRA8'), — 10-bit Bayer formats compressed to 8 bits
V4L2_PIX_FMT_SBGGR10DPCM8 ('bBA8'), V4L2_PIX_FMT_SGBRG10DPCM8 ('bGA8'), V4L2_PIX_FMT_SGRBG10DPCM8 ('BD10'), V4L2_PIX_FMT_SRGGB10DPCM8 ('bRA8'), — 10-bit Bayer formats compressed to 8 bits
V4L2_PIX_FMT_SRGGB12 ('RG12'), V4L2_PIX_FMT_SGRBG12 ('BA12'), V4L2_PIX_FMT_SGBRG12 ('GB12'), V4L2_PIX_FMT_SBGGR12 ('BG12'), — 12-bit Bayer formats expanded to 16 bits
YUV Formats
Packed YUV formats — Packed YUV formats
V4L2_PIX_FMT_GREY ('GREY') — Grey-scale image
V4L2_PIX_FMT_Y10 ('Y10 ') — Grey-scale image
V4L2_PIX_FMT_Y12 ('Y12 ') — Grey-scale image
V4L2_PIX_FMT_Y10BPACK ('Y10B') — Grey-scale image as a bit-packed array
V4L2_PIX_FMT_Y16 ('Y16 ') — Grey-scale image
V4L2_PIX_FMT_UV8 ('UV8') — UV plane interleaved
V4L2_PIX_FMT_YUYV ('YUYV') — Packed format with ½ horizontal chroma resolution, also known as YUV 4:2:2
V4L2_PIX_FMT_UYVY ('UYVY') — Variation of V4L2_PIX_FMT_YUYV with different order of samples in memory
V4L2_PIX_FMT_YVYU ('YVYU') — Variation of V4L2_PIX_FMT_YUYV with different order of samples in memory
V4L2_PIX_FMT_VYUY ('VYUY') — Variation of V4L2_PIX_FMT_YUYV with different order of samples in memory
V4L2_PIX_FMT_Y41P ('Y41P') — Format with ¼ horizontal chroma resolution, also known as YUV 4:1:1
V4L2_PIX_FMT_YVU420 ('YV12'), V4L2_PIX_FMT_YUV420 ('YU12') — Planar formats with ½ horizontal and vertical chroma resolution, also known as YUV 4:2:0
V4L2_PIX_FMT_YUV420M ('YM12') — Variation of V4L2_PIX_FMT_YUV420 with planes non contiguous in memory.
V4L2_PIX_FMT_YVU420M ('YM21') — Variation of V4L2_PIX_FMT_YVU420 with planes non contiguous in memory.
V4L2_PIX_FMT_YVU410 ('YVU9'), V4L2_PIX_FMT_YUV410 ('YUV9') — Planar formats with ¼ horizontal and vertical chroma resolution, also known as YUV 4:1:0
V4L2_PIX_FMT_YUV422P ('422P') — Format with ½ horizontal chroma resolution, also known as YUV 4:2:2. Planar layout as opposed to V4L2_PIX_FMT_YUYV
V4L2_PIX_FMT_YUV411P ('411P') — Format with ¼ horizontal chroma resolution, also known as YUV 4:1:1. Planar layout as opposed to V4L2_PIX_FMT_Y41P
V4L2_PIX_FMT_NV12 ('NV12'), V4L2_PIX_FMT_NV21 ('NV21') — Formats with ½ horizontal and vertical chroma resolution, also known as YUV 4:2:0. One luminance and one chrominance plane with alternating chroma samples as opposed to V4L2_PIX_FMT_YVU420
V4L2_PIX_FMT_NV12M ('NM12'), V4L2_PIX_FMT_NV21M ('NM21'), V4L2_PIX_FMT_NV12MT_16X16 — Variation of V4L2_PIX_FMT_NV12 and V4L2_PIX_FMT_NV21 with planes non contiguous in memory.
V4L2_PIX_FMT_NV12MT ('TM12') — Formats with ½ horizontal and vertical chroma resolution. This format has two planes - one for luminance and one for chrominance. Chroma samples are interleaved. The difference to V4L2_PIX_FMT_NV12 is the memory layout. Pixels are grouped in macroblocks of 64x32 size. The order of macroblocks in memory is also not standard.
V4L2_PIX_FMT_NV16 ('NV16'), V4L2_PIX_FMT_NV61 ('NV61') — Formats with ½ horizontal chroma resolution, also known as YUV 4:2:2. One luminance and one chrominance plane with alternating chroma samples as opposed to V4L2_PIX_FMT_YVU420
V4L2_PIX_FMT_NV16M ('NM16'), V4L2_PIX_FMT_NV61M ('NM61') — Variation of V4L2_PIX_FMT_NV16 and V4L2_PIX_FMT_NV61 with planes non contiguous in memory.
V4L2_PIX_FMT_NV24 ('NV24'), V4L2_PIX_FMT_NV42 ('NV42') — Formats with full horizontal and vertical chroma resolutions, also known as YUV 4:4:4. One luminance and one chrominance plane with alternating chroma samples as opposed to V4L2_PIX_FMT_YVU420
V4L2_PIX_FMT_M420 ('M420') — Format with ½ horizontal and vertical chroma resolution, also known as YUV 4:2:0. Hybrid plane line-interleaved layout.
Compressed Formats
SDR Formats
V4L2_SDR_FMT_CU8 ('CU08') — Complex unsigned 8-bit IQ sample
V4L2_SDR_FMT_CU16LE ('CU16') — Complex unsigned 16-bit little endian IQ sample
V4L2_SDR_FMT_CS8 ('CS08') — Complex signed 8-bit IQ sample
V4L2_SDR_FMT_CS14LE ('CS14') — Complex signed 14-bit little endian IQ sample
V4L2_SDR_FMT_RU12LE ('RU12') — Real unsigned 12-bit little endian sample
Reserved Format Identifiers
3. Input/Output
Read/Write
Streaming I/O (Memory Mapping)
Streaming I/O (User Pointers)
Streaming I/O (DMA buffer importing)
Asynchronous I/O
Buffers
Timecodes
Field Order
4. Interfaces
Video Capture Interface
Querying Capabilities
Supplemental Functions
Image Format Negotiation
Reading Images
Video Overlay Interface
Querying Capabilities
Supplemental Functions
Setup
Overlay Window
Enabling Overlay
Video Output Interface
Querying Capabilities
Supplemental Functions
Image Format Negotiation
Writing Images
Video Output Overlay Interface
Querying Capabilities
Framebuffer
Overlay Window and Scaling
Enabling Overlay
Codec Interface
Effect Devices Interface
Raw VBI Data Interface
Querying Capabilities
Supplemental Functions
Raw VBI Format Negotiation
Reading and writing VBI images
Sliced VBI Data Interface
Querying Capabilities
Supplemental Functions
Sliced VBI Format Negotiation
Reading and writing sliced VBI data
Sliced VBI Data in MPEG Streams
Teletext Interface
Radio Interface
Querying Capabilities
Supplemental Functions
Programming
RDS Interface
Querying Capabilities
Reading RDS data
Writing RDS data
RDS datastructures
Software Defined Radio Interface (SDR)
Querying Capabilities
Supplemental Functions
Data Format Negotiation
Event Interface
Sub-device Interface
Controls
Events
Pad-level Formats
Media Bus Formats
5. V4L2 Driver Programming
6. Libv4l Userspace Library
Introduction
libv4lconvert
libv4l1
libv4l2
v4l1compat.so wrapper library
7. Changes
Differences between V4L and V4L2
Opening and Closing Devices
Querying Capabilities
Video Sources
Tuning
Image Properties
Audio
Frame Buffer Overlay
Cropping
Reading Images, Memory Mapping
Reading Raw VBI Data
Miscellaneous
Changes of the V4L2 API
Early Versions
V4L2 Version 0.16 1999-01-31
V4L2 Version 0.18 1999-03-16
V4L2 Version 0.19 1999-06-05
V4L2 Version 0.20 (1999-09-10)
V4L2 Version 0.20 incremental changes
V4L2 Version 0.20 2000-11-23
V4L2 Version 0.20 2002-07-25
V4L2 in Linux 2.5.46, 2002-10
V4L2 2003-06-19
V4L2 2003-11-05
V4L2 in Linux 2.6.6, 2004-05-09
V4L2 in Linux 2.6.8
V4L2 spec erratum 2004-08-01
V4L2 in Linux 2.6.14
V4L2 in Linux 2.6.15
V4L2 spec erratum 2005-11-27
V4L2 spec erratum 2006-01-10
V4L2 spec erratum 2006-02-03
V4L2 spec erratum 2006-02-04
V4L2 in Linux 2.6.17
V4L2 spec erratum 2006-09-23 (Draft 0.15)
V4L2 in Linux 2.6.18
V4L2 in Linux 2.6.19
V4L2 spec erratum 2006-10-12 (Draft 0.17)
V4L2 in Linux 2.6.21
V4L2 in Linux 2.6.22
V4L2 in Linux 2.6.24
V4L2 in Linux 2.6.25
V4L2 in Linux 2.6.26
V4L2 in Linux 2.6.27
V4L2 in Linux 2.6.28
V4L2 in Linux 2.6.29
V4L2 in Linux 2.6.30
V4L2 in Linux 2.6.32
V4L2 in Linux 2.6.33
V4L2 in Linux 2.6.34
V4L2 in Linux 2.6.37
V4L2 in Linux 2.6.39
V4L2 in Linux 3.1
V4L2 in Linux 3.2
V4L2 in Linux 3.3
V4L2 in Linux 3.4
V4L2 in Linux 3.5
V4L2 in Linux 3.6
V4L2 in Linux 3.9
V4L2 in Linux 3.10
V4L2 in Linux 3.11
V4L2 in Linux 3.14
V4L2 in Linux 3.15
V4L2 in Linux 3.16
V4L2 in Linux 3.17
V4L2 in Linux 3.18
V4L2 in Linux 3.19
Relation of V4L2 to other Linux multimedia APIs
Experimental API Elements
Obsolete API Elements
A. Function Reference
V4L2 close() — Close a V4L2 device
V4L2 ioctl() — Program a V4L2 device
ioctl VIDIOC_CREATE_BUFS — Create buffers for Memory Mapped or User Pointer or DMA Buffer I/O
ioctl VIDIOC_CROPCAP — Information about the video cropping and scaling abilities
ioctl VIDIOC_DBG_G_CHIP_INFO — Identify the chips on a TV card
ioctl VIDIOC_DBG_G_REGISTER, VIDIOC_DBG_S_REGISTER — Read or write hardware registers
ioctl VIDIOC_DECODER_CMD, VIDIOC_TRY_DECODER_CMD — Execute an decoder command
ioctl VIDIOC_DQEVENT — Dequeue event
ioctl VIDIOC_DV_TIMINGS_CAP, VIDIOC_SUBDEV_DV_TIMINGS_CAP — The capabilities of the Digital Video receiver/transmitter
ioctl VIDIOC_ENCODER_CMD, VIDIOC_TRY_ENCODER_CMD — Execute an encoder command
ioctl VIDIOC_ENUMAUDIO — Enumerate audio inputs
ioctl VIDIOC_ENUMAUDOUT — Enumerate audio outputs
ioctl VIDIOC_ENUM_DV_TIMINGS, VIDIOC_SUBDEV_ENUM_DV_TIMINGS — Enumerate supported Digital Video timings
ioctl VIDIOC_ENUM_FMT — Enumerate image formats
ioctl VIDIOC_ENUM_FRAMESIZES — Enumerate frame sizes
ioctl VIDIOC_ENUM_FRAMEINTERVALS — Enumerate frame intervals
ioctl VIDIOC_ENUM_FREQ_BANDS — Enumerate supported frequency bands
ioctl VIDIOC_ENUMINPUT — Enumerate video inputs
ioctl VIDIOC_ENUMOUTPUT — Enumerate video outputs
ioctl VIDIOC_ENUMSTD — Enumerate supported video standards
ioctl VIDIOC_EXPBUF — Export a buffer as a DMABUF file descriptor.
ioctl VIDIOC_G_AUDIO, VIDIOC_S_AUDIO — Query or select the current audio input and its attributes
ioctl VIDIOC_G_AUDOUT, VIDIOC_S_AUDOUT — Query or select the current audio output
ioctl VIDIOC_G_CROP, VIDIOC_S_CROP — Get or set the current cropping rectangle
ioctl VIDIOC_G_CTRL, VIDIOC_S_CTRL — Get or set the value of a control
ioctl VIDIOC_G_DV_TIMINGS, VIDIOC_S_DV_TIMINGS — Get or set DV timings for input or output
ioctl VIDIOC_G_EDID, VIDIOC_S_EDID — Get or set the EDID of a video receiver/transmitter
ioctl VIDIOC_G_ENC_INDEX — Get meta data about a compressed video stream
ioctl VIDIOC_G_EXT_CTRLS, VIDIOC_S_EXT_CTRLS, VIDIOC_TRY_EXT_CTRLS — Get or set the value of several controls, try control values
ioctl VIDIOC_G_FBUF, VIDIOC_S_FBUF — Get or set frame buffer overlay parameters
ioctl VIDIOC_G_FMT, VIDIOC_S_FMT, VIDIOC_TRY_FMT — Get or set the data format, try a format
ioctl VIDIOC_G_FREQUENCY, VIDIOC_S_FREQUENCY — Get or set tuner or modulator radio frequency
ioctl VIDIOC_G_INPUT, VIDIOC_S_INPUT — Query or select the current video input
ioctl VIDIOC_G_JPEGCOMP, VIDIOC_S_JPEGCOMP
ioctl VIDIOC_G_MODULATOR, VIDIOC_S_MODULATOR — Get or set modulator attributes
ioctl VIDIOC_G_OUTPUT, VIDIOC_S_OUTPUT — Query or select the current video output
ioctl VIDIOC_G_PARM, VIDIOC_S_PARM — Get or set streaming parameters
ioctl VIDIOC_G_PRIORITY, VIDIOC_S_PRIORITY — Query or request the access priority associated with a file descriptor
ioctl VIDIOC_G_SELECTION, VIDIOC_S_SELECTION — Get or set one of the selection rectangles
ioctl VIDIOC_G_SLICED_VBI_CAP — Query sliced VBI capabilities
ioctl VIDIOC_G_STD, VIDIOC_S_STD — Query or select the video standard of the current input
ioctl VIDIOC_G_TUNER, VIDIOC_S_TUNER — Get or set tuner attributes
ioctl VIDIOC_LOG_STATUS — Log driver status information
ioctl VIDIOC_OVERLAY — Start or stop video overlay
ioctl VIDIOC_PREPARE_BUF — Prepare a buffer for I/O
ioctl VIDIOC_QBUF, VIDIOC_DQBUF — Exchange a buffer with the driver
ioctl VIDIOC_QUERYBUF — Query the status of a buffer
ioctl VIDIOC_QUERYCAP — Query device capabilities
ioctl VIDIOC_QUERYCTRL, VIDIOC_QUERY_EXT_CTRL, VIDIOC_QUERYMENU — Enumerate controls and menu control items
ioctl VIDIOC_QUERY_DV_TIMINGS — Sense the DV preset received by the current input
ioctl VIDIOC_QUERYSTD — Sense the video standard received by the current input
ioctl VIDIOC_REQBUFS — Initiate Memory Mapping or User Pointer I/O
ioctl VIDIOC_S_HW_FREQ_SEEK — Perform a hardware frequency seek
ioctl VIDIOC_STREAMON, VIDIOC_STREAMOFF — Start or stop streaming I/O
ioctl VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL — Enumerate frame intervals
ioctl VIDIOC_SUBDEV_ENUM_FRAME_SIZE — Enumerate media bus frame sizes
ioctl VIDIOC_SUBDEV_ENUM_MBUS_CODE — Enumerate media bus formats
ioctl VIDIOC_SUBDEV_G_CROP, VIDIOC_SUBDEV_S_CROP — Get or set the crop rectangle on a subdev pad
ioctl VIDIOC_SUBDEV_G_FMT, VIDIOC_SUBDEV_S_FMT — Get or set the data format on a subdev pad
ioctl VIDIOC_SUBDEV_G_FRAME_INTERVAL, VIDIOC_SUBDEV_S_FRAME_INTERVAL — Get or set the frame interval on a subdev pad
ioctl VIDIOC_SUBDEV_G_SELECTION, VIDIOC_SUBDEV_S_SELECTION — Get or set selection rectangles on a subdev pad
ioctl VIDIOC_SUBSCRIBE_EVENT, VIDIOC_UNSUBSCRIBE_EVENT — Subscribe or unsubscribe event
V4L2 mmap() — Map device memory into application address space
V4L2 munmap() — Unmap device memory
V4L2 open() — Open a V4L2 device
V4L2 poll() — Wait for some event on a file descriptor
V4L2 read() — Read from a V4L2 device
V4L2 select() — Synchronous I/O multiplexing
V4L2 write() — Write to a V4L2 device
B. Common definitions for V4L2 and V4L2 subdev interfaces
Common selection definitions
Selection targets
Selection flags
C. Video For Linux Two Header File
D. Video Capture Example
E. Video Grabber example using libv4l
List of Types
References
II. LINUX DVB API
8. Introduction
What you need to know
History
Overview
Linux DVB Devices
API include files
9. DVB Frontend API
Frontend Data Types
Frontend type
frontend capabilities
frontend information
diseqc master command
diseqc slave reply
diseqc slave reply
SEC continuous tone
SEC tone burst
frontend status
frontend parameters
frontend events
Frontend Function Calls
open()
close()
FE_READ_STATUS
FE_READ_BER
FE_READ_SNR
FE_READ_SIGNAL_STRENGTH
FE_READ_UNCORRECTED_BLOCKS
FE_SET_FRONTEND
FE_GET_FRONTEND
FE_GET_EVENT
FE_GET_INFO
FE_DISEQC_RESET_OVERLOAD
FE_DISEQC_SEND_MASTER_CMD
FE_DISEQC_RECV_SLAVE_REPLY
FE_DISEQC_SEND_BURST
FE_SET_TONE
FE_SET_VOLTAGE
FE_ENABLE_HIGH_LNB_VOLTAGE
FE_SET_FRONTEND_TUNE_MODE
FE_DISHNETWORK_SEND_LEGACY_CMD
FE_GET_PROPERTY/FE_SET_PROPERTY
DTV stats type
DTV stats type
DTV property type
DTV properties type
FE_GET_PROPERTY
FE_SET_PROPERTY
Property types
Digital TV property parameters
Frontend statistics indicators
Properties used on terrestrial delivery systems
Properties used on cable delivery systems
Properties used on satellital delivery systems
10. DVB Demux Device
Demux Data Types
dmx_output_t
dmx_input_t
dmx_pes_type_t
struct dmx_filter
struct dmx_sct_filter_params
struct dmx_pes_filter_params
struct dmx_event
struct dmx_stc
struct dmx_caps
enum dmx_source_t
Demux Function Calls
open()
close()
read()
write()
DMX_START
DMX_STOP
DMX_SET_FILTER
DMX_SET_PES_FILTER
DMX_SET_BUFFER_SIZE
DMX_GET_EVENT
DMX_GET_STC
DMX_GET_PES_PIDS
DMX_GET_CAPS
DMX_SET_SOURCE
DMX_ADD_PID
DMX_REMOVE_PID
11. DVB Video Device
Video Data Types
video_format_t
video_displayformat_t
video_stream_source_t
video_play_state_t
struct video_command
video_size_t
struct video_event
struct video_status
struct video_still_picture
video capabilities
video_system_t
struct video_highlight
struct video_spu
struct video_spu_palette
struct video_navi_pack
video_attributes_t
Video Function Calls
open()
close()
write()
VIDEO_STOP
VIDEO_PLAY
VIDEO_FREEZE
VIDEO_CONTINUE
VIDEO_SELECT_SOURCE
VIDEO_SET_BLANK
VIDEO_GET_STATUS
VIDEO_GET_FRAME_COUNT
VIDEO_GET_PTS
VIDEO_GET_FRAME_RATE
VIDEO_GET_EVENT
VIDEO_COMMAND
VIDEO_TRY_COMMAND
VIDEO_GET_SIZE
VIDEO_SET_DISPLAY_FORMAT
VIDEO_STILLPICTURE
VIDEO_FAST_FORWARD
VIDEO_SLOWMOTION
VIDEO_GET_CAPABILITIES
VIDEO_SET_ID
VIDEO_CLEAR_BUFFER
VIDEO_SET_STREAMTYPE
VIDEO_SET_FORMAT
VIDEO_SET_SYSTEM
VIDEO_SET_HIGHLIGHT
VIDEO_SET_SPU
VIDEO_SET_SPU_PALETTE
VIDEO_GET_NAVI
VIDEO_SET_ATTRIBUTES
12. DVB Audio Device
Audio Data Types
audio_stream_source_t
audio_play_state_t
audio_channel_select_t
struct audio_status
struct audio_mixer
audio encodings
struct audio_karaoke
audio attributes
Audio Function Calls
open()
close()
write()
AUDIO_STOP
AUDIO_PLAY
AUDIO_PAUSE
AUDIO_CONTINUE
AUDIO_SELECT_SOURCE
AUDIO_SET_MUTE
AUDIO_SET_AV_SYNC
AUDIO_SET_BYPASS_MODE
AUDIO_CHANNEL_SELECT
AUDIO_BILINGUAL_CHANNEL_SELECT
AUDIO_GET_PTS
AUDIO_GET_STATUS
AUDIO_GET_CAPABILITIES
AUDIO_CLEAR_BUFFER
AUDIO_SET_ID
AUDIO_SET_MIXER
AUDIO_SET_STREAMTYPE
AUDIO_SET_EXT_ID
AUDIO_SET_ATTRIBUTES
AUDIO_SET_KARAOKE
13. DVB CA Device
CA Data Types
ca_slot_info_t
ca_descr_info_t
ca_caps_t
ca_msg_t
ca_descr_t
ca-pid
CA Function Calls
open()
close()
CA_RESET
CA_GET_CAP
CA_GET_SLOT_INFO
CA_GET_DESCR_INFO
CA_GET_MSG
CA_SEND_MSG
CA_SET_DESCR
CA_SET_PID
14. DVB Network API
DVB Net Data Types
struct dvb_net_if
DVB net Function Calls
NET_ADD_IF
NET_REMOVE_IF
NET_GET_IF
15. Kernel Demux API
Kernel Demux Data Types
dmx_success_t
TS filter types
dmx_ts_pes_t
demux_demux_t
Demux directory
Demux Directory API
dmx_register_demux()
dmx_unregister_demux()
dmx_get_demuxes()
Demux API
open()
close()
write()
allocate_ts_feed()
release_ts_feed()
allocate_section_feed()
release_section_feed()
descramble_mac_address()
descramble_section_payload()
add_frontend()
remove_frontend()
get_frontends()
connect_frontend()
disconnect_frontend()
Demux Callback API
dmx_ts_cb()
dmx_section_cb()
TS Feed API
set()
start_filtering()
stop_filtering()
Section Feed API
set()
allocate_filter()
release_filter()
start_filtering()
stop_filtering()
16. Examples
Tuning
The DVR device
F. DVB Audio Header File
G. DVB Conditional Access Header File
H. DVB Demux Header File
I. DVB Frontend Header File
J. DVB Network Header File
K. DVB Video Header File
III. Remote Controller API
17. Remote Controllers
Introduction
Remote Controller's sysfs nodes
/sys/class/rc/
/sys/class/rc/rcN/
/sys/class/rc/rcN/protocols
/sys/class/rc/rcN/filter
/sys/class/rc/rcN/filter_mask
/sys/class/rc/rcN/wakeup_protocols
/sys/class/rc/rcN/wakeup_filter
/sys/class/rc/rcN/wakeup_filter_mask
Remote controller tables
Changing default Remote Controller mappings
LIRC Device Interface
Introduction
LIRC read fop
LIRC write fop
LIRC ioctl fop
IV. Media Controller API
18. Media Controller
Introduction
Media device model
L. Function Reference
media open() — Open a media device
media close() — Close a media device
media ioctl() — Control a media device
ioctl MEDIA_IOC_DEVICE_INFO — Query device information
ioctl MEDIA_IOC_ENUM_ENTITIES — Enumerate entities and their properties
ioctl MEDIA_IOC_ENUM_LINKS — Enumerate all pads and links for a given entity
ioctl MEDIA_IOC_SETUP_LINK — Modify the properties of a link
19. Generic Error Codes
M. GNU Free Documentation License
0. PREAMBLE
1. APPLICABILITY AND DEFINITIONS
2. VERBATIM COPYING
3. COPYING IN QUANTITY
4. MODIFICATIONS
5. COMBINING DOCUMENTS
6. COLLECTIONS OF DOCUMENTS
7. AGGREGATION WITH INDEPENDENT WORKS
8. TRANSLATION
9. TERMINATION
10. FUTURE REVISIONS OF THIS LICENSE
Addendum

List of Figures

1.1. Image Cropping, Insertion and Scaling
1.2. Cropping and composing targets
2.1. V4L2_PIX_FMT_NV12MT macroblock Z shape memory layout
2.2. Example V4L2_PIX_FMT_NV12MT memory layout of macroblocks
3.1. Field Order, Top Field First Transmitted
3.2. Field Order, Bottom Field First Transmitted
4.1. Line synchronization
4.2. ITU-R 525 line numbering (M/NTSC and M/PAL)
4.3. ITU-R 625 line numbering
4.4. Image Format Negotiation on Pipelines
4.5. Image processing in subdevs: simple crop example
4.6. Image processing in subdevs: scaling with multiple sources
4.7. Image processing in subdevs: scaling and composition with multiple sinks and sources
4.8. Bayer Patterns
A.1. Size adjustments with constraint flags.
8.1. Components of a DVB card/STB

List of Tables

1.1. Control IDs
1.2. Codec Control IDs
1.3. MFC 5.1 Control IDs
1.4. CX2341x Control IDs
1.5. VPX Control IDs
1.6. Camera Control IDs
1.7. FM_TX Control IDs
1.8. Flash Control IDs
1.9. JPEG Control IDs
1.10. Image Source Control IDs
1.11. Image Source Control IDs
1.12. Digital Video Control IDs
1.13. FM_RX Control IDs
1.14. Detect Control IDs
1.15. RF_TUNER Control IDs
2.1. struct v4l2_pix_format
2.2. struct v4l2_plane_pix_format
2.3. struct v4l2_pix_format_mplane
2.4. V4L2 Colorspaces
2.5. V4L2 Y'CbCr Encodings
2.6. V4L2 Quantization Methods
2.7. SMPTE 170M Chromaticities
2.8. Rec. 709 Chromaticities
2.9. sRGB Chromaticities
2.10. Adobe RGB Chromaticities
2.11. BT.2020 Chromaticities
2.12. SMPTE 240M Chromaticities
2.13. NTSC 1953 Chromaticities
2.14. EBU Tech. 3213 Chromaticities
2.15. Indexed Image Format
2.16. Packed RGB Image Formats
2.17. Deprecated Packed RGB Image Formats
2.18. Packed YUV Image Formats
2.19. Compressed Image Formats
2.20. Reserved Image Formats
2.21. Format Flags
3.1. struct v4l2_buffer
3.2. struct v4l2_plane
3.3. enum v4l2_buf_type
3.4. Buffer Flags
3.5. enum v4l2_memory
3.6. struct v4l2_timecode
3.7. Timecode Types
3.8. Timecode Flags
3.9. enum v4l2_field
4.1. struct v4l2_window
4.2. struct v4l2_clip
4.3. struct v4l2_rect
4.4. struct v4l2_vbi_format
4.5. Raw VBI Format Flags
4.6. struct v4l2_sliced_vbi_format
4.7. Sliced VBI services
4.8. struct v4l2_sliced_vbi_data
4.9. struct v4l2_mpeg_vbi_fmt_ivtv
4.10. Magic Constants for struct v4l2_mpeg_vbi_fmt_ivtv magic field
4.11. struct v4l2_mpeg_vbi_itv0
4.12. struct v4l2_mpeg_vbi_ITV0
4.13. struct v4l2_mpeg_vbi_itv0_line
4.14. Line Identifiers for struct v4l2_mpeg_vbi_itv0_line id field
4.15. struct v4l2_rds_data
4.16. Block description
4.17. Block defines
4.18. struct v4l2_sdr_format
4.19. Sample Pipeline Configuration
4.20. struct v4l2_mbus_framefmt
4.21. RGB formats
4.22. LVDS RGB formats
4.23. Bayer Formats
4.24. YUV Formats
4.25. HSV/HSL formats
4.26. JPEG Formats
4.27. Vendor and device specific formats
7.1. V4L Device Types, Names and Numbers
A.1. struct v4l2_create_buffers
A.2. struct v4l2_cropcap
A.3. struct v4l2_rect
A.4. struct v4l2_dbg_match
A.5. struct v4l2_dbg_chip_info
A.6. Chip Match Types
A.7. struct v4l2_dbg_match
A.8. struct v4l2_dbg_register
A.9. Chip Match Types
A.10. struct v4l2_decoder_cmd
A.11. Decoder Commands
A.12. struct v4l2_event
A.13. Event Types
A.14. struct v4l2_event_vsync
A.15. struct v4l2_event_ctrl
A.16. struct v4l2_event_frame_sync
A.17. struct v4l2_event_src_change
A.18. struct v4l2_event_motion_det
A.19. Control Changes
A.20. Source Changes
A.21. struct v4l2_bt_timings_cap
A.22. struct v4l2_dv_timings_cap
A.23. DV BT Timing capabilities
A.24. struct v4l2_encoder_cmd
A.25. Encoder Commands
A.26. Encoder Command Flags
A.27. struct v4l2_enum_dv_timings
A.28. struct v4l2_fmtdesc
A.29. Image Format Description Flags
A.30. struct v4l2_frmsize_discrete
A.31. struct v4l2_frmsize_stepwise
A.32. struct v4l2_frmsizeenum
A.33. enum v4l2_frmsizetypes
A.34. struct v4l2_frmival_stepwise
A.35. struct v4l2_frmivalenum
A.36. enum v4l2_frmivaltypes
A.37. struct v4l2_frequency_band
A.38. Band Modulation Systems
A.39. struct v4l2_input
A.40. Input Types
A.41. Input Status Flags
A.42. Input capabilities
A.43. struct v4l2_output
A.44. Output Type
A.45. Output capabilities
A.46. struct v4l2_standard
A.47. struct v4l2_fract
A.48. typedef v4l2_std_id
A.49. Video Standards (based on [[ITU BT.470]])
A.50. struct v4l2_exportbuffer
A.51. struct v4l2_audio
A.52. Audio Capability Flags
A.53. Audio Mode Flags
A.54. struct v4l2_audioout
A.55. struct v4l2_crop
A.56. struct v4l2_control
A.57. struct v4l2_bt_timings
A.58. struct v4l2_dv_timings
A.59. DV Timing types
A.60. DV BT Timing standards
A.61. DV BT Timing flags
A.62. struct v4l2_edid
A.63. struct v4l2_enc_idx
A.64. struct v4l2_enc_idx_entry
A.65. Index Entry Flags
A.66. struct v4l2_ext_control
A.67. struct v4l2_ext_controls
A.68. Control classes
A.69. struct v4l2_framebuffer
A.70. Frame Buffer Capability Flags
A.71. Frame Buffer Flags
A.72. struct v4l2_format
A.73. struct v4l2_frequency
A.74. struct v4l2_jpegcompression
A.75. JPEG Markers Flags
A.76. struct v4l2_modulator
A.77. Modulator Audio Transmission Flags
A.78. struct v4l2_streamparm
A.79. struct v4l2_captureparm
A.80. struct v4l2_outputparm
A.81. Streaming Parameters Capabilites
A.82. Capture Parameters Flags
A.83. enum v4l2_priority
A.84. struct v4l2_selection
A.85. struct v4l2_sliced_vbi_cap
A.86. Sliced VBI services
A.87. struct v4l2_tuner
A.88. enum v4l2_tuner_type
A.89. Tuner and Modulator Capability Flags
A.90. Tuner Audio Reception Flags
A.91. Tuner Audio Modes
A.92. Tuner Audio Matrix
A.93. struct v4l2_capability
A.94. Device Capabilities Flags
A.95. struct v4l2_queryctrl
A.96. struct v4l2_query_ext_ctrl
A.97. struct v4l2_querymenu
A.98. enum v4l2_ctrl_type
A.99. Control Flags
A.100. struct v4l2_requestbuffers
A.101. struct v4l2_hw_freq_seek
A.102. struct v4l2_subdev_frame_interval_enum
A.103. struct v4l2_subdev_frame_size_enum
A.104. struct v4l2_subdev_mbus_code_enum
A.105. struct v4l2_subdev_crop
A.106. struct v4l2_subdev_format
A.107. enum v4l2_subdev_format_whence
A.108. struct v4l2_subdev_frame_interval
A.109. struct v4l2_subdev_selection
A.110. struct v4l2_event_subscription
A.111. Event Flags
B.1. Selection target definitions
B.2. Selection flag definitions
9.1. Frontend types
17.1. IR default keymapping
17.2. Notes
L.1. struct media_device_info
L.2. struct media_entity_desc
L.3. Media entity types
L.4. Media entity flags
L.5. struct media_links_enum
L.6. struct media_pad_desc
L.7. Media pad flags
L.8. struct media_link_desc
L.9. Media link flags
19.1. Generic error codes

List of Examples

1.1. Information about the current video input
1.2. Switching to the first video input
1.3. Information about the current audio input
1.4. Switching to the first audio input
1.5. Information about the current video standard
1.6. Listing the video standards supported by the current input
1.7. Selecting a new video standard
1.8. Enumerating all user controls
1.9. Enumerating all user controls (alternative)
1.10. Changing controls
1.11. Resetting the cropping parameters
1.12. Simple downscaling
1.13. Selecting an output area
1.14. Current scaling factor and pixel aspect
1.15. Resetting the cropping parameters
1.16. Simple downscaling
1.17. Querying for scaling factors
2.1. V4L2_PIX_FMT_BGR24 4 × 4 pixel image
2.2. V4L2_PIX_FMT_SBGGR8 4 × 4 pixel image
2.3. V4L2_PIX_FMT_SGBRG8 4 × 4 pixel image
2.4. V4L2_PIX_FMT_SGRBG8 4 × 4 pixel image
2.5. V4L2_PIX_FMT_SRGGB8 4 × 4 pixel image
2.6. V4L2_PIX_FMT_SBGGR16 4 × 4 pixel image
2.7. V4L2_PIX_FMT_SBGGR10 4 × 4 pixel image
2.8. V4L2_PIX_FMT_SBGGR10P 4 × 4 pixel image
2.9. V4L2_PIX_FMT_SBGGR12 4 × 4 pixel image
2.10. V4L2_PIX_FMT_GREY 4 × 4 pixel image
2.11. V4L2_PIX_FMT_Y10 4 × 4 pixel image
2.12. V4L2_PIX_FMT_Y12 4 × 4 pixel image
2.13. V4L2_PIX_FMT_Y10BPACK 4 pixel data stream taking 5 bytes
2.14. V4L2_PIX_FMT_Y16 4 × 4 pixel image
2.15. V4L2_PIX_FMT_UV8 pixel image
2.16. V4L2_PIX_FMT_YUYV 4 × 4 pixel image
2.17. V4L2_PIX_FMT_UYVY 4 × 4 pixel image
2.18. V4L2_PIX_FMT_YVYU 4 × 4 pixel image
2.19. V4L2_PIX_FMT_VYUY 4 × 4 pixel image
2.20. V4L2_PIX_FMT_Y41P 8 × 4 pixel image
2.21. V4L2_PIX_FMT_YVU420 4 × 4 pixel image
2.22. V4L2_PIX_FMT_YUV420M 4 × 4 pixel image
2.23. V4L2_PIX_FMT_YVU420M 4 × 4 pixel image
2.24. V4L2_PIX_FMT_YVU410 4 × 4 pixel image
2.25. V4L2_PIX_FMT_YUV422P 4 × 4 pixel image
2.26. V4L2_PIX_FMT_YUV411P 4 × 4 pixel image
2.27. V4L2_PIX_FMT_NV12 4 × 4 pixel image
2.28. V4L2_PIX_FMT_NV12M 4 × 4 pixel image
2.29. Memory layout of macroblocks in V4L2_PIX_FMT_NV12 format pixel image - extreme case
2.30. V4L2_PIX_FMT_NV16 4 × 4 pixel image
2.31. V4L2_PIX_FMT_NV16M 4 × 4 pixel image
2.32. V4L2_PIX_FMT_NV24 4 × 4 pixel image
2.33. V4L2_PIX_FMT_M420 4 × 4 pixel image
2.34. V4L2_SDR_FMT_CU8 1 sample
2.35. V4L2_SDR_FMT_CU16LE 1 sample
2.36. V4L2_SDR_FMT_CS8 1 sample
2.37. V4L2_SDR_FMT_CS14LE 1 sample
2.38. V4L2_SDR_FMT_RU12LE 1 sample
3.1. Mapping buffers in the single-planar API
3.2. Mapping buffers in the multi-planar API
3.3. Initiating streaming I/O with user pointers
3.4. Initiating streaming I/O with DMABUF file descriptors
3.5. Queueing DMABUF using single plane API
3.6. Queueing DMABUF using multi plane API
4.1. Finding a framebuffer device for OSD
A.1. Exporting a buffer.
A.2. Exporting a buffer using the multi-planar API.