# `Direct.Playlist`
[🔗](https://github.com/alexdont/direct_stream/blob/v0.1.0/lib/direct/playlist.ex#L1)

HLS master playlists: for a multi-audio conversion, for ffmpeg's own
multi-audio TS output made fit for a player, and subtitle renditions
added to either.

# `master`

```elixir
@spec master([map()], pos_integer(), keyword()) :: String.t()
```

The master playlist of a multi-audio conversion: every track as a
switchable rendition of one group. The default is the first track in the
first preferred language the release has (`:prefer`, a code or a list in
order), else the first track. Without a CODECS attribute on purpose —
hls.js on Firefox stops at the HEVC string. The playlists named are those
of `:part`; `:subs` are listed as subtitle renditions.

# `subtitle_renditions`

The `#EXT-X-MEDIA` lines for subtitle tracks (of `part`); none shown unless picked.

# `tidy_master`

```elixir
@spec tidy_master(String.t(), keyword()) :: String.t()
```

ffmpeg's master playlist for a multi-audio TS conversion, made fit for the
player: ffmpeg names every rendition `audio_N`, and tracks of one language
can all point at one rendition file, so the list is cut down to one entry
per file, named by its language, with the preferred language the default.
Options as `master/3` (`:prefer`, `:subs`).

# `with_subtitles`

A master playlist with subtitle renditions added: their `#EXT-X-MEDIA`
lines before the variant, which gets `SUBTITLES="subs"`. Nothing changes
without tracks.

# `wrap_media`

A single media playlist under a master, so subtitle renditions can ride along.

---

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