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

Stefano Sabatini stefano.sabatini-lala
Mon Oct 6 22:40:54 CEST 2008


On date Sunday 2008-10-05 18:44:55 -0400, Alexander Strange encoded:
> 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 &  
> > CODEC_CAP_USE_INPUT_BUFFER)
> >        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.

Do you mean something like:
avcodec_decode_videoX(ctx, picture, got_picture_ptr, pkt_ptr);
?

> > +/**
> > + * 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...

Updated, attaching the new patch to another mail.

Regards.
-- 
FFmpeg = Fantastic & Fast MultiPurpose Exxagerate Gadget




More information about the ffmpeg-devel mailing list