@@ -24,6 +24,9 @@
#if CONFIG_D3D11VA
#include "libavutil/hwcontext_d3d11va.h"
#endif
+#if CONFIG_DXVA2
+#include "libavutil/hwcontext_dxva2.h"
+#endif
#include "libavutil/mem.h"
#include "libavutil/pixdesc.h"
#include "libavutil/time.h"
@@ -50,6 +53,9 @@ const enum AVPixelFormat ff_amf_pix_fmts[] = {
AV_PIX_FMT_YUV420P,
#if CONFIG_D3D11VA
AV_PIX_FMT_D3D11,
+#endif
+#if CONFIG_DXVA2
+ AV_PIX_FMT_DXVA2_VLD,
#endif
AV_PIX_FMT_NONE
};
@@ -69,6 +75,7 @@ static const FormatMap format_map[] =
{ AV_PIX_FMT_YUV420P, AMF_SURFACE_YUV420P },
{ AV_PIX_FMT_YUYV422, AMF_SURFACE_YUY2 },
{ AV_PIX_FMT_D3D11, AMF_SURFACE_NV12 },
+ { AV_PIX_FMT_DXVA2_VLD, AMF_SURFACE_NV12 },
};
@@ -152,6 +159,23 @@ static int amf_load_library(AVCodecContext *avctx)
return 0;
}
+static void get_dx9_device_from_devmgr(IDirect3DDeviceManager9 *devmgr,
IDirect3DDevice9 **device, void *avcl)
+{
+ HRESULT hr;
+ HANDLE device_handle;
+
+ if (SUCCEEDED(devmgr->lpVtbl->OpenDeviceHandle(devmgr,
&device_handle))) {
+ if (SUCCEEDED(devmgr->lpVtbl->LockDevice(devmgr, device_handle,
device, FALSE))) {
+ devmgr->lpVtbl->UnlockDevice(devmgr, device_handle, FALSE);
+ } else {
+ av_log(avcl, AV_LOG_INFO, "Failed to lock device handle for
Direct3D9 device: %lx.\n", (unsigned long)hr);
+ }
+ devmgr->lpVtbl->CloseDeviceHandle(devmgr, device_handle);
+ } else {
+ av_log(avcl, AV_LOG_INFO, "Failed to open device handle for
Direct3D9 device: %lx.\n", (unsigned long)hr);
+ }