Xav.Reader (xav v0.1.1)

Media reader.

Link to this section Summary

Types

Reader options.

t()

Functions

Creates a new media reader.

The same as new/1 but raises on error.

Reads next frame.

Link to this section Types

@type opts() :: [read: :audio | :video, device?: boolean()]

Reader options.

  • read - determines which stream to read from a file with both audio and video. Defaults to :video.
  • device? - determines whether path points to video camera. Defaults to false.
@type t() :: %Xav.Reader{
  bit_rate: integer(),
  codec: atom(),
  duration: integer(),
  in_format: atom(),
  out_format: atom(),
  reader: reference(),
  sample_rate: integer() | nil
}

Link to this section Functions

Link to this function

new(path, opts)

@spec new(String.t(), opts()) :: {:ok, t()} | {:error, term()}

Creates a new media reader.

Both reading from a file and video camera is supported. In case of video camera, v4l2 driver is required and FPS are locked to 10.

Microphone input is not supported.

Link to this function

new!(path, opts)

@spec new!(String.t(), opts()) :: t()

The same as new/1 but raises on error.

Link to this function

next_frame(reader)

@spec next_frame(t()) :: {:ok, Xav.Frame.t()} | {:error, :eof}

Reads next frame.

Frame is always decoded. Video frames are always in RGB format.