TagLib API Documentation
Public Member Functions | Protected Member Functions | List of all members
TagLib::MP4::Tag Class Reference

An MP4 tag implementation. More...

#include <mp4tag.h>

Inheritance diagram for TagLib::MP4::Tag:
[legend]
Collaboration diagram for TagLib::MP4::Tag:
[legend]

Public Member Functions

 Tag ()
 
 Tag (TagLib::File *file, Atoms *atoms, const ItemFactory *factory=nullptr)
 
 ~Tag () override
 
 Tag (const Tag &)=delete
 
Tagoperator= (const Tag &)=delete
 
bool save ()
 
String title () const override
 
String artist () const override
 
String album () const override
 
String comment () const override
 
String genre () const override
 
unsigned int year () const override
 
unsigned int track () const override
 
void setTitle (const String &value) override
 
void setArtist (const String &value) override
 
void setAlbum (const String &value) override
 
void setComment (const String &value) override
 
void setGenre (const String &value) override
 
void setYear (unsigned int value) override
 
void setTrack (unsigned int value) override
 
bool isEmpty () const override
 
const ItemMapitemMap () const
 
Item item (const String &key) const
 
void setItem (const String &key, const Item &value)
 
void removeItem (const String &key)
 
bool contains (const String &key) const
 
bool strip ()
 
PropertyMap properties () const override
 
void removeUnsupportedProperties (const StringList &props) override
 
PropertyMap setProperties (const PropertyMap &props) override
 
StringList complexPropertyKeys () const override
 
List< VariantMapcomplexProperties (const String &key) const override
 
bool setComplexProperties (const String &key, const List< VariantMap > &value) override
 
- Public Member Functions inherited from TagLib::Tag
virtual ~Tag ()
 
 Tag (const Tag &)=delete
 
Tagoperator= (const Tag &)=delete
 
virtual PropertyMap properties () const
 
virtual void removeUnsupportedProperties (const StringList &properties)
 
virtual PropertyMap setProperties (const PropertyMap &origProps)
 
virtual StringList complexPropertyKeys () const
 
virtual List< VariantMapcomplexProperties (const String &key) const
 
virtual bool setComplexProperties (const String &key, const List< VariantMap > &value)
 
virtual String title () const =0
 
virtual String artist () const =0
 
virtual String album () const =0
 
virtual String comment () const =0
 
virtual String genre () const =0
 
virtual unsigned int year () const =0
 
virtual unsigned int track () const =0
 
virtual void setTitle (const String &s)=0
 
virtual void setArtist (const String &s)=0
 
virtual void setAlbum (const String &s)=0
 
virtual void setComment (const String &s)=0
 
virtual void setGenre (const String &s)=0
 
virtual void setYear (unsigned int i)=0
 
virtual void setTrack (unsigned int i)=0
 
virtual bool isEmpty () const
 

Protected Member Functions

void setTextItem (const String &key, const String &value)
 
- Protected Member Functions inherited from TagLib::Tag
 Tag ()
 

Additional Inherited Members

- Static Public Member Functions inherited from TagLib::Tag
static void duplicate (const Tag *source, Tag *target, bool overwrite=true)
 
static String joinTagValues (const StringList &values)
 

Detailed Description

An MP4 tag implementation.

Constructor & Destructor Documentation

◆ Tag() [1/3]

TagLib::MP4::Tag::Tag ( )

◆ Tag() [2/3]

TagLib::MP4::Tag::Tag ( TagLib::File file,
Atoms *  atoms,
const ItemFactory factory = nullptr 
)

◆ ~Tag()

TagLib::MP4::Tag::~Tag ( )
overridevirtual

Destroys this Tag instance.

Reimplemented from TagLib::Tag.

◆ Tag() [3/3]

TagLib::MP4::Tag::Tag ( const Tag )
delete

Member Function Documentation

◆ album()

String TagLib::MP4::Tag::album ( ) const
overridevirtual

Returns the album name; if no album name is present in the tag an empty string will be returned.

Implements TagLib::Tag.

◆ artist()

String TagLib::MP4::Tag::artist ( ) const
overridevirtual

Returns the artist name; if no artist name is present in the tag an empty string will be returned.

Implements TagLib::Tag.

◆ comment()

String TagLib::MP4::Tag::comment ( ) const
overridevirtual

Returns the track comment; if no comment is present in the tag an empty string will be returned.

Implements TagLib::Tag.

◆ complexProperties()

List< VariantMap > TagLib::MP4::Tag::complexProperties ( const String key) const
overridevirtual

Get the complex properties for a given key. In order to be flexible for different metadata formats, the properties are represented as variant maps. Despite this dynamic nature, some degree of standardization should be achieved between formats:

  • PICTURE
    • data: ByteVector with picture data
    • description: String with description
    • pictureType: String with type as specified for ID3v2, e.g. "Front Cover", "Back Cover", "Band"
    • mimeType: String with image format, e.g. "image/jpeg"
    • optionally more information found in the tag, such as "width", "height", "numColors", "colorDepth" int values in FLAC pictures
  • GENERALOBJECT
    • data: ByteVector with object data
    • description: String with description
    • fileName: String with file name
    • mimeType: String with MIME type
    • this is currently only implemented for ID3v2 GEOB frames

Reimplemented from TagLib::Tag.

◆ complexPropertyKeys()

StringList TagLib::MP4::Tag::complexPropertyKeys ( ) const
overridevirtual

Get the keys of complex properties, i.e. properties which cannot be represented simply by a string. Because such properties might be expensive to fetch, there are separate operations to get the available keys - which is expected to be cheap - and getting and setting the property values. The default implementation returns only an empty list. Reimplementations should provide "PICTURE" if embedded cover art is present, and optionally support other properties.

Reimplemented from TagLib::Tag.

◆ contains()

bool TagLib::MP4::Tag::contains ( const String key) const
Returns
true if the tag contains an entry for key.

◆ genre()

String TagLib::MP4::Tag::genre ( ) const
overridevirtual

Returns the genre name; if no genre is present in the tag an empty string will be returned.

Implements TagLib::Tag.

◆ isEmpty()

bool TagLib::MP4::Tag::isEmpty ( ) const
overridevirtual

Returns true if the tag does not contain any data. This should be reimplemented in subclasses that provide more than the basic tagging abilities in this class.

Reimplemented from TagLib::Tag.

◆ item()

Item TagLib::MP4::Tag::item ( const String key) const
Returns
The item, if any, corresponding to key.

◆ itemMap()

const ItemMap & TagLib::MP4::Tag::itemMap ( ) const

Returns a string-keyed map of the MP4::Items for this tag.

◆ operator=()

Tag & TagLib::MP4::Tag::operator= ( const Tag )
delete

◆ properties()

PropertyMap TagLib::MP4::Tag::properties ( ) const
overridevirtual

Exports the tags of the file as dictionary mapping (human readable) tag names (Strings) to StringLists of tag values. The default implementation in this class considers only the usual built-in tags (artist, album, ...) and only one value per key.

Reimplemented from TagLib::Tag.

◆ removeItem()

void TagLib::MP4::Tag::removeItem ( const String key)

Removes the entry with key from the tag, or does nothing if it does not exist.

◆ removeUnsupportedProperties()

void TagLib::MP4::Tag::removeUnsupportedProperties ( const StringList properties)
overridevirtual

Removes unsupported properties, or a subset of them, from the tag. The parameter properties must contain only entries from properties().unsupportedData().

Reimplemented from TagLib::Tag.

◆ save()

bool TagLib::MP4::Tag::save ( )

◆ setAlbum()

void TagLib::MP4::Tag::setAlbum ( const String s)
overridevirtual

Sets the album to s. If s is an empty string then this value will be cleared.

Implements TagLib::Tag.

◆ setArtist()

void TagLib::MP4::Tag::setArtist ( const String s)
overridevirtual

Sets the artist to s. If s is an empty string then this value will be cleared.

Implements TagLib::Tag.

◆ setComment()

void TagLib::MP4::Tag::setComment ( const String s)
overridevirtual

Sets the comment to s. If s is an empty string then this value will be cleared.

Implements TagLib::Tag.

◆ setComplexProperties()

bool TagLib::MP4::Tag::setComplexProperties ( const String key,
const List< VariantMap > &  value 
)
overridevirtual

Set all complex properties for a given key using variant maps as value with the same format as returned by complexProperties(). An empty list as value removes all complex properties for key.

Reimplemented from TagLib::Tag.

◆ setGenre()

void TagLib::MP4::Tag::setGenre ( const String s)
overridevirtual

Sets the genre to s. If s is an empty string then this value will be cleared. For tag formats that use a fixed set of genres, the appropriate value will be selected based on a string comparison. A list of available genres for those formats should be available in that type's implementation.

Implements TagLib::Tag.

◆ setItem()

void TagLib::MP4::Tag::setItem ( const String key,
const Item value 
)

Sets the value of key to value, overwriting any previous value.

◆ setProperties()

PropertyMap TagLib::MP4::Tag::setProperties ( const PropertyMap origProps)
overridevirtual

Sets the tags of this File to those specified in origProps. This default implementation sets only the tags for which setter methods exist in this class (artist, album, ...), and only one value per key; the rest will be contained in the returned PropertyMap.

Reimplemented from TagLib::Tag.

◆ setTextItem()

void TagLib::MP4::Tag::setTextItem ( const String key,
const String value 
)
protected

Sets the value of key to value, overwriting any previous value. If value is empty, the item is removed.

◆ setTitle()

void TagLib::MP4::Tag::setTitle ( const String s)
overridevirtual

Sets the title to s. If s is an empty string then this value will be cleared.

Implements TagLib::Tag.

◆ setTrack()

void TagLib::MP4::Tag::setTrack ( unsigned int  i)
overridevirtual

Sets the track to i. If s is 0 then this value will be cleared.

Implements TagLib::Tag.

◆ setYear()

void TagLib::MP4::Tag::setYear ( unsigned int  i)
overridevirtual

Sets the year to i. If s is 0 then this value will be cleared.

Implements TagLib::Tag.

◆ strip()

bool TagLib::MP4::Tag::strip ( )

Saves the associated file with the tag stripped.

◆ title()

String TagLib::MP4::Tag::title ( ) const
overridevirtual

Returns the track name; if no track name is present in the tag an empty string will be returned.

Implements TagLib::Tag.

◆ track()

unsigned int TagLib::MP4::Tag::track ( ) const
overridevirtual

Returns the track number; if there is no track number set, this will return 0.

Implements TagLib::Tag.

◆ year()

unsigned int TagLib::MP4::Tag::year ( ) const
overridevirtual

Returns the year; if there is no year set, this will return 0.

Implements TagLib::Tag.


The documentation for this class was generated from the following file: