[FFmpeg-devel] [PATCH 2/5] lavu/hwcontext_amf: HWContext for AMF based components

Mark Thompson sw at jkqxz.net
Thu Oct 29 01:38:53 EET 2020


On 15/10/2020 01:16, OvchinnikovDmitrii wrote:
> From: Alexander Kravchenko <akravchenko188 at gmail.com>
> 
> ---
>   libavutil/Makefile             |   2 +
>   libavutil/hwcontext.c          |   4 +
>   libavutil/hwcontext.h          |   1 +
>   libavutil/hwcontext_amf.c      | 284 +++++++++++++++++++++++++++++++++
>   libavutil/hwcontext_amf.h      |  54 +++++++
>   libavutil/hwcontext_internal.h |   1 +
>   6 files changed, 346 insertions(+)
>   create mode 100644 libavutil/hwcontext_amf.c
>   create mode 100644 libavutil/hwcontext_amf.h
> 
> ...
> diff --git a/libavutil/hwcontext_amf.c b/libavutil/hwcontext_amf.c
> new file mode 100644
> index 0000000000..b70ee90d40
> --- /dev/null
> +++ b/libavutil/hwcontext_amf.c
> ...
> +
> +const HWContextType ff_hwcontext_type_amf = {
> +    .type                   = AV_HWDEVICE_TYPE_AMF,
> +    .name                   = "AMF",
> +
> +    .device_hwctx_size      = sizeof(AVAMFDeviceContext),
> +    .device_priv_size       = sizeof(AMFDeviceContextPrivate),
> +
> +    .device_create          = &amf_device_create,
> +    .device_derive          = &amf_device_derive,
> +};

This does make a weird kind of sense as a way to unify some bits of code, but it's very unclear to me whether it is a good idea to be exposing this device-only hwcontext implementation to the user in a way which they can't actually do anything with.  (Nothing has an external use for the AMF device.)

The code looks ok, but does anyone else have an opinion on the approach?

- Mark


More information about the ffmpeg-devel mailing list