Struct mp4ameta::Tag [−][src]
pub struct Tag { /* fields omitted */ }
Expand description
A MPEG-4 audio tag containing metadata atoms
Implementations
Returns all standard genres (gnre
).
Returns the first standard genre (gnre
).
Sets the standard genre (gnre
). This will remove all other standard genres.
Sets all standard genres (gnre
). This will remove all other standard genres.
Adds a standard genre (gnre
).
Adds all standard genres (gnre
).
Removes all standard genres (gnre
).
Genre
These are convenience methods that operate on values of both standard genres (gnre
) and
custom genres (©gen
).
Returns all genres, first the standard genres (gnre
) then custom ones (©gen
).
Removes all custom genres (©gen
) and returns all genres, first standard genres (gnre
)
then custom ones (©gen
).
Removes all custom genres (©gen
) and returns the first genre (gnre
or ©gen
).
Sets the custom genre (©gen
). This will remove all other standard or custom genres.
Sets the custom genre (©gen
). This will remove all other standard or custom genres.
Removes the genre (gnre
or ©gen
).
Returns a reference of the audio information.
Returns the channel configuration.
Returns the channel configuration.
Returns the average bitrate.
Returns the maximum bitrate.
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.
Returns the track number and the total number of tracks (trkn
).
Returns the track number (trkn
).
Returns the total number of tracks (trkn
).
Sets the track number and the total number of tracks (trkn
).
Sets the track number (trkn
).
Sets the total number of tracks (trkn
).
Removes the track number and the total number of tracks (trkn
).
Removes the track number, preserving the total number of tracks if present (trkn
).
Removes the total number of tracks, preserving the track number if present (trkn
).
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.
Returns the disc number and total number of discs (disk
).
Returns the disc number (disk
).
Returns the total number of discs (disk
).
Sets the disc number and the total number of discs (disk
).
Sets the disc number (disk
).
Sets the total number of discs (disk
).
Removes the disc number and the total number of discs (disk
).
Removes the disc number, preserving the total number of discs if present (disk
).
Removes the total number of discs, preserving the disc number if present (disk
).
Creates a new MPEG-4 audio tag containing the atom.
Attempts to read a MPEG-4 audio tag from the reader.
Attempts to read a MPEG-4 audio tag from the file at the indicated path.
Attempts to write the MPEG-4 audio tag to the writer. This will overwrite any metadata previously present on the file.
Attempts to write the MPEG-4 audio tag to the path. This will overwrite any metadata previously present on the file.
Attempts to dump the MPEG-4 audio tag to the writer.
Removes and returns the copyright (cprt
).
Sets the copyright (cprt
).
Removes the copyright (cprt
).
Removes and returns the encoder (©too
).
Sets the encoder (©too
).
Removes the encoder (©too
).
Removes and returns the lyrics (©lyr
).
Sets the lyrics (©lyr
).
Removes the lyrics (©lyr
).
Removes and returns the movement (©mvn
).
Sets the movement (©mvn
).
Removes the movement (©mvn
).
Returns the tv episode name (tven
).
Removes and returns the tv episode name (tven
).
Sets the tv episode name (tven
).
Removes the tv episode name (tven
).
Returns the tv network name (tvnn
).
Removes and returns the tv network name (tvnn
).
Sets the tv network name (tvnn
).
Removes the tv network name (tvnn
).
Returns the tv show name (tvsh
).
Removes and returns the tv show name (tvsh
).
Sets the tv show name (tvsh
).
Removes the tv show name (tvsh
).
Removes and returns the isrc (----:com.apple.iTunes:ISRC
).
Removes the isrc (----:com.apple.iTunes:ISRC
).
Returns all album artists (aART
).
Returns the first album artist (aART
).
Removes and returns all album artists (aART
).
Removes all and returns the first album artist (aART
).
Sets all album artists (aART
). This will remove all other album artists.
Sets the album artist (aART
). This will remove all other album artists.
Adds all album artists (aART
).
Adds an album artist (aART
).
Removes all album artists (aART
).
Removes and returns all artists (©ART
).
Removes all and returns the first artist (©ART
).
Sets all artists (©ART
). This will remove all other artists.
Sets the artist (©ART
). This will remove all other artists.
Adds all artists (©ART
).
Adds an artist (©ART
).
Removes all artists (©ART
).
Returns all categories (catg
).
Removes and returns all categories (catg
).
Removes all and returns the first category (catg
).
Sets all categories (catg
). This will remove all other categories.
Sets the category (catg
). This will remove all other categories.
Adds all categories (catg
).
Adds an category (catg
).
Removes all categories (catg
).
Removes and returns all comments (©cmt
).
Removes all and returns the first comment (©cmt
).
Sets all comments (©cmt
). This will remove all other comments.
Sets the comment (©cmt
). This will remove all other comments.
Adds all comments (©cmt
).
Adds an comment (©cmt
).
Removes all comments (©cmt
).
Removes and returns all composers (©wrt
).
Removes all and returns the first composer (©wrt
).
Sets all composers (©wrt
). This will remove all other composers.
Sets the composer (©wrt
). This will remove all other composers.
Adds all composers (©wrt
).
Adds an composer (©wrt
).
Removes all composers (©wrt
).
Returns all custom genres (©gen
).
Returns the first custom genre (©gen
).
Removes and returns all custom genres (©gen
).
Removes all and returns the first custom genre (©gen
).
Sets all custom genres (©gen
). This will remove all other custom genres.
Sets the custom genre (©gen
). This will remove all other custom genres.
Adds all custom genres (©gen
).
Adds an custom genre (©gen
).
Removes all custom genres (©gen
).
Returns all descriptions (desc
).
Returns the first description (desc
).
Removes and returns all descriptions (desc
).
Removes all and returns the first description (desc
).
Sets all descriptions (desc
). This will remove all other descriptions.
Sets the description (desc
). This will remove all other descriptions.
Adds all descriptions (desc
).
Adds an description (desc
).
Removes all descriptions (desc
).
Removes and returns all groupings (©grp
).
Removes all and returns the first grouping (©grp
).
Sets all groupings (©grp
). This will remove all other groupings.
Sets the grouping (©grp
). This will remove all other groupings.
Adds all groupings (©grp
).
Adds an grouping (©grp
).
Removes all groupings (©grp
).
Removes and returns all keywords (keyw
).
Removes all and returns the first keyword (keyw
).
Sets all keywords (keyw
). This will remove all other keywords.
Sets the keyword (keyw
). This will remove all other keywords.
Adds all keywords (keyw
).
Adds an keyword (keyw
).
Removes all keywords (keyw
).
Returns all lyricists (----:com.apple.iTunes:LYRICIST
).
Returns the first lyricist (----:com.apple.iTunes:LYRICIST
).
Removes and returns all lyricists (----:com.apple.iTunes:LYRICIST
).
Removes all and returns the first lyricist (----:com.apple.iTunes:LYRICIST
).
Sets all lyricists (----:com.apple.iTunes:LYRICIST
). This will remove all other lyricists.
Sets the lyricist (----:com.apple.iTunes:LYRICIST
). This will remove all other lyricists.
Adds all lyricists (----:com.apple.iTunes:LYRICIST
).
Adds an lyricist (----:com.apple.iTunes:LYRICIST
).
Removes all lyricists (----:com.apple.iTunes:LYRICIST
).
Returns the compilation flag (cpil
).
Sets the compilation flag to true (cpil
).
Removes the compilation flag (cpil
).
Returns the gapless playback flag (pgap
).
Sets the gapless playback flag to true (pgap
).
Removes the gapless playback flag (pgap
).
Returns the show movement flag (shwm
).
Sets the show movement flag to true (shwm
).
Removes the show movement flag (shwm
).
Returns the movement count (©mvc
)
Sets the movement count (©mvc
)
Removes the movement count (©mvc
).
Returns the movement index (©mvi
)
Sets the movement index (©mvi
)
Removes the movement index (©mvi
).
Returns the tv episode (tves
)
Sets the tv episode (tves
)
Removes the tv episode (tves
).
Sets the tv season (tvsn
)
Removes the tv season (tvsn
).
Removes and returns all artwork images (covr
).
Removes all and returns the first artwork image (covr
).
Sets the artwork image data (covr
). This will remove all other artworks.
Sets all artwork image data (covr
). This will remove all other artworks.
Adds artwork image data (covr
).
Removes all artworks (covr
).
Returns the media type (stik
).
Sets the media type (stik
).
Removes the media type (stik
).
Returns the advisory rating (rtng
).
Sets the advisory rating (rtng
).
Removes the advisory rating (rtng
).
Returns references to all byte 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::BeSigned(b"data".to_vec())); assert_eq!(tag.bytes_of(&test).next().unwrap(), b"data");
Returns mutable references to all byte 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::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");
Removes the atom corresponding to the identifier and returns all of it’s byte data.
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_of(&test).next().unwrap(), b"data"); assert_eq!(tag.bytes_of(&test).next(), None);
Returns references to all strings 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.strings_of(&test).next().unwrap(), "data");
pub fn strings_mut_of<'a>(
&'a mut self,
ident: &'a impl Ident
) -> impl Iterator<Item = &mut String>
[src]
pub fn strings_mut_of<'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("string".into())); tag.strings_mut_of(&test).next().unwrap().push('1'); assert_eq!(tag.strings_of(&test).next().unwrap(), "string1");
pub fn take_strings_of<'a>(
&'a mut self,
ident: &'a impl Ident
) -> impl Iterator<Item = String>
[src]
pub fn take_strings_of<'a>(
&'a mut self,
ident: &'a impl Ident
) -> impl Iterator<Item = String>
[src]Removes the atom corresponding to the identifier and returns all of it’s strings.
Example
use mp4ameta::{Tag, Data, Fourcc}; let mut tag = Tag::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);
Returns references to all images 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"image".to_vec())); let img = tag.images_of(&test).next().unwrap(); assert_eq!(img.data, b"image");
pub fn images_mut_of<'a>(
&'a mut self,
ident: &'a impl Ident
) -> impl Iterator<Item = ImgMut<'a>>
[src]
pub fn images_mut_of<'a>(
&'a mut self,
ident: &'a impl Ident
) -> impl Iterator<Item = ImgMut<'a>>
[src]Returns mutable references to all images 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"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");
Removes the atom corresponding to the identifier and returns all of it’s images.
Example
use mp4ameta::{Tag, Data, Fourcc, Img}; let mut tag = Tag::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);
Returns references to all 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_eq!(tag.data_of(&test).next().unwrap().string(), Some("data"));
Returns mutable references to all 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())); let data = tag.data_mut_of(&test).next().unwrap(); data.string_mut().unwrap().push('1'); assert_eq!(tag.strings_of(&test).next().unwrap(), "data1");
Removes the atom corresponding to the identifier and returns all of it’s 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.take_data_of(&test).next().unwrap(), Data::Utf8("data".into())); assert_eq!(tag.data_of(&test).next(), None);
Returns an iterator over references to all byte data.
Example
use mp4ameta::{Tag, Data, DataIdent, Fourcc}; let mut tag = Tag::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);
Returns an iterator over mutable references to all byte data.
Example
use mp4ameta::{Tag, Data, DataIdent, Fourcc}; let mut tag = Tag::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);
Consumes self
and returns an iterator over all byte data.
Example
use std::rc::Rc; use mp4ameta::{Tag, Data, DataIdent, Fourcc}; let mut tag = Tag::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 test = DataIdent::Fourcc(test); let (ident, data) = tag.take_bytes().next().unwrap(); assert_eq!(ident.as_ref(), &test); assert_eq!(data, b"data".to_vec());
Returns an iterator over references to all strings.
Example
use mp4ameta::{Tag, Data, DataIdent, Fourcc}; let mut tag = Tag::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);
Returns an iterator over mutable references to all strings.
Example
use mp4ameta::{Tag, Data, DataIdent, Fourcc}; let mut tag = Tag::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);
Consumes self
and returns an iterator over all strings.
Example
use std::rc::Rc; use mp4ameta::{Tag, Data, DataIdent, Fourcc}; let mut tag = Tag::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 test = DataIdent::Fourcc(test); let (ident, data) = tag.take_strings().next().unwrap(); assert_eq!(ident.as_ref(), &test); assert_eq!(data, "string".to_string());
Returns an iterator over references to all images.
Example
use mp4ameta::{Tag, Data, DataIdent, Fourcc, Img}; let mut tag = Tag::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);
Returns an iterator over mutable references to all images.
Example
use mp4ameta::{Tag, Data, DataIdent, Fourcc, Img}; let mut tag = Tag::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);
Consumes self
and returns an iterator over all images.
Example
use std::rc::Rc; use mp4ameta::{Tag, Data, DataIdent, Fourcc, Img}; let mut tag = Tag::default(); let test = Fourcc(*b"test"); tag.add_data(test, Data::Jpeg(b"data".to_vec())); tag.add_data(test, Data::Utf8("string".into())); let test = DataIdent::Fourcc(test); let (ident, image) = tag.take_images().next().unwrap(); assert_eq!(ident.as_ref(), &test); assert_eq!(image, Img::jpeg(b"data".to_vec()));
Returns an iterator over references to all data.
Example
use mp4ameta::{Tag, Data, DataIdent, Fourcc}; let mut tag = Tag::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);
Returns an iterator over mutable references to all data.
Example
use mp4ameta::{Tag, Data, DataIdent, Fourcc}; let mut tag = Tag::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);
Consumes self
and returns an iterator over all data.
Example
use std::rc::Rc; use mp4ameta::{Tag, Data, DataIdent, Fourcc, Img}; let mut tag = Tag::default(); let test = Fourcc(*b"test"); tag.add_data(test, Data::Jpeg(b"data".to_vec())); let test = DataIdent::Fourcc(test); let (ident, image) = tag.take_data().next().unwrap(); assert_eq!(ident.as_ref(), &test); assert_eq!(image, Data::Jpeg(b"data".to_vec()));
Removes all byte data corresponding to the identifier. Other data will remain unaffected.
Example
use mp4ameta::{Tag, Data, Fourcc}; let mut tag = Tag::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);
Removes all strings corresponding to the identifier. Other data will remain unaffected.
Example
use mp4ameta::{Tag, Data, Fourcc}; let mut tag = Tag::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);
Removes all images corresponding to the identifier. Other data will remain unaffected.
Example
use mp4ameta::{Tag, Data, Fourcc}; let mut tag = Tag::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);
Removes all 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_of(&test).next().is_some()); tag.remove_data_of(&test); assert!(tag.data_of(&test).next().is_none());
Retains only the bytes, of the atom corresponding to the identifier, that match the predicate.
Example
use mp4ameta::{Tag, Data, Fourcc}; let mut tag = Tag::default(); let test = Fourcc(*b"test"); tag.add_data(test, Data::BeSigned(vec![4u8; 12])); tag.add_data(test, Data::Reserved(vec![6u8; 16])); let mut bytes = tag.bytes_of(&test); assert_eq!(bytes.next(), Some(&[4u8; 12][..])); assert_eq!(bytes.next(), Some(&[6u8; 16][..])); assert_eq!(bytes.next(), None); drop(bytes); tag.retain_bytes_of(&test, |b| b[2..4] == [4u8, 4u8]); let mut bytes = tag.bytes_of(&test); assert_eq!(bytes.next(), Some(&[4u8; 12][..])); assert_eq!(bytes.next(), None);
Retains only the strings, of the atom corresponding to the identifier, that match the predicate.
Example
use mp4ameta::{Tag, Data, Fourcc, Img, ImgFmt}; let mut tag = Tag::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);
Retains only the images, of the atom corresponding to the identifier, that match the predicate.
Example
use mp4ameta::{Tag, Data, Fourcc, Img, ImgFmt}; let mut tag = Tag::default(); let test = Fourcc(*b"test"); tag.add_data(test, Data::Png(vec![5u8; 4])); tag.add_data(test, Data::Jpeg(vec![6u8; 16])); let mut images = tag.images_of(&test); assert_eq!(images.next(), Some(Img::new(ImgFmt::Png, &[5u8; 4][..]))); assert_eq!(images.next(), Some(Img::new(ImgFmt::Jpeg, &[6u8; 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, &[6u8; 16][..]))); assert_eq!(images.next(), None);
Retains only the data, of the atom corresponding to the identifier, that matches the predicate.
Example
use mp4ameta::{Tag, Data, Fourcc}; let mut tag = Tag::default(); let test = Fourcc(*b"test"); tag.add_data(test, Data::Utf8("short".into())); tag.add_data(test, Data::Reserved(vec![6u8; 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![6u8; 16]))); assert_eq!(data.next(), None); drop(data); tag.retain_data_of(&test, |d| d.len() < 10); let mut data = tag.data_of(&test); assert_eq!(data.next(), Some(&Data::Utf8("short".into()))); assert_eq!(data.next(), None);
Retains only the byte data matching the predicate. Other data will remain unaffected.
Example
use mp4ameta::{Tag, Data, Fourcc}; let mut tag = Tag::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);
Retains only the strings matching the predicate. Other data will remain unaffected.
Example
use mp4ameta::{Tag, Data, Fourcc}; let mut tag = Tag::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);
Retains only the images matching the predicate. Other data will remain unaffected.
Example
use mp4ameta::{Tag, Data, Fourcc}; let mut tag = Tag::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);
Retains only the data matching the predicate.
Example
use mp4ameta::{Tag, Data, Fourcc}; let mut tag = Tag::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);
Removes all metadata atoms of the tag.
Example
use mp4ameta::{Tag, Data, Fourcc}; let mut tag = Tag::default(); let test = Fourcc(*b"test"); assert!(tag.is_empty()); tag.set_data(test, Data::Utf8("data".into())); assert!(!tag.is_empty()); tag.clear(); assert!(tag.is_empty());
If an atom corresponding to the identifier exists, it’s data will be replaced by the new data, otherwise a new atom containing the data will be created.
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.strings_of(&test).next().unwrap(), "data");
pub fn set_all_data(
&mut self,
ident: impl Ident + Into<DataIdent>,
data: impl IntoIterator<Item = Data>
)
[src]
pub fn set_all_data(
&mut self,
ident: impl Ident + Into<DataIdent>,
data: impl IntoIterator<Item = Data>
)
[src]If an atom corresponding to the identifier exists, it’s data will be replaced by the new data, otherwise a new atom containing the data will be created.
Example
use mp4ameta::{Tag, Data, Fourcc}; let mut tag = Tag::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);
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::{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.strings_of(&test); assert_eq!(strings.next(), Some("data1")); assert_eq!(strings.next(), Some("data2")); assert_eq!(strings.next(), None)
pub fn add_all_data(
&mut self,
ident: impl Ident + Into<DataIdent>,
data: impl IntoIterator<Item = Data>
)
[src]
pub fn add_all_data(
&mut self,
ident: impl Ident + Into<DataIdent>,
data: impl IntoIterator<Item = Data>
)
[src]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::{Tag, Data, Fourcc}; let mut tag = Tag::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)
Returns true if this tag contains any metadata atoms, false otherwise.
Example
use mp4ameta::{Tag, Data, Fourcc}; let mut tag = Tag::default(); let test = Fourcc(*b"test"); assert!(tag.is_empty()); tag.set_data(test, Data::Utf8("data".into())); assert!(!tag.is_empty()); tag.clear(); assert!(tag.is_empty());
use mp4ameta::{Tag, Data, Fourcc};
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Tag
impl UnwindSafe for Tag
Blanket Implementations
Mutably borrows from an owned value. Read more