Referencia Zigtransmux

transmux/plan.zig

Declaraciones públicas de transmux/plan.zig (transmux).

ImplementadoSin versión del tren todavía· generada desde apps/docs/generated/zig/transmux.json

Página generada desde native/zig/transmux/transmux.zig. No se edita a mano: bun run docs:gen la regenera y bun run docs:check falla si difiere.

Segment plan: where each HLS/CMAF segment starts and ends, decided from the keyframe index before any media is read. Every segment starts on a keyframe of the reference (video) track, so any segment can be produced on its own (seek + mux): the playlist is known up front (VOD), and a seek in the player only costs the segments it asks for.

Common to both engines: the plan is the same whether engine=zig or engine=libav produce the segments, as long as their keyframe indexes agree (the head-to-head harness checks that they do).

plan.Segment

type · línea 16

pub const Segment = struct

Sin ///.

plan.Segment.durationUs

fn · línea 20

pub fn durationUs(self: Segment) i64

Sin ///.

plan.Plan

type · línea 25

pub const Plan = struct

Sin ///.

plan.Plan.deinit

fn · línea 28

pub fn deinit(self: *Plan, gpa: std.mem.Allocator) void

Sin ///.

plan.Plan.targetDurationS

fn · línea 34

pub fn targetDurationS(self: Plan) u64

EXT-X-TARGETDURATION: the longest segment, rounded up to whole seconds.

plan.Plan.segmentAt

fn · línea 41

pub fn segmentAt(self: Plan, t_us: i64) usize

Index of the segment that contains t_us (clamped to the ends).

plan.Error

const · línea 52

pub const Error = error{ OutOfMemory, Unsupported, TooLarge }

Sin ///.

plan.max_segments

const · línea 56

pub const max_segments: usize = 1 << 20

Segments of one plan at most (2^20 x 6 s = 72 days): a hostile duration cannot turn the time-based cutting into an unbounded loop.

plan.max_span_us

const · línea 59

pub const max_span_us: i64 = 1 << 42

Longest presentation a plan covers (2^42 us, about 50 days): beyond it the timestamps are hostile or corrupt, not a recording.

plan.build

fn · línea 67

pub fn build(gpa: std.mem.Allocator, keyframes: []const facts.Keyframe, start_us: i64, end_us: i64, target_us: i64, segment_cap: usize) Error!Plan

Cuts at the first keyframe at least target_us after the current cut. keyframes = PTS keyframe index of the reference track (may be empty: audio-only, or cut every target_us from start_us). end_us = end of the presentation. A plan of more than segment_cap segments (at most max_segments) is TooLarge, however it is cut: the cap bounds what the plan, and every playlist rendered from it, can weigh (ZT4-P1-01).