TagLib
2.0.2
|
ID3v2 frame implementation. More...
#include <id3v2frame.h>
Classes | |
class | Header |
ID3v2 frame header implementation. More... | |
Public Member Functions | |
virtual | ~Frame () |
Frame (const Frame &)=delete | |
Frame & | operator= (const Frame &)=delete |
ByteVector | frameID () const |
unsigned int | size () const |
unsigned int | headerSize () const |
void | setData (const ByteVector &data) |
virtual void | setText (const String &text) |
virtual String | toString () const =0 |
virtual StringList | toStringList () const |
ByteVector | render () const |
Header * | header () const |
Static Public Member Functions | |
static ByteVector | textDelimiter (String::Type t) |
static ByteVector | keyToFrameID (const String &) |
static String | frameIDToKey (const ByteVector &) |
Static Public Attributes | |
static const String | instrumentPrefix |
static const String | commentPrefix |
static const String | lyricsPrefix |
static const String | urlPrefix |
Protected Member Functions | |
Frame (const ByteVector &data) | |
Frame (Header *h) | |
void | setHeader (Header *h, bool deleteCurrent=true) |
void | parse (const ByteVector &data) |
virtual void | parseFields (const ByteVector &data)=0 |
virtual ByteVector | renderFields () const =0 |
ByteVector | fieldData (const ByteVector &frameData) const |
String | readStringField (const ByteVector &data, String::Type encoding, int *position=nullptr) |
String::Type | checkTextEncoding (const StringList &fields, String::Type encoding) const |
virtual PropertyMap | asProperties () const |
Static Protected Member Functions | |
static void | splitProperties (const PropertyMap &original, PropertyMap &singleFrameProperties, PropertyMap &tiplProperties, PropertyMap &tmclProperties) |
Friends | |
class | Tag |
class | FramePrivate |
ID3v2 frame implementation.
This class is the main ID3v2 frame implementation. In ID3v2, a tag is split between a collection of frames (which are in turn split into fields (id3v2.4.0-structure.txt, 4) (id3v2.4.0-frames.txt). This class provides an API for gathering information about and modifying ID3v2 frames. Functionality specific to a given frame type is handled in one of the many subclasses.
|
virtual |
Destroys this Frame instance.
|
delete |
|
explicitprotected |
Constructs an ID3v2 frame using data to read the header information. All other processing of data should be handled in a subclass.
|
protected |
This creates a Frame using the header h.
The ownership of this header will be assigned to the frame and the header will be deleted when the frame is destroyed.
|
protectedvirtual |
Parses the contents of this frame as PropertyMap. If that fails, the returned PropertyMap will be empty, and its unsupportedData() will contain this frame's ID.
Reimplemented in TagLib::ID3v2::ChapterFrame, TagLib::ID3v2::CommentsFrame, TagLib::ID3v2::PodcastFrame, TagLib::ID3v2::TableOfContentsFrame, TagLib::ID3v2::TextIdentificationFrame, TagLib::ID3v2::UniqueFileIdentifierFrame, TagLib::ID3v2::UnsynchronizedLyricsFrame, TagLib::ID3v2::UrlLinkFrame, TagLib::ID3v2::UserTextIdentificationFrame, and TagLib::ID3v2::UserUrlLinkFrame.
|
protected |
Checks the list of string values to see if they can be used with the specified encoding and returns the recommended encoding. This method also checks the ID3v2 version and makes sure the encoding can be used in the version specified by the frame's header.
|
protected |
Returns a ByteVector containing the field data given the frame data. This correctly adjusts for the header size plus any additional frame data that's specified in the frame header flags.
ByteVector TagLib::ID3v2::Frame::frameID | ( | ) | const |
Returns the Frame ID (id3v2.4.0-structure.txt, 4) (id3v2.4.0-frames.txt, 4)
|
static |
Returns a free-form tag name for the given ID3 frame ID. Note that this does not work for general frame IDs such as TXXX or WXXX; in such a case an empty string is returned.
Header * TagLib::ID3v2::Frame::header | ( | ) | const |
Returns a pointer to the frame header.
unsigned int TagLib::ID3v2::Frame::headerSize | ( | ) | const |
Returns the size of the frame header
|
static |
Returns an appropriate ID3 frame ID for the given free-form tag key. This method will return an empty ByteVector if no specialized translation is found.
|
protected |
Called by setData() to parse the frame data. It makes this information available through the public API.
|
protectedpure virtual |
Called by parse() to parse the field data. It makes this information available through the public API. This must be overridden by the subclasses.
Implemented in TagLib::ID3v2::AttachedPictureFrame, TagLib::ID3v2::AttachedPictureFrameV22, TagLib::ID3v2::ChapterFrame, TagLib::ID3v2::CommentsFrame, TagLib::ID3v2::EventTimingCodesFrame, TagLib::ID3v2::GeneralEncapsulatedObjectFrame, TagLib::ID3v2::OwnershipFrame, TagLib::ID3v2::PodcastFrame, TagLib::ID3v2::PopularimeterFrame, TagLib::ID3v2::PrivateFrame, TagLib::ID3v2::RelativeVolumeFrame, TagLib::ID3v2::SynchronizedLyricsFrame, TagLib::ID3v2::TableOfContentsFrame, TagLib::ID3v2::TextIdentificationFrame, TagLib::ID3v2::UniqueFileIdentifierFrame, TagLib::ID3v2::UnknownFrame, TagLib::ID3v2::UnsynchronizedLyricsFrame, TagLib::ID3v2::UrlLinkFrame, and TagLib::ID3v2::UserUrlLinkFrame.
|
protected |
Reads a String of type encoding from the ByteVector data. If position is passed in it is used both as the starting point and is updated to return the position just after the string that has been read. This is useful for reading strings sequentially.
ByteVector TagLib::ID3v2::Frame::render | ( | ) | const |
Render the frame back to its binary format in a ByteVector.
|
protectedpure virtual |
Render the field data back to a binary format in a ByteVector. This must be overridden by subclasses.
Implemented in TagLib::ID3v2::AttachedPictureFrame, TagLib::ID3v2::ChapterFrame, TagLib::ID3v2::CommentsFrame, TagLib::ID3v2::EventTimingCodesFrame, TagLib::ID3v2::GeneralEncapsulatedObjectFrame, TagLib::ID3v2::OwnershipFrame, TagLib::ID3v2::PodcastFrame, TagLib::ID3v2::PopularimeterFrame, TagLib::ID3v2::PrivateFrame, TagLib::ID3v2::RelativeVolumeFrame, TagLib::ID3v2::SynchronizedLyricsFrame, TagLib::ID3v2::TableOfContentsFrame, TagLib::ID3v2::TextIdentificationFrame, TagLib::ID3v2::UniqueFileIdentifierFrame, TagLib::ID3v2::UnknownFrame, TagLib::ID3v2::UnsynchronizedLyricsFrame, TagLib::ID3v2::UrlLinkFrame, and TagLib::ID3v2::UserUrlLinkFrame.
void TagLib::ID3v2::Frame::setData | ( | const ByteVector & | data | ) |
Sets the data that will be used as the frame. Since the length is not known before the frame has been parsed, this should just be a pointer to the first byte of the frame. It will determine the length internally and make that available through size().
|
protected |
Sets the header to h. If deleteCurrent is true
, this will free the memory of the current header.
The ownership of this header will be assigned to the frame and the header will be deleted when the frame is destroyed.
|
virtual |
Set the text of frame in the sanest way possible. This should only be reimplemented in frames where there is some logical mapping to text.
Reimplemented in TagLib::ID3v2::CommentsFrame, TagLib::ID3v2::TextIdentificationFrame, TagLib::ID3v2::UnsynchronizedLyricsFrame, TagLib::ID3v2::UrlLinkFrame, and TagLib::ID3v2::UserTextIdentificationFrame.
unsigned int TagLib::ID3v2::Frame::size | ( | ) | const |
Returns the size of the frame.
|
staticprotected |
This helper function splits the PropertyMap original into three ProperytMaps singleFrameProperties, tiplProperties, and tmclProperties, such that:
|
static |
Returns the text delimiter that is used between fields for the string type t.
|
pure virtual |
This returns the textual representation of the data in the frame. Subclasses must reimplement this method to provide a string representation of the frame's data.
Implemented in TagLib::ID3v2::AttachedPictureFrame, TagLib::ID3v2::ChapterFrame, TagLib::ID3v2::CommentsFrame, TagLib::ID3v2::EventTimingCodesFrame, TagLib::ID3v2::GeneralEncapsulatedObjectFrame, TagLib::ID3v2::OwnershipFrame, TagLib::ID3v2::PodcastFrame, TagLib::ID3v2::PopularimeterFrame, TagLib::ID3v2::PrivateFrame, TagLib::ID3v2::RelativeVolumeFrame, TagLib::ID3v2::SynchronizedLyricsFrame, TagLib::ID3v2::TableOfContentsFrame, TagLib::ID3v2::TextIdentificationFrame, TagLib::ID3v2::UniqueFileIdentifierFrame, TagLib::ID3v2::UnknownFrame, TagLib::ID3v2::UnsynchronizedLyricsFrame, TagLib::ID3v2::UrlLinkFrame, TagLib::ID3v2::UserTextIdentificationFrame, and TagLib::ID3v2::UserUrlLinkFrame.
|
virtual |
This returns the textual representation of the data in the frame. Subclasses can reimplement this method to provide a string list representation of the frame's data. The default implementation returns the single string representation from toString().
Reimplemented in TagLib::ID3v2::AttachedPictureFrame, TagLib::ID3v2::GeneralEncapsulatedObjectFrame, TagLib::ID3v2::OwnershipFrame, TagLib::ID3v2::PopularimeterFrame, and TagLib::ID3v2::TextIdentificationFrame.
|
friend |
|
friend |
|
static |
The PropertyMap key prefix which triggers the use of a COMM frame instead of a TXXX frame for a non-standard key. In the current implementation, this is "COMMENT:".
|
static |
The string with which an instrument name is prefixed to build a key in a PropertyMap; used to translate PropertyMaps to TMCL frames. In the current implementation, this is "PERFORMER:".
|
static |
The PropertyMap key prefix which triggers the use of a USLT frame instead of a TXXX frame for a non-standard key. In the current implementation, this is "LYRICS:".
|
static |
The PropertyMap key prefix which triggers the use of a WXXX frame instead of a TXX frame for a non-standard key. In the current implementation, this is "URL:".