Compile time configuration of supported formats (#1262)

CMake options WITH_APE, WITH_ASF, WITH_DSF, WITH_MOD, WITH_MP4,
WITH_RIFF, WITH_SHORTEN, WITH_TRUEAUDIO, WITH_VORBIS, by default,
they are all ON.
This commit is contained in:
Urs Fleisch
2025-02-02 12:24:26 +01:00
committed by GitHub
parent 648f5e5882
commit ee1931b811
20 changed files with 1162 additions and 500 deletions

View File

@ -25,11 +25,14 @@
#include "mpegfile.h"
#include "taglib_config.h"
#include "id3v2framefactory.h"
#include "tdebug.h"
#include "tpropertymap.h"
#ifdef TAGLIB_WITH_APE
#include "apefooter.h"
#include "apetag.h"
#endif
#include "id3v1tag.h"
#include "id3v2tag.h"
#include "tagunion.h"
@ -277,6 +280,7 @@ bool MPEG::File::save(int tags, StripTags strip, ID3v2::Version version, Duplica
}
}
#ifdef TAGLIB_WITH_APE
if(APE & tags) {
if(APETag() && !APETag()->isEmpty()) {
@ -305,6 +309,7 @@ bool MPEG::File::save(int tags, StripTags strip, ID3v2::Version version, Duplica
File::strip(APE, false);
}
}
#endif
return true;
}
@ -321,7 +326,11 @@ ID3v1::Tag *MPEG::File::ID3v1Tag(bool create)
APE::Tag *MPEG::File::APETag(bool create)
{
#ifdef TAGLIB_WITH_APE
return d->tag.access<APE::Tag>(APEIndex, create);
#else
return nullptr;
#endif
}
bool MPEG::File::strip(int tags, bool freeMemory)
@ -480,6 +489,7 @@ void MPEG::File::read(bool readProperties, Properties::ReadStyle readStyle)
if(d->ID3v1Location >= 0)
d->tag.set(ID3v1Index, new ID3v1::Tag(this, d->ID3v1Location));
#ifdef TAGLIB_WITH_APE
// Look for an APE tag
d->APELocation = Utils::findAPE(this, d->ID3v1Location);
@ -489,6 +499,7 @@ void MPEG::File::read(bool readProperties, Properties::ReadStyle readStyle)
d->APEOriginalSize = APETag()->footer()->completeTagSize();
d->APELocation = d->APELocation + APE::Footer::size() - d->APEOriginalSize;
}
#endif
if(readProperties)
d->properties = std::make_unique<Properties>(this, readStyle);

View File

@ -25,10 +25,13 @@
#include "mpegproperties.h"
#include "taglib_config.h"
#include "tdebug.h"
#include "mpegfile.h"
#include "xingheader.h"
#ifdef TAGLIB_WITH_APE
#include "apetag.h"
#endif
using namespace TagLib;