smooth_runtime/lib.rs
1#![forbid(unsafe_code)]
2#![cfg_attr(docsrs, feature(doc_cfg))]
3
4//! Sans-IO Smooth Streaming (MS-SSTR) client engine (issue #2370).
5//!
6//! One engine owns everything a Smooth pull client does between bytes: manifest
7//! fetch and live refresh, `<Protection>` refusal, `StreamIndex` identity across a
8//! refresh, stream/quality selection, chunk enumeration, fragment URL resolution,
9//! first-fragment track-id discovery, the synthetic init segment, the `tfxd`
10//! timestamp base, the encrypted-fragment probe, retry/backoff, live join
11//! look-ahead and discontinuity. Manifest syntax is `broadcast-smooth`'s; codec
12//! glue and fMP4 demux are `transmux`'s.
13//!
14//! The pull side is [`SmoothClient`]; the **serving** side is
15//! [`server::SmoothOrigin`] (feature `std`), which renders a live Manifest from
16//! a `media_plane::Trunk` and resolves fragment requests — the same split
17//! `hls-runtime` makes between its client and its `server` module, with
18//! `multimux` an adapter over it.
19//!
20//! The shape follows `dash-runtime`'s `DashClient`: the host drives it with
21//! [`SmoothClient::poll`] (what to fetch next), [`SmoothClient::on_manifest`],
22//! [`SmoothClient::on_fragment`] and [`SmoothClient::on_failure`], and drains
23//! [`SmoothClient::next_output`]. Every instant is an argument in microseconds; no
24//! I/O happens and no clock is read inside the crate.
25//!
26//! The wire syntax is MS-SSTR, transcribed in
27//! `private/specs-verified/mpeg/transmux/smooth/ms-sstr.md`.
28
29pub mod client;
30pub mod error;
31#[cfg(feature = "std")]
32#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
33pub mod server;
34
35pub use client::{
36 Action, Dropped, FetchFailure, ManifestFault, Output, QualityInfo, QualitySelector, RequestId,
37 SmoothClient, SmoothConfig, StreamId,
38};
39pub use error::SmoothError;
40#[cfg(feature = "std")]
41pub use server::{
42 FragmentLocation, SmoothBody, SmoothOrigin, SmoothOriginConfig, SmoothOriginError,
43 SmoothRequest, StreamKey,
44};