Struct mp4ameta::Tag[][src]

pub struct Tag {
    pub ftyp: String,
    pub info: AudioInfo,
    pub atoms: Vec<AtomData>,
}

A MPEG-4 audio tag containing metadata atoms

Fields

ftyp: String

The ftyp atom.

info: AudioInfo

Readonly audio information

atoms: Vec<AtomData>

A vector containing metadata atoms

Implementations

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]

Genre

These are convenience methods that operate on values of both standard genres (gnre) and custom genres (©gen).

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

Returns all genres, first the standard genres (gnre) then custom ones (©gen).

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

Returns the first genre (gnre or ©gen).

pub fn take_genres(&mut self) -> impl Iterator<Item = String> + '_[src]

Consumes all custom genres (©gen) and returns all genres, first standard genres (gnre) then custom ones (©gen).

pub fn take_genre(&mut self) -> Option<String>[src]

Consumes all custom genres (©gen) and 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 a standard genre (gnre) if it matches a predefined value 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<Duration>[src]

Returns the duration in seconds.

pub fn channel_config(&self) -> Option<ChannelConfig>[src]

Returns the channel configuration.

pub fn sample_rate(&self) -> Option<SampleRate>[src]

Returns the channel configuration.

pub fn avg_bitrate(&self) -> Option<u32>[src]

Returns the average bitrate.

pub fn max_bitrate(&self) -> Option<u32>[src]

Returns the maximum bitrate.

impl Tag[src]

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

returns the filetype (ftyp).

impl Tag[src]

Track

The track number and total number of tracks are stored in a tuple. If only one is present the other is represented as 0 and will be treated as if nonexistent.

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

pub fn remove_track_number(&mut self)[src]

Removes the track number, preserving the total number of tracks if present (trkn).

pub fn remove_total_tracks(&mut self)[src]

Removes the total number of tracks, preserving the track number if present (trkn).

impl Tag[src]

Disc

The disc number and total number of discs are stored in a tuple. If only one is present the other is represented as 0 and will be treated as if nonexistent.

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

pub fn remove_disc_number(&mut self)[src]

Removes the disc number, preserving the total number of discs if present (disk).

pub fn remove_total_discs(&mut self)[src]

Removes the total number of discs, preserving the disc number if present (disk).

impl Tag[src]

pub const fn new(ftyp: String, info: AudioInfo, atoms: Vec<AtomData>) -> Self[src]

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

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

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

pub fn read_from_path(path: impl AsRef<Path>) -> Result<Self>[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 take_album(&mut self) -> Option<String>[src]

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

Consumes and 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 take_encoder(&mut self) -> Option<String>[src]

Consumes and 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 take_lyrics(&mut self) -> Option<String>[src]

Consumes and 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 take_movement(&mut self) -> Option<String>[src]

Consumes and 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 take_title(&mut self) -> Option<String>[src]

Consumes and 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_name(&self) -> Option<&str>[src]

Returns the tv episode name (tven).

pub fn take_tv_episode_name(&mut self) -> Option<String>[src]

Consumes and returns the tv episode name (tven).

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

Sets the tv episode name (tven).

pub fn remove_tv_episode_name(&mut self)[src]

Removes the tv episode name (tven).

impl Tag[src]

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

Returns the tv network name (tvnn).

pub fn take_tv_network_name(&mut self) -> Option<String>[src]

Consumes and 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 take_tv_show_name(&mut self) -> Option<String>[src]

Consumes and 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 take_work(&mut self) -> Option<String>[src]

Consumes and 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 take_year(&mut self) -> Option<String>[src]

Consumes and 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 isrc(&self) -> Option<&str>[src]

Returns the isrc (----:com.apple.iTunes:ISRC).

pub fn take_isrc(&mut self) -> Option<String>[src]

Consumes and returns the isrc (----:com.apple.iTunes:ISRC).

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

Sets the isrc (----:com.apple.iTunes:ISRC).

pub fn remove_isrc(&mut self)[src]

Removes the isrc (----:com.apple.iTunes:ISRC).

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 take_album_artists(&mut self) -> impl Iterator<Item = String> + '_[src]

Consumes and returns all album artists (aART).

pub fn take_album_artist(&mut self) -> Option<String>[src]

Consumes all and 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 take_artists(&mut self) -> impl Iterator<Item = String> + '_[src]

Consumes and returns all artists (©ART).

pub fn take_artist(&mut self) -> Option<String>[src]

Consumes all and 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 categories(&self) -> impl Iterator<Item = &str>[src]

Returns all categories (catg).

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

Returns the first category (catg).

pub fn take_categories(&mut self) -> impl Iterator<Item = String> + '_[src]

Consumes and returns all categories (catg).

pub fn take_category(&mut self) -> Option<String>[src]

Consumes all and 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 categories.

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

Adds an category (catg).

pub fn remove_categories(&mut self)[src]

Removes all categories (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 take_comments(&mut self) -> impl Iterator<Item = String> + '_[src]

Consumes and returns all comments (©cmt).

pub fn take_comment(&mut self) -> Option<String>[src]

Consumes all and 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 take_composers(&mut self) -> impl Iterator<Item = String> + '_[src]

Consumes and returns all composers (©wrt).

pub fn take_composer(&mut self) -> Option<String>[src]

Consumes all and 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 take_custom_genres(&mut self) -> impl Iterator<Item = String> + '_[src]

Consumes and returns all custom genres (©gen).

pub fn take_custom_genre(&mut self) -> Option<String>[src]

Consumes all and 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 take_descriptions(&mut self) -> impl Iterator<Item = String> + '_[src]

Consumes and returns all descriptions (desc).

pub fn take_description(&mut self) -> Option<String>[src]

Consumes all and 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 take_groupings(&mut self) -> impl Iterator<Item = String> + '_[src]

Consumes and returns all groupings (©grp).

pub fn take_grouping(&mut self) -> Option<String>[src]

Consumes all and 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 take_keywords(&mut self) -> impl Iterator<Item = String> + '_[src]

Consumes and returns all keywords (keyw).

pub fn take_keyword(&mut self) -> Option<String>[src]

Consumes all and 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 lyricists(&self) -> impl Iterator<Item = &str>[src]

Returns all lyricists (----:com.apple.iTunes:LYRICIST).

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

Returns the first lyricist (----:com.apple.iTunes:LYRICIST).

pub fn take_lyricists(&mut self) -> impl Iterator<Item = String> + '_[src]

Consumes and returns all lyricists (----:com.apple.iTunes:LYRICIST).

pub fn take_lyricist(&mut self) -> Option<String>[src]

Consumes all and returns the first lyricist (----:com.apple.iTunes:LYRICIST).

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

Sets the lyricist (----:com.apple.iTunes:LYRICIST). This will remove all other lyricists.

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

Adds an lyricist (----:com.apple.iTunes:LYRICIST).

pub fn remove_lyricists(&mut self)[src]

Removes all lyricists (----:com.apple.iTunes:LYRICIST).

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 tv_episode(&self) -> Option<u32>[src]

Returns the tv episode (tves)

pub fn set_tv_episode(&mut self, tv_episode: u32)[src]

Sets the tv episode (tves)

pub fn remove_tv_episode(&mut self)[src]

Removes the tv episode (tves).

impl Tag[src]

pub fn tv_season(&self) -> Option<u32>[src]

Returns the tv season (tvsn)

pub fn set_tv_season(&mut self, tv_season: u32)[src]

Sets the tv season (tvsn)

pub fn remove_tv_season(&mut self)[src]

Removes the tv season (tvsn).

impl Tag[src]

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

Returns all artwork images of type Data::Jpeg, Data::Png or Data::Bmp (covr).

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

Returns the first artwork image of type Data::Jpeg, Data::Png or Data::Bmp (covr).

pub fn take_artworks(&mut self) -> impl Iterator<Item = Data> + '_[src]

Consumes and returns all artwork images of type Data::Jpeg, Data::Png or Data::Bmp (covr).

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

Consumes all and returns the first artwork image of type Data::Jpeg, Data::Png or Data::Bmp (covr).

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

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

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

Adds artwork image data of type Data::Jpeg, Data::Png or Data::Bmp (covr).

pub fn remove_artwork(&mut self)[src]

Removes all artworks (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]

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

Returns all byte data references corresponding to the identifier.

Example

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

let mut tag = Tag::default();
let test = Fourcc(*b"test");

tag.set_data(test, Data::BeSigned(b"data".to_vec()));
assert_eq!(tag.bytes(&test).next().unwrap(), b"data");

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

Returns all mutable string references corresponding to the identifier.

Example

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

let mut tag = Tag::default();
let test = Fourcc(*b"test");

tag.set_data(test, Data::Reserved(b"data".to_vec()));
tag.bytes_mut(&test).next().unwrap().push(49);
assert_eq!(tag.bytes(&test).next().unwrap(), b"data1");

pub fn take_bytes<'a>(
    &'a mut self,
    ident: &'a impl Ident
) -> impl Iterator<Item = Vec<u8>> + '_
[src]

Consumes all byte data corresponding to the identifier and returns it.

Example

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

let mut tag = Tag::default();
let test = Fourcc(*b"test");

tag.set_data(test, Data::Reserved(b"data".to_vec()));
assert_eq!(tag.take_bytes(&test).next(), Some(b"data".to_vec()));
assert_eq!(tag.bytes(&test).next(), None);

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

Returns all string references corresponding to the identifier.

Example

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

let mut tag = Tag::default();
let test = Fourcc(*b"test");

tag.set_data(test, Data::Utf8("data".into()));
assert_eq!(tag.string(&test).next().unwrap(), "data");

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

Returns all mutable string references corresponding to the identifier.

Example

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

let mut tag = Tag::default();
let test = Fourcc(*b"test");

tag.set_data(test, Data::Utf8("data".into()));
tag.string_mut(&test).next().unwrap().push('1');
assert_eq!(tag.string(&test).next().unwrap(), "data1");

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

Consumes all strings corresponding to the identifier and returns them.

Example

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

let mut tag = Tag::default();
let test = Fourcc(*b"test");

tag.set_data(test, Data::Utf8("data".into()));
assert_eq!(tag.take_string(&test).next(), Some("data".into()));
assert_eq!(tag.string(&test).next(), None);

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

Returns all image data references of type Data::Jpeg, Data::Png or Data::Bmp corresponding to the identifier.

Example

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

let mut tag = Tag::default();
let test = Fourcc(*b"test");

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

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

Returns all mutable image data references of type Data::Jpeg, Data::Png or Data::Bmp corresponding to the identifier.

Example

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

let mut tag = Tag::default();
let test = Fourcc(*b"test");

tag.set_data(test, Data::Jpeg(b"<the image data>".to_vec()));
match tag.image_mut(&test).next().unwrap() {
    Data::Jpeg(v) => v.push(49),
    _ => panic!("data type does match"),
}
match tag.image(&test).next().unwrap() {
    Data::Jpeg(v) => assert_eq!(*v, b"<the image data>1"),
    _ => panic!("data does not match"),
};

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

Consumes all images corresponding to the identifier and returns them.

Example

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

let mut tag = Tag::default();
let test = Fourcc(*b"test");

tag.set_data(test, Data::Png(b"<the image data>".to_vec()));
match tag.take_data(&test).next().unwrap() {
    Data::Png(s) =>  assert_eq!(s, b"<the image data>".to_vec()),
    _ => panic!("data does not match"),
};
assert_eq!(tag.string(&test).next(), None);

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

Returns all data references corresponding to the identifier.

Example

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

let mut tag = Tag::default();
let test = Fourcc(*b"test");

tag.set_data(test, Data::Utf8("data".into()));
match tag.data(&test).next().unwrap() {
    Data::Utf8(s) =>  assert_eq!(s, "data"),
    _ => panic!("data does not match"),
};

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

Returns all mutable data references corresponding to the identifier.

Example

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

let mut tag = Tag::default();
let test = Fourcc(*b"test");

tag.set_data(test, Data::Utf8("data".into()));
if let Data::Utf8(s) = tag.data_mut(&test).next().unwrap() {
    s.push('1');
}
assert_eq!(tag.string(&test).next().unwrap(), "data1");

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

Consumes all data corresponding to the identifier and returns it.

Example

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

let mut tag = Tag::default();
let test = Fourcc(*b"test");

tag.set_data(test, Data::Utf8("data".into()));
match tag.take_data(&test).next().unwrap() {
    Data::Utf8(s) =>  assert_eq!(s, "data".to_string()),
    _ => panic!("data does not match"),
};
assert_eq!(tag.string(&test).next(), None);

pub fn set_data(&mut self, ident: impl Into<DataIdent>, 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, Fourcc};

let mut tag = Tag::default();
let test = Fourcc(*b"test");

tag.set_data(test, Data::Utf8("data".into()));
assert_eq!(tag.string(&test).next().unwrap(), "data");

pub fn add_data(&mut self, ident: impl Into<DataIdent>, data: Data)[src]

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

Example

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

let mut tag = Tag::default();
let test = Fourcc(*b"test");

tag.add_data(test, Data::Utf8("data1".into()));
tag.add_data(test, Data::Utf8("data2".into()));
let mut strings = tag.string(&test);
assert_eq!(strings.next(), Some("data1"));
assert_eq!(strings.next(), Some("data2"));
assert_eq!(strings.next(), None)

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

Removes the data corresponding to the identifier.

Example

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

let mut tag = Tag::default();
let test = Fourcc(*b"test");

tag.set_data(test, Data::Utf8("data".into()));
assert!(tag.data(&test).next().is_some());
tag.remove_data(&test);
assert!(tag.data(&test).next().is_none());

Trait Implementations

impl Clone for Tag[src]

impl Debug for Tag[src]

impl Default for Tag[src]

impl Display for Tag[src]

impl Eq for Tag[src]

impl PartialEq<Tag> for Tag[src]

impl StructuralEq 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> ToString for T where
    T: Display + ?Sized
[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.