mirror of
https://github.com/taglib/taglib.git
synced 2026-02-14 04:03:04 -05:00
Migration to new PropertyMap ... done ape to mod.
This commit is contained in:
@ -138,29 +138,39 @@ TagLib::Tag *FLAC::File::tag() const
|
||||
return &d->tag;
|
||||
}
|
||||
|
||||
TagLib::TagDict FLAC::File::toDict(void) const
|
||||
PropertyMap FLAC::File::properties() const
|
||||
{
|
||||
// once Tag::toDict() is virtual, this case distinction could actually be done
|
||||
// once Tag::properties() is virtual, this case distinction could actually be done
|
||||
// within TagUnion.
|
||||
if (d->hasXiphComment)
|
||||
return d->tag.access<Ogg::XiphComment>(XiphIndex, false)->toDict();
|
||||
if (d->hasID3v2)
|
||||
return d->tag.access<ID3v2::Tag>(ID3v2Index, false)->toDict();
|
||||
if (d->hasID3v1)
|
||||
return d->tag.access<ID3v1::Tag>(ID3v1Index, false)->toDict();
|
||||
return TagLib::TagDict();
|
||||
if(d->hasXiphComment)
|
||||
return d->tag.access<Ogg::XiphComment>(XiphIndex, false)->properties();
|
||||
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();
|
||||
}
|
||||
|
||||
void FLAC::File::fromDict(const TagDict &dict)
|
||||
void FLAC::File::removeUnsupportedProperties(const StringList &unsupported)
|
||||
{
|
||||
if (d->hasXiphComment)
|
||||
d->tag.access<Ogg::XiphComment>(XiphIndex, false)->fromDict(dict);
|
||||
else if (d->hasID3v2)
|
||||
d->tag.access<ID3v2::Tag>(ID3v2Index, false)->fromDict(dict);
|
||||
else if (d->hasID3v1)
|
||||
d->tag.access<ID3v1::Tag>(ID3v1Index, false)->fromDict(dict);
|
||||
if(d->hasXiphComment)
|
||||
d->tag.access<Ogg::XiphComment>(XiphIndex, false)->removeUnsupportedProperties(unsupported);
|
||||
if(d->hasID3v2)
|
||||
d->tag.access<ID3v2::Tag>(ID3v2Index, false)->removeUnsupportedProperties(unsupported);
|
||||
if(d->hasID3v1)
|
||||
d->tag.access<ID3v1::Tag>(ID3v1Index, false)->removeUnsupportedProperties(unsupported);
|
||||
}
|
||||
|
||||
PropertyMap FLAC::File::setProperties(const PropertyMap &properties)
|
||||
{
|
||||
if(d->hasXiphComment)
|
||||
return d->tag.access<Ogg::XiphComment>(XiphIndex, false)->setProperties(properties);
|
||||
else 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
|
||||
d->tag.access<Ogg::XiphComment>(XiphIndex, true)->fromDict(dict);
|
||||
return d->tag.access<Ogg::XiphComment>(XiphIndex, true)->setProperties(properties);
|
||||
}
|
||||
|
||||
FLAC::Properties *FLAC::File::audioProperties() const
|
||||
|
||||
@ -119,19 +119,21 @@ 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 more than one tag (e.g. XiphComment and ID3v1),
|
||||
* only the first one (in the order XiphComment, ID3v2, ID3v1) will be
|
||||
* converted to the TagDict.
|
||||
* converted to the PropertyMap.
|
||||
*/
|
||||
TagDict toDict() const;
|
||||
PropertyMap properties() const;
|
||||
|
||||
void removeUnsupportedProperties(const StringList &);
|
||||
|
||||
/*!
|
||||
* 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, a XiphComment will be created.
|
||||
*/
|
||||
void fromDict(const TagDict &);
|
||||
PropertyMap setProperties(const PropertyMap &);
|
||||
|
||||
/*!
|
||||
* Returns the FLAC::Properties for this file. If no audio properties
|
||||
|
||||
Reference in New Issue
Block a user