summaryrefslogtreecommitdiff
path: root/libavcodec/avpacket.c
Commit message (Collapse)AuthorAge
* all: Remove unnecessary libavcodec/internal.h inclusionsAndreas Rheinhardt2022-02-08
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/packet_internal: Add proper PacketList structAndreas Rheinhardt2022-01-04
| | | | | | | | | | | | | | | Up until now, we had a PacketList structure which is actually a PacketListEntry; a proper PacketList did not exist and all the related functions just passed pointers to pointers to the head and tail elements around. All these pointers were actually consecutive elements of their containing structs, i.e. the users already treated them as if they were a struct. So add a proper PacketList struct and rename the current PacketList to PacketListEntry; also make the functions use this structure instead of the pair of pointers. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/avpacket: Perform fewer reallocations in repeated av_grow_packet()Michael Niedermayer2021-12-06
| | | | | | | | Fixes: Timeout Fixes: 41446/clusterfuzz-testcase-minimized-ffmpeg_dem_SAMI_fuzzer-4667644540747776 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* packet: initialize time_base field to (0, 1) instead of (0, 0)Lynne2021-08-02
| | | | Forget rational or irrational numbers, division by zero is undefined.
* avpacket: ABI bump additionsLynne2021-08-02
| | | | | This commit adds a long-requested by API users opaque fields for AVPacket, as well as a time_base field.
* avcodec: Pass HDR10+ metadata to packet side data in VP9 encoderMohammad Izadi2021-06-24
| | | | | | | | | | | | | HDR10+ metadata is stored in the bit stream for HEVC. The story is different for VP9 and cannot store the metadata in the bit stream. HDR10+ should be passed to packet side data an stored in the container (mkv) for VP9. This CL is taking HDR10+ from AVFrame side data in libvpxenc and is passing it to the AVPacket side data. Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: James Zern <jzern@google.com>
* avcodec/avpacket: use av_malloc() to allocate an AVPacketJames Almer2021-05-08
| | | | | | | | av_mallocz() is superfluous as get_packet_defaults() is called immediately after it's allocated, which will initialize the entire struct to default values. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/avpacket: always initialize the new packet in avpriv_packet_list_put()James Almer2021-05-08
| | | | | | | If a copy callback is provided by the caller, the packet passed to it was zeroed instead of initialized with default values. Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/buffer: Switch AVBuffer API to size_tAndreas Rheinhardt2021-04-27
| | | | | | | Announced in 14040a1d913794d9a3fd6406a6d8c2f0e37e0062. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec: Remove deprecated API to split/merge side-dataAndreas Rheinhardt2021-04-27
| | | | | | | Deprecated in d682ae70b4b3a53fb73ec30281f9f4cfbc531edd. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec: Remove deprecated AVPacket APIAndreas Rheinhardt2021-04-27
| | | | | | | Deprecated in ce70f28a1732c74a9cd7fec2d56178750bd6e457. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec, avformat: Remove AVPacket.convergence_durationAndreas Rheinhardt2021-04-27
| | | | | | | Deprecated in 948f3c19a8bd069768ca411212aaf8c1ed96b10d. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/packet: Also change av_packet_pack/unpack_dictionary to size_tAndreas Rheinhardt2021-03-19
| | | | | | | | | These are auxiliary side-data functions, so they should have been switched to size_t in d79e0fe65c51491f9bf8a470bbe36fb09f3e1280, but this has been forgotten. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/avpacket: Improve overflow checks when packing dictionaryAndreas Rheinhardt2021-03-19
| | | | | | Also avoid reallocations. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/packet_internal: make avpriv_packet_list_* functions use an internal ↵James Almer2021-03-17
| | | | | | | | | struct The next pointer is kept at the end for backwards compatability until the major bump, when it should ideally be moved at the front. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/packet: deprecate av_init_packet()James Almer2021-03-17
| | | | | | Once removed, sizeof(AVPacket) will stop being a part of the public ABI. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec: use the buffer_size_t typedef where requiredJames Almer2021-03-10
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/packet: change side data related public function and struct size ↵James Almer2021-03-10
| | | | | | | | | types to size_t av_packet_add_side_data() already defines size as a size_t, so this makes it consistent across all side data functions Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/packet: move AVPacketList definition and function helpers over from ↵James Almer2020-09-15
| | | | | | | | | libavformat And replace the flags parameter with a function callback that can be used to copy the contents of the packet (e.g, av_packet_ref and av_packet_copy_props). Signed-off-by: James Almer <jamrial@gmail.com>
* API: add AV_PKT_DATA_S12M_TIMECODE to AVPacketSideDataTypeLimin Wang2020-07-15
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avcodec/internal: move packet related functions to their own headerJames Almer2020-06-02
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/avpacket: add missing entry for prft to av_packet_side_data_name()James Almer2020-05-05
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/avpacket: Don't write into non-writable bufferAndreas Rheinhardt2020-04-30
| | | | | | | | | | The data of an AVPacket may be a part of the data of an AVBufferRef; Therefore av_grow_packet() doesn't reallocate if the available space in the actual buffer is sufficient for the enlargement. But given that it also zeroes the padding it also needs to make sure that the buffer is actually writable; this commit implements this. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* libavcodec/avpacket: Don't simply forward return value of av_dict_set()Andreas Rheinhardt2020-04-23
| | | | | | | | | | | The documentation of av_dict_set() states that values >= 0 indicate success, whereas av_packet_unpack_dictionary() implies that return values > 0 are impossible. So only forward the return value of av_dict_set() in av_packet_unpack_dictionary() on error. (Btw: av_dict_set() does currently not return values > 0.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* lavc: add a new sidedata type for DOVIJun Zhao2020-04-23
| | | | | | add a new sidedata type for DOVI. Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
* avcodec.h: split AVPacket API into its own headerAnton Khirnov2020-04-10
|
* avcodec/avcodec, avpacket: Return blank packet on av_packet_ref() failureAndreas Rheinhardt2020-03-28
| | | | | | | | | | | | Up until now, it was completely unspecified what the content of the destination packet dst was on error. Depending upon where the error happened calling av_packet_unref() on dst might be dangerous. This commit changes this by making sure that dst is blank on error, so unreferencing it again is safe (and still pointless). This behaviour is documented. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/avpacket: Always treat dst in av_packet_ref as uninitializedAndreas Rheinhardt2020-03-28
| | | | | | | | | | | | | | | | | | av_packet_ref() mostly treated the destination packet dst as uninitialized, i.e. the destination fields were simply overwritten. But if the source packet was not reference-counted, dst->buf was treated as if it pointed to an already allocated buffer (if != NULL) to be reallocated to the desired size. The documentation did not explicitly state whether the dst will be treated as uninitialized, but it stated that if the source packet is not refcounted, a new buffer in dst will be allocated. This and the fact that the side-data as well as the codepath taken in case src is refcounted always treated the packet as uninitialized means that dst should always be treated as uninitialized for the sake of consistency. And this behaviour has been explicitly documented. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* API: add AV_PKT_DATA_ICC_PROFILE to AVPacketSideDataTypevectronic2020-03-10
| | | | Signed-off-by: vectronic <hello.vectronic@gmail.com>
* avcodec: add a Producer Reference Time AVPacketSideData typeJames Almer2020-01-15
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/avpacket: Improve allocating packetsAndreas Rheinhardt2019-09-18
| | | | | | | | 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-12
| | | | | | 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-01
| | | | | | | | | | | 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-01
| | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/avpacket: fix whitespaceAman Gupta2018-10-12
| | | | Signed-off-by: Aman Gupta <aman@tmm1.net>
* lavc/avpacket: Add missing conversions from side data enum to name.Jun Zhao2018-09-21
| | | | | | 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-01
| | | | | | | | 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-27
| | | | | | | 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-21
| | | | | | | 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-14
| | | | | | | | | | 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-22
| | | | | | 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-28
| | | | | 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-25
| | | | | | 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-11
| | | | | | | | | 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-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-12
| | | | | | | | | 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-06
| | | | | | | | 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-06
| | | | | | 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-01
|\ | | | | | | | | | | | | | | | | * 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-17
| |