videodev2.h revision 847a8b2f04c17cbe47ab56bd07c70f781aa29a87
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef __LINUX_VIDEODEV2_H
#define __LINUX_VIDEODEV2_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* Video for Linux Two
*
* Header file for v4l or V4L2 drivers and applications
* with public API.
* All kernel-specific stuff were moved to media/v4l2-dev.h, so
* no #if __KERNEL tests are allowed here
*
* See http://linuxtv.org for more info
*
* Author: Bill Dirks <bdirks@pacbell.net>
* Justin Schoeman
* et al.
*/
/*
* Common stuff for both V4L1 and V4L2
* Moved from videodev.h
*/
#define VIDEO_MAX_FRAME 32
/*
* M I S C E L L A N E O U S
*/
/* Four-character-code (FOURCC) */
#define v4l2_fourcc(a, b, c, d) \
/*
* E N U M S
*/
enum v4l2_field {
/*
* driver can choose from none, top, bottom, interlaced
* depending on whatever it thinks is approximate ...
*/
V4L2_FIELD_ANY = 0,
/* both fields sequential into one buffer, top-bottom order */
V4L2_FIELD_SEQ_TB = 5,
/* both fields alternating into separate buffers */
};
#define V4L2_FIELD_HAS_TOP(field) \
((field) == V4L2_FIELD_TOP || \
(field) == V4L2_FIELD_INTERLACED || \
(field) == V4L2_FIELD_SEQ_TB || \
(field) == V4L2_FIELD_SEQ_BT)
#define V4L2_FIELD_HAS_BOTTOM(field) \
((field) == V4L2_FIELD_BOTTOM || \
(field) == V4L2_FIELD_INTERLACED || \
(field) == V4L2_FIELD_SEQ_TB || \
(field) == V4L2_FIELD_SEQ_BT)
#define V4L2_FIELD_HAS_BOTH(field) \
((field) == V4L2_FIELD_INTERLACED || \
(field) == V4L2_FIELD_SEQ_TB || \
(field) == V4L2_FIELD_SEQ_BT)
enum v4l2_buf_type {
#if 1
/* Experimental Sliced VBI */
#endif
V4L2_BUF_TYPE_PRIVATE = 0x80
};
enum v4l2_ctrl_type {
V4L2_CTRL_TYPE_MENU = 3,
};
enum v4l2_tuner_type {
V4L2_TUNER_RADIO = 1,
V4L2_TUNER_ANALOG_TV = 2,
};
enum v4l2_memory {
V4L2_MEMORY_MMAP = 1,
V4L2_MEMORY_USERPTR = 2,
};
/* see also http: vektor.theorem.ca/graphics/ycbcr/ */
enum v4l2_colorspace {
/* 1125-Line (US) HDTV */
/* HD and modern captures. */
/* broken BT878 extents (601, luma range 16-253 instead of 16-235) */
/* These should be useful. Assume 601 extents. */
/*
* I know there will be cameras that send this. So, this is
* unspecified chromaticities and full 0-255 on each of the
* Y'CbCr components
*/
V4L2_COLORSPACE_JPEG = 7,
/* For RGB colourspaces, this is probably a good start. */
};
enum v4l2_priority {
V4L2_PRIORITY_UNSET = 0, /* not initialized */
V4L2_PRIORITY_RECORD = 3,
};
struct v4l2_rect {
};
struct v4l2_fract {
};
/*
* D R I V E R C A P A B I L I T I E S
*/
struct v4l2_capability
{
};
/* Values for 'capabilities' field */
/* Is a video capture device */
#define V4L2_CAP_VIDEO_CAPTURE 0x00000001
/* Is a video output device */
#define V4L2_CAP_VIDEO_OUTPUT 0x00000002
/* Is a raw VBI capture device */
#define V4L2_CAP_VBI_CAPTURE 0x00000010
/* Is a raw VBI output device */
#define V4L2_CAP_VBI_OUTPUT 0x00000020
#if 1
/* Is a sliced VBI capture device */
#define V4L2_CAP_SLICED_VBI_CAPTURE 0x00000040
/* Is a sliced VBI output device */
#define V4L2_CAP_SLICED_VBI_OUTPUT 0x00000080
#endif
/*
* V I D E O I M A G E F O R M A T
*/
struct v4l2_pix_format
{
enum v4l2_field field;
enum v4l2_colorspace colorspace;
};
/* Pixel format FOURCC depth Description */
/* 16 RGB-5-5-5 BE */
/* 16 RGB-5-6-5 BE */
/* 16 YVU422 planar */
/* 16 YVU411 planar */
/* two planes -- one Y, one Cr + Cb interleaved */
/* The following formats are not defined in the V4L2 specification */
/* 8 YUV 4:1:1 16x16 macroblocks */
/* see www.siliconimaging.com/RGB%20Bayer.htm */
/* 8 BGBG.. GRGR.. */
/* compressed formats */
/* Motion-JPEG */
/* Vendor-specific formats */
/* Winnov hw compress */
/* SN9C10x compression */
/* pwc older webcam */
/* pwc newer webcam */
/* ET61X251 compression */
/*
* F O R M A T E N U M E R A T I O N
*/
struct v4l2_fmtdesc
{
};
#define V4L2_FMT_FLAG_COMPRESSED 0x0001
/*
* T I M E C O D E
*/
struct v4l2_timecode
{
};
/* Type */
#define V4L2_TC_TYPE_24FPS 1
#define V4L2_TC_TYPE_25FPS 2
#define V4L2_TC_TYPE_30FPS 3
#define V4L2_TC_TYPE_50FPS 4
#define V4L2_TC_TYPE_60FPS 5
/* Flags */
#define V4L2_TC_FLAG_COLORFRAME 0x0002
#define V4L2_TC_USERBITS_field 0x000C
#define V4L2_TC_USERBITS_USERDEFINED 0x0000
#define V4L2_TC_USERBITS_8BITCHARS 0x0008
/* The above is based on SMPTE timecodes */
#ifdef __KERNEL__
/*
* M P E G C O M P R E S S I O N P A R A M E T E R S
*
* ### WARNING: This experimental MPEG compression API is obsolete.
* ### It is replaced by the MPEG controls API.
* ### This old API will disappear in the near future!
*
*/
enum v4l2_bitrate_mode {
V4L2_BITRATE_NONE = 0, /* not specified */
V4L2_BITRATE_CBR, /* constant bitrate */
V4L2_BITRATE_VBR /* variable bitrate */
};
struct v4l2_bitrate {
enum v4l2_bitrate_mode mode;
};
enum v4l2_mpeg_streamtype {
V4L2_MPEG_SS_1, /* MPEG-1 system stream */
V4L2_MPEG_PS_2, /* MPEG-2 program stream */
V4L2_MPEG_TS_2, /* MPEG-2 transport stream */
/* MPEG-2 program stream with DVD header fixups */
};
enum v4l2_mpeg_audiotype {
V4L2_MPEG_AU_2_I, /* MPEG-2 layer 1 */
V4L2_MPEG_AU_2_II, /* MPEG-2 layer 2 */
V4L2_MPEG_AU_2_III, /* MPEG-2 layer 3 */
V4L2_MPEG_AC3, /* AC3 */
V4L2_MPEG_LPCM /* LPCM */
};
enum v4l2_mpeg_videotype {
V4L2_MPEG_VI_1, /* MPEG-1 */
V4L2_MPEG_VI_2 /* MPEG-2 */
};
enum v4l2_mpeg_aspectratio {
};
struct v4l2_mpeg_compression {
/* general */
enum v4l2_mpeg_streamtype st_type;
struct v4l2_bitrate st_bitrate;
/* transport streams */
/* program stream */
/* audio */
enum v4l2_mpeg_audiotype au_type;
struct v4l2_bitrate au_bitrate;
/* video */
enum v4l2_mpeg_videotype vi_type;
struct v4l2_bitrate vi_bitrate;
/* misc flags */
/* I don't expect the above being perfect yet ;) */
};
#endif
struct v4l2_jpegcompression
{
int quality;
/* Number of APP segment to be written, must be 0..15 */
int APPn;
int APP_len; /* Length of data in JPEG APPn segment */
int COM_len; /* Length of data in JPEG COM segment */
/*
* Which markers should go into the JPEG output. Unless you exactly
* know what you do, leave them untouched. Inluding less markers will
* make the resulting code smaller, but there will be fewer
* aplications which can read it. The presence of the APP and COM
* marker is influenced by APP_len and COM_len
* ONLY, not by this property!
*/
/* App segment, driver will allways use APP0 */
};
/*
* M E M O R Y - M A P P I N G B U F F E R S
*/
struct v4l2_requestbuffers
{
enum v4l2_buf_type type;
enum v4l2_memory memory;
};
/*
* this structure is defined to replace timeval structure which includes
* "long" type elements
*/
struct v4l2_timeval {
};
/* this structure is now 64bits alignment */
struct v4l2_buffer
{
enum v4l2_buf_type type;
enum v4l2_field field;
struct v4l2_timeval timestamp;
struct v4l2_timecode timecode;
union {
} m;
/* memory location */
enum v4l2_memory memory;
};
/* Flags for 'flags' field */
/*
* O V E R L A Y P R E V I E W
*/
struct v4l2_framebuffer
{
/*
* FIXME: in theory we should pass something like PCI device + memory
* region + offset instead of some physical address
*/
void* base;
struct v4l2_pix_format fmt;
};
/* Flags for the 'capability' field. Read only */
#define V4L2_FBUF_CAP_EXTERNOVERLAY 0x0001
#define V4L2_FBUF_CAP_CHROMAKEY 0x0002
#define V4L2_FBUF_CAP_LIST_CLIPPING 0x0004
#define V4L2_FBUF_CAP_BITMAP_CLIPPING 0x0008
/* Flags for the 'flags' field. */
#define V4L2_FBUF_FLAG_PRIMARY 0x0001
#define V4L2_FBUF_FLAG_OVERLAY 0x0002
#define V4L2_FBUF_FLAG_CHROMAKEY 0x0004
struct v4l2_clip
{
struct v4l2_rect c;
};
struct v4l2_window
{
struct v4l2_rect w;
enum v4l2_field field;
void *bitmap; /* __user */
};
/*
* C A P T U R E P A R A M E T E R S
*/
struct v4l2_captureparm
{
/* Time per frame in .1us units */
struct v4l2_fract timeperframe;
};
/* Flags for 'capability' and 'capturemode' fields */
struct v4l2_outputparm
{
/* Time per frame in seconds */
struct v4l2_fract timeperframe;
};
/*
* I N P U T I M A G E C R O P P I N G
*/
struct v4l2_cropcap {
enum v4l2_buf_type type;
struct v4l2_fract pixelaspect;
};
struct v4l2_crop {
enum v4l2_buf_type type;
struct v4l2_rect c;
};
/*
* A N A L O G V I D E O S T A N D A R D
*/
typedef uint64_t v4l2_std_id;
/* one bit for each */
/* some merged standards */
#define V4L2_STD_MN \
#define V4L2_STD_B \
#define V4L2_STD_GH \
/* some common needed stuff */
#define V4L2_STD_PAL_BG (V4L2_STD_PAL_B |\
#define V4L2_STD_PAL_DK (V4L2_STD_PAL_D |\
#define V4L2_STD_PAL (V4L2_STD_PAL_BG |\
#define V4L2_STD_NTSC (V4L2_STD_NTSC_M |\
#define V4L2_STD_SECAM_DK (V4L2_STD_SECAM_D |\
#define V4L2_STD_SECAM (V4L2_STD_SECAM_B |\
#define V4L2_STD_525_60 (V4L2_STD_PAL_M |\
#define V4L2_STD_625_50 (V4L2_STD_PAL |\
#define V4L2_STD_ATSC (V4L2_STD_ATSC_8_VSB |\
#define V4L2_STD_UNKNOWN 0
#define V4L2_STD_ALL (V4L2_STD_525_60 |\
/*
* On amd64, use pack(4) to make structures match the x86 alignment rules.
*/
#pragma pack(4)
#endif
struct v4l2_standard
{
};
#pragma pack()
#endif
/*
* V I D E O I N P U T S
*/
struct v4l2_input
{
/*
* Added for 64bits alignment, or, ENUMINPUT ioctl will fail. Because
* 32 bits app and 64bits driver will get different structure size
* which cause the values of ENUMINPUT are different. v4l2_input has a
* 64-bit element which make v4l2_input structure has to be 64bit
* alignment.
*/
};
/* Values for the 'type' field */
#define V4L2_INPUT_TYPE_TUNER 1
#define V4L2_INPUT_TYPE_CAMERA 2
/* field 'status' - general */
#define V4L2_IN_ST_NO_SIGNAL 0x00000002
#define V4L2_IN_ST_NO_COLOR 0x00000004
/* field 'status' - analog */
/* field 'status' - digital */
/* field 'status' - VCR and set-top box */
/*
* V I D E O O U T P U T S
*/
struct v4l2_output
{
};
/* Values for the 'type' field */
#define V4L2_OUTPUT_TYPE_MODULATOR 1
#define V4L2_OUTPUT_TYPE_ANALOG 2
#define V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY 3
/*
* C O N T R O L S
*/
struct v4l2_control
{
};
struct v4l2_ext_control
{
union {
void *reserved;
} value;
}; /* __attribute__ ((packed)), comment for solaris to compile */
struct v4l2_ext_controls
{
struct v4l2_ext_control *controls;
};
/* Values for ctrl_class field */
#define V4L2_CTRL_ID_MASK (0x0fffffff)
/* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */
struct v4l2_queryctrl
{
enum v4l2_ctrl_type type;
};
/* Used in the VIDIOC_QUERYMENU ioctl for querying menu items */
struct v4l2_querymenu
{
};
/* Control flags */
#define V4L2_CTRL_FLAG_DISABLED 0x0001
#define V4L2_CTRL_FLAG_GRABBED 0x0002
#define V4L2_CTRL_FLAG_READ_ONLY 0x0004
#define V4L2_CTRL_FLAG_UPDATE 0x0008
#define V4L2_CTRL_FLAG_INACTIVE 0x0010
#define V4L2_CTRL_FLAG_SLIDER 0x0020
/* Query flag, to be ORed with the control ID */
#define V4L2_CTRL_FLAG_NEXT_CTRL 0x80000000
/* User-class control IDs defined by V4L2 */
#define V4L2_CID_USER_BASE V4L2_CID_BASE
/* IDs reserved for driver specific controls */
#define V4L2_CID_PRIVATE_BASE 0x08000000
#define V4L2_CID_BRIGHTNESS (V4L2_CID_BASE+0)
/* MPEG-class control IDs defined by V4L2 */
/* MPEG streams */
#define V4L2_CID_MPEG_STREAM_TYPE (V4L2_CID_MPEG_BASE+0)
enum v4l2_mpeg_stream_type {
V4L2_MPEG_STREAM_TYPE_MPEG2_PS = 0, /* MPEG-2 program stream */
};
enum v4l2_mpeg_stream_vbi_fmt {
V4L2_MPEG_STREAM_VBI_FMT_NONE = 0, /* No VBI in the MPEG stream */
/* VBI in private packets, IVTV format */
};
/* MPEG audio */
};
enum v4l2_mpeg_audio_encoding {
};
enum v4l2_mpeg_audio_l1_bitrate {
};
enum v4l2_mpeg_audio_l2_bitrate {
};
enum v4l2_mpeg_audio_l3_bitrate {
};
enum v4l2_mpeg_audio_mode {
};
};
enum v4l2_mpeg_audio_emphasis {
};
enum v4l2_mpeg_audio_crc {
};
/* MPEG video */
enum v4l2_mpeg_video_encoding {
};
enum v4l2_mpeg_video_aspect {
};
enum v4l2_mpeg_video_bitrate_mode {
};
/* MPEG-class control IDs specific to the CX2584x driver as defined by V4L2 */
#define V4L2_CID_MPEG_CX2341X_BASE \
(V4L2_CTRL_CLASS_MPEG | 0x1000)
};
4
};
};
};
};
/*
* T U N I N G
*/
struct v4l2_tuner
{
enum v4l2_tuner_type type;
};
struct v4l2_modulator
{
};
/* Flags for the 'capability' field */
#define V4L2_TUNER_CAP_LOW 0x0001
#define V4L2_TUNER_CAP_NORM 0x0002
#define V4L2_TUNER_CAP_STEREO 0x0010
#define V4L2_TUNER_CAP_LANG2 0x0020
#define V4L2_TUNER_CAP_SAP 0x0020
#define V4L2_TUNER_CAP_LANG1 0x0040
/* Flags for the 'rxsubchans' field */
#define V4L2_TUNER_SUB_MONO 0x0001
#define V4L2_TUNER_SUB_STEREO 0x0002
#define V4L2_TUNER_SUB_LANG2 0x0004
#define V4L2_TUNER_SUB_SAP 0x0004
#define V4L2_TUNER_SUB_LANG1 0x0008
/* Values for the 'audmode' field */
#define V4L2_TUNER_MODE_MONO 0x0000
#define V4L2_TUNER_MODE_STEREO 0x0001
#define V4L2_TUNER_MODE_LANG2 0x0002
#define V4L2_TUNER_MODE_SAP 0x0002
#define V4L2_TUNER_MODE_LANG1 0x0003
#define V4L2_TUNER_MODE_LANG1_LANG2 0x0004
struct v4l2_frequency
{
enum v4l2_tuner_type type;
};
/*
* A U D I O
*/
struct v4l2_audio
{
};
/* Flags for the 'capability' field */
#define V4L2_AUDCAP_STEREO 0x00001
#define V4L2_AUDCAP_AVL 0x00002
/* Flags for the 'mode' field */
#define V4L2_AUDMODE_AVL 0x00001
struct v4l2_audioout
{
};
/*
* D A T A S E R V I C E S ( V B I )
*
* Data services API by Michael Schimek
*/
/* Raw VBI */
struct v4l2_vbi_format
{
};
/* VBI flags */
#define V4L2_VBI_UNSYNC (1<< 0)
#if 1
/*
* Sliced VBI
*
* This implements is a proposal V4L2 API to allow SLICED VBI
* required for some hardware encoders. It should change without
* notice in the definitive implementation.
*/
struct v4l2_sliced_vbi_format
{
/*
* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first
* field
* service_lines[1][...] specifies lines 0-23 (1-23 used) of the second
* field
* (equals frame lines 313-336 for 625 line video standards,
* 263-286 for 525 line standards)
*/
};
/*
* Teletext World System Teletext
* (WST), defined on ITU-R BT.653-2
*/
#define V4L2_SLICED_TELETEXT_B (0x0001)
/* Video Program System, defined on ETS 300 231 */
#define V4L2_SLICED_VPS (0x0400)
/* Closed Caption, defined on EIA-608 */
#define V4L2_SLICED_CAPTION_525 (0x1000)
/* Wide Screen System, defined on ITU-R BT1119.1 */
#define V4L2_SLICED_WSS_625 (0x4000)
#define V4L2_SLICED_VBI_525 (V4L2_SLICED_CAPTION_525)
struct v4l2_sliced_vbi_cap
{
/*
* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first
* field
* service_lines[1][...] specifies lines 0-23 (1-23 used) of the second
* field
* (equals frame lines 313-336 for 625 line video standards, 263-286
* for 525 line standards)
*/
};
struct v4l2_sliced_vbi_data
{
};
#endif
/*
* A G G R E G A T E S T R U C T U R E S
*/
/*
* Stream data format
*/
struct v4l2_format
{
enum v4l2_buf_type type;
/*
* Added for 64bits alignment, or, S_FMT ioctl will fail. Because
* 32 bits app and 64bits driver will get different structure size
* which cause the values of S_FMT are different. v4l2_window has
* pointers which make v4l2_format structure has to be 64bit alignment.
*/
union
{
#if 1
/* V4L2_BUF_TYPE_SLICED_VBI_CAPTURE */
struct v4l2_sliced_vbi_format sliced;
#endif
} fmt;
};
/*
* Stream type-dependent parameters
*/
struct v4l2_streamparm
{
enum v4l2_buf_type type;
union
{
struct v4l2_captureparm capture;
struct v4l2_outputparm output;
} parm;
};
/*
* I O C T L C O D E S F O R V I D E O D E V I C E S
*
*/
#ifdef __KERNEL__
#endif
#if 1
#endif
#ifdef __OLD_VIDIOC_
/* for compatibility, will go away some day */
#endif
#ifdef __cplusplus
}
#endif
#endif /* __LINUX_VIDEODEV2_H */
/*
* Local variables:
* c-basic-offset: 8
* End:
*/