diff options
author | James Almer <jamrial@gmail.com> | 2018-03-24 19:18:59 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2018-04-01 23:40:41 -0300 |
commit | 860086ee168866c8b7cdb5c1c13ac962c5f3efc4 (patch) | |
tree | 91acb5b03c1a16deb780fefa00de596927693643 /libavcodec/avcodec.h | |
parent | e0f32286861ddf7666ba92297686fa216d65968e (diff) | |
download | ffmpeg-streaming-860086ee168866c8b7cdb5c1c13ac962c5f3efc4.zip ffmpeg-streaming-860086ee168866c8b7cdb5c1c13ac962c5f3efc4.tar.gz |
avcodec/avpacket: add av_packet_make_refcounted()
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>
Diffstat (limited to 'libavcodec/avcodec.h')
-rw-r--r-- | libavcodec/avcodec.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 3306910..fb0c6fa 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -4365,7 +4365,7 @@ int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size); * @warning This is a hack - the packet memory allocation stuff is broken. The * packet is allocated if it was not really allocated. * - * @deprecated Use av_packet_ref + * @deprecated Use av_packet_ref or av_packet_make_refcounted */ attribute_deprecated int av_dup_packet(AVPacket *pkt); @@ -4537,6 +4537,22 @@ void av_packet_move_ref(AVPacket *dst, AVPacket *src); int av_packet_copy_props(AVPacket *dst, const AVPacket *src); /** + * Ensure the data described by a given packet is reference counted. + * + * @note This function does not ensure that the reference will be writable. + * Use av_packet_make_writable instead for that purpose. + * + * @see av_packet_ref + * @see av_packet_make_writable + * + * @param pkt packet whose data should be made reference counted. + * + * @return 0 on success, a negative AVERROR on error. On failure, the + * packet is unchanged. + */ +int av_packet_make_refcounted(AVPacket *pkt); + +/** * Create a writable reference for the data described by a given packet, * avoiding data copy if possible. * |