The register function now specifies that the user callback should
leave things in the same state that it found them on failure but
that failure to destroy is ignored by the library. The register
function is now explicit about its behavior on failure
(it unregisters the previous callback and destroys all mutex).
Signed-off-by: Manfred Georg <mgeorg@google.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Fixes out of array accesses
Fixes: asan_heap-oob_12304aa_8_asan_heap-oob_4da4f3_300_intro.jv
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
The register function now specifies that the user callback should
leave things in the same state that it found them on failure but
that failure to destroy is ignored by the library. The register
function is now explicit about its behavior on failure
(it unregisters the previous callback and destroys all mutex).
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Add CODEC_FLAG2_SKIP_MANUAL (exposed as "skip_manual"), which makes
the decoder export sample skip information via side data, instead
of applying it automatically. The format of the side data is the
same as AV_PKT_DATA_SKIP_SAMPLES, but since AVPacket and AVFrame
side data constants overlap, AV_FRAME_DATA_SKIP_SAMPLES needs to
be introduced.
This is useful for applications which want to do the timestamp
calculations manually, or which actually want to retrieve the
padding.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
A badly behaving user provided mutex manager (such as that in OpenCV) may not reset the mutex to NULL on destruction. This can cause a problem for a later mutex manager (which may assert that the mutex is NULL before creating).
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
mplayer-specifc hacks should not be in our codebase. mplayer should fix
its own code. It is not our responsibility to work around their broken
code.
This reverts commit e8e575633f.
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
* commit '53abe32409f13687c864b3cda077a1aa906a2459':
avcodec: Mark argument in av_{parser|hwaccel|bitstream_filter}_next as const
Conflicts:
libavcodec/avcodec.h
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* commit '1b04eb20f7e3f0a71f73ba91efcc3d60a435e443':
lavc: do not allocate edges in the default get_buffer2()
Conflicts:
libavcodec/utils.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* commit '9e500efdbe0deeff1602500ebc229a0a6b6bb1a2':
Add av_image_check_sar() and use it to validate SAR
Conflicts:
libavcodec/dpx.c
libavcodec/dvdec.c
libavcodec/ffv1dec.c
libavcodec/utils.c
libavutil/version.h
Merged-by: Michael Niedermayer <michaelni@gmx.at>
recode_subtitle() is called implicitly by avformat_find_stream_info().
As such, clients which disable ICONV always crash if a file contains
subtitles; even if they don't care about them.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Add AV_PKT_DATA_DISPLAYMATRIX and AV_FRAME_DATA_DISPLAYMATRIX as stream and
frame side data (respectively) to describe a display transformation matrix
for linear transformation operations on the decoded video.
Add functions to easily extract a rotation angle from a matrix and
conversely to setup a matrix for a given rotation angle.
Signed-off-by: Anton Khirnov <anton@khirnov.net>
* commit 'e1b66778b6ee82a192b5895e23c4e135f7269326':
lavc: remove the locking code in avcodec_close()
Conflicts:
libavcodec/utils.c
Note, if someone knows of a external codec lib/API, hwaccel or other that requires
locking on its close/free side, please contact ffmpeg-devel.
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* commit 'ebc29519d1634bfeb386c20a5d8a52837aae2436':
hwaccel: Support specific frame allocators
Conflicts:
libavcodec/utils.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* commit '5c1d7246cd65dc4db1b6dc36e29ce39fc1068f3f':
lavc: set AVCodecContext.hwaccel in ff_get_format()
Conflicts:
libavcodec/mpeg12dec.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
The most interesting parts are initialization in ff_MPV_common_init() and
uninitialization in ff_MPV_common_end().
ff_mpeg_unref_picture and ff_thread_release_buffer have additional NULL
checks for Picture.f, because these functions can be called on
uninitialized or partially initialized Pictures.
NULL pointer checks are added to ff_thread_release_buffer() stub function.
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* commit '6f273093e54cba130f3ffde3d6433e74baa4ad89':
LucasArts SMUSH VIMA audio decoder
Conflicts:
Changelog
libavcodec/avcodec.h
libavcodec/codec_desc.c
libavcodec/version.h
libavcodec/vima.c
This commit adds a AV_CODEC_ID_ADPCM_VIMA alias in addition to the previously
used AV_CODEC_ID_VIMA, as well as a AVCodec with name "adpcm_vima" in addition
to the previously used name "vima"
These changes are needed for compatibility with the renamed codec in libav
See: b18357326c and others
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* commit '4a0f6651434c6f213d830140f575b4ec7858519f':
libavcodec: when decoding, copy replaygain side data to decoded frames
Conflicts:
libavcodec/internal.h
libavcodec/rawdec.c
libavcodec/utils.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
This limits ABI issues in case libavcodec is linked to a libavutil with larger AVFrame
Which can happen if they are shiped in seperate binary packages and libavutil is upgraded
A cleaner alternative would be to replace them by pointers but this would likely cause
a small speedloss
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This is a bit tricky, we allocate a correctly sized AVFrame but then only
copy the compile time AVFrame size, this is to ensure that user applications
which do not use the correct av frame API dont end with out of array reads.
Note, applications using the correct API have set extended_data and the
changed code will never be executed for them.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* commit '8feac29cc46270cc89d6016340e7bac780877131':
lavc: use AVFrame API properly in ff_reget_buffer()
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Fixes inconsistency and out of array accesses
Fixes: 10cdd7e63e7f66e3e66273939e0863dd-asan_heap-oob_1a4ff32_7078_cov_4056274555_mov_h264_aac__mp4box_frag.mp4
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* commit 'e0ab5078a7d865f8f6fd6a6d3cbe0f380ead4a3d':
lavc: do not force the emu edge flag
Conflicts:
libavcodec/utils.c
There should be no such bugs in ffmpeg, but merging it anyway
as its safer.
Merged-by: Michael Niedermayer <michaelni@gmx.at>
The default get_buffer2() implementation (and possibly some
user ones) does not allocate edges when this flag is set, which may
expose bugs in some decoders. Until the 10 release is out, it is safer
to remove this part.
* commit 'f7e85ee996b3886c2b13e928b83277382311af96':
lavc: allow the caller to override dimensions in ff_get_buffer()
Conflicts:
libavcodec/utils.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* commit '50079a6aa93291e6dc9d9fb8d33da83f79e9311d':
lavc: do not leak the internal frame if opening the codec fails
Conflicts:
libavcodec/utils.c
See: 8b285f03f7
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* commit '8058284ce09030b47512746d726fb2ad3ae8a20f':
lavc: add 422/444 YUV with alpha to align_dimensions()
Conflicts:
libavcodec/utils.c
Only cosmetical changes happen as these formats already where in the list before
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* commit '5b4797a21db900b7d509660b7a4d49829089b004':
avframe: add AV_FRAME_DATA_MATRIXENCODING side data type.
Conflicts:
libavutil/version.h
Merged-by: Michael Niedermayer <michaelni@gmx.at>
this allows seperate installation of shared libs that should not conflict with
whatever is already installed.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This ensures that theres just one AVFrame allocation function and libs dont
produce multiple AVFrame variants after a minor lib update
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Its possible to implement this with a few lines less code but it then
would flip the order of the list and require registration of external
codecs to be done first, also it could break user applications due to
this. Thus to maintain ABI this slighty more complex solution is
used.
Reviewed-by: Stefano Sabatini
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* commit 'a1ee1648690726b34e98eaf8db04fd7b3303cfc8':
lavc/decode_video(): always unref the frame if there is no output in decode_video
Conflicts:
libavcodec/utils.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* commit '85f947aefb3dae81f65f518acdffa8e31c679654':
lavc: remove a pointless check in decode_audio4()
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* commit 'd4f0f2d1e80b76260eb6b9cdde472ac069dfda56':
lavc: use buf[0] instead of data[0] as the indicator of an allocated frame
Conflicts:
libavcodec/utils.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* commit 'e5419709f50593769037ab77d7102f82d9260784':
lavc: remove the extended_data workarounds.
Conflicts:
libavcodec/utils.c
One hunk is not merged as not all codecs are updated yet
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Use only proper AVFrame API (no assigning of whole frames, since that
hardcodes sizeof(AVFrame) into lavc).
Make a copy of the side data, so the caller can use av_frame_unref/free
on non-refcounted frames, eliminating the need for
avcodec_get_frame_defaults()/avcodec_free_frame().
Not just on failure. This is the same thing that is done in the audio
path and should prevent leaks in decoders that allocate a frame, but
then end up not writing into it.
This code changes the input packet, which is read only and can in
rare circumstances lead to decoder errors. (i run into one of these in
the audio decoder, which corrupted the packet during av_find_stream_info()
so that actual decoding that single packet failed later)
Until a better fix is implemented, this commit limits the problem.
A better fix might be to make the subtitle decoders not depend on
data[size] = 0 or to copy their input when this is not the case.