Skip to main content

EmsgBox

Struct EmsgBox 

Source
pub struct EmsgBox<'a> {
    pub scheme_id_uri: &'a str,
    pub value: &'a str,
    pub timescale: u32,
    pub presentation_time: PresentationTime,
    pub event_duration: u32,
    pub id: u32,
    pub message_data: &'a [u8],
}
Expand description

A parsed/owned MPEG-DASH Event Message Box (emsg).

Holds the typed FullBox body fields plus borrowed views of the two null-terminated UTF-8 strings and the opaque message_data. The box size and version are not stored: size is recomputed on serialize and version is derived from PresentationTime, so the round-trip is driven entirely from the typed fields (no raw passthrough).

Fields§

§scheme_id_uri: &'a str

scheme_id_uri (Table 6-2): the URI defining the event scheme. Stored without the wire 0x00 terminator.

§value: &'a str

value (Table 6-2): scheme-specific value, or the empty string when the scheme defines none. Stored without the wire 0x00 terminator.

§timescale: u32

timescale (Table 6-2, u32): ticks per second for the time fields; equal to the mdhd timescale of the Representation.

§presentation_time: PresentationTime

The presentation-time field — selects the box version (v0 delta vs v1 absolute).

§event_duration: u32

event_duration (Table 6-2, u32): event duration in timescale units.

§id: u32

id (Table 6-2, u32): unique identifier distinguishing events with the same scheme_id_uri/value and detecting repetitions.

§message_data: &'a [u8]

message_data[] (Table 6-2): the opaque scheme-specific payload (the remaining bytes of the box). Empty when the scheme needs none.

Implementations§

Source§

impl<'a> EmsgBox<'a>

Source

pub fn version(&self) -> EmsgVersion

The version of this box, derived from Self::presentation_time.

Source

pub fn is_scte35(&self) -> bool

true if scheme_id_uri names a SCTE 35 scheme (urn:scte:scte35...), in which case Self::message_data carries a SCTE 35 splice_info_section (SCTE 214-1 / ANSI/SCTE 35 — see crate root).

Source

pub fn serialized_len(&self) -> usize

Total serialized size in bytes (the size field value).

Source

pub fn parse(data: &'a [u8]) -> Result<EmsgBox<'a>, Error>

Parse an emsg box from the start of data. Requires the full box (size bytes) to be present; trailing bytes beyond size are ignored.

Source

pub fn serialize_into(&self, out: &mut [u8]) -> Result<usize, Error>

Serialize the box into out, recomputing the size field and writing flags = 0. Returns the number of bytes written.

Source

pub fn to_vec(&self) -> Result<Vec<u8>, Error>

Serialize into a freshly allocated Vec.

Trait Implementations§

Source§

impl<'a> Clone for EmsgBox<'a>

Source§

fn clone(&self) -> EmsgBox<'a>

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<'a> Debug for EmsgBox<'a>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'a> Eq for EmsgBox<'a>

Source§

impl<'a> PartialEq for EmsgBox<'a>

Source§

fn eq(&self, other: &EmsgBox<'a>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> Serialize for EmsgBox<'a>

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<'a> StructuralPartialEq for EmsgBox<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for EmsgBox<'a>

§

impl<'a> RefUnwindSafe for EmsgBox<'a>

§

impl<'a> Send for EmsgBox<'a>

§

impl<'a> Sync for EmsgBox<'a>

§

impl<'a> Unpin for EmsgBox<'a>

§

impl<'a> UnsafeUnpin for EmsgBox<'a>

§

impl<'a> UnwindSafe for EmsgBox<'a>

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> 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 = Infallible

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.