[FFmpeg-devel] [PATCH v5 1/5] libavcodec: VAAPI support infrastructure

wm4 nfxjfg at googlemail.com
Sun Jan 31 17:13:22 CET 2016


On Sat, 30 Jan 2016 22:11:52 +0000
Mark Thompson <sw at jkqxz.net> wrote:

> ---
>  configure                  |   5 +
>  libavcodec/Makefile        |   1 +
>  libavcodec/vaapi_support.c | 710 +++++++++++++++++++++++++++++++++++++++++++++
>  libavcodec/vaapi_support.h | 122 ++++++++
>  4 files changed, 838 insertions(+)
>  create mode 100644 libavcodec/vaapi_support.c
>  create mode 100644 libavcodec/vaapi_support.h
> 
> diff --git a/configure b/configure
> index dba8180..e7f53af 100755
> --- a/configure
> +++ b/configure
> @@ -2037,6 +2037,7 @@ CONFIG_EXTRA="
>      texturedsp
>      texturedspenc
>      tpeldsp
> +    vaapi_recent
>      videodsp
>      vp3dsp
>      vp56dsp
> @@ -5768,6 +5769,10 @@ enabled vaapi &&
>      check_lib va/va.h vaInitialize -lva ||
>      disable vaapi
> 
> +enabled vaapi &&
> +    check_code cc va/va.h "vaCreateSurfaces(0, 0, 0, 0, 0, 0, 0, 0)" &&
> +    enable vaapi_recent
> +
>  enabled vaapi && enabled xlib &&
>      check_lib2 "va/va.h va/va_x11.h" vaGetDisplay -lva -lva-x11 &&
>      enable vaapi_x11
> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> index de957d8..045d118 100644
> --- a/libavcodec/Makefile
> +++ b/libavcodec/Makefile
> @@ -719,6 +719,7 @@ OBJS-$(CONFIG_ADPCM_YAMAHA_ENCODER)       += adpcmenc.o adpcm_data.o
>  OBJS-$(CONFIG_D3D11VA)                    += dxva2.o
>  OBJS-$(CONFIG_DXVA2)                      += dxva2.o
>  OBJS-$(CONFIG_VAAPI)                      += vaapi.o
> +OBJS-$(CONFIG_VAAPI_RECENT)               += vaapi_support.o
>  OBJS-$(CONFIG_VDA)                        += vda.o videotoolbox.o
>  OBJS-$(CONFIG_VIDEOTOOLBOX)               += videotoolbox.o
>  OBJS-$(CONFIG_VDPAU)                      += vdpau.o
> diff --git a/libavcodec/vaapi_support.c b/libavcodec/vaapi_support.c
> new file mode 100644
> index 0000000..2e22f98
> --- /dev/null
> +++ b/libavcodec/vaapi_support.c
> @@ -0,0 +1,710 @@
> +/*
> + * VAAPI helper functions.
> + *
> + * Copyright (C) 2016 Mark Thompson <mrt at jkqxz.net>
> + *
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * FFmpeg is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with FFmpeg; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> + */
> +
> +#include "vaapi_support.h"
> +
> +#include "libavutil/avassert.h"
> +#include "libavutil/imgutils.h"
> +#include "libavutil/pixfmt.h"
> +
> +
> +static AVClass vaapi_class = {
> +    .class_name = "vaapi",
> +    .item_name  = av_default_item_name,
> +    .version    = LIBAVUTIL_VERSION_INT,
> +};
> +static AVClass *vaapi_log = &vaapi_class;
> +

I'll give a more thorough review tomorrow, but let me just point out
that this is not really the point of the log mechanism. It should be
bound to an actual instance, like the vaapi hw context or whatever. We
hope to get rid of the global log callback one day, and then all av_log
calls have to go to an instance of some sort (so that it can find the
log callback), even if this doesn't matter today yet.



More information about the ffmpeg-devel mailing list