Commit d55f5d62 authored by Gildas Bazin's avatar Gildas Bazin

* modified the directx video plugin to try to create an YUV surface before
   falling back to an RGB surface when it's not possible to use overlays.
   Some graphic cards can do the YUV->RGB conversion in hardware during the
   blitting stage.
* in the directx video plugin, we now request that the RGB surface be created
   in video memory. The reasoning behind this is that usually surfaces in
   video memory benefit from more hardware acceleration (like for instance
   hw rescaling, hw blitting, etc...)
* added two options to the directx video plugin to disable the above features.
   (mainly because my video driver is buggy and doesn't handle them well).

* small cosmetic changes to the generation of the config file.

* fix for config_GetHomeDir() on win32. SHGetFolderPath() is located in
   shfolder.dll not shell32.dll.
* fix for the gtk preferences dialog box. To be sure that an int or float value
   is actually changed we call gtk_spin_button_update() in the
   GtkInt/FloatChanged() event handler.
parent 74a2caa2
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* directx.c : Windows DirectX plugin for vlc * directx.c : Windows DirectX plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: directx.c,v 1.7 2002/04/19 13:56:10 sam Exp $ * $Id: directx.c,v 1.8 2002/05/18 13:30:28 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -43,7 +43,22 @@ void _M( vout_getfunctions )( function_list_t * p_function_list ); ...@@ -43,7 +43,22 @@ void _M( vout_getfunctions )( function_list_t * p_function_list );
/***************************************************************************** /*****************************************************************************
* Building configuration tree * Building configuration tree
*****************************************************************************/ *****************************************************************************/
#define HW_YUV_TEXT N_("Disable hardware YUV->RGB conversions")
#define HW_YUV_LONGTEXT N_( \
"Don't try to use hardware acceleration for YUV->RGB conversions. This " \
"option doesn't have any effect when using overlays." )
#define SYSMEM_TEXT N_("Use video buffers in system memory")
#define SYSMEM_LONGTEXT N_( \
"Create video buffers in system memory instead of video memory. This " \
"isn't recommended as usually using video memory allows to benefit from " \
"more hardware acceleration (like rescaling or YUV->RGB conversions). " \
"This option doesn't have any effect when using overlays." )
MODULE_CONFIG_START MODULE_CONFIG_START
ADD_CATEGORY_HINT( N_("Video"), NULL )
ADD_BOOL ( "no-directx-hw-yuv", NULL, HW_YUV_TEXT, HW_YUV_LONGTEXT )
ADD_BOOL ( "directx-use-sysmem", NULL, SYSMEM_TEXT, SYSMEM_LONGTEXT )
ADD_CATEGORY_HINT( N_("Audio"), NULL )
MODULE_CONFIG_STOP MODULE_CONFIG_STOP
MODULE_INIT_START MODULE_INIT_START
......
This diff is collapsed.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vout_directx.h: Windows DirectX video output header file * vout_directx.h: Windows DirectX video output header file
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: vout_directx.h,v 1.5 2002/04/23 22:07:05 gbazin Exp $ * $Id: vout_directx.h,v 1.6 2002/05/18 13:30:28 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -39,6 +39,8 @@ typedef struct vout_sys_s ...@@ -39,6 +39,8 @@ typedef struct vout_sys_s
HWND hwnd; /* Handle of the main window */ HWND hwnd; /* Handle of the main window */
boolean_t b_using_overlay; /* Are we using an overlay surface */ boolean_t b_using_overlay; /* Are we using an overlay surface */
boolean_t b_use_sysmem; /* Should we use system memory for surfaces */
boolean_t b_hw_yuv; /* Should we use hardware YUV->RGB conversions */
/* size of the display */ /* size of the display */
RECT rect_display; RECT rect_display;
...@@ -73,7 +75,7 @@ typedef struct vout_sys_s ...@@ -73,7 +75,7 @@ typedef struct vout_sys_s
vlc_cond_t event_thread_wait; vlc_cond_t event_thread_wait;
volatile int i_event_thread_status; /* DirectXEventThread status */ volatile int i_event_thread_status; /* DirectXEventThread status */
boolean_t b_event_thread_die; /* flag to kill the event thread */ volatile boolean_t b_event_thread_die; /* flag to kill the event thread */
} vout_sys_t; } vout_sys_t;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vout_events.c: Windows DirectX video output events handler * vout_events.c: Windows DirectX video output events handler
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: vout_events.c,v 1.15 2002/04/24 23:49:32 gbazin Exp $ * $Id: vout_events.c,v 1.16 2002/05/18 13:30:28 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -142,7 +142,7 @@ void DirectXEventThread( vout_thread_t *p_vout ) ...@@ -142,7 +142,7 @@ void DirectXEventThread( vout_thread_t *p_vout )
case VK_ESCAPE: case VK_ESCAPE:
case VK_F12: case VK_F12:
/* exit application */ /* exit application */
p_main->p_intf->b_die = 1; p_main->p_intf->b_die = p_vout->p_sys->b_event_thread_die = 1;
break; break;
} }
TranslateMessage(&msg); TranslateMessage(&msg);
...@@ -154,7 +154,7 @@ void DirectXEventThread( vout_thread_t *p_vout ) ...@@ -154,7 +154,7 @@ void DirectXEventThread( vout_thread_t *p_vout )
case 'q': case 'q':
case 'Q': case 'Q':
/* exit application */ /* exit application */
p_main->p_intf->b_die = 1; p_main->p_intf->b_die = p_vout->p_sys->b_event_thread_die = 1;
break; break;
case 'f': /* switch to fullscreen */ case 'f': /* switch to fullscreen */
...@@ -512,6 +512,8 @@ static long FAR PASCAL DirectXEventProc( HWND hwnd, UINT message, ...@@ -512,6 +512,8 @@ static long FAR PASCAL DirectXEventProc( HWND hwnd, UINT message,
DirectXUpdateOverlay( p_vout ); DirectXUpdateOverlay( p_vout );
/* signal the size change */ /* signal the size change */
if( !p_vout->p_sys->b_using_overlay &&
!p_vout->p_sys->b_event_thread_die )
p_vout->p_sys->i_changes |= VOUT_SIZE_CHANGE; p_vout->p_sys->i_changes |= VOUT_SIZE_CHANGE;
return 0; return 0;
...@@ -522,7 +524,8 @@ static long FAR PASCAL DirectXEventProc( HWND hwnd, UINT message, ...@@ -522,7 +524,8 @@ static long FAR PASCAL DirectXEventProc( HWND hwnd, UINT message,
case WM_CLOSE: case WM_CLOSE:
intf_WarnMsg( 4, "vout: WinProc WM_CLOSE" ); intf_WarnMsg( 4, "vout: WinProc WM_CLOSE" );
/* exit application */ /* exit application */
p_main->p_intf->b_die = 1; p_vout = (vout_thread_t *)GetWindowLong( hwnd, GWL_USERDATA );
p_main->p_intf->b_die = p_vout->p_sys->b_event_thread_die = 1;
return 0; return 0;
break; break;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* gtk_preferences.c: functions to handle the preferences dialog box. * gtk_preferences.c: functions to handle the preferences dialog box.
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001 VideoLAN
* $Id: gtk_preferences.c,v 1.27 2002/05/04 16:17:08 gbazin Exp $ * $Id: gtk_preferences.c,v 1.28 2002/05/18 13:30:28 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* Loc Minier <lool@via.ecp.fr> * Loc Minier <lool@via.ecp.fr>
...@@ -733,6 +733,7 @@ static void GtkIntChanged( GtkEditable *editable, gpointer user_data ) ...@@ -733,6 +733,7 @@ static void GtkIntChanged( GtkEditable *editable, gpointer user_data )
p_config = malloc( sizeof(module_config_t) ); p_config = malloc( sizeof(module_config_t) );
p_config->i_type = MODULE_CONFIG_ITEM_INTEGER; p_config->i_type = MODULE_CONFIG_ITEM_INTEGER;
gtk_spin_button_update( GTK_SPIN_BUTTON(editable) );
p_config->i_value = gtk_spin_button_get_value_as_int( p_config->i_value = gtk_spin_button_get_value_as_int(
GTK_SPIN_BUTTON(editable) ); GTK_SPIN_BUTTON(editable) );
p_config->psz_name = (char *)gtk_object_get_data( GTK_OBJECT(editable), p_config->psz_name = (char *)gtk_object_get_data( GTK_OBJECT(editable),
...@@ -767,6 +768,7 @@ static void GtkFloatChanged( GtkEditable *editable, gpointer user_data ) ...@@ -767,6 +768,7 @@ static void GtkFloatChanged( GtkEditable *editable, gpointer user_data )
p_config = malloc( sizeof(module_config_t) ); p_config = malloc( sizeof(module_config_t) );
p_config->i_type = MODULE_CONFIG_ITEM_FLOAT; p_config->i_type = MODULE_CONFIG_ITEM_FLOAT;
gtk_spin_button_update( GTK_SPIN_BUTTON(editable) );
p_config->f_value = gtk_spin_button_get_value_as_float( p_config->f_value = gtk_spin_button_get_value_as_float(
GTK_SPIN_BUTTON(editable) ); GTK_SPIN_BUTTON(editable) );
p_config->psz_name = (char *)gtk_object_get_data( GTK_OBJECT(editable), p_config->psz_name = (char *)gtk_object_get_data( GTK_OBJECT(editable),
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* configuration.c management of the modules configuration * configuration.c management of the modules configuration
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: configuration.c,v 1.23 2002/05/15 01:29:07 sam Exp $ * $Id: configuration.c,v 1.24 2002/05/18 13:30:28 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -411,8 +411,8 @@ int config_LoadConfigFile( const char *psz_module_name ) ...@@ -411,8 +411,8 @@ int config_LoadConfigFile( const char *psz_module_name )
file = fopen( psz_filename, "rt" ); file = fopen( psz_filename, "rt" );
if( !file ) if( !file )
{ {
intf_WarnMsg( 1, "config: couldn't open config file %s for reading (%s)", intf_WarnMsg( 1, "config: config file %s doesn't already exist",
psz_filename, strerror(errno) ); psz_filename );
free( psz_filename ); free( psz_filename );
vlc_mutex_unlock( &p_main->config_lock ); vlc_mutex_unlock( &p_main->config_lock );
return -1; return -1;
...@@ -450,7 +450,8 @@ int config_LoadConfigFile( const char *psz_module_name ) ...@@ -450,7 +450,8 @@ int config_LoadConfigFile( const char *psz_module_name )
if( line[0] == '[' ) break; /* end of section */ if( line[0] == '[' ) break; /* end of section */
/* ignore comments or empty lines */ /* ignore comments or empty lines */
if( (line[0] == '#') || (line[0] == (char)0) ) continue; if( (line[0] == '#') || (line[0] == '\n') || (line[0] == (char)0) )
continue;
/* get rid of line feed */ /* get rid of line feed */
if( line[strlen(line)-1] == '\n' ) if( line[strlen(line)-1] == '\n' )
...@@ -599,8 +600,8 @@ int config_SaveConfigFile( const char *psz_module_name ) ...@@ -599,8 +600,8 @@ int config_SaveConfigFile( const char *psz_module_name )
file = fopen( psz_filename, "rt" ); file = fopen( psz_filename, "rt" );
if( !file ) if( !file )
{ {
intf_WarnMsg( 1, "config: couldn't open config file %s for reading (%s)", intf_WarnMsg( 1, "config: config file %s doesn't already exist",
psz_filename, strerror(errno) ); psz_filename );
} }
else else
{ {
...@@ -702,10 +703,11 @@ int config_SaveConfigFile( const char *psz_module_name ) ...@@ -702,10 +703,11 @@ int config_SaveConfigFile( const char *psz_module_name )
intf_WarnMsg( 5, "config: saving config for module <%s>", intf_WarnMsg( 5, "config: saving config for module <%s>",
p_module->psz_name ); p_module->psz_name );
fprintf( file, "[%s]\n", p_module->psz_name ); fprintf( file, "[%s]", p_module->psz_name );
if( p_module->psz_longname ) if( p_module->psz_longname )
fprintf( file, "###\n### %s\n###\n", p_module->psz_longname ); fprintf( file, " # %s\n\n", p_module->psz_longname );
else
fprintf( file, "\n\n" );
for( p_item = p_module->p_config; for( p_item = p_module->p_config;
p_item->i_type != MODULE_CONFIG_HINT_END; p_item->i_type != MODULE_CONFIG_HINT_END;
...@@ -1022,13 +1024,13 @@ char *config_GetHomeDir( void ) ...@@ -1022,13 +1024,13 @@ char *config_GetHomeDir( void )
# define CSIDL_APPDATA 0x1A # define CSIDL_APPDATA 0x1A
# define SHGFP_TYPE_CURRENT 0 # define SHGFP_TYPE_CURRENT 0
HINSTANCE shell32_dll; HINSTANCE shfolder_dll;
SHGETFOLDERPATH SHGetFolderPath ; SHGETFOLDERPATH SHGetFolderPath ;
/* load the shell32 dll to retreive SHGetFolderPath */ /* load the shell32 dll to retreive SHGetFolderPath */
if( ( shell32_dll = LoadLibrary("shell32.dll") ) != NULL ) if( ( shfolder_dll = LoadLibrary("shfolder.dll") ) != NULL )
{ {
SHGetFolderPath = (void *)GetProcAddress( shell32_dll, SHGetFolderPath = (void *)GetProcAddress( shfolder_dll,
"SHGetFolderPathA" ); "SHGetFolderPathA" );
if ( SHGetFolderPath != NULL ) if ( SHGetFolderPath != NULL )
{ {
...@@ -1045,12 +1047,12 @@ char *config_GetHomeDir( void ) ...@@ -1045,12 +1047,12 @@ char *config_GetHomeDir( void )
NULL, SHGFP_TYPE_CURRENT, NULL, SHGFP_TYPE_CURRENT,
p_homedir ) ) p_homedir ) )
{ {
FreeLibrary( shell32_dll ); FreeLibrary( shfolder_dll );
return p_homedir; return p_homedir;
} }
free( p_homedir ); free( p_homedir );
} }
FreeLibrary( shell32_dll ); FreeLibrary( shfolder_dll );
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment