# include "config.h"
#endif
-#include <vlc/vlc.h>
+#include <vlc_common.h>
+#include <vlc_plugin.h>
#include <vlc_interface.h>
#include <vlc_playlist.h>
#include <vlc_vout.h>
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 *,
"background. Note that this feature only works in overlay mode and " \
"the desktop must not already have a wallpaper." )
-static char *ppsz_dev[] = { "" };
-static char *ppsz_dev_text[] = { N_("Default") };
+static const char *const ppsz_dev[] = { "" };
+static const char *const ppsz_dev_text[] = { N_("Default") };
vlc_module_begin();
set_shortname( "DirectX" );
set_category( CAT_VIDEO );
set_subcategory( SUBCAT_VIDEO_VOUT );
add_bool( "directx-hw-yuv", 1, NULL, HW_YUV_TEXT, HW_YUV_LONGTEXT,
- VLC_TRUE );
+ true );
add_bool( "directx-use-sysmem", 0, NULL, SYSMEM_TEXT, SYSMEM_LONGTEXT,
- VLC_TRUE );
+ true );
add_bool( "directx-3buffering", 1, NULL, TRIPLEBUF_TEXT,
- TRIPLEBUF_LONGTEXT, VLC_TRUE );
+ TRIPLEBUF_LONGTEXT, true );
add_string( "directx-device", "", NULL, DEVICE_TEXT, DEVICE_LONGTEXT,
- VLC_TRUE );
+ 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 );
+ true );
- set_description( _("DirectX video output") );
+ set_description( N_("DirectX video output") );
set_capability( "video output", 100 );
add_shortcut( "directx" );
set_callbacks( OpenVideo, CloseVideo );
/* 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 */
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 );
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;
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_release( p_vout->p_sys->p_event );
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
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 ) {
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
* 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;
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 */
- if( p_vout->p_sys->p_event->b_die )
+ if( !vlc_object_alive (p_vout->p_sys->p_event) )
{
return VLC_EGENERIC; /* exit */
}
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;
}
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') )
{
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
{
if( p_vout->output.i_chroma == pi_codes[i] )
{
- b_result = VLC_TRUE;
+ b_result = true;
break;
}
}
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 )
{
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];
}
else
{
- vlc_bool_t bHasOverlay, bHasOverlayFourCC, bCanDeinterlace,
+ bool bHasOverlay, bHasOverlayFourCC, bCanDeinterlace,
bHasColorKey, bCanStretch, bCanBltFourcc,
bAlignBoundarySrc, bAlignBoundaryDest,
bAlignSizeSrc, bAlignSizeDest;
/*****************************************************************************
* 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;
FreeLibrary( hddraw_dll );
/* Signal change to the interface */
- p_item->b_dirty = VLC_TRUE;
+ p_item->b_dirty = true;
return VLC_SUCCESS;
}
if( (newval.b_bool && !p_vout->p_sys->b_wallpaper) ||
(!newval.b_bool && p_vout->p_sys->b_wallpaper) )
{
- playlist_t *p_playlist;
+ playlist_t *p_playlist = pl_Yield( p_vout );
- p_playlist =
- (playlist_t *)vlc_object_find( p_this, VLC_OBJECT_PLAYLIST,
- FIND_PARENT );
if( p_playlist )
{
/* Modify playlist as well because the vout might have to be
* restarted */
var_Create( p_playlist, "directx-wallpaper", VLC_VAR_BOOL );
var_Set( p_playlist, "directx-wallpaper", newval );
-
- vlc_object_release( p_playlist );
+ pl_Release( p_vout );
}
p_vout->p_sys->i_changes |= DX_WALLPAPER_CHANGE;