diff --git a/modules/video_output/win32/common.c b/modules/video_output/win32/common.c index 4736755b4f..21f057d82b 100644 --- a/modules/video_output/win32/common.c +++ b/modules/video_output/win32/common.c @@ -49,14 +49,14 @@ void CommonInit(display_win32_area_t *area) #ifndef VLC_WINSTORE_APP /* */ int CommonWindowInit(vout_display_t *vd, display_win32_area_t *area, - vout_display_sys_win32_t *sys, bool projection_gestures) + event_thread_t **sys, bool projection_gestures) { if (unlikely(vd->cfg->window == NULL)) return VLC_EGENERIC; /* */ - sys->event = EventThreadCreate(VLC_OBJECT(vd), vd->cfg->window); - if (!sys->event) + *sys = EventThreadCreate(VLC_OBJECT(vd), vd->cfg->window); + if (!*sys) return VLC_EGENERIC; /* */ @@ -66,7 +66,7 @@ int CommonWindowInit(vout_display_t *vd, display_win32_area_t *area, cfg.height = vd->cfg->display.height; cfg.is_projected = projection_gestures; - if (EventThreadStart(sys->event, &cfg)) + if (EventThreadStart(*sys, &cfg)) return VLC_EGENERIC; CommonPlacePicture(vd, area); @@ -74,9 +74,9 @@ int CommonWindowInit(vout_display_t *vd, display_win32_area_t *area, return VLC_SUCCESS; } -HWND CommonVideoHWND(const vout_display_sys_win32_t *sys) +HWND CommonVideoHWND(const event_thread_t *sys) { - return EventThreadVideoHWND(sys->event); + return EventThreadVideoHWND(sys); } #endif /* !VLC_WINSTORE_APP */ @@ -111,24 +111,24 @@ void CommonPlacePicture(vout_display_t *vd, display_win32_area_t *area) #ifndef VLC_WINSTORE_APP /* */ -void CommonWindowClean(vout_display_sys_win32_t *sys) +void CommonWindowClean(event_thread_t *sys) { - if (sys->event) { - EventThreadStop(sys->event); - EventThreadDestroy(sys->event); + if (sys) { + EventThreadStop(sys); + EventThreadDestroy(sys); } } #endif /* !VLC_WINSTORE_APP */ -void CommonControl(vout_display_t *vd, display_win32_area_t *area, vout_display_sys_win32_t *sys, int query) +void CommonControl(vout_display_t *vd, display_win32_area_t *area, event_thread_t *sys, int query) { switch (query) { case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE: #ifndef VLC_WINSTORE_APP // Update dimensions - if (sys->event != NULL) + if (sys != NULL) { - EventThreadUpdateSize(sys->event); + EventThreadUpdateSize(sys); } #endif /* !VLC_WINSTORE_APP */ // fallthrough diff --git a/modules/video_output/win32/common.h b/modules/video_output/win32/common.h index fe59116c93..84cb460ac7 100644 --- a/modules/video_output/win32/common.h +++ b/modules/video_output/win32/common.h @@ -44,29 +44,16 @@ typedef struct display_win32_area_t #define RECTWidth(r) (LONG)((r).right - (r).left) #define RECTHeight(r) (LONG)((r).bottom - (r).top) -/***************************************************************************** - * vout_sys_t: video output method descriptor - ***************************************************************************** - * This structure is part of the video output thread descriptor. - * It describes the module specific properties of an output thread. - *****************************************************************************/ -typedef struct vout_display_sys_win32_t -{ - /* */ - event_thread_t *event; -} vout_display_sys_win32_t; - - /***************************************************************************** * Prototypes from common.c *****************************************************************************/ #ifndef VLC_WINSTORE_APP -int CommonWindowInit(vout_display_t *, display_win32_area_t *, vout_display_sys_win32_t *, +int CommonWindowInit(vout_display_t *, display_win32_area_t *, event_thread_t **, bool projection_gestures); -void CommonWindowClean(vout_display_sys_win32_t *); +void CommonWindowClean(event_thread_t *); #endif /* !VLC_WINSTORE_APP */ -void CommonControl(vout_display_t *, display_win32_area_t *, vout_display_sys_win32_t *, int ); -HWND CommonVideoHWND(const vout_display_sys_win32_t *); +void CommonControl(vout_display_t *, display_win32_area_t *, event_thread_t *, int ); +HWND CommonVideoHWND(const event_thread_t *); void CommonPlacePicture (vout_display_t *, display_win32_area_t *); diff --git a/modules/video_output/win32/direct3d11.cpp b/modules/video_output/win32/direct3d11.cpp index c18d5c5443..238ccc7abe 100644 --- a/modules/video_output/win32/direct3d11.cpp +++ b/modules/video_output/win32/direct3d11.cpp @@ -73,7 +73,7 @@ vlc_module_end () typedef struct vout_display_sys_t { - vout_display_sys_win32_t sys; /* only use if sys.event is not NULL */ + event_thread_t *sys; /* only use if sys.event is not NULL */ display_win32_area_t area; int log_level; @@ -387,7 +387,7 @@ static int Open(vout_display_t *vd, vd->cfg->window->handle.dcomp_visual, sys->d3d_dev); else #endif - sys->outside_opaque = D3D11_CreateLocalSwapchainHandleHwnd(VLC_OBJECT(vd), CommonVideoHWND(&sys->sys), sys->d3d_dev); + sys->outside_opaque = D3D11_CreateLocalSwapchainHandleHwnd(VLC_OBJECT(vd), CommonVideoHWND(sys->sys), sys->d3d_dev); if (unlikely(sys->outside_opaque == NULL)) goto error; sys->updateOutputCb = D3D11_LocalSwapchainUpdateOutput; @@ -398,8 +398,8 @@ static int Open(vout_display_t *vd, } #ifndef VLC_WINSTORE_APP - if (vd->source->projection_mode != PROJECTION_MODE_RECTANGULAR && CommonVideoHWND(&sys->sys)) - sys->p_sensors = HookWindowsSensors(vd, CommonVideoHWND(&sys->sys)); + if (vd->source->projection_mode != PROJECTION_MODE_RECTANGULAR && CommonVideoHWND(sys->sys)) + sys->p_sensors = HookWindowsSensors(vd, CommonVideoHWND(sys->sys)); #endif // !VLC_WINSTORE_APP if (Direct3D11Open(vd, fmtp, context)) { @@ -439,7 +439,7 @@ static void Close(vout_display_t *vd) D3D_ReleaseShaderCompiler(sys->shaders); #ifndef VLC_WINSTORE_APP UnhookWindowsSensors(sys->p_sensors); - CommonWindowClean(&sys->sys); + CommonWindowClean(sys->sys); #endif Direct3D11Close(vd); delete sys; @@ -447,7 +447,7 @@ static void Close(vout_display_t *vd) static int Control(vout_display_t *vd, int query) { vout_display_sys_t *sys = static_cast(vd->sys); - CommonControl( vd, &sys->area, &sys->sys, query ); + CommonControl( vd, &sys->area, sys->sys, query ); if ( sys->area.place_changed ) { diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c index 3139f24f3a..1c00fcd329 100644 --- a/modules/video_output/win32/direct3d9.c +++ b/modules/video_output/win32/direct3d9.c @@ -131,7 +131,7 @@ typedef struct typedef struct vout_display_sys_t { - vout_display_sys_win32_t sys; /* only use if sys.event is not NULL */ + event_thread_t *sys; /* only use if sys.event is not NULL */ display_win32_area_t area; bool allow_hw_yuv; /* Should we use hardware YUV->RGB conversions */ @@ -1139,7 +1139,7 @@ static void Prepare(vout_display_t *vd, picture_t *picture, RECT rect; UINT width, height; - GetClientRect(CommonVideoHWND(&sys->sys), &rect); + GetClientRect(CommonVideoHWND(sys->sys), &rect); width = RECTWidth(rect); height = RECTHeight(rect); @@ -1263,9 +1263,9 @@ static void Swap(vout_display_t *vd) HRESULT hr; if (sys->d3d9_device->hd3d.use_ex) { - hr = IDirect3DDevice9Ex_PresentEx(p_d3d9_dev->devex, &src, &src, CommonVideoHWND(&sys->sys), NULL, 0); + hr = IDirect3DDevice9Ex_PresentEx(p_d3d9_dev->devex, &src, &src, CommonVideoHWND(sys->sys), NULL, 0); } else { - hr = IDirect3DDevice9_Present(p_d3d9_dev->dev, &src, &src, CommonVideoHWND(&sys->sys), NULL); + hr = IDirect3DDevice9_Present(p_d3d9_dev->dev, &src, &src, CommonVideoHWND(sys->sys), NULL); } if (FAILED(hr)) { msg_Dbg(vd, "Failed Present: 0x%lX", hr); @@ -1688,7 +1688,7 @@ static void Direct3D9Close(vout_display_t *vd) static int Control(vout_display_t *vd, int query) { vout_display_sys_t *sys = vd->sys; - CommonControl(vd, &sys->area, &sys->sys, query); + CommonControl(vd, &sys->area, sys->sys, query); return VLC_SUCCESS; } @@ -1872,7 +1872,7 @@ static int Open(vout_display_t *vd, return VLC_SUCCESS; error: Direct3D9Close(vd); - CommonWindowClean(&sys->sys); + CommonWindowClean(sys->sys); Direct3D9Destroy(sys); free(vd->sys); return VLC_EGENERIC; @@ -1887,7 +1887,7 @@ static void Close(vout_display_t *vd) Direct3D9Close(vd); - CommonWindowClean(&sys->sys); + CommonWindowClean(sys->sys); Direct3D9Destroy(sys); diff --git a/modules/video_output/win32/glwin32.c b/modules/video_output/win32/glwin32.c index 86981b544c..3b427923e6 100644 --- a/modules/video_output/win32/glwin32.c +++ b/modules/video_output/win32/glwin32.c @@ -62,7 +62,7 @@ vlc_module_end() *****************************************************************************/ typedef struct vout_display_sys_t { - vout_display_sys_win32_t sys; + event_thread_t *sys; display_win32_area_t area; vlc_gl_t *gl; @@ -84,7 +84,7 @@ static int SetViewpoint(vout_display_t *vd, const vlc_viewpoint_t *vp) static int Control(vout_display_t *vd, int query) { vout_display_sys_t *sys = vd->sys; - CommonControl(vd, &sys->area, &sys->sys, query); + CommonControl(vd, &sys->area, sys->sys, query); return VLC_SUCCESS; } @@ -101,7 +101,7 @@ static vlc_window_t *EmbedVideoWindow_Create(vout_display_t *vd) return NULL; wnd->type = VLC_WINDOW_TYPE_HWND; - wnd->handle.hwnd = CommonVideoHWND(&sys->sys); + wnd->handle.hwnd = CommonVideoHWND(sys->sys); wnd->ops = &embedVideoWindow_Ops; return wnd; } @@ -138,7 +138,7 @@ static int Open(vout_display_t *vd, goto error; if (vd->source->projection_mode != PROJECTION_MODE_RECTANGULAR) - sys->p_sensors = HookWindowsSensors(vd, CommonVideoHWND(&sys->sys)); + sys->p_sensors = HookWindowsSensors(vd, CommonVideoHWND(sys->sys)); vlc_window_SetTitle(vd->cfg->window, VOUT_TITLE " (OpenGL output)"); @@ -201,7 +201,7 @@ static void Close(vout_display_t *vd) } UnhookWindowsSensors(sys->p_sensors); - CommonWindowClean(&sys->sys); + CommonWindowClean(sys->sys); free(sys); } diff --git a/modules/video_output/win32/wingdi.c b/modules/video_output/win32/wingdi.c index 8ed7a3d3b4..ce4ca6b2dd 100644 --- a/modules/video_output/win32/wingdi.c +++ b/modules/video_output/win32/wingdi.c @@ -59,7 +59,7 @@ vlc_module_end () *****************************************************************************/ typedef struct vout_display_sys_t { - vout_display_sys_win32_t sys; + event_thread_t *sys; display_win32_area_t area; int i_depth; @@ -99,7 +99,7 @@ static void Prepare(vout_display_t *vd, picture_t *picture, subpicture_t *subpic static int Control(vout_display_t *vd, int query) { vout_display_sys_t *sys = vd->sys; - CommonControl(vd, &sys->area, &sys->sys, query); + CommonControl(vd, &sys->area, sys->sys, query); return VLC_SUCCESS; } @@ -150,9 +150,9 @@ static void Close(vout_display_t *vd) Clean(vd); - CommonWindowClean(&sys->sys); + CommonWindowClean(sys->sys); - free(vd->sys); + free(sys); } static void Display(vout_display_t *vd, picture_t *picture) @@ -160,7 +160,7 @@ static void Display(vout_display_t *vd, picture_t *picture) vout_display_sys_t *sys = vd->sys; VLC_UNUSED(picture); - HDC hdc = GetDC(CommonVideoHWND(&sys->sys)); + HDC hdc = GetDC(CommonVideoHWND(sys->sys)); if (sys->area.place_changed) { @@ -196,7 +196,7 @@ static void Display(vout_display_t *vd, picture_t *picture) SRCCOPY); } - ReleaseDC(CommonVideoHWND(&sys->sys), hdc); + ReleaseDC(CommonVideoHWND(sys->sys), hdc); } static int Init(vout_display_t *vd, video_format_t *fmt) @@ -206,7 +206,7 @@ static int Init(vout_display_t *vd, video_format_t *fmt) /* Initialize an offscreen bitmap for direct buffer operations. */ /* */ - HDC window_dc = GetDC(CommonVideoHWND(&sys->sys)); + HDC window_dc = GetDC(CommonVideoHWND(sys->sys)); /* */ sys->i_depth = GetDeviceCaps(window_dc, PLANES) * @@ -279,7 +279,7 @@ static int Init(vout_display_t *vd, video_format_t *fmt) sys->off_dc = CreateCompatibleDC(window_dc); SelectObject(sys->off_dc, sys->off_bitmap); - ReleaseDC(CommonVideoHWND(&sys->sys), window_dc); + ReleaseDC(CommonVideoHWND(sys->sys), window_dc); return VLC_SUCCESS; }