[vlc-devel] [PATCH 10/14] direct3d9: remove the secondary HWND storage
Steve Lhomme
robux4 at videolabs.io
Sat Nov 18 14:26:43 CET 2017
---
modules/video_chroma/d3d9_fmt.c | 7 ++++---
modules/video_chroma/d3d9_fmt.h | 3 ++-
modules/video_output/win32/direct3d9.c | 11 ++++-------
3 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/modules/video_chroma/d3d9_fmt.c b/modules/video_chroma/d3d9_fmt.c
index cb63a79bab..dd2694b18a 100644
--- a/modules/video_chroma/d3d9_fmt.c
+++ b/modules/video_chroma/d3d9_fmt.c
@@ -84,7 +84,8 @@ HRESULT D3D9_CreateDevice(vlc_object_t *o, d3d9_handle_t *hd3d, HWND hwnd,
return E_INVALIDARG;
}
- if (D3D9_FillPresentationParameters(o, hd3d, AdapterToUse, hwnd, source, out))
+ out->hwnd = hwnd;
+ if (D3D9_FillPresentationParameters(o, hd3d, AdapterToUse, source, out))
return E_INVALIDARG;
/* */
@@ -138,7 +139,7 @@ void D3D9_ReleaseDevice(d3d9_device_t *d3d_dev)
* It setup vout_display_sys_t::d3dpp and vout_display_sys_t::rect_display
* from the default adapter.
*/
-int D3D9_FillPresentationParameters(vlc_object_t *o, d3d9_handle_t *hd3d, UINT AdapterToUse, HWND hwnd,
+int D3D9_FillPresentationParameters(vlc_object_t *o, d3d9_handle_t *hd3d, UINT AdapterToUse,
const video_format_t *source, d3d9_device_t *out)
{
/*
@@ -165,7 +166,7 @@ int D3D9_FillPresentationParameters(vlc_object_t *o, d3d9_handle_t *hd3d, UINT A
d3dpp->EnableAutoDepthStencil = FALSE;
if (source->i_width)
{
- d3dpp->hDeviceWindow = hwnd;
+ d3dpp->hDeviceWindow = out->hwnd;
d3dpp->SwapEffect = D3DSWAPEFFECT_COPY;
d3dpp->BackBufferFormat = d3ddm.Format;
d3dpp->BackBufferCount = 1;
diff --git a/modules/video_chroma/d3d9_fmt.h b/modules/video_chroma/d3d9_fmt.h
index 8fd22140d6..30f2336277 100644
--- a/modules/video_chroma/d3d9_fmt.h
+++ b/modules/video_chroma/d3d9_fmt.h
@@ -56,6 +56,7 @@ typedef struct
/* creation parameters */
D3DPRESENT_PARAMETERS pp;
UINT adapterId;
+ HWND hwnd;
D3DCAPS9 caps;
} d3d9_device_t;
@@ -83,7 +84,7 @@ int D3D9_Create(vlc_object_t *, d3d9_handle_t *);
void D3D9_Destroy(d3d9_handle_t *);
-int D3D9_FillPresentationParameters(vlc_object_t *, d3d9_handle_t *, UINT AdapterToUse, HWND,
+int D3D9_FillPresentationParameters(vlc_object_t *, d3d9_handle_t *, UINT AdapterToUse,
const video_format_t *, d3d9_device_t *out);
#endif /* VLC_VIDEOCHROMA_D3D9_FMT_H_ */
diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c
index b147ff8d03..393be60651 100644
--- a/modules/video_output/win32/direct3d9.c
+++ b/modules/video_output/win32/direct3d9.c
@@ -131,7 +131,6 @@ struct d3dctx
{
d3d9_handle_t hd3d;
d3d9_device_t d3d_dev;
- HWND hwnd;
};
struct vout_display_sys_t
@@ -758,9 +757,7 @@ static int Direct3D9Open(vout_display_t *vd, video_format_t *fmt)
{
vout_display_sys_t *sys = vd->sys;
- sys->d3dctx.hwnd = sys->sys.hvideownd;
-
- if (FAILED(D3D9_CreateDevice(vd, &sys->d3dctx.hd3d, sys->d3dctx.hwnd,
+ if (FAILED(D3D9_CreateDevice(vd, &sys->d3dctx.hd3d, sys->sys.hvideownd,
&vd->source, &sys->d3dctx.d3d_dev)))
return VLC_EGENERIC;
@@ -826,7 +823,7 @@ static int Direct3D9Reset(vout_display_t *vd)
struct d3dctx *d3dctx = &sys->d3dctx;
d3d9_device_t *p_d3d9_dev = &d3dctx->d3d_dev;
- if (D3D9_FillPresentationParameters(VLC_OBJECT(vd), &d3dctx->hd3d, p_d3d9_dev->adapterId, d3dctx->hwnd, &vd->source, &d3dctx->d3d_dev))
+ if (D3D9_FillPresentationParameters(VLC_OBJECT(vd), &d3dctx->hd3d, p_d3d9_dev->adapterId, &vd->source, &d3dctx->d3d_dev))
return VLC_EGENERIC;
/* release all D3D objects */
@@ -1958,7 +1955,7 @@ GLConvOpen(vlc_object_t *obj)
tc->priv = priv;
priv->vt = vt;
- priv->d3dctx = (struct d3dctx) { .hwnd = tc->gl->surface->handle.hwnd };
+ priv->d3dctx = (struct d3dctx) { 0 };
if (D3D9_Create(obj, &priv->d3dctx.hd3d) != VLC_SUCCESS)
goto error;
@@ -1968,7 +1965,7 @@ GLConvOpen(vlc_object_t *obj)
goto error;
}
- if (FAILED(D3D9_CreateDevice(obj, &priv->d3dctx.hd3d, priv->d3dctx.hwnd,
+ if (FAILED(D3D9_CreateDevice(obj, &priv->d3dctx.hd3d, tc->gl->surface->handle.hwnd,
&tc->fmt, &priv->d3dctx.d3d_dev)))
goto error;
--
2.14.2
More information about the vlc-devel
mailing list