pub struct Muxer<S = Open> { /* private fields */ }Implementations§
Source§impl Muxer<Open>
impl Muxer<Open>
Sourcepub fn new() -> Self
pub fn new() -> Self
Empty muxer in track-registration state, default TimecodeScale
(1ms/tick) and DEFAULT_CLUSTER_BATCH.
Sourcepub fn with_options(timecode_scale: u64, batch: usize) -> Self
pub fn with_options(timecode_scale: u64, batch: usize) -> Self
Muxer with a custom TimecodeScale (ns/tick) and Cluster batch size.
Sourcepub fn add_track(&mut self, track: TrackInfo) -> Result<(), MuxError>
pub fn add_track(&mut self, track: TrackInfo) -> Result<(), MuxError>
Register a track. track.track_number must be non-zero and unique.
§Errors
MuxError::InvalidTrackNumber for track_number == 0;
MuxError::DuplicateTrack if already registered.
Source§impl Muxer<Live>
impl Muxer<Live>
Sourcepub const fn timecode_scale(&self) -> u64
pub const fn timecode_scale(&self) -> u64
TimecodeScale in effect (ns per tick) — frame timecode values are
in these ticks, same unit crate::Demuxer::time_base reports.
Sourcepub fn push_frame(
&mut self,
track_number: u64,
timecode: i64,
is_keyframe: bool,
payload: &[u8],
) -> Result<(), MuxError>
pub fn push_frame( &mut self, track_number: u64, timecode: i64, is_keyframe: bool, payload: &[u8], ) -> Result<(), MuxError>
Push one frame. timecode is absolute, in TimecodeScale ticks, and
must be non-decreasing per track (not enforced — an out-of-order
timecode either still fits the open Cluster’s relative-offset range
or forces a new Cluster, same as any large forward jump).
Frames are buffered into the open Cluster and only reach output
when the Cluster closes (Self::flush, the batch/range limit, or
the next push_frame that can’t share the open Cluster) — call
Self::poll_bytes after to drain.
§Errors
MuxError::UnknownTrack if track_number was never registered.
Sourcepub fn flush(&mut self)
pub fn flush(&mut self)
Force the open Cluster (if any) to close and become available via
Self::poll_bytes. Call before finishing the stream — an empty
open Cluster (no frames pushed) writes nothing.
Sourcepub fn poll_bytes(&mut self, out: &mut Vec<u8>) -> usize
pub fn poll_bytes(&mut self, out: &mut Vec<u8>) -> usize
Append available output bytes into out, same drain contract as
iso_bmff::mux::Muxer::poll_bytes.