[vlc-commits] vout:win32: always pass the vout_display_sys_win32_t in common API
Steve Lhomme
git at videolan.org
Tue Apr 2 16:32:41 CEST 2019
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Apr 2 08:49:42 2019 +0200| [87f8eff222d78eb580c17f29ea598065928c9aab] | committer: Steve Lhomme
vout:win32: always pass the vout_display_sys_win32_t in common API
The existence of the event tells if it's in windowless mode or not.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=87f8eff222d78eb580c17f29ea598065928c9aab
---
modules/video_output/win32/common.c | 13 +++++--------
modules/video_output/win32/direct3d11.c | 10 +++++-----
modules/video_output/win32/direct3d9.c | 8 ++++----
3 files changed, 14 insertions(+), 17 deletions(-)
diff --git a/modules/video_output/win32/common.c b/modules/video_output/win32/common.c
index 9b8066ee6f..5c6f102c52 100644
--- a/modules/video_output/win32/common.c
+++ b/modules/video_output/win32/common.c
@@ -180,7 +180,7 @@ void UpdateRects(vout_display_t *vd, display_win32_area_t *area, vout_display_sy
#endif
#if !VLC_WINSTORE_APP
- if (sys != NULL)
+ if (sys->event != NULL)
{
EventThreadUpdatePlace(sys->event, &area->place);
@@ -216,10 +216,7 @@ void CommonClean(vlc_object_t *obj, vout_display_sys_win32_t *sys)
void CommonManage(vout_display_t *vd, display_win32_area_t *area, vout_display_sys_win32_t *sys)
{
- if (sys == NULL)
- return;
-
- if (EventThreadGetAndResetSizeChanged(sys->event))
+ if (sys->event != NULL && EventThreadGetAndResetSizeChanged(sys->event))
UpdateRects(vd, area, sys);
}
@@ -370,7 +367,7 @@ int CommonControl(vout_display_t *vd, display_win32_area_t *area, vout_display_s
{ /* Update dimensions */
area->vdcfg = *va_arg(args, const vout_display_cfg_t *);
#if !VLC_WINSTORE_APP
- if (!area->vdcfg.is_fullscreen && sys != NULL) {
+ if (!area->vdcfg.is_fullscreen && sys->event != NULL) {
RECT rect_window = {
.top = 0,
.left = 0,
@@ -390,7 +387,7 @@ int CommonControl(vout_display_t *vd, display_win32_area_t *area, vout_display_s
case VOUT_DISPLAY_CHANGE_WINDOW_STATE: { /* unsigned state */
const unsigned state = va_arg(args, unsigned);
const bool is_on_top = (state & VOUT_WINDOW_STATE_ABOVE) != 0;
- if (sys != NULL)
+ if (sys->event != NULL)
{
#ifdef MODULE_NAME_IS_direct3d9
if (sys->use_desktop && is_on_top)
@@ -411,7 +408,7 @@ int CommonControl(vout_display_t *vd, display_win32_area_t *area, vout_display_s
}
case VOUT_DISPLAY_CHANGE_FULLSCREEN: {
bool fs = va_arg(args, int);
- if (sys != NULL)
+ if (sys->event != NULL)
{
if (CommonControlSetFullscreen(VLC_OBJECT(vd), sys, fs))
return VLC_EGENERIC;
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 9c4925af44..4ccee2ff22 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -288,7 +288,7 @@ static bool StartRendering(void *opaque)
/* TODO read the swapchain size and call VOUT_DISPLAY_CHANGE_DISPLAY_SIZE */
UpdateRects(vd, &sys->area, &sys->sys);
#else /* !VLC_WINSTORE_APP */
- CommonManage(vd, &sys->area, sys->sys.event ? &sys->sys : NULL);
+ CommonManage(vd, &sys->area, &sys->sys);
#endif
if ( sys->area.place_changed )
@@ -745,7 +745,7 @@ static void SetQuadVSProjection(vout_display_t *vd, d3d_quad_t *quad, const vlc_
static int Control(vout_display_t *vd, int query, va_list args)
{
vout_display_sys_t *sys = vd->sys;
- int res = CommonControl( vd, &sys->area, sys->sys.event ? &sys->sys : NULL, query, args );
+ int res = CommonControl( vd, &sys->area, &sys->sys, query, args );
if (query == VOUT_DISPLAY_CHANGE_VIEWPOINT)
{
@@ -848,7 +848,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, &sys->area, sys->sys.event ? &sys->sys : NULL);
+ UpdateRects(vd, &sys->area, &sys->sys);
UpdateSize(vd);
}
}
@@ -1464,7 +1464,7 @@ static int Direct3D11CreateFormatResources(vout_display_t *vd, const video_forma
sys->picQuad.i_height = (sys->picQuad.i_height + 0x01) & ~0x01;
}
- UpdateRects(vd, &sys->area, sys->sys.event ? &sys->sys : NULL);
+ UpdateRects(vd, &sys->area, &sys->sys);
video_format_t surface_fmt = *fmt;
surface_fmt.i_width = sys->picQuad.i_width;
@@ -1574,7 +1574,7 @@ static int Direct3D11CreateGenericResources(vout_display_t *vd)
ID3D11DepthStencilState_Release(pDepthStencilState);
}
- UpdateRects(vd, &sys->area, sys->sys.event ? &sys->sys : NULL);
+ UpdateRects(vd, &sys->area, &sys->sys);
hr = UpdateBackBuffer(vd);
if (FAILED(hr)) {
diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c
index 28e6938c71..2be530a354 100644
--- a/modules/video_output/win32/direct3d9.c
+++ b/modules/video_output/win32/direct3d9.c
@@ -900,7 +900,7 @@ static int Direct3D9Reset(vout_display_t *vd, video_format_t *fmtp)
return VLC_EGENERIC;
}
- UpdateRects(vd, &sys->area, sys->sys.event ? &sys->sys : NULL);
+ UpdateRects(vd, &sys->area, &sys->sys);
/* re-create them */
if (Direct3D9CreateResources(vd, fmtp)) {
@@ -1208,7 +1208,7 @@ static void Prepare(vout_display_t *vd, picture_t *picture,
VLC_UNUSED(date);
vout_display_sys_t *sys = vd->sys;
- CommonManage(vd, &sys->area, sys->sys.event ? &sys->sys : NULL);
+ CommonManage(vd, &sys->area, &sys->sys);
/* Desktop mode change */
bool prev_desktop = sys->sys.use_desktop;
@@ -1505,7 +1505,7 @@ static int Direct3D9Open(vout_display_t *vd, video_format_t *fmt,
fmt->i_bmask = d3dfmt->bmask;
sys->sw_texture_fmt = d3dfmt;
- UpdateRects(vd, &sys->area, sys->sys.event ? &sys->sys : NULL);
+ UpdateRects(vd, &sys->area, &sys->sys);
if (Direct3D9CreateResources(vd, fmt)) {
msg_Err(vd, "Failed to allocate resources");
@@ -1556,7 +1556,7 @@ static int Control(vout_display_t *vd, int query, va_list args)
return VLC_SUCCESS;
}
default:
- return CommonControl(vd, &sys->area, sys->sys.event ? &sys->sys : NULL, query, args);
+ return CommonControl(vd, &sys->area, &sys->sys, query, args);
}
}
More information about the vlc-commits
mailing list