Struct Tag

Source
pub struct Tag {
    pub ftyp: String,
    pub info: AudioInfo,
    pub userdata: Userdata,
}
Expand description

A tag containing MPEG-4 audio metadata.

Fields§

§ftyp: String

The filetype (ftyp) atom.

§info: AudioInfo§userdata: Userdata

Implementations§

Source§

impl Tag

§Audio information
Source

pub fn audio_info(&self) -> &AudioInfo

Returns a reference of the audio information.

Source

pub fn duration(&self) -> Duration

Returns the duration in seconds.

Source

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

Returns the channel configuration.

Source

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

Returns the channel configuration.

Source

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

Returns the average bitrate.

Source

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

Returns the maximum bitrate.

Source§

impl Tag

§Filetype
Source

pub fn filetype(&self) -> &str

returns the filetype (ftyp).

Source§

impl Tag

Source

pub fn read_with( reader: &mut (impl Read + Seek), cfg: &ReadConfig, ) -> Result<Self>

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

Source

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

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

Source

pub fn read_with_path(path: impl AsRef<Path>, cfg: &ReadConfig) -> Result<Self>

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

Source

pub fn read_from_path(path: impl AsRef<Path>) -> Result<Self>

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

Methods from Deref<Target = Userdata>§

Source

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

Returns the album (©alb).

Source

pub fn take_album(&mut self) -> Option<String>

Removes and returns the album (©alb).

Source

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

Sets the album (©alb).

Source

pub fn remove_album(&mut self)

Removes the album (©alb).

Source

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

Returns the copyright (cprt).

Removes and returns the copyright (cprt).

Sets the copyright (cprt).

Removes the copyright (cprt).

Source

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

Returns the encoder (©too).

Source

pub fn take_encoder(&mut self) -> Option<String>

Removes and returns the encoder (©too).

Source

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

Sets the encoder (©too).

Source

pub fn remove_encoder(&mut self)

Removes the encoder (©too).

Source

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

Returns the lyrics (©lyr).

Source

pub fn take_lyrics(&mut self) -> Option<String>

Removes and returns the lyrics (©lyr).

Source

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

Sets the lyrics (©lyr).

Source

pub fn remove_lyrics(&mut self)

Removes the lyrics (©lyr).

Source

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

Returns the movement (©mvn).

Source

pub fn take_movement(&mut self) -> Option<String>

Removes and returns the movement (©mvn).

Source

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

Sets the movement (©mvn).

Source

pub fn remove_movement(&mut self)

Removes the movement (©mvn).

Source

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

Returns the title (©nam).

Source

pub fn take_title(&mut self) -> Option<String>

Removes and returns the title (©nam).

Source

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

Sets the title (©nam).

Source

pub fn remove_title(&mut self)

Removes the title (©nam).

Source

pub fn tv_episode_name(&self) -> Option<&str>

Returns the tv episode name (tven).

Source

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

Removes and returns the tv episode name (tven).

Source

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

Sets the tv episode name (tven).

Source

pub fn remove_tv_episode_name(&mut self)

Removes the tv episode name (tven).

Source

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

Returns the tv network name (tvnn).

Source

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

Removes and returns the tv network name (tvnn).

Source

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

Sets the tv network name (tvnn).

Source

pub fn remove_tv_network_name(&mut self)

Removes the tv network name (tvnn).

Source

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

Returns the tv show name (tvsh).

Source

pub fn take_tv_show_name(&mut self) -> Option<String>

Removes and returns the tv show name (tvsh).

Source

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

Sets the tv show name (tvsh).

Source

pub fn remove_tv_show_name(&mut self)

Removes the tv show name (tvsh).

Source

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

Returns the work (©wrk).

Source

pub fn take_work(&mut self) -> Option<String>

Removes and returns the work (©wrk).

Source

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

Sets the work (©wrk).

Source

pub fn remove_work(&mut self)

Removes the work (©wrk).

Source

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

Returns the year (©day).

Source

pub fn take_year(&mut self) -> Option<String>

Removes and returns the year (©day).

Source

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

Sets the year (©day).

Source

pub fn remove_year(&mut self)

Removes the year (©day).

Source

pub fn isrc(&self) -> Option<&str>

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

Source

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

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

Source

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

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

Source

pub fn remove_isrc(&mut self)

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

Source

pub fn album_sort_order(&self) -> Option<&str>

Returns the album sort order (soal).

Source

pub fn take_album_sort_order(&mut self) -> Option<String>

Removes and returns the album sort order (soal).

Source

pub fn set_album_sort_order(&mut self, album_sort_order: impl Into<String>)

Sets the album sort order (soal).

Source

pub fn remove_album_sort_order(&mut self)

Removes the album sort order (soal).

Source

pub fn title_sort_order(&self) -> Option<&str>

Returns the title sort order (sonm).

Source

pub fn take_title_sort_order(&mut self) -> Option<String>

Removes and returns the title sort order (sonm).

Source

pub fn set_title_sort_order(&mut self, title_sort_order: impl Into<String>)

Sets the title sort order (sonm).

Source

pub fn remove_title_sort_order(&mut self)

Removes the title sort order (sonm).

Source

pub fn tv_show_name_sort_order(&self) -> Option<&str>

Returns the tv show name sort order (sosn).

Source

pub fn take_tv_show_name_sort_order(&mut self) -> Option<String>

Removes and returns the tv show name sort order (sosn).

Source

pub fn set_tv_show_name_sort_order( &mut self, tv_show_name_sort_order: impl Into<String>, )

Sets the tv show name sort order (sosn).

Source

pub fn remove_tv_show_name_sort_order(&mut self)

Removes the tv show name sort order (sosn).

Source

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

Returns all album artists (aART).

Source

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

Returns the first album artist (aART).

Source

pub fn take_album_artists(&mut self) -> impl Iterator<Item = String> + '_

Removes and returns all album artists (aART).

Source

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

Removes all and returns the first album artist (aART).

Source

pub fn set_album_artists( &mut self, album_artists: impl IntoIterator<Item = String>, )

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

Source

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

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

Source

pub fn add_album_artists( &mut self, album_artists: impl IntoIterator<Item = String>, )

Adds all album artists (aART).

Source

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

Adds an album artist (aART).

Source

pub fn remove_album_artists(&mut self)

Removes all album artists (aART).

Source

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

Returns all artists (©ART).

Source

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

Returns the first artist (©ART).

Source

pub fn take_artists(&mut self) -> impl Iterator<Item = String> + '_

Removes and returns all artists (©ART).

Source

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

Removes all and returns the first artist (©ART).

Source

pub fn set_artists(&mut self, artists: impl IntoIterator<Item = String>)

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

Source

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

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

Source

pub fn add_artists(&mut self, artists: impl IntoIterator<Item = String>)

Adds all artists (©ART).

Source

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

Adds an artist (©ART).

Source

pub fn remove_artists(&mut self)

Removes all artists (©ART).

Source

pub fn categories(&self) -> impl Iterator<Item = &str>

Returns all categories (catg).

Source

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

Returns the first category (catg).

Source

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

Removes and returns all categories (catg).

Source

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

Removes all and returns the first category (catg).

Source

pub fn set_categories(&mut self, categories: impl IntoIterator<Item = String>)

Sets all categories (catg). This will remove all other categories.

Source

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

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

Source

pub fn add_categories(&mut self, categories: impl IntoIterator<Item = String>)

Adds all categories (catg).

Source

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

Adds an category (catg).

Source

pub fn remove_categories(&mut self)

Removes all categories (catg).

Source

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

Returns all comments (©cmt).

Source

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

Returns the first comment (©cmt).

Source

pub fn take_comments(&mut self) -> impl Iterator<Item = String> + '_

Removes and returns all comments (©cmt).

Source

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

Removes all and returns the first comment (©cmt).

Source

pub fn set_comments(&mut self, comments: impl IntoIterator<Item = String>)

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

Source

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

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

Source

pub fn add_comments(&mut self, comments: impl IntoIterator<Item = String>)

Adds all comments (©cmt).

Source

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

Adds an comment (©cmt).

Source

pub fn remove_comments(&mut self)

Removes all comments (©cmt).

Source

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

Returns all composers (©wrt).

Source

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

Returns the first composer (©wrt).

Source

pub fn take_composers(&mut self) -> impl Iterator<Item = String> + '_

Removes and returns all composers (©wrt).

Source

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

Removes all and returns the first composer (©wrt).

Source

pub fn set_composers(&mut self, composers: impl IntoIterator<Item = String>)

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

Source

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

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

Source

pub fn add_composers(&mut self, composers: impl IntoIterator<Item = String>)

Adds all composers (©wrt).

Source

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

Adds an composer (©wrt).

Source

pub fn remove_composers(&mut self)

Removes all composers (©wrt).

Source

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

Returns all custom genres (©gen).

Source

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

Returns the first custom genre (©gen).

Source

pub fn take_custom_genres(&mut self) -> impl Iterator<Item = String> + '_

Removes and returns all custom genres (©gen).

Source

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

Removes all and returns the first custom genre (©gen).

Source

pub fn set_custom_genres( &mut self, custom_genres: impl IntoIterator<Item = String>, )

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

Source

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

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

Source

pub fn add_custom_genres( &mut self, custom_genres: impl IntoIterator<Item = String>, )

Adds all custom genres (©gen).

Source

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

Adds an custom genre (©gen).

Source

pub fn remove_custom_genres(&mut self)

Removes all custom genres (©gen).

Source

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

Returns all descriptions (desc).

Source

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

Returns the first description (desc).

Source

pub fn take_descriptions(&mut self) -> impl Iterator<Item = String> + '_

Removes and returns all descriptions (desc).

Source

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

Removes all and returns the first description (desc).

Source

pub fn set_descriptions( &mut self, descriptions: impl IntoIterator<Item = String>, )

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

Source

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

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

Source

pub fn add_descriptions( &mut self, descriptions: impl IntoIterator<Item = String>, )

Adds all descriptions (desc).

Source

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

Adds an description (desc).

Source

pub fn remove_descriptions(&mut self)

Removes all descriptions (desc).

Source

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

Returns all groupings (©grp).

Source

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

Returns the first grouping (©grp).

Source

pub fn take_groupings(&mut self) -> impl Iterator<Item = String> + '_

Removes and returns all groupings (©grp).

Source

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

Removes all and returns the first grouping (©grp).

Source

pub fn set_groupings(&mut self, groupings: impl IntoIterator<Item = String>)

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

Source

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

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

Source

pub fn add_groupings(&mut self, groupings: impl IntoIterator<Item = String>)

Adds all groupings (©grp).

Source

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

Adds an grouping (©grp).

Source

pub fn remove_groupings(&mut self)

Removes all groupings (©grp).

Source

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

Returns all keywords (keyw).

Source

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

Returns the first keyword (keyw).

Source

pub fn take_keywords(&mut self) -> impl Iterator<Item = String> + '_

Removes and returns all keywords (keyw).

Source

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

Removes all and returns the first keyword (keyw).

Source

pub fn set_keywords(&mut self, keywords: impl IntoIterator<Item = String>)

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

Source

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

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

Source

pub fn add_keywords(&mut self, keywords: impl IntoIterator<Item = String>)

Adds all keywords (keyw).

Source

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

Adds an keyword (keyw).

Source

pub fn remove_keywords(&mut self)

Removes all keywords (keyw).

Source

pub fn lyricists(&self) -> impl Iterator<Item = &str>

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

Source

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

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

Source

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

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

Source

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

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

Source

pub fn set_lyricists(&mut self, lyricists: impl IntoIterator<Item = String>)

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

Source

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

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

Source

pub fn add_lyricists(&mut self, lyricists: impl IntoIterator<Item = String>)

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

Source

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

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

Source

pub fn remove_lyricists(&mut self)

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

Source

pub fn album_artist_sort_orders(&self) -> impl Iterator<Item = &str>

Returns all album artist sort orders (soaa).

Source

pub fn album_artist_sort_order(&self) -> Option<&str>

Returns the first album artist sort order (soaa).

Source

pub fn take_album_artist_sort_orders( &mut self, ) -> impl Iterator<Item = String> + '_

Removes and returns all album artist sort orders (soaa).

Source

pub fn take_album_artist_sort_order(&mut self) -> Option<String>

Removes all and returns the first album artist sort order (soaa).

Source

pub fn set_album_artist_sort_orders( &mut self, album_artist_sort_orders: impl IntoIterator<Item = String>, )

Sets all album artist sort orders (soaa). This will remove all other album artist sort orders.

Source

pub fn set_album_artist_sort_order( &mut self, album_artist_sort_order: impl Into<String>, )

Sets the album artist sort order (soaa). This will remove all other album artist sort orders.

Source

pub fn add_album_artist_sort_orders( &mut self, album_artist_sort_orders: impl IntoIterator<Item = String>, )

Adds all album artist sort orders (soaa).

Source

pub fn add_album_artist_sort_order( &mut self, album_artist_sort_order: impl Into<String>, )

Adds an album artist sort order (soaa).

Source

pub fn remove_album_artist_sort_orders(&mut self)

Removes all album artist sort orders (soaa).

Source

pub fn artist_sort_orders(&self) -> impl Iterator<Item = &str>

Returns all artist sort orders (soar).

Source

pub fn artist_sort_order(&self) -> Option<&str>

Returns the first artist sort order (soar).

Source

pub fn take_artist_sort_orders(&mut self) -> impl Iterator<Item = String> + '_

Removes and returns all artist sort orders (soar).

Source

pub fn take_artist_sort_order(&mut self) -> Option<String>

Removes all and returns the first artist sort order (soar).

Source

pub fn set_artist_sort_orders( &mut self, artist_sort_orders: impl IntoIterator<Item = String>, )

Sets all artist sort orders (soar). This will remove all other artist sort orders.

Source

pub fn set_artist_sort_order(&mut self, artist_sort_order: impl Into<String>)

Sets the artist sort order (soar). This will remove all other artist sort orders.

Source

pub fn add_artist_sort_orders( &mut self, artist_sort_orders: impl IntoIterator<Item = String>, )

Adds all artist sort orders (soar).

Source

pub fn add_artist_sort_order(&mut self, artist_sort_order: impl Into<String>)

Adds an artist sort order (soar).

Source

pub fn remove_artist_sort_orders(&mut self)

Removes all artist sort orders (soar).

Source

pub fn composer_sort_orders(&self) -> impl Iterator<Item = &str>

Returns all composer sort orders (soco).

Source

pub fn composer_sort_order(&self) -> Option<&str>

Returns the first composer sort order (soco).

Source

pub fn take_composer_sort_orders(&mut self) -> impl Iterator<Item = String> + '_

Removes and returns all composer sort orders (soco).

Source

pub fn take_composer_sort_order(&mut self) -> Option<String>

Removes all and returns the first composer sort order (soco).

Source

pub fn set_composer_sort_orders( &mut self, composer_sort_orders: impl IntoIterator<Item = String>, )

Sets all composer sort orders (soco). This will remove all other composer sort orders.

Source

pub fn set_composer_sort_order( &mut self, composer_sort_order: impl Into<String>, )

Sets the composer sort order (soco). This will remove all other composer sort orders.

Source

pub fn add_composer_sort_orders( &mut self, composer_sort_orders: impl IntoIterator<Item = String>, )

Adds all composer sort orders (soco).

Source

pub fn add_composer_sort_order( &mut self, composer_sort_order: impl Into<String>, )

Adds an composer sort order (soco).

Source

pub fn remove_composer_sort_orders(&mut self)

Removes all composer sort orders (soco).

Source

pub fn compilation(&self) -> bool

Returns the compilation flag (cpil).

Source

pub fn set_compilation(&mut self)

Sets the compilation flag to true (cpil).

Source

pub fn remove_compilation(&mut self)

Removes the compilation flag (cpil).

Source

pub fn gapless_playback(&self) -> bool

Returns the gapless playback flag (pgap).

Source

pub fn set_gapless_playback(&mut self)

Sets the gapless playback flag to true (pgap).

Source

pub fn remove_gapless_playback(&mut self)

Removes the gapless playback flag (pgap).

Source

pub fn show_movement(&self) -> bool

Returns the show movement flag (shwm).

Source

pub fn set_show_movement(&mut self)

Sets the show movement flag to true (shwm).

Source

pub fn remove_show_movement(&mut self)

Removes the show movement flag (shwm).

Source

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

Returns the bpm (tmpo)

Source

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

Sets the bpm (tmpo)

Source

pub fn remove_bpm(&mut self)

Removes the bpm (tmpo).

Source

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

Returns the movement count (©mvc)

Source

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

Sets the movement count (©mvc)

Source

pub fn remove_movement_count(&mut self)

Removes the movement count (©mvc).

Source

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

Returns the movement index (©mvi)

Source

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

Sets the movement index (©mvi)

Source

pub fn remove_movement_index(&mut self)

Removes the movement index (©mvi).

Source

pub fn tv_episode(&self) -> Option<u32>

Returns the tv episode (tves)

Source

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

Sets the tv episode (tves)

Source

pub fn remove_tv_episode(&mut self)

Removes the tv episode (tves).

Source

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

Returns the tv season (tvsn)

Source

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

Sets the tv season (tvsn)

Source

pub fn remove_tv_season(&mut self)

Removes the tv season (tvsn).

Source

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

Returns all standard genres (gnre).

Source

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

Returns the first standard genre (gnre).

Source

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

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

Source

pub fn set_standard_genres( &mut self, genre_codes: impl IntoIterator<Item = u16>, )

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

Source

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

Adds a standard genre (gnre).

Source

pub fn add_standard_genres( &mut self, genre_codes: impl IntoIterator<Item = u16>, )

Adds all standard genres (gnre).

Source

pub fn remove_standard_genres(&mut self)

Removes all standard genres (gnre).

Source

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

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

Source

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

Returns the first genre (gnre or ©gen).

Source

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

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

Source

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

Removes all custom genres (©gen) and returns the first genre (gnre or ©gen).

Source

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

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

Source

pub fn set_genres(&mut self, genres: impl IntoIterator<Item = String>)

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

Source

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

Adds a custom genre (©gen).

Source

pub fn remove_genres(&mut self)

Removes the genre (gnre or ©gen).

Source

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

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

Source

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

Returns the track number (trkn).

Source

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

Returns the total number of tracks (trkn).

Source

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

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

Source

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

Sets the track number (trkn).

Source

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

Sets the total number of tracks (trkn).

Source

pub fn remove_track(&mut self)

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

Source

pub fn remove_track_number(&mut self)

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

Source

pub fn remove_total_tracks(&mut self)

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

Source

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

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

Source

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

Returns the disc number (disk).

Source

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

Returns the total number of discs (disk).

Source

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

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

Source

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

Sets the disc number (disk).

Source

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

Sets the total number of discs (disk).

Source

pub fn remove_disc(&mut self)

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

Source

pub fn remove_disc_number(&mut self)

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

Source

pub fn remove_total_discs(&mut self)

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

Source

pub fn write_with(&self, file: &File, cfg: &WriteConfig) -> Result<()>

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

Source

pub fn write_to(&self, file: &File) -> Result<()>

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

Source

pub fn write_with_path( &self, path: impl AsRef<Path>, cfg: &WriteConfig, ) -> Result<()>

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

Source

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

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

Source

pub fn artworks(&self) -> impl Iterator<Item = ImgRef<'_>>

Returns all artwork images (covr).

Source

pub fn artwork(&self) -> Option<ImgRef<'_>>

Returns the first artwork image (covr).

Source

pub fn take_artworks(&mut self) -> impl Iterator<Item = ImgBuf> + '_

Removes and returns all artwork images (covr).

Source

pub fn take_artwork(&mut self) -> Option<ImgBuf>

Removes all and returns the first artwork image (covr).

Source

pub fn set_artwork(&mut self, image: Img<impl Into<Vec<u8>>>)

Sets the artwork image data (covr). This will remove all other artworks.

Source

pub fn set_artworks(&mut self, images: impl IntoIterator<Item = ImgBuf>)

Sets all artwork image data (covr). This will remove all other artworks.

Source

pub fn add_artwork(&mut self, image: Img<impl Into<Vec<u8>>>)

Adds artwork image data (covr).

Source

pub fn add_artworks(&mut self, images: impl IntoIterator<Item = ImgBuf>)

Adds artwork image data (covr).

Source

pub fn remove_artworks(&mut self)

Removes all artworks (covr).

Source

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

Returns the media type (stik).

Source

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

Sets the media type (stik).

Source

pub fn remove_media_type(&mut self)

Removes the media type (stik).

Source

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

Returns the advisory rating (rtng).

Source

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

Sets the advisory rating (rtng).

Source

pub fn remove_advisory_rating(&mut self)

Removes the advisory rating (rtng).

Source

pub fn chapters(&self) -> &[Chapter]

Returns either the chapter list or the chapter track. The chapter list is preferred.

Source

pub fn chapters_mut(&mut self) -> &mut Vec<Chapter>

Returns either the chapter list or the chapter track. The chapter list is preferred.

Source

pub fn take_chapters(&mut self) -> Vec<Chapter>

Removes and returns either the chapter list or the chapter track. The chapter list is preferred.

Source

pub fn chapter_list(&self) -> &[Chapter]

Returns the chapter list.

Source

pub fn chapter_list_mut(&mut self) -> &mut Vec<Chapter>

Returns the chapter list.

Source

pub fn take_chapter_list(&mut self) -> Vec<Chapter>

Removes and returns the chapter list.

Source

pub fn chapter_track(&self) -> &[Chapter]

Returns the chapter track.

Source

pub fn chapter_track_mut(&mut self) -> &mut Vec<Chapter>

Returns the chapter track.

Source

pub fn take_chapter_track(&mut self) -> Vec<Chapter>

Removes and returns the chapter track.

Source

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

Returns references to all byte data corresponding to the identifier.
See Data::bytes.

§Example
use mp4ameta::{Userdata, Data, Fourcc};

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

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

pub fn bytes_mut_of( &mut self, ident: &impl Ident, ) -> impl Iterator<Item = &mut Vec<u8>>

Returns mutable references to all byte data corresponding to the identifier.
See Data::bytes_mut.

§Example
use mp4ameta::{Userdata, Data, Fourcc};

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

tag.set_data(test, Data::Reserved(b"data".to_vec()));
tag.bytes_mut_of(&test).next().unwrap().push('1' as u8);
assert_eq!(tag.bytes_of(&test).next().unwrap(), b"data1");
Source

pub fn take_bytes_of( &mut self, ident: &impl Ident, ) -> impl Iterator<Item = Vec<u8>>

Removes the atom corresponding to the identifier and returns all of it’s byte data.
See Data::into_bytes.

§Example
use mp4ameta::{Userdata, Data, Fourcc};

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

tag.set_data(test, Data::Reserved(b"data".to_vec()));
assert_eq!(tag.take_bytes_of(&test).next().unwrap(), b"data");
assert_eq!(tag.bytes_of(&test).next(), None);
Source

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

Returns references to all strings corresponding to the identifier.
See Data::string.

§Example
use mp4ameta::{Userdata, Data, Fourcc};

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

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

pub fn strings_mut_of( &mut self, ident: &impl Ident, ) -> impl Iterator<Item = &mut String>

Returns all mutable string references corresponding to the identifier.
See Data::string_mut.

§Example
use mp4ameta::{Userdata, Data, Fourcc};

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

tag.set_data(test, Data::Utf8("string".into()));
tag.strings_mut_of(&test).next().unwrap().push('1');
assert_eq!(tag.strings_of(&test).next().unwrap(), "string1");
Source

pub fn take_strings_of( &mut self, ident: &impl Ident, ) -> impl Iterator<Item = String>

Removes the atom corresponding to the identifier and returns all of it’s strings.
See Data::into_string.

§Example
use mp4ameta::{Userdata, Data, Fourcc};

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

tag.set_data(test, Data::Utf8("string".into()));
assert_eq!(tag.take_strings_of(&test).next().unwrap(), "string");
assert_eq!(tag.strings_of(&test).next(), None);
Source

pub fn images_of<'a>( &'a self, ident: &impl Ident, ) -> impl Iterator<Item = ImgRef<'a>>

Returns references to all images corresponding to the identifier.
See Data::image.

§Example
use mp4ameta::{Userdata, Data, Fourcc};

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

tag.set_data(test, Data::Jpeg(b"image".to_vec()));
let img = tag.images_of(&test).next().unwrap();
assert_eq!(img.data, b"image");
Source

pub fn images_mut_of<'a>( &'a mut self, ident: &impl Ident, ) -> impl Iterator<Item = ImgMut<'a>>

Returns mutable references to all images corresponding to the identifier.
See Data::image_mut.

§Example
use mp4ameta::{Userdata, Data, Fourcc};

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

tag.set_data(test, Data::Jpeg(b"image".to_vec()));
let img = tag.images_mut_of(&test).next().unwrap();
img.data.push('1' as u8);

let img = tag.images_of(&test).next().unwrap();
assert_eq!(img.data, b"image1");
Source

pub fn take_images_of( &mut self, ident: &impl Ident, ) -> impl Iterator<Item = ImgBuf>

Removes the atom corresponding to the identifier and returns all of it’s images.
See Data::into_image.

§Example
use mp4ameta::{Userdata, Data, Fourcc, Img};

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

tag.set_data(test, Data::Png(b"image".to_vec()));
assert_eq!(tag.take_images_of(&test).next().unwrap(), Img::png(b"image".to_vec()));
assert_eq!(tag.images_of(&test).next(), None);
Source

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

Returns references to all data corresponding to the identifier.

§Example
use mp4ameta::{Userdata, Data, Fourcc};

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

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

pub fn data_mut_of( &mut self, ident: &impl Ident, ) -> impl Iterator<Item = &mut Data>

Returns mutable references to all data corresponding to the identifier.

§Example
use mp4ameta::{Userdata, Data, Fourcc};

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

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

pub fn take_data_of(&mut self, ident: &impl Ident) -> impl Iterator<Item = Data>

Removes the atom corresponding to the identifier and returns all of it’s data.

§Example
use mp4ameta::{Userdata, Data, Fourcc};

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

tag.set_data(test, Data::Utf8("data".into()));
assert_eq!(tag.take_data_of(&test).next().unwrap(), Data::Utf8("data".into()));
assert_eq!(tag.data_of(&test).next(), None);
Source

pub fn bytes(&self) -> impl Iterator<Item = (&DataIdent, &[u8])>

Returns an iterator over references to all byte data.

§Example
use mp4ameta::{Userdata, Data, DataIdent, Fourcc};

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

tag.add_data(test, Data::Reserved(b"data1".to_vec()));
tag.add_data(test, Data::Utf8("string".into()));
tag.add_data(test, Data::BeSigned(b"data2".to_vec()));

let test = DataIdent::Fourcc(test);
let mut bytes = tag.bytes();
assert_eq!(bytes.next().unwrap(), (&test, &b"data1"[..]));
assert_eq!(bytes.next().unwrap(), (&test, &b"data2"[..]));
assert_eq!(bytes.next(), None);
Source

pub fn bytes_mut(&mut self) -> impl Iterator<Item = (&DataIdent, &mut Vec<u8>)>

Returns an iterator over mutable references to all byte data.

§Example
use mp4ameta::{Userdata, Data, DataIdent, Fourcc};

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

tag.add_data(test, Data::Reserved(b"data".to_vec()));
tag.add_data(test, Data::Utf8("string".into()));

let (ident, data) = tag.bytes_mut().next().unwrap();
data.push('1' as u8);

let test = DataIdent::Fourcc(test);
let mut bytes = tag.bytes();
assert_eq!(bytes.next().unwrap(), (&test, &b"data1"[..]));
assert_eq!(bytes.next(), None);
Source

pub fn strings(&self) -> impl Iterator<Item = (&DataIdent, &str)>

Returns an iterator over references to all strings.

§Example
use mp4ameta::{Userdata, Data, DataIdent, Fourcc};

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

tag.add_data(test, Data::Utf8("string1".into()));
tag.add_data(test, Data::Reserved(b"data".to_vec()));
tag.add_data(test, Data::Utf16("string2".into()));

let test = DataIdent::Fourcc(test);
let mut strings = tag.strings();
assert_eq!(strings.next().unwrap(), (&test, "string1"));
assert_eq!(strings.next().unwrap(), (&test, "string2"));
assert_eq!(strings.next(), None);
Source

pub fn strings_mut(&mut self) -> impl Iterator<Item = (&DataIdent, &mut String)>

Returns an iterator over mutable references to all strings.

§Example
use mp4ameta::{Userdata, Data, DataIdent, Fourcc};

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

tag.add_data(test, Data::Reserved(b"data".to_vec()));
tag.add_data(test, Data::Utf8("string".into()));

let (ident, data) = tag.strings_mut().next().unwrap();
data.push('1');

let test = DataIdent::Fourcc(test);
let mut strings = tag.strings();
assert_eq!(strings.next().unwrap(), (&test, "string1"));
assert_eq!(strings.next(), None);
Source

pub fn images(&self) -> impl Iterator<Item = (&DataIdent, ImgRef<'_>)>

Returns an iterator over references to all images.

§Example
use mp4ameta::{Userdata, Data, DataIdent, Fourcc, Img};

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

tag.add_data(test, Data::Png(b"image1".to_vec()));
tag.add_data(test, Data::Utf8("string".into()));
tag.add_data(test, Data::Jpeg(b"image2".to_vec()));

let test = DataIdent::Fourcc(test);
let mut images = tag.images();
assert_eq!(images.next().unwrap(), (&test, Img::png(&b"image1"[..])));
assert_eq!(images.next().unwrap(), (&test, Img::jpeg(&b"image2"[..])));
assert_eq!(images.next(), None);
Source

pub fn images_mut(&mut self) -> impl Iterator<Item = (&DataIdent, ImgMut<'_>)>

Returns an iterator over mutable references to all images.

§Example
use mp4ameta::{Userdata, Data, DataIdent, Fourcc, Img};

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

tag.add_data(test, Data::Bmp(b"data".to_vec()));
tag.add_data(test, Data::Utf8("string".into()));

let (ident, image) = tag.images_mut().next().unwrap();
image.data.push('1' as u8);

let test = DataIdent::Fourcc(test);
let mut images = tag.images();
assert_eq!(images.next().unwrap(), (&test, Img::bmp(&b"data1"[..])));
assert_eq!(images.next(), None);
Source

pub fn data(&self) -> impl Iterator<Item = (&DataIdent, &Data)>

Returns an iterator over references to all data.

§Example
use mp4ameta::{Userdata, Data, DataIdent, Fourcc};

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

tag.add_data(test, Data::Reserved(b"data".to_vec()));
tag.add_data(test, Data::Utf8("string".into()));
tag.add_data(test, Data::Png(b"image".to_vec()));

let test = DataIdent::Fourcc(test);
let mut data = tag.data();
assert_eq!(data.next().unwrap(), (&test, &Data::Reserved(b"data".to_vec())));
assert_eq!(data.next().unwrap(), (&test, &Data::Utf8("string".into())));
assert_eq!(data.next().unwrap(), (&test, &Data::Png(b"image".to_vec())));
assert_eq!(data.next(), None);
Source

pub fn data_mut(&mut self) -> impl Iterator<Item = (&DataIdent, &mut Data)>

Returns an iterator over mutable references to all data.

§Example
use mp4ameta::{Userdata, Data, DataIdent, Fourcc};

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

tag.add_data(test, Data::Utf8("string".into()));

let (ident, data) = tag.data_mut().next().unwrap();
data.string_mut().unwrap().push('1');

let test = DataIdent::Fourcc(test);
let mut strings = tag.strings();
assert_eq!(strings.next().unwrap(), (&test, "string1"));
assert_eq!(strings.next(), None);
Source

pub fn remove_bytes_of(&mut self, ident: &impl Ident)

Removes all byte data corresponding to the identifier. Other data will remain unaffected.
See Data::is_bytes

§Example
use mp4ameta::{Userdata, Data, Fourcc};

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

tag.add_data(test, Data::Utf8("string".into()));
tag.add_data(test, Data::BeSigned("data".into()));

let mut data = tag.data_of(&test);
assert_eq!(data.next(), Some(&Data::Utf8("string".into())));
assert_eq!(data.next(), Some(&Data::BeSigned(b"data".to_vec())));
assert_eq!(data.next(), None);
drop(data);

tag.remove_bytes_of(&test);


let mut data = tag.data_of(&test);
assert_eq!(data.next(), Some(&Data::Utf8("string".into())));
assert_eq!(data.next(), None);
Source

pub fn remove_strings_of(&mut self, ident: &impl Ident)

Removes all strings corresponding to the identifier. Other data will remain unaffected.

§Example
use mp4ameta::{Userdata, Data, Fourcc};

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

tag.add_data(test, Data::Utf8("string".into()));
tag.add_data(test, Data::Bmp("image".into()));

let mut data = tag.data_of(&test);
assert_eq!(data.next(), Some(&Data::Utf8("string".into())));
assert_eq!(data.next(), Some(&Data::Bmp(b"image".to_vec())));
assert_eq!(data.next(), None);
drop(data);

tag.remove_strings_of(&test);


let mut data = tag.data_of(&test);
assert_eq!(data.next(), Some(&Data::Bmp(b"image".to_vec())));
assert_eq!(data.next(), None);
Source

pub fn remove_images_of(&mut self, ident: &impl Ident)

Removes all images corresponding to the identifier. Other data will remain unaffected.

§Example
use mp4ameta::{Userdata, Data, Fourcc};

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

tag.add_data(test, Data::Utf8("string".into()));
tag.add_data(test, Data::Bmp("image".into()));

let mut data = tag.data_of(&test);
assert_eq!(data.next(), Some(&Data::Utf8("string".into())));
assert_eq!(data.next(), Some(&Data::Bmp(b"image".to_vec())));
assert_eq!(data.next(), None);
drop(data);

tag.remove_images_of(&test);


let mut data = tag.data_of(&test);
assert_eq!(data.next(), Some(&Data::Utf8("string".into())));
assert_eq!(data.next(), None);
Source

pub fn remove_data_of(&mut self, ident: &impl Ident)

Removes all data corresponding to the identifier.

§Example
use mp4ameta::{Userdata, Data, Fourcc};

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

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

pub fn retain_bytes_of( &mut self, ident: &impl Ident, predicate: impl Fn(&[u8]) -> bool, )

Retains only the bytes, of the atom corresponding to the identifier, that match the predicate.

§Example
use mp4ameta::{Userdata, Data, Fourcc};

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

tag.add_data(test, Data::BeSigned(vec![4; 12]));
tag.add_data(test, Data::Reserved(vec![6; 16]));

let mut bytes = tag.bytes_of(&test);
assert_eq!(bytes.next(), Some(&[4; 12][..]));
assert_eq!(bytes.next(), Some(&[6; 16][..]));
assert_eq!(bytes.next(), None);
drop(bytes);

tag.retain_bytes_of(&test, |b| b[2..4] == [4, 4]);

let mut bytes = tag.bytes_of(&test);
assert_eq!(bytes.next(), Some(&[4; 12][..]));
assert_eq!(bytes.next(), None);
Source

pub fn retain_strings_of( &mut self, ident: &impl Ident, predicate: impl Fn(&str) -> bool, )

Retains only the strings, of the atom corresponding to the identifier, that match the predicate.

§Example
use mp4ameta::{Userdata, Data, Fourcc, Img, ImgFmt};

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

tag.add_data(test, Data::Utf8("string1".into()));
tag.add_data(test, Data::Utf8("string2".into()));

let mut strings = tag.strings_of(&test);
assert_eq!(strings.next(), Some("string1"));
assert_eq!(strings.next(), Some("string2"));
assert_eq!(strings.next(), None);
drop(strings);

tag.retain_strings_of(&test, |s| s.ends_with("1"));

let mut strings = tag.strings_of(&test);
assert_eq!(strings.next(), Some("string1"));
assert_eq!(strings.next(), None);
Source

pub fn retain_images_of( &mut self, ident: &impl Ident, predicate: impl Fn(ImgRef<'_>) -> bool, )

Retains only the images, of the atom corresponding to the identifier, that match the predicate.

§Example
use mp4ameta::{Userdata, Data, Fourcc, Img, ImgFmt};

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

tag.add_data(test, Data::Png(vec![5; 4]));
tag.add_data(test, Data::Jpeg(vec![6; 16]));

let mut images = tag.images_of(&test);
assert_eq!(images.next(), Some(Img::new(ImgFmt::Png, &[5; 4][..])));
assert_eq!(images.next(), Some(Img::new(ImgFmt::Jpeg, &[6; 16][..])));
assert_eq!(images.next(), None);
drop(images);

tag.retain_images_of(&test, |d| d.fmt == ImgFmt::Jpeg);

let mut images = tag.images_of(&test);
assert_eq!(images.next(), Some(Img::new(ImgFmt::Jpeg, &[6; 16][..])));
assert_eq!(images.next(), None);
Source

pub fn retain_data_of( &mut self, ident: &impl Ident, predicate: impl Fn(&Data) -> bool, )

Retains only the data, of the atom corresponding to the identifier, that matches the predicate.

§Example
use mp4ameta::{Userdata, Data, Fourcc};

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

tag.add_data(test, Data::Utf8("short".into()));
tag.add_data(test, Data::Reserved(vec![6; 16]));

let mut data = tag.data_of(&test);
assert_eq!(data.next(), Some(&Data::Utf8("short".into())));
assert_eq!(data.next(), Some(&Data::Reserved(vec![6; 16])));
assert_eq!(data.next(), None);
drop(data);

tag.retain_data_of(&test, |d| d.data_len() < 10);

let mut data = tag.data_of(&test);
assert_eq!(data.next(), Some(&Data::Utf8("short".into())));
assert_eq!(data.next(), None);
Source

pub fn retain_bytes(&mut self, predicate: impl Fn(&DataIdent, &[u8]) -> bool)

Retains only the byte data matching the predicate. Other data will remain unaffected.

§Example
use mp4ameta::{Userdata, Data, Fourcc};

let mut tag = Userdata::default();
let tst1 = Fourcc(*b"tst1");
let tst2 = Fourcc(*b"tst2");

tag.add_data(tst1, Data::Reserved(b"data1".to_vec()));
tag.add_data(tst2, Data::Png(b"data2".to_vec()));
tag.add_data(tst2, Data::BeSigned(b"data3".to_vec()));

let mut data = tag.data().map(|(i, d)| d);
assert_eq!(data.next(), Some(&Data::Reserved(b"data1".to_vec())));
assert_eq!(data.next(), Some(&Data::Png(b"data2".to_vec())));
assert_eq!(data.next(), Some(&Data::BeSigned(b"data3".to_vec())));
assert_eq!(data.next(), None);
drop(data);

tag.retain_bytes(|i, d| &tst1 == i);

let mut data = tag.data().map(|(i, d)| d);
assert_eq!(data.next(), Some(&Data::Reserved(b"data1".to_vec())));
assert_eq!(data.next(), Some(&Data::Png(b"data2".to_vec())));
assert_eq!(data.next(), None);
Source

pub fn retain_strings(&mut self, predicate: impl Fn(&DataIdent, &str) -> bool)

Retains only the strings matching the predicate. Other data will remain unaffected.

§Example
use mp4ameta::{Userdata, Data, Fourcc};

let mut tag = Userdata::default();
let tst1 = Fourcc(*b"tst1");
let tst2 = Fourcc(*b"tst2");

tag.add_data(tst1, Data::Utf8("data1".into()));
tag.add_data(tst2, Data::Png(b"data2".to_vec()));
tag.add_data(tst2, Data::Utf8("data3".into()));

let mut data = tag.data().map(|(i, d)| d);
assert_eq!(data.next(), Some(&Data::Utf8("data1".into())));
assert_eq!(data.next(), Some(&Data::Png(b"data2".to_vec())));
assert_eq!(data.next(), Some(&Data::Utf8("data3".into())));
assert_eq!(data.next(), None);
drop(data);

tag.retain_strings(|i, d| &tst1 == i);

let mut data = tag.data().map(|(i, d)| d);
assert_eq!(data.next(), Some(&Data::Utf8("data1".into())));
assert_eq!(data.next(), Some(&Data::Png(b"data2".to_vec())));
assert_eq!(data.next(), None);
Source

pub fn retain_images( &mut self, predicate: impl Fn(&DataIdent, ImgRef<'_>) -> bool, )

Retains only the images matching the predicate. Other data will remain unaffected.

§Example
use mp4ameta::{Userdata, Data, Fourcc};

let mut tag = Userdata::default();
let tst1 = Fourcc(*b"tst1");
let tst2 = Fourcc(*b"tst2");

tag.add_data(tst1, Data::Jpeg(b"data1".to_vec()));
tag.add_data(tst2, Data::Png(b"data2".to_vec()));
tag.add_data(tst2, Data::Utf8("data3".into()));

let mut data = tag.data().map(|(i, d)| d);
assert_eq!(data.next(), Some(&Data::Jpeg(b"data1".to_vec())));
assert_eq!(data.next(), Some(&Data::Png(b"data2".to_vec())));
assert_eq!(data.next(), Some(&Data::Utf8("data3".into())));
assert_eq!(data.next(), None);
drop(data);

tag.retain_images(|i, d| &tst1 == i);

let mut data = tag.data().map(|(i, d)| d);
assert_eq!(data.next(), Some(&Data::Jpeg(b"data1".to_vec())));
assert_eq!(data.next(), Some(&Data::Utf8("data3".into())));
assert_eq!(data.next(), None);
Source

pub fn retain_data(&mut self, predicate: impl Fn(&DataIdent, &Data) -> bool)

Retains only the data matching the predicate.

§Example
use mp4ameta::{Userdata, Data, Fourcc};

let mut tag = Userdata::default();
let tst1 = Fourcc(*b"tst1");
let tst2 = Fourcc(*b"tst2");

tag.add_data(tst1, Data::Utf8("data1".into()));
tag.add_data(tst2, Data::Utf8("data2".into()));

let mut data = tag.data().map(|(i, d)| d);
assert_eq!(data.next(), Some(&Data::Utf8("data1".into())));
assert_eq!(data.next(), Some(&Data::Utf8("data2".into())));
assert_eq!(data.next(), None);
drop(data);

tag.retain_data(|i, d| &tst1 != i);

let mut data = tag.data().map(|(i, d)| d);
assert_eq!(data.next(), Some(&Data::Utf8("data2".into())));
assert_eq!(data.next(), None);
Source

pub fn clear(&mut self)

Removes user data. This includes the metadata item list as well as the chapter list and track.

§Example
use std::time::Duration;
use mp4ameta::{Userdata, Chapter, Data, Fourcc};

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

tag.set_data(test, Data::Utf8("data".into()));
tag.chapter_list_mut().push(Chapter::new(Duration::ZERO, "first"));
assert!(!tag.is_empty());
tag.clear();
assert!(tag.is_empty());
Source

pub fn clear_meta_items(&mut self)

Clear the metadata item list.

§Example
use std::time::Duration;
use mp4ameta::{Userdata, Chapter, Data, Fourcc};

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

tag.set_data(test, Data::Utf8("data".into()));
tag.chapter_list_mut().push(Chapter::new(Duration::ZERO, "first"));
assert!(!tag.is_empty());
assert!(!tag.meta_items_is_empty());
tag.clear_meta_items();
assert!(!tag.is_empty());
assert!(tag.meta_items_is_empty());
Source

pub fn set_data(&mut self, ident: impl Ident + Into<DataIdent>, data: Data)

If an atom corresponding to the identifier exists, it’s data will be replaced by the new data, otherwise a new metadata item atom containing the data will be created.

§Example
use mp4ameta::{Userdata, Data, Fourcc};

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

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

pub fn set_all_data( &mut self, ident: impl Ident + Into<DataIdent>, data: impl IntoIterator<Item = Data>, )

If an atom corresponding to the identifier exists, it’s data will be replaced by the new data, otherwise a new metadata item atom containing the data will be created.

§Example
use mp4ameta::{Userdata, Data, Fourcc};

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

let data = vec![
    Data::Utf8("data1".into()),
    Data::Utf8("data2".into()),
];
tag.set_all_data(test, data);

let mut strings = tag.strings_of(&test);
assert_eq!(strings.next(), Some("data1"));
assert_eq!(strings.next(), Some("data2"));
assert_eq!(strings.next(), None);
Source

pub fn add_data(&mut self, ident: impl Ident + Into<DataIdent>, data: Data)

If an atom corresponding to the identifier exists, the new data will be added to it, otherwise a new atom containing the data will be created.

§Example
use mp4ameta::{Userdata, Data, Fourcc};

let mut tag = Userdata::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.strings_of(&test);
assert_eq!(strings.next(), Some("data1"));
assert_eq!(strings.next(), Some("data2"));
assert_eq!(strings.next(), None)
Source

pub fn add_all_data( &mut self, ident: impl Ident + Into<DataIdent>, data: impl IntoIterator<Item = Data>, )

If an atom corresponding to the identifier exists, the new data will be added to it, otherwise a new metadata item atom containing the data will be created.

§Example
use mp4ameta::{Userdata, Data, Fourcc};

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

let data = vec![
    Data::Utf8("data1".into()),
    Data::Utf8("data2".into()),
];
tag.add_all_data(test, data);

let mut strings = tag.strings_of(&test);
assert_eq!(strings.next(), Some("data1"));
assert_eq!(strings.next(), Some("data2"));
assert_eq!(strings.next(), None)
Source

pub fn is_empty(&self) -> bool

Returns true if there is any user data.
This includes the metadata item list as well as the chapter list and track.

§Example
use std::time::Duration;
use mp4ameta::{Userdata, Chapter, Data, Fourcc};

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

tag.set_data(test, Data::Utf8("data".into()));
tag.chapter_list_mut().push(Chapter::new(Duration::ZERO, "first"));
assert!(!tag.is_empty());
tag.clear();
assert!(tag.is_empty());
Source

pub fn meta_items_is_empty(&self) -> bool

Returns true if metadata item list contains any data.

§Example
use std::time::Duration;
use mp4ameta::{Userdata, Chapter, Data, Fourcc};

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

tag.set_data(test, Data::Utf8("data".into()));
tag.chapter_list_mut().push(Chapter::new(Duration::ZERO, "first"));
assert!(!tag.is_empty());
assert!(!tag.meta_items_is_empty());
tag.clear_meta_items();
assert!(!tag.is_empty());
assert!(tag.meta_items_is_empty());

Trait Implementations§

Source§

impl Clone for Tag

Source§

fn clone(&self) -> Tag

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Tag

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Tag

Source§

fn default() -> Tag

Returns the “default value” for a type. Read more
Source§

impl Deref for Tag

Source§

type Target = Userdata

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl DerefMut for Tag

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl Display for Tag

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Tag

Source§

fn eq(&self, other: &Tag) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for Tag

Source§

impl StructuralPartialEq for Tag

Auto Trait Implementations§

§

impl Freeze for Tag

§

impl RefUnwindSafe for Tag

§

impl Send for Tag

§

impl Sync for Tag

§

impl Unpin for Tag

§

impl UnwindSafe for Tag

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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.