Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/easymode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,10 +331,11 @@ static Config configs[] = {
.skip_mp4 = false,
.preserve_mtimes = false,
.dual_mono = false
},
}

// DSF config
{
#ifdef HAS_DSF
,{
.tag_mode = 'i',
.skip_existing = false,
.target_loudness = RG_TARGET_LOUDNESS,
Expand All @@ -353,6 +354,7 @@ static Config configs[] = {
.preserve_mtimes = false,
.dual_mono = false
}
#endif

// Matroska config
#ifdef HAS_MATROSKA
Expand Down Expand Up @@ -526,7 +528,9 @@ static FileType determine_section_type(const std::string &section)
{"APE", FileType::APE},
{"TAK", FileType::TAK},
{"Musepack", FileType::MPC},
#ifdef HAS_DSF
{"DSF", FileType::DSF},
#endif
#ifdef HAS_MATROSKA
{"Matroska", FileType::MATROSKA},
{"WebM", FileType::WEBM}
Expand Down
8 changes: 6 additions & 2 deletions src/rsgain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -411,13 +411,17 @@ static void help_main() {
rsgain::print("{} {} supports writing tags to the following file types:\n", PROJECT_NAME, PROJECT_VERSION);
rsgain::print(" FLAC (.flac), Ogg (.ogg, .oga, .spx), Opus (.opus), MP2 (.mp2), MP3 (.mp3),\n");
rsgain::print(" MP4 (.mp4, .m4a), WMA (.wma), WavPack (.wv), APE (.ape), WAV (.wav),\n");
rsgain::print(" WAV (.wav), DSF (.dsf), TAK (.tak), ");
rsgain::print(" WAV (.wav), TAK (.tak), ");

rsgain::print(
#ifdef HAS_DSF
"DSF (.dsf), "
#endif
#ifdef HAS_MATROSKA
"Matroska (.mka, .mkv), WebM (.webm),\n "
#endif
"and AIFF (.aiff, .aif, .snd).\n");
"and AIFF (.aiff, .aif, .snd).\n"
);

rsgain::print("\n");
rsgain::print(COLOR_RED "Options:\n" COLOR_OFF);
Expand Down
6 changes: 6 additions & 0 deletions src/rsgain.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
#pragma once

#include <taglib/taglib_config.h>
// Taglib added DSF support in 2.0, but the TAGLIB_WITH_DSF define was not
// added untile 2.1. Check both ways. TAGLIB_MAJOR_VERSION can be dropped
// when taglib >= 2.1 is required.
#if (defined(TAGLIB_WITH_DSF) && TAGLIB_WITH_DSF == 1) || TAGLIB_MAJOR_VERSION > 1
#define HAS_DSF
#endif
#if defined(TAGLIB_WITH_MATROSKA) && TAGLIB_WITH_MATROSKA == 1
#define HAS_MATROSKA
#endif
Expand Down
2 changes: 2 additions & 0 deletions src/scan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,9 @@ static FileType determine_filetype(const std::string &extension)
{".ape", FileType::APE},
{".tak", FileType::TAK},
{".mpc", FileType::MPC},
#ifdef HAS_DSF
{".dsf", FileType::DSF},
#endif
#ifdef HAS_MATROSKA
{".mka", FileType::MATROSKA},
{".mkv", FileType::MATROSKA},
Expand Down
2 changes: 2 additions & 0 deletions src/scan.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ enum class FileType {
APE,
TAK,
MPC,
#ifdef HAS_DSF
DSF,
#endif
#ifdef HAS_MATROSKA
MATROSKA,
WEBM
Expand Down
27 changes: 23 additions & 4 deletions src/tag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
#include <taglib/wavpackfile.h>
#include <taglib/apefile.h>
#include <taglib/mpcfile.h>
#include <taglib/dsffile.h>
#include <libavcodec/avcodec.h>

#define CRCPP_USE_CPP11
Expand All @@ -65,6 +64,10 @@
#include "tag.hpp"
#include "output.hpp"

#ifdef HAS_DSF
#include <taglib/dsffile.h>
#endif

#ifdef HAS_MATROSKA
#include <taglib/matroskafile.h>
#include <taglib/matroskatag.h>
Expand Down Expand Up @@ -268,9 +271,11 @@ bool tag_track(ScanJob::Track &track, const Config &config)
ret = tag_apev2<TagLib::MPC::File>(track, config);
break;

#ifdef HAS_DSF
case FileType::DSF:
ret = tag_riff<TagLib::DSF::File>(track, config);
break;
#endif

#ifdef HAS_MATROSKA
case FileType::MATROSKA:
Expand Down Expand Up @@ -328,8 +333,10 @@ bool tag_exists(const ScanJob::Track &track)
case FileType::MPC:
return tag_exists_ape<TagLib::MPC::File>(track);

#ifdef HAS_DSF
case FileType::DSF:
return tag_exists_id3<TagLib::DSF::File>(track);
#endif

#ifdef HAS_MATROSKA
case FileType::MATROSKA:
Expand All @@ -348,7 +355,11 @@ static bool tag_exists_id3(const ScanJob::Track &track)
{
const TagLib::ID3v2::Tag *tag = nullptr;
T file(track.path.string().c_str(), false);
if constexpr (std::is_same_v<T, TagLib::RIFF::AIFF::File> || std::is_same_v<T, TagLib::DSF::File>)
if constexpr (std::is_same_v<T, TagLib::RIFF::AIFF::File>
#ifdef HAS_DSF
|| std::is_same_v<T, TagLib::DSF::File>
#endif
)
tag = file.tag();
else
tag = file.ID3v2Tag();
Expand Down Expand Up @@ -590,7 +601,11 @@ static bool tag_riff(ScanJob::Track &track, const Config &config)
TagLib::ID3v2::Tag *tag = nullptr;
if constexpr (std::is_same_v<T, TagLib::RIFF::WAV::File>)
tag = file.ID3v2Tag();
else if constexpr (std::is_same_v<T, TagLib::RIFF::AIFF::File> || std::is_same_v<T, TagLib::DSF::File>)
else if constexpr (std::is_same_v<T, TagLib::RIFF::AIFF::File>
#ifdef HAS_DSF
|| std::is_same_v<T, TagLib::DSF::File>
#endif
)
tag = file.tag();
if (!tag)
return false;
Expand All @@ -610,7 +625,11 @@ static bool tag_riff(ScanJob::Track &track, const Config &config)
id3v2version == 3 ? TagLib::ID3v2::Version::v3 : TagLib::ID3v2::Version::v4
);
#endif
else if constexpr (std::is_same_v<T, TagLib::RIFF::AIFF::File> || std::is_same_v<T, TagLib::DSF::File>)
else if constexpr (std::is_same_v<T, TagLib::RIFF::AIFF::File>
#ifdef HAS_DSF
|| std::is_same_v<T, TagLib::DSF::File>
#endif
)
return file.save();
}

Expand Down