Rearrange conditional blocks for supported formats (#1262)

Now the created binary is not longer the same, but the code gets
more readable.
This commit is contained in:
Urs Fleisch
2025-01-31 09:36:29 +01:00
parent 9940cba549
commit 97e72e179c
10 changed files with 268 additions and 454 deletions

View File

@ -1,26 +1,30 @@
set(tag_c_HDR_DIRS
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/toolkit
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/mpeg
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/mpeg/id3v2
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/mpeg/id3v2/frames
)
if(WITH_ASF)
set(tag_c_HDR_DIRS ${tag_c_HDR_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/asf
)
endif()
set(tag_c_HDR_DIRS ${tag_c_HDR_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/mpeg
)
if(WITH_VORBIS)
set(tag_c_HDR_DIRS ${tag_c_HDR_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/ogg
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/ogg/vorbis
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/ogg/flac
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/flac
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/ogg/speex
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/ogg/opus
)
endif()
if(WITH_APE)
set(tag_c_HDR_DIRS ${tag_c_HDR_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/mpc
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/wavpack
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/ape
)
endif()
if(WITH_MP4)
@ -28,20 +32,6 @@ if(WITH_MP4)
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/mp4
)
endif()
set(tag_c_HDR_DIRS ${tag_c_HDR_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/mpeg/id3v2
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/mpeg/id3v2/frames
)
if(WITH_APE)
set(tag_c_HDR_DIRS ${tag_c_HDR_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/wavpack
)
endif()
if(WITH_VORBIS)
set(tag_c_HDR_DIRS ${tag_c_HDR_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/ogg/speex
)
endif()
if(WITH_TRUEAUDIO)
set(tag_c_HDR_DIRS ${tag_c_HDR_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/trueaudio
@ -54,11 +44,6 @@ if(WITH_RIFF)
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/riff/wav
)
endif()
if(WITH_APE)
set(tag_c_HDR_DIRS ${tag_c_HDR_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/ape
)
endif()
if(WITH_MOD)
set(tag_c_HDR_DIRS ${tag_c_HDR_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/it
@ -67,11 +52,6 @@ if(WITH_MOD)
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/xm
)
endif()
if(WITH_VORBIS)
set(tag_c_HDR_DIRS ${tag_c_HDR_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/ogg/opus
)
endif()
if(WITH_DSF)
set(tag_c_HDR_DIRS ${tag_c_HDR_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/dsf

View File

@ -35,24 +35,23 @@
#include "tfile.h"
#include "tpropertymap.h"
#include "fileref.h"
#include "mpegfile.h"
#include "tag.h"
#include "id3v2framefactory.h"
#ifdef WITH_ASF
#include "asffile.h"
#endif
#ifdef WITH_VORBIS
#include "vorbisfile.h"
#endif
#include "mpegfile.h"
#ifdef WITH_VORBIS
#include "flacfile.h"
#include "oggflacfile.h"
#include "speexfile.h"
#include "opusfile.h"
#endif
#ifdef WITH_APE
#include "mpcfile.h"
#include "wavpackfile.h"
#endif
#ifdef WITH_VORBIS
#include "speexfile.h"
#endif
#ifdef WITH_TRUEAUDIO
#include "trueaudiofile.h"
#endif
@ -72,9 +71,6 @@
#include "s3mfile.h"
#include "xmfile.h"
#endif
#ifdef WITH_VORBIS
#include "opusfile.h"
#endif
#ifdef WITH_DSF
#include "dsffile.h"
#include "dsdifffile.h"
@ -82,8 +78,6 @@
#ifdef WITH_SHORTEN
#include "shortenfile.h"
#endif
#include "tag.h"
#include "id3v2framefactory.h"
using namespace TagLib;
@ -167,25 +161,25 @@ TagLib_File *taglib_file_new_type(const char *filename, TagLib_File_Type type)
case TagLib_File_FLAC:
file = new FLAC::File(filename);
break;
case TagLib_File_OggFlac:
file = new Ogg::FLAC::File(filename);
break;
case TagLib_File_Speex:
file = new Ogg::Speex::File(filename);
break;
case TagLib_File_Opus:
file = new Ogg::Opus::File(filename);
break;
#endif
#ifdef WITH_APE
case TagLib_File_MPC:
file = new MPC::File(filename);
break;
#endif
#ifdef WITH_VORBIS
case TagLib_File_OggFlac:
file = new Ogg::FLAC::File(filename);
break;
#endif
#ifdef WITH_APE
case TagLib_File_WavPack:
file = new WavPack::File(filename);
break;
#endif
#ifdef WITH_VORBIS
case TagLib_File_Speex:
file = new Ogg::Speex::File(filename);
case TagLib_File_APE:
file = new APE::File(filename);
break;
#endif
#ifdef WITH_TRUEAUDIO
@ -211,11 +205,6 @@ TagLib_File *taglib_file_new_type(const char *filename, TagLib_File_Type type)
file = new RIFF::WAV::File(filename);
break;
#endif
#ifdef WITH_APE
case TagLib_File_APE:
file = new APE::File(filename);
break;
#endif
#ifdef WITH_MOD
case TagLib_File_IT:
file = new IT::File(filename);
@ -230,11 +219,6 @@ TagLib_File *taglib_file_new_type(const char *filename, TagLib_File_Type type)
file = new XM::File(filename);
break;
#endif
#ifdef WITH_VORBIS
case TagLib_File_Opus:
file = new Ogg::Opus::File(filename);
break;
#endif
#ifdef WITH_DSF
case TagLib_File_DSF:
file = new DSF::File(filename);