Luca Barbato
701966730c
vmd: drop incomplete chunks and spurious samples
...
Odd chunk size makes no sense for stereo and incomplete chunks are
not supported.
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
12 years ago
Luca Barbato
676da248ca
vmd: refactor the inner decode loop
...
Simplify a little, assume empty frames are acceptable and
do not pointlessly reinit the bytestream2 contexts using
possibly wrong size values.
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
12 years ago
Luca Barbato
c8f3cb9119
vmd: return meaningful errors
...
CC: libav-stable@libav.org
12 years ago
Luca Barbato
91a6944e56
vmd: use the PALETTE_COUNT constant uniformly
...
While at it drop useless parentheses.
12 years ago
Paul B Mahol
663794f63d
vmdav: unbreak decoding of samples from game The Last Dynasty
...
This fixes video output with samples HG060808.VMD and
HG060810.VMD. Regression since c0cbe36b18
.
While here show warning if decoding is aborted for some reason.
Signed-off-by: Paul B Mahol <onemda@gmail.com>
12 years ago
Paul B Mahol
cdada4f639
vmdav: return meaningful error codes
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
12 years ago
Michael Niedermayer
c1f2c4c3b4
vmdav: Try to fix unpack_rle()
...
This fixes out of array accesses
The code prior to this commit could not have worked, thus obviously
was untested. I was also not able to find a valid sample that uses this
code.
This fix is thus only based on the description of the format
If someone has a sample that uses unpack_rle(), please mail me.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Paul B Mahol
a345b7f906
vmdav: use more unchecked bytestream2 variants where it makes sense
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
12 years ago
Alexandra Khirnova
0afcf97e1e
vmdav: convert to bytestream2
...
Signed-off-by: Anton Khirnov <anton@khirnov.net>
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
f86d66bcfa
vmdaudio: fix invalid reads when packet size is not a multiple of chunk size
...
CC:libav-stable@libav.org
12 years ago
Anton Khirnov
759001c534
lavc decoders: work with refcounted frames.
12 years ago
Justin Ruggles
f80f8dd4c2
vmdaudio: decode directly to the user-provided AVFrame
12 years ago
Anton Khirnov
df9b956751
lavc: fix decode_frame() third parameter semantics for video decoders
...
It's got_frame, not data size
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
Michael Niedermayer
c2409a7c5b
vmdav: more complete check for block_align, prevent out of array access.
...
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
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
Justin Ruggles
50a65e7a54
vmdaudio: set channel layout
12 years ago
Michael Niedermayer
b12d92efd6
avoid "0xFF << 24" as it is considered a integer overflow in C99
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Anton Khirnov
716d413c13
Replace PIX_FMT_* -> AV_PIX_FMT_*, PixelFormat -> AVPixelFormat
12 years ago
Martin Storsjö
1d9c2dc89a
Don't include common.h from avutil.h
...
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
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
Paul B Mahol
a0b07b8fc5
vmdvideo: remove superfluous strings from av_log messages
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
13 years ago
Michael Niedermayer
2278ecc434
vmdav: check that theres enough space for a chunk remaining.
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
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
Carl Eugen Hoyos
1fc573dd25
Increase Sierra VMD palette dynamics.
13 years ago
Carl Eugen Hoyos
90f75f9804
Set Sierra VMD palette opaque.
13 years ago
Reimar Döffinger
371e165443
Try to set AVFrame.reference to correct values.
...
I am not sure these new values are correct, not am I sure
the semantics are a good idea since we do not seem to make any
use of them but they caused a lot of confusion, but this
seems to make things closer to matching the documentation.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
13 years ago
Laurent Aimar
c0cbe36b18
vmd: fix segfaults on corruped streams
...
Signed-off-by: Janne Grunau <janne-libav@jannau.net>
13 years ago
Justin Ruggles
4568c2bf97
vmdaudio: fix decoding of 16-bit audio format.
...
The initial sample of each block is raw 16-bit PCM, not DPCM.
Fixes decoding of all samples in:
http://streams.videolan.org/samples/game-formats/sierra-vmd/Lighthouse/
13 years ago
Laurent Aimar
35cb6854bb
Fix potential pointer arithmetic overflows in rle_unpack() of vmd video decoder.
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
13 years ago
Laurent Aimar
4749e07498
Fix out of bound reads in rle_unpack() of vmd video decoder.
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
13 years ago
Laurent Aimar
e07377e736
Check for out of bound reads in vmd_decode() of vmd video decoder.
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
13 years ago
Laurent Aimar
78cb39d2b2
Fix potential pointer arithmetic overflows in lz_unpack of vmd video decoder.
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
13 years ago
Laurent Aimar
5127f465bd
Prevent out of bound read in lz_unpack in vmd video decoder.
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
13 years ago
Laurent Aimar
6a6383bebc
Prevent NULL dereferences when the previous frame is missing in vmd video decoder.
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
13 years ago
Laurent Aimar
e7aed1280e
Check for invalid update parameters in vmd video decoder.
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
13 years ago
Laurent Aimar
00cbe9e405
Fix potential overread in vmd audio decoder.
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
13 years ago
Anton Khirnov
ec6402b7c5
lavc: use designated initialisers for all codecs.
...
It's more readable and less prone to breakage.
13 years ago
Justin Ruggles
e6c52cee54
Replace usages of av_get_bits_per_sample_fmt() with av_get_bytes_per_sample().
...
av_get_bits_per_sample_fmt() is deprecated.
14 years ago
Mans Rullgard
e65ab9d94f
Remove unused variables
14 years ago
Clément Bœsch
adba9c6352
Fix various unused variable warnings
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
14 years ago
Stefano Sabatini
01042d4123
lavc: set defaults in internal codec frames
...
This is required specifically for setting frame->format to -1,
otherwise it will be set to 0 = PIX_FMT_YUV420P and code reading
the format from the output decoded frame will get misled.
In particular fix regressions occurring with the pending vsrc_buffer
patch.
14 years ago
Mans Rullgard
2912e87a6c
Replace FFmpeg with Libav in licence headers
...
Signed-off-by: Mans Rullgard <mans@mansr.com>
14 years ago
Justin Ruggles
1e898e7d35
vmdaudio: output 8-bit audio as AV_SAMPLE_FMT_U8.
...
There is no need to expand to 16-bits. Just use memcpy() to copy the raw data.
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
(cherry picked from commit 1108f8998c
)
14 years ago
Justin Ruggles
f3618b014b
vmdaudio: remove unnecessary fields from VmdAudioContext and use the corresponding AVCodecContext fields instead.
...
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
(cherry picked from commit 2ec7862db8
)
14 years ago
Justin Ruggles
5e7c422dda
vmdaudio: add out_bps to VmdAudioContext and use it to replace hard-coded sample size.
...
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
(cherry picked from commit 1e86d685e0
)
14 years ago
Justin Ruggles
504dff8e4e
vmdaudio: simplify vmdaudio_decode_frame() by handling block_type first, then making a single call to vmdaudio_loadsound().
...
This also adds output buffer size checks for AUDIO and SILENCE block types.
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
(cherry picked from commit 1574eff3d2
)
14 years ago
Justin Ruggles
83e94d50cb
cosmetics: reindent after previous commit
...
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
(cherry picked from commit ba9516cca8
)
14 years ago