1
mirror of https://code.videolan.org/videolan/vlc synced 2024-07-25 09:41:30 +02:00

* src/input/input_programs.c: Added a 'intf-changed' variable as vout, aout

and playlist already have, to be notified of menu changes.
* src/video_output/video_output.c: Changed a 1 to a VLC_TRUE
* modules/gui/macosx/intf.?: Interface listens for changes in the input
  menu's now.
This commit is contained in:
Derk-Jan Hartman 2003-05-11 18:40:11 +00:00
parent ef46a3ffb1
commit 934308bbc3
4 changed files with 56 additions and 105 deletions

View File

@ -2,7 +2,7 @@
* intf.h: MacOS X interface plugin
*****************************************************************************
* Copyright (C) 2002-2003 VideoLAN
* $Id: intf.h,v 1.36 2003/05/08 17:13:22 massiot Exp $
* $Id: intf.h,v 1.37 2003/05/11 18:40:11 hartman Exp $
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Christophe Massiot <massiot@via.ecp.fr>
@ -76,20 +76,12 @@ struct intf_sys_t
vlc_bool_t b_current_title_update;
/* menus handlers */
vlc_bool_t b_chapter_update;
vlc_bool_t b_program_update;
vlc_bool_t b_title_update;
vlc_bool_t b_audio_update;
vlc_bool_t b_video_update;
vlc_bool_t b_spu_update;
vlc_bool_t b_input_update;
vlc_bool_t b_aout_update;
vlc_bool_t b_vout_update;
/* The messages window */
msg_subscription_t * p_sub;
/* DVD mode */
unsigned int i_part;
};
/*****************************************************************************
@ -238,7 +230,6 @@ struct intf_sys_t
- (void)updateMessageArray;
- (void)playStatusUpdated:(BOOL)b_pause;
- (void)setSubmenusEnabled:(BOOL)b_enabled;
- (void)manageVolumeSlider;
- (void)setupMenus:(input_thread_t *)p_input;

View File

@ -2,7 +2,7 @@
* intf.m: MacOS X interface plugin
*****************************************************************************
* Copyright (C) 2002-2003 VideoLAN
* $Id: intf.m,v 1.78 2003/05/08 23:11:28 hartman Exp $
* $Id: intf.m,v 1.79 2003/05/11 18:40:11 hartman Exp $
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Christophe Massiot <massiot@via.ecp.fr>
@ -391,7 +391,6 @@ int ExecuteOnMainThread( id target, SEL sel, void * p_arg )
[o_info_window setTitle: _NS("Info")];
[self setSubmenusEnabled: FALSE];
[self manageVolumeSlider];
}
@ -501,7 +500,6 @@ int ExecuteOnMainThread( id target, SEL sel, void * p_arg )
{
vout_thread_t * p_vout = NULL;
aout_instance_t * p_aout = NULL;
vlc_bool_t b_need_menus = VLC_FALSE;
vlc_mutex_lock( &p_input->stream.stream_lock );
@ -512,16 +510,16 @@ int ExecuteOnMainThread( id target, SEL sel, void * p_arg )
/* New input or stream map change */
if( p_input->stream.b_changed )
{
p_intf->p_sys->b_playing = 1;
p_intf->p_sys->b_playing = TRUE;
[self manageMode: p_playlist];
b_need_menus = VLC_TRUE;
}
if( p_intf->p_sys->i_part !=
p_input->stream.p_selected_area->i_part )
vlc_value_t val;
if( var_Get( (vlc_object_t *)p_input, "intf-change", &val )
>= 0 && val.b_bool )
{
p_intf->p_sys->b_chapter_update = 1;
b_need_menus = VLC_TRUE;
p_intf->p_sys->b_input_update = TRUE;
}
p_aout = vlc_object_find( p_intf, VLC_OBJECT_AOUT,
@ -533,8 +531,7 @@ int ExecuteOnMainThread( id target, SEL sel, void * p_arg )
if( var_Get( (vlc_object_t *)p_aout, "intf-change", &val )
>= 0 && val.b_bool )
{
p_intf->p_sys->b_aout_update = 1;
b_need_menus = VLC_TRUE;
p_intf->p_sys->b_aout_update = TRUE;
}
vlc_object_release( (vlc_object_t *)p_aout );
@ -552,24 +549,18 @@ int ExecuteOnMainThread( id target, SEL sel, void * p_arg )
if( var_Get( (vlc_object_t *)p_vout, "intf-change", &val )
>= 0 && val.b_bool )
{
p_intf->p_sys->b_vout_update = 1;
b_need_menus = VLC_TRUE;
p_intf->p_sys->b_vout_update = TRUE;
}
vlc_object_release( (vlc_object_t *)p_vout );
}
if( b_need_menus )
{
[self setupMenus: p_input];
}
[self setupMenus: p_input];
}
vlc_mutex_unlock( &p_input->stream.stream_lock );
}
else if( p_intf->p_sys->b_playing && !p_intf->b_die )
{
p_intf->p_sys->b_playing = 0;
p_intf->p_sys->b_playing = FALSE;
[self manageMode: p_playlist];
}
@ -582,16 +573,7 @@ int ExecuteOnMainThread( id target, SEL sel, void * p_arg )
if( p_playlist->p_input != NULL )
{
/* get ready for menu regeneration */
p_intf->p_sys->b_program_update = 1;
p_intf->p_sys->b_title_update = 1;
p_intf->p_sys->b_chapter_update = 1;
p_intf->p_sys->b_audio_update = 1;
p_intf->p_sys->b_video_update = 1;
p_intf->p_sys->b_spu_update = 1;
p_intf->p_sys->b_current_title_update = 1;
p_intf->p_sys->i_part = 0;
p_playlist->p_input->stream.b_changed = 0;
msg_Dbg( p_intf, "stream has changed, refreshing interface" );
@ -636,7 +618,7 @@ int ExecuteOnMainThread( id target, SEL sel, void * p_arg )
{
vlc_value_t val;
val.b_bool = 0;
val.b_bool = FALSE;
var_Set( (vlc_object_t *)p_playlist, "intf-change", val );
[o_playlist playlistUpdated];
@ -706,8 +688,6 @@ int ExecuteOnMainThread( id target, SEL sel, void * p_arg )
{
/* play status */
p_intf->p_sys->b_play_status = VLC_FALSE;
[self setSubmenusEnabled: FALSE];
}
[self playStatusUpdated: p_intf->p_sys->b_play_status];
@ -731,7 +711,7 @@ int ExecuteOnMainThread( id target, SEL sel, void * p_arg )
if( p_intf->p_sys->b_playing && p_input != NULL )
{
vlc_bool_t b_field_update = VLC_TRUE;
vlc_bool_t b_field_update = TRUE;
if( !p_input->b_die && ( p_intf->p_sys->b_play_status !=
( p_input->stream.control.i_status != PAUSE_S ) ) )
@ -902,19 +882,6 @@ int ExecuteOnMainThread( id target, SEL sel, void * p_arg )
}
}
- (void)setSubmenusEnabled:(BOOL)b_enabled
{
[o_mi_program setEnabled: b_enabled];
[o_mi_title setEnabled: b_enabled];
[o_mi_chapter setEnabled: b_enabled];
[o_mi_audiotrack setEnabled: b_enabled];
[o_mi_videotrack setEnabled: b_enabled];
[o_mi_subtitle setEnabled: b_enabled];
[o_mi_channels setEnabled: b_enabled];
[o_mi_device setEnabled: b_enabled];
[o_mi_screen setEnabled: b_enabled];
}
- (void)manageVolumeSlider
{
audio_volume_t i_volume;
@ -923,7 +890,7 @@ int ExecuteOnMainThread( id target, SEL sel, void * p_arg )
aout_VolumeGet( p_intf, &i_volume );
[o_volumeslider setFloatValue: (float)i_volume / AOUT_VOLUME_STEP];
[o_volumeslider setEnabled: 1];
[o_volumeslider setEnabled: TRUE];
p_intf->p_sys->b_mute = ( i_volume == 0 );
}
@ -1007,62 +974,32 @@ int ExecuteOnMainThread( id target, SEL sel, void * p_arg )
- (void)setupMenus:(input_thread_t *)p_input
{
intf_thread_t * p_intf = [NSApp getIntf];
vlc_value_t val;
p_intf->p_sys->b_chapter_update |= p_intf->p_sys->b_title_update;
p_intf->p_sys->b_audio_update |= p_intf->p_sys->b_title_update |
p_intf->p_sys->b_program_update;
p_intf->p_sys->b_spu_update |= p_intf->p_sys->b_title_update |
p_intf->p_sys->b_program_update;
p_intf->p_sys->b_video_update |= p_intf->p_sys->b_program_update |
p_intf->p_sys->b_program_update;
if( p_intf->p_sys->b_program_update )
if( p_intf->p_sys->b_input_update )
{
val.b_bool = FALSE;
[self setupVarMenu: o_mi_program target: (vlc_object_t *)p_input
var: "program" selector: @selector(toggleVar:)];
p_intf->p_sys->b_program_update = 0;
}
if( p_intf->p_sys->b_title_update )
{
[self setupVarMenu: o_mi_title target: (vlc_object_t *)p_input
var: "title" selector: @selector(toggleVar:)];
p_intf->p_sys->b_title_update = 0;
}
if( p_intf->p_sys->b_chapter_update )
{
[self setupVarMenu: o_mi_chapter target: (vlc_object_t *)p_input
var: "chapter" selector: @selector(toggleVar:)];\
p_intf->p_sys->i_part = p_input->stream.p_selected_area->i_part;
p_intf->p_sys->b_chapter_update = 0;
}
var: "chapter" selector: @selector(toggleVar:)];
if( p_intf->p_sys->b_audio_update )
{
[self setupVarMenu: o_mi_audiotrack target: (vlc_object_t *)p_input
var: "audio-es" selector: @selector(toggleVar:)];
p_intf->p_sys->b_audio_update = 0;
}
if( p_intf->p_sys->b_video_update )
{
[self setupVarMenu: o_mi_videotrack target: (vlc_object_t *)p_input
var: "video-es" selector: @selector(toggleVar:)];
p_intf->p_sys->b_video_update = 0;
}
if( p_intf->p_sys->b_spu_update )
{
[self setupVarMenu: o_mi_subtitle target: (vlc_object_t *)p_input
var: "spu-es" selector: @selector(toggleVar:)];
p_intf->p_sys->b_spu_update = 0;
p_intf->p_sys->b_input_update = FALSE;
var_Set( (vlc_object_t *)p_input, "intf-change", val );
}
if ( p_intf->p_sys->b_aout_update )
@ -1072,8 +1009,7 @@ int ExecuteOnMainThread( id target, SEL sel, void * p_arg )
if ( p_aout != NULL )
{
vlc_value_t val;
val.b_bool = 0;
val.b_bool = FALSE;
[self setupVarMenu: o_mi_channels target: (vlc_object_t *)p_aout
var: "audio-channels" selector: @selector(toggleVar:)];
@ -1084,7 +1020,7 @@ int ExecuteOnMainThread( id target, SEL sel, void * p_arg )
vlc_object_release( (vlc_object_t *)p_aout );
}
p_intf->p_sys->b_aout_update = 0;
p_intf->p_sys->b_aout_update = FALSE;
}
if( p_intf->p_sys->b_vout_update )
@ -1094,8 +1030,7 @@ int ExecuteOnMainThread( id target, SEL sel, void * p_arg )
if ( p_vout != NULL )
{
vlc_value_t val;
val.b_bool = 0;
val.b_bool = FALSE;
[self setupVarMenu: o_mi_screen target: (vlc_object_t *)p_vout
var: "video-device" selector: @selector(toggleVar:)];
@ -1105,7 +1040,7 @@ int ExecuteOnMainThread( id target, SEL sel, void * p_arg )
[o_mi_close_window setEnabled: TRUE];
}
p_intf->p_sys->b_vout_update = 0;
p_intf->p_sys->b_vout_update = FALSE;
}
}

View File

@ -2,7 +2,7 @@
* input_programs.c: es_descriptor_t, pgrm_descriptor_t management
*****************************************************************************
* Copyright (C) 1999-2002 VideoLAN
* $Id: input_programs.c,v 1.108 2003/05/10 11:08:07 gbazin Exp $
* $Id: input_programs.c,v 1.109 2003/05/11 18:40:11 hartman Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
@ -56,7 +56,7 @@ static int ESCallback( vlc_object_t *, char const *,
*****************************************************************************/
int input_InitStream( input_thread_t * p_input, size_t i_data_len )
{
vlc_value_t text;
vlc_value_t text,val;
p_input->stream.i_stream_id = 0;
@ -84,6 +84,10 @@ int input_InitStream( input_thread_t * p_input, size_t i_data_len )
{
p_input->stream.p_demux_data = NULL;
}
var_Create( p_input, "intf-change", VLC_VAR_BOOL );
val.b_bool = VLC_TRUE;
var_Set( p_input, "intf-change", val );
/* Create a few object variables used for navigation in the interfaces */
var_Create( p_input, "program", VLC_VAR_INTEGER | VLC_VAR_HASCHOICE );
@ -159,6 +163,7 @@ void input_EndStream( input_thread_t * p_input )
var_Destroy( p_input, "video-es" );
var_Destroy( p_input, "audio-es" );
var_Destroy( p_input, "spu-es" );
var_Destroy( p_input, "intf-change" );
}
/*****************************************************************************
@ -900,6 +905,7 @@ static int ProgramCallback( vlc_object_t *p_this, char const *psz_cmd,
vlc_value_t oldval, vlc_value_t newval, void *p_data )
{
input_thread_t *p_input = (input_thread_t *)p_this;
vlc_value_t val;
if( oldval.i_int == newval.i_int )
return VLC_SUCCESS;
@ -914,6 +920,9 @@ static int ProgramCallback( vlc_object_t *p_this, char const *psz_cmd,
}
vlc_mutex_unlock( &p_input->stream.stream_lock );
val.b_bool = VLC_TRUE;
var_Set( p_input, "intf-change", val );
return VLC_SUCCESS;
}
@ -922,6 +931,7 @@ static int TitleCallback( vlc_object_t *p_this, char const *psz_cmd,
{
input_thread_t *p_input = (input_thread_t *)p_this;
input_area_t *p_area;
vlc_value_t val;
if( oldval.i_int == newval.i_int )
return VLC_SUCCESS;
@ -934,6 +944,9 @@ static int TitleCallback( vlc_object_t *p_this, char const *psz_cmd,
input_ChangeArea( p_input, p_area );
input_SetStatus( p_input, INPUT_STATUS_PLAY );
val.b_bool = VLC_TRUE;
var_Set( p_input, "intf-change", val );
return VLC_SUCCESS;
}
@ -942,6 +955,7 @@ static int ChapterCallback( vlc_object_t *p_this, char const *psz_cmd,
{
input_thread_t *p_input = (input_thread_t *)p_this;
input_area_t *p_area;
vlc_value_t val;
if( oldval.i_int == newval.i_int )
return VLC_SUCCESS;
@ -955,6 +969,9 @@ static int ChapterCallback( vlc_object_t *p_this, char const *psz_cmd,
input_ChangeArea( p_input, p_area );
input_SetStatus( p_input, INPUT_STATUS_PLAY );
val.b_bool = VLC_TRUE;
var_Set( p_input, "intf-change", val );
return VLC_SUCCESS;
}
@ -963,6 +980,7 @@ static int NavigationCallback( vlc_object_t *p_this, char const *psz_cmd,
{
input_thread_t *p_input = (input_thread_t *)p_this;
uint16_t i_area_id = (int)p_data;
vlc_value_t val;
vlc_mutex_lock( &p_input->stream.stream_lock );
@ -987,6 +1005,9 @@ static int NavigationCallback( vlc_object_t *p_this, char const *psz_cmd,
}
vlc_mutex_unlock( &p_input->stream.stream_lock );
val.b_bool = VLC_TRUE;
var_Set( p_input, "intf-change", val );
return VLC_SUCCESS;
}
@ -995,6 +1016,7 @@ static int ESCallback( vlc_object_t *p_this, char const *psz_cmd,
{
input_thread_t *p_input = (input_thread_t *)p_this;
unsigned int i;
vlc_value_t val;
vlc_mutex_lock( &p_input->stream.stream_lock );
@ -1020,5 +1042,8 @@ static int ESCallback( vlc_object_t *p_this, char const *psz_cmd,
vlc_mutex_unlock( &p_input->stream.stream_lock );
val.b_bool = VLC_TRUE;
var_Set( p_input, "intf-change", val );
return VLC_SUCCESS;
}

View File

@ -5,7 +5,7 @@
* thread, and destroy a previously oppened video output thread.
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: video_output.c,v 1.220 2003/05/05 11:49:50 sam Exp $
* $Id: video_output.c,v 1.221 2003/05/11 18:40:11 hartman Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
@ -1146,7 +1146,7 @@ int vout_VarCallback( vlc_object_t * p_this, const char * psz_variable,
{
vout_thread_t * p_vout = (vout_thread_t *)p_this;
vlc_value_t val;
val.b_bool = 1;
val.b_bool = VLC_TRUE;
var_Set( p_vout, "intf-change", val );
return 0;
}