This commit is contained in:
Lukáš Lalinský
2012-03-17 10:41:02 +01:00
61 changed files with 2332 additions and 7 deletions

View File

@ -31,6 +31,8 @@
#include <tstring.h>
#include <tdebug.h>
#include <tagunion.h>
#include <tstringlist.h>
#include <tpropertymap.h>
#include "trueaudiofile.h"
#include "id3v1tag.h"
@ -126,6 +128,27 @@ TagLib::Tag *TrueAudio::File::tag() const
return &d->tag;
}
PropertyMap TrueAudio::File::properties() const
{
// once Tag::properties() is virtual, this case distinction could actually be done
// within TagUnion.
if(d->hasID3v2)
return d->tag.access<ID3v2::Tag>(ID3v2Index, false)->properties();
if(d->hasID3v1)
return d->tag.access<ID3v1::Tag>(ID3v1Index, false)->properties();
return PropertyMap();
}
PropertyMap TrueAudio::File::setProperties(const PropertyMap &properties)
{
if(d->hasID3v2)
return d->tag.access<ID3v2::Tag>(ID3v2Index, false)->setProperties(properties);
else if(d->hasID3v1)
return d->tag.access<ID3v1::Tag>(ID3v1Index, false)->setProperties(properties);
else
return d->tag.access<ID3v2::Tag>(ID3v2Index, true)->setProperties(properties);
}
TrueAudio::Properties *TrueAudio::File::audioProperties() const
{
return d->properties;

View File

@ -124,6 +124,20 @@ namespace TagLib {
*/
virtual TagLib::Tag *tag() const;
/*!
* Implements the unified property interface -- export function.
* If the file contains both ID3v1 and v2 tags, only ID3v2 will be
* converted to the PropertyMap.
*/
PropertyMap properties() const;
/*!
* 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, ID3v2 will be created.
*/
PropertyMap setProperties(const PropertyMap &);
/*!
* Returns the TrueAudio::Properties for this file. If no audio properties
* were read then this will return a null pointer.