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
24 changes: 23 additions & 1 deletion src/easymode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,27 @@ static Config configs[] = {
},

// Musepack config
{
.tag_mode = 'i',
.skip_existing = false,
.target_loudness = RG_TARGET_LOUDNESS,
.max_peak_level = 0.0,
.true_peak = false,
.clip_mode = 'p',
.do_album = true,
.album_as_aes77 = false,
.tab_output = OutputType::NONE,
.sep_header = false,
.sort_alphanum = false,
.lowercase = false,
.id3v2version = ID3V2_KEEP,
.opus_mode = 'd',
.skip_mp4 = false,
.preserve_mtimes = false,
.dual_mono = false
},

// DSF config
{
.tag_mode = 'i',
.skip_existing = false,
Expand Down Expand Up @@ -460,7 +481,8 @@ static FileType determine_section_type(const std::string &section)
{"Wavpack", FileType::WAVPACK},
{"APE", FileType::APE},
{"TAK", FileType::TAK},
{"Musepack", FileType::MPC}
{"Musepack", FileType::MPC},
{"DSF", FileType::DSF}
};
auto it = map.find(section);
return it == map.end() ? FileType::INVALID : it->second;
Expand Down
11 changes: 6 additions & 5 deletions src/scan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ constexpr void output_fferror(int error, T&& msg)
output_error("{}: {}", msg, errbuf);
}
#define OLD_CHANNEL_LAYOUT LIBAVUTIL_VERSION_MAJOR < 57 || (LIBAVUTIL_VERSION_MAJOR == 57 && LIBAVUTIL_VERSION_MINOR < 18)
#define OUTPUT_FORMAT AV_SAMPLE_FMT_S16
#define OUTPUT_FORMAT AV_SAMPLE_FMT_FLT

extern bool multithread;

Expand All @@ -79,7 +79,7 @@ static FileType determine_filetype(const std::string &extension)
{".spx", FileType::OGG},
{".opus", FileType::OPUS},
{".m4a", FileType::M4A},
{".mp4", FileType::M4A},
{".mp4", FileType::M4A},
{".wma", FileType::WMA},
{".wav", FileType::WAV},
{".aiff", FileType::AIFF},
Expand All @@ -88,7 +88,8 @@ static FileType determine_filetype(const std::string &extension)
{".wv", FileType::WAVPACK},
{".ape", FileType::APE},
{".tak", FileType::TAK},
{".mpc", FileType::MPC}
{".mpc", FileType::MPC},
{".dsf", FileType::DSF}
};
std::string extensionlower = extension;
std::transform(extensionlower.begin(), extensionlower.end(), extensionlower.begin(), ::tolower);
Expand Down Expand Up @@ -434,13 +435,13 @@ ScanReturn ScanJob::Track::scan(const Config &config, std::mutex *m)
goto end;
}

ebur128_add_frames_short(ebur128, (short*) swr_out_data[0], static_cast<size_t>(frame->nb_samples));
ebur128_add_frames_float(ebur128, (float*) swr_out_data[0], static_cast<size_t>(frame->nb_samples));
av_free(swr_out_data[0]);
}

// Audio is already in correct format
else
ebur128_add_frames_short(ebur128, (short*) frame->data[0], static_cast<size_t>(frame->nb_samples));
ebur128_add_frames_float(ebur128, (float*) frame->data[0], static_cast<size_t>(frame->nb_samples));

if (output_progress) {
int pos = (int) std::round((double) frame->pts * time_base);
Expand Down
3 changes: 2 additions & 1 deletion src/scan.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ enum class FileType {
WAVPACK,
APE,
TAK,
MPC
MPC,
DSF
};

struct ScanResult {
Expand Down
14 changes: 11 additions & 3 deletions src/tag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
#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 Down Expand Up @@ -236,6 +237,10 @@ bool tag_track(ScanJob::Track &track, const Config &config)
ret = tag_apev2<TagLib::MPC::File>(track, config);
break;

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

default:
break;
}
Expand Down Expand Up @@ -285,6 +290,9 @@ bool tag_exists(const ScanJob::Track &track)
case FileType::MPC:
return tag_exists_ape<TagLib::MPC::File>(track);

case FileType::DSF:
return tag_exists_id3<TagLib::DSF::File>(track);

default:
return false;
}
Expand All @@ -296,7 +304,7 @@ 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>)
if constexpr (std::is_same_v<T, TagLib::RIFF::AIFF::File> || std::is_same_v<T, TagLib::DSF::File>)
tag = file.tag();
else
tag = file.ID3v2Tag();
Expand Down Expand Up @@ -510,7 +518,7 @@ 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>)
else if constexpr (std::is_same_v<T, TagLib::RIFF::AIFF::File> || std::is_same_v<T, TagLib::DSF::File>)
tag = file.tag();
if (!tag)
return false;
Expand All @@ -530,7 +538,7 @@ 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>)
else if constexpr (std::is_same_v<T, TagLib::RIFF::AIFF::File> || std::is_same_v<T, TagLib::DSF::File>)
return file.save();
}

Expand Down
Loading