On 5/3/2016 9:56 AM, Anton Khirnov wrote:
> ---
> libavutil/Makefile | 3 +
> libavutil/hwcontext.c | 3 +
> libavutil/hwcontext.h | 1 +
> libavutil/hwcontext_dxva2.c | 291
> +++++++++++++++++++++++++++++++++++++++++
> libavutil/hwcontext_dxva2.h | 72 ++++++++++
> libavutil/hwcontext_internal.h | 1 +
> 6 files changed, 371 insertions(+)
> create mode 100644 libavutil/hwcontext_dxva2.c
> create mode 100644 libavutil/hwcontext_dxva2.h
>
> diff --git a/libavutil/Makefile b/libavutil/Makefile
> index 11d9179..637ad3b 100644
> --- a/libavutil/Makefile
> +++ b/libavutil/Makefile
> @@ -26,6 +26,7 @@ HEADERS = adler32.h
> \
> hmac.h \
> hwcontext.h \
> hwcontext_cuda.h \
> + hwcontext_dxva2.h \
> hwcontext_vaapi.h \
> hwcontext_vdpau.h \
> imgutils.h \
> @@ -108,6 +109,7 @@ OBJS = adler32.o
> \
> xtea.o \
>
> OBJS-$(CONFIG_CUDA) += hwcontext_cuda.o
> +OBJS-$(CONFIG_DXVA2) += hwcontext_dxva2.o
> OBJS-$(CONFIG_LZO) += lzo.o
> OBJS-$(CONFIG_VAAPI) += hwcontext_vaapi.o
> OBJS-$(CONFIG_VDPAU) += hwcontext_vdpau.o
> @@ -115,6 +117,7 @@ OBJS-$(CONFIG_VDPAU) +=
> hwcontext_vdpau.o
> OBJS += $(COMPAT_OBJS:%=../compat/%)
>
> SKIPHEADERS-$(CONFIG_CUDA) += hwcontext_cuda.h
> +SKIPHEADERS-$(CONFIG_DXVA2) += hwcontext_dxva2.h
> SKIPHEADERS-$(CONFIG_VAAPI) += hwcontext_vaapi.h
> SKIPHEADERS-$(CONFIG_VDPAU) += hwcontext_vdpau.h
> SKIPHEADERS-$(HAVE_ATOMICS_GCC) += atomic_gcc.h
> diff --git a/libavutil/hwcontext.c b/libavutil/hwcontext.c
> index 9ffc718..2ddae90 100644
> --- a/libavutil/hwcontext.c
> +++ b/libavutil/hwcontext.c
> @@ -32,6 +32,9 @@ static const HWContextType *hw_table[] = {
> #if CONFIG_CUDA
> &ff_hwcontext_type_cuda,
> #endif
> +#if CONFIG_DXVA2
> + &ff_hwcontext_type_dxva2,
> +#endif
> #if CONFIG_VAAPI
> &ff_hwcontext_type_vaapi,
> #endif
> diff --git a/libavutil/hwcontext.h b/libavutil/hwcontext.h
> index 8502342..54af19d 100644
> --- a/libavutil/hwcontext.h
> +++ b/libavutil/hwcontext.h
> @@ -28,6 +28,7 @@ enum AVHWDeviceType {
> AV_HWDEVICE_TYPE_VDPAU,
> AV_HWDEVICE_TYPE_CUDA,
> AV_HWDEVICE_TYPE_VAAPI,
> + AV_HWDEVICE_TYPE_DXVA2,
> };
>
> typedef struct AVHWDeviceInternal AVHWDeviceInternal;
> diff --git a/libavutil/hwcontext_dxva2.c b/libavutil/hwcontext_dxva2.c
> new file mode 100644
> index 0000000..20b426c
> --- /dev/null
> +++ b/libavutil/hwcontext_dxva2.c
> @@ -0,0 +1,291 @@
> +/*
> + * This file is part of Libav.
> + *
> + * Libav 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.
> + *
> + * Libav 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 Libav; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
> USA
> + */
> +
> +#include <windows.h>
> +
> +#ifdef _WIN32_WINNT
> +#undef _WIN32_WINNT
> +#endif
> +#define _WIN32_WINNT 0x0600
You should instead use a check like to the ones in libavcodec/dxva2.h
and libavcodec/d3d11va.h to avoid overriding a potentially higher value
set by the user.
#if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600
#undef _WIN32_WINNT
#define _WIN32_WINNT 0x0600
#endif
The ones in dxva2/d3d11va for that matter are 0x0602 (Win 8). It makes
sense for d3d11va but not sure why it's done for dxva2.
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel