On Thu, Oct 15, 2015 at 2:26 AM, Luca Barbato <lu_z...@gentoo.org> wrote: > `av_packet_unref` replaces it.
Might be a tad bit more verbose here, deprecating is never fun for users so each step has to be very well explained. > --- > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h > index 5f1755a..3d5af09 100644 > --- a/libavcodec/avcodec.h > +++ b/libavcodec/avcodec.h > @@ -1152,13 +1152,13 @@ typedef struct AVPacketSideData { > * > * The semantics of data ownership depends on the buf or destruct > (deprecated) > * fields. If either is set, the packet data is dynamically allocated and is > - * valid indefinitely until av_free_packet() is called (which in turn calls > + * valid indefinitely until av_packet_unref() is called (which in turn calls > * av_buffer_unref()/the destruct callback to free the data). If neither is > set, > * the packet data is typically backed by some static buffer somewhere and is > * only valid for a limited time (e.g. until the next read call when > demuxing). > * > * The side data is always allocated with av_malloc() and is freed in > - * av_free_packet(). > + * av_packet_unref(). not sure we want to do this: at least this does not happen in the av_frame_unref version and probably would make more sense to free it in free_packet > */ > typedef struct AVPacket { > /** > @@ -3468,8 +3468,11 @@ int av_dup_packet(AVPacket *pkt); > /** > * Free a packet. > * > + * @deprecated Use av_packet_unref > + * > * @param pkt packet to free > */ > +attribute_deprecated > void av_free_packet(AVPacket *pkt); y u no FF_API? > + > +void av_packet_free_side_data(AVPacket *pkt) > +{ > + int i; > + for (i = 0; i < pkt->side_data_elems; i++) > + av_free(pkt->side_data[i].data); > + av_freep(&pkt->side_data); > + pkt->side_data_elems = 0; > +} > + this is worth an APIchange entry, and while at it, mention the unref function use instead of the deprecated one -- Vittorio _______________________________________________ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel