Quoting wm4 (2015-12-27 14:39:10)
> On Sun, 20 Dec 2015 20:59:29 +0100
> Anton Khirnov <[email protected]> wrote:
> 
> > ---
> >  libavcodec/avcodec.h | 20 ++++++++++++++++++++
> >  libavcodec/utils.c   |  3 +++
> >  2 files changed, 23 insertions(+)
> > 
> > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> > index 8083111..79aa3b7 100644
> > --- a/libavcodec/avcodec.h
> > +++ b/libavcodec/avcodec.h
> > @@ -35,6 +35,7 @@
> >  #include "libavutil/cpu.h"
> >  #include "libavutil/dict.h"
> >  #include "libavutil/frame.h"
> > +#include "libavutil/hwframe.h"
> >  #include "libavutil/log.h"
> >  #include "libavutil/pixfmt.h"
> >  #include "libavutil/rational.h"
> > @@ -2996,6 +2997,23 @@ typedef struct AVCodecContext {
> >      AVPacketSideData *coded_side_data;
> >      int            nb_coded_side_data;
> >  
> > +    /**
> > +     * Hwaccel decoding only. If the internal get_buffer2() implementation 
> > gets
> > +     * used to allocate hardware frames (either because the caller did not
> > +     * override get_buffer2() or because the custom get_buffer2() calls
> > +     * avcodec_default_get_buffer2()) then this callback needs to be set 
> > by the
> > +     * caller at latest in get_format().
> > +     *
> > +     * This callback will be used as the free() callback in creating an
> > +     * AVHWFramesContext that will be attached to the allocated frames.
> > +     */
> > +    void (*hwframe_ctx_free)(AVHWFramesContext *ctx);
> > +
> > +    /**
> > +     * See the hwframe_ctx_free documentation for details. This field will 
> > be
> > +     * used as the user_opaque field in the AVHWFramesContext.
> > +     */
> > +    void *hwframe_ctx_opaque;
> 
> I don't understand what these fields are for.
> 

The callback will tell you when all the frames using a given hw context
are freed, so you can destroy it. There's no other way to know
otherwise.

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

Reply via email to