Ogg Vorbis comment implementation. More...
#include <xiphcomment.h>
Public Member Functions | |
XiphComment () | |
XiphComment (const ByteVector &data) | |
~XiphComment () override | |
XiphComment (const XiphComment &)=delete | |
XiphComment & | operator= (const XiphComment &)=delete |
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 &s) override |
void | setArtist (const String &s) override |
void | setAlbum (const String &s) override |
void | setComment (const String &s) override |
void | setGenre (const String &s) override |
void | setYear (unsigned int i) override |
void | setTrack (unsigned int i) override |
bool | isEmpty () const override |
unsigned int | fieldCount () const |
const FieldListMap & | fieldListMap () const |
PropertyMap | properties () const override |
PropertyMap | setProperties (const PropertyMap &) override |
StringList | complexPropertyKeys () const override |
List< VariantMap > | complexProperties (const String &key) const override |
bool | setComplexProperties (const String &key, const List< VariantMap > &value) override |
String | vendorID () const |
void | addField (const String &key, const String &value, bool replace=true) |
void | removeFields (const String &key) |
void | removeFields (const String &key, const String &value) |
void | removeAllFields () |
bool | contains (const String &key) const |
ByteVector | render (bool addFramingBit=true) const |
List< FLAC::Picture * > | pictureList () |
void | removePicture (FLAC::Picture *picture, bool del=true) |
void | removeAllPictures () |
void | addPicture (FLAC::Picture *picture) |
Public Member Functions inherited from TagLib::Tag | |
virtual | ~Tag () |
Tag (const Tag &)=delete | |
Tag & | operator= (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< VariantMap > | complexProperties (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 |
Static Public Member Functions | |
static bool | checkKey (const String &) |
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) |
Protected Member Functions | |
void | parse (const ByteVector &data) |
Protected Member Functions inherited from TagLib::Tag | |
Tag () | |
Ogg Vorbis comment implementation.
This class is an implementation of the Ogg Vorbis comment specification, to be found in section 5 of the Ogg Vorbis specification. Because this format is also used in other (currently unsupported) Xiph.org formats, it has been made part of a generic implementation rather than being limited to strictly Vorbis.
Vorbis comments are a simple vector of keys and values, called fields. Multiple values for a given key are supported.
TagLib::Ogg::XiphComment::XiphComment | ( | ) |
Constructs an empty Vorbis comment.
TagLib::Ogg::XiphComment::XiphComment | ( | const ByteVector & | data | ) |
Constructs a Vorbis comment from data.
|
override |
Destroys this instance of the XiphComment.
|
delete |
void TagLib::Ogg::XiphComment::addField | ( | const String & | key, |
const String & | value, | ||
bool | replace = true |
||
) |
Add the field specified by key with the data value. If replace is true
, then all of the other fields with the same key will be removed first.
If the field value is empty, the field will be removed.
void TagLib::Ogg::XiphComment::addPicture | ( | FLAC::Picture * | picture | ) |
Add a new picture to the comment block. The comment block takes ownership of the picture and will handle freeing its memory.
|
overridevirtual |
Returns the album name; if no album name is present in the tag an empty string will be returned.
Implements TagLib::Tag.
|
overridevirtual |
Returns the artist name; if no artist name is present in the tag an empty string will be returned.
Implements TagLib::Tag.
|
static |
Check if the given String is a valid Xiph comment key.
|
overridevirtual |
Returns the track comment; if no comment is present in the tag an empty string will be returned.
Implements TagLib::Tag.
|
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:
Reimplemented from TagLib::Tag.
|
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.
bool TagLib::Ogg::XiphComment::contains | ( | const String & | key | ) | const |
Returns true
if the field is contained within the comment.
unsigned int TagLib::Ogg::XiphComment::fieldCount | ( | ) | const |
Returns the number of fields present in the comment.
const FieldListMap & TagLib::Ogg::XiphComment::fieldListMap | ( | ) | const |
Returns a reference to the map of field lists. Because Xiph comments support multiple fields with the same key, a pure Map would not work. As such this is a Map of string lists, keyed on the comment field name.
The standard set of Xiph/Vorbis fields (which may or may not be contained in any specific comment) is:
For a more detailed description of these fields, please see the Ogg Vorbis specification, section 5.2.2.1.
|
overridevirtual |
Returns the genre name; if no genre is present in the tag an empty string will be returned.
Implements TagLib::Tag.
|
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.
|
delete |
|
protected |
Reads the tag from the file specified in the constructor and fills the FieldListMap.
List< FLAC::Picture * > TagLib::Ogg::XiphComment::pictureList | ( | ) |
Returns a list of pictures attached to the xiph comment.
|
overridevirtual |
Implements the unified property interface – export function. The result is a one-to-one match of the Xiph comment, since it is completely compatible with the property interface (in fact, a Xiph comment is nothing more than a map from tag names to list of values, as is the dict interface).
Reimplemented from TagLib::Tag.
void TagLib::Ogg::XiphComment::removeAllFields | ( | ) |
Remove all the fields in the comment.
void TagLib::Ogg::XiphComment::removeAllPictures | ( | ) |
Remove all pictures.
void TagLib::Ogg::XiphComment::removeFields | ( | const String & | key | ) |
Remove all the fields specified by key.
Remove all the fields specified by key with the data value.
void TagLib::Ogg::XiphComment::removePicture | ( | FLAC::Picture * | picture, |
bool | del = true |
||
) |
Removes a picture. If del is true
the picture's memory will be freed; if it is false
, it must be deleted by the user.
ByteVector TagLib::Ogg::XiphComment::render | ( | bool | addFramingBit = true | ) | const |
Renders the comment to a ByteVector suitable for inserting into a file.
If addFramingBit is true
the standard Vorbis comment framing bit will be appended. However some formats (notably FLAC) do not work with this in place.
|
overridevirtual |
Sets the album to s. If s is an empty string then this value will be cleared.
Implements TagLib::Tag.
|
overridevirtual |
Sets the artist to s. If s is an empty string then this value will be cleared.
Implements TagLib::Tag.
|
overridevirtual |
Sets the comment to s. If s is an empty string then this value will be cleared.
Implements TagLib::Tag.
|
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.
|
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.
|
overridevirtual |
Implements the unified property interface – import function. The tags from the given map will be stored one-to-one in the file, except for invalid keys (less than one character, non-ASCII, or containing '=' or '~') in which case the according values will be contained in the returned PropertyMap.
Reimplemented from TagLib::Tag.
|
overridevirtual |
Sets the title to s. If s is an empty string then this value will be cleared.
Implements TagLib::Tag.
|
overridevirtual |
Sets the track to i. If s is 0 then this value will be cleared.
Implements TagLib::Tag.
|
overridevirtual |
Sets the year to i. If s is 0 then this value will be cleared.
Implements TagLib::Tag.
|
overridevirtual |
Returns the track name; if no track name is present in the tag an empty string will be returned.
Implements TagLib::Tag.
|
overridevirtual |
Returns the track number; if there is no track number set, this will return 0.
Implements TagLib::Tag.
String TagLib::Ogg::XiphComment::vendorID | ( | ) | const |
|
overridevirtual |
Returns the year; if there is no year set, this will return 0.
Implements TagLib::Tag.