[][src]Struct mp4ameta::Atom

pub struct Atom {
    pub head: [u8; 4],
    pub offset: usize,
    pub content: Content,
}

A structure that represents a MPEG-4 audio metadata atom.

Fields

head: [u8; 4]

The 4 byte identifier of the atom.

offset: usize

The offset in bytes separating the head from the content.

content: Content

The content of an atom.

Methods

impl Atom[src]

pub fn new() -> Atom[src]

Creates a new empty atom.

pub fn with(head: [u8; 4], offset: usize, content: Content) -> Atom[src]

Creates an atom containing the provided content at a n byte offset.

pub fn with_raw_data(head: [u8; 4], offset: usize, data: Data) -> Atom[src]

Creates an atom containing Content::RawData with the provided data.

pub fn data_atom() -> Atom[src]

Creates a data atom containing unparsed Content::TypedData.

pub fn data_atom_with(data: Data) -> Atom[src]

Creates a data atom containing Content::TypedData with the provided data.

pub fn len(&self) -> usize[src]

Returns the length in bytes.

pub fn read_from(reader: &mut impl Read + Seek) -> Result<Vec<Atom>>[src]

Attempts to read MPEG-4 audio metadata from the reader.

pub fn write_to(&self, writer: &mut impl Write) -> Result<()>[src]

Attempts to write the MPEG-4 audio metadata to the writer.

pub fn parse(&mut self, reader: &mut impl Read + Seek) -> Result<()>[src]

Attempts to parse itself from the reader.

pub fn parse_atoms(
    atoms: &mut Vec<Atom>,
    reader: &mut impl Read + Seek,
    length: usize
) -> Result<()>
[src]

Attempts to parse the list of atoms from the reader.

pub fn locate_metadata_item_list(
    reader: &mut impl Read + Seek
) -> Result<Vec<(usize, usize)>>
[src]

Locates the metadata item list atom and returns a list of tuples containing the position from the beginning of the file and length in bytes of the atom hierarchy leading to it.

pub fn parse_head(reader: &mut impl Read + Seek) -> Result<(usize, [u8; 4])>[src]

Attempts to parse a 32 bit unsigned integer determining the size of the atom in bytes and the following 4 byte head from the reader.

pub fn parse_content(
    &mut self,
    reader: &mut impl Read + Seek,
    length: usize
) -> Result<()>
[src]

Attempts to parse the content of the provided length from the reader.

pub fn first_child(&self) -> Option<&Atom>[src]

Attempts to return the first children atom if it's content is of type Content::Atoms.

pub fn mut_first_child(&mut self) -> Option<&mut Atom>[src]

Attempts to return the first children atom if it's content is of type Content::Atoms.

pub fn is_valid_filetype(&self) -> bool[src]

Return true if the filetype specified in the ftyp atom is valid, false otherwise.

pub fn filetype_atom() -> Atom[src]

Returns a atom filetype hierarchy needed to parse the filetype:

pub fn metadata_atom() -> Atom[src]

Returns a atom metadata hierarchy needed to parse metadata.

pub fn empty_metadata_atom() -> Atom[src]

Returns a atom metadata hierarchy.

pub fn format_head(head: [u8; 4]) -> String[src]

Returns the head formatted as a string.

Trait Implementations

impl Clone for Atom[src]

impl Debug for Atom[src]

impl PartialEq<Atom> for Atom[src]

Auto Trait Implementations

impl RefUnwindSafe for Atom

impl Send for Atom

impl Sync for Atom

impl Unpin for Atom

impl UnwindSafe for Atom

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.