Membrane.RawAudioParser (Membrane RawAudioParser plugin v0.5.0)

Copy Markdown View Source

This element is responsible for parsing audio in RawAudio format. The Parser ensures that output buffers have whole samples.

By default, the parser doesn't ensure that each output buffer holds the same number of samples, it only re-aligns buffers to whole samples. When chunk_duration is set, the parser additionally re-chunks the stream, so that every output buffer carries exactly chunk_duration worth of audio.

Element options

Passed via struct Membrane.RawAudioParser.t/0

  • assumed_input_stream_format

    RawAudio.t() | nil

    Default value: nil
    The format of the stream to assume if the stream format received on the input pad is Membrane.RemoteStream.t/0. When nil, the format received on the input pad is used. When both formats are instances of Membrane.RawAudio.t/0, the parser expects them to be identical.

  • overwrite_pts?

    boolean()

    Default value: false
    If set to true, RawAudioParser will add timestamps based on payload duration. The first buffer's timestamp value can be specified with the pts_offset option and defaults to 0.

  • pts_offset

    non_neg_integer()

    Default value: 0
    If set to a value different than 0, RawAudioParser will start timestamps from this offset. Only valid when :overwrite_pts? is set to true.

  • chunk_duration

    Membrane.Time.t() | nil

    Default value: nil
    When set, output buffers are re-chunked so that each one carries exactly chunk_duration worth of audio. Bytes that don't fill a whole chunk are buffered until enough data arrives. The trailing remainder is flushed as a (possibly shorter) buffer at end of stream.

    When nil (the default), the parser only re-aligns buffers to whole samples and otherwise passes them through unchanged.

Pads

:input

Accepted formats:

Membrane.RawAudio
Membrane.RemoteStream
Direction::input
Availability::always
Flow control::auto

:output

Accepted formats:

Membrane.RawAudio
Direction::output
Availability::always
Flow control::auto

Summary

Types

t()

Struct containing options for Membrane.RawAudioParser

Functions

Returns description of options available for this module

Types

t()

@type t() :: %Membrane.RawAudioParser{
  assumed_input_stream_format: Membrane.RawAudio.t() | nil,
  chunk_duration: Membrane.Time.t() | nil,
  overwrite_pts?: boolean(),
  pts_offset: non_neg_integer()
}

Struct containing options for Membrane.RawAudioParser

Functions

options()

@spec options() :: keyword()

Returns description of options available for this module