# `Dala.Media.Pipeline`
[🔗](https://github.com/manhvu/dala/blob/main/lib/dala/media/pipeline.ex#L1)

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)

# `config`

```elixir
@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`

```elixir
@type pipeline_ref() :: pid()
```

# `add_filter`

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

Add a filter to the running pipeline.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `diagnostic`

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

Get pipeline diagnostics.

# `get_state`

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

Get pipeline state.

# `pause`

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

Pause playback.

# `play`

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

Start playback.

# `remove_filter`

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

Remove a filter from the running pipeline.

# `seek`

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

Seek to a position in milliseconds.

# `start`

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

Start a media pipeline with the given configuration.

# `stop`

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

Stop playback and release all resources.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
