[FFmpeg-devel] [PATCH] Add a CODEC_CAP_USE_INPUT_BUFFER capabilities flag
Mon Oct 6 08:41:51 CEST 2008
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().
I am not sure I understand the situation, but if libavfilter is accessing
a buffer after freeing it, then I guess this is a bug in libavfilter...
Why not calling av_packet_free() only after libavfilter finished to access
> For example it could be used like this:
> if (is->video_st->codec->codec->capabilities & CODEC_CAP_USE_INPUT_BUFFER)
> pkt->destruct = av_destruct_packet_nofree;
Maybe I am misunderstanding something, but this looks like a hack: if the
destruct method should be av_destruct_packet_nofree(), why not setting it
to av_destruct_packet_nofree() since the beginning (in the demuxer),
instead of changing it before calling av_free_packet()?
I do not know the libavfilter internals, but maybe this problem can be
better solved by using some form of reference counting?
(when I tried to think about a filter layer some years ago, I arrived to
the conclusion that a reference counter for these buffers is needed)
More information about the ffmpeg-devel