View Source Membrane.MP4.Demuxer.DemuxingSource (Membrane MP4 plugin v0.36.0)

A Membrane Source capable of reading streams from the MP4 file.

It requires specifying provide_data_callback - a function that will be called each time data from MP4 needs to be read. If you know in advance what kind of track you want to read from the MP4, you can link the element's Pad.ref(:output, id) (with any desired id) pad with the kind: :audio | :video option provided. Alternatively, you can spawn the element without linking its pads and wait until the tracks are resolved. Once the Demuxer identifies the tracks in the MP4, new_tracks_t/0 notification is sent with description of each of the tracks and a corresponding track_id. The parent can then link Pad.ref(:output, track_id) for desired tracks.

Element options

Passed via struct Membrane.MP4.Demuxer.DemuxingSource.t/0

  • provide_data_cb

    Engine.provide_data_cb()

    Required
    A function that will be called each time the Membrane.MP4.Demuxer.DemuxingSource needs data. It should read desired number of bytes from MP4 file, starting at given position.

  • start_at

    non_neg_integer()

    Default value: 0
    Specifies the decoding timestamp of the first sample that should be read from each of the tracks.

    If there is no sample with exactly such a timestamp, that sample will be the first sample with DTS greater than provided timestamp.

Pads

:output

Accepted formats:

%Membrane.AAC{config: {:esds, _esds}}
%Membrane.H264{stream_structure: {_avc, _dcr}, alignment: :au}
%Membrane.H265{stream_structure: {_hevc, _dcr}, alignment: :au}
%Membrane.Opus{self_delimiting?: false}
Direction::output
Availability::on_request
Flow control::manual
Demand unit::buffers

Pad options:

  • kind

    :video | :audio | nil

    Default value: nil
    Specifies the decoding timestamp of the first sample that should be read from each of the tracks. If there is no sample with exactly such a timestamp, that sample will be the first sample with DTS greater than provided timestamp.

Summary

Types

Notification sent when the tracks are identified in the MP4.

Options for pad :output

t()

Struct containing options for Membrane.MP4.Demuxer.DemuxingSource

Functions

Returns description of options available for this module

Types

@type new_tracks_t() :: {:new_tracks, [{track_id :: integer(), content :: struct()}]}

Notification sent when the tracks are identified in the MP4.

Upon receiving the notification, Pad.ref(:output, track_id) pads should be linked for the desired track_ids in the list. The content field contains the stream format describing given track.

@type output_pad_opts() :: [{:kind, :video | :audio | nil}]

Options for pad :output

@type t() :: %Membrane.MP4.Demuxer.DemuxingSource{
  provide_data_cb: Membrane.MP4.Demuxer.ISOM.Engine.provide_data_cb(),
  start_at: non_neg_integer()
}

Struct containing options for Membrane.MP4.Demuxer.DemuxingSource

Functions

@spec options() :: keyword()

Returns description of options available for this module