Membrane.HTTPAdaptiveStream.Manifest.Track (Membrane HTTP Adaptive Stream plugin v0.4.0) View Source

Struct representing a state of a single manifest track and functions to operate on it.

Link to this section Summary

Functions

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. New header has to be stored under the returned filename. For details on discontinuity, please refer to RFC 8216.

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

Link to this section Types

Specs

id_t() :: any()
Link to this type

segment_bytes_size_t()

View Source

Specs

segment_bytes_size_t() :: non_neg_integer()

Specs

segment_duration_t() :: Membrane.Time.t() | Ratio.t()

Specs

segments_t() ::
  Qex.t(%{
    name: String.t(),
    duration: segment_duration_t(),
    bytes_size: segment_bytes_size_t(),
    attributes: [Membrane.HTTPAdaptiveStream.Manifest.SegmentAttribute.t()]
  })

Specs

t() :: %Membrane.HTTPAdaptiveStream.Manifest.Track{
  awaiting_discontinuity: term(),
  content_type: :audio | :video,
  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(),
  id: id_t(),
  persist?: boolean(),
  segment_extension: String.t(),
  segments: segments_t(),
  stale_headers: term(),
  stale_segments: segments_t(),
  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:

  • id_string - serialized id
  • header_name - name of the header file
  • current_seq_num - the number to identify the next segment
  • current_discontinuity_seq_num - number of current discontinuity sequence.
  • segments - segments' names and durations
  • stale_segments - stale segments' names and durations, kept empty unless persist? is set to true
  • stale_headers - stale headers' names, kept empty unless persist? is set to true
  • finished? - determines whether the track is finished
  • window_duration - current window duration

Specs

to_remove_names_t() :: [segment_names: [String.t()], header_names: [String.t()]]

Link to this section Functions

Link to this function

add_segment(track, duration, bytes_size, attributes \\ [])

View Source

Specs

add_segment(t(), segment_duration_t(), segment_bytes_size_t(), [
  Membrane.HTTPAdaptiveStream.Manifest.SegmentAttribute.t()
]) :: {{to_add_name :: String.t(), to_remove_names :: to_remove_names_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.

Specs

all_segments(t()) :: [segment_name :: String.t()]

Returns all segments present in the track, including stale segments.

Specs

discontinue(t()) :: {header_name :: String.t(), 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.

Specs

finish(t()) :: t()

Marks the track as finished. After this action, it won't be possible to add any new segments to the track.

Specs

from_beginning(t()) :: t()

Return new track with all stale segments restored, resulting in playback of historic data. Only works with 'persist?' option enabled

Specs