Skip to main content

TrackProtection

Struct TrackProtection 

Source
pub struct TrackProtection {
    pub stream_index: usize,
    pub scheme_type: [u8; 4],
    pub scheme_version: u32,
    pub tenc: TencBox,
}
Expand description

Per-track CENC protection signalling for the muxer (ISO/IEC 14496-12 §8.12 envelope + ISO/IEC 23001-7 §4.1 carriage).

When a Mp4MuxerOptions::track_protection entry targets a stream, the muxer wraps that track’s sample entry into its protected form: the FourCC becomes encv / enca / enct / encs (per the stream’s media type) and a sinf box — frma(original_format) + schm(scheme_type, scheme_version) + schi(tenc) — is appended to the entry body, exactly the shape this crate’s demuxer unwraps back to the original codec id plus protection_scheme / cenc_default_* options.

The muxer signals protection only — packet payloads are written as handed in. The caller encrypts each sample first (e.g. via cenc_cipher::encrypt_sample_in_place with a CencSchemeDecision built from this same (scheme_type, tenc) pair) and carries the per-sample IVs / subsample maps through its own senc / saiz / saio channel.

Fields§

§stream_index: usize

Index into the muxer’s streams slice (the stream to protect).

§scheme_type: [u8; 4]

§8.12.5 scheme_type FourCC — one of the ISO/IEC 23001-7 §10 schemes (cenc / cbc1 / cens / cbcs) or a private dialect FourCC (validated structurally only in that case).

§scheme_version: u32

§8.12.5 32-bit scheme_version word. Every ISO/IEC 23001-7 edition to date uses 0x0001_0000 (the Default here).

§tenc: TencBox

Track-default encryption parameters written into schi/tenc (ISO/IEC 23001-7 §8.2). Must satisfy the same round-trip rules as cenc::build_tenc_box plus scheme coherence (a §10 scheme pins the tenc version; pattern schemes need a non-zero pattern pair) — violations fail at open.

Trait Implementations§

Source§

impl Clone for TrackProtection

Source§

fn clone(&self) -> TrackProtection

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TrackProtection

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.