View Source Membrane.HTTPAdaptiveStream.Manifest.Track (Membrane HTTP Adaptive Stream plugin v0.12.0)
Struct representing a state of a single manifest track and functions to operate on it.
Link to this section Summary
Types
The struct representing a track.
Functions
Append a partial segment to the current incomplete segment.
Add a segment of given duration to the track.
It is recommended not to pass discontinuity attribute manually but use discontinue/1
function instead.
Returns all segments present in the track, including stale segments.
Discontinue the track, indicating that parameters of the stream have changed.
Finalize current segment.
Marks the track as finished. After this action, it won't be possible to add any new segments to the track.
Return new track with all stale segments restored, resulting in playback of historic data. Only works with 'persist?' option enabled.
Tells whether the track is able to produce partial media segments.
Link to this section Types
@type id_t() :: any()
@type segment_byte_size_t() :: non_neg_integer()
@type segment_duration_t() :: Membrane.Time.t() | Ratio.t()
@type segment_opt_t() :: {:name, String.t()} | {:complete?, boolean()} | {:duration, segment_duration_t()} | {:byte_size, segment_byte_size_t()}
@type segments_t() :: Qex.t(Membrane.HTTPAdaptiveStream.Manifest.Segment.t())
@type t() :: %Membrane.HTTPAdaptiveStream.Manifest.Track{ awaiting_discontinuity: term(), content_type: :audio | :video | :muxed, current_discontinuity_seq_num: non_neg_integer(), current_seq_num: non_neg_integer(), discontinuities_counter: non_neg_integer(), finished?: boolean(), header_extension: String.t(), header_name: String.t(), header_naming_fun: (t(), counter :: non_neg_integer() -> String.t()), id: id_t(), next_segment_id: non_neg_integer(), persist?: boolean(), segment_extension: String.t(), segment_naming_fun: (t() -> String.t()), segments: segments_t(), stale_headers: term(), stale_segments: segments_t(), target_partial_segment_duration: segment_duration_t() | nil, target_segment_duration: segment_duration_t(), target_window_duration: Membrane.Time.t() | Ratio.t(), track_name: String.t(), window_duration: non_neg_integer() }
The struct representing a track.
Consists of all the fields from Config.t
and also:
header_name
- name of the header filecurrent_seq_num
- the number to identify the next segmentcurrent_discontinuity_seq_num
- number of current discontinuity sequence.segments
- segments' names and durationsstale_segments
- stale segments' names and durations, kept empty unlesspersist?
is set to truestale_headers
- stale headers' names, kept empty unlesspersist?
is set to truefinished?
- determines whether the track is finishedwindow_duration
- current window durationdiscontinuities_counter
- the number of discontinuities that happened so farnext_segment_id
- the sequence number of the next segment that will be generated
Link to this section Functions
@spec add_partial_segment(t(), boolean(), segment_duration_t(), segment_byte_size_t()) :: {Membrane.HTTPAdaptiveStream.Manifest.Track.Changeset.t(), t()}
Append a partial segment to the current incomplete segment.
The current segment is supposed to be of type :partial
, meaning that it is still in a phase
of gathering partial segments before being finalized into a full segment. There can only be
a single such segment and it must be the last one.
@spec add_segment(t(), [segment_opt_t()], [ Membrane.HTTPAdaptiveStream.Manifest.SegmentAttribute.t() ]) :: {Membrane.HTTPAdaptiveStream.Manifest.Track.Changeset.t(), t()}
Add a segment of given duration to the track.
It is recommended not to pass discontinuity attribute manually but use discontinue/1
function instead.
Returns all segments present in the track, including stale segments.
@spec default_header_naming_fun(t(), non_neg_integer()) :: String.t()
Discontinue the track, indicating that parameters of the stream have changed.
New header has to be stored under the returned filename. For details on discontinuity, please refer to RFC 8216.
@spec finalize_current_segment(t()) :: {Membrane.HTTPAdaptiveStream.Manifest.Track.Changeset.t(), t()}
Finalize current segment.
With low latency, a regular segments gets created gradually. Each partial segment gets appended to a regular one, if all parts are collected then the regular segment is said to be complete.
This function aims to finalize the current (latest) segment that is still incomplete so it can live on its own and so a new segment can get started.
Marks the track as finished. After this action, it won't be possible to add any new segments to the track.
Return new track with all stale segments restored, resulting in playback of historic data. Only works with 'persist?' option enabled.
@spec new(Membrane.HTTPAdaptiveStream.Manifest.Track.Config.t()) :: t()
Tells whether the track is able to produce partial media segments.