[vlc-commits] vout:win32: pass the common display_sys_t structure explicitly
Steve Lhomme
git at videolan.org
Fri Mar 29 17:31:36 CET 2019
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Mar 22 12:07:12 2019 +0100| [0a7dea4e258dd8c00001df0e681826c874d1d59b] | committer: Steve Lhomme
vout:win32: pass the common display_sys_t structure explicitly
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0a7dea4e258dd8c00001df0e681826c874d1d59b
---
modules/video_output/win32/common.c | 60 +++++++++++++--------------------
modules/video_output/win32/common.h | 12 +++----
modules/video_output/win32/direct3d11.c | 16 ++++-----
modules/video_output/win32/direct3d9.c | 16 ++++-----
modules/video_output/win32/glwin32.c | 10 +++---
modules/video_output/win32/wingdi.c | 18 ++++++----
6 files changed, 63 insertions(+), 69 deletions(-)
diff --git a/modules/video_output/win32/common.c b/modules/video_output/win32/common.c
index 5a2b8e1895..bac4b41431 100644
--- a/modules/video_output/win32/common.c
+++ b/modules/video_output/win32/common.c
@@ -45,11 +45,11 @@
#include "common.h"
#include "../video_chroma/copy.h"
-static void CommonChangeThumbnailClip(vout_display_t *, bool show);
+static void CommonChangeThumbnailClip(vout_display_t *, vout_display_sys_win32_t *, bool show);
#if !VLC_WINSTORE_APP
-static int CommonControlSetFullscreen(vout_display_t *, bool is_fullscreen);
+static int CommonControlSetFullscreen(vout_display_t *, vout_display_sys_win32_t *, bool is_fullscreen);
-static bool GetRect(const vout_display_sys_t *sys, RECT *out)
+static bool GetRect(const vout_display_sys_win32_t *sys, RECT *out)
{
if (sys->b_windowless)
return false;
@@ -68,10 +68,8 @@ static unsigned int GetPictureHeight(const vout_display_t *vd)
}
/* */
-int CommonInit(vout_display_t *vd, bool b_windowless, const vout_display_cfg_t *vdcfg)
+int CommonInit(vout_display_t *vd, vout_display_sys_win32_t *sys, bool b_windowless, const vout_display_cfg_t *vdcfg)
{
- vout_display_sys_t *sys = vd->sys;
-
sys->hwnd = NULL;
sys->hvideownd = NULL;
sys->hparent = NULL;
@@ -138,9 +136,8 @@ int CommonInit(vout_display_t *vd, bool b_windowless, const vout_display_cfg_t *
* its job is to update the source and destination RECTs used to display the
* picture.
*****************************************************************************/
-void UpdateRects(vout_display_t *vd, bool is_forced)
+void UpdateRects(vout_display_t *vd, vout_display_sys_win32_t *sys, bool is_forced)
{
- vout_display_sys_t *sys = vd->sys;
const video_format_t *source = &vd->source;
#define rect_src sys->rect_src
#define rect_src_clipped sys->rect_src_clipped
@@ -282,7 +279,7 @@ void UpdateRects(vout_display_t *vd, bool is_forced)
rect_dest.right, rect_dest.bottom);
#endif
- CommonChangeThumbnailClip(vd, true);
+ CommonChangeThumbnailClip(vd, sys, true);
exit:
/* Signal the change in size/position */
@@ -295,19 +292,17 @@ exit:
#if !VLC_WINSTORE_APP
/* */
-void CommonClean(vout_display_t *vd)
+void CommonClean(vout_display_t *vd, vout_display_sys_win32_t *sys)
{
- vout_display_sys_t *sys = vd->sys;
if (sys->event) {
- CommonChangeThumbnailClip(vd, false);
+ CommonChangeThumbnailClip(vd, sys, false);
EventThreadStop(sys->event);
EventThreadDestroy(sys->event);
}
}
-void CommonManage(vout_display_t *vd)
+void CommonManage(vout_display_t *vd, vout_display_sys_win32_t *sys)
{
- vout_display_sys_t *sys = vd->sys;
if (sys->b_windowless)
return;
@@ -341,22 +336,21 @@ void CommonManage(vout_display_t *vd)
RECTHeight(rect_parent),
SWP_NOZORDER);
- UpdateRects(vd, true);
+ UpdateRects(vd, sys, true);
}
}
/* HasMoved means here resize or move */
if (EventThreadGetAndResetHasMoved(sys->event))
- UpdateRects(vd, false);
+ UpdateRects(vd, sys, false);
}
/**
* It ensures that the video window is shown after the first picture
* is displayed.
*/
-void CommonDisplay(vout_display_t *vd)
+void CommonDisplay(vout_display_sys_win32_t *sys)
{
- vout_display_sys_t *sys = vd->sys;
if (!sys->is_first_display)
return;
@@ -376,10 +370,8 @@ void CommonDisplay(vout_display_t *vd)
#if !VLC_WINSTORE_APP
/* */
-static void CommonChangeThumbnailClip(vout_display_t *vd, bool show)
+static void CommonChangeThumbnailClip(vout_display_t *vd, vout_display_sys_win32_t *sys, bool show)
{
- vout_display_sys_t *sys = vd->sys;
-
/* Windows 7 taskbar thumbnail code */
OSVERSIONINFO winVer;
winVer.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
@@ -423,10 +415,8 @@ static void CommonChangeThumbnailClip(vout_display_t *vd, bool show)
CoUninitialize();
}
-static int CommonControlSetFullscreen(vout_display_t *vd, bool is_fullscreen)
+static int CommonControlSetFullscreen(vout_display_t *vd, vout_display_sys_win32_t *sys, bool is_fullscreen)
{
- vout_display_sys_t *sys = vd->sys;
-
#ifdef MODULE_NAME_IS_direct3d9
if (sys->use_desktop && is_fullscreen)
return VLC_EGENERIC;
@@ -515,18 +505,16 @@ static int CommonControlSetFullscreen(vout_display_t *vd, bool is_fullscreen)
#else
-void CommonManage(vout_display_t *vd) {
- UpdateRects(vd, false);
+void CommonManage(vout_display_t *vd, vout_display_sys_win32_t *sys) {
+ UpdateRects(vd, sys, false);
}
-void CommonClean(vout_display_t *vd) {}
-void CommonDisplay(vout_display_t *vd) {}
-void CommonChangeThumbnailClip(vout_display_t *vd, bool show) {}
+void CommonClean(vout_display_t *vd, vout_display_sys_win32_t *) {}
+void CommonDisplay(vout_display_sys_win32_t *) {}
+void CommonChangeThumbnailClip(vout_display_t *vd, vout_display_sys_win32_t *, bool show) {}
#endif
-int CommonControl(vout_display_t *vd, int query, va_list args)
+int CommonControl(vout_display_t *vd, vout_display_sys_win32_t *sys, int query, va_list args)
{
- vout_display_sys_t *sys = vd->sys;
-
switch (query) {
case VOUT_DISPLAY_CHANGE_DISPLAY_FILLED: /* const vout_display_cfg_t *p_cfg */
case VOUT_DISPLAY_CHANGE_ZOOM: /* const vout_display_cfg_t *p_cfg */
@@ -534,7 +522,7 @@ int CommonControl(vout_display_t *vd, int query, va_list args)
case VOUT_DISPLAY_CHANGE_SOURCE_CROP: {
const vout_display_cfg_t *cfg = va_arg(args, const vout_display_cfg_t *);
sys->vdcfg = *cfg;
- UpdateRects(vd, true);
+ UpdateRects(vd, sys, true);
return VLC_SUCCESS;
}
#if !VLC_WINSTORE_APP
@@ -555,7 +543,7 @@ int CommonControl(vout_display_t *vd, int query, va_list args)
RECTHeight(rect_window), SWP_NOMOVE);
}
sys->vdcfg = *cfg;
- UpdateRects(vd, false);
+ UpdateRects(vd, sys, false);
return VLC_SUCCESS;
}
case VOUT_DISPLAY_CHANGE_WINDOW_STATE: { /* unsigned state */
@@ -579,9 +567,9 @@ int CommonControl(vout_display_t *vd, int query, va_list args)
}
case VOUT_DISPLAY_CHANGE_FULLSCREEN: {
bool fs = va_arg(args, int);
- if (CommonControlSetFullscreen(vd, fs))
+ if (CommonControlSetFullscreen(vd, sys, fs))
return VLC_EGENERIC;
- UpdateRects(vd, false);
+ UpdateRects(vd, sys, false);
return VLC_SUCCESS;
}
diff --git a/modules/video_output/win32/common.h b/modules/video_output/win32/common.h
index a46edbb8a4..1bc427f0ce 100644
--- a/modules/video_output/win32/common.h
+++ b/modules/video_output/win32/common.h
@@ -84,13 +84,13 @@ typedef struct vout_display_sys_win32_t
/*****************************************************************************
* Prototypes from common.c
*****************************************************************************/
-int CommonInit(vout_display_t *, bool b_windowless, const vout_display_cfg_t *vdcfg);
-void CommonClean(vout_display_t *);
-void CommonManage(vout_display_t *);
-int CommonControl(vout_display_t *, int , va_list );
-void CommonDisplay(vout_display_t *);
+int CommonInit(vout_display_t *, vout_display_sys_win32_t *, bool b_windowless, const vout_display_cfg_t *);
+void CommonClean(vout_display_t *, vout_display_sys_win32_t *);
+void CommonManage(vout_display_t *, vout_display_sys_win32_t *);
+int CommonControl(vout_display_t *, vout_display_sys_win32_t *, int , va_list );
+void CommonDisplay(vout_display_sys_win32_t *);
-void UpdateRects (vout_display_t *, bool is_forced);
+void UpdateRects (vout_display_t *, vout_display_sys_win32_t *, bool is_forced);
/*****************************************************************************
* Constants
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 61943255e5..ae20889c3c 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -224,7 +224,7 @@ static void Manage(vout_display_t *vd)
RECT before_src_clipped = sys->sys.rect_src_clipped;
RECT before_dest = sys->sys.rect_dest;
- CommonManage(vd);
+ CommonManage(vd, &sys->sys);
if (!RectEquals(&before_src_clipped, &sys->sys.rect_src_clipped) ||
!RectEquals(&before_dest, &sys->sys.rect_dest))
@@ -489,7 +489,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
goto error;
}
#endif
- if (CommonInit(vd, d3d11_ctx != NULL, cfg))
+ if (CommonInit(vd, &sys->sys, d3d11_ctx != NULL, cfg))
goto error;
#if VLC_WINSTORE_APP
@@ -549,7 +549,7 @@ error:
static void Close(vout_display_t *vd)
{
Direct3D11Close(vd);
- CommonClean(vd);
+ CommonClean(vd, &vd->sys->sys);
Direct3D11Destroy(vd);
}
@@ -752,7 +752,7 @@ static int Control(vout_display_t *vd, int query, va_list args)
RECT before_src_clipped = sys->sys.rect_src_clipped;
RECT before_dest = sys->sys.rect_dest;
- int res = CommonControl( vd, query, args );
+ int res = CommonControl( vd, &sys->sys, query, args );
if (query == VOUT_DISPLAY_CHANGE_VIEWPOINT)
{
@@ -855,7 +855,7 @@ static void PreparePicture(vout_display_t *vd, picture_t *picture, subpicture_t
sys->picQuad.i_height = texDesc.Height;
sys->picQuad.i_width = texDesc.Width;
- UpdateRects(vd, true);
+ UpdateRects(vd, &sys->sys, true);
UpdateSize(vd);
}
}
@@ -957,7 +957,7 @@ static void Display(vout_display_t *vd, picture_t *picture)
sys->swapCb(sys->outside_opaque);
d3d11_device_unlock( &sys->d3d_dev );
- CommonDisplay(vd);
+ CommonDisplay(&sys->sys);
}
static void Direct3D11Destroy(vout_display_t *vd)
@@ -1466,7 +1466,7 @@ static int Direct3D11CreateFormatResources(vout_display_t *vd, const video_forma
sys->picQuad.i_height = (sys->picQuad.i_height + 0x01) & ~0x01;
}
- UpdateRects(vd, true);
+ UpdateRects(vd, &sys->sys, true);
video_format_t surface_fmt = *fmt;
surface_fmt.i_width = sys->picQuad.i_width;
@@ -1569,7 +1569,7 @@ static int Direct3D11CreateGenericResources(vout_display_t *vd)
ID3D11DepthStencilState_Release(pDepthStencilState);
}
- UpdateRects(vd, true);
+ UpdateRects(vd, &sys->sys, true);
hr = UpdateBackBuffer(vd);
if (FAILED(hr)) {
diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c
index 4c45ec1b24..552d9525cd 100644
--- a/modules/video_output/win32/direct3d9.c
+++ b/modules/video_output/win32/direct3d9.c
@@ -882,7 +882,7 @@ static int Direct3D9Reset(vout_display_t *vd, video_format_t *fmtp)
return VLC_EGENERIC;
}
- UpdateRects(vd, true);
+ UpdateRects(vd, &sys->sys, true);
/* re-create them */
if (Direct3D9CreateResources(vd, fmtp)) {
@@ -919,7 +919,7 @@ static void Manage (vout_display_t *vd)
{
vout_display_sys_t *sys = vd->sys;
- CommonManage(vd);
+ CommonManage(vd, &sys->sys);
/* Desktop mode change */
bool prev_desktop = sys->sys.use_desktop;
@@ -1342,7 +1342,7 @@ static void Display(vout_display_t *vd, picture_t *picture)
sys->swapCb(sys->outside_opaque);
- CommonDisplay(vd);
+ CommonDisplay(&sys->sys);
}
/**
@@ -1496,7 +1496,7 @@ static int Direct3D9Open(vout_display_t *vd, video_format_t *fmt,
fmt->i_bmask = d3dfmt->bmask;
sys->sw_texture_fmt = d3dfmt;
- UpdateRects(vd, true);
+ UpdateRects(vd, &sys->sys, true);
if (Direct3D9CreateResources(vd, fmt)) {
msg_Err(vd, "Failed to allocate resources");
@@ -1547,7 +1547,7 @@ static int Control(vout_display_t *vd, int query, va_list args)
return VLC_SUCCESS;
}
default:
- return CommonControl(vd, query, args);
+ return CommonControl(vd, &sys->sys, query, args);
}
}
@@ -1671,7 +1671,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
sys->desktop_save.is_fullscreen = cfg->is_fullscreen;
sys->desktop_save.is_on_top = false;
- if (CommonInit(vd, d3d9_device != NULL, cfg))
+ if (CommonInit(vd, &sys->sys, d3d9_device != NULL, cfg))
goto error;
/* */
@@ -1719,7 +1719,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
return VLC_SUCCESS;
error:
Direct3D9Close(vd);
- CommonClean(vd);
+ CommonClean(vd, &sys->sys);
Direct3D9Destroy(sys);
free(vd->sys);
return VLC_EGENERIC;
@@ -1734,7 +1734,7 @@ static void Close(vout_display_t *vd)
Direct3D9Close(vd);
- CommonClean(vd);
+ CommonClean(vd, &vd->sys->sys);
Direct3D9Destroy(vd->sys);
diff --git a/modules/video_output/win32/glwin32.c b/modules/video_output/win32/glwin32.c
index 78b70bbd90..f026e45ae1 100644
--- a/modules/video_output/win32/glwin32.c
+++ b/modules/video_output/win32/glwin32.c
@@ -80,7 +80,7 @@ static int Control(vout_display_t *vd, int query, va_list args)
return vout_display_opengl_SetViewpoint(sys->vgl,
&va_arg (args, const vout_display_cfg_t* )->viewpoint);
- return CommonControl(vd, query, args);
+ return CommonControl(vd, &sys->sys, query, args);
}
static const struct vout_window_operations embedVideoWindow_Ops =
@@ -122,7 +122,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
return VLC_ENOMEM;
/* */
- if (CommonInit(vd, false, cfg))
+ if (CommonInit(vd, &sys->sys, false, cfg))
goto error;
if (!sys->sys.b_windowless)
@@ -193,7 +193,7 @@ static void Close(vout_display_t *vd)
vlc_object_delete(surface);
}
- CommonClean(vd);
+ CommonClean(vd, &sys->sys);
free(sys);
}
@@ -236,14 +236,14 @@ static void Display(vout_display_t *vd, picture_t *picture)
vlc_gl_ReleaseCurrent (sys->gl);
}
- CommonDisplay(vd);
+ CommonDisplay(&sys->sys);
}
static void Manage (vout_display_t *vd)
{
vout_display_sys_t *sys = vd->sys;
- CommonManage(vd);
+ CommonManage(vd, &sys->sys);
const int width = RECTWidth(sys->sys.rect_dest);
const int height = RECTHeight(sys->sys.rect_dest);
diff --git a/modules/video_output/win32/wingdi.c b/modules/video_output/win32/wingdi.c
index a4ec42f840..f86507f594 100644
--- a/modules/video_output/win32/wingdi.c
+++ b/modules/video_output/win32/wingdi.c
@@ -97,6 +97,12 @@ static void Prepare(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
picture_CopyPixels(&fake_pic, picture);
}
+static int Control(vout_display_t *vd, int query, va_list args)
+{
+ vout_display_sys_t *sys = vd->sys;
+ return CommonControl(vd, &sys->sys, query, args);
+}
+
/* */
static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
video_format_t *fmtp, vlc_video_context *context)
@@ -110,7 +116,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
if (!sys)
return VLC_ENOMEM;
- if (CommonInit(vd, false, cfg))
+ if (CommonInit(vd, &sys->sys, false, cfg))
goto error;
/* */
@@ -122,7 +128,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
vd->prepare = Prepare;
vd->display = Display;
- vd->control = CommonControl;
+ vd->control = Control;
return VLC_SUCCESS;
error:
@@ -135,7 +141,7 @@ static void Close(vout_display_t *vd)
{
Clean(vd);
- CommonClean(vd);
+ CommonClean(vd, &vd->sys->sys);
free(vd->sys);
}
@@ -171,8 +177,8 @@ static void Display(vout_display_t *vd, picture_t *picture)
#undef rect_src_clipped
#undef rect_dest
- CommonDisplay(vd);
- CommonManage(vd);
+ CommonDisplay(&sys->sys);
+ CommonManage(vd, &sys->sys);
}
static int Init(vout_display_t *vd, video_format_t *fmt)
@@ -267,7 +273,7 @@ static int Init(vout_display_t *vd, video_format_t *fmt)
if (!sys->sys.b_windowless)
EventThreadUpdateTitle(sys->sys.event, VOUT_TITLE " (WinGDI output)");
- UpdateRects(vd, true);
+ UpdateRects(vd, &sys->sys, true);
return VLC_SUCCESS;
}
More information about the vlc-commits
mailing list