![]() |
Miam-Player
0.8.0
A nice music player
|
Ogg Vorbis comment implementation. More...
#include <xiphcomment.h>
Public Member Functions | |
XiphComment () | |
Constructs an empty Vorbis comment. More... | |
XiphComment (const ByteVector &data) | |
Constructs a Vorbis comment from data. More... | |
virtual | ~XiphComment () |
Destroys this instance of the XiphComment. More... | |
virtual String | title () const |
Returns the track name; if no track name is present in the tag String::null will be returned. More... | |
virtual String | artist () const |
Returns the artist name; if no artist name is present in the tag String::null will be returned. More... | |
virtual String | album () const |
Returns the album name; if no album name is present in the tag String::null will be returned. More... | |
virtual String | comment () const |
Returns the track comment; if no comment is present in the tag String::null will be returned. More... | |
virtual String | genre () const |
Returns the genre name; if no genre is present in the tag String::null will be returned. More... | |
virtual unsigned int | year () const |
Returns the year; if there is no year set, this will return 0. More... | |
virtual unsigned int | track () const |
Returns the track number; if there is no track number set, this will return 0. More... | |
virtual void | setTitle (const String &s) |
Sets the title to s. More... | |
virtual void | setArtist (const String &s) |
Sets the artist to s. More... | |
virtual void | setAlbum (const String &s) |
Sets the album to s. More... | |
virtual void | setComment (const String &s) |
Sets the comment to s. More... | |
virtual void | setGenre (const String &s) |
Sets the genre to s. More... | |
virtual void | setYear (unsigned int i) |
Sets the year to i. More... | |
virtual void | setTrack (unsigned int i) |
Sets the track to i. More... | |
virtual bool | isEmpty () const |
Returns true if the tag does not contain any data. More... | |
unsigned int | fieldCount () const |
Returns the number of fields present in the comment. More... | |
const FieldListMap & | fieldListMap () const |
Returns a reference to the map of field lists. More... | |
PropertyMap | properties () const |
Implements the unified property interface – export function. More... | |
PropertyMap | setProperties (const PropertyMap &) |
Implements the unified property interface – import function. More... | |
String | vendorID () const |
Returns the vendor ID of the Ogg Vorbis encoder. More... | |
void | addField (const String &key, const String &value, bool replace=true) |
Add the field specified by key with the data value. More... | |
void | removeField (const String &key, const String &value=String::null) |
Remove the field specified by key with the data value. More... | |
void | removeFields (const String &key) |
Remove all the fields specified by key. More... | |
void | removeFields (const String &key, const String &value) |
Remove all the fields specified by key with the data value. More... | |
void | removeAllFields () |
Remove all the fields in the comment. More... | |
bool | contains (const String &key) const |
Returns true if the field is contained within the comment. More... | |
ByteVector | render () const |
Renders the comment to a ByteVector suitable for inserting into a file. More... | |
ByteVector | render (bool addFramingBit) const |
Renders the comment to a ByteVector suitable for inserting into a file. More... | |
List< FLAC::Picture * > | pictureList () |
Returns a list of pictures attached to the xiph comment. More... | |
void | removePicture (FLAC::Picture *picture, bool del=true) |
Removes an picture. More... | |
void | removeAllPictures () |
Remove all pictures. More... | |
void | addPicture (FLAC::Picture *picture) |
Add a new picture to the comment block. More... | |
![]() | |
virtual | ~Tag () |
Destroys this Tag instance. More... | |
PropertyMap | properties () const |
Exports the tags of the file as dictionary mapping (human readable) tag names (Strings) to StringLists of tag values. More... | |
void | removeUnsupportedProperties (const StringList &properties) |
Removes unsupported properties, or a subset of them, from the tag. More... | |
PropertyMap | setProperties (const PropertyMap &properties) |
Sets the tags of this File to those specified in properties. More... | |
Static Public Member Functions | |
static bool | checkKey (const String &) |
Check if the given String is a valid Xiph comment key. More... | |
![]() | |
static void | duplicate (const Tag *source, Tag *target, bool overwrite=true) |
Copies the generic data from one tag to another. More... | |
Protected Member Functions | |
void | parse (const ByteVector &data) |
Reads the tag from the file specified in the constructor and fills the FieldListMap. More... | |
![]() | |
Tag () | |
Construct a Tag. More... | |
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.
|
virtual |
Destroys this instance of the XiphComment.
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.
|
virtual |
Returns the album name; if no album name is present in the tag String::null will be returned.
Implements TagLib::Tag.
|
virtual |
Returns the artist name; if no artist name is present in the tag String::null will be returned.
Implements TagLib::Tag.
|
static |
Check if the given String is a valid Xiph comment key.
|
virtual |
Returns the track comment; if no comment is present in the tag String::null will be returned.
Implements 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.
|
virtual |
Returns the genre name; if no genre is present in the tag String::null will be returned.
Implements TagLib::Tag.
|
virtual |
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.
|
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.
PropertyMap TagLib::Ogg::XiphComment::properties | ( | ) | const |
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).
void TagLib::Ogg::XiphComment::removeAllFields | ( | ) |
Remove all the fields in the comment.
void TagLib::Ogg::XiphComment::removeAllPictures | ( | ) |
Remove all pictures.
void TagLib::Ogg::XiphComment::removeField | ( | const String & | key, |
const String & | value = String::null |
||
) |
Remove the field specified by key with the data value.
If value is null, all of the fields with the given key will be removed.
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 an 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 | ( | ) | const |
Renders the comment to a ByteVector suitable for inserting into a file.
ByteVector TagLib::Ogg::XiphComment::render | ( | bool | addFramingBit | ) | 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.
|
virtual |
|
virtual |
|
virtual |
Sets the comment to s.
If s is String::null then this value will be cleared.
Implements TagLib::Tag.
|
virtual |
Sets the genre to s.
If s is String::null 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.
PropertyMap TagLib::Ogg::XiphComment::setProperties | ( | const PropertyMap & | ) |
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.
|
virtual |
|
virtual |
|
virtual |
|
virtual |
Returns the track name; if no track name is present in the tag String::null will be returned.
Implements TagLib::Tag.
|
virtual |
Returns the track number; if there is no track number set, this will return 0.
Implements TagLib::Tag.
String TagLib::Ogg::XiphComment::vendorID | ( | ) | const |
|
virtual |
Returns the year; if there is no year set, this will return 0.
Implements TagLib::Tag.