[][src]Struct mp4ameta::Tag

pub struct Tag {
    pub atoms: Vec<Atom>,
}

A MPEG-4 audio tag containing metadata atoms

Fields

atoms: Vec<Atom>

A vector containing metadata atoms

Methods

impl Tag[src]

pub fn new() -> Tag[src]

Creates a new empty MPEG-4 audio tag.

pub fn with(atoms: Vec<Atom>) -> Tag[src]

Creates a new MPEG-4 audio tag containing the atom.

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

Attempts to read a MPEG-4 audio tag from the reader.

pub fn read_from_path(path: impl AsRef<Path>) -> Result<Tag>[src]

Attempts to read a MPEG-4 audio tag from the file at the indicated path.

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

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

pub fn write_to_path(&self, path: impl AsRef<Path>) -> Result<()>[src]

Attempts to write the MPEG-4 audio tag to the path.

pub fn album(&self) -> Option<&str>[src]

Returns the album (©alb).

pub fn set_album(&mut self, album: impl Into<String>)[src]

Sets the album (©alb).

pub fn remove_album(&mut self)[src]

Removes the album (©alb).

pub fn album_artist(&self) -> Option<&str>[src]

Returns the album artist (aART).

pub fn set_album_artist(&mut self, album_artist: impl Into<String>)[src]

Sets the album artist (aART).

pub fn remove_album_artist(&mut self)[src]

Removes the album artist (aART).

pub fn artist(&self) -> Option<&str>[src]

Returns the artist (©ART).

pub fn set_artist(&mut self, artist: impl Into<String>)[src]

Sets the artist (©ART).

pub fn remove_artist(&mut self)[src]

Removes the artist (©ART).

pub fn category(&self) -> Option<&str>[src]

Returns the category (catg).

pub fn set_category(&mut self, category: impl Into<String>)[src]

Sets the category (catg).

pub fn remove_category(&mut self)[src]

Removes the category (catg).

pub fn comment(&self) -> Option<&str>[src]

Returns the comment (©cmt).

pub fn set_comment(&mut self, comment: impl Into<String>)[src]

Sets the comment (©cmt).

pub fn remove_comment(&mut self)[src]

Removes the comment (©cmt).

pub fn composer(&self) -> Option<&str>[src]

Returns the composer (©wrt).

pub fn set_composer(&mut self, composer: impl Into<String>)[src]

Sets the composer (©wrt).

pub fn remove_composer(&mut self)[src]

Removes the composer (©wrt).

pub fn copyright(&self) -> Option<&str>[src]

Returns the copyright (cprt).

Sets the copyright (cprt).

Removes the copyright (cprt).

pub fn description(&self) -> Option<&str>[src]

Returns the description (desc).

pub fn set_description(&mut self, description: impl Into<String>)[src]

Sets the description (desc).

pub fn remove_description(&mut self)[src]

Removes the description (desc).

pub fn encoder(&self) -> Option<&str>[src]

Returns the encoder (©too).

pub fn set_encoder(&mut self, encoder: impl Into<String>)[src]

Sets the encoder (©too).

pub fn remove_encoder(&mut self)[src]

Removes the encoder (©too).

pub fn grouping(&self) -> Option<&str>[src]

Returns the grouping (©grp).

pub fn set_grouping(&mut self, grouping: impl Into<String>)[src]

Sets the grouping (©grp).

pub fn remove_grouping(&mut self)[src]

Removes the grouping (©grp).

pub fn keyword(&self) -> Option<&str>[src]

Returns the keyword (keyw).

pub fn set_keyword(&mut self, keyword: impl Into<String>)[src]

Sets the keyword (keyw).

pub fn remove_keyword(&mut self)[src]

Removes the keyword (keyw).

pub fn lyrics(&self) -> Option<&str>[src]

Returns the lyrics (©lyr).

pub fn set_lyrics(&mut self, lyrics: impl Into<String>)[src]

Sets the lyrics (©lyr).

pub fn remove_lyrics(&mut self)[src]

Removes the lyrics (©lyr).

pub fn title(&self) -> Option<&str>[src]

Returns the title (©nam).

pub fn set_title(&mut self, title: impl Into<String>)[src]

Sets the title (©nam).

pub fn remove_title(&mut self)[src]

Removes the title (©nam).

pub fn tv_episode_number(&self) -> Option<&str>[src]

Returns the tv episode number (tven).

pub fn set_tv_episode_number(&mut self, tv_episode_number: impl Into<String>)[src]

Sets the tv episode number (tven).

pub fn remove_tv_episode_number(&mut self)[src]

Removes the tv episode number (tven).

pub fn tv_network_name(&self) -> Option<&str>[src]

Returns the tv network name (tvnn).

pub fn set_tv_network_name(&mut self, tv_network_name: impl Into<String>)[src]

Sets the tv network name (tvnn).

pub fn remove_tv_network_name(&mut self)[src]

Removes the tv network name (tvnn).

pub fn tv_show_name(&self) -> Option<&str>[src]

Returns the tv show name (tvsh).

pub fn set_tv_show_name(&mut self, tv_show_name: impl Into<String>)[src]

Sets the tv show name (tvsh).

pub fn remove_tv_show_name(&mut self)[src]

Removes the tv show name (tvsh).

pub fn year(&self) -> Option<&str>[src]

Returns the year (©day).

pub fn set_year(&mut self, year: impl Into<String>)[src]

Sets the year (©day).

pub fn remove_year(&mut self)[src]

Removes the year (©day).

pub fn genre(&self) -> Option<&str>[src]

Returns the genre (gnre) or (©gen).

pub fn set_genre(&mut self, genre: impl Into<String>)[src]

Sets the standard genre (gnre) if it matches one otherwise a custom genre (©gen).

pub fn remove_genre(&mut self)[src]

Removes the genre (gnre) or (©gen).

pub fn standard_genre(&self) -> Option<u16>[src]

Returns the standard genre (gnre).

pub fn set_standard_genre(&mut self, genre_code: u16)[src]

Sets the standard genre (gnre).

pub fn remove_standard_genre(&mut self)[src]

Removes the standard genre (gnre).

pub fn custom_genre(&self) -> Option<&str>[src]

Returns the custom genre (©gen).

pub fn set_custom_genre(&mut self, custom_genre: impl Into<String>)[src]

Sets the custom genre (©gen).

pub fn remove_custom_genre(&mut self)[src]

Removes the custom genre (©gen).

pub fn track_number(&self) -> (Option<u16>, Option<u16>)[src]

Returns the track number and the total number of tracks (trkn).

pub fn set_track_number(&mut self, track_number: u16, total_tracks: u16)[src]

Sets the track number and the total number of tracks (trkn).

pub fn remove_track_number(&mut self)[src]

Removes the track number and the total number of tracks (trkn).

pub fn disk_number(&self) -> (Option<u16>, Option<u16>)[src]

Returns the disk number and total number of disks (disk).

pub fn set_disk_number(&mut self, disk_number: u16, total_disks: u16)[src]

Sets the disk number and the total number of disks (disk).

pub fn remove_disk_number(&mut self)[src]

Removes the disk number and the total number of disks (disk).

pub fn artwork(&self) -> Option<Data>[src]

Returns the artwork image data of type Data::JPEG or Data::PNG (covr).

pub fn set_artwork(&mut self, image: Data)[src]

Sets the artwork image data of type Data::JPEG or Data::PNG (covr).

pub fn remove_artwork(&mut self)[src]

Removes the artwork image data (covr).

pub fn reserved(&self, head: [u8; 4]) -> Option<&Vec<u8>>[src]

Attempts to return byte data corresponding to the head.

Example

use mp4ameta::{Tag, Data};

let mut tag = Tag::new();
tag.set_data(*b"test", Data::Reserved(vec![1,2,3,4,5,6]));
assert_eq!(tag.reserved(*b"test").unwrap().to_vec(), vec![1,2,3,4,5,6]);

pub fn string(&self, head: [u8; 4]) -> Option<&str>[src]

Attempts to return a string reference corresponding to the head.

Example

use mp4ameta::{Tag, Data};

let mut tag = Tag::new();
tag.set_data(*b"test", Data::Utf8("data".into()));
assert_eq!(tag.string(*b"test").unwrap(), "data");

pub fn mut_string(&mut self, head: [u8; 4]) -> Option<&mut String>[src]

Attempts to return a mutable string reference corresponding to the head.

Example

use mp4ameta::{Tag, Data};

let mut tag = Tag::new();
tag.set_data(*b"test", Data::Utf8("data".into()));
tag.mut_string(*b"test").unwrap().push('1');
assert_eq!(tag.string(*b"test").unwrap(), "data1");

pub fn image(&self, head: [u8; 4]) -> Option<Data>[src]

Attempts to return image data of type Data::JPEG or Data::PNG corresponding to the head.

Example

use mp4ameta::{Tag, Data};

let mut tag = Tag::new();
tag.set_data(*b"test", Data::Jpeg("<the image data>".as_bytes().to_vec()));
if let Data::Jpeg(v) = tag.image(*b"test").unwrap(){
    assert_eq!(v, "<the image data>".as_bytes())
}

pub fn data(&self, head: [u8; 4]) -> Option<&Data>[src]

Attempts to return a data reference corresponding to the head.

Example

use mp4ameta::{Tag, Data};

let mut tag = Tag::new();
tag.set_data(*b"test", Data::Utf8("data".into()));
if let Data::Utf8(s) = tag.data(*b"test").unwrap(){
    assert_eq!(s, "data");
}else{
    panic!("data does not match");
}

pub fn mut_data(&mut self, head: [u8; 4]) -> Option<&mut Data>[src]

Attempts to return a mutable data reference corresponding to the head.

Example

use mp4ameta::{Tag, Data};

let mut tag = Tag::new();
tag.set_data(*b"test", Data::Utf8("data".into()));
if let Data::Utf8(s) = tag.mut_data(*b"test").unwrap(){
    s.push('1');
}
assert_eq!(tag.string(*b"test").unwrap(), "data1");

pub fn set_data(&mut self, head: [u8; 4], data: Data)[src]

Updates or appends a new atom with the data corresponding to the head.

Example

use mp4ameta::{Tag, Data};

let mut tag = Tag::new();
tag.set_data(*b"test", Data::Utf8("data".into()));
assert_eq!(tag.string(*b"test").unwrap(), "data");

pub fn remove_data(&mut self, head: [u8; 4])[src]

Removes the data corresponding to the head.

Example

use mp4ameta::{Tag, Data};

let mut tag = Tag::new();
tag.set_data(*b"test", Data::Utf8("data".into()));
assert!(tag.data(*b"test").is_some());
tag.remove_data(*b"test");
assert!(tag.data(*b"test").is_none());

Trait Implementations

impl Debug for Tag[src]

Auto Trait Implementations

impl RefUnwindSafe for Tag

impl Send for Tag

impl Sync for Tag

impl Unpin for Tag

impl UnwindSafe for Tag

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, 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.