Dala.Media.Pipeline (dala v0.3.0)

Copy Markdown View Source

High-level media pipeline orchestrator.

Ties together all media subsystems into a coherent pipeline:

Stream  Decode  Texture Pool  Scene Compositor  GPU Surface
                                     
        Adaptive    Subtitles     Filters/Effects
        Bitrate                      
                   Clock  Animation
            

Example

{:ok, pipeline} = Dala.Media.Pipeline.start(%{
  url: "https://example.com/stream.m3u8",
  width: 1920,
  height: 1080,
  fps: 60,
  subtitles: "subtitles.srt",
  filters: [:blur, :lut],
  adaptive: true
})

Dala.Media.Pipeline.play(pipeline)
Dala.Media.Pipeline.pause(pipeline)
Dala.Media.Pipeline.stop(pipeline)

Summary

Functions

Add a filter to the running pipeline.

Returns a specification to start this module under a supervisor.

Get pipeline diagnostics.

Get pipeline state.

Pause playback.

Start playback.

Remove a filter from the running pipeline.

Seek to a position in milliseconds.

Start a media pipeline with the given configuration.

Stop playback and release all resources.

Types

config()

@type config() :: %{
  url: String.t(),
  width: non_neg_integer(),
  height: non_neg_integer(),
  fps: pos_integer(),
  subtitles: String.t() | nil,
  filters: [atom()],
  adaptive: boolean(),
  loop: boolean(),
  volume: float()
}

pipeline_ref()

@type pipeline_ref() :: pid()

Functions

add_filter(pid, filter_type, params \\ %{})

@spec add_filter(pipeline_ref(), atom(), map()) :: :ok | {:error, term()}

Add a filter to the running pipeline.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

diagnostic(pid)

@spec diagnostic(pipeline_ref()) :: map()

Get pipeline diagnostics.

get_state(pid)

@spec get_state(pipeline_ref()) :: atom()

Get pipeline state.

pause(pid)

@spec pause(pipeline_ref()) :: :ok

Pause playback.

play(pid)

@spec play(pipeline_ref()) :: :ok

Start playback.

remove_filter(pid, filter_type)

@spec remove_filter(pipeline_ref(), atom()) :: :ok

Remove a filter from the running pipeline.

seek(pid, position_ms)

@spec seek(pipeline_ref(), non_neg_integer()) :: :ok

Seek to a position in milliseconds.

start(config)

@spec start(map()) :: {:ok, pipeline_ref()} | {:error, term()}

Start a media pipeline with the given configuration.

stop(pid)

@spec stop(pipeline_ref()) :: :ok

Stop playback and release all resources.