Skip to main content

Crate ssai_runtime

Crate ssai_runtime 

Source
Expand description

Sans-IO SCTE-35 server-side ad insertion (SSAI) session core — issue #929.

Per-session ad-break state (session), a pluggable ad-decision trait (decision), SCTE-35 splice-point conditioning against real segment or keyframe boundaries (splice), and per-session HLS Interstitial (EXT-X-DATERANGE CLASS="com.apple.hls.interstitial", draft-pantos-hls-rfc8216bis Appendix D, transcribed at broadcast-hls/docs/interstitials.md) playlist rendering over broadcast_hls::MediaPlaylist (playlist).

Mirrors the rtsp-runtime/hls-runtime split the rest of the workspace uses: this crate is the driveable, sans-IO core; an HTTP-facing adapter (e.g. a multimux output) is separate, later work that layers on top of it rather than living inside it.

§What this crate is not

  • No HTTP client, no VAST/VMAP. decision::AdDecisionProvider is the only extension point for “which ad to play” — implementing it (and doing whatever network I/O that requires) is entirely the caller’s job. This crate never makes a network call.
  • No media manipulation. Splicing the actual CMAF/TS bytes at the conditioned splice point is transmux’s job (its splice/SSAI IR transforms and PTS/DTS rebase); this crate only decides where that splice point is and what the per-session manifest should say about it.
  • No per-viewer media cursor. Every viewer in a break watches one of a small set of pre-conditioned ad assets, and outside a break sees byte-identical primary content — see the issue’s design-decision comment. What differs per session is a small session::BreakState record, never a media_plane::Trunk cursor; media-plane’s O(N)-in-cursor-count rule is about the shared media rings, not this.
  • No multimux HTTP wiring. That adapter is future work, not this crate.

no_std + alloc.

Re-exports§

pub use decision::AdBreakDecision;
pub use decision::AdDecisionProvider;
pub use decision::AssetSource;
pub use decision::BreakContext;
pub use decision::RestrictMode;
pub use decision::SnapMode;
pub use error::Error;
pub use error::Result;
pub use playlist::INTERSTITIAL_CLASS;
pub use playlist::InterstitialDateRange;
pub use playlist::SessionPlaylistBase;
pub use playlist::render_session_playlist;
pub use session::BreakState;
pub use session::SessionStore;
pub use splice::ConditionedSplicePoint;
pub use splice::PTS_MODULUS_33;
pub use splice::SnapDirection;
pub use splice::condition_splice_point;
pub use splice::condition_splice_point_wrapping;

Modules§

decision
Ad-break decision types.
error
Crate error type.
playlist
Per-session HLS Interstitial playlist rendering.
session
Per-session ad-break state.
splice
Splice-point conditioning: aligning a SCTE-35 cue’s target presentation time (splice_time().pts_time, ANSI/SCTE 35 2023r1 §9.8.1, or a DASH emsg’s presentation_time) against the primary content’s actual segment/keyframe boundaries.