2016-05-09 17:42:03 +00:00
|
|
|
#include <d3d9.h>
|
|
|
|
|
2015-07-03 14:37:01 +00:00
|
|
|
#include "common/common.h"
|
|
|
|
|
2015-08-29 02:12:56 +00:00
|
|
|
#include "hwdec.h"
|
|
|
|
#include "utils.h"
|
2015-07-03 14:37:01 +00:00
|
|
|
#include "video/hwdec.h"
|
|
|
|
|
|
|
|
// This does not provide real (zero-copy) interop - it merely exists for
|
|
|
|
// making sure the same D3D device is used for decoding and display, which
|
|
|
|
// may help with OpenGL fullscreen mode.
|
|
|
|
|
|
|
|
struct priv {
|
2016-05-09 17:42:03 +00:00
|
|
|
struct mp_hwdec_ctx hwctx;
|
2015-07-03 14:37:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static void destroy(struct gl_hwdec *hw)
|
|
|
|
{
|
|
|
|
struct priv *p = hw->priv;
|
2016-05-09 17:42:03 +00:00
|
|
|
hwdec_devices_remove(hw->devs, &p->hwctx);
|
|
|
|
if (p->hwctx.ctx)
|
|
|
|
IDirect3DDevice9_Release((IDirect3DDevice9 *)p->hwctx.ctx);
|
2015-07-03 14:37:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int create(struct gl_hwdec *hw)
|
|
|
|
{
|
|
|
|
GL *gl = hw->gl;
|
2016-05-09 17:42:03 +00:00
|
|
|
if (!gl->MPGetNativeDisplay)
|
2015-07-03 14:37:01 +00:00
|
|
|
return -1;
|
|
|
|
|
|
|
|
struct priv *p = talloc_zero(hw, struct priv);
|
|
|
|
hw->priv = p;
|
|
|
|
|
2016-05-09 17:42:03 +00:00
|
|
|
IDirect3DDevice9 *d3d = gl->MPGetNativeDisplay("IDirect3DDevice9");
|
|
|
|
if (!d3d)
|
2015-07-03 14:37:01 +00:00
|
|
|
return -1;
|
|
|
|
|
2016-05-09 17:42:03 +00:00
|
|
|
MP_VERBOSE(hw, "Using libmpv supplied device %p.\n", d3d);
|
2015-07-03 14:37:01 +00:00
|
|
|
|
2016-05-09 17:42:03 +00:00
|
|
|
p->hwctx = (struct mp_hwdec_ctx){
|
|
|
|
.type = HWDEC_DXVA2_COPY,
|
|
|
|
.driver_name = hw->driver->name,
|
|
|
|
.ctx = d3d,
|
|
|
|
};
|
|
|
|
hwdec_devices_add(hw->devs, &p->hwctx);
|
2015-07-03 14:37:01 +00:00
|
|
|
|
|
|
|
hw->converted_imgfmt = 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int reinit(struct gl_hwdec *hw, struct mp_image_params *params)
|
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int map_image(struct gl_hwdec *hw, struct mp_image *hw_image,
|
|
|
|
GLuint *out_textures)
|
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
const struct gl_hwdec_driver gl_hwdec_dxva2 = {
|
2016-02-01 19:02:52 +00:00
|
|
|
.name = "dxva2-dummy",
|
|
|
|
.api = HWDEC_DXVA2_COPY,
|
2015-07-03 14:37:01 +00:00
|
|
|
.imgfmt = -1,
|
|
|
|
.create = create,
|
|
|
|
.reinit = reinit,
|
|
|
|
.map_image = map_image,
|
|
|
|
.destroy = destroy,
|
|
|
|
};
|