Anton Khirnov
89806691b1
wavpack: check that all the channels were coded.
12 years ago
Anton Khirnov
eae1b8451a
wavpack: check that there aren't too many blocks per packet
12 years ago
Anton Khirnov
7d039e70a5
wavpack: extract channel information from the bitstream
...
This way we don't require the caller to parse the block header. It also
allows the channel configuration to change mid-stream.
12 years ago
Anton Khirnov
78f75b6fa4
wavpack: extract sample rate from the bitstream
...
This way we don't require the caller to parse the block header. It also
allows the sample rate to change mid-stream.
12 years ago
Anton Khirnov
9b6f47c448
matroskadec: export full wavpack blocks.
...
This allows us to get rid of demuxer-specific hacks in the decoder and
will allow streamcopy from matroska once we have a wavpack muxer.
12 years ago
Anton Khirnov
5074f4545c
wavpack demuxer: export full wavpack blocks.
...
Currently the demuxer shaves the blocks and exports only the
information that is useful to the decoder.
Exporting the blocks just as they are stored is simpler to understand
and will make remuxing wavpack easier.
12 years ago
Anton Khirnov
72dee5f40b
wavpack: don't set sample format in init.
...
We don't know whether it will be float until we look at the data.
12 years ago
Anton Khirnov
35596bd4f4
wavpack: remove a useless parameter from wavpack_decode_block().
...
The decoder always returns output if an error does not occur.
12 years ago
Anton Khirnov
d1bec4be22
wavpack: return an error on 0-sized blocks
...
Such blocks are not valid.
12 years ago
Anton Khirnov
1d177200ce
wavpack: remove a useless check.
...
Number of samples in the first block is checked to be strictly positive
earlier in wavpack_decode_frame() and number of samples in all the other
blocks is checked to be equal to the first one.
12 years ago
Anton Khirnov
0f3a0b24dd
wavpack: add an error message to a failure.
12 years ago
Anton Khirnov
474fb0c9d9
wavpack: return 0 instead of samples count from decoding functions
...
The caller never cares about the number of decoded samples, so this only
confuses the reader.
12 years ago
Anton Khirnov
528daa3990
wavpack: switch to planar output
...
This simplifies the code and makes it faster.
12 years ago
Anton Khirnov
a7ec3a9a4e
wavpack: drop redundant if/else blocks
12 years ago
Anton Khirnov
7b44c99180
wavpack: remove the subframes codec cap
...
The decoder always consumes full packets.
12 years ago
Luca Barbato
fd06291239
wavpack: check packet size early
...
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
12 years ago
Luca Barbato
3f0b6d7a62
wavpack: use bytestream2 in wavpack_decode_block
...
Prevent most out of buffer reads.
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
12 years ago
Luca Barbato
ed50673066
wavpack: validate samples size parsed in wavpack_decode_block
...
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
12 years ago
Luca Barbato
8c34558131
wavpack: return meaningful errors
...
And forward those that were already meaningful.
12 years ago
Luca Barbato
0f689a3d97
wavpack: K&R formatting cosmetics
...
Signed-off-by: Diego Biurrun <diego@biurrun.de>
12 years ago
Anton Khirnov
759001c534
lavc decoders: work with refcounted frames.
12 years ago
Justin Ruggles
9873d71f31
wavpack: decode directly to the user-provided AVFrame
12 years ago
Anton Khirnov
594d4d5df3
lavc: add a wrapper for AVCodecContext.get_buffer().
...
It will be useful in the upcoming transition to refcounted AVFrames.
12 years ago
Justin Ruggles
a903f8f087
Include libavutil/channel_layout.h instead of libavutil/audioconvert.h
...
Also reorder some other #include when applicable.
12 years ago
Anton Khirnov
36ef5369ee
Replace all CODEC_ID_* with AV_CODEC_ID_*
12 years ago
Hendrik Leppkes
37c6ad2345
wavpack: set bits_per_raw_sample for S32 samples to properly identify 24-bit
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
13 years ago
Derek Buitenhuis
f604eab30a
wavpack: Fix an integer overflow
...
Integer Overflow Checker detected an integer
overflow while FATE was running.
See: http://fate.libav.org/x86_64-linux-ioc/
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Kostya Shishkov <kostya.shishkov@gmail.com>
13 years ago
Derek Buitenhuis
480b133e6f
wavpack: Don't shift minclip/maxclip
...
Since we are clipping before we shift the values to
16 or 32 bits, we should not shift the min/max clip
values to compensate.
Fixes 8 and 24 bit lossy decoding.
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
13 years ago
Justin Ruggles
9d7cee50aa
wavpack: add needed braces for 2 statements inside an if block
13 years ago
Paul B Mahol
c388558d31
wavpack: allow user to disable CRC checking
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
13 years ago
Kostya Shishkov
e6e7bfc11e
wavpack: fix clipping for 32-bit lossy mode
...
Reference decoder clips data before shifting it to final range and also
forces 32-bit lossy mode to be actually 24-bit lossy mode in order to be
able to perform proper clipping.
13 years ago
Justin Ruggles
3a1867deac
wavpack: fix typos in previous cosmetic clean-up commit
13 years ago
Justin Ruggles
513c238fa9
wavpack: cosmetics: K&R pretty-printing
13 years ago
Hendrik Leppkes
14165fe125
wavpack: determine sample_fmt before requesting a buffer
...
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
13 years ago
Diego Biurrun
aaf47bcde7
Drop ALT_ prefix from BITSTREAM_READER_LE name.
...
The prefix is a historic remnant that probably meant "alternative".
Now that the A32 bitstream reader has been dropped it makes no sense anymore.
13 years ago
Derek Buitenhuis
bb9747c8ee
wavpack: Fix 32-bit clipping
...
In the case that (frame_flags & 0x03) == 3, hybrid_maxclip
may have had a signed integer overflow.
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
13 years ago
Derek Buitenhuis
365e1ec26d
wavpack: Clip samples after shifting
...
It doesn't make much sense to clip pre-shift,
nor is it correct for proper decoding.
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
13 years ago
Derek Buitenhuis
a548b6cbfc
wavpack: Properly clip samples during lossy decode
...
When decoding lossy WavPack samples, they are supposed
to be clipped, in order to be decoded correctly.
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
13 years ago
Justin Ruggles
0eea212943
Add avcodec_decode_audio4().
...
Deprecate avcodec_decode_audio3().
Implement audio support in avcodec_default_get_buffer().
Implement the new audio decoder API in all audio decoders.
13 years ago
Justin Ruggles
d2604f9260
wavpack: calculate bpp using av_get_bytes_per_sample()
13 years ago
Laurent Aimar
2c6cf13940
wavpack: Reset internal state on corrupted blocks
...
wavpack_decode_block() supposes that it is called back with the exact
same buffer unless it has returned with an error. With multi-channels
files, wavpack_decode_frame() was breaking this assumption.
Signed-off-by: Janne Grunau <janne-libav@jannau.net>
13 years ago
Laurent Aimar
8bfea4ab4e
Fixed segfault with wavpack decoder on corrupted decorrelation terms sub-blocks.
...
Signed-off-by: Martin Storsjö <martin@martin.st>
13 years ago
Alex Converse
dba2b63a98
wavpack: Check error codes rather than working around error conditions.
13 years ago
Laurent Aimar
55354b7de2
Fixed invalid access in wavpack decoder on corrupted bitstream.
...
Signed-off-by: Martin Storsjö <martin@martin.st>
13 years ago
Laurent Aimar
0aedab0340
Fixed invalid writes in wavpack decoder on corrupted bitstreams.
...
Signed-off-by: Martin Storsjö <martin@martin.st>
13 years ago
Laurent Aimar
beefafda63
Fixed invalid access in wavpack decoder on corrupted extra bits sub-blocks.
...
Signed-off-by: Martin Storsjö <martin@martin.st>
13 years ago
Kostya Shishkov
bcd4aa8bec
wavpack: fix wrong return value in wavpack_decode_block()
...
This function should return number of samples decoded, not number of bytes
decoded.
Spotted by Uoti Urpala.
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
13 years ago
Kostya Shishkov
9bc4e21a9b
wavpack: use context reset in appropriate places
...
This fixes improper flushing in the cases when the same frame is decoded in
several iterations (for being too large to fit into output buffer) and flush is
called mid-decoding and it also resets context in case of decoding errors.
Signed-off-by: Anton Khirnov <anton@khirnov.net>
13 years ago
Kostya Shishkov
4ba8c521b1
WavPack decoder: implement flush function
...
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
13 years ago
Anton Khirnov
ec6402b7c5
lavc: use designated initialisers for all codecs.
...
It's more readable and less prone to breakage.
14 years ago