Commit be8297d6 authored by Max Kellermann's avatar Max Kellermann

decoder/wavpack: basic DSD support (WavPack 5)

Enable OPEN_DSD_AS_PCM if available. No OPEN_DSD_NATIVE yet. https://bugs.musicpd.org/view.php?id=4606
parent 09da80e9
...@@ -27,6 +27,7 @@ ver 0.20 (not yet released) ...@@ -27,6 +27,7 @@ ver 0.20 (not yet released)
- mpcdec: read the bit rate - mpcdec: read the bit rate
- pcm: support audio/L16 (RFC 2586) and audio/x-mpd-float - pcm: support audio/L16 (RFC 2586) and audio/x-mpd-float
- sidplay: faster scanning - sidplay: faster scanning
- wavpack: support DSD (WavPack 5)
* playlist * playlist
- cue: don't skip pregap - cue: don't skip pregap
- embcue: fix last track - embcue: fix last track
......
...@@ -41,6 +41,14 @@ ...@@ -41,6 +41,14 @@
static constexpr Domain wavpack_domain("wavpack"); static constexpr Domain wavpack_domain("wavpack");
#ifdef OPEN_DSD_AS_PCM
/* libWavPack supports DSD since version 5 */
static constexpr int OPEN_DSD_FLAG = OPEN_DSD_AS_PCM;
#else
/* no DSD support in this libWavPack version */
static constexpr int OPEN_DSD_FLAG = 0;
#endif
/** A pointer type for format converter function. */ /** A pointer type for format converter function. */
typedef void (*format_samples_t)( typedef void (*format_samples_t)(
int bytes_per_sample, int bytes_per_sample,
...@@ -204,7 +212,7 @@ wavpack_scan_file(Path path_fs, ...@@ -204,7 +212,7 @@ wavpack_scan_file(Path path_fs,
{ {
char error[ERRORLEN]; char error[ERRORLEN];
WavpackContext *wpc = WavpackOpenFileInput(path_fs.c_str(), error, WavpackContext *wpc = WavpackOpenFileInput(path_fs.c_str(), error,
0, 0); OPEN_DSD_FLAG, 0);
if (wpc == nullptr) { if (wpc == nullptr) {
FormatError(wavpack_domain, FormatError(wavpack_domain,
"failed to open WavPack file \"%s\": %s", "failed to open WavPack file \"%s\": %s",
...@@ -415,7 +423,7 @@ wavpack_open_wvc(DecoderClient &client, const char *uri) ...@@ -415,7 +423,7 @@ wavpack_open_wvc(DecoderClient &client, const char *uri)
static void static void
wavpack_streamdecode(DecoderClient &client, InputStream &is) wavpack_streamdecode(DecoderClient &client, InputStream &is)
{ {
int open_flags = OPEN_NORMALIZE; int open_flags = OPEN_DSD_FLAG | OPEN_NORMALIZE;
bool can_seek = is.IsSeekable(); bool can_seek = is.IsSeekable();
std::unique_ptr<WavpackInput> wvc; std::unique_ptr<WavpackInput> wvc;
...@@ -459,7 +467,7 @@ wavpack_filedecode(DecoderClient &client, Path path_fs) ...@@ -459,7 +467,7 @@ wavpack_filedecode(DecoderClient &client, Path path_fs)
{ {
char error[ERRORLEN]; char error[ERRORLEN];
WavpackContext *wpc = WavpackOpenFileInput(path_fs.c_str(), error, WavpackContext *wpc = WavpackOpenFileInput(path_fs.c_str(), error,
OPEN_WVC | OPEN_NORMALIZE, OPEN_DSD_FLAG | OPEN_NORMALIZE | OPEN_WVC,
0); 0);
if (wpc == nullptr) { if (wpc == nullptr) {
FormatWarning(wavpack_domain, FormatWarning(wavpack_domain,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment