aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLászló Áshin <kodest@gmail.com>2008-11-14 15:23:18 +0100
committerMax Kellermann <max@duempel.org>2008-11-14 15:23:18 +0100
commit440b1ea3ea0e2bc0f56c8f39f917e59d1761a3d0 (patch)
tree45acf5aa19c2e80a6fe7aae5d170895ba8afb88a
parentc495c6f5afefaf37fea4288b42ec6d63d054679b (diff)
downloadmpd-440b1ea3ea0e2bc0f56c8f39f917e59d1761a3d0.tar.gz
mpd-440b1ea3ea0e2bc0f56c8f39f917e59d1761a3d0.tar.xz
mpd-440b1ea3ea0e2bc0f56c8f39f917e59d1761a3d0.zip
wavpack: be more robust if the underlying stream is not seekable
The wavpack open function gives us an option called OPEN_STREAMING. This provides more robust and error tolerant playback, but it automatically disables seeking. (More exactly the wavpack lib will not return the length information.) So, if the stream is already not seekable we can use this option safely.
-rw-r--r--src/decoder/wavpack_plugin.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/decoder/wavpack_plugin.c b/src/decoder/wavpack_plugin.c
index c771db621..4262d55fa 100644
--- a/src/decoder/wavpack_plugin.c
+++ b/src/decoder/wavpack_plugin.c
@@ -494,7 +494,7 @@ wavpack_streamdecode(struct decoder * decoder, struct input_stream *is)
char error[ERRORLEN];
WavpackContext *wpc;
struct input_stream is_wvc;
- int open_flags = OPEN_2CH_MAX | OPEN_NORMALIZE /*| OPEN_STREAMING*/;
+ int open_flags = OPEN_2CH_MAX | OPEN_NORMALIZE;
struct wavpack_input isp, isp_wvc;
bool can_seek = is->seekable;
@@ -503,6 +503,10 @@ wavpack_streamdecode(struct decoder * decoder, struct input_stream *is)
can_seek &= is_wvc.seekable;
}
+ if (!can_seek) {
+ open_flags |= OPEN_STREAMING;
+ }
+
wavpack_input_init(&isp, decoder, is);
wpc = WavpackOpenFileInputEx(
&mpd_is_reader, &isp, &isp_wvc, error, open_flags, 23