X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Favcodec.h;h=fb0c6fae70b33d9ab2ff49813022f5e37456e25f;hb=ae7e66fb4b1a256fb79a016b9c585de84ac77339;hp=3306910dd2f4f4fe63dda5224a132f2687990754;hpb=33bd2b99a1c2cf3fc8b810a11c6615a37d9f9cf4;p=ffmpeg diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 3306910dd2f..fb0c6fae70b 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); @@ -4536,6 +4536,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.