Skip to main content

ParsedBox

Struct ParsedBox 

Source
pub struct ParsedBox<'a> {
    pub name: String,
    pub parser: &'a mut Mp4Parser,
    pub partial_okay: bool,
    pub stop_on_partial: bool,
    pub start: u64,
    pub size: usize,
    pub version: Option<u32>,
    pub flags: Option<u32>,
    pub reader: Reader,
    pub has_64_bit_size: bool,
    pub header: Vec<u8>,
}
Expand description

A representation of a parsed MP4 box containing its header information and payload reader.

Fields§

§name: String

The box name, a 4-character string (fourcc).

§parser: &'a mut Mp4Parser

The parser that parsed this box. The parser can be used to parse child boxes where the configuration of the current parser is needed to parsed other boxes.

§partial_okay: bool

If true, allows reading partial payloads from some boxes. If the goal is a child box, we can sometimes find it without enough data to find all child boxes. This property allows the partialOkay flag from parse() to be propagated through methods like children().

§stop_on_partial: bool

If true, stop reading if an incomplete box is detected.

§start: u64

The start of this box (before the header) in the original buffer. This start position is the absolute position.

§size: usize

The size of this box (including the header).

§version: Option<u32>

The version for a full box, null for basic boxes.

§flags: Option<u32>

The flags for a full box, null for basic boxes.

§reader: Reader

The reader for this box is only for this box. Reading or not reading to the end will have no affect on the parser reading other sibling boxes.

§has_64_bit_size: bool

If true, the box header had a 64-bit size field. This affects the offsets of other fields.

§header: Vec<u8>

The raw header bytes of the box (size, type, optional 64-bit size, optional version/flags).

Implementations§

Source§

impl<'a> ParsedBox<'a>

Source

pub fn header_size(&self) -> u64

Find the header size of the box. Useful for modifying boxes in place or finding the exact offset of a field.

Source

pub fn full_data(&self) -> Vec<u8>

Get the full box data including header. Merges the stored header with the payload from the reader.

Auto Trait Implementations§

§

impl<'a> Freeze for ParsedBox<'a>

§

impl<'a> !RefUnwindSafe for ParsedBox<'a>

§

impl<'a> !Send for ParsedBox<'a>

§

impl<'a> !Sync for ParsedBox<'a>

§

impl<'a> Unpin for ParsedBox<'a>

§

impl<'a> UnsafeUnpin for ParsedBox<'a>

§

impl<'a> !UnwindSafe for ParsedBox<'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> 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, 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.