[FFmpeg-devel] [PATCH] avutil/hwcontext: add support to allow hardware to ref/unref frame

James Almer jamrial at gmail.com
Thu Mar 4 21:13:19 EET 2021


On 3/4/2021 3:19 AM, suji.velupillai at broadcom.com wrote:
> From: Patrick Rault <patrick.rault at broadcom.com>
> 
> Add support to allow attached hardware to add/remove reference to the
> frame buffer mirroring the ffmpeg.
> 
> Signed-off-by: Patrick Rault <patrick.rault at broadcom.com>
> Signed-off-by: Suji Velupillai <suji.velupillai at broadcom.com>
> ---
>   libavutil/frame.c              |  7 ++++++-
>   libavutil/hwcontext.c          | 21 +++++++++++++++++++++
>   libavutil/hwcontext.h          | 15 +++++++++++++++
>   libavutil/hwcontext_internal.h |  2 ++
>   4 files changed, 44 insertions(+), 1 deletion(-)
> 
> diff --git a/libavutil/frame.c b/libavutil/frame.c
> index eab51b6a32..6f8db14bf5 100644
> --- a/libavutil/frame.c
> +++ b/libavutil/frame.c
> @@ -22,6 +22,7 @@
>   #include "common.h"
>   #include "dict.h"
>   #include "frame.h"
> +#include "hwcontext.h"
>   #include "imgutils.h"
>   #include "mem.h"
>   #include "samplefmt.h"
> @@ -492,7 +493,7 @@ int av_frame_ref(AVFrame *dst, const AVFrame *src)
>           dst->nb_extended_buf = src->nb_extended_buf;
>   
>           for (i = 0; i < src->nb_extended_buf; i++) {
> -            dst->extended_buf[i] = av_buffer_ref(src->extended_buf[i]);
> +            dst->extended_buf[i] = av_buffer_ref(dst);

dst is an AVFrame, not AVBufferRef.


More information about the ffmpeg-devel mailing list