Commit Graph

9174 Commits

Author SHA1 Message Date
Max Kellermann
67cc09416f decoder/dsf: implement seeking 2014-08-23 14:00:38 +02:00
Max Kellermann
f2a75fbfc7 decoder/dsf: refactor the main decoder loop
Check for STOP before decoding the first chunk.  This reduces the
command latency.
2014-08-23 13:57:57 +02:00
Max Kellermann
b1fb09e183 decoder/dsf: make the buffer more local
This allows the compiler to discard buffer contents between two
iterations.
2014-08-23 13:55:52 +02:00
Max Kellermann
cd0082c630 decoder/dsf: eliminate pointless return statement 2014-08-23 13:54:07 +02:00
Max Kellermann
f78527d1e3 decoder/dsf: use the block count internally 2014-08-23 13:51:08 +02:00
Max Kellermann
1f642238a7 decoder/dsf: don't skip remaining bytes
Nobody cares.
2014-08-23 13:50:36 +02:00
Max Kellermann
6fe06cad98 decoder/dsf: count the blocks, not the remaining bytes
Prepare refactoring the whole plugin to use blocks instead of bytes.
A block is the smallest addressable unit, and it will simplify the
seeking code.
2014-08-23 13:44:53 +02:00
Max Kellermann
2335fdbb5a decoder/dsf: allow channel setups other than stereo
This finishes the multi-channel support.  Development of the feature
was started with commit 02cc77cd8
2014-08-23 13:40:21 +02:00
Max Kellermann
1b6f7c3eb7 decoder/dsf: eliminate another hard-coded stereo mode assumption
When calculating the upper bound using the "sample count" format
header, don't assume it's stereo.
2014-08-23 13:39:00 +02:00
Max Kellermann
67f0d26d17 decoder/dsf: fix big-endian bugs 2014-08-23 13:35:29 +02:00
Max Kellermann
8574bcd494 decoder/dsf: compare with InputStream::GetRest() instead of ..GetSize() 2014-08-23 13:26:17 +02:00
Max Kellermann
02cc77cd82 decoder/dsf: fix multi-channel files
The plugin was horribly bugged for files that were not stereo.
2014-08-22 07:30:32 +02:00
Max Kellermann
d8782ce5fd decoder/dsf: simplify dsf_to_pcm_order()
Don't pass the buffer size to the function, as it's known at compile
time.  Use "restrict" on the pointer arguments, and merge the two
loops, which allows the compiler to optimize this loop with a few SSE2
instructions.
2014-08-22 06:58:08 +02:00
Max Kellermann
dedc2986c6 decoder/dsf: fix noise at end of malformed file
Read one block at a time.  This discards the last partial block, which
cannot be interleaved anyway.  Previously, uninitialised memory was
used to interleave the last block, which generated some noise.
2014-08-21 17:46:25 +02:00
Max Kellermann
74cdc0005a decoder/dsf: eliminate temporary buffer
Convert into a second buffer that gets passed to decoder_data()
without copying back to the first buffer.
2014-08-21 17:15:29 +02:00
Max Kellermann
a756cd9565 decoder/dsf: add constant DSF_BLOCK_SIZE 2014-08-21 17:12:43 +02:00
Max Kellermann
ae27c3f4c5 decoder/dsf: use size_t loop variables when the limit is a size_t 2014-08-21 17:09:49 +02:00
Max Kellermann
6d41f36266 decoder/dsf: use memcpy() 2014-08-21 13:09:14 +02:00
Max Kellermann
57cbcdf2ec decoder/dsf: make the "scratch" buffer local
This allows the compiler to discard buffer contents between two
function calls.
2014-08-21 13:05:35 +02:00
Max Kellermann
455fd180b1 Merge branch 'v0.18.x' 2014-08-21 12:52:27 +02:00
Max Kellermann
78abcd7df7 decoer/dsdiff: fix endless loop on malformed file
Same bug as in the previous commit.
2014-08-21 12:48:03 +02:00
Max Kellermann
23dce21647 decoer/dsf: fix endless loop on malformed file
When the data chunk size is not a multiple of the frame size, the last
partial frame lead to an endless loop.  We fix this by checking
chunk_sze>=frame instead of chunk_sze>0.  This way, the partial frame
is simply skipped.
2014-08-21 12:37:22 +02:00
Max Kellermann
e6177c3349 decoder/dsf: remove unused attribute "id3_size" 2014-08-20 09:46:42 +02:00
Max Kellermann
e2adb82e29 decoder/DsdLib: use offset_type instead of uint64_t 2014-08-19 22:39:44 +02:00
Max Kellermann
bb472206de InputStream: move typedef offset_type to Offset.hxx
Reduce header dependencies.
2014-08-19 22:29:52 +02:00
Max Kellermann
d87cf5146e InputStream: CheapSeeking() returns false only for HTTP
Seeking on NFS or SMB is cheap.  Actually, only HTTP streams are
expensive to seek.  This enables a few features on NFS/SMB files, for
example Ogg tags.
2014-08-19 21:39:12 +02:00
Max Kellermann
87eb5cbced InputStream: move code to ExpensiveSeeking() 2014-08-19 21:38:18 +02:00
Max Kellermann
181edf4b53 InputStream: make offset_type unsigned 2014-08-19 21:23:03 +02:00
Max Kellermann
dfa53cb88e InputPlugin: remove typedef offset_type
Has been moved to class InputStream long ago.
2014-08-19 21:22:23 +02:00
Max Kellermann
d079cda174 InputStream: allow GetSize() only if KnownSize() 2014-08-19 21:02:00 +02:00
Max Kellermann
4265e71d6f InputStream: add constant UNKNOWN_SIZE 2014-08-19 21:00:50 +02:00
Max Kellermann
f66a72c66b input/proxy: use KnownSize() 2014-08-19 21:00:32 +02:00
Max Kellermann
9be90bd1c9 decoder/wavpack: add local reference variables 2014-08-19 20:58:08 +02:00
Max Kellermann
106e535577 decoder/sndfile: check InputStream::KnownSize() 2014-08-19 20:57:25 +02:00
Max Kellermann
194be51f05 decoder/pcm: check InputStream::KnownSize() 2014-08-19 20:57:00 +02:00
Max Kellermann
a862e363ea decoder/mpcdec: check InputStream::KnownSize() 2014-08-19 20:55:51 +02:00
Max Kellermann
2e64afca27 decoder/modplug: check InputStream::KnownSize() 2014-08-19 20:53:02 +02:00
Max Kellermann
51cda0be2a decoder/mad: check InputStream::KnownSize() 2014-08-19 20:44:29 +02:00
Max Kellermann
4da3291157 decoder/ffmpeg: check InputStream::KnownSize() 2014-08-19 20:44:29 +02:00
Max Kellermann
52edabf2cb decoder/faad: remove unnecessary cast to size_t 2014-08-19 20:44:29 +02:00
Max Kellermann
43a1a0f3ab decoder/faad: remove size!=0 check
Since we already checked InputStream::KnownSize(), we can assume that
GetSize() returns a valid value, and this check is obsolete.
2014-08-19 20:44:29 +02:00
Max Kellermann
e88524f274 decoder/faad: check InputStream::KnownSize()
Replace the bogus GetSize() check and call GetSize() only when
necessary.
2014-08-19 20:44:29 +02:00
Max Kellermann
7a929fcd27 decoder/faad: call GetSize() only when needed 2014-08-19 20:44:29 +02:00
Max Kellermann
7087fdf6c0 decoder/DsdLib: make variables more local 2014-08-19 20:44:29 +02:00
Max Kellermann
67093a5143 decoder/DsdLib: use fixed-length ID3 buffer
Variable-length arrays are not allowed in C++.
2014-08-19 20:42:40 +02:00
Max Kellermann
3f34016888 decoder/DsdLib: check InputStream::KnownSize() 2014-08-19 20:24:33 +02:00
Max Kellermann
1307633a84 decoder/dsf: check InputStream::KnownSize() 2014-08-19 20:24:09 +02:00
Max Kellermann
1a53f07d80 decoder/dsf: remove unnecessary ID3 offset check
If the offset is out of range, the seek will simply fail.  Not a
problem.
2014-08-19 20:23:36 +02:00
Max Kellermann
672f678ed6 InputStream: use KnownSize() in assertion 2014-08-19 11:59:19 +02:00
Max Kellermann
b924568f79 decoder/audiofile: check InputStream::KnownSize()
The plugin assumes that the size is known, but does not verify it at
runtime.
2014-08-19 11:58:15 +02:00