diff options
author | Michael Helmling <helmling@mathematik.uni-kl.de> | 2012-01-21 23:05:59 +0100 |
---|---|---|
committer | Michael Helmling <helmling@mathematik.uni-kl.de> | 2012-01-21 23:05:59 +0100 |
commit | a5e45f196b472db5e01b92ec84bdf5d59ac0fc56 (patch) | |
tree | 0a5cbf8b2820444b27d6a22d60843a9d13c36850 /taglib/mpc | |
parent | e4d955d6ef703be049f47df278b30e567ab27924 (diff) |
Started to work on ID3v2.
Diffstat (limited to 'taglib/mpc')
-rw-r--r-- | taglib/mpc/mpcfile.cpp | 35 | ||||
-rw-r--r-- | taglib/mpc/mpcfile.h | 14 |
2 files changed, 29 insertions, 20 deletions
diff --git a/taglib/mpc/mpcfile.cpp b/taglib/mpc/mpcfile.cpp index 2482a90c..6b372a60 100644 --- a/taglib/mpc/mpcfile.cpp +++ b/taglib/mpc/mpcfile.cpp @@ -113,27 +113,34 @@ TagLib::Tag *MPC::File::tag() const return &d->tag; } -TagLib::TagDict MPC::File::toDict(void) const +PropertyMap MPC::File::properties() const { - // once Tag::toDict() is virtual, this case distinction could actually be done - // within TagUnion. - if (d->hasAPE) - return d->tag.access<APE::Tag>(APEIndex, false)->toDict(); - if (d->hasID3v1) - return d->tag.access<ID3v1::Tag>(ID3v1Index, false)->toDict(); - return TagLib::TagDict(); + if(d->hasAPE) + return d->tag.access<APE::Tag>(APEIndex, false)->properties(); + if(d->hasID3v1) + return d->tag.access<ID3v1::Tag>(ID3v1Index, false)->properties(); + return PropertyMap(); +} + +void MPC::File::removeUnsupportedProperties(const StringList &properties) +{ + if(d->hasAPE) + d->tag.access<APE::Tag>(APEIndex, false)->removeUnsupportedProperties(properties); + if(d->hasID3v1) + d->tag.access<ID3v1::Tag>(ID3v1Index, false)->removeUnsupportedProperties(properties); } -void MPC::File::fromDict(const TagDict &dict) +PropertyMap MPC::File::setProperties(const PropertyMap &properties) { - if (d->hasAPE) - d->tag.access<APE::Tag>(APEIndex, false)->fromDict(dict); - else if (d->hasID3v1) - d->tag.access<ID3v1::Tag>(ID3v1Index, false)->fromDict(dict); + if(d->hasAPE) + return d->tag.access<APE::Tag>(APEIndex, false)->setProperties(properties); + else if(d->hasID3v1) + return d->tag.access<ID3v1::Tag>(ID3v1Index, false)->setProperties(properties); else - d->tag.access<APE::Tag>(APEIndex, true)->fromDict(dict); + return d->tag.access<APE::Tag>(APE, true)->setProperties(properties); } + MPC::Properties *MPC::File::audioProperties() const { return d->properties; diff --git a/taglib/mpc/mpcfile.h b/taglib/mpc/mpcfile.h index 6ff91e71..c906ae67 100644 --- a/taglib/mpc/mpcfile.h +++ b/taglib/mpc/mpcfile.h @@ -109,18 +109,20 @@ namespace TagLib { virtual TagLib::Tag *tag() const; /*! - * Implements the unified tag dictionary interface -- export function. + * Implements the unified property interface -- export function. * If the file contains both an APE and an ID3v1 tag, only the APE - * tag will be converted to the TagDict. + * tag will be converted to the PropertyMap. */ - TagDict toDict() const; + PropertyMap properties() const; + + void removeUnsupportedProperties(const StringList &properties); /*! - * Implements the unified tag dictionary interface -- import function. + * Implements the unified property interface -- import function. * As with the export, only one tag is taken into account. If the file - * has no tag at all, APE will be created. + * has no tag at all, an APE tag will be created. */ - void fromDict(const TagDict &); + PropertyMap setProperties(const PropertyMap &); /*! * Returns the MPC::Properties for this file. If no audio properties |