class V4L2::Device

Overview

Represents an opened V4L2 device.

Included Modules

Defined in:

v4l2/device.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(fd : Int32) #

Initializes the device with the previously opened file descriptor.


[View source]
def self.open(path) : Device #

Opens the V4L2 device at the given path.

V4L2::Device.open("/dev/video0")

[View source]

Class Method Detail

def self.open(path, &block : Device -> ) #

Opens the V4L2 device at the given path, yields it, then closes it.

V4L2::Device.open("/dev/video0") do |video|
  # ...
end

[View source]

Instance Method Detail

def audio : Audio #

Retrieves the current audio input.


[View source]
def audio=(new_audio : Audio) : Audio #

Sets the current audio input.


[View source]
def capability : Capability #

The capabilities of the V4L2 device.


[View source]
def close #

Closes the V4L2 device.


[View source]
def closed? : Bool #

Determines whether the V4L2 device is closed.


[View source]
def each_audio(&) : self #

Enumerates over each audio input supported by the V4L2 device, yielding each Audio object.


[View source]
def each_audio_out(&) : self #

Enumerates over each audio output supported by the V4L2 device, yielding each AudioOut object.


[View source]
def each_input(&) : self #

Enumerates over the video inputs, yielding each Input object.


[View source]
def each_output(&) : self #

Enumerates over the video outputs supported by the V4L2 device, yielding each Output object.


[View source]
def each_standard(&) : self #

Enumerates over the supported video standards for the V4L2 device, yielding each Standard object.


[View source]
def fd : Int32 #

The underlying file descriptor.


[View source]
def finalize #

Ensures the V4L2 device gets closed.


[View source]
def frame_buffer : Linux::V4L2FrameBuffer #

Retrieves the current frame buffer.


[View source]
def frame_buffer=(new_fb) #

Sets the current frame buffer.


[View source]
def frequency(tuner : UInt32) #

Retrieves the current tuner or modulator radio frequency, given the tuner or modulator index number.


[View source]
def frequency=(frequency : Frequency) #

Sets the current tuner or modulator frequency.


[View source]
def input : Int32 #

Queries the video input number.


[View source]
def input=(new_input : Int32) : Int32 #

Sets the video input number.


[View source]
def log_status #

Log driver status information.

Note: This ioctl is optional and not all drivers support it. It was introduced in Linux 2.6.15.


[View source]
def meta_capture #

The META_CAPTURE stream.


[View source]
def meta_output #

The META_OUTPUT stream.


[View source]
def modulator(index : UInt32 = 0) : Modulator #

Retrieves the current modulator.


[View source]
def modulator=(modulator : Modulator) #

Sets the current modulator.


[View source]
def output : LibC::Int #

Queries the current video output number.


[View source]
def output=(new_output : Int32) #

Sets the current video output number.


[View source]
def overlay=(start_or_stop : Bool) : Bool #

Starts or stops video overlay I/O.


[View source]
def priority : Priority #

Queries the access priority of the V4L2 device.


[View source]
def priority=(new_priority : Priority) : Priority #

Sets the access priority of the device.


[View source]
def query_capability : Capability #

Queries the V4L2 device capabilities.


[View source]
def read(buffer : Slice(UInt8)) : Int32 #

Reads data directly from the V4L2 device's file descriptor. Returns the number of bytes read. If no data is currently available, this method will wait.


[View source]
def read_timeout : Time::Span #

Queries the read timeout for the V4L2 device's file descriptor.


[View source]
def read_timeout=(new_timeout : Time::Span) #

Sets the read timeout for the V4L2 device's file descriptor.


[View source]
def sdr_capture #

The SDR_CAPTURE stream.


[View source]
def sdr_output #

The SDR_OUTPUT stream.


[View source]
def sliced_vbi_capture #

The SLICED_VBI_CAPTURE stream.


[View source]
def sliced_vbi_output #

The SLICED_VBI_OUTPUT stream.


[View source]
def standard : StandardID #

Queries the current video standard.


[View source]
def standard=(new_std_id : StandardID) #

Sets the current video standard.


[View source]
def to_unsafe : Int32 #

Returns the underlying file descriptor for the V4L2 device.


[View source]
def try_format(new_format : Format) : Bool #

Attempts to change the current format of the V4L2 device, but does not actually change the current format.


[View source]
def vbi_capture #

The VBI_CAPTURE stream.


[View source]
def vbi_output #

The VBI_OUTPUT stream.


[View source]
def video_capture #

The VIDEO_CAPTURE stream.


[View source]
def video_capture_mplane #

The VIDEO_CAPTURE_MPLANE stream.


[View source]
def video_output #

The VIDEO_OUTPUT stream.


[View source]
def video_output_mplane #

The VIDEO_OUTPUT_MPLANE stream.


[View source]
def video_output_overlay #

The VIDEO_OUTPUT_OVERLAY stream.


[View source]
def video_overlay #

The VIDEO_OVERLAY stream.


[View source]
def wait_readable #

Waits for the V4L2 device to indicate data is available for reading.


[View source]
def write(buffer : Slice(UInt8)) #

Writes data directly to the V4L2 device's file descriptor.


[View source]