On Sun, 19 Feb 2017 18:46:31 +0000
Mark Thompson <[email protected]> wrote:
> ---
> libavutil/hwcontext.c | 9 ++++++++-
> libavutil/hwcontext_internal.h | 5 +++++
> 2 files changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/libavutil/hwcontext.c b/libavutil/hwcontext.c
> index e3484c78c..3cdf543d1 100644
> --- a/libavutil/hwcontext.c
> +++ b/libavutil/hwcontext.c
> @@ -798,7 +798,14 @@ int av_hwframe_ctx_create_derived(AVBufferRef
> **derived_frame_ctx,
> goto fail;
> }
>
> - ret = av_hwframe_ctx_init(dst_ref);
> + ret = AVERROR(ENOSYS);
> + if (src->internal->hw_type->map_frames_from)
> + ret = src->internal->hw_type->map_frames_from(dst, src, flags);
> + if (ret == AVERROR(ENOSYS) &&
> + dst->internal->hw_type->map_frames_to)
> + ret = dst->internal->hw_type->map_frames_to(dst, src, flags);
> + if (ret == AVERROR(ENOSYS))
> + ret = 0;
> if (ret)
> goto fail;
>
> diff --git a/libavutil/hwcontext_internal.h b/libavutil/hwcontext_internal.h
> index 66f54142e..125517215 100644
> --- a/libavutil/hwcontext_internal.h
> +++ b/libavutil/hwcontext_internal.h
> @@ -92,6 +92,11 @@ typedef struct HWContextType {
> const AVFrame *src, int flags);
> int (*map_from)(AVHWFramesContext *ctx, AVFrame *dst,
> const AVFrame *src, int flags);
> + int (*map_frames_to)(AVHWFramesContext *dst_ctx,
> + AVHWFramesContext *src_ctx, int flags);
> + int (*map_frames_from)(AVHWFramesContext *dst_ctx,
> + AVHWFramesContext *src_ctx, int
> flags);
> +
> } HWContextType;
>
> struct AVHWDeviceInternal {
I guess after staring at it for a while I understand why there are 3
map callbacks... Seems all a bit complex though.
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel