Reformatting of python files.

This commit is contained in:
David Carley
2022-08-31 14:26:54 +00:00
parent 0c58292347
commit d94bf96a56
23 changed files with 877 additions and 1264 deletions

View File

@@ -39,7 +39,6 @@
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""
Python bindings for the v4l2 userspace api in Linux 2.6.34
"""
@@ -49,7 +48,6 @@ Python bindings for the v4l2 userspace api in Linux 2.6.34
import ctypes
import platform
# See ioctl.h of your architecture for appropriate constants here.
# This has been tested only on x86 and MIPS
_IOC_NRBITS = 8
@@ -62,24 +60,25 @@ _IOC_SIZESHIFT = _IOC_TYPESHIFT + _IOC_TYPEBITS
if (platform.machine() == "mips"):
_IOC_NONE = 1
_IOC_READ = 2
_IOC_WRITE = 4
_IOC_WRITE = 4
_IOC_SIZEBITS = 13
_IOC_DIRBITS = 3
else:
_IOC_NONE = 0
_IOC_WRITE = 1
_IOC_READ = 2
_IOC_READ = 2
_IOC_SIZEBITS = 14
_IOC_DIRBITS = 2
_IOC_DIRSHIFT = _IOC_SIZESHIFT + _IOC_SIZEBITS
def _IOC(dir_, type_, nr, size):
return (
ctypes.c_int32(dir_ << _IOC_DIRSHIFT).value |
ctypes.c_int32(ord(type_) << _IOC_TYPESHIFT).value |
ctypes.c_int32(nr << _IOC_NRSHIFT).value |
ctypes.c_int32(size << _IOC_SIZESHIFT).value)
return (ctypes.c_int32(dir_ << _IOC_DIRSHIFT).value
| ctypes.c_int32(ord(type_) << _IOC_TYPESHIFT).value
| ctypes.c_int32(nr << _IOC_NRSHIFT).value
| ctypes.c_int32(size << _IOC_SIZESHIFT).value)
def _IOC_TYPECHECK(t):
return ctypes.sizeof(t)
@@ -96,6 +95,7 @@ def _IOW(type_, nr, size):
def _IOR(type_, nr, size):
return _IOC(_IOC_READ, type_, nr, _IOC_TYPECHECK(size))
def _IOWR(type_, nr, size):
return _IOC(_IOC_READ | _IOC_WRITE, type_, nr, _IOC_TYPECHECK(size))
@@ -107,11 +107,11 @@ def _IOWR(type_, nr, size):
enum = ctypes.c_uint
c_int = ctypes.c_int
#
# time
#
class timeval(ctypes.Structure):
_fields_ = [
('secs', ctypes.c_long),
@@ -123,10 +123,8 @@ class timeval(ctypes.Structure):
# v4l2
#
VIDEO_MAX_FRAME = 32
VID_TYPE_CAPTURE = 1
VID_TYPE_TUNER = 2
VID_TYPE_TELETEXT = 4
@@ -134,7 +132,7 @@ VID_TYPE_OVERLAY = 8
VID_TYPE_CHROMAKEY = 16
VID_TYPE_CLIPPING = 32
VID_TYPE_FRAMERAM = 64
VID_TYPE_SCALES = 128
VID_TYPE_SCALES = 128
VID_TYPE_MONOCHROME = 256
VID_TYPE_SUBCAPTURE = 512
VID_TYPE_MPEG_DECODER = 1024
@@ -163,32 +161,23 @@ v4l2_field = enum
def V4L2_FIELD_HAS_TOP(field):
return (
field == V4L2_FIELD_TOP or
field == V4L2_FIELD_INTERLACED or
field == V4L2_FIELD_INTERLACED_TB or
field == V4L2_FIELD_INTERLACED_BT or
field == V4L2_FIELD_SEQ_TB or
field == V4L2_FIELD_SEQ_BT)
return (field == V4L2_FIELD_TOP or field == V4L2_FIELD_INTERLACED
or field == V4L2_FIELD_INTERLACED_TB
or field == V4L2_FIELD_INTERLACED_BT or field == V4L2_FIELD_SEQ_TB
or field == V4L2_FIELD_SEQ_BT)
def V4L2_FIELD_HAS_BOTTOM(field):
return (
field == V4L2_FIELD_BOTTOM or
field == V4L2_FIELD_INTERLACED or
field == V4L2_FIELD_INTERLACED_TB or
field == V4L2_FIELD_INTERLACED_BT or
field == V4L2_FIELD_SEQ_TB or
field == V4L2_FIELD_SEQ_BT)
return (field == V4L2_FIELD_BOTTOM or field == V4L2_FIELD_INTERLACED
or field == V4L2_FIELD_INTERLACED_TB
or field == V4L2_FIELD_INTERLACED_BT or field == V4L2_FIELD_SEQ_TB
or field == V4L2_FIELD_SEQ_BT)
def V4L2_FIELD_HAS_BOTH(field):
return (
field == V4L2_FIELD_INTERLACED or
field == V4L2_FIELD_INTERLACED_TB or
field == V4L2_FIELD_INTERLACED_BT or
field == V4L2_FIELD_SEQ_TB or
field == V4L2_FIELD_SEQ_BT)
return (field == V4L2_FIELD_INTERLACED or field == V4L2_FIELD_INTERLACED_TB
or field == V4L2_FIELD_INTERLACED_BT or field == V4L2_FIELD_SEQ_TB
or field == V4L2_FIELD_SEQ_BT)
v4l2_buf_type = enum
@@ -206,7 +195,6 @@ v4l2_buf_type = enum
V4L2_BUF_TYPE_PRIVATE,
) = list(range(1, 11)) + [0x80]
v4l2_ctrl_type = enum
(
V4L2_CTRL_TYPE_INTEGER,
@@ -218,7 +206,6 @@ v4l2_ctrl_type = enum
V4L2_CTRL_TYPE_STRING,
) = range(1, 8)
v4l2_tuner_type = enum
(
V4L2_TUNER_RADIO,
@@ -226,7 +213,6 @@ v4l2_tuner_type = enum
V4L2_TUNER_DIGITAL_TV,
) = range(1, 4)
v4l2_memory = enum
(
V4L2_MEMORY_MMAP,
@@ -234,7 +220,6 @@ v4l2_memory = enum
V4L2_MEMORY_OVERLAY,
) = range(1, 4)
v4l2_colorspace = enum
(
V4L2_COLORSPACE_SMPTE170M,
@@ -247,7 +232,6 @@ v4l2_colorspace = enum
V4L2_COLORSPACE_SRGB,
) = range(1, 9)
v4l2_priority = enum
(
V4L2_PRIORITY_UNSET,
@@ -278,6 +262,7 @@ class v4l2_fract(ctypes.Structure):
# Driver capabilities
#
class v4l2_capability(ctypes.Structure):
_fields_ = [
('driver', ctypes.c_uint8 * 16),
@@ -315,11 +300,11 @@ V4L2_CAP_READWRITE = 0x01000000
V4L2_CAP_ASYNCIO = 0x02000000
V4L2_CAP_STREAMING = 0x04000000
#
# Video image format
#
class v4l2_pix_format(ctypes.Structure):
_fields_ = [
('width', ctypes.c_uint32),
@@ -332,6 +317,7 @@ class v4l2_pix_format(ctypes.Structure):
('priv', ctypes.c_uint32),
]
# RGB formats
V4L2_PIX_FMT_RGB332 = v4l2_fourcc('R', 'G', 'B', '1')
V4L2_PIX_FMT_RGB444 = v4l2_fourcc('R', '4', '4', '4')
@@ -346,7 +332,7 @@ V4L2_PIX_FMT_RGB32 = v4l2_fourcc('R', 'G', 'B', '4')
# Grey formats
V4L2_PIX_FMT_GREY = v4l2_fourcc('G', 'R', 'E', 'Y')
V4L2_PIX_FMT_Y10 = v4l2_fourcc('Y', '1', '0', ' ')
V4L2_PIX_FMT_Y10 = v4l2_fourcc('Y', '1', '0', ' ')
V4L2_PIX_FMT_Y16 = v4l2_fourcc('Y', '1', '6', ' ')
# Palette formats
@@ -417,11 +403,11 @@ V4L2_PIX_FMT_OV511 = v4l2_fourcc('O', '5', '1', '1')
V4L2_PIX_FMT_OV518 = v4l2_fourcc('O', '5', '1', '8')
V4L2_PIX_FMT_STV0680 = v4l2_fourcc('S', '6', '8', '0')
#
# Format enumeration
#
class v4l2_fmtdesc(ctypes.Structure):
_fields_ = [
('index', ctypes.c_uint32),
@@ -432,10 +418,10 @@ class v4l2_fmtdesc(ctypes.Structure):
('reserved', ctypes.c_uint32 * 4),
]
V4L2_FMT_FLAG_COMPRESSED = 0x0001
V4L2_FMT_FLAG_EMULATED = 0x0002
#
# Experimental frame size and frame rate enumeration
#
@@ -467,21 +453,18 @@ class v4l2_frmsize_stepwise(ctypes.Structure):
class v4l2_frmsizeenum(ctypes.Structure):
class _u(ctypes.Union):
_fields_ = [
('discrete', v4l2_frmsize_discrete),
('stepwise', v4l2_frmsize_stepwise),
]
_fields_ = [
('index', ctypes.c_uint32),
('pixel_format', ctypes.c_uint32),
('type', ctypes.c_uint32),
('_u', _u),
('reserved', ctypes.c_uint32 * 2)
]
_fields_ = [('index', ctypes.c_uint32), ('pixel_format', ctypes.c_uint32),
('type', ctypes.c_uint32), ('_u', _u),
('reserved', ctypes.c_uint32 * 2)]
_anonymous_ = ('_u',)
_anonymous_ = ('_u', )
#
@@ -505,6 +488,7 @@ class v4l2_frmival_stepwise(ctypes.Structure):
class v4l2_frmivalenum(ctypes.Structure):
class _u(ctypes.Union):
_fields_ = [
('discrete', v4l2_fract),
@@ -521,13 +505,14 @@ class v4l2_frmivalenum(ctypes.Structure):
('reserved', ctypes.c_uint32 * 2),
]
_anonymous_ = ('_u',)
_anonymous_ = ('_u', )
#
# Timecode
#
class v4l2_timecode(ctypes.Structure):
_fields_ = [
('type', ctypes.c_uint32),
@@ -571,11 +556,11 @@ V4L2_JPEG_MARKER_DRI = 1 << 5
V4L2_JPEG_MARKER_COM = 1 << 6
V4L2_JPEG_MARKER_APP = 1 << 7
#
# Memory-mapping buffers
#
class v4l2_requestbuffers(ctypes.Structure):
_fields_ = [
('count', ctypes.c_uint32),
@@ -586,6 +571,7 @@ class v4l2_requestbuffers(ctypes.Structure):
class v4l2_plane(ctypes.Structure):
class _u(ctypes.Union):
_fields_ = [
('mem_offset', ctypes.c_uint32),
@@ -600,13 +586,12 @@ class v4l2_plane(ctypes.Structure):
('reserved', ctypes.c_uint32 * 11),
]
class v4l2_buffer(ctypes.Structure):
class _u(ctypes.Union):
_fields_ = [
('offset', ctypes.c_uint32),
('userptr', ctypes.c_ulong),
('planes', ctypes.POINTER(v4l2_plane))
]
_fields_ = [('offset', ctypes.c_uint32), ('userptr', ctypes.c_ulong),
('planes', ctypes.POINTER(v4l2_plane))]
_fields_ = [
('index', ctypes.c_uint32),
@@ -634,11 +619,11 @@ V4L2_BUF_FLAG_BFRAME = 0x0020
V4L2_BUF_FLAG_TIMECODE = 0x0100
V4L2_BUF_FLAG_INPUT = 0x0200
#
# Overlay preview
#
class v4l2_framebuffer(ctypes.Structure):
_fields_ = [
('capability', ctypes.c_uint32),
@@ -647,8 +632,9 @@ class v4l2_framebuffer(ctypes.Structure):
('fmt', v4l2_pix_format),
]
V4L2_FBUF_CAP_EXTERNOVERLAY = 0x0001
V4L2_FBUF_CAP_CHROMAKEY = 0x0002
V4L2_FBUF_CAP_CHROMAKEY = 0x0002
V4L2_FBUF_CAP_LIST_CLIPPING = 0x0004
V4L2_FBUF_CAP_BITMAP_CLIPPING = 0x0008
V4L2_FBUF_CAP_LOCAL_ALPHA = 0x0010
@@ -667,6 +653,8 @@ V4L2_FBUF_FLAG_SRC_CHROMAKEY = 0x0040
class v4l2_clip(ctypes.Structure):
pass
v4l2_clip._fields_ = [
('c', v4l2_rect),
('next', ctypes.POINTER(v4l2_clip)),
@@ -689,6 +677,7 @@ class v4l2_window(ctypes.Structure):
# Capture parameters
#
class v4l2_captureparm(ctypes.Structure):
_fields_ = [
('capability', ctypes.c_uint32),
@@ -719,6 +708,7 @@ class v4l2_outputparm(ctypes.Structure):
# Input image cropping
#
class v4l2_cropcap(ctypes.Structure):
_fields_ = [
('type', v4l2_buf_type),
@@ -741,7 +731,6 @@ class v4l2_crop(ctypes.Structure):
v4l2_std_id = ctypes.c_uint64
V4L2_STD_PAL_B = 0x00000001
V4L2_STD_PAL_B1 = 0x00000002
V4L2_STD_PAL_G = 0x00000004
@@ -773,26 +762,31 @@ V4L2_STD_SECAM_LC = 0x00800000
V4L2_STD_ATSC_8_VSB = 0x01000000
V4L2_STD_ATSC_16_VSB = 0x02000000
# some common needed stuff
V4L2_STD_PAL_BG = (V4L2_STD_PAL_B | V4L2_STD_PAL_B1 | V4L2_STD_PAL_G)
V4L2_STD_PAL_DK = (V4L2_STD_PAL_D | V4L2_STD_PAL_D1 | V4L2_STD_PAL_K)
V4L2_STD_PAL = (V4L2_STD_PAL_BG | V4L2_STD_PAL_DK | V4L2_STD_PAL_H | V4L2_STD_PAL_I)
V4L2_STD_PAL = (V4L2_STD_PAL_BG | V4L2_STD_PAL_DK | V4L2_STD_PAL_H
| V4L2_STD_PAL_I)
V4L2_STD_NTSC = (V4L2_STD_NTSC_M | V4L2_STD_NTSC_M_JP | V4L2_STD_NTSC_M_KR)
V4L2_STD_SECAM_DK = (V4L2_STD_SECAM_D | V4L2_STD_SECAM_K | V4L2_STD_SECAM_K1)
V4L2_STD_SECAM = (V4L2_STD_SECAM_B | V4L2_STD_SECAM_G | V4L2_STD_SECAM_H | V4L2_STD_SECAM_DK | V4L2_STD_SECAM_L | V4L2_STD_SECAM_LC)
V4L2_STD_SECAM = (V4L2_STD_SECAM_B | V4L2_STD_SECAM_G | V4L2_STD_SECAM_H
| V4L2_STD_SECAM_DK | V4L2_STD_SECAM_L | V4L2_STD_SECAM_LC)
V4L2_STD_525_60 = (V4L2_STD_PAL_M | V4L2_STD_PAL_60 | V4L2_STD_NTSC | V4L2_STD_NTSC_443)
V4L2_STD_625_50 = (V4L2_STD_PAL | V4L2_STD_PAL_N | V4L2_STD_PAL_Nc | V4L2_STD_SECAM)
V4L2_STD_525_60 = (V4L2_STD_PAL_M | V4L2_STD_PAL_60 | V4L2_STD_NTSC
| V4L2_STD_NTSC_443)
V4L2_STD_625_50 = (V4L2_STD_PAL | V4L2_STD_PAL_N | V4L2_STD_PAL_Nc
| V4L2_STD_SECAM)
V4L2_STD_ATSC = (V4L2_STD_ATSC_8_VSB | V4L2_STD_ATSC_16_VSB)
V4L2_STD_UNKNOWN = 0
V4L2_STD_ALL = (V4L2_STD_525_60 | V4L2_STD_625_50)
# some merged standards
V4L2_STD_MN = (V4L2_STD_PAL_M | V4L2_STD_PAL_N | V4L2_STD_PAL_Nc | V4L2_STD_NTSC)
V4L2_STD_MN = (V4L2_STD_PAL_M | V4L2_STD_PAL_N | V4L2_STD_PAL_Nc
| V4L2_STD_NTSC)
V4L2_STD_B = (V4L2_STD_PAL_B | V4L2_STD_PAL_B1 | V4L2_STD_SECAM_B)
V4L2_STD_GH = (V4L2_STD_PAL_G | V4L2_STD_PAL_H|V4L2_STD_SECAM_G | V4L2_STD_SECAM_H)
V4L2_STD_GH = (V4L2_STD_PAL_G | V4L2_STD_PAL_H | V4L2_STD_SECAM_G
| V4L2_STD_SECAM_H)
V4L2_STD_DK = (V4L2_STD_PAL_DK | V4L2_STD_SECAM_DK)
@@ -811,17 +805,16 @@ class v4l2_standard(ctypes.Structure):
# Video timings dv preset
#
class v4l2_dv_preset(ctypes.Structure):
_fields_ = [
('preset', ctypes.c_uint32),
('reserved', ctypes.c_uint32 * 4)
]
_fields_ = [('preset', ctypes.c_uint32), ('reserved', ctypes.c_uint32 * 4)]
#
# DV preset enumeration
#
class v4l2_dv_enum_preset(ctypes.Structure):
_fields_ = [
('index', ctypes.c_uint32),
@@ -832,6 +825,7 @@ class v4l2_dv_enum_preset(ctypes.Structure):
('reserved', ctypes.c_uint32 * 4),
]
#
# DV preset values
#
@@ -846,21 +840,21 @@ V4L2_DV_720P50 = 6
V4L2_DV_720P59_94 = 7
V4L2_DV_720P60 = 8
V4L2_DV_1080I29_97 = 9
V4L2_DV_1080I30 = 10
V4L2_DV_1080I25 = 11
V4L2_DV_1080I50 = 12
V4L2_DV_1080I60 = 13
V4L2_DV_1080P24 = 14
V4L2_DV_1080P25 = 15
V4L2_DV_1080P30 = 16
V4L2_DV_1080P50 = 17
V4L2_DV_1080P60 = 18
V4L2_DV_1080I30 = 10
V4L2_DV_1080I25 = 11
V4L2_DV_1080I50 = 12
V4L2_DV_1080I60 = 13
V4L2_DV_1080P24 = 14
V4L2_DV_1080P25 = 15
V4L2_DV_1080P30 = 16
V4L2_DV_1080P50 = 17
V4L2_DV_1080P60 = 18
#
# DV BT timings
#
class v4l2_bt_timings(ctypes.Structure):
_fields_ = [
('width', ctypes.c_uint32),
@@ -882,6 +876,7 @@ class v4l2_bt_timings(ctypes.Structure):
_pack_ = True
# Interlaced or progressive format
V4L2_DV_PROGRESSIVE = 0
V4L2_DV_INTERLACED = 1
@@ -892,6 +887,7 @@ V4L2_DV_HSYNC_POS_POL = 0x00000002
class v4l2_dv_timings(ctypes.Structure):
class _u(ctypes.Union):
_fields_ = [
('bt', v4l2_bt_timings),
@@ -903,18 +899,18 @@ class v4l2_dv_timings(ctypes.Structure):
('_u', _u),
]
_anonymous_ = ('_u',)
_anonymous_ = ('_u', )
_pack_ = True
# Values for the type field
V4L2_DV_BT_656_1120 = 0
#
# Video inputs
#
class v4l2_input(ctypes.Structure):
_fields_ = [
('index', ctypes.c_uint32),
@@ -957,6 +953,7 @@ V4L2_IN_CAP_STD = 0x00000004
# Video outputs
#
class v4l2_output(ctypes.Structure):
_fields_ = [
('index', ctypes.c_uint32),
@@ -970,7 +967,7 @@ class v4l2_output(ctypes.Structure):
V4L2_OUTPUT_TYPE_MODULATOR = 1
V4L2_OUTPUT_TYPE_ANALOG = 2
V4L2_OUTPUT_TYPE_ANALOG = 2
V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY = 3
V4L2_OUT_CAP_PRESETS = 0x00000001
@@ -981,6 +978,7 @@ V4L2_OUT_CAP_STD = 0x00000004
# Controls
#
class v4l2_control(ctypes.Structure):
_fields_ = [
('id', ctypes.c_uint32),
@@ -989,6 +987,7 @@ class v4l2_control(ctypes.Structure):
class v4l2_ext_control(ctypes.Structure):
class _u(ctypes.Union):
_fields_ = [
('value', ctypes.c_int32),
@@ -996,13 +995,10 @@ class v4l2_ext_control(ctypes.Structure):
('reserved', ctypes.c_void_p),
]
_fields_ = [
('id', ctypes.c_uint32),
('reserved2', ctypes.c_uint32 * 2),
('_u', _u)
]
_fields_ = [('id', ctypes.c_uint32), ('reserved2', ctypes.c_uint32 * 2),
('_u', _u)]
_anonymous_ = ('_u',)
_anonymous_ = ('_u', )
_pack_ = True
@@ -1016,25 +1012,26 @@ class v4l2_ext_controls(ctypes.Structure):
]
V4L2_CTRL_CLASS_USER = 0x00980000 # Old-style 'user' controls
V4L2_CTRL_CLASS_MPEG = 0x00990000 # MPEG-compression controls
V4L2_CTRL_CLASS_CAMERA = 0x009a0000 # Camera class controls
V4L2_CTRL_CLASS_FM_TX = 0x009b0000 # FM Modulator controls
V4L2_CTRL_CLASS_FLASH = 0x009c0000 # Camera flash controls
V4L2_CTRL_CLASS_JPEG = 0x009d0000 # JPEG-compression controls
V4L2_CTRL_CLASS_IMAGE_SOURCE = 0x009e0000 # Image source controls
V4L2_CTRL_CLASS_IMAGE_PROC = 0x009f0000 # Image processing controls
V4L2_CTRL_CLASS_DV = 0x00a00000 # Digital Video controls
V4L2_CTRL_CLASS_FM_RX = 0x00a10000 # FM Receiver controls
V4L2_CTRL_CLASS_RF_TUNER = 0x00a20000 # RF tuner controls
V4L2_CTRL_CLASS_DETECT = 0x00a30000 # Detection controls
V4L2_CTRL_CLASS_USER = 0x00980000 # Old-style 'user' controls
V4L2_CTRL_CLASS_MPEG = 0x00990000 # MPEG-compression controls
V4L2_CTRL_CLASS_CAMERA = 0x009a0000 # Camera class controls
V4L2_CTRL_CLASS_FM_TX = 0x009b0000 # FM Modulator controls
V4L2_CTRL_CLASS_FLASH = 0x009c0000 # Camera flash controls
V4L2_CTRL_CLASS_JPEG = 0x009d0000 # JPEG-compression controls
V4L2_CTRL_CLASS_IMAGE_SOURCE = 0x009e0000 # Image source controls
V4L2_CTRL_CLASS_IMAGE_PROC = 0x009f0000 # Image processing controls
V4L2_CTRL_CLASS_DV = 0x00a00000 # Digital Video controls
V4L2_CTRL_CLASS_FM_RX = 0x00a10000 # FM Receiver controls
V4L2_CTRL_CLASS_RF_TUNER = 0x00a20000 # RF tuner controls
V4L2_CTRL_CLASS_DETECT = 0x00a30000 # Detection controls
def V4L2_CTRL_ID_MASK():
return 0x0fffffff
def V4L2_CTRL_ID2CLASS(id_):
return id_ & 0x0fff0000 # unsigned long
return id_ & 0x0fff0000 # unsigned long
def V4L2_CTRL_DRIVER_PRIV(id_):
@@ -1089,13 +1086,13 @@ V4L2_CID_AUDIO_BASS = V4L2_CID_BASE + 7
V4L2_CID_AUDIO_TREBLE = V4L2_CID_BASE + 8
V4L2_CID_AUDIO_MUTE = V4L2_CID_BASE + 9
V4L2_CID_AUDIO_LOUDNESS = V4L2_CID_BASE + 10
V4L2_CID_BLACK_LEVEL = V4L2_CID_BASE + 11 # Deprecated
V4L2_CID_BLACK_LEVEL = V4L2_CID_BASE + 11 # Deprecated
V4L2_CID_AUTO_WHITE_BALANCE = V4L2_CID_BASE + 12
V4L2_CID_DO_WHITE_BALANCE = V4L2_CID_BASE + 13
V4L2_CID_RED_BALANCE = V4L2_CID_BASE + 14
V4L2_CID_BLUE_BALANCE = V4L2_CID_BASE + 15
V4L2_CID_GAMMA = V4L2_CID_BASE + 16
V4L2_CID_WHITENESS = V4L2_CID_GAMMA # Deprecated
V4L2_CID_WHITENESS = V4L2_CID_GAMMA # Deprecated
V4L2_CID_EXPOSURE = V4L2_CID_BASE + 17
V4L2_CID_AUTOGAIN = V4L2_CID_BASE + 18
V4L2_CID_GAIN = V4L2_CID_BASE + 19
@@ -1286,7 +1283,7 @@ v4l2_mpeg_audio_crc = enum
V4L2_CID_MPEG_AUDIO_MUTE = V4L2_CID_MPEG_BASE + 109
V4L2_CID_MPEG_AUDIO_AAC_BITRATE = V4L2_CID_MPEG_BASE + 110
V4L2_CID_MPEG_AUDIO_AC3_BITRATE = V4L2_CID_MPEG_BASE + 111
V4L2_CID_MPEG_AUDIO_AC3_BITRATE = V4L2_CID_MPEG_BASE + 111
v4l2_mpeg_audio_ac3_bitrate = enum
(
@@ -1472,7 +1469,6 @@ v4l2_preemphasis = enum
V4L2_CID_TUNE_POWER_LEVEL = V4L2_CID_FM_TX_CLASS_BASE + 113
V4L2_CID_TUNE_ANTENNA_CAPACITOR = V4L2_CID_FM_TX_CLASS_BASE + 114
# JPEG-class control IDs
V4L2_CID_JPEG_CLASS_BASE = V4L2_CTRL_CLASS_JPEG | 0x900
@@ -1480,7 +1476,7 @@ V4L2_CID_JPEG_CLASS = V4L2_CTRL_CLASS_JPEG | 1
V4L2_CID_JPEG_CHROMA_SUBSAMPLING = V4L2_CID_JPEG_CLASS_BASE + 1
v4l2_jpeg_chroma_subsampling = enum
v4l2_jpeg_chroma_subsampling = enum
(
V4L2_JPEG_CHROMA_SUBSAMPLING_444,
V4L2_JPEG_CHROMA_SUBSAMPLING_422,
@@ -1493,18 +1489,18 @@ v4l2_jpeg_chroma_subsampling = enum
V4L2_CID_JPEG_RESTART_INTERVAL = V4L2_CID_JPEG_CLASS_BASE + 2
V4L2_CID_JPEG_COMPRESSION_QUALITY = V4L2_CID_JPEG_CLASS_BASE + 3
V4L2_CID_JPEG_ACTIVE_MARKER = V4L2_CID_JPEG_CLASS_BASE + 4
V4L2_CID_JPEG_ACTIVE_MARKER = V4L2_CID_JPEG_CLASS_BASE + 4
V4L2_JPEG_ACTIVE_MARKER_APP0 = 1 << 0
V4L2_JPEG_ACTIVE_MARKER_APP1 = 1 << 1
V4L2_JPEG_ACTIVE_MARKER_COM = 1 << 16
V4L2_JPEG_ACTIVE_MARKER_DQT = 1 << 17
V4L2_JPEG_ACTIVE_MARKER_DHT = 1 << 18
V4L2_JPEG_ACTIVE_MARKER_COM = 1 << 16
V4L2_JPEG_ACTIVE_MARKER_DQT = 1 << 17
V4L2_JPEG_ACTIVE_MARKER_DHT = 1 << 18
#
# Tuning
#
class v4l2_tuner(ctypes.Structure):
_fields_ = [
('index', ctypes.c_uint32),
@@ -1579,6 +1575,7 @@ class v4l2_hw_freq_seek(ctypes.Structure):
# RDS
#
class v4l2_rds_data(ctypes.Structure):
_fields_ = [
('lsb', ctypes.c_char),
@@ -1589,7 +1586,7 @@ class v4l2_rds_data(ctypes.Structure):
_pack_ = True
V4L2_RDS_BLOCK_MSK = 0x7
V4L2_RDS_BLOCK_MSK = 0x7
V4L2_RDS_BLOCK_A = 0
V4L2_RDS_BLOCK_B = 1
V4L2_RDS_BLOCK_C = 2
@@ -1600,11 +1597,11 @@ V4L2_RDS_BLOCK_INVALID = 7
V4L2_RDS_BLOCK_CORRECTED = 0x40
V4L2_RDS_BLOCK_ERROR = 0x80
#
# Audio
#
class v4l2_audio(ctypes.Structure):
_fields_ = [
('index', ctypes.c_uint32),
@@ -1672,7 +1669,9 @@ V4L2_ENC_CMD_STOP_AT_GOP_END = 1 << 0
class v4l2_encoder_cmd(ctypes.Structure):
class _u(ctypes.Union):
class _s(ctypes.Structure):
_fields_ = [
('data', ctypes.c_uint32 * 8),
@@ -1688,13 +1687,14 @@ class v4l2_encoder_cmd(ctypes.Structure):
('_u', _u),
]
_anonymous_ = ('_u',)
_anonymous_ = ('_u', )
#
# Data services (VBI)
#
class v4l2_vbi_format(ctypes.Structure):
_fields_ = [
('sampling_rate', ctypes.c_uint32),
@@ -1726,8 +1726,8 @@ V4L2_SLICED_VPS = 0x0400
V4L2_SLICED_CAPTION_525 = 0x1000
V4L2_SLICED_WSS_625 = 0x4000
V4L2_SLICED_VBI_525 = V4L2_SLICED_CAPTION_525
V4L2_SLICED_VBI_625 = (
V4L2_SLICED_TELETEXT_B | V4L2_SLICED_VPS | V4L2_SLICED_WSS_625)
V4L2_SLICED_VBI_625 = (V4L2_SLICED_TELETEXT_B | V4L2_SLICED_VPS
| V4L2_SLICED_WSS_625)
class v4l2_sliced_vbi_cap(ctypes.Structure):
@@ -1753,7 +1753,6 @@ class v4l2_sliced_vbi_data(ctypes.Structure):
# Sliced VBI data inserted into MPEG Streams
#
V4L2_MPEG_VBI_IVTV_TELETEXT_B = 1
V4L2_MPEG_VBI_IVTV_CAPTION_525 = 4
V4L2_MPEG_VBI_IVTV_WSS_625 = 5
@@ -1771,7 +1770,7 @@ class v4l2_mpeg_vbi_itv0_line(ctypes.Structure):
class v4l2_mpeg_vbi_itv0(ctypes.Structure):
_fields_ = [
('linemask', ctypes.c_uint32 * 2), # how to define __le32 in ctypes?
('linemask', ctypes.c_uint32 * 2), # how to define __le32 in ctypes?
('line', v4l2_mpeg_vbi_itv0_line * 35),
]
@@ -1791,18 +1790,16 @@ V4L2_MPEG_VBI_IVTV_MAGIC1 = "ITV0"
class v4l2_mpeg_vbi_fmt_ivtv(ctypes.Structure):
class _u(ctypes.Union):
_fields_ = [
('itv0', v4l2_mpeg_vbi_itv0),
('ITV0', v4l2_mpeg_vbi_ITV0),
]
_fields_ = [
('magic', ctypes.c_char * 4),
('_u', _u)
]
_fields_ = [('magic', ctypes.c_char * 4), ('_u', _u)]
_anonymous_ = ('_u',)
_anonymous_ = ('_u', )
_pack_ = True
@@ -1810,7 +1807,9 @@ class v4l2_mpeg_vbi_fmt_ivtv(ctypes.Structure):
# Aggregate structures
#
class v4l2_format(ctypes.Structure):
class _u(ctypes.Union):
_fields_ = [
('pix', v4l2_pix_format),
@@ -1827,6 +1826,7 @@ class v4l2_format(ctypes.Structure):
class v4l2_streamparm(ctypes.Structure):
class _u(ctypes.Union):
_fields_ = [
('capture', v4l2_captureparm),
@@ -1834,10 +1834,7 @@ class v4l2_streamparm(ctypes.Structure):
('raw_data', ctypes.c_char * 200),
]
_fields_ = [
('type', v4l2_buf_type),
('parm', _u)
]
_fields_ = [('type', v4l2_buf_type), ('parm', _u)]
#
@@ -1851,6 +1848,7 @@ V4L2_CHIP_MATCH_AC97 = 3
class v4l2_dbg_match(ctypes.Structure):
class _u(ctypes.Union):
_fields_ = [
('addr', ctypes.c_uint32),
@@ -1862,7 +1860,7 @@ class v4l2_dbg_match(ctypes.Structure):
('_u', _u),
]
_anonymous_ = ('_u',)
_anonymous_ = ('_u', )
_pack_ = True
@@ -1897,7 +1895,7 @@ VIDIOC_ENUM_FMT = _IOWR('V', 2, v4l2_fmtdesc)
VIDIOC_G_FMT = _IOWR('V', 4, v4l2_format)
VIDIOC_S_FMT = _IOWR('V', 5, v4l2_format)
VIDIOC_REQBUFS = _IOWR('V', 8, v4l2_requestbuffers)
VIDIOC_QUERYBUF = _IOWR('V', 9, v4l2_buffer)
VIDIOC_QUERYBUF = _IOWR('V', 9, v4l2_buffer)
VIDIOC_G_FBUF = _IOR('V', 10, v4l2_framebuffer)
VIDIOC_S_FBUF = _IOW('V', 11, v4l2_framebuffer)
VIDIOC_OVERLAY = _IOW('V', 14, ctypes.c_int)
@@ -1925,7 +1923,7 @@ VIDIOC_G_OUTPUT = _IOR('V', 46, ctypes.c_int)
VIDIOC_S_OUTPUT = _IOWR('V', 47, ctypes.c_int)
VIDIOC_ENUMOUTPUT = _IOWR('V', 48, v4l2_output)
VIDIOC_G_AUDOUT = _IOR('V', 49, v4l2_audioout)
VIDIOC_S_AUDOUT = _IOW('V', 50, v4l2_audioout)
VIDIOC_S_AUDOUT = _IOW('V', 50, v4l2_audioout)
VIDIOC_G_MODULATOR = _IOWR('V', 54, v4l2_modulator)
VIDIOC_S_MODULATOR = _IOW('V', 55, v4l2_modulator)
VIDIOC_G_FREQUENCY = _IOWR('V', 56, v4l2_frequency)