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
This commit is contained in:
Max Kellermann 2016-12-09 21:03:47 +01:00
parent 09da80e9f4
commit be8297d6f6
2 changed files with 12 additions and 3 deletions

1
NEWS
View File

@ -27,6 +27,7 @@ ver 0.20 (not yet released)
- mpcdec: read the bit rate
- pcm: support audio/L16 (RFC 2586) and audio/x-mpd-float
- sidplay: faster scanning
- wavpack: support DSD (WavPack 5)
* playlist
- cue: don't skip pregap
- embcue: fix last track

View File

@ -41,6 +41,14 @@
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. */
typedef void (*format_samples_t)(
int bytes_per_sample,
@ -204,7 +212,7 @@ wavpack_scan_file(Path path_fs,
{
char error[ERRORLEN];
WavpackContext *wpc = WavpackOpenFileInput(path_fs.c_str(), error,
0, 0);
OPEN_DSD_FLAG, 0);
if (wpc == nullptr) {
FormatError(wavpack_domain,
"failed to open WavPack file \"%s\": %s",
@ -415,7 +423,7 @@ wavpack_open_wvc(DecoderClient &client, const char *uri)
static void
wavpack_streamdecode(DecoderClient &client, InputStream &is)
{
int open_flags = OPEN_NORMALIZE;
int open_flags = OPEN_DSD_FLAG | OPEN_NORMALIZE;
bool can_seek = is.IsSeekable();
std::unique_ptr<WavpackInput> wvc;
@ -459,7 +467,7 @@ wavpack_filedecode(DecoderClient &client, Path path_fs)
{
char error[ERRORLEN];
WavpackContext *wpc = WavpackOpenFileInput(path_fs.c_str(), error,
OPEN_WVC | OPEN_NORMALIZE,
OPEN_DSD_FLAG | OPEN_NORMALIZE | OPEN_WVC,
0);
if (wpc == nullptr) {
FormatWarning(wavpack_domain,