summaryrefslogtreecommitdiffstats
path: root/media/ffvpx/libavcodec/hwaccel.h
diff options
context:
space:
mode:
authorMoonchild <mcwerewolf@gmail.com>2018-10-01 14:34:26 +0200
committerGitHub <noreply@github.com>2018-10-01 14:34:26 +0200
commit79b00fc33b5cb6d56d29b50efac6d62ce3a89018 (patch)
tree77d8179bb3d9d76d9ec4fcfe396a35afcc8f73cd /media/ffvpx/libavcodec/hwaccel.h
parentab881a3bf513e591b6cc2966560cdab2b63a0f2a (diff)
parent7d1ee0e5e4958175ccde5d153b025f97a17caeb2 (diff)
downloadUXP-79b00fc33b5cb6d56d29b50efac6d62ce3a89018.tar
UXP-79b00fc33b5cb6d56d29b50efac6d62ce3a89018.tar.gz
UXP-79b00fc33b5cb6d56d29b50efac6d62ce3a89018.tar.lz
UXP-79b00fc33b5cb6d56d29b50efac6d62ce3a89018.tar.xz
UXP-79b00fc33b5cb6d56d29b50efac6d62ce3a89018.zip
Merge pull request #801 from trav90/update-from-upstream
Update ffvpx code to 4.0.2
Diffstat (limited to 'media/ffvpx/libavcodec/hwaccel.h')
-rw-r--r--media/ffvpx/libavcodec/hwaccel.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/media/ffvpx/libavcodec/hwaccel.h b/media/ffvpx/libavcodec/hwaccel.h
index 124fbbf1f..3aaa92571 100644
--- a/media/ffvpx/libavcodec/hwaccel.h
+++ b/media/ffvpx/libavcodec/hwaccel.h
@@ -19,6 +19,66 @@
#ifndef AVCODEC_HWACCEL_H
#define AVCODEC_HWACCEL_H
+#include "avcodec.h"
+#include "hwaccels.h"
+
+
#define HWACCEL_CAP_ASYNC_SAFE (1 << 0)
+
+typedef struct AVCodecHWConfigInternal {
+ /**
+ * This is the structure which will be returned to the user by
+ * avcodec_get_hw_config().
+ */
+ AVCodecHWConfig public;
+ /**
+ * If this configuration uses a hwaccel, a pointer to it.
+ * If not, NULL.
+ */
+ const AVHWAccel *hwaccel;
+} AVCodecHWConfigInternal;
+
+
+// These macros are used to simplify AVCodecHWConfigInternal definitions.
+
+#define HW_CONFIG_HWACCEL(device, frames, ad_hoc, format, device_type_, name) \
+ &(const AVCodecHWConfigInternal) { \
+ .public = { \
+ .pix_fmt = AV_PIX_FMT_ ## format, \
+ .methods = (device ? AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX : 0) | \
+ (frames ? AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX : 0) | \
+ (ad_hoc ? AV_CODEC_HW_CONFIG_METHOD_AD_HOC : 0), \
+ .device_type = AV_HWDEVICE_TYPE_ ## device_type_, \
+ }, \
+ .hwaccel = &name, \
+ }
+
+#define HW_CONFIG_INTERNAL(format) \
+ &(const AVCodecHWConfigInternal) { \
+ .public = { \
+ .pix_fmt = AV_PIX_FMT_ ## format, \
+ .methods = AV_CODEC_HW_CONFIG_METHOD_INTERNAL, \
+ .device_type = AV_HWDEVICE_TYPE_NONE, \
+ }, \
+ .hwaccel = NULL, \
+ }
+
+#define HWACCEL_DXVA2(codec) \
+ HW_CONFIG_HWACCEL(1, 1, 1, DXVA2_VLD, DXVA2, ff_ ## codec ## _dxva2_hwaccel)
+#define HWACCEL_D3D11VA2(codec) \
+ HW_CONFIG_HWACCEL(1, 1, 0, D3D11, D3D11VA, ff_ ## codec ## _d3d11va2_hwaccel)
+#define HWACCEL_NVDEC(codec) \
+ HW_CONFIG_HWACCEL(1, 1, 0, CUDA, CUDA, ff_ ## codec ## _nvdec_hwaccel)
+#define HWACCEL_VAAPI(codec) \
+ HW_CONFIG_HWACCEL(1, 1, 1, VAAPI, VAAPI, ff_ ## codec ## _vaapi_hwaccel)
+#define HWACCEL_VDPAU(codec) \
+ HW_CONFIG_HWACCEL(1, 1, 1, VDPAU, VDPAU, ff_ ## codec ## _vdpau_hwaccel)
+#define HWACCEL_VIDEOTOOLBOX(codec) \
+ HW_CONFIG_HWACCEL(1, 1, 1, VIDEOTOOLBOX, VIDEOTOOLBOX, ff_ ## codec ## _videotoolbox_hwaccel)
+#define HWACCEL_D3D11VA(codec) \
+ HW_CONFIG_HWACCEL(0, 0, 1, D3D11VA_VLD, NONE, ff_ ## codec ## _d3d11va_hwaccel)
+#define HWACCEL_XVMC(codec) \
+ HW_CONFIG_HWACCEL(0, 0, 1, XVMC, NONE, ff_ ## codec ## _xvmc_hwaccel)
+
#endif /* AVCODEC_HWACCEL_H */