vlc | branch: master | Steve Lhomme <[email protected]> | Tue Mar 26 13:15:06 2019 +0100| [debcdb33d084e1ce5d656d9fbc20734504e6257e] | committer: Steve Lhomme
vout:win32: separate the bare object use from direct vout_display_t use > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=debcdb33d084e1ce5d656d9fbc20734504e6257e --- modules/video_output/win32/common.c | 10 +++--- modules/video_output/win32/common.h | 2 +- modules/video_output/win32/direct3d11.c | 2 +- modules/video_output/win32/direct3d9.c | 2 +- modules/video_output/win32/events.c | 62 +++++++++++++++------------------ modules/video_output/win32/events.h | 2 +- modules/video_output/win32/glwin32.c | 2 +- modules/video_output/win32/wingdi.c | 2 +- 8 files changed, 40 insertions(+), 44 deletions(-) diff --git a/modules/video_output/win32/common.c b/modules/video_output/win32/common.c index 0cb2162d61..6d2a395063 100644 --- a/modules/video_output/win32/common.c +++ b/modules/video_output/win32/common.c @@ -77,7 +77,7 @@ static bool GetWindowDimensions(void *opaque, UINT *width, UINT *height) } /* */ -int CommonInit(vout_display_t *vd, display_win32_area_t *area, vout_display_sys_win32_t *sys) +int CommonInit(vlc_object_t *obj, vout_display_t *vd, display_win32_area_t *area, vout_display_sys_win32_t *sys) { if (unlikely(area->vdcfg.window == NULL)) return VLC_EGENERIC; @@ -98,10 +98,10 @@ int CommonInit(vout_display_t *vd, display_win32_area_t *area, vout_display_sys_ area->pf_GetDisplayDimensions = GetWindowDimensions; area->opaque_dimensions = sys; - var_Create(vd, "video-deco", VLC_VAR_BOOL | VLC_VAR_DOINHERIT); + var_Create(obj, "video-deco", VLC_VAR_BOOL | VLC_VAR_DOINHERIT); /* */ - sys->event = EventThreadCreate(vd, area->vdcfg.window); + sys->event = EventThreadCreate(obj, area->vdcfg.window); if (!sys->event) return VLC_EGENERIC; @@ -114,8 +114,8 @@ int CommonInit(vout_display_t *vd, display_win32_area_t *area, vout_display_sys_ #ifdef MODULE_NAME_IS_direct3d9 cfg.use_desktop = sys->use_desktop; #endif - cfg.x = var_InheritInteger(vd, "video-x"); - cfg.y = var_InheritInteger(vd, "video-y"); + cfg.x = var_InheritInteger(obj, "video-x"); + cfg.y = var_InheritInteger(obj, "video-y"); cfg.width = area->vdcfg.display.width; cfg.height = area->vdcfg.display.height; cfg.is_projected = vd->source.projection_mode != PROJECTION_MODE_RECTANGULAR; diff --git a/modules/video_output/win32/common.h b/modules/video_output/win32/common.h index 74000a51b7..88745755b7 100644 --- a/modules/video_output/win32/common.h +++ b/modules/video_output/win32/common.h @@ -75,7 +75,7 @@ typedef struct vout_display_sys_win32_t * Prototypes from common.c *****************************************************************************/ #if !VLC_WINSTORE_APP -int CommonInit(vout_display_t *, display_win32_area_t *, vout_display_sys_win32_t *); +int CommonInit(vlc_object_t *, vout_display_t *, display_win32_area_t *, vout_display_sys_win32_t *); void CommonClean(vlc_object_t *, vout_display_sys_win32_t *); #endif /* !VLC_WINSTORE_APP */ void CommonManage(vout_display_t *, display_win32_area_t *, vout_display_sys_win32_t *); diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c index 4ccee2ff22..fe8456b43d 100644 --- a/modules/video_output/win32/direct3d11.c +++ b/modules/video_output/win32/direct3d11.c @@ -481,7 +481,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg, #endif InitArea(vd, &sys->area, cfg); #if !VLC_WINSTORE_APP - if (d3d11_ctx == NULL && CommonInit(vd, &sys->area, &sys->sys)) + if (d3d11_ctx == NULL && CommonInit(VLC_OBJECT(vd), vd, &sys->area, &sys->sys)) goto error; #else /* !VLC_WINSTORE_APP */ sys->area.pf_GetDisplayDimensions = GetExtenalSwapchainDimensions; diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c index 41268ba0fb..d5e0a4369e 100644 --- a/modules/video_output/win32/direct3d9.c +++ b/modules/video_output/win32/direct3d9.c @@ -1681,7 +1681,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg, sys->desktop_save.is_on_top = false; InitArea(vd, &sys->area, cfg); - if (d3d9_device == NULL && CommonInit(vd, &sys->area, &sys->sys)) + if (d3d9_device == NULL && CommonInit(VLC_OBJECT(vd), vd, &sys->area, &sys->sys)) goto error; /* */ diff --git a/modules/video_output/win32/events.c b/modules/video_output/win32/events.c index 6d040d5f8d..303f843f35 100644 --- a/modules/video_output/win32/events.c +++ b/modules/video_output/win32/events.c @@ -50,7 +50,7 @@ struct event_thread_t { - vout_display_t *vd; + vlc_object_t *obj; /* */ vlc_thread_t thread; @@ -154,13 +154,12 @@ static inline bool isKeyEvent( WPARAM type ) static void *EventThread( void *p_this ) { event_thread_t *p_event = (event_thread_t *)p_this; - vout_display_t *vd = p_event->vd; MSG msg; POINT old_mouse_pos = {0,0}, mouse_pos; int canc = vlc_savecancel (); - bool b_mouse_support = var_InheritBool( vd, "mouse-events" ); - bool b_key_support = var_InheritBool( vd, "keyboard-events" ); + bool b_mouse_support = var_InheritBool( p_event->obj, "mouse-events" ); + bool b_key_support = var_InheritBool( p_event->obj, "keyboard-events" ); vlc_mutex_lock( &p_event->lock ); /* Create a window for the video */ @@ -381,11 +380,11 @@ static void *EventThread( void *p_this ) /* Check for WM_QUIT if we created the window */ if( !p_event->hparent && msg.message == WM_QUIT ) { - msg_Warn( vd, "WM_QUIT... should not happen!!" ); + msg_Warn( p_event->obj, "WM_QUIT... should not happen!!" ); p_event->hwnd = NULL; /* Window already destroyed */ } - msg_Dbg( vd, "Win32 Vout EventThread terminating" ); + msg_Dbg( p_event->obj, "Win32 Vout EventThread terminating" ); Win32VoutCloseWindow( p_event ); vlc_restorecancel(canc); @@ -394,7 +393,7 @@ static void *EventThread( void *p_this ) void EventThreadUpdateTitle( event_thread_t *p_event, const char *psz_fallback ) { - char *psz_title = var_InheritString( p_event->vd, "video-title" ); + char *psz_title = var_InheritString( p_event->obj, "video-title" ); if( !psz_title ) psz_title = strdup( psz_fallback ); if( !psz_title ) @@ -426,7 +425,7 @@ bool EventThreadGetAndResetSizeChanged( event_thread_t *p_event ) return atomic_exchange(&p_event->size_changed, false); } -event_thread_t *EventThreadCreate( vout_display_t *vd, vout_window_t *parent_window) +event_thread_t *EventThreadCreate( vlc_object_t *obj, vout_window_t *parent_window) { if (parent_window->type != VOUT_WINDOW_TYPE_HWND && !(parent_window->type == VOUT_WINDOW_TYPE_DUMMY && parent_window->handle.hwnd == 0)) @@ -438,12 +437,12 @@ event_thread_t *EventThreadCreate( vout_display_t *vd, vout_window_t *parent_win * Vout EventThread will take care of the creation of the video * window (because PeekMessage has to be called from the same thread which * created the window). */ - msg_Dbg( vd, "creating Vout EventThread" ); + msg_Dbg( obj, "creating Vout EventThread" ); event_thread_t *p_event = malloc( sizeof(*p_event) ); if( !p_event ) return NULL; - p_event->vd = vd; + p_event->obj = obj; vlc_mutex_init( &p_event->lock ); vlc_cond_init( &p_event->wait ); @@ -494,7 +493,7 @@ int EventThreadStart( event_thread_t *p_event, event_hwnd_t *p_hwnd, const event if( vlc_clone( &p_event->thread, EventThread, p_event, VLC_THREAD_PRIORITY_LOW ) ) { - msg_Err( p_event->vd, "cannot create Vout EventThread" ); + msg_Err( p_event->obj, "cannot create Vout EventThread" ); return VLC_EGENERIC; } @@ -510,7 +509,7 @@ int EventThreadStart( event_thread_t *p_event, event_hwnd_t *p_hwnd, const event p_event->b_ready = false; return VLC_EGENERIC; } - msg_Dbg( p_event->vd, "Vout EventThread running" ); + msg_Dbg( p_event->obj, "Vout EventThread running" ); /* */ p_hwnd->parent_window = p_event->parent_window; @@ -626,7 +625,7 @@ enumWindowsProc(HWND hwnd, LPARAM lParam) return true; } -static HWND GetDesktopHandle(vout_display_t *vd) +static HWND GetDesktopHandle(vlc_object_t *obj) { /* Find Program Manager */ HWND hwnd = FindWindow( _T("Progman"), NULL ); @@ -635,7 +634,7 @@ static HWND GetDesktopHandle(vout_display_t *vd) if( hwnd ) return hwnd; - msg_Dbg( vd, "Couldn't find desktop icon window,. Trying the hard way." ); + msg_Dbg( obj, "Couldn't find desktop icon window,. Trying the hard way." ); EnumWindows( enumWindowsProc, (LPARAM)&hwnd ); return hwnd; @@ -651,14 +650,13 @@ static HWND GetDesktopHandle(vout_display_t *vd) *****************************************************************************/ static int Win32VoutCreateWindow( event_thread_t *p_event ) { - vout_display_t *vd = p_event->vd; HINSTANCE hInstance; HMENU hMenu; WNDCLASS wc; /* window class components */ TCHAR vlc_path[MAX_PATH+1]; int i_style; - msg_Dbg( vd, "Win32VoutCreateWindow" ); + msg_Dbg( p_event->obj, "Win32VoutCreateWindow" ); /* Get this module's instance */ hInstance = GetModuleHandle(NULL); @@ -674,7 +672,7 @@ static int Win32VoutCreateWindow( event_thread_t *p_event ) else { p_event->parent_window = NULL; - p_event->hparent = GetDesktopHandle(vd); + p_event->hparent = GetDesktopHandle(p_event->obj); } #endif p_event->cursor_arrow = LoadCursor(NULL, IDC_ARROW); @@ -686,7 +684,7 @@ static int Win32VoutCreateWindow( event_thread_t *p_event ) { p_event->vlc_icon = ExtractIcon( hInstance, vlc_path, 0 ); } - p_event->hide_timeout = var_InheritInteger( p_event->vd, "mouse-hide-timeout" ); + p_event->hide_timeout = var_InheritInteger( p_event->obj, "mouse-hide-timeout" ); UpdateCursorMoved( p_event ); /* Fill in the window class structure */ @@ -712,7 +710,7 @@ static int Win32VoutCreateWindow( event_thread_t *p_event ) if( p_event->vlc_icon ) DestroyIcon( p_event->vlc_icon ); - msg_Err( vd, "Win32VoutCreateWindow RegisterClass FAILED (err=%lu)", GetLastError() ); + msg_Err( p_event->obj, "Win32VoutCreateWindow RegisterClass FAILED (err=%lu)", GetLastError() ); return VLC_EGENERIC; } @@ -722,7 +720,7 @@ static int Win32VoutCreateWindow( event_thread_t *p_event ) wc.hbrBackground = NULL; /* no background color */ if( !RegisterClass(&wc) ) { - msg_Err( vd, "Win32VoutCreateWindow RegisterClass FAILED (err=%lu)", GetLastError() ); + msg_Err( p_event->obj, "Win32VoutCreateWindow RegisterClass FAILED (err=%lu)", GetLastError() ); return VLC_EGENERIC; } @@ -731,7 +729,7 @@ static int Win32VoutCreateWindow( event_thread_t *p_event ) * titlebar. We use the following function to find out the size of * the window corresponding to the useable surface we want */ RECT decorated_window = p_event->window_area; - i_style = var_GetBool( vd, "video-deco" ) + i_style = var_GetBool( p_event->obj, "video-deco" ) /* Open with window decoration */ ? WS_OVERLAPPEDWINDOW|WS_SIZEBOX /* No window decoration */ @@ -744,8 +742,8 @@ static int Win32VoutCreateWindow( event_thread_t *p_event ) i_style = WS_VISIBLE|WS_CLIPCHILDREN|WS_CHILD; /* allow user to regain control over input events if requested */ - bool b_mouse_support = var_InheritBool( vd, "mouse-events" ); - bool b_key_support = var_InheritBool( vd, "keyboard-events" ); + bool b_mouse_support = var_InheritBool( p_event->obj, "mouse-events" ); + bool b_key_support = var_InheritBool( p_event->obj, "keyboard-events" ); if( !b_mouse_support && !b_key_support ) i_style |= WS_DISABLED; } @@ -771,7 +769,7 @@ static int Win32VoutCreateWindow( event_thread_t *p_event ) if( !p_event->hwnd ) { - msg_Warn( vd, "Win32VoutCreateWindow create window FAILED (err=%lu)", GetLastError() ); + msg_Warn( p_event->obj, "Win32VoutCreateWindow create window FAILED (err=%lu)", GetLastError() ); return VLC_EGENERIC; } @@ -819,10 +817,10 @@ static int Win32VoutCreateWindow( event_thread_t *p_event ) if( !p_event->hvideownd ) { - msg_Err( vd, "can't create video sub-window" ); + msg_Err( p_event->obj, "can't create video sub-window" ); return VLC_EGENERIC; } - msg_Dbg( vd, "created video sub-window" ); + msg_Dbg( p_event->obj, "created video sub-window" ); InitGestures( p_event->hwnd, &p_event->p_gesture, p_event->is_projected ); @@ -839,8 +837,7 @@ static int Win32VoutCreateWindow( event_thread_t *p_event ) *****************************************************************************/ static void Win32VoutCloseWindow( event_thread_t *p_event ) { - vout_display_t *vd = p_event->vd; - msg_Dbg( vd, "Win32VoutCloseWindow" ); + msg_Dbg( p_event->obj, "Win32VoutCloseWindow" ); #if defined(MODULE_NAME_IS_direct3d9) || defined(MODULE_NAME_IS_direct3d11) DestroyWindow( p_event->hvideownd ); @@ -909,12 +906,11 @@ static long FAR PASCAL WinVoutEventProc( HWND hwnd, UINT message, return DefWindowProc(hwnd, message, wParam, lParam); } } - vout_display_t *vd = p_event->vd; #if 0 if( message == WM_SETCURSOR ) { - msg_Err(vd, "WM_SETCURSOR: %d (t2)", p_event->is_cursor_hidden); + msg_Err(p_event->obj, "WM_SETCURSOR: %d (t2)", p_event->is_cursor_hidden); SetCursor( p_event->is_cursor_hidden ? p_event->cursor_empty : p_event->cursor_arrow ); return 1; } @@ -968,7 +964,7 @@ static long FAR PASCAL WinVoutEventProc( HWND hwnd, UINT message, /* the window has been closed so shut down everything now */ case WM_DESTROY: - msg_Dbg( vd, "WinProc WM_DESTROY" ); + msg_Dbg( p_event->obj, "WinProc WM_DESTROY" ); /* just destroy the window */ PostQuitMessage( 0 ); return 0; @@ -978,7 +974,7 @@ static long FAR PASCAL WinVoutEventProc( HWND hwnd, UINT message, { case IDM_TOGGLE_ON_TOP: /* toggle the "on top" status */ { - msg_Dbg(vd, "WinProc WM_SYSCOMMAND: IDM_TOGGLE_ON_TOP"); + msg_Dbg(p_event->obj, "WinProc WM_SYSCOMMAND: IDM_TOGGLE_ON_TOP"); HMENU hMenu = GetSystemMenu(p_event->hwnd, FALSE); const bool is_on_top = (GetMenuState(hMenu, IDM_TOGGLE_ON_TOP, MF_BYCOMMAND) & MF_CHECKED) == 0; #ifdef MODULE_NAME_IS_direct3d9 @@ -1009,7 +1005,7 @@ static long FAR PASCAL WinVoutEventProc( HWND hwnd, UINT message, return 0; case WM_GESTURE: - return DecodeGesture( VLC_OBJECT(vd), p_event->p_gesture, hwnd, message, wParam, lParam ); + return DecodeGesture( p_event->obj, p_event->p_gesture, hwnd, message, wParam, lParam ); default: break; diff --git a/modules/video_output/win32/events.h b/modules/video_output/win32/events.h index 15cdb05897..6a9716036c 100644 --- a/modules/video_output/win32/events.h +++ b/modules/video_output/win32/events.h @@ -46,7 +46,7 @@ typedef struct { HWND hfswnd; } event_hwnd_t; -event_thread_t *EventThreadCreate( vout_display_t *, vout_window_t *); +event_thread_t *EventThreadCreate( vlc_object_t *, vout_window_t *); void EventThreadDestroy( event_thread_t * ); int EventThreadStart( event_thread_t *, event_hwnd_t *, const event_cfg_t * ); void EventThreadStop( event_thread_t * ); diff --git a/modules/video_output/win32/glwin32.c b/modules/video_output/win32/glwin32.c index a1a9516839..2a3252134e 100644 --- a/modules/video_output/win32/glwin32.c +++ b/modules/video_output/win32/glwin32.c @@ -123,7 +123,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg, /* */ InitArea(vd, &sys->area, cfg); - if (CommonInit(vd, &sys->area, &sys->sys)) + if (CommonInit(VLC_OBJECT(vd), vd, &sys->area, &sys->sys)) goto error; if (vd->source.projection_mode != PROJECTION_MODE_RECTANGULAR) diff --git a/modules/video_output/win32/wingdi.c b/modules/video_output/win32/wingdi.c index c2fad2a092..e7da115fe4 100644 --- a/modules/video_output/win32/wingdi.c +++ b/modules/video_output/win32/wingdi.c @@ -118,7 +118,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg, return VLC_ENOMEM; InitArea(vd, &sys->area, cfg); - if (CommonInit(vd, &sys->area, &sys->sys)) + if (CommonInit(VLC_OBJECT(vd), vd, &sys->area, &sys->sys)) goto error; /* */ _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
