[][src]Struct mp4ameta::Tag

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

A MPEG-4 audio tag containing metadata atoms

Fields

atoms: Vec<Atom>

A vector containing metadata atoms

readonly_atoms: Vec<Atom>

A vector containing readonly metadata atoms

Implementations

impl Tag[src]

pub fn with(atoms: Vec<Atom>, readonly_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, file: &File) -> Result<()>[src]

Attempts to write the MPEG-4 audio tag to the writer. This will overwrite any metadata previously present on the file.

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

Attempts to write the MPEG-4 audio tag to the path. This will overwrite any metadata previously present on the file.

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

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

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

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

impl Tag[src]

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

impl Tag[src]

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

Returns the copyright (cprt).

Sets the copyright (cprt).

Removes the copyright (cprt).

impl Tag[src]

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

impl Tag[src]

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

impl Tag[src]

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

Returns the movement (©mvn).

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

Sets the movement (©mvn).

pub fn remove_movement(&mut self)[src]

Removes the movement (©mvn).

impl Tag[src]

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

impl Tag[src]

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

impl Tag[src]

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

impl Tag[src]

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

impl Tag[src]

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

Returns the work (©wrk).

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

Sets the work (©wrk).

pub fn remove_work(&mut self)[src]

Removes the work (©wrk).

impl Tag[src]

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

impl Tag[src]

pub fn album_artists(&self) -> impl Iterator<Item = &str>[src]

Returns all album artists (aART).

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

Returns the first album artist (aART).

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

Sets the album artist (aART). This will remove all other album artists.

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

Adds an album artist (aART).

pub fn remove_album_artists(&mut self)[src]

Removes all album artists (aART).

impl Tag[src]

pub fn artists(&self) -> impl Iterator<Item = &str>[src]

Returns all artists (©ART).

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

Returns the first artist (©ART).

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

Sets the artist (©ART). This will remove all other artists.

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

Adds an artist (©ART).

pub fn remove_artists(&mut self)[src]

Removes all artists (©ART).

impl Tag[src]

pub fn categoryies(&self) -> impl Iterator<Item = &str>[src]

Returns all categoryies (catg).

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

Returns the first category (catg).

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

Sets the category (catg). This will remove all other categoryies.

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

Adds an category (catg).

pub fn remove_categoryies(&mut self)[src]

Removes all categoryies (catg).

impl Tag[src]

pub fn comments(&self) -> impl Iterator<Item = &str>[src]

Returns all comments (©cmt).

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

Returns the first comment (©cmt).

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

Sets the comment (©cmt). This will remove all other comments.

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

Adds an comment (©cmt).

pub fn remove_comments(&mut self)[src]

Removes all comments (©cmt).

impl Tag[src]

pub fn composers(&self) -> impl Iterator<Item = &str>[src]

Returns all composers (©wrt).

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

Returns the first composer (©wrt).

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

Sets the composer (©wrt). This will remove all other composers.

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

Adds an composer (©wrt).

pub fn remove_composers(&mut self)[src]

Removes all composers (©wrt).

impl Tag[src]

pub fn custom_genres(&self) -> impl Iterator<Item = &str>[src]

Returns all custom genres (©gen).

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

Returns the first custom genre (©gen).

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

Sets the custom genre (©gen). This will remove all other custom genres.

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

Adds an custom genre (©gen).

pub fn remove_custom_genres(&mut self)[src]

Removes all custom genres (©gen).

impl Tag[src]

pub fn descriptions(&self) -> impl Iterator<Item = &str>[src]

Returns all descriptions (desc).

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

Returns the first description (desc).

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

Sets the description (desc). This will remove all other descriptions.

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

Adds an description (desc).

pub fn remove_descriptions(&mut self)[src]

Removes all descriptions (desc).

impl Tag[src]

pub fn groupings(&self) -> impl Iterator<Item = &str>[src]

Returns all groupings (©grp).

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

Returns the first grouping (©grp).

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

Sets the grouping (©grp). This will remove all other groupings.

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

Adds an grouping (©grp).

pub fn remove_groupings(&mut self)[src]

Removes all groupings (©grp).

impl Tag[src]

pub fn keywords(&self) -> impl Iterator<Item = &str>[src]

Returns all keywords (keyw).

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

Returns the first keyword (keyw).

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

Sets the keyword (keyw). This will remove all other keywords.

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

Adds an keyword (keyw).

pub fn remove_keywords(&mut self)[src]

Removes all keywords (keyw).

impl Tag[src]

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

Returns the compilation flag (cpil).

pub fn set_compilation(&mut self)[src]

Sets the compilation flag to true (cpil).

pub fn remove_compilation(&mut self)[src]

Removes the compilation flag (cpil).

impl Tag[src]

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

Returns the gapless playback flag (pgap).

pub fn set_gapless_playback(&mut self)[src]

Sets the gapless playback flag to true (pgap).

pub fn remove_gapless_playback(&mut self)[src]

Removes the gapless playback flag (pgap).

impl Tag[src]

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

Returns the show movement flag (shwm).

pub fn set_show_movement(&mut self)[src]

Sets the show movement flag to true (shwm).

pub fn remove_show_movement(&mut self)[src]

Removes the show movement flag (shwm).

impl Tag[src]

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

Returns the bpm (tmpo)

pub fn set_bpm(&mut self, bpm: u16)[src]

Sets the bpm (tmpo)

pub fn remove_bpm(&mut self)[src]

Removes the bpm (tmpo).

impl Tag[src]

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

Returns the movement count (©mvc)

pub fn set_movement_count(&mut self, movement_count: u16)[src]

Sets the movement count (©mvc)

pub fn remove_movement_count(&mut self)[src]

Removes the movement count (©mvc).

impl Tag[src]

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

Returns the movement index (©mvi)

pub fn set_movement_index(&mut self, movement_index: u16)[src]

Sets the movement index (©mvi)

pub fn remove_movement_index(&mut self)[src]

Removes the movement index (©mvi).

impl Tag[src]

pub fn standard_genres(&self) -> impl Iterator<Item = u16> + '_[src]

Returns all standard genres (gnre).

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

Returns the first standard genre (gnre).

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

Sets the standard genre (gnre). This will remove all other standard genres.

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

Adds a standard genre (gnre).

pub fn remove_standard_genres(&mut self)[src]

Removes all standard genres (gnre).

impl Tag[src]

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

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

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

Returns the track number (trkn).

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

Returns the total number of tracks (trkn).

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

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

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

Sets the track number (trkn).

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

Sets the total number of tracks (trkn).

pub fn remove_track(&mut self)[src]

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

impl Tag[src]

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

Returns the disc number and total number of discs (disk).

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

Returns the disc number (disk).

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

Returns the total number of discs (disk).

pub fn set_disc(&mut self, disc_number: u16, total_discs: u16)[src]

Sets the disc number and the total number of discs (disk).

pub fn set_disc_number(&mut self, disc_number: u16)[src]

Sets the disc number (disk).

pub fn set_total_discs(&mut self, total_discs: u16)[src]

Sets the total number of discs (disk).

pub fn remove_disc(&mut self)[src]

Removes the disc number and the total number of discs (disk).

impl Tag[src]

pub fn artworks(&self) -> impl Iterator<Item = &Data>[src]

Returns the artwork image data of type Data::Jpeg or Data::Png (covr).

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 add_artwork(&mut self, image: Data)[src]

Adds artwork image data of type Data::Jpeg or Data::Png (covr). This will remove all other artworks.

pub fn remove_artwork(&mut self)[src]

Removes the artwork image data (covr).

impl Tag[src]

pub fn media_type(&self) -> Option<MediaType>[src]

Returns the media type (stik).

pub fn set_media_type(&mut self, media_type: MediaType)[src]

Sets the media type (stik).

pub fn remove_media_type(&mut self)[src]

Removes the media type (stik).

impl Tag[src]

pub fn advisory_rating(&self) -> Option<AdvisoryRating>[src]

Returns the advisory rating (rtng).

pub fn set_advisory_rating(&mut self, rating: AdvisoryRating)[src]

Sets the advisory rating (rtng).

pub fn remove_advisory_rating(&mut self)[src]

Removes the advisory rating (rtng).

impl Tag[src]

Genre

These are convenience functions that combine the values from the standard genre (gnre) and custom genre (©gen).

pub fn genres(&self) -> impl Iterator<Item = &str>[src]

Returns all genres (gnre or ©gen).

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

Returns the first genre (gnre or ©gen).

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

Sets the standard genre (gnre) if it matches a predefined value otherwise a custom genre (©gen). This will remove all other standard or custom genres.

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

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

pub fn remove_genres(&mut self)[src]

Removes the genre (gnre or ©gen).

impl Tag[src]

pub fn duration(&self) -> Option<f64>[src]

Returns the duration in seconds.

impl Tag[src]

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

returns the filetype (ftyp).

impl Tag[src]

pub fn reserved(&self, ident: Ident) -> impl Iterator<Item = &Vec<u8>>[src]

Returns all byte data corresponding to the identifier.

Example

use mp4ameta::{Tag, Data, Ident};

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

pub fn be_signed(&self, ident: Ident) -> impl Iterator<Item = &Vec<u8>>[src]

Returns all byte data representing a big endian integer corresponding to the identifier.

Example

use mp4ameta::{Tag, Data, Ident};

let mut tag = Tag::default();
tag.set_data(Ident(*b"test"), Data::BeSigned(vec![1,2,3,4,5,6]));
assert_eq!(tag.be_signed(Ident(*b"test")).next().unwrap().to_vec(), vec![1,2,3,4,5,6]);

pub fn string(&self, ident: Ident) -> impl Iterator<Item = &str>[src]

Returns all string references corresponding to the identifier.

Example

use mp4ameta::{Tag, Data, Ident};

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

pub fn mut_string(&mut self, ident: Ident) -> impl Iterator<Item = &mut String>[src]

Returns all mutable string references corresponding to the identifier.

Example

use mp4ameta::{Tag, Data, Ident};

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

pub fn image(&self, ident: Ident) -> impl Iterator<Item = &Data>[src]

Returns all image data of type Data::Jpeg or Data::Jpeg corresponding to the identifier.

Example

use mp4ameta::{Tag, Data, Ident};

let mut tag = Tag::default();
tag.set_data(Ident(*b"test"), Data::Jpeg("<the image data>".as_bytes().to_vec()));
match tag.image(Ident(*b"test")).next().unwrap() {
    Data::Jpeg(v) => assert_eq!(*v, "<the image data>".as_bytes()),
    _ => panic!("data does not match"),
};

pub fn data(&self, ident: Ident) -> impl Iterator<Item = &Data>[src]

Returns all data references corresponding to the identifier.

Example

use mp4ameta::{Tag, Data, Ident};

let mut tag = Tag::default();
tag.set_data(Ident(*b"test"), Data::Utf8("data".into()));
match tag.data(Ident(*b"test")).next().unwrap() {
    Data::Utf8(s) =>  assert_eq!(s, "data"),
    _ => panic!("data does not match"),
};

pub fn mut_data(&mut self, ident: Ident) -> impl Iterator<Item = &mut Data>[src]

Returns all mutable data references corresponding to the identifier.

Example

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

pub fn set_data(&mut self, ident: Ident, data: Data)[src]

Removes all other atoms, corresponding to the identifier, and adds a new atom containing the provided data.

Example

use mp4ameta::{Tag, Data, Ident};

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

pub fn add_data(&mut self, ident: Ident, data: Data)[src]

Adds a new atom, corresponding to the identifier, containing the provided data.

Example

use mp4ameta::{Tag, Data, Ident};

let mut tag = Tag::default();
tag.add_data(Ident(*b"test"), Data::Utf8("data1".into()));
tag.add_data(Ident(*b"test"), Data::Utf8("data2".into()));
let mut strings = tag.string(Ident(*b"test"));
assert_eq!(strings.next().unwrap(), "data1");
assert_eq!(strings.next().unwrap(), "data2");

pub fn remove_data(&mut self, ident: Ident)[src]

Removes the data corresponding to the identifier.

Example

use mp4ameta::{Tag, Data, Ident};

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

Trait Implementations

impl Clone for Tag[src]

impl Debug for Tag[src]

impl Default for Tag[src]

impl PartialEq<Tag> for Tag[src]

impl StructuralPartialEq 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> 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.