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
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 DCI-P3 (V4L2_COLORSPACE_DCI_P3)
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)
Detailed Transfer Function Descriptions
Transfer Function SMPTE 2084 (V4L2_XFER_FUNC_SMPTE2084)
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_Y16_BE ('Y16 ' | (1 << 31)) — Grey-scale image
V4L2_PIX_FMT_Y8I ('Y8I ') — Interleaved grey-scale image, e.g. from a stereo-pair
V4L2_PIX_FMT_Y12I ('Y12I') — Interleaved grey-scale image, e.g. from a stereo-pair
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'), V4L2_PIX_FMT_YVU420M ('YM21') — Variation of V4L2_PIX_FMT_YUV420 and V4L2_PIX_FMT_YVU420 with planes non contiguous in memory.
V4L2_PIX_FMT_YUV422M ('YM16'), V4L2_PIX_FMT_YVU422M ('YM61') — Planar formats with ½ horizontal resolution, also known as YUV and YVU 4:2:2
V4L2_PIX_FMT_YUV444M ('YM24'), V4L2_PIX_FMT_YVU444M ('YM42') — Planar formats with full horizontal resolution, also known as YUV and YVU 4:4:4
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.
Depth Formats
V4L2_PIX_FMT_Z16 ('Z16 ') — 16-bit depth data with distance values at each pixel
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
V4L2 in Linux 4.4
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, VIDIOC_SUBDEV_G_EDID, VIDIOC_SUBDEV_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, User Pointer or DMA Buffer 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
Querying frontend information
Querying frontend status and statistics
DVB Frontend properties
struct dtv_stats
struct dtv_fe_stats
struct dtv_property
struct dtv_properties
Property types
Digital TV property parameters
Frontend statistics indicators
Properties used on terrestrial delivery systems
Properties used on cable delivery systems
Properties used on satellite delivery systems
Frontend Function Calls
DVB frontend open() — Open a frontend device
DVB frontend close() — Close a frontend device
ioctl FE_GET_INFO — Query DVB frontend capabilities and returns information about the front-end. This call only requires read-only access to the device
ioctl FE_READ_STATUS — Returns status information about the front-end. This call only requires read-only access to the device
ioctl FE_SET_PROPERTY, FE_GET_PROPERTY — FE_SET_PROPERTY sets one or more frontend properties. FE_GET_PROPERTY returns one or more frontend properties.
ioctl FE_DISEQC_RESET_OVERLOAD — Restores the power to the antenna subsystem, if it was powered off due to power overload.
ioctl FE_DISEQC_SEND_MASTER_CMD — Sends a DiSEqC command
ioctl FE_DISEQC_RECV_SLAVE_REPLY — Receives reply from a DiSEqC 2.0 command
ioctl FE_DISEQC_SEND_BURST — Sends a 22KHz tone burst for 2x1 mini DiSEqC satellite selection.
ioctl FE_SET_TONE — Sets/resets the generation of the continuous 22kHz tone.
ioctl FE_SET_VOLTAGE — Allow setting the DC level sent to the antenna subsystem.
ioctl FE_ENABLE_HIGH_LNB_VOLTAGE — Select output DC level between normal LNBf voltages or higher LNBf voltages.
ioctl FE_SET_FRONTEND_TUNE_MODE — Allow setting tuner mode flags to the frontend.
DVB Frontend legacy API (a. k. a. DVBv3)
Frontend Legacy Data Types
Frontend Legacy Function Calls
10. DVB Demux Device
Demux Data Types
Output for the demux
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 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
12. DVB Network API
DVB net Function Calls
ioctl NET_ADD_IF — Creates a new network interface for a given Packet ID.
ioctl NET_REMOVE_IF — Removes a network interface.
ioctl NET_GET_IFRead the configuration data of an interface created via NET_ADD_IF.
13. DVB Deprecated APIs
DVB Video Device
Video Data Types
Video Function Calls
DVB Audio Device
Audio Data Types
Audio Function Calls
14. 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
15. 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
16. Media Controller
Introduction
Media device model
Types and flags used to represent the media graph elements
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_G_TOPOLOGY — Enumerate the graph topology and graph element properties
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
V. CEC API
17. CEC: Consumer Electronics Control
Introduction
M. Function Reference
cec open() — Open a cec device
cec close() — Close a cec device
cec ioctl() — Control a cec device
cec poll() — Wait for some event on a file descriptor
ioctl CEC_ADAP_G_CAPS — Query device capabilities
ioctl CEC_ADAP_G_LOG_ADDRS, CEC_ADAP_S_LOG_ADDRS — Get or set the logical addresses
ioctl CEC_ADAP_G_PHYS_ADDR, CEC_ADAP_S_PHYS_ADDR — Get or set the physical address
ioctl CEC_DQEVENT — Dequeue a CEC event
ioctl CEC_G_MODE, CEC_S_MODE — Get or set exclusive use of the CEC adapter
ioctl CEC_RECEIVE, CEC_TRANSMIT — Receive or transmit a CEC message
18. Generic Error Codes
N. 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. Typical Media Device
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 Process 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 Transfer Function
2.6. V4L2 Y'CbCr Encodings
2.7. V4L2 Quantization Methods
2.8. SMPTE 170M Chromaticities
2.9. Rec. 709 Chromaticities
2.10. sRGB Chromaticities
2.11. Adobe RGB Chromaticities
2.12. BT.2020 Chromaticities
2.13. DCI-P3 Chromaticities
2.14. SMPTE 240M Chromaticities
2.15. NTSC 1953 Chromaticities
2.16. EBU Tech. 3213 Chromaticities
2.17. Indexed Image Format
2.18. Packed RGB Image Formats
2.19. Deprecated Packed RGB Image Formats
2.20. Packed YUV Image Formats
2.21. Compressed Image Formats
2.22. Reserved Image Formats
2.23. 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. enum fe_modulation
9.2. enum fe_modulation
9.3. enum fe_code_rate
9.4. enum fe_sec_voltage
9.5. enum fe_pilot
9.6. enum fe_rolloff
9.7. enum fe_delivery_system
9.8. enum atscmh_rs_frame_mode
9.9. enum atscmh_rs_frame_ensemble
9.10. enum atscmh_rs_code_mode
9.11. enum atscmh_scc_block_mode
9.12. enum atscmh_sccc_code_mode
9.13. enum fe_guard_interval
9.14. enum fe_transmit_mode
9.15. enum fe_hierarchy
9.16. enum fe_interleaving
9.17. struct dvb_frontend_info
9.18. enum fe_caps
9.19. enum fe_status
9.20. struct dvb_diseqc_master_cmd
9.21. struct dvb_diseqc_slave_reply
9.22. enum fe_sec_mini_cmd
9.23. enum fe_sec_tone_mode
9.24. Frontend types
9.25. enum fe_bandwidth
10.1. enum dmx_output
12.1. struct dvb_net_if
15.1. IR default keymapping
15.2. Notes
16.1. Media entity types
16.2. Media entity flags
16.3. Media interface types
16.4. Media pad flags
16.5. Media link flags
L.1. struct media_device_info
L.2. struct media_v2_topology
L.3. struct media_v2_entity
L.4. struct media_v2_interface
L.5. struct media_v2_interface
L.6. struct media_v2_pad
L.7. struct media_v2_pad
L.8. struct media_entity_desc
L.9. struct media_links_enum
L.10. struct media_pad_desc
L.11. struct media_link_desc
M.1. struct cec_caps
M.2. CEC Capabilities Flags
M.3. struct cec_log_addrs
M.4. CEC Versions
M.5. CEC Primary Device Types
M.6. CEC Logical Address Types
M.7. CEC All Device Types Flags
M.8. struct cec_event_state_change
M.9. struct cec_event_lost_msgs
M.10. struct cec_event
M.11. CEC Events Types
M.12. CEC Event Flags
M.13. Initiator Modes
M.14. Follower Modes
M.15. Core Message Processing
M.16. struct cec_msg
M.17. CEC Transmit Status
M.18. CEC Receive Status
18.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_Y16_BE 4 × 4 pixel image
2.16. V4L2_PIX_FMT_Y8I 4 × 4 pixel image
2.17. V4L2_PIX_FMT_Y12I 2 pixel data stream taking 3 bytes
2.18. V4L2_PIX_FMT_UV8 pixel image
2.19. V4L2_PIX_FMT_YUYV 4 × 4 pixel image
2.20. V4L2_PIX_FMT_UYVY 4 × 4 pixel image
2.21. V4L2_PIX_FMT_YVYU 4 × 4 pixel image
2.22. V4L2_PIX_FMT_VYUY 4 × 4 pixel image
2.23. V4L2_PIX_FMT_Y41P 8 × 4 pixel image
2.24. V4L2_PIX_FMT_YVU420 4 × 4 pixel image
2.25. V4L2_PIX_FMT_YUV420M 4 × 4 pixel image
2.26. V4L2_PIX_FMT_YUV422M 4 × 4 pixel image
2.27. V4L2_PIX_FMT_YUV444M 4 × 4 pixel image
2.28. V4L2_PIX_FMT_YVU410 4 × 4 pixel image
2.29. V4L2_PIX_FMT_YUV422P 4 × 4 pixel image
2.30. V4L2_PIX_FMT_YUV411P 4 × 4 pixel image
2.31. V4L2_PIX_FMT_NV12 4 × 4 pixel image
2.32. V4L2_PIX_FMT_NV12M 4 × 4 pixel image
2.33. Memory layout of macroblocks in V4L2_PIX_FMT_NV12 format pixel image - extreme case
2.34. V4L2_PIX_FMT_NV16 4 × 4 pixel image
2.35. V4L2_PIX_FMT_NV16M 4 × 4 pixel image
2.36. V4L2_PIX_FMT_NV24 4 × 4 pixel image
2.37. V4L2_PIX_FMT_M420 4 × 4 pixel image
2.38. V4L2_PIX_FMT_Z16 4 × 4 pixel image
2.39. V4L2_SDR_FMT_CU8 1 sample
2.40. V4L2_SDR_FMT_CU16LE 1 sample
2.41. V4L2_SDR_FMT_CS8 1 sample
2.42. V4L2_SDR_FMT_CS14LE 1 sample
2.43. 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.