Rafaël Carré
91d4cfb812
apedec: do not buffer decoded samples over AVPackets
...
Only consume an AVPacket when all the samples have been read.
When the rate of samples output is limited (by the default value
of max_samples), consuming the first packet immediately will cause
timing problems:
- The first packet with PTS 0 will output 4608 samples and be
consumed entirely
- The second packet with PTS 64 will output the remaining samples
(typically, a lot, that's why max_samples exist) until the decoded
samples of the first packet have been exhausted, at which point the
samples of the second packet will be decoded and output when
av_decode_frame is called with the next packet).
That means there's a PTS jump since the first packet is 'decoded'
immediately, which can be seen with avplay or mplayer: the timing
jumps immediately to 6.2s (which is the size of a packet).
Sample: http://streams.videolan.org/issues/6348/Goldwave-MAClib.ape
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
11 years ago
Michael Niedermayer
60ab448042
ape_decode_value_3860: check k before using it in get_bits()
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
8937230719
ape_decode_value_3900: check tmpk
...
Fixes division by 0
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Kostya Shishkov
613a37eca4
ape: 3.80-3.92 decoding support
12 years ago
Kostya Shishkov
c42e262513
add support for Monkey's Audio versions from 3.93
12 years ago
Kostya Shishkov
9652d4fcfc
ape: provide two additional bytes in buffer for old MAC versions
...
Range coder in 3.90-3.95 overread two bytes in the final normalize.
12 years ago
Kostya Shishkov
b164d66e35
ape: make version-dependent decoding functions called via pointers
...
This will help in supporting old versions, e.g. version 3.93 uses the same
range coder but different predictor and version 3.82 uses different range
coder and predictor. Also this should not make decoding newer versions slower
by introducing additional checks on versions.
12 years ago
Diego Biurrun
6d97484d72
avcodec: av_log_ask_for_sample() ---> avpriv_request_sample()
12 years ago
Clément Bœsch
1ec94b0f06
lavc: factorize ff_{thread_,re,}get_buffer error messages.
...
Coccinelle profile used:
@@
expression r, ctx, f, loglevel, str, flags;
@@
-if ((r = ff_get_buffer(ctx, f, flags)) < 0) {
- av_log(ctx, loglevel, str);
- return r;
-}
+if ((r = ff_get_buffer(ctx, f, flags)) < 0)
+ return r;
@@
expression r, ctx, f, loglevel, str;
@@
-if ((r = ff_reget_buffer(ctx, f)) < 0) {
- av_log(ctx, loglevel, str);
- return r;
-}
+if ((r = ff_reget_buffer(ctx, f)) < 0)
+ return r;
@@
expression r, ctx, f, loglevel, str, flags;
@@
-if ((r = ff_thread_get_buffer(ctx, f, flags)) < 0) {
- av_log(ctx, loglevel, str);
- return r;
-}
+if ((r = ff_thread_get_buffer(ctx, f, flags)) < 0)
+ return r;
...along with some manual patches for the remaining ones.
12 years ago
Anton Khirnov
759001c534
lavc decoders: work with refcounted frames.
12 years ago
Justin Ruggles
5932e2d7d2
ape: 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
Paul B Mahol
77d89a5b16
apedec: consume packet after it has been fully decoded
...
Timestamp handling of decoded frames are much simpler now.
Fixes #1675 .
Signed-off-by: Paul B Mahol <onemda@gmail.com>
12 years ago
Justin Ruggles
461ba7e97a
apedec: output in planar sample format
12 years ago
Martin Storsjö
e6153f173a
avopt: Store defaults for AV_OPT_TYPE_INT in the i64 union member
...
Signed-off-by: Martin Storsjö <martin@martin.st>
12 years ago
Martin Storsjö
124134e424
avopt: Store defaults for AV_OPT_TYPE_CONST in the i64 union member
...
Signed-off-by: Martin Storsjö <martin@martin.st>
12 years ago
Anton Khirnov
36ef5369ee
Replace all CODEC_ID_* with AV_CODEC_ID_*
12 years ago
Christophe Gisquet
706b998cdc
ape: Use unsigned integer maths
...
This involves a division that should be a shift.
Signed-off-by: Diego Biurrun <diego@biurrun.de>
13 years ago
Martin Storsjö
00c3b67b8a
cosmetics: Align codec declarations
...
Also break some long lines, remove codec function placeholder comments
and add spaces in sample/pixel format lists.
Signed-off-by: Martin Storsjö <martin@martin.st>
13 years ago
Michael Niedermayer
420d1df2e2
apedec: check bits <= 32.
...
Fixes a floating-point exception further down.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
13 years ago
Michael Niedermayer
8db2935db0
apedec: fix global array overread
...
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
13 years ago
Michael Niedermayer
7a5e587249
apedec: check bits <= 32
...
Fixes FPE
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
13 years ago
Martin Storsjö
9cf0841ef3
dsputil: Add ff_ prefix to the dsputil*_init* functions
...
Signed-off-by: Martin Storsjö <martin@martin.st>
13 years ago
Justin Ruggles
37390d5cca
apedec: allow the user to set the maximum number of output samples per call
...
It makes sense in some cases to split up the output packet to save on memory
usage (ape frames can be very large), but the current/default size is
arbitrary. Allowing the user to configure this gives more flexibility and
requires minimal additional code.
13 years ago
Justin Ruggles
39575eead2
apedec: do not unnecessarily zero output samples for mono frames
13 years ago
Justin Ruggles
1d3c672d27
apedec: allocate a single flat buffer for decoded samples
...
This will allow the decoder to return samples for the full packet, and it also
makes the decoded buffer pointers aligned.
13 years ago
Justin Ruggles
32c61400c0
apedec: use sizeof(field) instead of sizeof(type)
13 years ago
Paul B Mahol
b60620bf7e
apedec: 8bit and 24bit support
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
13 years ago
Michael Niedermayer
670229ef43
apedec: remove unused variable
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
13 years ago
Justin Ruggles
22c0babbb2
apedec: remove unneeded #include of get_bits.h and associated macro
13 years ago
Justin Ruggles
e4169612a1
apedec: av_fast_malloc() instead of av_realloc()
...
av_realloc() does not guarantee alignment, which is required for
DSPContext.bswap_buf().
13 years ago
Justin Ruggles
0759c8eb10
apedec: fix handling of packet sizes that are not a multiple of 4 bytes
13 years ago
Michael Niedermayer
6462d28dcc
apedec: Fix alignment and fate.
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
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
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
Mans Rullgard
644bff6c9b
apedec: fix signed integer overflows
...
This bit manipulation is equivalent but avoids undefined
shifts and overflows.
Signed-off-by: Mans Rullgard <mans@mansr.com>
13 years ago
Justin Ruggles
c298b2b8db
apedec: consume the whole packet when copying to the decoder buffer.
...
This avoids artifically consuming a partial packet but ignoring remaining data
in subsequent calls.
13 years ago
Justin Ruggles
de157f2118
apedec: do not needlessly copy s->samples to nblocks.
...
also move nblocks to the local scope where it is used.
13 years ago
Justin Ruggles
4315c7d35a
apedec: check output buffer size after calculating actual output size
13 years ago
Justin Ruggles
ad17207b51
apedec: remove unneeded entropy decoder normalization.
...
The decoder already skips data at the end of the packet without this.
Also remove 2 APEContext fields that were only used for the end-of-frame
normalization.
13 years ago
Justin Ruggles
9a33264478
apedec: assert that s->samples is not negative before trying to decode
13 years ago
Justin Ruggles
0927154d37
apedec: use FFALIGN macro for internal data buffer size
13 years ago
Justin Ruggles
5b8009f4c8
apedec: do not keep incrementing the input data pointer past the end of the
...
buffer during entropy decoding.
The pointer address could overflow, which would likely segfault. Instead set
the context error flag to indicate that the decoder tried to read past the
end of the packet data.
13 years ago
Justin Ruggles
a4c32c9a63
apedec: check for input buffer overflow while reading frame header
13 years ago
Justin Ruggles
fd244ae3a0
apedec: use unsigned int for offset
...
avoids implementation-defined unsigned-to-signed conversion and simplifies
the bounds checking.
13 years ago
Justin Ruggles
89ec474a43
apedec: remove pointless increment of 'buf'
...
The variable is not used anymore at that point.
13 years ago
Justin Ruggles
52d4fb2a3d
apedec: set s->currentframeblocks after validating nblocks
13 years ago
Justin Ruggles
2cab578489
apedec: use unsigned int for 'nblocks' and make sure that it's within int range
13 years ago
Justin Ruggles
b7e5145759
apedec: do not set s->samples until after validation.
...
This prevents errors and/or invalid writes in the next decode call due to
s->samples still being negative.
13 years ago