Commit e1aabc8f authored by Gildas Bazin's avatar Gildas Bazin

* src/misc/configuration.c, include/configuration.h, src/audio_output/intf.c, include/audio_output.h, modules/gui/gtk/display.[ch]: configuration variables now use vlc_callback_t callbacks (same as the object variables).
* modules/video_output/x11/*: support for the _NET_WM_STATE_FULLSCREEN hint from the Extended Window Manager Hints spec.
* modules/audio_output/alsa.c: support for 4.0 and 5.1 audio channels. This time it has been tested ;)
parent 5a4904ce
......@@ -2,7 +2,7 @@
* audio_output.h : audio output interface
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: audio_output.h,v 1.80 2003/05/04 22:42:14 gbazin Exp $
* $Id: audio_output.h,v 1.81 2003/08/03 23:11:21 gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -204,6 +204,6 @@ VLC_EXPORT( int, __aout_VolumeDown, ( vlc_object_t *, int, audio_volume_t * ) );
#define aout_VolumeMute(a, b) __aout_VolumeMute(VLC_OBJECT(a), b)
VLC_EXPORT( int, __aout_VolumeMute, ( vlc_object_t *, audio_volume_t * ) );
VLC_EXPORT( int, aout_Restart, ( aout_instance_t * p_aout ) );
VLC_EXPORT( void, aout_FindAndRestart, ( vlc_object_t * p_this ) );
VLC_EXPORT( int, aout_FindAndRestart, ( vlc_object_t *, const char *, vlc_value_t, vlc_value_t, void * ) );
VLC_EXPORT( int, aout_ChannelsRestart, ( vlc_object_t *, const char *, vlc_value_t, vlc_value_t, void * ) );
......@@ -4,7 +4,7 @@
* It includes functions allowing to declare, get or set configuration options.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: configuration.h,v 1.28 2003/07/23 01:13:47 gbazin Exp $
* $Id: configuration.h,v 1.29 2003/08/03 23:11:21 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -64,7 +64,8 @@ struct module_config_t
float f_max; /* Option maximum value */
/* Function to call when commiting a change */
void ( * pf_callback ) ( vlc_object_t * );
vlc_callback_t pf_callback;
void *p_callback_data;
char **ppsz_list; /* List of possible values for the option */
......
......@@ -2,7 +2,7 @@
* alsa.c : alsa plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: alsa.c,v 1.33 2003/07/27 16:20:53 gbazin Exp $
* $Id: alsa.c,v 1.34 2003/08/03 23:11:21 gbazin Exp $
*
* Authors: Henri Fallon <henri@videolan.org> - Original Author
* Jeffrey Baker <jwbaker@acm.org> - Port to ALSA 1.0 API
......@@ -72,7 +72,7 @@ struct aout_sys_t
number of channel(s) (eg. 2 for stereo) and the size of a sample (eg.
2 for s16). */
#define ALSA_DEFAULT_PERIOD_SIZE 1024
#define ALSA_DEFAULT_BUFFER_SIZE ( ALSA_DEFAULT_PERIOD_SIZE << 4 )
#define ALSA_DEFAULT_BUFFER_SIZE ( ALSA_DEFAULT_PERIOD_SIZE << 8 )
#define ALSA_SPDIF_PERIOD_SIZE A52_FRAME_NB
#define ALSA_SPDIF_BUFFER_SIZE ( ALSA_SPDIF_PERIOD_SIZE << 4 )
/* Why << 4 ? --Meuuh */
......@@ -107,7 +107,7 @@ vlc_module_end();
*****************************************************************************/
static void Probe( aout_instance_t * p_aout,
const char * psz_device, const char * psz_iec_device,
int i_snd_pcm_format )
int *pi_snd_pcm_format )
{
struct aout_sys_t * p_sys = p_aout->output.p_sys;
vlc_value_t val, text;
......@@ -140,29 +140,27 @@ static void Probe( aout_instance_t * p_aout,
}
if ( snd_pcm_hw_params_set_format( p_sys->p_snd_pcm, p_hw,
i_snd_pcm_format ) < 0 )
*pi_snd_pcm_format ) < 0 )
{
/* Assume a FPU enabled computer can handle float32 format.
If somebody tells us it's not always true then we'll have
to change this */
msg_Warn( p_aout, "unable to set stream sample size and word order"
", disabling linear PCM audio" );
if( *pi_snd_pcm_format != SND_PCM_FORMAT_S16 )
{
*pi_snd_pcm_format = SND_PCM_FORMAT_S16;
if ( snd_pcm_hw_params_set_format( p_sys->p_snd_pcm, p_hw,
*pi_snd_pcm_format ) < 0 )
{
msg_Warn( p_aout, "unable to set stream sample size and "
"word order, disabling linear PCM audio" );
snd_pcm_close( p_sys->p_snd_pcm );
var_Destroy( p_aout, "audio-device" );
return;
}
}
}
i_channels = aout_FormatNbChannels( &p_aout->output.output );
while ( i_channels > 0 )
{
/* Here we have to probe multi-channel capabilities but I have
no idea (at the moment) of how its managed by the ALSA
library.
It seems that '6' channels aren't well handled on a stereo
sound card like my i810 but it requires some more
investigations. That's why '4' and '6' cases are disabled.
-- Bozo */
if ( !snd_pcm_hw_params_test_channels( p_sys->p_snd_pcm, p_hw,
i_channels ) )
{
......@@ -339,7 +337,16 @@ static int Open( vlc_object_t *p_this )
and we have to probe the available audio formats and channels */
if ( var_Type( p_aout, "audio-device" ) == 0 )
{
Probe( p_aout, psz_device, psz_iec_device, i_snd_pcm_format );
Probe( p_aout, psz_device, psz_iec_device, &i_snd_pcm_format );
switch( i_snd_pcm_format )
{
case SND_PCM_FORMAT_FLOAT:
i_vlc_pcm_format = VLC_FOURCC('f','l','3','2');
break;
case SND_PCM_FORMAT_S16:
i_vlc_pcm_format = AOUT_FMT_S16_NE;
break;
}
}
if ( var_Get( p_aout, "audio-device", &val ) < 0 )
......@@ -360,6 +367,8 @@ static int Open( vlc_object_t *p_this )
= AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_CENTER
| AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT
| AOUT_CHAN_LFE;
free( psz_device );
psz_device = strdup( "surround51" );
}
else if ( val.i_int == AOUT_VAR_2F2R )
{
......@@ -367,6 +376,8 @@ static int Open( vlc_object_t *p_this )
p_aout->output.output.i_physical_channels
= AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT
| AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT;
free( psz_device );
psz_device = strdup( "surround40" );
}
else if ( val.i_int == AOUT_VAR_STEREO )
{
......@@ -416,6 +427,8 @@ static int Open( vlc_object_t *p_this )
}
else
{
msg_Dbg( p_aout, "opening ALSA device `%s'", psz_device );
if ( ( i_snd_rc = snd_pcm_open( &p_sys->p_snd_pcm, psz_device,
SND_PCM_STREAM_PLAYBACK, 0 ) ) < 0 )
{
......
......@@ -2,7 +2,7 @@
* display.c: Gtk+ tools for main interface
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: display.c,v 1.10 2003/05/05 16:09:39 gbazin Exp $
* $Id: display.c,v 1.11 2003/08/03 23:11:21 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Stphane Borel <stef@via.ecp.fr>
......@@ -215,7 +215,8 @@ gint E_(GtkModeManage)( intf_thread_t * p_intf )
* GtkHideTooltips: show or hide the tooltips depending on the configuration
* option gnome-tooltips
*****************************************************************************/
void E_(GtkHideTooltips)( vlc_object_t *p_this )
int E_(GtkHideTooltips)( vlc_object_t *p_this, const char *psz_name,
vlc_value_t oldval, vlc_value_t val, void *p_data )
{
intf_thread_t *p_intf;
int i_index;
......@@ -244,6 +245,7 @@ void E_(GtkHideTooltips)( vlc_object_t *p_this )
}
vlc_list_release( p_list );
return VLC_SUCCESS;
}
#ifdef MODULE_NAME_IS_gnome
......@@ -253,7 +255,8 @@ void E_(GtkHideTooltips)( vlc_object_t *p_this )
*****************************************************************************
* FIXME: GNOME only because of missing icons in gtk interface
*****************************************************************************/
void GtkHideToolbarText( vlc_object_t *p_this )
int GtkHideToolbarText( vlc_object_t *p_this, const char *psz_name,
vlc_value_t oldval, vlc_value_t val, void *p_data )
{
GtkToolbarStyle style;
GtkToolbar * p_toolbar;
......@@ -281,5 +284,6 @@ void GtkHideToolbarText( vlc_object_t *p_this )
}
vlc_list_release( p_list );
return VLC_SUCCESS;
}
#endif
......@@ -2,7 +2,7 @@
* display.h: Gtk+ tools for main interface.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: display.h,v 1.2 2002/09/30 11:05:39 sam Exp $
* $Id: display.h,v 1.3 2003/08/03 23:11:21 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Stéphane Borel <stef@via.ecp.fr>
......@@ -28,6 +28,8 @@
gint E_(GtkModeManage) ( intf_thread_t * p_intf );
void E_(GtkDisplayDate) ( GtkAdjustment *p_adj );
void E_(GtkHideTooltips) ( vlc_object_t * );
void GtkHideToolbarText ( vlc_object_t * );
int E_(GtkHideTooltips) ( vlc_object_t *, const char *,
vlc_value_t, vlc_value_t, void * );
int GtkHideToolbarText ( vlc_object_t *, const char *,
vlc_value_t, vlc_value_t, void * );
......@@ -2,7 +2,7 @@
* xcommon.c: Functions common to the X11 and XVideo plugins
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: xcommon.c,v 1.27 2003/08/02 14:06:22 gbazin Exp $
* $Id: xcommon.c,v 1.28 2003/08/03 23:11:21 gbazin Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -117,6 +117,8 @@ static void SetPalette ( vout_thread_t *,
uint16_t *, uint16_t *, uint16_t * );
#endif
static void TestNetWMSupport( vout_thread_t * );
/*****************************************************************************
* Activate: allocate X11 video thread output method
*****************************************************************************
......@@ -269,6 +271,8 @@ int E_(Activate) ( vlc_object_t *p_this )
p_vout->p_sys->b_altfullscreen = 0;
p_vout->p_sys->i_time_button_last_pressed = 0;
TestNetWMSupport( p_vout );
return VLC_SUCCESS;
}
......@@ -1453,13 +1457,41 @@ static void ToggleFullScreen ( vout_thread_t *p_vout )
p_vout->p_sys->p_win->base_window,
CWOverrideRedirect,
&attributes);
/* Make sure the change is effective */
XReparentWindow( p_vout->p_sys->p_display,
p_vout->p_sys->p_win->base_window,
DefaultRootWindow( p_vout->p_sys->p_display ),
0, 0 );
}
if( p_vout->p_sys->b_net_wm_state_fullscreen )
{
XClientMessageEvent event;
memset( &event, 0, sizeof( XClientMessageEvent ) );
event.type = ClientMessage;
event.message_type = p_vout->p_sys->net_wm_state;
event.display = p_vout->p_sys->p_display;
event.window = p_vout->p_sys->p_win->base_window;
event.format = 32;
event.data.l[ 0 ] = 1; /* set property */
event.data.l[ 1 ] = p_vout->p_sys->net_wm_state_fullscreen;
XSendEvent( p_vout->p_sys->p_display,
DefaultRootWindow( p_vout->p_sys->p_display ),
False, SubstructureRedirectMask,
(XEvent*)&event );
}
else
{
/* Make sure the change is effective */
XReparentWindow( p_vout->p_sys->p_display,
p_vout->p_sys->p_win->base_window,
DefaultRootWindow( p_vout->p_sys->p_display ),
0, 0 );
}
/* fullscreen window size and position */
p_vout->p_sys->p_win->i_width =
......@@ -2197,3 +2229,74 @@ static void SetPalette( vout_thread_t *p_vout,
p_vout->p_sys->colormap, p_colors, 255 );
}
#endif
/*****************************************************************************
* TestNetWMSupport: tests for Extended Window Manager Hints support
*****************************************************************************/
static void TestNetWMSupport( vout_thread_t *p_vout )
{
int i_ret, i_format;
unsigned long i, i_items, i_bytesafter;
Atom net_wm_supported, *p_args = NULL;
p_vout->p_sys->b_net_wm_state_fullscreen = VLC_FALSE;
p_vout->p_sys->b_net_wm_state_above = VLC_FALSE;
p_vout->p_sys->b_net_wm_state_below = VLC_FALSE;
p_vout->p_sys->b_net_wm_state_stays_on_top = VLC_FALSE;
net_wm_supported =
XInternAtom( p_vout->p_sys->p_display, "_NET_SUPPORTED", False );
i_ret = XGetWindowProperty( p_vout->p_sys->p_display,
DefaultRootWindow( p_vout->p_sys->p_display ),
net_wm_supported,
0, 16384, False, AnyPropertyType,
&net_wm_supported,
&i_format, &i_items, &i_bytesafter,
(unsigned char **)&p_args );
if( i_ret != Success || i_items == 0 ) return;
msg_Dbg( p_vout, "Window manager supports NetWM" );
p_vout->p_sys->net_wm_state =
XInternAtom( p_vout->p_sys->p_display, "_NET_WM_STATE", False );
p_vout->p_sys->net_wm_state_fullscreen =
XInternAtom( p_vout->p_sys->p_display, "_NET_WM_STATE_FULLSCREEN",
False );
p_vout->p_sys->net_wm_state_above =
XInternAtom( p_vout->p_sys->p_display, "_NET_WM_STATE_ABOVE", False );
p_vout->p_sys->net_wm_state_below =
XInternAtom( p_vout->p_sys->p_display, "_NET_WM_STATE_BELOW", False );
p_vout->p_sys->net_wm_state_stays_on_top =
XInternAtom( p_vout->p_sys->p_display, "_NET_WM_STATE_STAYS_ON_TOP",
False );
for( i = 0; i < i_items; i++ )
{
if( p_args[i] == p_vout->p_sys->net_wm_state_fullscreen )
{
msg_Dbg( p_vout,
"Window manager supports _NET_WM_STATE_FULLSCREEN" );
p_vout->p_sys->b_net_wm_state_fullscreen = VLC_TRUE;
}
else if( p_args[i] == p_vout->p_sys->net_wm_state_above )
{
msg_Dbg( p_vout, "Window manager supports _NET_WM_STATE_ABOVE" );
p_vout->p_sys->b_net_wm_state_above = VLC_TRUE;
}
else if( p_args[i] == p_vout->p_sys->net_wm_state_below )
{
msg_Dbg( p_vout, "Window manager supports _NET_WM_STATE_BELOW" );
p_vout->p_sys->b_net_wm_state_below = VLC_TRUE;
}
else if( p_args[i] == p_vout->p_sys->net_wm_state_stays_on_top )
{
msg_Dbg( p_vout,
"Window manager supports _NET_WM_STATE_STAYS_ON_TOP" );
p_vout->p_sys->b_net_wm_state_stays_on_top = VLC_TRUE;
}
}
XFree( p_args );
}
......@@ -2,7 +2,7 @@
* xcommon.h: Defines common to the X11 and XVideo plugins
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: xcommon.h,v 1.7 2003/07/29 09:32:14 sam Exp $
* $Id: xcommon.h,v 1.8 2003/08/03 23:11:21 gbazin Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -128,6 +128,17 @@ struct vout_sys_t
Cursor blank_cursor; /* the hidden cursor */
mtime_t i_time_button_last_pressed; /* to track dbl-clicks */
Pixmap cursor_pixmap;
/* Window manager properties */
Atom net_wm_state;
Atom net_wm_state_fullscreen;
vlc_bool_t b_net_wm_state_fullscreen;
Atom net_wm_state_above;
vlc_bool_t b_net_wm_state_above;
Atom net_wm_state_stays_on_top;
vlc_bool_t b_net_wm_state_stays_on_top;
Atom net_wm_state_below;
vlc_bool_t b_net_wm_state_below;
};
/*****************************************************************************
......
......@@ -2,7 +2,7 @@
* intf.c : audio output API towards the interface modules
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: intf.c,v 1.17 2003/02/12 14:22:23 hartman Exp $
* $Id: intf.c,v 1.18 2003/08/03 23:11:21 gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -385,12 +385,13 @@ int aout_Restart( aout_instance_t * p_aout )
* that when those are changed, it is a significant change which implies
* rebuilding the audio-device and audio-channels variables.
*****************************************************************************/
void aout_FindAndRestart( vlc_object_t * p_this )
int aout_FindAndRestart( vlc_object_t * p_this, const char *psz_name,
vlc_value_t oldval, vlc_value_t val, void *p_data )
{
aout_instance_t * p_aout = vlc_object_find( p_this, VLC_OBJECT_AOUT,
FIND_ANYWHERE );
if ( p_aout == NULL ) return;
if ( p_aout == NULL ) return VLC_SUCCESS;
if ( var_Type( p_aout, "audio-device" ) != 0 )
{
......@@ -403,6 +404,8 @@ void aout_FindAndRestart( vlc_object_t * p_this )
aout_Restart( p_aout );
vlc_object_release( p_aout );
return VLC_SUCCESS;
}
/*****************************************************************************
......
......@@ -2,7 +2,7 @@
* configuration.c management of the modules configuration
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: configuration.c,v 1.60 2003/07/23 01:13:48 gbazin Exp $
* $Id: configuration.c,v 1.61 2003/08/03 23:11:21 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -218,6 +218,7 @@ void __config_PutPsz( vlc_object_t *p_this,
const char *psz_name, const char *psz_value )
{
module_config_t *p_config;
vlc_value_t oldval, val;
p_config = config_FindConfig( p_this, psz_name );
......@@ -238,18 +239,24 @@ void __config_PutPsz( vlc_object_t *p_this,
vlc_mutex_lock( p_config->p_lock );
/* free old string */
if( p_config->psz_value ) free( p_config->psz_value );
/* backup old value */
oldval.psz_string = p_config->psz_value;
if( psz_value && *psz_value ) p_config->psz_value = strdup( psz_value );
else p_config->psz_value = NULL;
val.psz_string = p_config->psz_value;
vlc_mutex_unlock( p_config->p_lock );
if( p_config->pf_callback )
{
p_config->pf_callback( p_this );
p_config->pf_callback( p_this, psz_name, oldval, val,
p_config->p_callback_data );
}
/* free old string */
if( oldval.psz_string ) free( oldval.psz_string );
}
/*****************************************************************************
......@@ -262,6 +269,7 @@ void __config_PutPsz( vlc_object_t *p_this,
void __config_PutInt( vlc_object_t *p_this, const char *psz_name, int i_value )
{
module_config_t *p_config;
vlc_value_t oldval, val;
p_config = config_FindConfig( p_this, psz_name );
......@@ -278,6 +286,9 @@ void __config_PutInt( vlc_object_t *p_this, const char *psz_name, int i_value )
return;
}
/* backup old value */
oldval.i_int = p_config->i_value;
/* if i_min == i_max == 0, then do not use them */
if ((p_config->i_min == 0) && (p_config->i_max == 0))
{
......@@ -296,9 +307,12 @@ void __config_PutInt( vlc_object_t *p_this, const char *psz_name, int i_value )
p_config->i_value = i_value;
}
val.i_int = p_config->i_value;
if( p_config->pf_callback )
{
p_config->pf_callback( p_this );
p_config->pf_callback( p_this, psz_name, oldval, val,
p_config->p_callback_data );
}
}
......@@ -312,6 +326,7 @@ void __config_PutFloat( vlc_object_t *p_this,
const char *psz_name, float f_value )
{
module_config_t *p_config;
vlc_value_t oldval, val;
p_config = config_FindConfig( p_this, psz_name );
......@@ -327,6 +342,9 @@ void __config_PutFloat( vlc_object_t *p_this,
return;
}
/* backup old value */
oldval.f_float = p_config->f_value;
/* if f_min == f_max == 0, then do not use them */
if ((p_config->f_min == 0) && (p_config->f_max == 0))
{
......@@ -345,9 +363,12 @@ void __config_PutFloat( vlc_object_t *p_this,
p_config->f_value = f_value;
}
val.f_float = p_config->f_value;
if( p_config->pf_callback )
{
p_config->pf_callback( p_this );
p_config->pf_callback( p_this, psz_name, oldval, val,
p_config->p_callback_data );
}
}
......
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