Commit 23ba8c3e authored by ipkiss's avatar ipkiss

* MacOSX interface: fixed a stupid bug

 * Win32 interface: completed support for channel selection
parent 4e82695c
......@@ -2,7 +2,7 @@
* intf.m: MacOS X interface plugin
*****************************************************************************
* Copyright (C) 2002-2003 VideoLAN
* $Id: intf.m,v 1.22 2003/01/12 18:25:05 jlj Exp $
* $Id: intf.m,v 1.23 2003/01/13 17:11:14 ipkiss Exp $
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Christophe Massiot <massiot@via.ecp.fr>
......@@ -782,7 +782,7 @@ static void Run( intf_thread_t *p_intf )
for( i = 0 ; i < p_input->stream.i_selected_es_number ; i++ )
{
if( p_input->stream.pp_selected_es[i]->i_cat == SPU_ES )
if( p_input->stream.pp_selected_es[i]->i_cat == AUDIO_ES )
{
p_audio_es = p_input->stream.pp_selected_es[i];
}
......
......@@ -2391,6 +2391,7 @@ object MainFrameDlg: TMainFrameDlg
object PopupADevice: TMenuItem
Tag = 3
Caption = 'Device'
Enabled = False
end
object VolumeUp1: TMenuItem
Tag = 3
......@@ -2407,10 +2408,12 @@ object MainFrameDlg: TMainFrameDlg
object PopupChannel: TMenuItem
Tag = 3
Caption = 'Channels'
Enabled = False
end
end
object PopupVDevice: TMenuItem
Caption = 'Screen'
Enabled = False
end
object N1: TMenuItem
Caption = '-'
......
/*****************************************************************************
* menu.cpp: functions to handle menu items
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: menu.cpp,v 1.3 2003/01/08 02:16:09 ipkiss Exp $
* Copyright (C) 2002-2003 VideoLAN
* $Id: menu.cpp,v 1.4 2003/01/13 17:11:14 ipkiss Exp $
*
* Authors: Olivier Teuliere <ipkiss@via.ecp.fr>
*
......@@ -239,6 +239,11 @@ __fastcall TMenusGen::TMenusGen( intf_thread_t *_p_intf ) : TObject()
}
/*****************************************************************************
* SetupMenus: This function dynamically generates some menus
*****************************************************************************
* The lock on p_input->stream must be taken before you call this function
*****************************************************************************/
void __fastcall TMenusGen::SetupMenus()
{
TMainFrameDlg * p_window = p_intf->p_sys->p_window;
......@@ -349,7 +354,7 @@ void __fastcall TMenusGen::SetupMenus()
p_aout = (aout_instance_t *)vlc_object_find( p_intf, VLC_OBJECT_AOUT,
FIND_ANYWHERE );
if ( p_aout != NULL )
if( p_aout != NULL )
{
vlc_value_t val;
val.b_bool = 0;
......@@ -378,7 +383,7 @@ void __fastcall TMenusGen::SetupMenus()
p_vout = (vout_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_VOUT,
FIND_ANYWHERE );
if ( p_vout != NULL )
if( p_vout != NULL )
{
vlc_value_t val;
val.b_bool = 0;
......@@ -447,8 +452,17 @@ void __fastcall TMenusGen::VarChange( vlc_object_t *p_object,
vlc_value_t val;
int i_index;
/* We must delete all the '&' characters in the caption string, because
* Borland automatically adds one when (and only when!) you click on
* the menuitem. Grrrrr... */
AnsiString Caption = Item->Caption;
while( Caption.LastDelimiter( "&" ) != 0 )
{
Caption.Delete( Caption.LastDelimiter( "&" ), 1 );
}
val.psz_string = Caption.c_str();
/* set the new value */
val.psz_string = Item->Name.c_str();
if( var_Set( p_object, psz_variable, val ) < 0 )
{
msg_Warn( p_object, "cannot set variable (%s)", val.psz_string );
......@@ -546,27 +560,27 @@ void __fastcall TMenusGen::SetupVarMenu( vlc_object_t *p_object,
{
TMenuItem * Item;
vlc_value_t val;
char * psz_value;
char * psz_value = NULL;
int i;
/* remove previous menu */
Root->Clear();
/* get the current value */
if ( var_Get( p_object, psz_variable, &val ) < 0 )
if( var_Get( p_object, psz_variable, &val ) < 0 )
{
return;
}
psz_value = val.psz_string;
if ( var_Change( p_object, psz_variable, VLC_VAR_GETLIST, &val ) < 0 )
if( var_Change( p_object, psz_variable, VLC_VAR_GETLIST, &val ) < 0 )
{
free( psz_value );
return;
}
/* append a menuitem for each option */
for ( i = 0; i < val.p_list->i_count; i++ )
for( i = 0; i < val.p_list->i_count; i++ )
{
Item = new TMenuItem( Root );
Item->Caption = val.p_list->p_values[i].psz_string;
......@@ -585,7 +599,7 @@ void __fastcall TMenusGen::SetupVarMenu( vlc_object_t *p_object,
/* clean up everything */
var_Change( p_object, psz_variable, VLC_VAR_FREELIST, &val );
free( psz_value );
// free( psz_value );
}
/*****************************************************************************
......@@ -929,3 +943,4 @@ void __fastcall TMenusGen::NavigationMenu( TMenuItem *Root,
Root->Enabled = true;
}
/*****************************************************************************
* win32.cpp : Win32 interface plugin for vlc
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: win32.cpp,v 1.7 2003/01/08 02:16:09 ipkiss Exp $
* Copyright (C) 2002-2003 VideoLAN
* $Id: win32.cpp,v 1.8 2003/01/13 17:11:14 ipkiss Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
*
......@@ -129,9 +129,6 @@ static void Run( intf_thread_t *p_intf )
*****************************************************************************/
int Win32Manage( intf_thread_t *p_intf )
{
aout_instance_t * p_aout;
vout_thread_t * p_vout;
vlc_mutex_lock( &p_intf->change_lock );
/* If the "display popup" flag has changed */
......@@ -163,68 +160,99 @@ int Win32Manage( intf_thread_t *p_intf )
p_intf->p_sys->p_input = NULL;
}
if( p_intf->p_sys->p_input )
if( p_intf->p_sys->p_input != NULL && !p_intf->p_sys->p_input->b_die )
{
input_thread_t *p_input = p_intf->p_sys->p_input;
vlc_bool_t b_need_menus = 0;
input_thread_t * p_input = p_intf->p_sys->p_input;
aout_instance_t * p_aout = NULL;
vout_thread_t * p_vout = NULL;
vlc_mutex_lock( &p_input->stream.stream_lock );
if( !p_input->b_die )
/* New input or stream map change */
if( p_input->stream.b_changed )
{
p_intf->p_sys->p_window->ModeManage();
b_need_menus = 1;
p_intf->p_sys->b_playing = 1;
}
/* Manage the slider */
if( p_input->stream.b_seekable && p_intf->p_sys->b_playing )
{
/* New input or stream map change */
if( p_input->stream.b_changed )
TTrackBar * TrackBar = p_intf->p_sys->p_window->TrackBar;
off_t NewValue = TrackBar->Position;
#define p_area p_input->stream.p_selected_area
/* If the user hasn't touched the slider since the last time,
* then the input can safely change it */
if( NewValue == p_intf->p_sys->OldValue )
{
p_intf->p_sys->p_window->ModeManage();
p_intf->p_sys->p_menus->SetupMenus();
p_intf->p_sys->b_playing = 1;
/* Update the value */
TrackBar->Position = p_intf->p_sys->OldValue =
( (off_t)SLIDER_MAX_VALUE * p_area->i_tell ) /
p_area->i_size;
}
/* Manage the slider */
if( p_input->stream.b_seekable && p_intf->p_sys->b_playing )
/* Otherwise, send message to the input if the user has
* finished dragging the slider */
else if( p_intf->p_sys->b_slider_free )
{
TTrackBar * TrackBar = p_intf->p_sys->p_window->TrackBar;
off_t NewValue = TrackBar->Position;
off_t i_seek = ( NewValue * p_area->i_size ) /
(off_t)SLIDER_MAX_VALUE;
#define p_area p_input->stream.p_selected_area
/* If the user hasn't touched the slider since the last time,
* then the input can safely change it */
if( NewValue == p_intf->p_sys->OldValue )
{
/* Update the value */
TrackBar->Position = p_intf->p_sys->OldValue =
( (off_t)SLIDER_MAX_VALUE * p_area->i_tell ) /
p_area->i_size;
}
/* Otherwise, send message to the input if the user has
* finished dragging the slider */
else if( p_intf->p_sys->b_slider_free )
{
off_t i_seek = ( NewValue * p_area->i_size ) /
(off_t)SLIDER_MAX_VALUE;
/* release the lock to be able to seek */
vlc_mutex_unlock( &p_input->stream.stream_lock );
input_Seek( p_input, i_seek, INPUT_SEEK_SET );
vlc_mutex_lock( &p_input->stream.stream_lock );
/* Update the old value */
p_intf->p_sys->OldValue = NewValue;
}
/* Update the display */
// TrackBar->Invalidate();
/* release the lock to be able to seek */
vlc_mutex_unlock( &p_input->stream.stream_lock );
input_Seek( p_input, i_seek, INPUT_SEEK_SET );
vlc_mutex_lock( &p_input->stream.stream_lock );
/* Update the old value */
p_intf->p_sys->OldValue = NewValue;
}
# undef p_area
}
if( p_intf->p_sys->i_part != p_input->stream.p_selected_area->i_part )
{
p_intf->p_sys->b_chapter_update = 1;
b_need_menus = 1;
}
/* Does the audio output require to update the menus ? */
p_aout = (aout_instance_t *)vlc_object_find( p_intf, VLC_OBJECT_AOUT,
FIND_ANYWHERE );
if( p_aout != NULL )
{
vlc_value_t val;
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 = 1;
}
if( p_intf->p_sys->i_part !=
p_input->stream.p_selected_area->i_part )
vlc_object_release( (vlc_object_t *)p_aout );
}
/* Does the video output require to update the menus ? */
p_vout = (vout_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_VOUT,
FIND_ANYWHERE );
if( p_vout != NULL )
{
vlc_value_t val;
if( var_Get( (vlc_object_t *)p_vout, "intf-change", &val ) >= 0
&& val.b_bool )
{
// p_intf->p_sys->b_chapter_update = 1;
p_intf->p_sys->p_menus->SetupMenus();
p_intf->p_sys->b_vout_update = 1;
b_need_menus = 1;
}
vlc_object_release( (vlc_object_t *)p_vout );
}
if( b_need_menus )
p_intf->p_sys->p_menus->SetupMenus();
vlc_mutex_unlock( &p_input->stream.stream_lock );
}
else if( p_intf->p_sys->b_playing && !p_intf->b_die )
......@@ -233,42 +261,6 @@ int Win32Manage( intf_thread_t *p_intf )
p_intf->p_sys->b_playing = 0;
}
/* Does the audio output require to update the menus ? */
p_aout = (aout_instance_t *)vlc_object_find( p_intf, VLC_OBJECT_AOUT,
FIND_ANYWHERE );
if( p_aout != NULL )
{
vlc_value_t val;
if( var_Get( (vlc_object_t *)p_aout, "intf-change", &val ) >= 0
&& val.b_bool )
{
#if 0
p_intf->p_sys->b_aout_update = 1;
p_intf->p_sys->p_menus->SetupMenus();
#endif
}
vlc_object_release( (vlc_object_t *)p_aout );
}
/* Does the video output require to update the menus ? */
p_vout = (vout_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_VOUT,
FIND_ANYWHERE );
if( p_vout != NULL )
{
vlc_value_t val;
if( var_Get( (vlc_object_t *)p_vout, "intf-change", &val ) >= 0
&& val.b_bool )
{
#if 0
p_intf->p_sys->b_vout_update = 1;
p_intf->p_sys->p_menus->SetupMenus();
#endif
}
vlc_object_release( (vlc_object_t *)p_vout );
}
if( p_intf->b_die )
{
vlc_mutex_unlock( &p_intf->change_lock );
......
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