X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fvideo_output%2Fmsw%2Fdirectx.c;h=ec72dcd1342780750fd95a38feb32b32aff47530;hb=7eaca895c90b3f14ab208373d0213d0579515e70;hp=240a8ff6afb0cf08e66f89c68f2e101552baae29;hpb=806cf5165824be921bf2402ecf11fd3ee6501f9c;p=vlc diff --git a/modules/video_output/msw/directx.c b/modules/video_output/msw/directx.c index 240a8ff6af..ec72dcd134 100644 --- a/modules/video_output/msw/directx.c +++ b/modules/video_output/msw/directx.c @@ -36,7 +36,12 @@ *****************************************************************************/ #include /* ENOMEM */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include +#include #include #include #include @@ -112,7 +117,7 @@ static int DirectXUnlockSurface ( vout_thread_t *p_vout, picture_t *p_pic ); static DWORD DirectXFindColorkey( vout_thread_t *p_vout, uint32_t *i_color ); -void SwitchWallpaperMode( vout_thread_t *, vlc_bool_t ); +void SwitchWallpaperMode( vout_thread_t *, bool ); /* Object variables callbacks */ static int FindDevicesCallback( vlc_object_t *, char const *, @@ -160,26 +165,21 @@ vlc_module_begin(); set_category( CAT_VIDEO ); set_subcategory( SUBCAT_VIDEO_VOUT ); add_bool( "directx-hw-yuv", 1, NULL, HW_YUV_TEXT, HW_YUV_LONGTEXT, - VLC_TRUE ); - change_safe(); + true ); add_bool( "directx-use-sysmem", 0, NULL, SYSMEM_TEXT, SYSMEM_LONGTEXT, - VLC_TRUE ); - change_safe(); + true ); add_bool( "directx-3buffering", 1, NULL, TRIPLEBUF_TEXT, - TRIPLEBUF_LONGTEXT, VLC_TRUE ); - change_safe(); + TRIPLEBUF_LONGTEXT, true ); add_string( "directx-device", "", NULL, DEVICE_TEXT, DEVICE_LONGTEXT, - VLC_TRUE ); - change_safe(); + true ); change_string_list( ppsz_dev, ppsz_dev_text, FindDevicesCallback ); change_action_add( FindDevicesCallback, N_("Refresh list") ); add_bool( "directx-wallpaper", 0, NULL, WALLPAPER_TEXT, WALLPAPER_LONGTEXT, - VLC_TRUE ); - change_safe(); + true ); - set_description( _("DirectX video output") ); + set_description( N_("DirectX video output") ); set_capability( "video output", 100 ); add_shortcut( "directx" ); set_callbacks( OpenVideo, CloseVideo ); @@ -210,10 +210,7 @@ static int OpenVideo( vlc_object_t *p_this ) /* Allocate structure */ p_vout->p_sys = malloc( sizeof( vout_sys_t ) ); if( p_vout->p_sys == NULL ) - { - msg_Err( p_vout, "out of memory" ); return VLC_ENOMEM; - } memset( p_vout->p_sys, 0, sizeof( vout_sys_t ) ); /* Initialisations */ @@ -231,7 +228,7 @@ static int OpenVideo( vlc_object_t *p_this ) p_vout->p_sys->hparent = p_vout->p_sys->hfswnd = NULL; p_vout->p_sys->i_changes = 0; p_vout->p_sys->b_wallpaper = 0; - vlc_mutex_init( p_vout, &p_vout->p_sys->lock ); + vlc_mutex_init( &p_vout->p_sys->lock ); SetRectEmpty( &p_vout->p_sys->rect_display ); SetRectEmpty( &p_vout->p_sys->rect_parent ); @@ -262,6 +259,8 @@ static int OpenVideo( vlc_object_t *p_this ) p_vout->p_sys->b_cursor_hidden = 0; p_vout->p_sys->i_lastmoved = mdate(); + p_vout->p_sys->i_mouse_hide_timeout = + var_GetInteger(p_vout, "mouse-hide-timeout") * 1000; /* Set main window's size */ p_vout->p_sys->i_window_width = p_vout->i_window_width; @@ -279,10 +278,10 @@ static int OpenVideo( vlc_object_t *p_this ) vlc_object_create( p_vout, sizeof(event_thread_t) ); p_vout->p_sys->p_event->p_vout = p_vout; if( vlc_thread_create( p_vout->p_sys->p_event, "Vout Events Thread", - E_(EventThread), 0, 1 ) ) + EventThread, 0, 1 ) ) { msg_Err( p_vout, "cannot create Vout EventThread" ); - vlc_object_destroy( p_vout->p_sys->p_event ); + vlc_object_release( p_vout->p_sys->p_event ); p_vout->p_sys->p_event = NULL; goto error; } @@ -402,7 +401,7 @@ static int Init( vout_thread_t *p_vout ) p_vout->output.i_height = p_vout->render.i_height; p_vout->output.i_aspect = p_vout->render.i_aspect; p_vout->fmt_out = p_vout->fmt_in; - E_(UpdateRects)( p_vout, VLC_TRUE ); + UpdateRects( p_vout, true ); #define MAX_DIRECTBUFFERS 1 /* Right now we use only 1 directbuffer because we don't want the @@ -506,13 +505,13 @@ static void CloseVideo( vlc_object_t *p_this ) } vlc_thread_join( p_vout->p_sys->p_event ); - vlc_object_destroy( p_vout->p_sys->p_event ); + vlc_object_release( p_vout->p_sys->p_event ); } vlc_mutex_destroy( &p_vout->p_sys->lock ); /* Make sure the wallpaper is restored */ - SwitchWallpaperMode( p_vout, VLC_FALSE ); + SwitchWallpaperMode( p_vout, false ); /* restore screensaver system settings */ if( 0 != p_vout->p_sys->i_spi_lowpowertimeout ) { @@ -528,11 +527,8 @@ static void CloseVideo( vlc_object_t *p_this ) p_vout->p_sys->i_spi_screensavetimeout, NULL, 0); } - if( p_vout->p_sys ) - { - free( p_vout->p_sys ); - p_vout->p_sys = NULL; - } + free( p_vout->p_sys ); + p_vout->p_sys = NULL; } /***************************************************************************** @@ -611,7 +607,7 @@ static int Manage( vout_thread_t *p_vout ) p_vout->fmt_out.i_sar_num = p_vout->fmt_in.i_sar_num; p_vout->fmt_out.i_sar_den = p_vout->fmt_in.i_sar_den; p_vout->output.i_aspect = p_vout->fmt_in.i_aspect; - E_(UpdateRects)( p_vout, VLC_TRUE ); + UpdateRects( p_vout, true ); } /* We used to call the Win32 PeekMessage function here to read the window @@ -642,7 +638,8 @@ static int Manage( vout_thread_t *p_vout ) * Pointer change */ if( p_vout->b_fullscreen && !p_vout->p_sys->b_cursor_hidden && - (mdate() - p_vout->p_sys->i_lastmoved) > 5000000 ) + (mdate() - p_vout->p_sys->i_lastmoved) > + p_vout->p_sys->i_mouse_hide_timeout ) { POINT point; HWND hwnd; @@ -690,7 +687,7 @@ static int Manage( vout_thread_t *p_vout ) SWP_NOSIZE | SWP_NOMOVE ); } - p_vout->p_sys->b_on_top_change = VLC_FALSE; + p_vout->p_sys->b_on_top_change = false; } /* Check if the event thread is still running */ @@ -838,7 +835,7 @@ BOOL WINAPI DirectXEnumCallback( GUID* p_guid, LPTSTR psz_desc, if( ( !device.psz_string || !*device.psz_string ) && hmon == p_vout->p_sys->hmonitor ) { - if( device.psz_string ) free( device.psz_string ); + free( device.psz_string ); } else if( strcmp( psz_drivername, device.psz_string ) == 0 ) { @@ -864,11 +861,11 @@ BOOL WINAPI DirectXEnumCallback( GUID* p_guid, LPTSTR psz_desc, } p_vout->p_sys->hmonitor = hmon; - if( device.psz_string ) free( device.psz_string ); + free( device.psz_string ); } else { - if( device.psz_string ) free( device.psz_string ); + free( device.psz_string ); return TRUE; /* Keep enumerating */ } @@ -1059,7 +1056,7 @@ static int DirectXCreateDisplay( vout_thread_t *p_vout ) p_vout->p_sys->i_rgb_colorkey = DirectXFindColorkey( p_vout, &p_vout->p_sys->i_colorkey ); - E_(UpdateRects)( p_vout, VLC_TRUE ); + UpdateRects( p_vout, true ); return VLC_SUCCESS; } @@ -1173,7 +1170,7 @@ static int DirectXCreateSurface( vout_thread_t *p_vout, if( !b_overlay ) { - vlc_bool_t b_rgb_surface = + bool b_rgb_surface = ( i_chroma == VLC_FOURCC('R','G','B','2') ) || ( i_chroma == VLC_FOURCC('R','V','1','5') ) || ( i_chroma == VLC_FOURCC('R','V','1','6') ) @@ -1329,11 +1326,8 @@ static void DirectXCloseDDraw( vout_thread_t *p_vout ) p_vout->p_sys->hddraw_dll = NULL; } - if( p_vout->p_sys->p_display_driver != NULL ) - { - free( p_vout->p_sys->p_display_driver ); - p_vout->p_sys->p_display_driver = NULL; - } + free( p_vout->p_sys->p_display_driver ); + p_vout->p_sys->p_display_driver = NULL; p_vout->p_sys->hmonitor = NULL; } @@ -1486,7 +1480,7 @@ static int NewPictureVec( vout_thread_t *p_vout, picture_t *p_pic, { DWORD i_codes; DWORD *pi_codes; - vlc_bool_t b_result = VLC_FALSE; + bool b_result = false; /* Check if the chroma is supported first. This is required * because a few buggy drivers don't mind creating the surface @@ -1502,7 +1496,7 @@ static int NewPictureVec( vout_thread_t *p_vout, picture_t *p_pic, { if( p_vout->output.i_chroma == pi_codes[i] ) { - b_result = VLC_TRUE; + b_result = true; break; } } @@ -1515,7 +1509,7 @@ static int NewPictureVec( vout_thread_t *p_vout, picture_t *p_pic, 0 /* no overlay */, 0 /* no back buffers */ ); else - p_vout->p_sys->b_hw_yuv = VLC_FALSE; + p_vout->p_sys->b_hw_yuv = false; } if( i_ret || !p_vout->p_sys->b_hw_yuv ) @@ -1602,7 +1596,7 @@ static int NewPictureVec( vout_thread_t *p_vout, picture_t *p_pic, { p_pic[i].i_status = DESTROYED_PICTURE; p_pic[i].i_type = DIRECT_PICTURE; - p_pic[i].b_slow = VLC_TRUE; + p_pic[i].b_slow = true; p_pic[i].pf_lock = DirectXLockSurface; p_pic[i].pf_unlock = DirectXUnlockSurface; PP_OUTPUTPICTURE[i] = &p_pic[i]; @@ -1806,7 +1800,7 @@ static void DirectXGetDDrawCaps( vout_thread_t *p_vout ) } else { - vlc_bool_t bHasOverlay, bHasOverlayFourCC, bCanDeinterlace, + bool bHasOverlay, bHasOverlayFourCC, bCanDeinterlace, bHasColorKey, bCanStretch, bCanBltFourcc, bAlignBoundarySrc, bAlignBoundaryDest, bAlignSizeSrc, bAlignSizeDest; @@ -2002,7 +1996,7 @@ static DWORD DirectXFindColorkey( vout_thread_t *p_vout, uint32_t *pi_color ) /***************************************************************************** * A few toolbox functions *****************************************************************************/ -void SwitchWallpaperMode( vout_thread_t *p_vout, vlc_bool_t b_on ) +void SwitchWallpaperMode( vout_thread_t *p_vout, bool b_on ) { HWND hwnd; @@ -2115,7 +2109,7 @@ static int FindDevicesCallback( vlc_object_t *p_this, char const *psz_name, FreeLibrary( hddraw_dll ); /* Signal change to the interface */ - p_item->b_dirty = VLC_TRUE; + p_item->b_dirty = true; return VLC_SUCCESS; }