Tag Parser
9.3.0
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
|
The MediaFileInfo class allows to read and write tag information providing a container/tag format independent interface. More...
#include <mediafileinfo.h>
Public Member Functions | |
MediaFileInfo () | |
Constructs a new MediaFileInfo. More... | |
MediaFileInfo (const std::string &path) | |
Constructs a new MediaFileInfo for the specified file. More... | |
MediaFileInfo (const MediaFileInfo &)=delete | |
MediaFileInfo & | operator= (const MediaFileInfo &)=delete |
~MediaFileInfo () override | |
Destroys the MediaFileInfo. More... | |
void | parseContainerFormat (Diagnostics &diag) |
Parses the container format of the current file. More... | |
void | parseTracks (Diagnostics &diag) |
Parses the tracks of the current file. More... | |
void | parseTags (Diagnostics &diag) |
Parses the tag(s) of the current file. More... | |
void | parseChapters (Diagnostics &diag) |
Parses the chapters of the current file. More... | |
void | parseAttachments (Diagnostics &diag) |
Parses the attachments of the current file. More... | |
void | parseEverything (Diagnostics &diag) |
Parses the container format, the tracks and the tag information of the current file. More... | |
void | applyChanges (Diagnostics &diag, AbortableProgressFeedback &progress) |
Applies assigned/changed tag information to the current file. More... | |
ContainerFormat | containerFormat () const |
Returns the container format of the current file. More... | |
const char * | containerFormatName () const |
Returns the name of the container format as C-style string. More... | |
const char * | containerFormatAbbreviation () const |
Returns the abbreviation of the container format as C-style string. More... | |
const char * | containerFormatSubversion () const |
Returns the subversion of the container format as C-style string. More... | |
const char * | mimeType () const |
Returns the MIME-type of the container format as C-style string. More... | |
std::uint64_t | containerOffset () const |
Returns the actual container start offset. More... | |
std::uint64_t | paddingSize () const |
Returns the padding size. More... | |
AbstractContainer * | container () const |
Returns the container for the current file. More... | |
ParsingStatus | containerParsingStatus () const |
Returns an indication whether the container format has been parsed yet. More... | |
ParsingStatus | chaptersParsingStatus () const |
Returns whether the chapters have been parsed yet. More... | |
std::vector< AbstractChapter * > | chapters () const |
Returns all chapters assigned to the current file. More... | |
bool | areChaptersSupported () const |
Returns an indication whether this library supports parsing the chapters of the current file. More... | |
ParsingStatus | attachmentsParsingStatus () const |
Returns whether the attachments have been parsed yet. More... | |
std::vector< AbstractAttachment * > | attachments () const |
Returns all attachments assigned to the current file. More... | |
bool | areAttachmentsSupported () const |
Returns an indication whether this library supports attachment format of the current file. More... | |
ParsingStatus | tracksParsingStatus () const |
Returns an indication whether tracks have been parsed yet. More... | |
std::size_t | trackCount () const |
Returns the number of tracks that could be parsed. More... | |
std::vector< AbstractTrack * > | tracks () const |
Returns the tracks for the current file. More... | |
bool | hasTracksOfType (TagParser::MediaType type) const |
Returns an indication whether the current file has tracks of the specified type. More... | |
CppUtilities::TimeSpan | duration () const |
Returns the overall duration of the file if known; otherwise returns a TimeSpan with zero ticks. More... | |
double | overallAverageBitrate () const |
Returns the overall average bitrate in kbit/s of the file if known; otherwise returns 0.0. More... | |
std::unordered_set< std::string > | availableLanguages (TagParser::MediaType type=TagParser::MediaType::Audio) const |
Determines the available languages for specified media type (by default MediaType::Audio). More... | |
std::string | technicalSummary () const |
Generates a short technical summary about the file's tracks. More... | |
bool | areTracksSupported () const |
Returns an indication whether this library supports parsing the tracks information of the current file. More... | |
ParsingStatus | tagsParsingStatus () const |
Returns an indication whether tag information has been parsed yet. More... | |
bool | hasId3v1Tag () const |
Returns an indication whether an ID3v1 tag is assigned. More... | |
bool | hasId3v2Tag () const |
Returns an indication whether an ID3v2 tag is assigned. More... | |
bool | hasAnyTag () const |
Returns an indication whether a tag of any format is assigned. More... | |
Id3v1Tag * | id3v1Tag () const |
Returns a pointer to the assigned ID3v1 tag or nullptr if none is assigned. More... | |
const std::vector< std::unique_ptr< Id3v2Tag > > & | id3v2Tags () const |
Returns pointers to the assigned ID3v2 tags. More... | |
void | tags (std::vector< Tag * > &tags) const |
Stores all tags assigned to the current file in the specified vector. More... | |
std::vector< Tag * > | tags () const |
Returns all tags assigned to the current file. More... | |
Mp4Tag * | mp4Tag () const |
Returns a pointer to the assigned MP4 tag or nullptr if none is assigned. More... | |
const std::vector< std::unique_ptr< MatroskaTag > > & | matroskaTags () const |
Returns pointers to the assigned Matroska tags. More... | |
VorbisComment * | vorbisComment () const |
Returns a pointer to the first assigned Vorbis comment or nullptr if none is assigned. More... | |
bool | areTagsSupported () const |
Returns an indication whether this library supports the tag format of the current file. More... | |
bool | createAppropriateTags (const TagCreationSettings &settings=TagCreationSettings()) |
Ensures appropriate tags are created according the given settings. More... | |
bool | removeId3v1Tag () |
Removes a possibly assigned ID3v1 tag from the current file. More... | |
Id3v1Tag * | createId3v1Tag () |
Creates an ID3v1 tag for the current file. More... | |
bool | removeId3v2Tag (Id3v2Tag *tag) |
Removes an assigned ID3v2 tag from the current file. More... | |
bool | removeAllId3v2Tags () |
Removes all assigned ID3v2 tags from the current file. More... | |
Id3v2Tag * | createId3v2Tag () |
Creates an ID3v2 tag for the current file. More... | |
bool | removeTag (Tag *tag) |
Removes a possibly assigned tag from the current file. More... | |
void | removeAllTags () |
Removes all assigned tags from the file. More... | |
void | mergeId3v2Tags () |
Merges the assigned ID3v2 tags into a single ID3v2 tag. More... | |
bool | id3v1ToId3v2 () |
Converts an existing ID3v1 tag into an ID3v2 tag. More... | |
bool | id3v2ToId3v1 () |
Converts the existing ID3v2 tags into an ID3v1 tag. More... | |
VorbisComment * | createVorbisComment () |
Creates a Vorbis comment for the current file. More... | |
bool | removeVorbisComment () |
Removes all assigned Vorbis comment from the current file. More... | |
void | clearParsingResults () |
Clears all parsing results and assigned/created/changed information such as detected container format, tracks, tags, ... More... | |
const std::string & | backupDirectory () const |
Returns the directory used to store backup files. More... | |
void | setBackupDirectory (const std::string &backupDirectory) |
Sets the directory used to store backup files. More... | |
const std::string & | saveFilePath () const |
Returns the "save file path" which has been set using setSaveFilePath(). More... | |
void | setSaveFilePath (const std::string &saveFilePath) |
Sets the "save file path". More... | |
const std::string | writingApplication () const |
Sets the writing application as container-level meta-data. More... | |
void | setWritingApplication (const std::string &writingApplication) |
Sets the writing application as container-level meta-data. More... | |
void | setWritingApplication (const char *writingApplication) |
Sets the writing application as container-level meta-data. More... | |
bool | isForcingFullParse () const |
Returns an indication whether forcing a full parse is enabled. More... | |
void | setForceFullParse (bool forceFullParse) |
Sets whether forcing a full parse is enabled. More... | |
bool | isForcingRewrite () const |
Returns whether forcing rewriting (when applying changes) is enabled. More... | |
void | setForceRewrite (bool forceRewrite) |
Sets whether forcing rewriting (when applying changes) is enabled. More... | |
size_t | minPadding () const |
Returns the minimum padding to be written before the data blocks when applying changes. More... | |
void | setMinPadding (size_t minPadding) |
Sets the minimum padding to be written before the data blocks when applying changes. More... | |
size_t | maxPadding () const |
Returns the maximum padding to be written before the data blocks when applying changes. More... | |
void | setMaxPadding (size_t maxPadding) |
Sets the maximum padding to be written before the data blocks when applying changes. More... | |
size_t | preferredPadding () const |
Returns the padding to be written before the data block when applying changes and the file needs to be rewritten anyways. More... | |
void | setPreferredPadding (size_t preferredPadding) |
Sets the padding to be written before the data block when applying changes and the file needs to be rewritten anyways. More... | |
ElementPosition | tagPosition () const |
Returns the position (in the output file) where the tag information is written when applying changes. More... | |
void | setTagPosition (ElementPosition tagPosition) |
Sets the position (in the output file) where the tag information is written when applying changes. More... | |
bool | forceTagPosition () const |
Returns whether tagPosition() is forced. More... | |
void | setForceTagPosition (bool forceTagPosition) |
Sets whether tagPosition() is forced. More... | |
ElementPosition | indexPosition () const |
Returns the position (in the output file) where the index is written when applying changes. More... | |
void | setIndexPosition (ElementPosition indexPosition) |
Sets the position (in the output file) where the index is written when applying changes. More... | |
bool | forceIndexPosition () const |
Returns whether indexPosition() is forced. More... | |
void | setForceIndexPosition (bool forceTagPosition) |
Sets whether indexPosition() is forced. More... | |
![]() | |
BasicFileInfo (const std::string &path=std::string()) | |
Constructs a new BasicFileInfo for the specified file. More... | |
BasicFileInfo (const BasicFileInfo &)=delete | |
BasicFileInfo & | operator= (const BasicFileInfo &)=delete |
virtual | ~BasicFileInfo () |
Destroys the BasicFileInfo. More... | |
void | open (bool readOnly=false) |
Opens a std::fstream for the current file. More... | |
void | reopen (bool readOnly=false) |
Opens a std::fstream for the current file. More... | |
bool | isOpen () const |
Indicates whether a std::fstream is open for the current file. More... | |
bool | isReadOnly () const |
Indicates whether the last open()/reopen() call was read-only. More... | |
void | close () |
A possibly opened std::fstream will be closed. More... | |
void | invalidate () |
Invalidates the file info manually. More... | |
CppUtilities::NativeFileStream & | stream () |
Returns the std::fstream for the current instance. More... | |
const CppUtilities::NativeFileStream & | stream () const |
Returns the std::fstream for the current instance. More... | |
const std::string & | path () const |
Returns the path of the current file. More... | |
void | setPath (const std::string &path) |
Sets the current file. More... | |
std::string | fileName (bool cutExtension=false) const |
Returns the file name of the current file. More... | |
std::string | extension () const |
Returns the extension of the current file. More... | |
std::string | pathWithoutExtension () const |
Returns the path of the current file without the extension/suffix. More... | |
std::string | containingDirectory () const |
Returns the path of the directory containing the current file. More... | |
std::uint64_t | size () const |
Returns size of the current file in bytes. More... | |
void | reportSizeChanged (std::uint64_t newSize) |
Call this function to report that the size changed. More... | |
void | reportPathChanged (const std::string &newPath) |
Call this function to report that the path changed. More... | |
Protected Member Functions | |
void | invalidated () override |
Reimplemented from BasicFileInfo::invalidated(). More... | |
Additional Inherited Members | |
![]() | |
static std::string | fileName (const std::string &path, bool cutExtension=false) |
Returns the file name of the given file. More... | |
static std::string | extension (const std::string &path) |
Returns the extension of the given file. More... | |
static std::string | pathWithoutExtension (const std::string &fullPath) |
Returns a copy of the given path without the extension/suffix. More... | |
static std::string | containingDirectory (const std::string &path) |
Returns the path of the directory containing the given file. More... | |
static const char * | pathForOpen (const std::string &url) |
Returns removes the "file:/" prefix from url to be able to pass it to functions like open(), stat() and truncate(). More... | |
The MediaFileInfo class allows to read and write tag information providing a container/tag format independent interface.
It also provides some technical information such as contained streams.
For examples see "cli/mainfeatures.cpp" of the tageditor repository.
Definition at line 45 of file mediafileinfo.h.
TagParser::MediaFileInfo::MediaFileInfo | ( | ) |
Constructs a new MediaFileInfo.
Definition at line 81 of file mediafileinfo.cpp.
TagParser::MediaFileInfo::MediaFileInfo | ( | const std::string & | path | ) |
Constructs a new MediaFileInfo for the specified file.
path | Specifies the absolute or relative path of the file. |
Definition at line 107 of file mediafileinfo.cpp.
|
delete |
|
override |
Destroys the MediaFileInfo.
Definition at line 132 of file mediafileinfo.cpp.
void TagParser::MediaFileInfo::applyChanges | ( | Diagnostics & | diag, |
AbortableProgressFeedback & | progress | ||
) |
Applies assigned/changed tag information to the current file.
This method applies previously assigned tag information to the current file.
Depending on the changes to be applied the file will be rewritten.
When the file needs to be rewritten it will be renamed. A new file with the old name will be created to replace the old file.
Throws | std::ios_base::failure when an IO error occurs. |
Throws | TagParser::Failure or a derived exception when a making error occurs. |
Definition at line 659 of file mediafileinfo.cpp.
bool TagParser::MediaFileInfo::areAttachmentsSupported | ( | ) | const |
Returns an indication whether this library supports attachment format of the current file.
Definition at line 1141 of file mediafileinfo.cpp.
bool TagParser::MediaFileInfo::areChaptersSupported | ( | ) | const |
Returns an indication whether this library supports parsing the chapters of the current file.
Definition at line 1124 of file mediafileinfo.cpp.
bool TagParser::MediaFileInfo::areTagsSupported | ( | ) | const |
Returns an indication whether this library supports the tag format of the current file.
Definition at line 1179 of file mediafileinfo.cpp.
bool TagParser::MediaFileInfo::areTracksSupported | ( | ) | const |
Returns an indication whether this library supports parsing the tracks information of the current file.
Definition at line 1158 of file mediafileinfo.cpp.
vector< AbstractAttachment * > TagParser::MediaFileInfo::attachments | ( | ) | const |
Returns all attachments assigned to the current file.
Definition at line 1265 of file mediafileinfo.cpp.
|
inline |
Returns whether the attachments have been parsed yet.
Definition at line 302 of file mediafileinfo.h.
unordered_set< string > TagParser::MediaFileInfo::availableLanguages | ( | TagParser::MediaType | type = TagParser::MediaType::Audio | ) | const |
Determines the available languages for specified media type (by default MediaType::Audio).
If type is MediaType::Unknown, all media types are considered.
parseTracks() needs to be called before. Otherwise this method always returns an empty set.
Definition at line 900 of file mediafileinfo.cpp.
|
inline |
Returns the directory used to store backup files.
Definition at line 352 of file mediafileinfo.h.
vector< AbstractChapter * > TagParser::MediaFileInfo::chapters | ( | ) | const |
Returns all chapters assigned to the current file.
Definition at line 1247 of file mediafileinfo.cpp.
|
inline |
Returns whether the chapters have been parsed yet.
Definition at line 294 of file mediafileinfo.h.
void TagParser::MediaFileInfo::clearParsingResults | ( | ) |
Clears all parsing results and assigned/created/changed information such as detected container format, tracks, tags, ...
This allows a rescan of the file using parsing methods like parseContainerFormat(). Otherwise, these methods do nothing if the information to be parsed has already been gathered.
Definition at line 1289 of file mediafileinfo.cpp.
|
inline |
Returns the container for the current file.
If there is not corresponding subclass of AbstractContainer for the container format or the container has not been parsed yet using the parseContainerFormat() method nullptr will be returned.
Definition at line 432 of file mediafileinfo.h.
|
inline |
Returns the container format of the current file.
parseContainerFormat() needs to be called before. Otherwise always ContainerFormat::Unknown will be returned.
Definition at line 211 of file mediafileinfo.h.
const char * TagParser::MediaFileInfo::containerFormatAbbreviation | ( | ) | const |
Returns the abbreviation of the container format as C-style string.
This abbreviation might be used as file extension.
parseContainerFormat() needs to be called before. Otherwise always an empty string will be returned.
Definition at line 725 of file mediafileinfo.cpp.
|
inline |
Returns the name of the container format as C-style string.
parseContainerFormat() needs to be called before. Otherwise always the name "Unknown" will be returned.
Definition at line 226 of file mediafileinfo.h.
|
inline |
Returns the subversion of the container format as C-style string.
parseContainerFormat() needs to be called before. Otherwise always an empty string will be returned.
Definition at line 241 of file mediafileinfo.h.
|
inline |
Returns the actual container start offset.
Definition at line 249 of file mediafileinfo.h.
|
inline |
Returns an indication whether the container format has been parsed yet.
Definition at line 200 of file mediafileinfo.h.
bool TagParser::MediaFileInfo::createAppropriateTags | ( | const TagCreationSettings & | settings = TagCreationSettings() | ) |
Ensures appropriate tags are created according the given settings.
Definition at line 533 of file mediafileinfo.cpp.
Id3v1Tag * TagParser::MediaFileInfo::createId3v1Tag | ( | ) |
Creates an ID3v1 tag for the current file.
This method does nothing the tags of the current file haven't been parsed using the parseTags() method.
If the file has already an ID3v1 tag no new tag will be created.
To apply the created tag and other changings call the applyChanges() method.
Definition at line 982 of file mediafileinfo.cpp.
Id3v2Tag * TagParser::MediaFileInfo::createId3v2Tag | ( | ) |
Creates an ID3v2 tag for the current file.
This method does nothing the tags of the current file haven't been parsed using the parseTags() method.
If the file has already an ID3v2 tag no new tag will be created.
To apply the created tag and other changings call the applyChanges() method.
Definition at line 1049 of file mediafileinfo.cpp.
VorbisComment * TagParser::MediaFileInfo::createVorbisComment | ( | ) |
Creates a Vorbis comment for the current file.
This method does nothing if the tags/tracks of the current file haven't been parsed using the parseTags() and parseTracks() methods.
If the file has already a Vorbis comment no new tag will be created.
To apply the created tag and other changings call the applyChanges() method.
Definition at line 1392 of file mediafileinfo.cpp.
CppUtilities::TimeSpan TagParser::MediaFileInfo::duration | ( | ) | const |
Returns the overall duration of the file if known; otherwise returns a TimeSpan with zero ticks.
parseTracks() needs to be called before. Otherwise this method always returns false.
Definition at line 862 of file mediafileinfo.cpp.
|
inline |
Returns whether indexPosition() is forced.
Definition at line 622 of file mediafileinfo.h.
|
inline |
Returns whether tagPosition() is forced.
Definition at line 582 of file mediafileinfo.h.
bool TagParser::MediaFileInfo::hasAnyTag | ( | ) | const |
Returns an indication whether a tag of any format is assigned.
Definition at line 1470 of file mediafileinfo.cpp.
|
inline |
Returns an indication whether an ID3v1 tag is assigned.
Definition at line 310 of file mediafileinfo.h.
|
inline |
Returns an indication whether an ID3v2 tag is assigned.
Definition at line 318 of file mediafileinfo.h.
bool TagParser::MediaFileInfo::hasTracksOfType | ( | TagParser::MediaType | type | ) | const |
Returns an indication whether the current file has tracks of the specified type.
parseTracks() needs to be called before. Otherwise this method always returns false.
Definition at line 836 of file mediafileinfo.cpp.
|
inline |
Returns a pointer to the assigned ID3v1 tag or nullptr if none is assigned.
Definition at line 330 of file mediafileinfo.h.
bool TagParser::MediaFileInfo::id3v1ToId3v2 | ( | ) |
Converts an existing ID3v1 tag into an ID3v2 tag.
Effectively merges all ID3 tags into a single ID3v2 tag.
Definition at line 1350 of file mediafileinfo.cpp.
|
inline |
Returns pointers to the assigned ID3v2 tags.
Definition at line 342 of file mediafileinfo.h.
bool TagParser::MediaFileInfo::id3v2ToId3v1 | ( | ) |
Converts the existing ID3v2 tags into an ID3v1 tag.
Effectively merges all ID3 tags into a single ID3v1 tag.
Definition at line 1369 of file mediafileinfo.cpp.
|
inline |
Returns the position (in the output file) where the index is written when applying changes.
Definition at line 602 of file mediafileinfo.h.
|
overrideprotectedvirtual |
Reimplemented from BasicFileInfo::invalidated().
Reimplemented from TagParser::BasicFileInfo.
Definition at line 1492 of file mediafileinfo.cpp.
|
inline |
Returns an indication whether forcing a full parse is enabled.
If enabled the parser will analyse the file structure as deep as possible. This might cause long parsing times for big files.
Definition at line 445 of file mediafileinfo.h.
|
inline |
Returns whether forcing rewriting (when applying changes) is enabled.
Definition at line 463 of file mediafileinfo.h.
const vector< unique_ptr< MatroskaTag > > & TagParser::MediaFileInfo::matroskaTags | ( | ) | const |
Returns pointers to the assigned Matroska tags.
Definition at line 1219 of file mediafileinfo.cpp.
|
inline |
Returns the maximum padding to be written before the data blocks when applying changes.
Maximum padding in front of the file allows adding additional fields afterwards whithout needing to rewrite the entire file or to put tag information at the end of the file.
The default value is 0 which will force the library to rewrite the entire file almost always when applying changes. Increate the value using setMaxPadding() to prevent this.
Definition at line 516 of file mediafileinfo.h.
void TagParser::MediaFileInfo::mergeId3v2Tags | ( | ) |
Merges the assigned ID3v2 tags into a single ID3v2 tag.
Some files I've got contain multiple successive ID3v2 tags. If the tags of such an file is parsed by this class, these tags will be kept seperate. This method merges all assigned ID3v2 tags. All fields from the additional ID3v2 tags will be inserted to the first tag. All assigned ID3v2 tag instances except thefirst will be destroyed.
A possibly assigned ID3v1 tag remains unaffected.
This method does nothing the tags of the current file haven't been parsed using the parseTags() method.
Definition at line 1323 of file mediafileinfo.cpp.
const char * TagParser::MediaFileInfo::mimeType | ( | ) | const |
Returns the MIME-type of the container format as C-style string.
parseContainerFormat() needs to be called before. Otherwise always an empty string will be returned.
Definition at line 779 of file mediafileinfo.cpp.
|
inline |
Returns the minimum padding to be written before the data blocks when applying changes.
Minimum padding in front of the file allows adding additional fields afterwards whithout needing to rewrite the entire file or to put tag information at the end of the file.
The default value is 0.
Definition at line 488 of file mediafileinfo.h.
Mp4Tag * TagParser::MediaFileInfo::mp4Tag | ( | ) | const |
Returns a pointer to the assigned MP4 tag or nullptr if none is assigned.
Definition at line 1204 of file mediafileinfo.cpp.
|
delete |
double TagParser::MediaFileInfo::overallAverageBitrate | ( | ) | const |
Returns the overall average bitrate in kbit/s of the file if known; otherwise returns 0.0.
parseTracks() needs to be called before. Otherwise this method always returns false.
Definition at line 881 of file mediafileinfo.cpp.
|
inline |
Returns the padding size.
Container format and tags should have been parsed yet.
Definition at line 257 of file mediafileinfo.h.
void TagParser::MediaFileInfo::parseAttachments | ( | Diagnostics & | diag | ) |
Parses the attachments of the current file.
This method parses the attachments of the current file if not been parsed yet.
Throws | std::ios_base::failure when an IO error occurs. |
Throws | TagParser::Failure or a derived exception when a parsing error occurs. |
Definition at line 483 of file mediafileinfo.cpp.
void TagParser::MediaFileInfo::parseChapters | ( | Diagnostics & | diag | ) |
Parses the chapters of the current file.
This method parses the chapters of the current file if not been parsed yet.
Throws | std::ios_base::failure when an IO error occurs. |
Throws | TagParser::Failure or a derived exception when a parsing error occurs. |
Definition at line 448 of file mediafileinfo.cpp.
void TagParser::MediaFileInfo::parseContainerFormat | ( | Diagnostics & | diag | ) |
Parses the container format of the current file.
This method parses the container of the current file format if it has not been parsed yet.
After calling this method the methods containerFormat(), containerFormatName(), containerFormatAbbreviation(), containerFormatSubversion(), containerMimeType(), container(), mp4Container() and matroskaContainer() will return the parsed information.
Throws | std::ios_base::failure when an IO error occurs. |
Throws | TagParser::Failure or a derived exception when a parsing error occurs. |
Definition at line 151 of file mediafileinfo.cpp.
void TagParser::MediaFileInfo::parseEverything | ( | Diagnostics & | diag | ) |
Parses the container format, the tracks and the tag information of the current file.
See the individual methods to for more details and exceptions which might be thrown.
Definition at line 513 of file mediafileinfo.cpp.
void TagParser::MediaFileInfo::parseTags | ( | Diagnostics & | diag | ) |
Parses the tag(s) of the current file.
This method parses the tag(s) of the current file if not been parsed yet. After calling this method the methods id3v1Tag(), id3v2Tags(), mp4Tag() and allTags() will return the parsed information.
Previously assigned but not applied tag information will be discarted.
Throws | std::ios_base::failure when an IO error occurs. |
Throws | TagParser::Failure or a derived exception when a parsing error occurs. |
Definition at line 366 of file mediafileinfo.cpp.
void TagParser::MediaFileInfo::parseTracks | ( | Diagnostics & | diag | ) |
Parses the tracks of the current file.
This method parses the tracks of the current file if not been parsed yet. After calling this method the methods trackCount(), tracks(), and hasTracksOfType() will return the parsed information.
Throws | std::ios_base::failure when an IO error occurs. |
Throws | TagParser::Failure or a derived exception when a parsing error occurs. |
Definition at line 295 of file mediafileinfo.cpp.
|
inline |
Returns the padding to be written before the data block when applying changes and the file needs to be rewritten anyways.
Padding in front of the file allows adding additional fields afterwards whithout needing to rewrite the entire file or to put tag information at the end of the file.
Definition at line 537 of file mediafileinfo.h.
bool TagParser::MediaFileInfo::removeAllId3v2Tags | ( | ) |
Removes all assigned ID3v2 tags from the current file.
To apply the removal and other changings call the applyChanges() method
Definition at line 1025 of file mediafileinfo.cpp.
void TagParser::MediaFileInfo::removeAllTags | ( | ) |
Removes all assigned tags from the file.
To apply the removal and other changings call the applyChanges() method.
Definition at line 1109 of file mediafileinfo.cpp.
bool TagParser::MediaFileInfo::removeId3v1Tag | ( | ) |
Removes a possibly assigned ID3v1 tag from the current file.
To apply the removal and other changings call the applyChanges() method.
Definition at line 955 of file mediafileinfo.cpp.
bool TagParser::MediaFileInfo::removeId3v2Tag | ( | Id3v2Tag * | tag | ) |
Removes an assigned ID3v2 tag from the current file.
To apply the removal and other changings call the applyChanges() method.
tag | Specifies the ID3v2 tag to be removed. |
Definition at line 1003 of file mediafileinfo.cpp.
bool TagParser::MediaFileInfo::removeTag | ( | Tag * | tag | ) |
Removes a possibly assigned tag from the current file.
To apply the removal and other changings call the applyChanges() method.
tag | Specifies the tag to be removed. The tag will not only be detached from the file, it will be destroyed as well. Might be nullptr for convenience (eg. you might want to call file.removeTag(file.mp4Tag()) to ensure no MP4 tag is present without checking before). |
Definition at line 1070 of file mediafileinfo.cpp.
bool TagParser::MediaFileInfo::removeVorbisComment | ( | ) |
Removes all assigned Vorbis comment from the current file.
To apply the removal and other changings call the applyChanges() method.
Definition at line 1419 of file mediafileinfo.cpp.
|
inline |
Returns the "save file path" which has been set using setSaveFilePath().
Definition at line 370 of file mediafileinfo.h.
|
inline |
Sets the directory used to store backup files.
Definition at line 361 of file mediafileinfo.h.
|
inline |
Sets whether forcing a full parse is enabled.
Definition at line 455 of file mediafileinfo.h.
|
inline |
Sets whether indexPosition() is forced.
Definition at line 632 of file mediafileinfo.h.
|
inline |
Sets whether forcing rewriting (when applying changes) is enabled.
Definition at line 471 of file mediafileinfo.h.
|
inline |
Sets whether tagPosition() is forced.
Definition at line 592 of file mediafileinfo.h.
|
inline |
Sets the position (in the output file) where the index is written when applying changes.
Definition at line 612 of file mediafileinfo.h.
|
inline |
Sets the maximum padding to be written before the data blocks when applying changes.
Definition at line 526 of file mediafileinfo.h.
|
inline |
Sets the minimum padding to be written before the data blocks when applying changes.
Definition at line 498 of file mediafileinfo.h.
|
inline |
Sets the padding to be written before the data block when applying changes and the file needs to be rewritten anyways.
Definition at line 547 of file mediafileinfo.h.
|
inline |
Sets the "save file path".
If saveFilePath is not empty, this path will be used to save the output file when applying changes using applyChanges(). Thus the current file is not modified by applyChanges() in this case and the variable isForcingRewrite() does not affect the behaviour of applyChanges(). If the changes have been applied without fatal errors the "save file path" is cleared and used as the new regular path().
By default, this path is empty.
Definition at line 389 of file mediafileinfo.h.
|
inline |
Sets the position (in the output file) where the tag information is written when applying changes.
Definition at line 572 of file mediafileinfo.h.
|
inline |
Sets the writing application as container-level meta-data.
Put the name of your application here.
Definition at line 417 of file mediafileinfo.h.
|
inline |
Sets the writing application as container-level meta-data.
Put the name of your application here.
Definition at line 408 of file mediafileinfo.h.
|
inline |
Returns the position (in the output file) where the tag information is written when applying changes.
Definition at line 557 of file mediafileinfo.h.
vector< Tag * > TagParser::MediaFileInfo::tags | ( | ) | const |
Returns all tags assigned to the current file.
Definition at line 1482 of file mediafileinfo.cpp.
void TagParser::MediaFileInfo::tags | ( | std::vector< Tag * > & | tags | ) | const |
Stores all tags assigned to the current file in the specified vector.
Previous elements of the vector will not be cleared.
Definition at line 1447 of file mediafileinfo.cpp.
|
inline |
Returns an indication whether tag information has been parsed yet.
Definition at line 265 of file mediafileinfo.h.
string TagParser::MediaFileInfo::technicalSummary | ( | ) | const |
Generates a short technical summary about the file's tracks.
parseTracks() needs to be called before. Otherwise this method always returns an empty string.
Example (exact format might change in the future!): "H.264-720p / HE-AAC-6ch-eng / HE-AAC-2ch-ger / SRT-eng / SRT-ger"
Definition at line 927 of file mediafileinfo.cpp.
|
inline |
Returns the number of tracks that could be parsed.
parseTracks() needs to be called before. Otherwise this method always returns zero.
Definition at line 286 of file mediafileinfo.h.
vector< AbstractTrack * > TagParser::MediaFileInfo::tracks | ( | ) | const |
Returns the tracks for the current file.
parseTracks() needs to be called before. Otherwise this method always returns an empty vector.
Definition at line 806 of file mediafileinfo.cpp.
|
inline |
Returns an indication whether tracks have been parsed yet.
Definition at line 273 of file mediafileinfo.h.
VorbisComment * TagParser::MediaFileInfo::vorbisComment | ( | ) | const |
Returns a pointer to the first assigned Vorbis comment or nullptr if none is assigned.
Definition at line 1235 of file mediafileinfo.cpp.
|
inline |
Sets the writing application as container-level meta-data.
Definition at line 399 of file mediafileinfo.h.