[FFmpeg-devel] [PATCH] Add a CODEC_CAP_USE_INPUT_BUFFER capabilities flag

Alexander Strange astrange
Mon Oct 6 00:44:55 CEST 2008

On Oct 5, 2008, at 6:28 PM, Stefano Sabatini wrote:

> Hi all,
> the new flag will be useful for example in libavfilter when the output
> frame is accessed *after* the call to av_packet_free().
> For example it could be used like this:
>    if (is->video_st->codec->codec->capabilities &  
>        pkt->destruct = av_destruct_packet_nofree;
>    av_free_packet(pkt);
> This looks nicer than the use of a codec id check, even in the case
> of rawdec being the only codec having this capability (I don't
> know if there are other ones like this).
> I'm omitting minor version bump in the patch.

I'm not sure of the exact problem details here, but avoiding freeing  
packets by swapping out the destructor seems fragile to me.
As long as AVPackets aren't copied around, using retain counting would  
work better, especially since we should be using them instead of buf/ 
buf_size in the avcodec API.

> +/**
> + * Codec will use the input data to store the output frame. You  
> should
> + * not free the input data if you plan to access later to the output
> + * frame.
> + */

I don't understand the first sentence.
...if you plan to access the output frame later...

More information about the ffmpeg-devel mailing list