Tag Parser
6.5.1
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
|
Implementation of Media::Tag for the MP4 container. More...
#include <mp4tag.h>
Public Member Functions | |
Mp4Tag () | |
Constructs a new tag. More... | |
TagType | type () const |
Returns the type of the tag as Media::TagType. More... | |
const char * | typeName () const |
Returns the type name of the tag as C-style string. More... | |
TagTextEncoding | proposedTextEncoding () const |
Returns the proposed text encoding. More... | |
bool | canEncodingBeUsed (TagTextEncoding encoding) const |
Returns an indication whether the specified encoding can be used to provide string values for the tag. More... | |
uint32 | fieldId (KnownField field) const |
Returns the ID for the specified field. More... | |
KnownField | knownField (const uint32 &id) const |
bool | supportsField (KnownField field) const |
Returns an indication whether the specified field is supported by the tag. More... | |
const TagValue & | value (KnownField value) const |
Returns the value of the specified field. More... | |
std::vector< const TagValue * > | values (KnownField field) const |
Returns the values of the specified field. More... | |
const TagValue & | value (const std::string &mean, const std::string &name) const |
Returns the value of the field with the specified mean and name attributes. More... | |
const TagValue & | value (const char *mean, const char *name) const |
Returns the value of the field with the specified mean and name attributes. More... | |
bool | setValue (KnownField field, const TagValue &value) |
Assigns the given value to the specified field. More... | |
bool | setValues (KnownField field, const std::vector< TagValue > &values) |
Assigns the given values to the specified field. More... | |
bool | setValue (const std::string &mean, const std::string &name, const TagValue &value) |
Assigns the given value to the field with the specified mean and name attributes. More... | |
bool | setValue (const char *mean, const char *name, const TagValue &value) |
Assigns the given value to the field with the specified mean and name attributes. More... | |
bool | hasField (KnownField value) const |
Returns an indication whether the specified field is present. More... | |
void | parse (Mp4Atom &metaAtom) |
Parses tag information from the specified metaAtom. More... | |
Mp4TagMaker | prepareMaking () |
Prepares making. More... | |
void | make (std::ostream &stream) |
Writes tag information to the specified stream. More... | |
![]() | |
FieldMapBasedTag () | |
Constructs a new FieldMapBasedTag. More... | |
virtual const TagValue & | value (const typename Mp4TagField ::identifierType &id) const |
Returns the value of the field with the specified id. More... | |
const TagValue & | value (KnownField field) const |
Returns the value of the specified field. More... | |
std::vector< const TagValue *> | values (const typename Mp4TagField ::identifierType &id) const |
Returns the values of the field with the specified id. More... | |
std::vector< const TagValue *> | values (KnownField field) const |
Returns the values of the specified field. More... | |
virtual bool | setValue (const typename Mp4TagField ::identifierType &id, const TagValue &value) |
Assigns the given value to the field with the specified id. More... | |
bool | setValue (KnownField field, const TagValue &value) |
Assigns the given value to the specified field. More... | |
bool | setValues (const typename Mp4TagField ::identifierType &id, const std::vector< TagValue > &values) |
Assigns the given values to the field with the specified id. More... | |
bool | setValues (KnownField field, const std::vector< TagValue > &values) |
Assigns the given values to the field with the specified id. More... | |
bool | hasField (KnownField field) const |
Returns an indication whether the specified field is present. More... | |
virtual bool | hasField (const typename Mp4TagField ::identifierType &id) const |
Returns an indication whether the field with the specified id is present. More... | |
void | removeAllFields () |
Removes all fields from the tag. More... | |
const std::multimap< typename Mp4TagField ::identifierType, Mp4TagField, std::less< typename Mp4TagField ::identifierType > > & | fields () const |
Returns the fields of the tag by providing direct access to the field map of the tag. More... | |
std::multimap< typename Mp4TagField ::identifierType, Mp4TagField, std::less< typename Mp4TagField ::identifierType > > & | fields () |
Returns the fields of the tag by providing direct access to the field map of the tag. More... | |
unsigned int | fieldCount () const |
Returns the number of present fields. More... | |
virtual KnownField | knownField (const typename Mp4TagField ::identifierType &id) const=0 |
Returns the field for the specified ID. More... | |
bool | supportsField (KnownField field) const |
Returns an indication whether the specified field is supported by the tag. More... | |
virtual TagDataType | proposedDataType (const typename Mp4TagField ::identifierType &id) const |
Returns the proposed data type for the field with the specified id. More... | |
virtual TagDataType | proposedDataType (KnownField field) const |
Returns the proposed data type for the specified field as TagDataType. More... | |
int | insertFields (const FieldMapBasedTag< Mp4TagField, std::less< typename Mp4TagField ::identifierType > > &from, bool overwrite) |
Inserts all fields from another tag of the same field type and compare function. More... | |
unsigned int | insertValues (const Tag &from, bool overwrite) |
Inserts all compatible values from another Tag. More... | |
void | ensureTextValuesAreProperlyEncoded () |
Ensures the encoding of all assigned text values is supported by the tag by converting the character set if neccessary. More... | |
![]() | |
virtual | ~Tag () |
Destroys the Tag. More... | |
std::string | toString () const |
Returns a string representation of the tag. More... | |
const std::string & | version () const |
Returns the version of the tag as std::string. More... | |
uint32 | size () const |
Returns the size of the tag in bytes. More... | |
virtual bool | supportsTarget () const |
Returns an indication whether a target is supported by the tag. More... | |
const TagTarget & | target () const |
Returns the target of tag. More... | |
void | setTarget (const TagTarget &target) |
Sets the target of tag. More... | |
virtual TagTargetLevel | targetLevel () const |
Returns the name of the current tag target level. More... | |
const char * | targetLevelName () const |
Returns the name of the current target level. More... | |
bool | isTargetingLevel (TagTargetLevel tagTargetLevel) const |
Returns whether the tag is targeting the specified tagTargetLevel. More... | |
std::string | targetString () const |
Returns the string representation for the assigned tag target. More... | |
virtual TagDataType | proposedDataType (KnownField field) const |
Returns the proposed data type for the specified field as TagDataType. More... | |
virtual bool | supportsDescription (KnownField field) const |
Returns an indications whether the specified field supports descriptions. More... | |
virtual bool | supportsMimeType (KnownField field) const |
Returns an indications whether the specified field supports mime types. More... | |
![]() | |
const NotificationList & | notifications () const |
Returns notifications for the current object. More... | |
bool | hasNotifications () const |
Returns an indication whether there are notifications for the current object. More... | |
bool | hasCriticalNotifications () const |
Returns an indication whether there are critical notifications for the current object. More... | |
NotificationType | worstNotificationType () const |
Returns the worst notification type. More... | |
const std::string & | currentStatus () const |
Returns a status information for the current object. More... | |
double | currentPercentage () const |
Returns the progress percentage of the current object. More... | |
size_t | registerCallback (CallbackFunction callback) |
Registers a callback function. More... | |
void | unregisterCallback (size_t id) |
Unregisters a previously registered callback function whith the specified id. More... | |
void | unregisterAllCallbacks () |
Unregisters all callback functions. More... | |
void | forwardStatusUpdateCalls (StatusProvider *other=nullptr) |
Forwards all status updates calls to the specified statusProvider. More... | |
StatusProvider * | usedProvider () |
Returns the provider which callback functions will be called when the status or the percentage is updated. More... | |
void | tryToAbort () |
Commands the object to abort the current operation. More... | |
bool | isAborted () const |
Returns an indication whether the current operation should be aborted. More... | |
void | invalidateStatus () |
Invalidates the current status. More... | |
void | invalidateNotifications () |
Invalidates the object's notifications. More... | |
void | updateStatus (const std::string &status) |
This method is meant to be called by the derived class to report updated status information. More... | |
void | updateStatus (const std::string &status, double percentage) |
This method is meant to be called by the derived class to report updated status information. More... | |
void | updatePercentage (double percentage) |
This method is meant to be called by the derived class to report updated progress percentage only. More... | |
void | addNotification (const Notification ¬ification) |
This method is meant to be called by the derived class to add a notification. More... | |
void | addNotification (NotificationType type, const std::string &message, const std::string &context) |
This method is meant to be called by the derived class to add a notification of the specified type, message and context. More... | |
void | addNotifications (const StatusProvider &from) |
This method is meant to be called by the derived class to add all notifications from another StatusProvider instance. More... | |
void | addNotifications (const std::string &higherContext, const StatusProvider &from) |
This method is meant to be called by the derived class to add all notifications from another StatusProvider instance. More... | |
void | addNotifications (const NotificationList ¬ifications) |
This method is meant to be called by the derived class to add the specified notifications. More... | |
Static Public Attributes | |
static constexpr TagType | tagType = TagType::Mp4Tag |
Additional Inherited Members | |
![]() | |
typedef Mp4TagField | fieldType |
![]() | |
typedef std::function< void(StatusProvider &sender)> | CallbackFunction |
typedef std::vector< CallbackFunction > | CallbackVector |
typedef std::pair< int, CallbackFunction > | CallbackPair |
![]() | |
Tag () | |
Constructs a new Tag. More... | |
![]() | |
StatusProvider () | |
Constructs a new StatusProvider. More... | |
![]() | |
std::string | m_version |
uint32 | m_size |
TagTarget | m_target |
Implementation of Media::Tag for the MP4 container.
|
virtual |
Returns an indication whether the specified encoding can be used to provide string values for the tag.
Only the proposedTextEncoding() is accepted by default. This might be overwritten when subclassing.
The tag class and its subclasses do not perform any conversions. You have to provide all string values using an encoding which is appropriate for the specific tag type. This method is meant to determine if a particular encoding can be used.
Reimplemented from Media::Tag.
Definition at line 46 of file mp4tag.cpp.
|
virtual |
Returns the ID for the specified field.
Needs to be implemented when subclassing.
Implements Media::FieldMapBasedTag< Mp4TagField >.
Definition at line 122 of file mp4tag.cpp.
|
virtual |
Returns an indication whether the specified field is present.
Implements Media::Tag.
Definition at line 259 of file mp4tag.cpp.
KnownField Media::Mp4Tag::knownField | ( | const uint32 & | id | ) | const |
Definition at line 149 of file mp4tag.cpp.
void Media::Mp4Tag::make | ( | std::ostream & | stream | ) |
Writes tag information to the specified stream.
Throws | std::ios_base::failure when an IO error occurs. |
Throws | Media::Failure or a derived exception when a making error occurs. |
Definition at line 357 of file mp4tag.cpp.
void Media::Mp4Tag::parse | ( | Mp4Atom & | metaAtom | ) |
Parses tag information from the specified metaAtom.
Throws | std::ios_base::failure when an IO error occurs. |
Throws | Media::Failure or a derived exception when a parsing error occurs. |
Definition at line 277 of file mp4tag.cpp.
Mp4TagMaker Media::Mp4Tag::prepareMaking | ( | ) |
Prepares making.
Throws | Media::Failure or a derived exception when a making error occurs. |
This method might be useful when it is necessary to know the size of the tag before making it.
Definition at line 345 of file mp4tag.cpp.
|
inlinevirtual |
Returns the proposed text encoding.
This is TagTextEncoding::Latin1 by default an might be overwritten when subclassing.
The tag class and its subclasses do not perform any conversions. You have to provide all string values using an encoding which is appropriate for the specific tag type. This method returns such an encoding.
Reimplemented from Media::Tag.
|
virtual |
Assigns the given value to the specified field.
Implements Media::Tag.
Definition at line 176 of file mp4tag.cpp.
|
inline |
bool Media::Mp4Tag::setValue | ( | const char * | mean, |
const char * | name, | ||
const TagValue & | value | ||
) |
Assigns the given value to the field with the specified mean and name attributes.
Definition at line 238 of file mp4tag.cpp.
|
virtual |
Assigns the given values to the specified field.
Reimplemented from Media::Tag.
Definition at line 200 of file mp4tag.cpp.
|
inlinevirtual |
Returns an indication whether the specified field is supported by the tag.
Implements Media::Tag.
|
inlinevirtual |
Returns the type of the tag as Media::TagType.
This is TagType::Unspecified by default and might be overwritten when subclassing.
Reimplemented from Media::Tag.
|
inlinevirtual |
Returns the type name of the tag as C-style string.
This is "unspecified" by default and might be overwritten when subclassing.
Reimplemented from Media::Tag.
|
virtual |
Returns the value of the specified field.
Implements Media::Tag.
Definition at line 58 of file mp4tag.cpp.
|
inline |
const TagValue & Media::Mp4Tag::value | ( | const char * | mean, |
const char * | name | ||
) | const |
Returns the value of the field with the specified mean and name attributes.
Definition at line 103 of file mp4tag.cpp.
|
virtual |
Returns the values of the specified field.
Reimplemented from Media::Tag.
Definition at line 83 of file mp4tag.cpp.
|
static |