View Source ExWebRTC.Media.Ogg.Reader (ex_webrtc v0.7.0)

Reads Opus packets from an Ogg container file.

For now, works only with single Opus stream in the container.

Based on:

Summary

Functions

Closes an Ogg reader.

Reads next Ogg packet.

Opens Ogg file.

Types

Functions

@spec close(t()) :: :ok | {:error, term()}

Closes an Ogg reader.

When a process owning the Ogg reader exits, Ogg reader is closed automatically.

@spec next_packet(t()) ::
  {:ok, {binary(), non_neg_integer()}, t()} | {:error, term()} | :eof

Reads next Ogg packet.

One Ogg packet is equivalent to one Opus packet. This function also returns the duration of the audio in milliseconds, based on Opus packet TOC sequence (see RFC 6716, sec. 3). It assumes that all of the Ogg packets belong to the same stream.

@spec open(Path.t()) :: {:ok, t()} | {:error, term()}

Opens Ogg file.

For now, works only with single Opus stream in the container. This function reads the ID and Comment Headers (and, for now, ignores them).