On 15/10/15 13:38, Vittorio Giovara wrote:
> On Thu, Oct 15, 2015 at 2:26 AM, Luca Barbato <[email protected]> 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.

I'll think something.

>> ---
>> 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

This part needs rework indeed. What do you suggest exactly?

> y u no FF_API?

Because I want to do that once at the end of the set, If you prefer I
can do little by little.

>> +
>> +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

The function got moved aside but no API got changed yet.

lu


_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to