Internal documentation

This is the documentation of the internals of v4l2ctl

Module ioctlmacros

Module v4l2interface

Module v4l2device

exception v4l2ctl.v4l2device.FeatureNotSupported

Bases: Exception

__module__ = 'v4l2ctl.v4l2device'
__weakref__

list of weak references to the object (if defined)

class v4l2ctl.v4l2device.V4l2Device(device='/dev/video0')

Bases: io.IOBase

Initialize the V4l2Device object and read its basic information.

Keyword Arguments:
 device (str, path-like, int) – the video device (default r”/dev/video0”) if an int is given, it is assumed to be number after “video” in “/dev”.
Raises:IoctlError – if a non-video device file is given.
__abstractmethods__ = frozenset()
__enter__()
__exit__(exc_type, exc, tb)
__init__(device='/dev/video0')

Initialize self. See help(type(self)) for accurate signature.

__iter__()

Implement iter(self).

__module__ = 'v4l2ctl.v4l2device'
__next__()

Implement next(self).

__repr__()

Return repr(self).

_abc_impl = <_abc_data object>
_open()
buffer_type

The buffer type (see V4l2BufferType) required for several operations. This attribute does not change anything in the device itself. It is used by other operations.

bus

The bus through which this device is connected (read-only).

capabilities

The device specific capabilities (read-only). These are the capabilities associated with this dev-file only. The physical device can have more than one dev-file, and hence more capabilities. See physical_capabilities.

close()

Flush and close the IO object.

This method has no effect if the file is already closed.

closed
cropping_buffer_types = [<V4l2BufferType.VIDEO_CAPTURE: 1>, <V4l2BufferType.VIDEO_CAPTURE_MPLANE: 9>, <V4l2BufferType.VIDEO_OUTPUT: 2>, <V4l2BufferType.VIDEO_OUTPUT_MPLANE: 10>, <V4l2BufferType.VIDEO_OVERLAY: 3>]
cropping_capabilities

The cropping capabilities (read-only). These are the cropping capabilities of this video device.

Only valid for these buffer types:
  • V4l2BufferType.VIDEO_CAPTURE
  • V4l2BufferType.VIDEO_CAPTURE_MPLANE
  • V4l2BufferType.VIDEO_OUTPUT
  • V4l2BufferType.VIDEO_OUTPUT_MPLANE
  • V4l2BufferType.VIDEO_OVERLAY
cropping_rectangle

The cropping rectangle (see V4l2Rectangle).

Note

The cropping rectange is specfic to the set buffer type. (See buffer_type)

device

The device file (read-only).

driver

The linux driver (read-only).

fileno()

Returns underlying file descriptor if one exists.

OSError is raised if the IO object does not use a file descriptor.

flush()

Flush write buffers, if applicable.

This is not implemented for read-only and non-blocking streams.

formats

A generator for the suported formats by this video device.

Note

The formats are specfic to the set buffer type. (See buffer_type)

isatty()

Return whether this is an ‘interactive’ stream.

Return False if it can’t be determined.

iter_buffer_formats(buffer_type)

Iterate over the formats supported by a certain buffer.

Keyword Arguments:
 buffer_type – see V4l2BufferType.
Returns:a generator
static iter_devices(skip_links=True)

Return an iterator over the available v4l2 devices.

Keyword Arguments:
 skip_links (bool) – skip links and return every device only once (default True)
Returns:an iterator
name

The card name (read-only).

physical_capabilities

The general physical capabilities (read-only). These are the capabilities associated with the physical device as a while, and not limited to this dev-file only.

readable()

Return whether object was opened for reading.

If False, read() will raise OSError.

readline(size=-1)

Read and return a line from the stream.

If size is specified, at most size bytes will be read.

The line terminator is always b’n’ for binary files; for text files, the newlines argument to open can be used to select the line terminator(s) recognized.

readlines(hint=-1)

Return a list of lines from the stream.

hint can be specified to control the number of lines read: no more lines will be read if the total size (in bytes/characters) of all lines so far exceeds hint.

seekable()

Return whether object supports random access.

If False, seek(), tell() and truncate() will raise OSError. This method may need to do a test seek().

supported_buffer_types

The supported buffer types by this video device (read-only).

version

The kernel version as a string (read-only).

version_tuple

The kernel version as a tuple (read-only).

writable()

Return whether object was opened for writing.

If False, write() will raise OSError.

writelines(lines)

Write a list of lines to stream.

Line separators are not added, so it is usual for each of the lines provided to have a line separator at the end.

class v4l2ctl.v4l2device.V4l2DeviceIterator(skip_links)

Bases: object

__dict__ = mappingproxy({'__module__': 'v4l2ctl.v4l2device', '_v4l2_device_prefixes': ['video', 'radio', 'vbi', 'swradio', 'v4l-subdev'], '__init__': <function V4l2DeviceIterator.__init__>, '__iter__': <function V4l2DeviceIterator.__iter__>, '__dict__': <attribute '__dict__' of 'V4l2DeviceIterator' objects>, '__weakref__': <attribute '__weakref__' of 'V4l2DeviceIterator' objects>, '__doc__': None})
__init__(skip_links)

Initialize self. See help(type(self)) for accurate signature.

__iter__()
__module__ = 'v4l2ctl.v4l2device'
__weakref__

list of weak references to the object (if defined)

_v4l2_device_prefixes = ['video', 'radio', 'vbi', 'swradio', 'v4l-subdev']