Quoting wm4 (2015-12-27 14:29:11)
> On Sun, 20 Dec 2015 20:59:27 +0100
> Anton Khirnov <[email protected]> wrote:
> > +static int retrieve_data_alloc(AVFrame *dst, const AVFrame *src)
> > +{
> > +    AVFrame *frame_tmp;
> > +    int ret = 0;
> > +
> > +    frame_tmp = av_frame_alloc();
> > +    if (!frame_tmp)
> > +        return AVERROR(ENOMEM);
> > +
> > +    /* if the format is set, use that
> > +     * otherwise pick the first supported one */
> > +    if (dst->format >= 0) {
> > +        frame_tmp->format = dst->format;
> > +    } else {
> > +        enum AVPixelFormat *formats;
> > +
> > +        ret = av_hwframe_get_target_formats(src, &formats);
> > +        if (ret < 0)
> > +            goto fail;
> > +        frame_tmp->format = formats[0];
> > +        av_freep(&formats);
> > +    }
> > +    frame_tmp->width  = src->width;
> > +    frame_tmp->height = src->height;
> > +
> > +    ret = av_frame_get_buffer(frame_tmp, 32);
> > +    if (ret < 0)
> > +        goto fail;
> 
> Would be nice if this function could get its frames from a memory pool.
> (Or maybe a function like av_hwframe_retrieve_data(), which
> creates/recreates a pool as needed?)
> 

What would be the point of that? You can already allocate the target
frame yourself in any way you want, this is just a convenience shortcut
for lazy people. Adding support for pools would have to make the API
more complex, thus eliminating the point.

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

Reply via email to