ISOMedia.DASH (ISOMedia v0.2.0)

Copy Markdown View Source

Generate the DASH MPD (.mpd) for the CMAF segments ISOMedia.split_segments/1 produces: a single muxed static/VOD rendition using SegmentTemplate + SegmentTimeline. Pure XML templating over FragmentIndex.fragment_spans/1 + ISOMedia.Manifest (the same codec/resolution/bandwidth computations HLS uses), via a small zero-dependency XML builder (element/3 + attr_escape/1 + iso8601_duration/1) — the library keeps no runtime deps, and the MPD's value surface is small and controlled. write_dash/3 derives the segment filenames from the $Number$ template so the written files match the manifest.

Summary

Functions

Escape an XML attribute value: &&amp;, <&lt;, >&gt;, "&quot; (ampersand first so existing entities are not double-escaped).

The DASH MPD (.mpd) string for a fragmented tree.

Write the DASH bundle into dir (created if absent): the MPD (opts[:manifest_name], default manifest.mpd) and — via ISOMedia.write_segments/3init.mp4 + the media segments. The write_segments :segment_pattern is derived from :segment_template so the written filenames match the manifest. Returns {:ok, [manifest_path | segment_paths]}.

Functions

attr_escape(value)

@spec attr_escape(String.t()) :: String.t()

Escape an XML attribute value: &&amp;, <&lt;, >&gt;, "&quot; (ampersand first so existing entities are not double-escaped).

manifest(boxes, opts \\ [])

@spec manifest(
  [ISOMedia.Box.t()],
  keyword()
) :: String.t()

The DASH MPD (.mpd) string for a fragmented tree.

opts: :init_name ("init.mp4"), :segment_template ("seg-$Number$.m4s"). Raises ArgumentError on a non-fragmented (progressive) tree.

write_dash(dir, boxes, opts \\ [])

@spec write_dash(Path.t(), [ISOMedia.Box.t()], keyword()) :: {:ok, [Path.t()]}

Write the DASH bundle into dir (created if absent): the MPD (opts[:manifest_name], default manifest.mpd) and — via ISOMedia.write_segments/3init.mp4 + the media segments. The write_segments :segment_pattern is derived from :segment_template so the written filenames match the manifest. Returns {:ok, [manifest_path | segment_paths]}.