Implemented dict interface for more formats.

Now supported: MOD files (IT, MOD, S3M, XM), RIFF files
(AIFF, WAV), TrueAudio, WavPack.
This commit is contained in:
Michael Helmling
2011-11-02 21:02:35 +01:00
parent 292a377d1e
commit 0eaf3a3fbd
20 changed files with 315 additions and 29 deletions

View File

@ -105,6 +105,25 @@ TagLib::Tag *WavPack::File::tag() const
return &d->tag;
}
TagLib::TagDict WavPack::File::toDict(void) const
{
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();
}
void WavPack::File::fromDict(const TagDict &dict)
{
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);
else
d->tag.access<APE::Tag>(APE, true)->fromDict(dict);
}
WavPack::Properties *WavPack::File::audioProperties() const
{
return d->properties;

View File

@ -106,6 +106,20 @@ namespace TagLib {
*/
virtual TagLib::Tag *tag() const;
/*!
* Implements the unified tag dictionary interface -- export function.
* If the file contains both an APE and an ID3v1 tag, only APE
* will be converted to the TagDict.
*/
TagDict toDict() const;
/*!
* Implements the unified tag dictionary interface -- import function.
* As for the export, only one tag is taken into account. If the file
* has no tag at all, APE will be created.
*/
void fromDict(const TagDict &);
/*!
* Returns the MPC::Properties for this file. If no audio properties
* were read then this will return a null pointer.