summaryrefslogtreecommitdiffstats
path: root/libavcodec/avpacket.c
Commit message (Collapse)AuthorAgeFilesLines
* avcodec/avpacket: Improve allocating packetsAndreas Rheinhardt2019-09-181-1/+1
| | | | | | | | av_mallocz + av_init_packet leads to the same result as av_mallocz + av_packet_unref, but faster. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavc/avpacket: check NULL before using the pointerJun Zhao2019-05-121-1/+2
| | | | | | Need to check NULL before using the pointer Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
* avcodec/avpacket: add some assertions to ensure pkt->data is not null if ↵Marton Balint2019-03-011-0/+3
| | | | | | | | | | | pkt->size > 0 This should fix the following Coverity false positives: Coverity CID #1405450. Coverity CID #1430930. Signed-off-by: Marton Balint <cus@passwd.hu>
* avcodec/avpacket: Avoid unspecific return -1 for av_grow_packet()Michael Niedermayer2019-01-011-2/+2
| | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/avpacket: fix whitespaceAman Gupta2018-10-121-4/+4
| | | | Signed-off-by: Aman Gupta <aman@tmm1.net>
* lavc/avpacket: Add missing conversions from side data enum to name.Jun Zhao2018-09-211-0/+6
| | | | | | Add missing conversions from side data enum to name. Signed-off-by: Jun Zhao <mypopydev@gmail.com>
* avcodec/avpacket: add av_packet_make_refcounted()James Almer2018-04-011-0/+18
| | | | | | | | It works as a drop in replacement for the deprecated av_dup_packet(), to ensure a packet is reference counted. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/avpacket: remove unnecessary check in av_packet_make_writable()James Almer2018-03-271-3/+0
| | | | | | | Zero sized packets are already handled below in the function. This is more in line with av_packet_ref(). Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/avpacket: add av_packet_make_writable()James Almer2018-03-211-0/+24
| | | | | | | Useful as well to quickly make a packet reference counted when it isn't already so. Signed-off-by: James Almer <jamrial@gmail.com>
* avpacket: reset dst side_data fields in av_packet_copy_propsYusuke Nakamura2018-02-141-0/+2
| | | | | | | | | | This effectively copies the side data elements from src instead of potentially merging them with those already existing in dst. This by extension also removes the only dependency on existing values in the dst packet. Reviewed-by: wm4 <nfxjfg@googlemail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec: remove ABI portion of the side data merging APIJames Almer2017-10-221-28/+0
| | | | | | The actual API is left in place until the deprecation period ends. Signed-off-by: James Almer <jamrial@gmail.com>
* avdevice/decklink_dec: Added Closed caption decode from VANCKarthick J2017-09-281-0/+1
| | | | | Signed-off-by: Karthick J <kjeyapal@akamai.com> Signed-off-by: Marton Balint <cus@passwd.hu>
* avcodec/avpacket: deprecate av_copy_packet()James Almer2017-09-251-2/+2
| | | | | | It does the same thing as av_packet_ref(). Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/avpacket: Limit iterations in ff_packet_split_and_drop_side_data()Michael Niedermayer2017-06-111-0/+2
| | | | | | | | | This avoids scaning beyond what a valid packet can contain Fixes: Timeout Fixes: 541/clusterfuzz-testcase-610189291657625 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/avpacket: allow only one element per type in packet side dataJames Almer2017-05-121-1/+12
| | | | | | | | | | It was never meant to do otherwise, as av_packet_get_side_data() returns the first entry it finds of a given type. Based on code from libavformat's av_stream_add_side_data(). Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/avcodec: Limit the number of side data elements per packetMichael Niedermayer2017-05-121-1/+4
| | | | | | | | | Fixes: 1293/clusterfuzz-testcase-minimized-6054752074858496 See: [FFmpeg-devel] [PATCH] avcodec/avcodec: Limit the number of side data elements per packet Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec: Avoid splitting side data repeatedlyMichael Niedermayer2017-05-061-0/+25
| | | | | | | | Fixes Timeout Fixes: 508/clusterfuzz-testcase-6245747678773248 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavc: Add Content Light Level side metadata found in HEVCSteve Lhomme2017-04-061-0/+1
| | | | | | These data are necessary when transmitting HDR over HDMI. Signed-off-by: James Almer <jamrial@gmail.com>
* Merge commit 'adb0e941c329a4778ade6dd0a326274472992f54'Clément Bœsch2017-04-011-1/+1
|\ | | | | | | | | | | | | | | | | * commit 'adb0e941c329a4778ade6dd0a326274472992f54': avpacket: Mark src pointer as constant See 5bb3f8825584a319b25b430e4ece2fa5b2b47ff9 Merged-by: Clément Bœsch <u@pkh.me>
| * avpacket: Mark src pointer as constantLuca Barbato2016-11-171-2/+2
| |
| * avpacket: Error out when creating 0-sized side dataVittorio Giovara2016-06-131-1/+1
| | | | | | | | | | | | | | | | This mimics the behaviour of other av_*_new_side_data(). This is not caught by the malloc check, since padding is always added to the allocated size. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* | avcodec, avformat: deprecate anything related to side data mergingwm42017-03-211-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch deprecates anything that has to do with merging/splitting side data. Automatic side data merging (and splitting), as well as all API symbols involved in it, are removed completely. Two FF_API_ defines are dedicated to deprecating API symbols related to this: FF_API_MERGE_SD_API removes av_packet_split/merge_side_data in libavcodec, and FF_API_LAVF_KEEPSIDE_FLAG deprecates AVFMT_FLAG_KEEP_SIDE_DATA in libavformat. Since it was claimed that changing the default from merging side data to not doing it is an ABI change, there are two additional FF_API_ defines, which stop using the side data merging/splitting by default (and remove any code in avformat/avcodec doing this): FF_API_MERGE_SD in libavcodec, and FF_API_LAVF_MERGE_SD in libavformat. It is very much intended that FF_API_MERGE_SD and FF_API_LAVF_MERGE_SD are quickly defined to 0 in the next ABI bump, while the API symbols are retained for a longer time for the sake of compatibility. AVFMT_FLAG_KEEP_SIDE_DATA will (very much intentionally) do nothing for most of the time it will still be defined. Keep in mind that no code exists that actually tries to unset this flag for any reason, nor does such code need to exist. Code setting this flag explicitly will work as before. Thus it's ok for AVFMT_FLAG_KEEP_SIDE_DATA to do nothing once side data merging has been removed from libavformat. In order to avoid that anyone in the future does this incorrectly, here is a small guide how to update the internal code on bumps: - next ABI bump (probably soon): - define FF_API_LAVF_MERGE_SD to 0, and remove all code covered by it - define FF_API_MERGE_SD to 0, and remove all code covered by it - next API bump (typically two years in the future or so): - define FF_API_LAVF_KEEPSIDE_FLAG to 0, and remove all code covered by it - define FF_API_MERGE_SD_API to 0, and remove all code covered by it This forces anyone who actually wants packet side data to temporarily use deprecated API to get it all. If you ask me, this is batshit fucked up crazy, but it's how we roll. Making AVFMT_FLAG_KEEP_SIDE_DATA to be set by default was rejected as an ABI change, so I'm going all the way to get rid of this once and for all. Reviewed-by: James Almer <jamrial@gmail.com> Reviewed-by: Rostislav Pehlivanov <atomnuker@gmail.com> Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
* | lavc/avpacket: Make pkt parameter of av_packet_get_side_data() const.Carl Eugen Hoyos2017-03-161-1/+1
| | | | | | | | | | Reflects the actual code and silences a gcc warning: libavcodec/utils.c:2102:36: warning: passing argument 1 of 'av_packet_get_side_data' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
* | avcodec/avpacket: Check metadata key in av_packet_unpack_dictionary()Michael Niedermayer2017-03-011-1/+1
| | | | | | | | | | | | | | | | Fixes timeout Fixes: 501/clusterfuzz-testcase-5672752870588416 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | lavc/avpacket: Initialize a variable in error path.Carl Eugen Hoyos2017-02-171-0/+2
| | | | | | | | | | | | Fixes ticket #6153. Tested-by: Tyson Smith
* | lavc: Add spherical packet side data APIVittorio Giovara2016-12-071-0/+1
| | | | | | | | Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* | avcodec/avpacket: fix leak on realloc in av_packet_add_side_data()James Almer2016-11-191-3/+4
| | | | | | | | | | | | | | | | | | If realloc fails, the pointer is overwritten and the previously allocated buffer is leaked, which goes against the expected behavior of keeping the packet unchanged in case of error. Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
* | lavc/avpacket: Fix undefined behaviour, do not pass a null pointer to memcpy().Carl Eugen Hoyos2016-09-221-1/+2
| | | | | | | | Fixes ticket #5857.
* | avcodec/avpacket: clear side_data_elemsMichael Niedermayer2016-09-121-2/+5
| | | | | | | | | | | | | | Fixes null pointer dereference Found-by: 连一汉 <lianyihan@360.cn> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | lavc/avpacket: Fix undefined behaviour, do not pass a null pointer to memcpy().Carl Eugen Hoyos2016-09-051-1/+2
| | | | | | | | Fixes ticket #5128.
* | Merge commit '8996515b137f962e3a8691241c285c96437b6c53'Clément Bœsch2016-06-221-0/+1
|\ \ | |/ | | | | | | | | | | | | | | * commit '8996515b137f962e3a8691241c285c96437b6c53': avpacket: fix setting AVPacket.data in av_packet_ref() This commit is a noop, see ed3a02547c71ac06fa27f17ad53116a74f78d927 Merged-by: Clément Bœsch <u@pkh.me>
| * avpacket: fix setting AVPacket.data in av_packet_ref()Anton Khirnov2016-05-161-1/+4
| | | | | | | | | | | | | | The data field does not necessarily point to the beginning of the underlying AVBuffer. CC: libav-stable@libav.org
* | avcodec/avpacket: Respect payload offset in av_grow_packetAndriy Lysnevych2016-06-021-7/+21
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/avpacket: Respect payload offset in av_packet_refAndriy Lysnevych2016-05-131-1/+3
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/avpacket: Fix off by 5 errorMichael Niedermayer2016-04-211-2/+4
| | | | | | | | | | | | | | | | Fixes out of array read Fixes: mozilla bug 1266129 Found-by: Tyson Smith Tested-by: Tyson Smith Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | Merge commit 'dbb43b8b83b097585ec255ec638b61e359ebea77'Derek Buitenhuis2016-04-121-0/+2
|\ \ | |/ | | | | | | | | | | * commit 'dbb43b8b83b097585ec255ec638b61e359ebea77': avpacket: properly reset data/size in av_packet_move_ref() Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
| * avpacket: properly reset data/size in av_packet_move_ref()Anton Khirnov2016-02-261-0/+2
| | | | | | | | | | It currently just calls av_init_packet(), which does not touch those fields.
| * avpacket: fix size check in packet_allocAndreas Cadhalpun2016-01-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | The previous check only caught sizes from -AV_INPUT_BUFFER_PADDING_SIZE to -1. This fixes ubsan runtime error: signed integer overflow: 2147483647 + 32 cannot be represented in type 'int' Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> Signed-off-by: Anton Khirnov <anton@khirnov.net>
* | libavcodec:add packet level support for mastering metadataNeil Birkbeck2016-02-251-17/+18
| | | | | | | | | | | | | | | | | | Some containers, like webm/mkv, will contain this mastering metadata. This is analogous to the way 3D fpa data is handled (in frame and packet side data). Signed-off-by: Neil Birkbeck <neil.birkbeck@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | lavc/lavf: transmit stream_id information for mpegts KLV data packetsStefano Sabatini2016-02-231-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | This allows to copy information related to the stream ID from the demuxer to the muxer, thus allowing for example to retain information related to synchronous and asynchronous KLV data packets. This information is used in the muxer when remuxing to distinguish the two kind of packets (if the information is lacking, data packets are considered synchronous). The fate reference changes are due to the use of av_packet_merge_side_data(), which increases the size of the output packet size, since side data is merged into the packet data.
* | avpacket: fix size check in packet_allocAndreas Cadhalpun2016-01-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | The previous check only caught sizes from -AV_INPUT_BUFFER_PADDING_SIZE to -1. This fixes ubsan runtime error: signed integer overflow: 2147483647 + 32 cannot be represented in type 'int' Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
* | Merge commit '68e547ae8b455e5e2b60839f35c359d77a6d94bc'Hendrik Leppkes2015-12-171-1/+1
|\ \ | |/ | | | | | | | | | | * commit '68e547ae8b455e5e2b60839f35c359d77a6d94bc': avpacket: use ERANGE instead of EOVERFLOW Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * avpacket: use ERANGE instead of EOVERFLOWAnton Khirnov2015-12-071-1/+1
| | | | | | | | EOVERFLOW seems to be unavailable on certain platforms.
* | Merge commit '31c51f7441de07b88cfea2550245bf1f5140cb8f'Hendrik Leppkes2015-12-171-10/+28
|\ \ | |/ | | | | | | | | | | * commit '31c51f7441de07b88cfea2550245bf1f5140cb8f': avpacket: add a function for wrapping existing data as side data Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * avpacket: add a function for wrapping existing data as side dataAnton Khirnov2015-12-061-10/+28
| |
* | Merge commit 'a9a60106370f862e191dea58e748626da6a8fe97'Hendrik Leppkes2015-10-291-0/+33
|\ \ | |/ | | | | | | | | | | * commit 'a9a60106370f862e191dea58e748626da6a8fe97': avpacket: Provide an alloc and a free function for the struct Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * avpacket: Provide an alloc and a free function for the structLuca Barbato2015-10-261-0/+33
| | | | | | | | | | Pave the way for having the size of the AVPacket struct not part of the ABI.
* | Merge commit '9b56d5c11488656254e9aed8d964ef2b7c2ff5e6'Hendrik Leppkes2015-10-291-0/+4
|\ \ | |/ | | | | | | | | | | * commit '9b56d5c11488656254e9aed8d964ef2b7c2ff5e6': avpacket: Deprecate av_dup_packet Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * avpacket: Deprecate av_dup_packetLuca Barbato2015-10-261-0/+4
| | | | | | | | | | As documented, `av_dup_packet` is broken by design, `av_packet_ref` matches the AVFrame ref-counted API and can be safely used instead.
* | Replace remaining occurances of av_free_packet with av_packet_unrefHendrik Leppkes2015-10-271-2/+2
| |
OpenPOWER on IntegriCloud