From 08863dec0bb3ae324e53041378de6ef707ae584b Mon Sep 17 00:00:00 2001 From: Michael Helmling Date: Thu, 3 Jan 2013 23:20:15 +0100 Subject: [PATCH] Found and fixed more missing property interface forwarders. Probably due to a copy-and-paste error the implementation of File::removeUnsupportedProperties() contained cases for several type which do not reimplement this method; for others the implementation was missing and is now included. In addition, the formats Speex and Opus suffered from the same bug as OggFLAC in the commit before, which is now fixed. --- taglib/ogg/opus/opusfile.cpp | 11 +++++++++++ taglib/ogg/opus/opusfile.h | 12 ++++++++++++ taglib/ogg/speex/speexfile.cpp | 11 +++++++++++ taglib/ogg/speex/speexfile.h | 14 ++++++++++++++ taglib/riff/aiff/aifffile.cpp | 5 +++++ taglib/riff/aiff/aifffile.h | 2 ++ taglib/riff/wav/wavfile.cpp | 9 +++++++-- taglib/riff/wav/wavfile.h | 2 ++ taglib/toolkit/tfile.cpp | 10 ---------- taglib/trueaudio/trueaudiofile.cpp | 6 ++++++ taglib/trueaudio/trueaudiofile.h | 2 ++ taglib/wavpack/wavpackfile.cpp | 8 ++++++++ taglib/wavpack/wavpackfile.h | 2 ++ 13 files changed, 82 insertions(+), 12 deletions(-) diff --git a/taglib/ogg/opus/opusfile.cpp b/taglib/ogg/opus/opusfile.cpp index ecbc218d..8d3af7af 100644 --- a/taglib/ogg/opus/opusfile.cpp +++ b/taglib/ogg/opus/opusfile.cpp @@ -31,6 +31,7 @@ #include #include +#include #include "opusfile.h" @@ -82,6 +83,16 @@ Ogg::XiphComment *Opus::File::tag() const return d->comment; } +PropertyMap Opus::File::properties() const +{ + return d->comment->properties(); +} + +PropertyMap Opus::File::setProperties(const PropertyMap &properties) +{ + return d->comment->setProperties(properties); +} + Opus::Properties *Opus::File::audioProperties() const { return d->properties; diff --git a/taglib/ogg/opus/opusfile.h b/taglib/ogg/opus/opusfile.h index 73375af8..736235c6 100644 --- a/taglib/ogg/opus/opusfile.h +++ b/taglib/ogg/opus/opusfile.h @@ -86,6 +86,18 @@ namespace TagLib { */ virtual Ogg::XiphComment *tag() const; + /*! + * Implements the unified property interface -- export function. + * This forwards directly to XiphComment::properties(). + */ + PropertyMap properties() const; + + /*! + * Implements the unified tag dictionary interface -- import function. + * Like properties(), this is a forwarder to the file's XiphComment. + */ + PropertyMap setProperties(const PropertyMap &); + /*! * Returns the Opus::Properties for this file. If no audio properties * were read then this will return a null pointer. diff --git a/taglib/ogg/speex/speexfile.cpp b/taglib/ogg/speex/speexfile.cpp index 8ac86e69..e83f0ad9 100644 --- a/taglib/ogg/speex/speexfile.cpp +++ b/taglib/ogg/speex/speexfile.cpp @@ -31,6 +31,7 @@ #include #include +#include #include "speexfile.h" @@ -84,6 +85,16 @@ Ogg::XiphComment *Speex::File::tag() const return d->comment; } +PropertyMap Speex::File::properties() const +{ + return d->comment->properties(); +} + +PropertyMap Speex::File::setProperties(const PropertyMap &properties) +{ + return d->comment->setProperties(properties); +} + Speex::Properties *Speex::File::audioProperties() const { return d->properties; diff --git a/taglib/ogg/speex/speexfile.h b/taglib/ogg/speex/speexfile.h index dfe51ec4..2bbf8f40 100644 --- a/taglib/ogg/speex/speexfile.h +++ b/taglib/ogg/speex/speexfile.h @@ -86,12 +86,26 @@ namespace TagLib { */ virtual Ogg::XiphComment *tag() const; + /*! + * Implements the unified property interface -- export function. + * This forwards directly to XiphComment::properties(). + */ + PropertyMap properties() const; + + /*! + * Implements the unified tag dictionary interface -- import function. + * Like properties(), this is a forwarder to the file's XiphComment. + */ + PropertyMap setProperties(const PropertyMap &); + /*! * Returns the Speex::Properties for this file. If no audio properties * were read then this will return a null pointer. */ virtual Properties *audioProperties() const; + + virtual bool save(); private: diff --git a/taglib/riff/aiff/aifffile.cpp b/taglib/riff/aiff/aifffile.cpp index ece84f05..19b80c8a 100644 --- a/taglib/riff/aiff/aifffile.cpp +++ b/taglib/riff/aiff/aifffile.cpp @@ -90,6 +90,11 @@ PropertyMap RIFF::AIFF::File::properties() const return d->tag->properties(); } +void RIFF::AIFF::File::removeUnsupportedProperties(const StringList &unsupported) +{ + d->tag->removeUnsupportedProperties(unsupported); +} + PropertyMap RIFF::AIFF::File::setProperties(const PropertyMap &properties) { return d->tag->setProperties(properties); diff --git a/taglib/riff/aiff/aifffile.h b/taglib/riff/aiff/aifffile.h index e1284db0..f2ce0ba2 100644 --- a/taglib/riff/aiff/aifffile.h +++ b/taglib/riff/aiff/aifffile.h @@ -92,6 +92,8 @@ namespace TagLib { */ PropertyMap properties() const; + void removeUnsupportedProperties(const StringList &properties); + /*! * Implements the unified property interface -- import function. * This method forwards to ID3v2::Tag::setProperties(). diff --git a/taglib/riff/wav/wavfile.cpp b/taglib/riff/wav/wavfile.cpp index 0ba40665..43f2d812 100644 --- a/taglib/riff/wav/wavfile.cpp +++ b/taglib/riff/wav/wavfile.cpp @@ -103,12 +103,17 @@ RIFF::Info::Tag *RIFF::WAV::File::InfoTag() const PropertyMap RIFF::WAV::File::properties() const { - return d->tag.properties(); + return tag()->properties(); +} + +void RIFF::WAV::File::removeUnsupportedProperties(const StringList &unsupported) +{ + tag()->removeUnsupportedProperties(unsupported); } PropertyMap RIFF::WAV::File::setProperties(const PropertyMap &properties) { - return d->tag.setProperties(properties); + return tag()->setProperties(properties); } RIFF::WAV::Properties *RIFF::WAV::File::audioProperties() const diff --git a/taglib/riff/wav/wavfile.h b/taglib/riff/wav/wavfile.h index 18ce2336..980f6e4d 100644 --- a/taglib/riff/wav/wavfile.h +++ b/taglib/riff/wav/wavfile.h @@ -117,6 +117,8 @@ namespace TagLib { */ PropertyMap properties() const; + void removeUnsupportedProperties(const StringList &properties); + /*! * Implements the unified property interface -- import function. * This method forwards to ID3v2::Tag::setProperties(). diff --git a/taglib/toolkit/tfile.cpp b/taglib/toolkit/tfile.cpp index 7251f3f7..fdb5237f 100644 --- a/taglib/toolkit/tfile.cpp +++ b/taglib/toolkit/tfile.cpp @@ -172,26 +172,16 @@ void File::removeUnsupportedProperties(const StringList &properties) dynamic_cast(this)->removeUnsupportedProperties(properties); else if(dynamic_cast(this)) dynamic_cast(this)->removeUnsupportedProperties(properties); - else if(dynamic_cast(this)) - dynamic_cast(this)->removeUnsupportedProperties(properties); - else if(dynamic_cast(this)) - dynamic_cast(this)->removeUnsupportedProperties(properties); - else if(dynamic_cast(this)) - dynamic_cast(this)->removeUnsupportedProperties(properties); else if(dynamic_cast(this)) dynamic_cast(this)->removeUnsupportedProperties(properties); else if(dynamic_cast(this)) dynamic_cast(this)->removeUnsupportedProperties(properties); else if(dynamic_cast(this)) dynamic_cast(this)->removeUnsupportedProperties(properties); - else if(dynamic_cast(this)) - dynamic_cast(this)->removeUnsupportedProperties(properties); else if(dynamic_cast(this)) dynamic_cast(this)->removeUnsupportedProperties(properties); else if(dynamic_cast(this)) dynamic_cast(this)->removeUnsupportedProperties(properties); - else if(dynamic_cast(this)) - dynamic_cast(this)->removeUnsupportedProperties(properties); else if(dynamic_cast(this)) dynamic_cast(this)->removeUnsupportedProperties(properties); else if(dynamic_cast(this)) diff --git a/taglib/trueaudio/trueaudiofile.cpp b/taglib/trueaudio/trueaudiofile.cpp index 85e5a21b..9bac29f0 100644 --- a/taglib/trueaudio/trueaudiofile.cpp +++ b/taglib/trueaudio/trueaudiofile.cpp @@ -139,6 +139,12 @@ PropertyMap TrueAudio::File::properties() const return PropertyMap(); } +void TrueAudio::File::removeUnsupportedProperties(const StringList &unsupported) +{ + if(d->hasID3v2) + d->tag.access(TrueAudioID3v2Index, false)->removeUnsupportedProperties(unsupported); +} + PropertyMap TrueAudio::File::setProperties(const PropertyMap &properties) { if(d->hasID3v1) diff --git a/taglib/trueaudio/trueaudiofile.h b/taglib/trueaudio/trueaudiofile.h index 1b8a9353..be31089e 100644 --- a/taglib/trueaudio/trueaudiofile.h +++ b/taglib/trueaudio/trueaudiofile.h @@ -144,6 +144,8 @@ namespace TagLib { */ PropertyMap setProperties(const PropertyMap &); + void removeUnsupportedProperties(const StringList &properties); + /*! * Returns the TrueAudio::Properties for this file. If no audio properties * were read then this will return a null pointer. diff --git a/taglib/wavpack/wavpackfile.cpp b/taglib/wavpack/wavpackfile.cpp index 78df182d..3754ea86 100644 --- a/taglib/wavpack/wavpackfile.cpp +++ b/taglib/wavpack/wavpackfile.cpp @@ -117,6 +117,14 @@ PropertyMap WavPack::File::properties() const return PropertyMap(); } + +void WavPack::File::removeUnsupportedProperties(const StringList &unsupported) +{ + if(d->hasAPE) + d->tag.access(WavAPEIndex, false)->removeUnsupportedProperties(unsupported); +} + + PropertyMap WavPack::File::setProperties(const PropertyMap &properties) { if(d->hasID3v1) diff --git a/taglib/wavpack/wavpackfile.h b/taglib/wavpack/wavpackfile.h index 918edca8..7d4fafee 100644 --- a/taglib/wavpack/wavpackfile.h +++ b/taglib/wavpack/wavpackfile.h @@ -116,6 +116,8 @@ namespace TagLib { */ PropertyMap properties() const; + void removeUnsupportedProperties(const StringList &properties); + /*! * Implements the unified property interface -- import function. * Creates an APE tag if it does not exists and calls setProperties() on