TagLib: Implement new field support

Implement the new fields into TagLib, pending contribution to upstream.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This commit is contained in:
Christopher Snowhill 2025-02-17 04:21:32 -08:00
parent c4ed14aa53
commit 03bf4b36fe
14 changed files with 3623 additions and 6 deletions

View file

@ -56,6 +56,8 @@ namespace TagLib {
class TAGLIB_EXPORT Tag : public TagLib::Tag
{
public:
using TagLib::Tag::ReplayGain;
/*!
* Create an APE tag with default values.
*/
@ -90,20 +92,34 @@ namespace TagLib {
// Reimplementations.
String title() const override;
String albumartist() const override;
String artist() const override;
String composer() const override;
String album() const override;
String unsyncedlyrics() const override;
String comment() const override;
String genre() const override;
unsigned int year() const override;
unsigned int track() const override;
unsigned int disc() const override;
String cuesheet() const override;
ReplayGain replaygain() const override;
String soundcheck() const override;
void setTitle(const String &s) override;
void setAlbumArtist(const String &s) override;
void setArtist(const String &s) override;
void setComposer(const String &s) override;
void setAlbum(const String &s) override;
void setUnsyncedLyrics(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;
void setDisc(unsigned int i) override;
void setCuesheet(const String &s) override;
void setReplaygain(ReplayGain r) override;
void setSoundcheck(const String &s) override;
/*!
* Implements the unified tag dictionary interface -- export function.

View file

@ -46,6 +46,7 @@ namespace TagLib {
friend class File;
public:
using TagLib::Tag::ReplayGain;
Tag();
@ -59,17 +60,33 @@ namespace TagLib {
*/
String title() const override;
/*!
* Returns the album artist name.
*/
String albumartist() const override;
/*!
* Returns the artist name.
*/
String artist() const override;
/*!
* Returns the composer name.
*/
String composer() const override;
/*!
* Returns the album name; if no album name is present in the tag
* an empty string will be returned.
*/
String album() const override;
/*!
* Returns the unsynchronized lyrics; if no unsynced lyrics are
* present in the tag an empty string will be returned.
*/
String unsyncedlyrics() const override;
/*!
* Returns the track comment.
*/
@ -103,22 +120,62 @@ namespace TagLib {
*/
unsigned int track() const override;
/*!
* Returns the disc number; if there is no disc number set, this will
* return 0.
*/
unsigned int disc() const override;
/*!
* Returns the embedded cuesheet; currently unimplemented, this will
* always return an empty string.
*/
String cuesheet() const override;
/*!
* Returns the ReplayGain tag; currently unimplemented, will alway
* always return an empty tag.
*/
ReplayGain replaygain() const override;
/*!
* Returns the SoundCheck tag; currently unimplemented, this will
* always return an empty string.
*/
String soundcheck() const override;
/*!
* Sets the title to \a value.
*/
void setTitle(const String &value) override;
/*!
* Sets the album artist to \a value.
*/
void setAlbumArtist(const String &value) override;
/*!
* Sets the artist to \a value.
*/
void setArtist(const String &value) override;
/*!
* Sets the composer to \a value.
*/
void setComposer(const String &value) override;
/*!
* Sets the album to \a value. If \a value is an empty string then this value will be
* cleared.
*/
void setAlbum(const String &value) override;
/*!
* Sets the unsynchronized lyrics to \a value. If \a value is an empty string then
* this value will be cleared.
*/
void setUnsyncedLyrics(const String &value) override;
/*!
* Sets the comment to \a value.
*/
@ -150,6 +207,29 @@ namespace TagLib {
void setTrack(unsigned int value) override;
/*!
* Sets the disc to \a value. If \a value is 0 then this value will be cleared.
*/
void setDisc(unsigned int value) override;
/*!
* Sets the embedded cuesheet to \a value. Currently unimplemented and does
* nothing.
*/
void setCuesheet(const String &value) override;
/*!
* Sets the ReplayGain tag to \a value. Currently unimplemented and does
* nothing.
*/
void setReplaygain(ReplayGain value) override;
/*!
* Sets the SoundCheck tag to \a value. Currently unimplemented and does
* nothing.
*/
void setSoundcheck(const String &value) override;
/*!
* Returns \c 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.

View file

@ -42,6 +42,7 @@ namespace TagLib {
class TAGLIB_EXPORT Tag : public TagLib::Tag
{
public:
using TagLib::Tag::ReplayGain;
Tag();
~Tag() override;
@ -52,16 +53,31 @@ namespace TagLib {
String title() const override;
/*!
* Not supported. Therefore always returns String().
*/
String albumartist() const override;
/*!
* Returns the artist name; if no artist name is present in the tag
* String() will be returned.
*/
String artist() const override;
/*!
* Not supported. Therefore always returns String().
*/
String composer() const override;
/*!
* Not supported. Therefore always returns String().
*/
String album() const override;
/*!
* Not supported. Therefore always returns String().
*/
String unsyncedlyrics() const override;
/*!
* Not supported. Therefore always returns String().
*/
@ -82,23 +98,58 @@ namespace TagLib {
*/
unsigned int track() const override;
/*!
* Not supported. Therefore always returns 0.
*/
unsigned int disc() const override;
/*!
* Not supported. Therefore always returns String().
*/
String cuesheet() const override;
/*!
* Not supported. Therefore always returns ReplayGain().
*/
ReplayGain replaygain() const override;
/*!
* Not supported. Therefore always returns String().
*/
String soundcheck() const override;
/*!
* Sets the title to \a title. If \a title is String() then this
* value will be cleared.
*/
void setTitle(const String &title) override;
/*!
* Not supported and therefore ignored.
*/
void setAlbumArtist(const String &albumartist) override;
/*!
* Sets the artist to \a artist. If \a artist is String() then this
* value will be cleared.
*/
void setArtist(const String &artist) override;
/*!
* Not supported and therefore ignored.
*/
void setComposer(const String &composer) override;
/*!
* Not supported and therefore ignored.
*/
void setAlbum(const String &album) override;
/*!
* Not supported and therefore ignored.
*/
void setUnsyncedLyrics(const String &unsyncedlyrics) override;
/*!
* Not supported and therefore ignored.
*/
@ -119,6 +170,26 @@ namespace TagLib {
*/
void setTrack(unsigned int track) override;
/*!
* Not supported and therefore ignored.
*/
void setDisc(unsigned int disc) override;
/*!
* Not supported and therefore ignored.
*/
void setCuesheet(const String &cuesheet) override;
/*!
* Not supported and therefore ignored.
*/
void setReplaygain(ReplayGain replaygain) override;
/*!
* Not supported and therefore ignored.
*/
void setSoundcheck(const String &soundcheck) override;
/*!
* Implements the unified property interface -- export function.
* Since the DIIN tag is very limited, the exported map is as well.

View file

@ -114,6 +114,7 @@ namespace TagLib {
class TAGLIB_EXPORT Tag : public TagLib::Tag
{
public:
using TagLib::Tag::ReplayGain;
/*!
* Create an ID3v1 tag with default values.
*/
@ -148,20 +149,34 @@ namespace TagLib {
// Reimplementations.
String title() const override;
String albumartist() const override;
String artist() const override;
String composer() const override;
String album() const override;
String unsyncedlyrics() const override;
String comment() const override;
String genre() const override;
unsigned int year() const override;
unsigned int track() const override;
unsigned int disc() const override;
String cuesheet() const override;
ReplayGain replaygain() const override;
String soundcheck() const override;
void setTitle(const String &s) override;
void setAlbumArtist(const String &s) override;
void setArtist(const String &s) override;
void setComposer(const String &s) override;
void setAlbum(const String &s) override;
void setUnsyncedLyrics(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;
void setDisc(unsigned int i) override;
void setCuesheet(const String &s) override;
void setReplaygain(ReplayGain r) override;
void setSoundcheck(const String &s) override;
/*!
* Returns the genre in number.

View file

@ -133,6 +133,7 @@ namespace TagLib {
class TAGLIB_EXPORT Tag : public TagLib::Tag
{
public:
using TagLib::Tag::ReplayGain;
/*!
* Constructs an empty ID3v2 tag.
*
@ -166,20 +167,34 @@ namespace TagLib {
// Reimplementations.
String title() const override;
String albumartist() const override;
String artist() const override;
String composer() const override;
String album() const override;
String unsyncedlyrics() const override;
String comment() const override;
String genre() const override;
unsigned int year() const override;
unsigned int track() const override;
unsigned int disc() const override;
String cuesheet() const override;
ReplayGain replaygain() const override;
String soundcheck() const override;
void setTitle(const String &s) override;
void setAlbumArtist(const String &s) override;
void setArtist(const String &s) override;
void setComposer(const String &s) override;
void setAlbum(const String &s) override;
void setUnsyncedLyrics(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;
void setDisc(unsigned int i) override;
void setCuesheet(const String &s) override;
void setReplaygain(ReplayGain r) override;
void setSoundcheck(const String &s) override;
bool isEmpty() const override;

View file

@ -95,6 +95,7 @@ namespace TagLib {
class TAGLIB_EXPORT Tag : public TagLib::Tag
{
public:
using TagLib::Tag::ReplayGain;
/*!
* Constructs an empty INFO tag.
*/
@ -113,20 +114,34 @@ namespace TagLib {
// Reimplementations
String title() const override;
String albumartist() const override;
String artist() const override;
String composer() const override;
String album() const override;
String unsyncedlyrics() const override;
String comment() const override;
String genre() const override;
unsigned int year() const override;
unsigned int track() const override;
unsigned int disc() const override;
String cuesheet() const override;
ReplayGain replaygain() const override;
String soundcheck() const override;
void setTitle(const String &s) override;
void setAlbumArtist(const String &s) override;
void setArtist(const String &s) override;
void setComposer(const String &s) override;
void setAlbum(const String &s) override;
void setUnsyncedLyrics(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;
void setDisc(unsigned int i) override;
void setCuesheet(const String &s) override;
void setReplaygain(ReplayGain r) override;
void setSoundcheck(const String &s) override;
bool isEmpty() const override;

View file

@ -48,6 +48,8 @@ namespace TagLib {
class TAGLIB_EXPORT Tag : public TagLib::Tag
{
public:
using TagLib::Tag::ReplayGain;
Tag();
~Tag() override;
@ -60,6 +62,11 @@ namespace TagLib {
*/
String title() const override;
/*!
* Not supported by module files. Therefore always returns an empty string.
*/
String albumartist() const override;
/*!
* Not supported by module files. Therefore always returns an empty string.
*/
@ -68,9 +75,19 @@ namespace TagLib {
/*!
* Not supported by module files. Therefore always returns an empty string.
*/
String composer() const override;
/*!
* Not supported by module files. Therefore always returns an empty string.
*/
String album() const override;
/*!
* Not supported by module files. Therefore always returns an empty string.
*/
String unsyncedlyrics() const override;
/*!
* Returns the track comment derived from the instrument/sample/pattern
* names; if no comment is present in the tag an empty string will be
* returned.
@ -93,6 +110,26 @@ namespace TagLib {
unsigned int track() const override;
/*!
* Not supported by module files. Therefore always returns 0.
*/
unsigned int disc() const override;
/*!
* Not supported by module files. Therefore always returns an empty string.
*/
String cuesheet() const override;
/*!
* Not supported by module files. Therefore always returns an empty tag.
*/
ReplayGain replaygain() const override;
/*!
* Not supported by module files. Therefore always returns an empty string.
*/
String soundcheck() const override;
/*!
* Returns the name of the tracker used to create/edit the module file.
* Only XM files store this tag to the file as such, for other formats
* (Mod, S3M, IT) this is derived from the file type or the flavour of
@ -111,16 +148,31 @@ namespace TagLib {
*/
void setTitle(const String &title) override;
/*!
* Not supported by module files and therefore ignored.
*/
void setAlbumArtist(const String &albumartist) override;
/*!
* Not supported by module files and therefore ignored.
*/
void setArtist(const String &artist) override;
/*!
* Not supported by module files and therefore ignored.
*/
void setComposer(const String &composer) override;
/*!
* Not supported by module files and therefore ignored.
*/
void setAlbum(const String &album) override;
/*!
* Not supported by module files and therefore ignored.
*/
void setUnsyncedLyrics(const String &unsyncedlyrics) override;
/*!
* Sets the comment to \a comment. If \a comment is an empty string then
* this value will be cleared.
@ -156,6 +208,26 @@ namespace TagLib {
void setTrack(unsigned int track) override;
/*!
* Not supported by module files and therefore ignored.
*/
void setDisc(unsigned int disc) override;
/*!
* Not supported by module files and therefore ignored.
*/
void setCuesheet(const String &cuesheet) override;
/*!
* Not supported by module files and therefore ignored.
*/
void setReplaygain(ReplayGain r) override;
/*!
* Not supported by module files and therefore ignored.
*/
void setSoundcheck(const String &soundcheck) override;
/*!
* Sets the tracker name to \a trackerName. If \a trackerName is
* an empty string then this value will be cleared.
*

View file

@ -43,6 +43,7 @@ namespace TagLib {
class TAGLIB_EXPORT Tag: public TagLib::Tag
{
public:
using TagLib::Tag::ReplayGain;
Tag();
Tag(TagLib::File *file, Atoms *atoms,
const ItemFactory *factory = nullptr);
@ -52,20 +53,34 @@ namespace TagLib {
bool save();
String title() const override;
String albumartist() const override;
String artist() const override;
String composer() const override;
String album() const override;
String unsyncedlyrics() const override;
String comment() const override;
String genre() const override;
unsigned int year() const override;
unsigned int track() const override;
unsigned int disc() const override;
String cuesheet() const override;
ReplayGain replaygain() const override;
String soundcheck() const override;
void setTitle(const String &value) override;
void setAlbumArtist(const String &value) override;
void setArtist(const String &value) override;
void setComposer(const String &value) override;
void setAlbum(const String &value) override;
void setUnsyncedLyrics(const String &value) override;
void setComment(const String &value) override;
void setGenre(const String &value) override;
void setYear(unsigned int value) override;
void setTrack(unsigned int value) override;
void setDisc(unsigned int value) override;
void setCuesheet(const String &value) override;
void setReplaygain(ReplayGain value) override;
void setSoundcheck(const String &value) override;
bool isEmpty() const override;

View file

@ -48,6 +48,50 @@ namespace TagLib {
class TAGLIB_EXPORT Tag
{
public:
class ReplayGain {
protected:
bool _equals(const ReplayGain &) const;
public:
ReplayGain();
ReplayGain &operator=(const ReplayGain &);
bool operator==(const ReplayGain &) const;
bool operator!=(const ReplayGain &) const;
bool isEmpty() const;
bool albumGainSet() const;
bool albumPeakSet() const;
bool trackGainSet() const;
bool trackPeakSet() const;
float albumGain() const;
float albumPeak() const;
float trackGain() const;
float trackPeak() const;
void setAlbumGain(float f);
void setAlbumPeak(float f);
void setTrackGain(float f);
void setTrackPeak(float f);
void clear();
void clearAlbumGain();
void clearAlbumPeak();
void clearTrackGain();
void clearTrackPeak();
private:
bool albumgainSet;
bool albumpeakSet;
bool trackgainSet;
bool trackpeakSet;
float albumgain;
float albumpeak;
float trackgain;
float trackpeak;
};
/*!
* Destroys this Tag instance.
@ -129,18 +173,36 @@ namespace TagLib {
*/
virtual String title() const = 0;
/*!
* Returns the album artist name; if no album artist name is present
* in the tag an empty string will be returned.
*/
virtual String albumartist() const = 0;
/*!
* Returns the artist name; if no artist name is present in the tag
* an empty string will be returned.
*/
virtual String artist() const = 0;
/*!
* Returns the composer name; if no composer name is present in the
* tag an empty string will be returned.
*/
virtual String composer() const = 0;
/*!
* Returns the album name; if no album name is present in the tag
* an empty string will be returned.
*/
virtual String album() const = 0;
/*!
* Returns the unsynchronized lyrics; if no unsynced lyrics are
* present in the tag an empty string will be returned.
*/
virtual String unsyncedlyrics() const = 0;
/*!
* Returns the track comment; if no comment is present in the tag
* an empty string will be returned.
@ -164,24 +226,65 @@ namespace TagLib {
*/
virtual unsigned int track() const = 0;
/*!
* Returns the disc number; if there is no disc number set, this will
* return 0.
*/
virtual unsigned int disc() const = 0;
/*!
* Returns the embedded cue sheet; if there is no embedded cue sheet set,
* this will return an empty string.
*/
virtual String cuesheet() const = 0;
/*!
* Returns the ReplayGain tags; if there are no tags set then it will be
* marked empty.
*/
virtual ReplayGain replaygain() const = 0;
/*!
* Returns the SoundCheck tag; if there is no SoundCheck tag set then this
* will return an empty string.
*/
virtual String soundcheck() const = 0;
/*!
* Sets the title to \a s. If \a s is an empty string then this value will be
* cleared.
*/
virtual void setTitle(const String &s) = 0;
/*!
* Sets the album artist to \a s. If \a s is an empty string then this value
* will be cleared. */
virtual void setAlbumArtist(const String &s) = 0;
/*!
* Sets the artist to \a s. If \a s is an empty string then this value will be
* cleared.
*/
virtual void setArtist(const String &s) = 0;
/*!
* Sets the composer to \a s. If \a s is an empty string then this value will
* be cleared.
*/
virtual void setComposer(const String &s) = 0;
/*!
* Sets the album to \a s. If \a s is an empty string then this value will be
* cleared.
*/
virtual void setAlbum(const String &s) = 0;
/*!
* Sets the unsynchronized lyrics to \a s. If \a s is an empty string then this
* value will be cleared.
*/
virtual void setUnsyncedLyrics(const String &s) = 0;
/*!
* Sets the comment to \a s. If \a s is an empty string then this value will be
* cleared.
@ -198,15 +301,38 @@ namespace TagLib {
virtual void setGenre(const String &s) = 0;
/*!
* Sets the year to \a i. If \a s is 0 then this value will be cleared.
* Sets the year to \a i. If \a i is 0 then this value will be cleared.
*/
virtual void setYear(unsigned int i) = 0;
/*!
* Sets the track to \a i. If \a s is 0 then this value will be cleared.
* Sets the track to \a i. If \a i is 0 then this value will be cleared.
*/
virtual void setTrack(unsigned int i) = 0;
/*!
* Sets the disc to \a i. If \a i is 0 then this value will be cleared.
*/
virtual void setDisc(unsigned int i) = 0;
/*!
* Sets the embedded cue sheet to \a s. If \a s is an empty string then
* this value will be cleared.
*/
virtual void setCuesheet(const String &s) = 0;
/*!
* Sets the ReplayGain tag to \a t. If any fields are marked as empty
* then they will be cleared.
*/
virtual void setReplaygain(ReplayGain replaygain) = 0;
/*!
* Sets the SoundCheck tag to \a s. If \a s is an empty string then this
* value will be cleared.
*/
virtual void setSoundcheck(const String &s) = 0;
/*!
* Returns \c true if the tag does not contain any data. This should be
* reimplemented in subclasses that provide more than the basic tagging
@ -242,6 +368,12 @@ namespace TagLib {
*/
Tag();
/*!
* Internal ReplayGain tag state. This is protected since subclasses should
* be able to manipulate it freely.
*/
ReplayGain rg;
private:
class TagPrivate;
TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE

View file

@ -357,7 +357,16 @@ namespace TagLib {
* \c true and returns the integer. Otherwise it sets \a *ok to \c false
* and the result is undefined.
*/
int toInt(bool *ok = nullptr) const;
int toInt(bool *ok = nullptr, int base = 10) const;
/*!
* Convert the string to a float.
*
* If the conversion was successful, it sets the value of \a *ok to
* \c true and returns the float. Otherwise it sets \a *ok to \c false
* and the result is undefined.
*/
float toFloat(bool *ok = nullptr) const;
/*!
* Returns a string with the leading and trailing whitespace stripped.

View file

@ -70,6 +70,7 @@ namespace TagLib {
class TAGLIB_EXPORT XiphComment : public TagLib::Tag
{
public:
using TagLib::Tag::ReplayGain;
/*!
* Constructs an empty Vorbis comment.
*/
@ -89,20 +90,34 @@ namespace TagLib {
XiphComment &operator=(const XiphComment &) = delete;
String title() const override;
String albumartist() const override;
String artist() const override;
String composer() const override;
String album() const override;
String unsyncedlyrics() const override;
String comment() const override;
String genre() const override;
unsigned int year() const override;
unsigned int track() const override;
unsigned int disc() const override;
String cuesheet() const override;
ReplayGain replaygain() const override;
String soundcheck() const override;
void setTitle(const String &s) override;
void setAlbumArtist(const String &s) override;
void setArtist(const String &s) override;
void setComposer(const String &s) override;
void setAlbum(const String &s) override;
void setUnsyncedLyrics(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;
void setDisc(unsigned int i) override;
void setCuesheet(const String &s) override;
void setReplaygain(ReplayGain r) override;
void setSoundcheck(const String &s) override;
bool isEmpty() const override;

View file

@ -9,11 +9,11 @@
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>org.taglib.tag</string>
<string></string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>tag</string>
<string></string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleSignature</key>
@ -21,7 +21,7 @@
<key>CFBundleVersion</key>
<string></string>
<key>CFBundleShortVersionString</key>
<string>2.0.2</string>
<string></string>
<key>CSResourcesFileMapped</key>
<true/>
</dict>

3162
ThirdParty/Frameworks/taglib.patch vendored Normal file

File diff suppressed because it is too large Load diff