Andreas Rheinhardt
c1e439d7e9
avformat: Forward errors where possible
...
It is not uncommon to find code where the caller thinks to know better
what the return value should be than the callee. E.g. something like
"if (av_new_packet(pkt, size) < 0) return AVERROR(ENOMEM);". This commit
changes several instances of this to instead forward the actual error.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 years ago
Steven Liu
a3655a5cb2
avformat/smacker: fix memleak when avformat_new_stream failed
...
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
5 years ago
Carl Eugen Hoyos
4d8875ec23
lavf: Constify the probe function argument.
...
Reviewed-by: Lauri Kasanen
Reviewed-by: Tomas Härdin
6 years ago
Michael Niedermayer
ec683ed527
smacker: fix integer overflow with pts_inc
...
Bug-Id: 1073
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Sean McGovern <gseanmcg@gmail.com>
7 years ago
Sean McGovern
9e36102278
smacker: return meaningful error codes on failure
7 years ago
Anton Khirnov
9200514ad8
lavf: replace AVStream.codec with AVStream.codecpar
...
Currently, AVStream contains an embedded AVCodecContext instance, which
is used by demuxers to export stream parameters to the caller and by
muxers to receive stream parameters from the caller. It is also used
internally as the codec context that is passed to parsers.
In addition, it is also widely used by the callers as the decoding (when
demuxer) or encoding (when muxing) context, though this has been
officially discouraged since Libav 11.
There are multiple important problems with this approach:
- the fields in AVCodecContext are in general one of
* stream parameters
* codec options
* codec state
However, it's not clear which ones are which. It is consequently
unclear which fields are a demuxer allowed to set or a muxer allowed to
read. This leads to erratic behaviour depending on whether decoding or
encoding is being performed or not (and whether it uses the AVStream
embedded codec context).
- various synchronization issues arising from the fact that the same
context is used by several different APIs (muxers/demuxers,
parsers, bitstream filters and encoders/decoders) simultaneously, with
there being no clear rules for who can modify what and the different
processes being typically delayed with respect to each other.
- avformat_find_stream_info() making it necessary to support opening
and closing a single codec context multiple times, thus
complicating the semantics of freeing various allocated objects in the
codec context.
Those problems are resolved by replacing the AVStream embedded codec
context with a newly added AVCodecParameters instance, which stores only
the stream parameters exported by the demuxers or read by the muxers.
9 years ago
Michael Niedermayer
7ed47e9729
avformat/smacker: fix integer overflow with pts_inc
...
Fixes: ce19e41f0ef1e52a23edc488faecdb58/asan_heap-oob_2504e97_4202_ffa0df1baed14022b9bfd4f8ac23d0cb.smk
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
9 years ago
Vittorio Giovara
059a934806
lavc: Consistently prefix input buffer defines
...
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
9 years ago
Michael Niedermayer
465f3705b1
avformat/smacker: Fix number suffix
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
James Almer
d34ec64a22
replace calls to url_feof() with avio_feof()
...
Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Diego Biurrun
d92024f18f
lavf: more correct printf format specifiers
11 years ago
Michael Niedermayer
0062869ae2
avformat/smacker: check width/height in probe
...
Fixes probetest failure
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Paul B Mahol
a807c68253
avformat: use ff_alloc_extradata()
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
11 years ago
Martin Storsjö
d872fb0f7f
lavf: Reset the entry count and allocation size variables on av_reallocp failures
...
When av_reallocp fails, the associated variables that keep track of
the number of elements in the array (and in some cases, the
separate number of allocated elements) need to be reset.
Not all of these might technically be needed, but it's better to
reset them if in doubt, to make sure variables don't end up
conflicting.
Signed-off-by: Martin Storsjö <martin@martin.st>
11 years ago
Michael Niedermayer
8be56e464b
avformat/smacker: Check if bufs has been allocated before use
...
Fixes null pointer dereference
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Alexandra Khirnova
5626f994f2
avformat: Use av_reallocp() where suitable
...
Signed-off-by: Diego Biurrun <diego@biurrun.de>
11 years ago
Paul B Mahol
78f680cb36
avformat/smacker: use av_malloc_array() and check for allocation error
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
11 years ago
Michael Niedermayer
d2d96f9e47
vformat/smacker: use av_freep() to ensure no stale pointers remain
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Martin Storsjö
710b0e2702
smacker: Avoid integer overflow when allocating packets
...
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
11 years ago
Martin Storsjö
8d928023f9
smacker: Don't return packets in unallocated streams
...
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
11 years ago
Paul B Mahol
9e505485f3
avformat/smacker: check avformat_new_stream() return value
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
11 years ago
Kostya Shishkov
ee16a0ced0
smacker: check frame size validity
...
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
12 years ago
Kostya Shishkov
58c95448e4
smacker: pad the extradata allocation
...
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
12 years ago
Kostya Shishkov
851bc1d6be
smacker: assign video frame PTS
12 years ago
Kostya Shishkov
c3c08baefb
smacker: fix off-by-one error in palette expanding code
12 years ago
Paul B Mahol
e3cc92a623
smacker: fix off by one error
...
Regression since a93b572ae4
.
Fixes #2426 .
Signed-off-by: Paul B Mahol <onemda@gmail.com>
12 years ago
Paul B Mahol
547b8aeed4
smacker: use meaningful error codes
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
12 years ago
Justin Ruggles
bfccd76adb
smacker: set channel layout
12 years ago
Anton Khirnov
716d413c13
Replace PIX_FMT_* -> AV_PIX_FMT_*, PixelFormat -> AVPixelFormat
12 years ago
Anton Khirnov
36ef5369ee
Replace all CODEC_ID_* with AV_CODEC_ID_*
12 years ago
Paul B Mahol
29ba3aacb1
lavf/smacker: remove bogus video from .long_name
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
12 years ago
Michael Niedermayer
2a59abf1a8
smackerdemux: Allocate padding for extradata
...
Fixes slight overread.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
13 years ago
Ronald S. Bultje
a93b572ae4
smacker: error out if palette copy-with-offset overruns palette size.
...
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
13 years ago
Anton Khirnov
6e9651d106
lavf: remove AVFormatParameters from AVFormatContext.read_header signature
13 years ago
Michael Niedermayer
c402c1c976
smackerdemuxer: check some values before instead of just after malloc()
...
Fixes Ticket777
Bug Found by: Diana Elena Muscalu
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
13 years ago
Anton Khirnov
c3f9ebf743
lavf: make av_set_pts_info private.
...
It's supposed to be called only from (de)muxers.
13 years ago
Anton Khirnov
3b3bbdd3e6
lavf,lavd: replace av_new_stream->avformat_new_stream part I.
...
Trivial replacements with sed are done in this commit:
sed 's/av_new_stream(\([^)]*\), 0)/avformat_new_stream(\1, NULL)/'
13 years ago
Justin Ruggles
a7984a6a6d
smacker: Separate audio flags from sample rates in smacker demuxer.
...
Makes the code easier to understand.
13 years ago
Laurent Aimar
a92d0fa5d2
Fixed off by one packet size allocation in the smacker demuxer.
...
Signed-off-by: Martin Storsjö <martin@martin.st>
13 years ago
Laurent Aimar
e055932f56
Check for invalid packet size in the smacker demuxer.
...
Signed-off-by: Martin Storsjö <martin@martin.st>
13 years ago
Kostya Shishkov
47a8589f7b
smacker demuxer: handle possible av_realloc() failure.
...
Signed-off-by: Anton Khirnov <anton@khirnov.net>
13 years ago
Laurent Aimar
d0121e8d96
Fixed segfault on corrupted smacker streams in the demuxer.
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
13 years ago
Anton Khirnov
dfc2c4d900
lavf: use designated initialisers for all (de)muxers.
...
It's more readable and less prone to breakage.
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
Mans Rullgard
2912e87a6c
Replace FFmpeg with Libav in licence headers
...
Signed-off-by: Mans Rullgard <mans@mansr.com>
14 years ago
Anton Khirnov
66e5b1df36
avio: deprecate url_feof
...
AVIOContext.eof_reached should be used directly instead.
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
14 years ago
Anton Khirnov
384c9c2fa7
avio: add avio_tell macro as a replacement for url_ftell
...
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
(cherry picked from commit a2704c9712
)
14 years ago
Anton Khirnov
a2704c9712
avio: add avio_tell macro as a replacement for url_ftell
...
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
14 years ago
Anton Khirnov
f59d8ff8cd
avio: avio_ prefix for url_fseek
...
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
(cherry picked from commit 6b4aa5dac8
)
14 years ago