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 2024-12-28 10:20:20 +01:00
parent 648f5e5882
commit 9940cba549
20 changed files with 1090 additions and 269 deletions

View File

@ -97,6 +97,16 @@ set(TAGLIB_SOVERSION_PATCH 2)
include(ConfigureChecks.cmake)
option(WITH_APE "Build with APE, MPC, WavPack" ON)
option(WITH_ASF "Build with ASF" ON)
option(WITH_DSF "Build with DSF" ON)
option(WITH_MOD "Build with Tracker modules" ON)
option(WITH_MP4 "Build with MP4" ON)
option(WITH_RIFF "Build with AIFF, RIFF, WAV" ON)
option(WITH_SHORTEN "Build with Shorten" ON)
option(WITH_TRUEAUDIO "Build with TrueAudio" ON)
option(WITH_VORBIS "Build with Vorbis, FLAC, Ogg, Opus" ON)
# Determine whether zlib is installed.
option(WITH_ZLIB "Build with ZLIB" ON)

View File

@ -1,32 +1,89 @@
include_directories(
set(tag_c_HDR_DIRS
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/toolkit
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/asf
)
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
${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/mpc
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/mp4
)
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
)
endif()
if(WITH_APE)
set(tag_c_HDR_DIRS ${tag_c_HDR_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/mpc
)
endif()
if(WITH_MP4)
set(tag_c_HDR_DIRS ${tag_c_HDR_DIRS}
${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
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/wavpack
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/ogg/speex
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/trueaudio
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/riff
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/riff/aiff
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/riff/wav
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/ape
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/it
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/mod
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/s3m
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/xm
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/ogg/opus
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/dsf
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/dsdiff
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/shorten
)
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
)
endif()
if(WITH_RIFF)
set(tag_c_HDR_DIRS ${tag_c_HDR_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/riff
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/riff/aiff
${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
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/mod
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/s3m
${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
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/dsdiff
)
endif()
if(WITH_SHORTEN)
set(tag_c_HDR_DIRS ${tag_c_HDR_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/shorten
)
endif()
include_directories(${tag_c_HDR_DIRS})
set(tag_c_HDRS tag_c.h)

View File

@ -35,27 +35,53 @@
#include "tfile.h"
#include "tpropertymap.h"
#include "fileref.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"
#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
#ifdef WITH_MP4
#include "mp4file.h"
#endif
#ifdef WITH_RIFF
#include "aifffile.h"
#include "wavfile.h"
#endif
#ifdef WITH_APE
#include "apefile.h"
#endif
#ifdef WITH_MOD
#include "itfile.h"
#include "modfile.h"
#include "s3mfile.h"
#include "xmfile.h"
#endif
#ifdef WITH_VORBIS
#include "opusfile.h"
#endif
#ifdef WITH_DSF
#include "dsffile.h"
#include "dsdifffile.h"
#endif
#ifdef WITH_SHORTEN
#include "shortenfile.h"
#endif
#include "tag.h"
#include "id3v2framefactory.h"
@ -134,42 +160,63 @@ TagLib_File *taglib_file_new_type(const char *filename, TagLib_File_Type type)
case TagLib_File_MPEG:
file = new MPEG::File(filename);
break;
#ifdef WITH_VORBIS
case TagLib_File_OggVorbis:
file = new Ogg::Vorbis::File(filename);
break;
case TagLib_File_FLAC:
file = new FLAC::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);
break;
#endif
#ifdef WITH_TRUEAUDIO
case TagLib_File_TrueAudio:
file = new TrueAudio::File(filename);
break;
#endif
#ifdef WITH_MP4
case TagLib_File_MP4:
file = new MP4::File(filename);
break;
#endif
#ifdef WITH_ASF
case TagLib_File_ASF:
file = new ASF::File(filename);
break;
#endif
#ifdef WITH_RIFF
case TagLib_File_AIFF:
file = new RIFF::AIFF::File(filename);
break;
case TagLib_File_WAV:
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);
break;
@ -182,18 +229,25 @@ TagLib_File *taglib_file_new_type(const char *filename, TagLib_File_Type type)
case TagLib_File_XM:
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);
break;
case TagLib_File_DSDIFF:
file = new DSDIFF::File(filename);
break;
#endif
#ifdef WITH_SHORTEN
case TagLib_File_SHORTEN:
file = new Shorten::File(filename);
break;
#endif
default:
break;
}

View File

@ -21,4 +21,14 @@
#cmakedefine TESTS_DIR "@TESTS_DIR@"
#cmakedefine WITH_APE 1
#cmakedefine WITH_ASF 1
#cmakedefine WITH_DSF 1
#cmakedefine WITH_MOD 1
#cmakedefine WITH_MP4 1
#cmakedefine WITH_RIFF 1
#cmakedefine WITH_SHORTEN 1
#cmakedefine WITH_TRUEAUDIO 1
#cmakedefine WITH_VORBIS 1
#endif

View File

@ -22,6 +22,10 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <iostream>
#include <cstdlib>
@ -32,7 +36,9 @@
#include "id3v2header.h"
#include "commentsframe.h"
#include "id3v1tag.h"
#ifdef WITH_APE
#include "apetag.h"
#endif
using namespace TagLib;
@ -90,6 +96,7 @@ int main(int argc, char *argv[])
else
std::cout << "file does not have a valid id3v1 tag" << std::endl;
#ifdef WITH_APE
APE::Tag *ape = f.APETag();
std::cout << std::endl << "APE" << std::endl;
@ -106,6 +113,7 @@ int main(int argc, char *argv[])
}
else
std::cout << "file does not have a valid APE tag" << std::endl;
#endif
std::cout << std::endl;
}

View File

@ -1,33 +1,82 @@
set(CMAKE_INCLUDE_CURRENT_DIR ON)
include_directories(
set(tag_HDR_DIRS
${CMAKE_CURRENT_SOURCE_DIR}/toolkit
${CMAKE_CURRENT_SOURCE_DIR}/asf
)
if(WITH_ASF)
set(tag_HDR_DIRS ${tag_HDR_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/asf
)
endif()
set(tag_HDR_DIRS ${tag_HDR_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/mpeg
${CMAKE_CURRENT_SOURCE_DIR}/ogg
${CMAKE_CURRENT_SOURCE_DIR}/ogg/flac
${CMAKE_CURRENT_SOURCE_DIR}/flac
${CMAKE_CURRENT_SOURCE_DIR}/mpc
${CMAKE_CURRENT_SOURCE_DIR}/mp4
${CMAKE_CURRENT_SOURCE_DIR}/ogg/vorbis
${CMAKE_CURRENT_SOURCE_DIR}/ogg/speex
${CMAKE_CURRENT_SOURCE_DIR}/ogg/opus
)
if(WITH_VORBIS)
set(tag_HDR_DIRS ${tag_HDR_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/ogg
${CMAKE_CURRENT_SOURCE_DIR}/ogg/flac
${CMAKE_CURRENT_SOURCE_DIR}/flac
)
endif()
if(WITH_APE)
set(tag_HDR_DIRS ${tag_HDR_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/mpc
)
endif()
if(WITH_MP4)
set(tag_HDR_DIRS ${tag_HDR_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/mp4
)
endif()
if(WITH_VORBIS)
set(tag_HDR_DIRS ${tag_HDR_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/ogg/vorbis
${CMAKE_CURRENT_SOURCE_DIR}/ogg/speex
${CMAKE_CURRENT_SOURCE_DIR}/ogg/opus
)
endif()
set(tag_HDR_DIRS ${tag_HDR_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/mpeg/id3v2
${CMAKE_CURRENT_SOURCE_DIR}/mpeg/id3v2/frames
${CMAKE_CURRENT_SOURCE_DIR}/mpeg/id3v1
${CMAKE_CURRENT_SOURCE_DIR}/ape
${CMAKE_CURRENT_SOURCE_DIR}/wavpack
${CMAKE_CURRENT_SOURCE_DIR}/trueaudio
${CMAKE_CURRENT_SOURCE_DIR}/riff
${CMAKE_CURRENT_SOURCE_DIR}/riff/aiff
${CMAKE_CURRENT_SOURCE_DIR}/riff/wav
${CMAKE_CURRENT_SOURCE_DIR}/mod
${CMAKE_CURRENT_SOURCE_DIR}/s3m
${CMAKE_CURRENT_SOURCE_DIR}/it
${CMAKE_CURRENT_SOURCE_DIR}/xm
${CMAKE_CURRENT_SOURCE_DIR}/dsf
${CMAKE_CURRENT_SOURCE_DIR}/dsdiff
${CMAKE_CURRENT_SOURCE_DIR}/shorten
)
if(WITH_APE)
set(tag_HDR_DIRS ${tag_HDR_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/ape
${CMAKE_CURRENT_SOURCE_DIR}/wavpack
)
endif()
if(WITH_TRUEAUDIO)
set(tag_HDR_DIRS ${tag_HDR_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/trueaudio
)
endif()
if(WITH_RIFF)
set(tag_HDR_DIRS ${tag_HDR_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/riff
${CMAKE_CURRENT_SOURCE_DIR}/riff/aiff
${CMAKE_CURRENT_SOURCE_DIR}/riff/wav
)
endif()
if(WITH_MOD)
set(tag_HDR_DIRS ${tag_HDR_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/mod
${CMAKE_CURRENT_SOURCE_DIR}/s3m
${CMAKE_CURRENT_SOURCE_DIR}/it
${CMAKE_CURRENT_SOURCE_DIR}/xm
)
endif()
if(WITH_DSF)
set(tag_HDR_DIRS ${tag_HDR_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/dsf
${CMAKE_CURRENT_SOURCE_DIR}/dsdiff
)
endif()
if(WITH_SHORTEN)
set(tag_HDR_DIRS ${tag_HDR_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/shorten
)
endif()
include_directories(${tag_HDR_DIRS})
set(tag_HDRS
tag.h
@ -56,6 +105,8 @@ set(tag_HDRS
mpeg/mpegproperties.h
mpeg/mpegheader.h
mpeg/xingheader.h
)
set(tag_HDRS ${tag_HDRS}
mpeg/id3v1/id3v1tag.h
mpeg/id3v1/id3v1genres.h
mpeg/id3v2/id3v2.h
@ -83,69 +134,105 @@ set(tag_HDRS
mpeg/id3v2/frames/chapterframe.h
mpeg/id3v2/frames/tableofcontentsframe.h
mpeg/id3v2/frames/podcastframe.h
ogg/oggfile.h
ogg/oggpage.h
ogg/oggpageheader.h
ogg/xiphcomment.h
ogg/vorbis/vorbisfile.h
ogg/vorbis/vorbisproperties.h
ogg/flac/oggflacfile.h
ogg/speex/speexfile.h
ogg/speex/speexproperties.h
ogg/opus/opusfile.h
ogg/opus/opusproperties.h
flac/flacfile.h
flac/flacpicture.h
flac/flacproperties.h
flac/flacmetadatablock.h
ape/apefile.h
ape/apeproperties.h
ape/apetag.h
ape/apefooter.h
ape/apeitem.h
mpc/mpcfile.h
mpc/mpcproperties.h
wavpack/wavpackfile.h
wavpack/wavpackproperties.h
trueaudio/trueaudiofile.h
trueaudio/trueaudioproperties.h
riff/rifffile.h
riff/aiff/aifffile.h
riff/aiff/aiffproperties.h
riff/wav/wavfile.h
riff/wav/wavproperties.h
riff/wav/infotag.h
asf/asffile.h
asf/asfproperties.h
asf/asftag.h
asf/asfattribute.h
asf/asfpicture.h
mp4/mp4file.h
mp4/mp4atom.h
mp4/mp4tag.h
mp4/mp4item.h
mp4/mp4properties.h
mp4/mp4coverart.h
mp4/mp4itemfactory.h
mod/modfilebase.h
mod/modfile.h
mod/modtag.h
mod/modproperties.h
it/itfile.h
it/itproperties.h
s3m/s3mfile.h
s3m/s3mproperties.h
xm/xmfile.h
xm/xmproperties.h
dsf/dsffile.h
dsf/dsfproperties.h
dsdiff/dsdifffile.h
dsdiff/dsdiffproperties.h
dsdiff/dsdiffdiintag.h
shorten/shortenfile.h
shorten/shortenproperties.h
shorten/shortentag.h
)
if(WITH_VORBIS)
set(tag_HDRS ${tag_HDRS}
ogg/oggfile.h
ogg/oggpage.h
ogg/oggpageheader.h
ogg/xiphcomment.h
ogg/vorbis/vorbisfile.h
ogg/vorbis/vorbisproperties.h
ogg/flac/oggflacfile.h
ogg/speex/speexfile.h
ogg/speex/speexproperties.h
ogg/opus/opusfile.h
ogg/opus/opusproperties.h
flac/flacfile.h
flac/flacpicture.h
flac/flacproperties.h
flac/flacmetadatablock.h
)
endif()
if(WITH_APE)
set(tag_HDRS ${tag_HDRS}
ape/apefile.h
ape/apeproperties.h
ape/apetag.h
ape/apefooter.h
ape/apeitem.h
mpc/mpcfile.h
mpc/mpcproperties.h
wavpack/wavpackfile.h
wavpack/wavpackproperties.h
)
endif()
if(WITH_TRUEAUDIO)
set(tag_HDRS ${tag_HDRS}
trueaudio/trueaudiofile.h
trueaudio/trueaudioproperties.h
)
endif()
if(WITH_RIFF)
set(tag_HDRS ${tag_HDRS}
riff/rifffile.h
riff/aiff/aifffile.h
riff/aiff/aiffproperties.h
riff/wav/wavfile.h
riff/wav/wavproperties.h
riff/wav/infotag.h
)
endif()
if(WITH_ASF)
set(tag_HDRS ${tag_HDRS}
asf/asffile.h
asf/asfproperties.h
asf/asftag.h
asf/asfattribute.h
asf/asfpicture.h
)
endif()
if(WITH_MP4)
set(tag_HDRS ${tag_HDRS}
mp4/mp4file.h
mp4/mp4atom.h
mp4/mp4tag.h
mp4/mp4item.h
mp4/mp4properties.h
mp4/mp4coverart.h
mp4/mp4itemfactory.h
)
endif()
if(WITH_MOD)
set(tag_HDRS ${tag_HDRS}
mod/modfilebase.h
mod/modfile.h
mod/modtag.h
mod/modproperties.h
it/itfile.h
it/itproperties.h
s3m/s3mfile.h
s3m/s3mproperties.h
xm/xmfile.h
xm/xmproperties.h
)
endif()
if(WITH_DSF)
set(tag_HDRS ${tag_HDRS}
dsf/dsffile.h
dsf/dsfproperties.h
dsdiff/dsdifffile.h
dsdiff/dsdiffproperties.h
dsdiff/dsdiffdiintag.h
)
endif()
if(WITH_SHORTEN)
set(tag_HDRS ${tag_HDRS}
shorten/shortenfile.h
shorten/shortenproperties.h
shorten/shortentag.h
)
endif()
set(mpeg_SRCS
mpeg/mpegfile.cpp
@ -189,134 +276,156 @@ set(frames_SRCS
mpeg/id3v2/frames/podcastframe.cpp
)
set(ogg_SRCS
ogg/oggfile.cpp
ogg/oggpage.cpp
ogg/oggpageheader.cpp
ogg/xiphcomment.cpp
)
if(WITH_VORBIS)
set(ogg_SRCS
ogg/oggfile.cpp
ogg/oggpage.cpp
ogg/oggpageheader.cpp
ogg/xiphcomment.cpp
)
set(vorbis_SRCS
ogg/vorbis/vorbisfile.cpp
ogg/vorbis/vorbisproperties.cpp
)
set(vorbis_SRCS
ogg/vorbis/vorbisfile.cpp
ogg/vorbis/vorbisproperties.cpp
)
set(flacs_SRCS
flac/flacfile.cpp
flac/flacpicture.cpp
flac/flacproperties.cpp
flac/flacmetadatablock.cpp
flac/flacunknownmetadatablock.cpp
)
set(flacs_SRCS
flac/flacfile.cpp
flac/flacpicture.cpp
flac/flacproperties.cpp
flac/flacmetadatablock.cpp
flac/flacunknownmetadatablock.cpp
)
set(oggflacs_SRCS
ogg/flac/oggflacfile.cpp
)
set(oggflacs_SRCS
ogg/flac/oggflacfile.cpp
)
endif()
set(mpc_SRCS
mpc/mpcfile.cpp
mpc/mpcproperties.cpp
)
if(WITH_APE)
set(mpc_SRCS
mpc/mpcfile.cpp
mpc/mpcproperties.cpp
)
endif()
set(mp4_SRCS
mp4/mp4file.cpp
mp4/mp4atom.cpp
mp4/mp4tag.cpp
mp4/mp4item.cpp
mp4/mp4properties.cpp
mp4/mp4coverart.cpp
mp4/mp4itemfactory.cpp
)
if(WITH_MP4)
set(mp4_SRCS
mp4/mp4file.cpp
mp4/mp4atom.cpp
mp4/mp4tag.cpp
mp4/mp4item.cpp
mp4/mp4properties.cpp
mp4/mp4coverart.cpp
mp4/mp4itemfactory.cpp
)
endif()
set(ape_SRCS
ape/apetag.cpp
ape/apefooter.cpp
ape/apeitem.cpp
ape/apefile.cpp
ape/apeproperties.cpp
)
if(WITH_APE)
set(ape_SRCS
ape/apetag.cpp
ape/apefooter.cpp
ape/apeitem.cpp
ape/apefile.cpp
ape/apeproperties.cpp
)
set(wavpack_SRCS
wavpack/wavpackfile.cpp
wavpack/wavpackproperties.cpp
)
set(wavpack_SRCS
wavpack/wavpackfile.cpp
wavpack/wavpackproperties.cpp
)
endif()
set(speex_SRCS
ogg/speex/speexfile.cpp
ogg/speex/speexproperties.cpp
)
if(WITH_VORBIS)
set(speex_SRCS
ogg/speex/speexfile.cpp
ogg/speex/speexproperties.cpp
)
set(opus_SRCS
ogg/opus/opusfile.cpp
ogg/opus/opusproperties.cpp
)
set(opus_SRCS
ogg/opus/opusfile.cpp
ogg/opus/opusproperties.cpp
)
endif()
set(trueaudio_SRCS
trueaudio/trueaudiofile.cpp
trueaudio/trueaudioproperties.cpp
)
if(WITH_TRUEAUDIO)
set(trueaudio_SRCS
trueaudio/trueaudiofile.cpp
trueaudio/trueaudioproperties.cpp
)
endif()
set(asf_SRCS
asf/asftag.cpp
asf/asffile.cpp
asf/asfproperties.cpp
asf/asfattribute.cpp
asf/asfpicture.cpp
)
if(WITH_ASF)
set(asf_SRCS
asf/asftag.cpp
asf/asffile.cpp
asf/asfproperties.cpp
asf/asfattribute.cpp
asf/asfpicture.cpp
)
endif()
set(riff_SRCS
riff/rifffile.cpp
)
if(WITH_RIFF)
set(riff_SRCS
riff/rifffile.cpp
)
set(aiff_SRCS
riff/aiff/aifffile.cpp
riff/aiff/aiffproperties.cpp
)
set(aiff_SRCS
riff/aiff/aifffile.cpp
riff/aiff/aiffproperties.cpp
)
set(wav_SRCS
riff/wav/wavfile.cpp
riff/wav/wavproperties.cpp
riff/wav/infotag.cpp
)
set(wav_SRCS
riff/wav/wavfile.cpp
riff/wav/wavproperties.cpp
riff/wav/infotag.cpp
)
endif()
set(mod_SRCS
mod/modfilebase.cpp
mod/modfile.cpp
mod/modtag.cpp
mod/modproperties.cpp
)
if(WITH_MOD)
set(mod_SRCS
mod/modfilebase.cpp
mod/modfile.cpp
mod/modtag.cpp
mod/modproperties.cpp
)
set(s3m_SRCS
s3m/s3mfile.cpp
s3m/s3mproperties.cpp
)
set(s3m_SRCS
s3m/s3mfile.cpp
s3m/s3mproperties.cpp
)
set(it_SRCS
it/itfile.cpp
it/itproperties.cpp
)
set(it_SRCS
it/itfile.cpp
it/itproperties.cpp
)
set(xm_SRCS
xm/xmfile.cpp
xm/xmproperties.cpp
)
set(xm_SRCS
xm/xmfile.cpp
xm/xmproperties.cpp
)
endif()
set(dsf_SRCS
dsf/dsffile.cpp
dsf/dsfproperties.cpp
)
if(WITH_DSF)
set(dsf_SRCS
dsf/dsffile.cpp
dsf/dsfproperties.cpp
)
set(dsdiff_SRCS
dsdiff/dsdifffile.cpp
dsdiff/dsdiffproperties.cpp
dsdiff/dsdiffdiintag.cpp
)
set(dsdiff_SRCS
dsdiff/dsdifffile.cpp
dsdiff/dsdiffproperties.cpp
dsdiff/dsdiffdiintag.cpp
)
endif()
set(shorten_SRCS
shorten/shortenfile.cpp
shorten/shortenproperties.cpp
shorten/shortentag.cpp
)
if(WITH_SHORTEN)
set(shorten_SRCS
shorten/shortenfile.cpp
shorten/shortenproperties.cpp
shorten/shortentag.cpp
)
endif()
set(toolkit_SRCS
toolkit/tstring.cpp

View File

@ -26,7 +26,7 @@
#ifndef TAGLIB_DSDIFFFILE_H
#define TAGLIB_DSDIFFFILE_H
#include "rifffile.h"
#include "tfile.h"
#include "id3v2tag.h"
#include "dsdiffproperties.h"
#include "dsdiffdiintag.h"

View File

@ -29,6 +29,10 @@
#include "fileref.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <cstring>
#include <utility>
@ -37,27 +41,61 @@
#include "tstringlist.h"
#include "tvariant.h"
#include "tdebug.h"
#ifdef WITH_RIFF
#include "aifffile.h"
#endif
#ifdef WITH_APE
#include "apefile.h"
#endif
#ifdef WITH_ASF
#include "asffile.h"
#endif
#ifdef WITH_VORBIS
#include "flacfile.h"
#endif
#ifdef WITH_MOD
#include "itfile.h"
#include "modfile.h"
#endif
#ifdef WITH_MP4
#include "mp4file.h"
#endif
#ifdef WITH_APE
#include "mpcfile.h"
#endif
#include "mpegfile.h"
#ifdef WITH_VORBIS
#include "oggflacfile.h"
#include "opusfile.h"
#endif
#ifdef WITH_MOD
#include "s3mfile.h"
#endif
#ifdef WITH_VORBIS
#include "speexfile.h"
#endif
#ifdef WITH_TRUEAUDIO
#include "trueaudiofile.h"
#endif
#ifdef WITH_VORBIS
#include "vorbisfile.h"
#endif
#ifdef WITH_RIFF
#include "wavfile.h"
#endif
#ifdef WITH_APE
#include "wavpackfile.h"
#endif
#ifdef WITH_MOD
#include "xmfile.h"
#endif
#ifdef WITH_DSF
#include "dsffile.h"
#include "dsdifffile.h"
#endif
#ifdef WITH_SHORTEN
#include "shortenfile.h"
#endif
using namespace TagLib;
@ -136,6 +174,7 @@ namespace
if(ext == "MP3" || ext == "MP2" || ext == "AAC")
file = new MPEG::File(stream, readAudioProperties, audioPropertiesStyle);
#ifdef WITH_VORBIS
else if(ext == "OGG")
file = new Ogg::Vorbis::File(stream, readAudioProperties, audioPropertiesStyle);
else if(ext == "OGA") {
@ -148,26 +187,42 @@ namespace
}
else if(ext == "FLAC")
file = new FLAC::File(stream, readAudioProperties, audioPropertiesStyle);
#endif
#ifdef WITH_APE
else if(ext == "MPC")
file = new MPC::File(stream, readAudioProperties, audioPropertiesStyle);
else if(ext == "WV")
file = new WavPack::File(stream, readAudioProperties, audioPropertiesStyle);
#endif
#ifdef WITH_VORBIS
else if(ext == "SPX")
file = new Ogg::Speex::File(stream, readAudioProperties, audioPropertiesStyle);
else if(ext == "OPUS")
file = new Ogg::Opus::File(stream, readAudioProperties, audioPropertiesStyle);
#endif
#ifdef WITH_TRUEAUDIO
else if(ext == "TTA")
file = new TrueAudio::File(stream, readAudioProperties, audioPropertiesStyle);
#endif
#ifdef WITH_MP4
else if(ext == "M4A" || ext == "M4R" || ext == "M4B" || ext == "M4P" || ext == "MP4" || ext == "3G2" || ext == "M4V")
file = new MP4::File(stream, readAudioProperties, audioPropertiesStyle);
#endif
#ifdef WITH_ASF
else if(ext == "WMA" || ext == "ASF")
file = new ASF::File(stream, readAudioProperties, audioPropertiesStyle);
#endif
#ifdef WITH_RIFF
else if(ext == "AIF" || ext == "AIFF" || ext == "AFC" || ext == "AIFC")
file = new RIFF::AIFF::File(stream, readAudioProperties, audioPropertiesStyle);
else if(ext == "WAV")
file = new RIFF::WAV::File(stream, readAudioProperties, audioPropertiesStyle);
#endif
#ifdef WITH_APE
else if(ext == "APE")
file = new APE::File(stream, readAudioProperties, audioPropertiesStyle);
#endif
#ifdef WITH_MOD
// module, nst and wow are possible but uncommon extensions
else if(ext == "MOD" || ext == "MODULE" || ext == "NST" || ext == "WOW")
file = new Mod::File(stream, readAudioProperties, audioPropertiesStyle);
@ -177,12 +232,17 @@ namespace
file = new IT::File(stream, readAudioProperties, audioPropertiesStyle);
else if(ext == "XM")
file = new XM::File(stream, readAudioProperties, audioPropertiesStyle);
#endif
#ifdef WITH_DSF
else if(ext == "DSF")
file = new DSF::File(stream, readAudioProperties, audioPropertiesStyle);
else if(ext == "DFF" || ext == "DSDIFF")
file = new DSDIFF::File(stream, readAudioProperties, audioPropertiesStyle);
#endif
#ifdef WITH_SHORTEN
else if(ext == "SHN")
file = new Shorten::File(stream, readAudioProperties, audioPropertiesStyle);
#endif
// if file is not valid, leave it to content-based detection.
@ -204,38 +264,58 @@ namespace
if(MPEG::File::isSupported(stream))
file = new MPEG::File(stream, readAudioProperties, audioPropertiesStyle);
#ifdef WITH_VORBIS
else if(Ogg::Vorbis::File::isSupported(stream))
file = new Ogg::Vorbis::File(stream, readAudioProperties, audioPropertiesStyle);
else if(Ogg::FLAC::File::isSupported(stream))
file = new Ogg::FLAC::File(stream, readAudioProperties, audioPropertiesStyle);
else if(FLAC::File::isSupported(stream))
file = new FLAC::File(stream, readAudioProperties, audioPropertiesStyle);
#endif
#ifdef WITH_APE
else if(MPC::File::isSupported(stream))
file = new MPC::File(stream, readAudioProperties, audioPropertiesStyle);
else if(WavPack::File::isSupported(stream))
file = new WavPack::File(stream, readAudioProperties, audioPropertiesStyle);
#endif
#ifdef WITH_VORBIS
else if(Ogg::Speex::File::isSupported(stream))
file = new Ogg::Speex::File(stream, readAudioProperties, audioPropertiesStyle);
else if(Ogg::Opus::File::isSupported(stream))
file = new Ogg::Opus::File(stream, readAudioProperties, audioPropertiesStyle);
#endif
#ifdef WITH_TRUEAUDIO
else if(TrueAudio::File::isSupported(stream))
file = new TrueAudio::File(stream, readAudioProperties, audioPropertiesStyle);
#endif
#ifdef WITH_MP4
else if(MP4::File::isSupported(stream))
file = new MP4::File(stream, readAudioProperties, audioPropertiesStyle);
#endif
#ifdef WITH_ASF
else if(ASF::File::isSupported(stream))
file = new ASF::File(stream, readAudioProperties, audioPropertiesStyle);
#endif
#ifdef WITH_RIFF
else if(RIFF::AIFF::File::isSupported(stream))
file = new RIFF::AIFF::File(stream, readAudioProperties, audioPropertiesStyle);
else if(RIFF::WAV::File::isSupported(stream))
file = new RIFF::WAV::File(stream, readAudioProperties, audioPropertiesStyle);
#endif
#ifdef WITH_APE
else if(APE::File::isSupported(stream))
file = new APE::File(stream, readAudioProperties, audioPropertiesStyle);
#endif
#ifdef WITH_DSF
else if(DSF::File::isSupported(stream))
file = new DSF::File(stream, readAudioProperties, audioPropertiesStyle);
else if(DSDIFF::File::isSupported(stream))
file = new DSDIFF::File(stream, readAudioProperties, audioPropertiesStyle);
#endif
#ifdef WITH_SHORTEN
else if(Shorten::File::isSupported(stream))
file = new Shorten::File(stream, readAudioProperties, audioPropertiesStyle);
#endif
// isSupported() only does a quick check, so double check the file here.
@ -405,17 +485,26 @@ StringList FileRef::defaultFileExtensions()
{
StringList l;
#ifdef WITH_VORBIS
l.append("ogg");
l.append("flac");
l.append("oga");
l.append("opus");
#endif
l.append("mp3");
l.append("mp2");
#ifdef WITH_APE
l.append("mpc");
l.append("wv");
#endif
#ifdef WITH_VORBIS
l.append("spx");
#endif
#ifdef WITH_TRUEAUDIO
l.append("tta");
#endif
l.append("aac");
#ifdef WITH_MP4
l.append("m4a");
l.append("m4r");
l.append("m4b");
@ -423,14 +512,22 @@ StringList FileRef::defaultFileExtensions()
l.append("3g2");
l.append("mp4");
l.append("m4v");
#endif
#ifdef WITH_ASF
l.append("wma");
l.append("asf");
#endif
#ifdef WITH_RIFF
l.append("aif");
l.append("aiff");
l.append("afc");
l.append("aifc");
l.append("wav");
#endif
#ifdef WITH_APE
l.append("ape");
#endif
#ifdef WITH_MOD
l.append("mod");
l.append("module"); // alias for "mod"
l.append("nst"); // alias for "mod"
@ -438,10 +535,15 @@ StringList FileRef::defaultFileExtensions()
l.append("s3m");
l.append("it");
l.append("xm");
#endif
#ifdef WITH_DSF
l.append("dsf");
l.append("dff");
l.append("dsdiff"); // alias for "dff"
#endif
#ifdef WITH_SHORTEN
l.append("shn");
#endif
return l;
}

View File

@ -28,8 +28,10 @@
#include "id3v2framefactory.h"
#include "tdebug.h"
#include "tpropertymap.h"
#ifdef WITH_APE
#include "apefooter.h"
#include "apetag.h"
#endif
#include "id3v1tag.h"
#include "id3v2tag.h"
#include "tagunion.h"
@ -277,6 +279,7 @@ bool MPEG::File::save(int tags, StripTags strip, ID3v2::Version version, Duplica
}
}
#ifdef WITH_APE
if(APE & tags) {
if(APETag() && !APETag()->isEmpty()) {
@ -305,6 +308,7 @@ bool MPEG::File::save(int tags, StripTags strip, ID3v2::Version version, Duplica
File::strip(APE, false);
}
}
#endif
return true;
}
@ -319,10 +323,12 @@ ID3v1::Tag *MPEG::File::ID3v1Tag(bool create)
return d->tag.access<ID3v1::Tag>(ID3v1Index, create);
}
#ifdef WITH_APE
APE::Tag *MPEG::File::APETag(bool create)
{
return d->tag.access<APE::Tag>(APEIndex, create);
}
#endif
bool MPEG::File::strip(int tags, bool freeMemory)
{
@ -480,6 +486,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 WITH_APE
// Look for an APE tag
d->APELocation = Utils::findAPE(this, d->ID3v1Location);
@ -489,6 +496,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

@ -26,6 +26,10 @@
#ifndef TAGLIB_MPEGFILE_H
#define TAGLIB_MPEGFILE_H
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "tfile.h"
#include "taglib_export.h"
#include "tag.h"
@ -266,6 +270,7 @@ namespace TagLib {
*/
ID3v1::Tag *ID3v1Tag(bool create = false);
#ifdef WITH_APE
/*!
* Returns a pointer to the APE tag of the file.
*
@ -284,6 +289,7 @@ namespace TagLib {
* \see hasAPETag()
*/
APE::Tag *APETag(bool create = false);
#endif
/*!
* This will strip the tags that match the OR-ed together TagTypes from the

View File

@ -25,10 +25,16 @@
#include "mpegproperties.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "tdebug.h"
#include "mpegfile.h"
#include "xingheader.h"
#ifdef WITH_APE
#include "apetag.h"
#endif
using namespace TagLib;

View File

@ -25,11 +25,17 @@
#include "tagutils.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "tfile.h"
#include "id3v1tag.h"
#include "id3v2header.h"
#ifdef WITH_APE
#include "apetag.h"
#endif
using namespace TagLib;
@ -45,7 +51,13 @@ offset_t Utils::findID3v1(File *file)
const offset_t p = file->tell() + 3;
if(const TagLib::ByteVector data = file->readBlock(8);
data.containsAt(ID3v1::Tag::fileIdentifier(), 3) && data != APE::Tag::fileIdentifier())
data.containsAt(ID3v1::Tag::fileIdentifier(), 3) &&
#ifdef WITH_APE
data != APE::Tag::fileIdentifier()
#else
data != ByteVector::fromCString("APETAGEX")
#endif
)
return p;
} else {
file->seek(-128, File::End);
@ -83,7 +95,13 @@ offset_t Utils::findAPE(File *file, offset_t id3v1Location)
const offset_t p = file->tell();
if(file->readBlock(8) == APE::Tag::fileIdentifier())
if(file->readBlock(8) ==
#ifdef WITH_APE
APE::Tag::fileIdentifier()
#else
ByteVector::fromCString("APETAGEX")
#endif
)
return p;
return -1;

View File

@ -1,34 +1,81 @@
INCLUDE_DIRECTORIES(
SET(test_HDR_DIRS
${CMAKE_CURRENT_SOURCE_DIR}/../taglib
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/toolkit
${CMAKE_CURRENT_SOURCE_DIR}/../bindings/c
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/ape
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/asf
)
IF(WITH_APE)
SET(test_HDR_DIRS ${test_HDR_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/ape
)
ENDIF()
IF(WITH_ASF)
SET(test_HDR_DIRS ${test_HDR_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/asf
)
ENDIF()
SET(test_HDR_DIRS ${test_HDR_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/mpeg/id3v1
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/mpeg/id3v2
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/mpeg/id3v2/frames
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/mpeg
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/mpc
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/mp4
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/riff
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/riff/aiff
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/riff/wav
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/trueaudio
${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/ogg/speex
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/ogg/opus
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/flac
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/wavpack
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/mod
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/s3m
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/it
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/xm
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/dsf
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/dsdiff
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/shorten
)
IF(WITH_APE)
SET(test_HDR_DIRS ${test_HDR_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/mpc
)
ENDIF()
IF(WITH_MP4)
SET(test_HDR_DIRS ${test_HDR_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/mp4
)
ENDIF()
IF(WITH_RIFF)
SET(test_HDR_DIRS ${test_HDR_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/riff
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/riff/aiff
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/riff/wav
)
ENDIF()
IF(WITH_TRUEAUDIO)
SET(test_HDR_DIRS ${test_HDR_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/trueaudio
)
ENDIF()
IF(WITH_VORBIS)
SET(test_HDR_DIRS ${test_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/ogg/speex
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/ogg/opus
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/flac
)
ENDIF()
IF(WITH_APE)
SET(test_HDR_DIRS ${test_HDR_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/wavpack
)
ENDIF()
IF(WITH_MOD)
SET(test_HDR_DIRS ${test_HDR_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/mod
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/s3m
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/it
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/xm
)
ENDIF()
IF(WITH_DSF)
SET(test_HDR_DIRS ${test_HDR_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/dsf
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/dsdiff
)
ENDIF()
IF(WITH_SHORTEN)
SET(test_HDR_DIRS ${test_HDR_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/shorten
)
ENDIF()
INCLUDE_DIRECTORIES(${test_HDR_DIRS})
SET(test_runner_SRCS
main.cpp
@ -36,7 +83,13 @@ SET(test_runner_SRCS
test_map.cpp
test_mpeg.cpp
test_synchdata.cpp
test_trueaudio.cpp
)
IF(WITH_TRUEAUDIO)
SET(test_runner_SRCS ${test_runner_SRCS}
test_trueaudio.cpp
)
ENDIF()
SET(test_runner_SRCS ${test_runner_SRCS}
test_bytevector.cpp
test_bytevectorlist.cpp
test_bytevectorstream.cpp
@ -46,36 +99,92 @@ SET(test_runner_SRCS
test_complexproperties.cpp
test_file.cpp
test_fileref.cpp
)
SET(test_runner_SRCS ${test_runner_SRCS}
test_id3v1.cpp
test_id3v2.cpp
test_id3v2framefactory.cpp
test_xiphcomment.cpp
test_aiff.cpp
test_riff.cpp
test_ogg.cpp
test_oggflac.cpp
test_flac.cpp
test_flacpicture.cpp
test_flacunknownmetadatablock.cpp
test_ape.cpp
test_apetag.cpp
test_wav.cpp
test_info.cpp
test_wavpack.cpp
test_mp4.cpp
test_mp4item.cpp
test_mp4coverart.cpp
test_asf.cpp
test_mod.cpp
test_s3m.cpp
test_it.cpp
test_xm.cpp
test_mpc.cpp
test_opus.cpp
test_speex.cpp
test_dsf.cpp
test_dsdiff.cpp
test_shorten.cpp
)
IF(WITH_VORBIS)
SET(test_runner_SRCS ${test_runner_SRCS}
test_xiphcomment.cpp
)
ENDIF()
IF(WITH_RIFF)
SET(test_runner_SRCS ${test_runner_SRCS}
test_aiff.cpp
test_riff.cpp
)
ENDIF()
IF(WITH_VORBIS)
SET(test_runner_SRCS ${test_runner_SRCS}
test_ogg.cpp
test_oggflac.cpp
test_flac.cpp
test_flacpicture.cpp
test_flacunknownmetadatablock.cpp
)
ENDIF()
if(WITH_APE)
SET(test_runner_SRCS ${test_runner_SRCS}
test_ape.cpp
test_apetag.cpp
)
ENDIF()
IF(WITH_RIFF)
SET(test_runner_SRCS ${test_runner_SRCS}
test_wav.cpp
test_info.cpp
)
ENDIF()
IF(WITH_APE)
SET(test_runner_SRCS ${test_runner_SRCS}
test_wavpack.cpp
)
ENDIF()
IF(WITH_MP4)
SET(test_runner_SRCS ${test_runner_SRCS}
test_mp4.cpp
test_mp4item.cpp
test_mp4coverart.cpp
)
ENDIF()
IF(WITH_ASF)
SET(test_runner_SRCS ${test_runner_SRCS}
test_asf.cpp
)
ENDIF()
IF(WITH_MOD)
SET(test_runner_SRCS ${test_runner_SRCS}
test_mod.cpp
test_s3m.cpp
test_it.cpp
test_xm.cpp
)
ENDIF()
IF(WITH_APE)
SET(test_runner_SRCS ${test_runner_SRCS}
test_mpc.cpp
)
ENDIF()
IF(WITH_VORBIS)
SET(test_runner_SRCS ${test_runner_SRCS}
test_opus.cpp
test_speex.cpp
)
ENDIF()
IF(WITH_DSF)
SET(test_runner_SRCS ${test_runner_SRCS}
test_dsf.cpp
test_dsdiff.cpp
)
ENDIF()
IF(WITH_SHORTEN)
SET(test_runner_SRCS ${test_runner_SRCS}
test_shorten.cpp
)
ENDIF()
SET(test_runner_SRCS ${test_runner_SRCS}
test_sizes.cpp
test_versionnumber.cpp
)

View File

@ -23,17 +23,33 @@
* http://www.mozilla.org/MPL/ *
***************************************************************************/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifdef WITH_ASF
#include "asfpicture.h"
#endif
#ifdef WITH_VORBIS
#include "flacpicture.h"
#include "flacfile.h"
#endif
#include "tbytevector.h"
#include "tvariant.h"
#include "tzlib.h"
#include "fileref.h"
#ifdef WITH_APE
#include "apetag.h"
#endif
#ifdef WITH_ASF
#include "asftag.h"
#endif
#ifdef WITH_MP4
#include "mp4tag.h"
#endif
#ifdef WITH_VORBIS
#include "xiphcomment.h"
#endif
#include "id3v1tag.h"
#include "id3v2tag.h"
#include "attachedpictureframe.h"
@ -69,16 +85,28 @@ class TestComplexProperties : public CppUnit::TestFixture
{
CPPUNIT_TEST_SUITE(TestComplexProperties);
CPPUNIT_TEST(testReadMp3Picture);
#ifdef WITH_MP4
CPPUNIT_TEST(testReadM4aPicture);
#endif
#ifdef WITH_VORBIS
CPPUNIT_TEST(testReadOggPicture);
CPPUNIT_TEST(testReadWriteFlacPicture);
CPPUNIT_TEST(testReadWriteMultipleProperties);
#endif
CPPUNIT_TEST(testSetGetId3Geob);
CPPUNIT_TEST(testSetGetId3Picture);
#ifdef WITH_APE
CPPUNIT_TEST(testSetGetApePicture);
#endif
#ifdef WITH_ASF
CPPUNIT_TEST(testSetGetAsfPicture);
#endif
#ifdef WITH_MP4
CPPUNIT_TEST(testSetGetMp4Picture);
#endif
#ifdef WITH_VORBIS
CPPUNIT_TEST(testSetGetXiphPicture);
#endif
CPPUNIT_TEST(testNonExistent);
CPPUNIT_TEST_SUITE_END();
@ -103,6 +131,7 @@ public:
}
}
#ifdef WITH_MP4
void testReadM4aPicture()
{
const ByteVector expectedData1(
@ -145,7 +174,9 @@ public:
CPPUNIT_ASSERT_EQUAL(String("image/jpeg"),
picture.value("mimeType").value<String>());
}
#endif
#ifdef WITH_VORBIS
void testReadOggPicture()
{
FileRef f(TEST_FILE_PATH_C("lowercase-fields.ogg"), false);
@ -217,6 +248,7 @@ public:
CPPUNIT_ASSERT(f.pictureList().isEmpty());
}
}
#endif
void testReadWriteMultipleProperties()
{
@ -311,6 +343,7 @@ public:
CPPUNIT_ASSERT_EQUAL(ID3v2::AttachedPictureFrame::FrontCover, frame->type());
}
#ifdef WITH_APE
void testSetGetApePicture()
{
const String FRONT_COVER("COVER ART (FRONT)");
@ -326,7 +359,9 @@ public:
.append(picture.value("data").value<ByteVector>()),
item.binaryData());
}
#endif
#ifdef WITH_ASF
void testSetGetAsfPicture()
{
VariantMap picture(TEST_PICTURE);
@ -344,7 +379,9 @@ public:
asfPicture.description());
CPPUNIT_ASSERT_EQUAL(ASF::Picture::FrontCover, asfPicture.type());
}
#endif
#ifdef WITH_MP4
void testSetGetMp4Picture()
{
VariantMap picture(TEST_PICTURE);
@ -360,7 +397,9 @@ public:
covr.data());
CPPUNIT_ASSERT_EQUAL(MP4::CoverArt::JPEG, covr.format());
}
#endif
#ifdef WITH_VORBIS
void testSetGetXiphPicture()
{
VariantMap picture(TEST_PICTURE);
@ -386,6 +425,7 @@ public:
CPPUNIT_ASSERT_EQUAL(1, pic->width());
CPPUNIT_ASSERT_EQUAL(1, pic->height());
}
#endif
void testNonExistent()
{

View File

@ -23,6 +23,10 @@
* http://www.mozilla.org/MPL/ *
***************************************************************************/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <string>
#include <cstdio>
@ -30,23 +34,49 @@
#include "tbytevectorstream.h"
#include "tag.h"
#include "fileref.h"
#ifdef WITH_VORBIS
#include "oggflacfile.h"
#include "vorbisfile.h"
#endif
#include "mpegfile.h"
#ifdef WITH_APE
#include "mpcfile.h"
#endif
#ifdef WITH_ASF
#include "asffile.h"
#endif
#ifdef WITH_VORBIS
#include "speexfile.h"
#include "flacfile.h"
#endif
#ifdef WITH_TRUEAUDIO
#include "trueaudiofile.h"
#endif
#ifdef WITH_MP4
#include "mp4file.h"
#endif
#ifdef WITH_RIFF
#include "wavfile.h"
#endif
#ifdef WITH_APE
#include "apefile.h"
#endif
#ifdef WITH_RIFF
#include "aifffile.h"
#endif
#ifdef WITH_APE
#include "wavpackfile.h"
#endif
#ifdef WITH_VORBIS
#include "opusfile.h"
#endif
#ifdef WITH_MOD
#include "xmfile.h"
#endif
#ifdef WITH_DSF
#include "dsffile.h"
#include "dsdifffile.h"
#endif
#include <cppunit/extensions/HelperMacros.h>
#include "utils.h"
@ -55,6 +85,7 @@ using namespace TagLib;
namespace
{
#ifdef WITH_VORBIS
class DummyResolver : public FileRef::FileTypeResolver
{
public:
@ -63,7 +94,9 @@ namespace
return new Ogg::Vorbis::File(fileName);
}
};
#endif
#ifdef WITH_MP4
class DummyStreamResolver : public FileRef::StreamTypeResolver
{
public:
@ -77,32 +110,55 @@ namespace
return new MP4::File(s);
}
};
#endif
} // namespace
class TestFileRef : public CppUnit::TestFixture
{
CPPUNIT_TEST_SUITE(TestFileRef);
#ifdef WITH_ASF
CPPUNIT_TEST(testASF);
#endif
#ifdef WITH_APE
CPPUNIT_TEST(testMusepack);
#endif
#ifdef WITH_VORBIS
CPPUNIT_TEST(testVorbis);
CPPUNIT_TEST(testSpeex);
CPPUNIT_TEST(testFLAC);
#endif
CPPUNIT_TEST(testMP3);
#ifdef WITH_VORBIS
CPPUNIT_TEST(testOGA_FLAC);
CPPUNIT_TEST(testOGA_Vorbis);
#endif
#ifdef WITH_MP4
CPPUNIT_TEST(testMP4_1);
CPPUNIT_TEST(testMP4_2);
CPPUNIT_TEST(testMP4_3);
CPPUNIT_TEST(testMP4_4);
#endif
#ifdef WITH_TRUEAUDIO
CPPUNIT_TEST(testTrueAudio);
#endif
#ifdef WITH_APE
CPPUNIT_TEST(testAPE);
#endif
#ifdef WITH_RIFF
CPPUNIT_TEST(testWav);
CPPUNIT_TEST(testAIFF_1);
CPPUNIT_TEST(testAIFF_2);
#endif
#ifdef WITH_APE
CPPUNIT_TEST(testWavPack);
#endif
#ifdef WITH_VORBIS
CPPUNIT_TEST(testOpus);
#endif
#ifdef WITH_DSF
CPPUNIT_TEST(testDSF);
CPPUNIT_TEST(testDSDIFF);
#endif
CPPUNIT_TEST(testUnsupported);
CPPUNIT_TEST(testAudioProperties);
CPPUNIT_TEST(testDefaultFileExtensions);
@ -239,16 +295,21 @@ public:
}
}
#ifdef WITH_APE
void testMusepack()
{
fileRefSave<MPC::File>("click", ".mpc");
}
#endif
#ifdef WITH_ASF
void testASF()
{
fileRefSave<ASF::File>("silence-1", ".wma");
}
#endif
#ifdef WITH_VORBIS
void testVorbis()
{
fileRefSave<Ogg::Vorbis::File>("empty", ".ogg");
@ -263,17 +324,21 @@ public:
{
fileRefSave<FLAC::File>("no-tags", ".flac");
}
#endif
void testMP3()
{
fileRefSave<MPEG::File>("xing", ".mp3");
}
#ifdef WITH_TRUEAUDIO
void testTrueAudio()
{
fileRefSave<TrueAudio::File>("empty", ".tta");
}
#endif
#ifdef WITH_MP4
void testMP4_1()
{
fileRefSave<MP4::File>("has-tags", ".m4a");
@ -293,12 +358,16 @@ public:
{
fileRefSave<MP4::File>("blank_video", ".m4v");
}
#endif
#ifdef WITH_RIFF
void testWav()
{
fileRefSave<RIFF::WAV::File>("empty", ".wav");
}
#endif
#ifdef WITH_VORBIS
void testOGA_FLAC()
{
fileRefSave<Ogg::FLAC::File>("empty_flac", ".oga");
@ -308,12 +377,16 @@ public:
{
fileRefSave<Ogg::Vorbis::File>("empty_vorbis", ".oga");
}
#endif
#ifdef WITH_APE
void testAPE()
{
fileRefSave<APE::File>("mac-399", ".ape");
}
#endif
#ifdef WITH_RIFF
void testAIFF_1()
{
fileRefSave<RIFF::AIFF::File>("empty", ".aiff");
@ -323,17 +396,23 @@ public:
{
fileRefSave<RIFF::AIFF::File>("alaw", ".aifc");
}
#endif
#ifdef WITH_APE
void testWavPack()
{
fileRefSave<WavPack::File>("click", ".wv");
}
#endif
#ifdef WITH_VORBIS
void testOpus()
{
fileRefSave<Ogg::Opus::File>("correctness_gain_silent_output", ".opus");
}
#endif
#ifdef WITH_DSF
void testDSF()
{
fileRefSave<DSF::File>("empty10ms",".dsf");
@ -343,6 +422,7 @@ public:
{
fileRefSave<DSDIFF::File>("empty10ms",".dff");
}
#endif
void testUnsupported()
{
@ -364,28 +444,56 @@ public:
void testDefaultFileExtensions()
{
const StringList extensions = FileRef::defaultFileExtensions();
#ifdef WITH_APE
CPPUNIT_ASSERT(extensions.contains("mpc"));
#endif
#ifdef WITH_ASF
CPPUNIT_ASSERT(extensions.contains("wma"));
#endif
#ifdef WITH_VORBIS
CPPUNIT_ASSERT(extensions.contains("ogg"));
CPPUNIT_ASSERT(extensions.contains("spx"));
CPPUNIT_ASSERT(extensions.contains("flac"));
#endif
CPPUNIT_ASSERT(extensions.contains("mp3"));
#ifdef WITH_TRUEAUDIO
CPPUNIT_ASSERT(extensions.contains("tta"));
#endif
#ifdef WITH_MP4
CPPUNIT_ASSERT(extensions.contains("m4a"));
CPPUNIT_ASSERT(extensions.contains("3g2"));
CPPUNIT_ASSERT(extensions.contains("m4v"));
#endif
#ifdef WITH_RIFF
CPPUNIT_ASSERT(extensions.contains("wav"));
#endif
#ifdef WITH_VORBIS
CPPUNIT_ASSERT(extensions.contains("oga"));
#endif
#ifdef WITH_APE
CPPUNIT_ASSERT(extensions.contains("ape"));
#endif
#ifdef WITH_RIFF
CPPUNIT_ASSERT(extensions.contains("aiff"));
CPPUNIT_ASSERT(extensions.contains("aifc"));
#endif
#ifdef WITH_APE
CPPUNIT_ASSERT(extensions.contains("wv"));
#endif
#ifdef WITH_VORBIS
CPPUNIT_ASSERT(extensions.contains("opus"));
#endif
#ifdef WITH_MOD
CPPUNIT_ASSERT(extensions.contains("xm"));
#endif
#ifdef WITH_DSF
CPPUNIT_ASSERT(extensions.contains("dsf"));
CPPUNIT_ASSERT(extensions.contains("dff"));
CPPUNIT_ASSERT(extensions.contains("dsdiff"));
#endif
#ifdef WITH_SHORTEN
CPPUNIT_ASSERT(extensions.contains("shn"));
#endif
}
void testFileResolver()
@ -395,6 +503,7 @@ public:
CPPUNIT_ASSERT(dynamic_cast<MPEG::File *>(f.file()) != nullptr);
}
#ifdef WITH_VORBIS
DummyResolver resolver;
FileRef::addFileTypeResolver(&resolver);
@ -402,7 +511,9 @@ public:
FileRef f(TEST_FILE_PATH_C("xing.mp3"));
CPPUNIT_ASSERT(dynamic_cast<Ogg::Vorbis::File *>(f.file()) != nullptr);
}
#endif
#ifdef WITH_MP4
DummyStreamResolver streamResolver;
FileRef::addFileTypeResolver(&streamResolver);
@ -411,6 +522,7 @@ public:
FileRef f(&s);
CPPUNIT_ASSERT(dynamic_cast<MP4::File *>(f.file()) != nullptr);
}
#endif
FileRef::clearFileTypeResolvers();
}

View File

@ -23,21 +23,35 @@
* http://www.mozilla.org/MPL/ *
***************************************************************************/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <functional>
#include <memory>
#ifdef WITH_VORBIS
#include "flacproperties.h"
#endif
#include "mpegproperties.h"
#include "tbytevector.h"
#include "tpropertymap.h"
#include "mpegfile.h"
#ifdef WITH_VORBIS
#include "flacfile.h"
#endif
#ifdef WITH_TRUEAUDIO
#include "trueaudiofile.h"
#include "trueaudioproperties.h"
#endif
#ifdef WITH_RIFF
#include "wavfile.h"
#include "aifffile.h"
#endif
#ifdef WITH_DSF
#include "dsffile.h"
#include "dsdifffile.h"
#endif
#include "id3v2tag.h"
#include "id3v2frame.h"
#include "id3v2framefactory.h"
@ -118,12 +132,20 @@ class TestId3v2FrameFactory : public CppUnit::TestFixture
{
CPPUNIT_TEST_SUITE(TestId3v2FrameFactory);
CPPUNIT_TEST(testMPEG);
#ifdef WITH_VORBIS
CPPUNIT_TEST(testFLAC);
#endif
#ifdef WITH_TRUEAUDIO
CPPUNIT_TEST(testTrueAudio);
#endif
#ifdef WITH_RIFF
CPPUNIT_TEST(testWAV);
CPPUNIT_TEST(testAIFF);
#endif
#ifdef WITH_DSF
CPPUNIT_TEST(testDSF);
CPPUNIT_TEST(testDSDIFF);
#endif
CPPUNIT_TEST_SUITE_END();
public:
@ -236,6 +258,7 @@ public:
);
}
#ifdef WITH_VORBIS
void testFLAC()
{
ScopedFileCopy copy("no-tags", ".flac");
@ -260,7 +283,9 @@ public:
}
);
}
#endif
#ifdef WITH_TRUEAUDIO
void testTrueAudio()
{
ScopedFileCopy copy("empty", ".tta");
@ -285,7 +310,9 @@ public:
}
);
}
#endif
#ifdef WITH_RIFF
void testWAV()
{
ScopedFileCopy copy("empty", ".wav");
@ -335,7 +362,9 @@ public:
}
);
}
#endif
#ifdef WITH_DSF
void testDSF()
{
ScopedFileCopy copy("empty10ms", ".dsf");
@ -385,6 +414,7 @@ public:
}
);
}
#endif
};

View File

@ -23,6 +23,10 @@
* http://www.mozilla.org/MPL/ *
***************************************************************************/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <string>
#include <cstdio>
#include <array>
@ -32,7 +36,9 @@
#include "mpegfile.h"
#include "id3v2tag.h"
#include "id3v1tag.h"
#ifdef WITH_APE
#include "apetag.h"
#endif
#include "mpegproperties.h"
#include "xingheader.h"
#include "mpegheader.h"
@ -67,7 +73,9 @@ class TestMPEG : public CppUnit::TestFixture
CPPUNIT_TEST(testRepeatedSave3);
CPPUNIT_TEST(testEmptyID3v2);
CPPUNIT_TEST(testEmptyID3v1);
#ifdef WITH_APE
CPPUNIT_TEST(testEmptyAPE);
#endif
CPPUNIT_TEST(testIgnoreGarbage);
CPPUNIT_TEST(testExtendedHeader);
CPPUNIT_TEST(testReadStyleFast);
@ -304,7 +312,9 @@ public:
{
MPEG::File f(copy.fileName().c_str());
f.ID3v2Tag(true)->setTitle("ID3v2");
#ifdef WITH_APE
f.APETag(true)->setTitle("APE");
#endif
f.ID3v1Tag(true)->setTitle("ID3v1");
f.save();
}
@ -312,8 +322,10 @@ public:
MPEG::File f(copy.fileName().c_str());
CPPUNIT_ASSERT_EQUAL(String("ID3v2"), f.properties()["TITLE"].front());
f.strip(MPEG::File::ID3v2);
#ifdef WITH_APE
CPPUNIT_ASSERT_EQUAL(String("APE"), f.properties()["TITLE"].front());
f.strip(MPEG::File::APE);
#endif
CPPUNIT_ASSERT_EQUAL(String("ID3v1"), f.properties()["TITLE"].front());
f.strip(MPEG::File::ID3v1);
CPPUNIT_ASSERT(f.properties().isEmpty());
@ -464,17 +476,23 @@ public:
CPPUNIT_ASSERT(!f.hasAPETag());
CPPUNIT_ASSERT(!f.hasID3v1Tag());
#ifdef WITH_APE
f.APETag(true)->setTitle("01234 56789 ABCDE FGHIJ");
f.save();
f.APETag()->setTitle("0");
f.save();
#endif
f.ID3v1Tag(true)->setTitle("01234 56789 ABCDE FGHIJ");
#ifdef WITH_APE
f.APETag()->setTitle("01234 56789 ABCDE FGHIJ 01234 56789 ABCDE FGHIJ 01234 56789");
#endif
f.save();
}
{
MPEG::File f(copy.fileName().c_str());
#ifdef WITH_APE
CPPUNIT_ASSERT(f.hasAPETag());
#endif
CPPUNIT_ASSERT(f.hasID3v1Tag());
}
}
@ -519,6 +537,7 @@ public:
}
}
#ifdef WITH_APE
void testEmptyAPE()
{
ScopedFileCopy copy("xing", ".mp3");
@ -538,6 +557,7 @@ public:
CPPUNIT_ASSERT(!f.hasAPETag());
}
}
#endif
void testIgnoreGarbage()
{

View File

@ -23,15 +23,29 @@
* http://www.mozilla.org/MPL/ *
***************************************************************************/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "tpropertymap.h"
#include "tag.h"
#ifdef WITH_APE
#include "apetag.h"
#endif
#ifdef WITH_ASF
#include "asftag.h"
#endif
#include "id3v1tag.h"
#include "id3v2tag.h"
#ifdef WITH_RIFF
#include "infotag.h"
#endif
#ifdef WITH_MP4
#include "mp4tag.h"
#endif
#ifdef WITH_VORBIS
#include "xiphcomment.h"
#endif
#include <cppunit/extensions/HelperMacros.h>
#include "utils.h"
@ -41,13 +55,23 @@ class TestPropertyMap : public CppUnit::TestFixture
{
CPPUNIT_TEST_SUITE(TestPropertyMap);
CPPUNIT_TEST(testInvalidKeys);
#ifdef WITH_APE
CPPUNIT_TEST(testGetSetApe);
#endif
#ifdef WITH_ASF
CPPUNIT_TEST(testGetSetAsf);
#endif
CPPUNIT_TEST(testGetSetId3v1);
CPPUNIT_TEST(testGetSetId3v2);
#ifdef WITH_RIFF
CPPUNIT_TEST(testGetSetInfo);
#endif
#ifdef WITH_MP4
CPPUNIT_TEST(testGetSetMp4);
#endif
#ifdef WITH_VORBIS
CPPUNIT_TEST(testGetSetXiphComment);
#endif
CPPUNIT_TEST(testGetSet);
CPPUNIT_TEST_SUITE_END();
@ -141,30 +165,40 @@ public:
tagGetSet<ID3v2::Tag>();
}
#ifdef WITH_VORBIS
void testGetSetXiphComment()
{
tagGetSet<Ogg::XiphComment>();
}
#endif
#ifdef WITH_APE
void testGetSetApe()
{
tagGetSet<APE::Tag>();
}
#endif
#ifdef WITH_ASF
void testGetSetAsf()
{
tagGetSet<ASF::Tag>();
}
#endif
#ifdef WITH_MP4
void testGetSetMp4()
{
tagGetSet<MP4::Tag>();
}
#endif
#ifdef WITH_RIFF
void testGetSetInfo()
{
tagGetSet<RIFF::Info::Tag>();
}
#endif
void testGetSet()
{

View File

@ -23,35 +23,49 @@
* http://www.mozilla.org/MPL/ *
***************************************************************************/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <cstring>
#ifdef WITH_RIFF
#include "aifffile.h"
#include "aiffproperties.h"
#endif
#ifdef WITH_APE
#include "apefile.h"
#include "apefooter.h"
#include "apeitem.h"
#include "apeproperties.h"
#include "apetag.h"
#endif
#ifdef WITH_ASF
#include "asfattribute.h"
#include "asffile.h"
#include "asfpicture.h"
#include "asfproperties.h"
#include "asftag.h"
#endif
#include "attachedpictureframe.h"
#include "audioproperties.h"
#include "chapterframe.h"
#include "commentsframe.h"
#ifdef WITH_DSF
#include "dsffile.h"
#include "dsfproperties.h"
#include "dsdifffile.h"
#include "dsdiffproperties.h"
#endif
#include "eventtimingcodesframe.h"
#include "fileref.h"
#ifdef WITH_VORBIS
#include "flacfile.h"
#include "flacmetadatablock.h"
#include "flacunknownmetadatablock.h"
#include "flacpicture.h"
#include "flacproperties.h"
#endif
#include "generalencapsulatedobjectframe.h"
#include "id3v1tag.h"
#include "id3v2extendedheader.h"
@ -60,43 +74,61 @@
#include "id3v2framefactory.h"
#include "id3v2header.h"
#include "id3v2tag.h"
#ifdef WITH_RIFF
#include "infotag.h"
#endif
#ifdef WITH_MOD
#include "itfile.h"
#include "itproperties.h"
#include "modfile.h"
#include "modfilebase.h"
#include "modproperties.h"
#include "modtag.h"
#endif
#ifdef WITH_MP4
#include "mp4coverart.h"
#include "mp4file.h"
#include "mp4item.h"
#include "mp4itemfactory.h"
#include "mp4properties.h"
#include "mp4tag.h"
#endif
#ifdef WITH_APE
#include "mpcfile.h"
#include "mpcproperties.h"
#endif
#include "mpegfile.h"
#include "mpegheader.h"
#include "mpegproperties.h"
#ifdef WITH_VORBIS
#include "oggfile.h"
#include "oggflacfile.h"
#include "oggpage.h"
#include "oggpageheader.h"
#include "opusfile.h"
#include "opusproperties.h"
#endif
#include "ownershipframe.h"
#include "podcastframe.h"
#include "popularimeterframe.h"
#include "privateframe.h"
#include "relativevolumeframe.h"
#ifdef WITH_RIFF
#include "rifffile.h"
#endif
#ifdef WITH_MOD
#include "s3mfile.h"
#include "s3mproperties.h"
#endif
#ifdef WITH_SHORTEN
#include "shortenfile.h"
#include "shortenproperties.h"
#include "shortentag.h"
#endif
#ifdef WITH_VORBIS
#include "speexfile.h"
#include "speexproperties.h"
#endif
#include "synchronizedlyricsframe.h"
#include "tableofcontentsframe.h"
#include "tag.h"
@ -111,24 +143,38 @@
#include "tlist.h"
#include "tmap.h"
#include "tpropertymap.h"
#ifdef WITH_TRUEAUDIO
#include "trueaudiofile.h"
#include "trueaudioproperties.h"
#endif
#include "tstring.h"
#include "tstringlist.h"
#include "uniquefileidentifierframe.h"
#include "unknownframe.h"
#include "unsynchronizedlyricsframe.h"
#include "urllinkframe.h"
#ifdef WITH_VORBIS
#include "vorbisfile.h"
#include "vorbisproperties.h"
#endif
#ifdef WITH_RIFF
#include "wavfile.h"
#endif
#ifdef WITH_APE
#include "wavpackfile.h"
#include "wavpackproperties.h"
#endif
#ifdef WITH_RIFF
#include "wavproperties.h"
#endif
#include "xingheader.h"
#ifdef WITH_VORBIS
#include "xiphcomment.h"
#endif
#ifdef WITH_MOD
#include "xmfile.h"
#include "xmproperties.h"
#endif
#include <cppunit/extensions/HelperMacros.h>
@ -147,31 +193,43 @@ public:
// Class list was built by generating XML docs with Doxygen, and then running:
// $ grep kind=\"class\" index.xml | sed -E -e 's/(.*<name>|<\/name>.*)//g'
#ifdef WITH_APE
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::APE::File));
CPPUNIT_ASSERT_EQUAL(classSize(0, false), sizeof(TagLib::APE::Footer));
CPPUNIT_ASSERT_EQUAL(classSize(0, false), sizeof(TagLib::APE::Item));
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::APE::Properties));
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::APE::Tag));
#endif
#ifdef WITH_ASF
CPPUNIT_ASSERT_EQUAL(classSize(1, false), sizeof(TagLib::ASF::Attribute));
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::ASF::File));
CPPUNIT_ASSERT_EQUAL(classSize(1, false), sizeof(TagLib::ASF::Picture));
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::ASF::Properties));
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::ASF::Tag));
#endif
CPPUNIT_ASSERT_EQUAL(classSize(0, true), sizeof(TagLib::AudioProperties));
CPPUNIT_ASSERT_EQUAL(classSize(0, false), sizeof(TagLib::ByteVector));
CPPUNIT_ASSERT_EQUAL(classSize(2, false), sizeof(TagLib::ByteVectorList));
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::ByteVectorStream));
CPPUNIT_ASSERT_EQUAL(classSize(0, true), sizeof(TagLib::DebugListener));
#ifdef WITH_DSF
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::DSDIFF::DIIN::Tag));
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::DSDIFF::File));
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::DSDIFF::Properties));
#endif
#ifdef WITH_VORBIS
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::FLAC::File));
#endif
#ifdef WITH_DSF
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::DSF::File));
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::DSF::Properties));
#endif
#ifdef WITH_VORBIS
CPPUNIT_ASSERT_EQUAL(classSize(0, true), sizeof(TagLib::FLAC::MetadataBlock));
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::FLAC::Picture));
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::FLAC::Properties));
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::FLAC::UnknownMetadataBlock));
#endif
CPPUNIT_ASSERT_EQUAL(classSize(0, true), sizeof(TagLib::File));
CPPUNIT_ASSERT_EQUAL(classSize(1, false), sizeof(TagLib::FileRef));
CPPUNIT_ASSERT_EQUAL(classSize(0, true), sizeof(TagLib::FileRef::FileTypeResolver));
@ -207,26 +265,35 @@ public:
CPPUNIT_ASSERT_EQUAL(classSize(2, true), sizeof(TagLib::ID3v2::UserTextIdentificationFrame));
CPPUNIT_ASSERT_EQUAL(classSize(2, true), sizeof(TagLib::ID3v2::UserUrlLinkFrame));
CPPUNIT_ASSERT_EQUAL(classSize(0, true), sizeof(TagLib::IOStream));
#ifdef WITH_MOD
CPPUNIT_ASSERT_EQUAL(classSize(2, true), sizeof(TagLib::IT::File));
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::IT::Properties));
#endif
CPPUNIT_ASSERT_EQUAL(classSize(1, false), sizeof(TagLib::List<int>));
#ifdef WITH_MP4
CPPUNIT_ASSERT_EQUAL(classSize(1, false), sizeof(TagLib::MP4::CoverArt));
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::MP4::File));
CPPUNIT_ASSERT_EQUAL(classSize(1, false), sizeof(TagLib::MP4::Item));
CPPUNIT_ASSERT_EQUAL(classSize(0, true), sizeof(TagLib::MP4::ItemFactory));
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::MP4::Properties));
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::MP4::Tag));
#endif
#ifdef WITH_APE
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::MPC::File));
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::MPC::Properties));
#endif
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::MPEG::File));
CPPUNIT_ASSERT_EQUAL(classSize(1, false), sizeof(TagLib::MPEG::Header));
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::MPEG::Properties));
CPPUNIT_ASSERT_EQUAL(classSize(0, false), sizeof(TagLib::MPEG::XingHeader));
CPPUNIT_ASSERT_EQUAL(classSize(1, false), sizeof(TagLib::Map<int, int>));
#ifdef WITH_MOD
CPPUNIT_ASSERT_EQUAL(classSize(2, true), sizeof(TagLib::Mod::File));
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::Mod::FileBase));
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::Mod::Properties));
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::Mod::Tag));
#endif
#ifdef WITH_VORBIS
CPPUNIT_ASSERT_EQUAL(classSize(2, true), sizeof(TagLib::Ogg::FLAC::File));
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::Ogg::File));
CPPUNIT_ASSERT_EQUAL(classSize(2, true), sizeof(TagLib::Ogg::Opus::File));
@ -238,7 +305,9 @@ public:
CPPUNIT_ASSERT_EQUAL(classSize(2, true), sizeof(TagLib::Ogg::Vorbis::File));
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::Ogg::Vorbis::Properties));
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::Ogg::XiphComment));
#endif
CPPUNIT_ASSERT_EQUAL(classSize(2, false), sizeof(TagLib::PropertyMap));
#ifdef WITH_RIFF
CPPUNIT_ASSERT_EQUAL(classSize(2, true), sizeof(TagLib::RIFF::AIFF::File));
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::RIFF::AIFF::Properties));
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::RIFF::File));
@ -246,21 +315,32 @@ public:
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::RIFF::Info::Tag));
CPPUNIT_ASSERT_EQUAL(classSize(2, true), sizeof(TagLib::RIFF::WAV::File));
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::RIFF::WAV::Properties));
#endif
#ifdef WITH_MOD
CPPUNIT_ASSERT_EQUAL(classSize(2, true), sizeof(TagLib::S3M::File));
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::S3M::Properties));
#endif
#ifdef WITH_SHORTEN
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::Shorten::File));
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::Shorten::Properties));
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::Shorten::Tag));
#endif
CPPUNIT_ASSERT_EQUAL(classSize(1, false), sizeof(TagLib::String));
CPPUNIT_ASSERT_EQUAL(classSize(2, false), sizeof(TagLib::StringList));
CPPUNIT_ASSERT_EQUAL(classSize(0, true), sizeof(TagLib::Tag));
#ifdef WITH_TRUEAUDIO
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::TrueAudio::File));
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::TrueAudio::Properties));
#endif
#ifdef WITH_APE
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::WavPack::File));
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::WavPack::Properties));
#endif
#ifdef WITH_MOD
CPPUNIT_ASSERT_EQUAL(classSize(2, true), sizeof(TagLib::XM::File));
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::XM::Properties));
CPPUNIT_ASSERT_EQUAL(classSize(1, false), sizeof(TagLib::Variant));
#endif
}
private:

View File

@ -23,6 +23,10 @@
* http://www.mozilla.org/MPL/ *
***************************************************************************/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <string>
#include <unordered_map>
#include <list>
@ -77,7 +81,9 @@ class TestTagC : public CppUnit::TestFixture
{
CPPUNIT_TEST_SUITE(TestTagC);
CPPUNIT_TEST(testMp3);
#ifdef WITH_VORBIS
CPPUNIT_TEST(testStream);
#endif
CPPUNIT_TEST_SUITE_END();
public:
@ -165,6 +171,7 @@ public:
taglib_tag_free_strings();
}
#ifdef WITH_VORBIS
void testStream()
{
// Only fetch the beginning of a FLAC file
@ -233,6 +240,7 @@ public:
taglib_tag_free_strings();
}
#endif
};
CPPUNIT_TEST_SUITE_REGISTRATION(TestTagC);