From: Laurent Aimar Date: Sun, 7 Sep 2003 22:53:09 +0000 (+0000) Subject: * control: use new variables and 'title*', 'chapter*' ones. X-Git-Tag: 0.7.0~979 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=3c98f145a38a0f09184baf07be912a4433584fd8;p=vlc * control: use new variables and 'title*', 'chapter*' ones. * gui/beos: removed not really used STARTED_S, and NOT_STARTED_S input state. * gui/wxwindows: use 'position' and 'time' variables -> seek improved for avi and mp4 and accurate time display :) --- diff --git a/modules/control/rc/rc.c b/modules/control/rc/rc.c index 4d2530a000..9d9560ea86 100644 --- a/modules/control/rc/rc.c +++ b/modules/control/rc/rc.c @@ -2,7 +2,7 @@ * rc.c : remote control stdin/stdout plugin for vlc ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: rc.c,v 1.37 2003/07/28 07:16:50 fenrir Exp $ + * $Id: rc.c,v 1.38 2003/09/07 22:53:09 fenrir Exp $ * * Authors: Peter Surda * @@ -510,6 +510,7 @@ static int Input( 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; + vlc_value_t val; p_input = vlc_object_find( p_this, VLC_OBJECT_INPUT, FIND_ANYWHERE ); @@ -521,7 +522,9 @@ static int Input( vlc_object_t *p_this, char const *psz_cmd, /* Parse commands that only require an input */ if( !strcmp( psz_cmd, "pause" ) ) { - input_SetStatus( p_input, INPUT_STATUS_PAUSE ); + val.i_int = PAUSE_S; + + var_Set( p_input, "state", val ); vlc_object_release( p_input ); return VLC_SUCCESS; } @@ -530,13 +533,13 @@ static int Input( vlc_object_t *p_this, char const *psz_cmd, if( strlen( newval.psz_string ) > 0 && newval.psz_string[strlen( newval.psz_string ) - 1] == '%' ) { - input_Seek( p_input, atoi( newval.psz_string ), - INPUT_SEEK_PERCENT | INPUT_SEEK_SET ); + val.f_float = (float)atoi( newval.psz_string ) / 100.0; + var_Set( p_input, "position", val ); } else { - input_Seek( p_input, atoi( newval.psz_string ), - INPUT_SEEK_SECONDS | INPUT_SEEK_SET ); + val.i_time = (int64_t)atoi( newval.psz_string ) * 1000000ULL; + var_Set( p_input, "time", val ); } vlc_object_release( p_input ); return VLC_SUCCESS; @@ -545,53 +548,35 @@ static int Input( vlc_object_t *p_this, char const *psz_cmd, !strcmp( psz_cmd, "chapter_n" ) || !strcmp( psz_cmd, "chapter_p" ) ) { - unsigned int i_chapter = 0; - if( !strcmp( psz_cmd, "chapter" ) ) { if ( *newval.psz_string ) { /* Set. */ - i_chapter = atoi( newval.psz_string ); + val.i_int = atoi( newval.psz_string ); + var_Set( p_input, "chapter", val ); } else { + vlc_value_t val_list; + /* Get. */ - vlc_mutex_lock( &p_input->stream.stream_lock ); - printf( "Currently playing chapter %d/%d\n", - p_input->stream.p_selected_area->i_part, - p_input->stream.p_selected_area->i_part_nb - 1 ); - vlc_mutex_unlock( &p_input->stream.stream_lock ); - - vlc_object_release( p_input ); - return VLC_SUCCESS; + var_Get( p_input, "chapter", &val ); + var_Change( p_input, "chapter", VLC_VAR_GETCHOICES, &val_list, NULL ); + printf( "Currently playing chapter %d/%d\n", val.i_int, val_list.p_list->i_count ); + var_Change( p_this, "chapter", VLC_VAR_FREELIST, &val_list, NULL ); } } else if( !strcmp( psz_cmd, "chapter_n" ) ) { - vlc_mutex_lock( &p_input->stream.stream_lock ); - i_chapter = p_input->stream.p_selected_area->i_part + 1; - vlc_mutex_unlock( &p_input->stream.stream_lock ); + val.b_bool = VLC_TRUE; + var_Set( p_input, "next-chapter", val ); } else if( !strcmp( psz_cmd, "chapter_p" ) ) { - vlc_mutex_lock( &p_input->stream.stream_lock ); - i_chapter = p_input->stream.p_selected_area->i_part - 1; - vlc_mutex_unlock( &p_input->stream.stream_lock ); - } - - vlc_mutex_lock( &p_input->stream.stream_lock ); - if( ( i_chapter > 0 ) && ( i_chapter < - p_input->stream.p_selected_area->i_part_nb ) ) - { - input_area_t *p_area = p_input->stream.p_selected_area; - p_input->stream.p_selected_area->i_part = i_chapter; - vlc_mutex_unlock( &p_input->stream.stream_lock ); - input_ChangeArea( p_input, p_area ); - input_SetStatus( p_input, INPUT_STATUS_PLAY ); - vlc_mutex_lock( &p_input->stream.stream_lock ); + val.b_bool = VLC_TRUE; + var_Set( p_input, "prev-chapter", val ); } - vlc_mutex_unlock( &p_input->stream.stream_lock ); vlc_object_release( p_input ); return VLC_SUCCESS; @@ -600,51 +585,35 @@ static int Input( vlc_object_t *p_this, char const *psz_cmd, !strcmp( psz_cmd, "title_n" ) || !strcmp( psz_cmd, "title_p" ) ) { - unsigned int i_title = 0; - if( !strcmp( psz_cmd, "title" ) ) { if ( *newval.psz_string ) { /* Set. */ - i_title = atoi( newval.psz_string ); + val.i_int = atoi( newval.psz_string ); + var_Set( p_input, "title", val ); } else { + vlc_value_t val_list; + /* Get. */ - vlc_mutex_lock( &p_input->stream.stream_lock ); - printf( "Currently playing title %d/%d\n", - p_input->stream.p_selected_area->i_id, - p_input->stream.i_area_nb - 1 ); - vlc_mutex_unlock( &p_input->stream.stream_lock ); - - vlc_object_release( p_input ); - return VLC_SUCCESS; + var_Get( p_input, "title", &val ); + var_Change( p_input, "title", VLC_VAR_GETCHOICES, &val_list, NULL ); + printf( "Currently playing title %d/%d\n", val.i_int, val_list.p_list->i_count ); + var_Change( p_this, "title", VLC_VAR_FREELIST, &val_list, NULL ); } } else if( !strcmp( psz_cmd, "title_n" ) ) { - vlc_mutex_lock( &p_input->stream.stream_lock ); - i_title = p_input->stream.p_selected_area->i_id + 1; - vlc_mutex_unlock( &p_input->stream.stream_lock ); + val.b_bool = VLC_TRUE; + var_Set( p_input, "next-title", val ); } else if( !strcmp( psz_cmd, "title_p" ) ) { - vlc_mutex_lock( &p_input->stream.stream_lock ); - i_title = p_input->stream.p_selected_area->i_id - 1; - vlc_mutex_unlock( &p_input->stream.stream_lock ); - } - - vlc_mutex_lock( &p_input->stream.stream_lock ); - if( ( i_title > 0 ) && ( i_title < p_input->stream.i_area_nb ) ) - { - input_area_t *p_area = p_input->stream.pp_areas[i_title]; - vlc_mutex_unlock( &p_input->stream.stream_lock ); - input_ChangeArea( p_input, p_area ); - input_SetStatus( p_input, INPUT_STATUS_PLAY ); - vlc_mutex_lock( &p_input->stream.stream_lock ); + val.b_bool = VLC_TRUE; + var_Set( p_input, "prev-title", val ); } - vlc_mutex_unlock( &p_input->stream.stream_lock ); vlc_object_release( p_input ); return VLC_SUCCESS; diff --git a/modules/gui/beos/InterfaceWindow.cpp b/modules/gui/beos/InterfaceWindow.cpp index d0bce6bd29..6686847466 100644 --- a/modules/gui/beos/InterfaceWindow.cpp +++ b/modules/gui/beos/InterfaceWindow.cpp @@ -2,7 +2,7 @@ * InterfaceWindow.cpp: beos interface ***************************************************************************** * Copyright (C) 1999, 2000, 2001 VideoLAN - * $Id: InterfaceWindow.cpp,v 1.42 2003/06/22 00:40:18 titer Exp $ + * $Id: InterfaceWindow.cpp,v 1.43 2003/09/07 22:53:09 fenrir Exp $ * * Authors: Jean-Marc Dressler * Samuel Hocevar @@ -416,7 +416,7 @@ void InterfaceWindow::MessageReceived( BMessage * p_message ) if (playback_status > UNDEF_S) { p_wrapper->PlaylistStop(); - p_mediaControl->SetStatus(NOT_STARTED_S, DEFAULT_RATE); + p_mediaControl->SetStatus(UNDEF_S, DEFAULT_RATE); } break; @@ -722,7 +722,7 @@ void InterfaceWindow::MessageReceived( BMessage * p_message ) bool InterfaceWindow::QuitRequested() { p_wrapper->PlaylistStop(); - p_mediaControl->SetStatus(NOT_STARTED_S, DEFAULT_RATE); + p_mediaControl->SetStatus(UNDEF_S, DEFAULT_RATE); _StoreSettings(); diff --git a/modules/gui/beos/MediaControlView.cpp b/modules/gui/beos/MediaControlView.cpp index 4e0624eb0d..9aba3b7ae6 100644 --- a/modules/gui/beos/MediaControlView.cpp +++ b/modules/gui/beos/MediaControlView.cpp @@ -2,7 +2,7 @@ * MediaControlView.cpp: beos interface ***************************************************************************** * Copyright (C) 1999, 2000, 2001 VideoLAN - * $Id: MediaControlView.cpp,v 1.19 2003/06/22 00:40:18 titer Exp $ + * $Id: MediaControlView.cpp,v 1.20 2003/09/07 22:53:09 fenrir Exp $ * * Authors: Tony Castley * Stephan Aßmus @@ -300,14 +300,12 @@ MediaControlView::SetStatus(int status, int rate) case PLAYING_S: case FORWARD_S: case BACKWARD_S: - case START_S: fPlayPause->SetPlaying(); break; case PAUSE_S: fPlayPause->SetPaused(); break; case UNDEF_S: - case NOT_STARTED_S: default: fPlayPause->SetStopped(); break; diff --git a/modules/gui/beos/VlcWrapper.cpp b/modules/gui/beos/VlcWrapper.cpp index 8accd59383..b1bdf8fd8a 100644 --- a/modules/gui/beos/VlcWrapper.cpp +++ b/modules/gui/beos/VlcWrapper.cpp @@ -2,7 +2,7 @@ * VlcWrapper.cpp: BeOS plugin for vlc (derived from MacOS X port) ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: VlcWrapper.cpp,v 1.36 2003/07/23 01:13:47 gbazin Exp $ + * $Id: VlcWrapper.cpp,v 1.37 2003/09/07 22:53:09 fenrir Exp $ * * Authors: Florian G. Pflug * Jon Lech Johansen @@ -314,12 +314,10 @@ bool VlcWrapper::IsPlaying() case PLAYING_S: case FORWARD_S: case BACKWARD_S: - case START_S: playing = true; break; case PAUSE_S: case UNDEF_S: - case NOT_STARTED_S: default: break; } diff --git a/modules/gui/wxwindows/interface.cpp b/modules/gui/wxwindows/interface.cpp index a2c23fd537..aeeefc53c8 100644 --- a/modules/gui/wxwindows/interface.cpp +++ b/modules/gui/wxwindows/interface.cpp @@ -2,7 +2,7 @@ * interface.cpp : wxWindows plugin for vlc ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: interface.cpp,v 1.59 2003/08/30 13:59:15 gbazin Exp $ + * $Id: interface.cpp,v 1.60 2003/09/07 22:53:09 fenrir Exp $ * * Authors: Gildas Bazin * @@ -669,6 +669,8 @@ void Interface::OnPlayStream( wxCommandEvent& WXUNUSED(event) ) if( p_playlist->i_size ) { + vlc_value_t state; + input_thread_t *p_input = (input_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_ANYWHERE ); @@ -681,19 +683,21 @@ void Interface::OnPlayStream( wxCommandEvent& WXUNUSED(event) ) return; } - if( p_input->stream.control.i_status != PAUSE_S ) + var_Get( p_input, "state", &state ); + + if( state.i_int != PAUSE_S ) { /* A stream is being played, pause it */ - input_SetStatus( p_input, INPUT_STATUS_PAUSE ); - TogglePlayButton( PAUSE_S ); - vlc_object_release( p_playlist ); - vlc_object_release( p_input ); - return; + state.i_int = PAUSE_S; } + else + { + /* Stream is paused, resume it */ + state.i_int = PLAYING_S; + } + var_Set( p_input, "state", state ); - /* Stream is paused, resume it */ - input_SetStatus( p_input, INPUT_STATUS_PLAY ); - TogglePlayButton( PLAYING_S ); + TogglePlayButton( state.i_int ); vlc_object_release( p_input ); vlc_object_release( p_playlist ); } @@ -732,10 +736,10 @@ void Interface::OnSliderUpdate( wxScrollEvent& event ) if( p_intf->p_sys->i_slider_pos != event.GetPosition() && p_intf->p_sys->p_input ) { - p_intf->p_sys->i_slider_pos = event.GetPosition(); - input_Seek( p_intf->p_sys->p_input, p_intf->p_sys->i_slider_pos * - 100 / SLIDER_MAX_POS, - INPUT_SEEK_PERCENT | INPUT_SEEK_SET ); + vlc_value_t pos; + pos.f_float = (float)event.GetPosition() / (float)SLIDER_MAX_POS; + + var_Set( p_intf->p_sys->p_input, "position", pos ); } #ifdef WIN32 @@ -835,7 +839,9 @@ void Interface::OnSlowStream( wxCommandEvent& WXUNUSED(event) ) FIND_ANYWHERE ); if( p_input ) { - input_SetStatus( p_input, INPUT_STATUS_SLOWER ); + vlc_value_t val; val.b_bool = VLC_TRUE; + + var_Set( p_input, "rate-slower", val ); vlc_object_release( p_input ); } } @@ -847,7 +853,9 @@ void Interface::OnFastStream( wxCommandEvent& WXUNUSED(event) ) FIND_ANYWHERE ); if( p_input ) { - input_SetStatus( p_input, INPUT_STATUS_FASTER ); + vlc_value_t val; val.b_bool = VLC_TRUE; + + var_Set( p_input, "rate-faster", val ); vlc_object_release( p_input ); } } diff --git a/modules/gui/wxwindows/messages.cpp b/modules/gui/wxwindows/messages.cpp index 0b30c5b723..9328275cc8 100644 --- a/modules/gui/wxwindows/messages.cpp +++ b/modules/gui/wxwindows/messages.cpp @@ -2,7 +2,7 @@ * playlist.cpp : wxWindows plugin for vlc ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: messages.cpp,v 1.15 2003/08/30 16:34:12 gbazin Exp $ + * $Id: messages.cpp,v 1.16 2003/09/07 22:53:09 fenrir Exp $ * * Authors: Olivier Teulière * @@ -70,6 +70,7 @@ Messages::Messages( intf_thread_t *_p_intf, wxWindow *p_parent ): b_verbose = VLC_FALSE; SetIcon( *p_intf->p_sys->p_icon ); save_log_dialog = NULL; + b_verbose = VLC_FALSE; /* Create a panel to put everything in */ wxPanel *messages_panel = new wxPanel( this, -1 ); diff --git a/modules/gui/wxwindows/timer.cpp b/modules/gui/wxwindows/timer.cpp index 17def5be0a..1b07d2f7c8 100644 --- a/modules/gui/wxwindows/timer.cpp +++ b/modules/gui/wxwindows/timer.cpp @@ -2,7 +2,7 @@ * timer.cpp : wxWindows plugin for vlc ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: timer.cpp,v 1.31 2003/08/28 15:59:04 gbazin Exp $ + * $Id: timer.cpp,v 1.32 2003/09/07 22:53:09 fenrir Exp $ * * Authors: Gildas Bazin * @@ -36,7 +36,7 @@ #include "wxwindows.h" #include -void DisplayStreamDate( wxControl *, intf_thread_t *, int ); +//void DisplayStreamDate( wxControl *, intf_thread_t *, int ); /* Callback prototype */ static int PopupMenuCB( vlc_object_t *p_this, const char *psz_variable, @@ -171,25 +171,32 @@ void Timer::Notify() /* Manage the slider */ if( p_input->stream.b_seekable && p_intf->p_sys->b_playing ) { - stream_position_t position; - /* Update the slider if the user isn't dragging it. */ if( p_intf->p_sys->b_slider_free ) { + vlc_value_t pos; + char psz_time[ OFFSETTOTIME_MAX_SIZE ]; + vlc_value_t time; + mtime_t i_seconds; + /* Update the value */ - vlc_mutex_unlock( &p_input->stream.stream_lock ); - input_Tell( p_input, &position ); - vlc_mutex_lock( &p_input->stream.stream_lock ); - if( position.i_size ) + var_Get( p_input, "position", &pos ); + if( pos.f_float >= 0.0 ) { - p_intf->p_sys->i_slider_pos = - ( SLIDER_MAX_POS * position.i_tell ) / position.i_size; + p_intf->p_sys->i_slider_pos = (int)(SLIDER_MAX_POS * pos.f_float); + + p_main_interface->slider->SetValue( p_intf->p_sys->i_slider_pos ); + + var_Get( p_intf->p_sys->p_input, "time", &time ); + i_seconds = time.i_time / 1000000; - p_main_interface->slider->SetValue( - p_intf->p_sys->i_slider_pos ); + sprintf( psz_time, "%d:%02d:%02d", + (int) (i_seconds / (60 * 60)), + (int) (i_seconds / 60 % 60), + (int) (i_seconds % 60) ); - DisplayStreamDate( p_main_interface->slider_box,p_intf, - p_intf->p_sys->i_slider_pos ); + + p_main_interface->slider_box->SetLabel(wxU( psz_time ) ); } } } @@ -239,28 +246,6 @@ void Timer::Notify() vlc_mutex_unlock( &p_intf->change_lock ); } -/***************************************************************************** - * DisplayStreamDate: display stream date - ***************************************************************************** - * This function displays the current date related to the position in - * the stream. It is called whenever the slider changes its value. - * The lock has to be taken before you call the function. - *****************************************************************************/ -void DisplayStreamDate( wxControl *p_slider_frame, intf_thread_t * p_intf , - int i_pos ) -{ - if( p_intf->p_sys->p_input ) - { -#define p_area p_intf->p_sys->p_input->stream.p_selected_area - char psz_time[ OFFSETTOTIME_MAX_SIZE ]; - - p_slider_frame->SetLabel( - wxU(input_OffsetToTime( p_intf->p_sys->p_input, - psz_time, p_area->i_size * i_pos / SLIDER_MAX_POS )) ); -#undef p_area - } -} - /***************************************************************************** * PopupMenuCB: callback triggered by the intf-popupmenu playlist variable. * We don't show the menu directly here because we don't want the diff --git a/modules/misc/dummy/input.c b/modules/misc/dummy/input.c index de4aa61359..7771be7280 100644 --- a/modules/misc/dummy/input.c +++ b/modules/misc/dummy/input.c @@ -2,7 +2,7 @@ * input_dummy.c: dummy input plugin, to manage "vlc:***" special options ***************************************************************************** * Copyright (C) 2001, 2002 VideoLAN - * $Id: input.c,v 1.3 2003/04/16 11:47:08 gbazin Exp $ + * $Id: input.c,v 1.4 2003/09/07 22:53:09 fenrir Exp $ * * Authors: Samuel Hocevar * @@ -78,10 +78,11 @@ int E_(OpenDemux) ( vlc_object_t *p_this ) int i_len = strlen( psz_name ); struct demux_sys_t * p_method; int i_arg; - + p_input->stream.b_seekable = 0; p_input->pf_demux = Demux; p_input->pf_rewind = NULL; + p_input->pf_demux_control = demux_vaControlDefault; p_method = malloc( sizeof( struct demux_sys_t ) ); if( p_method == NULL ) diff --git a/modules/stream_out/Modules.am b/modules/stream_out/Modules.am index eb58d74bf6..6f6925aa2d 100644 --- a/modules/stream_out/Modules.am +++ b/modules/stream_out/Modules.am @@ -5,3 +5,4 @@ SOURCES_stream_out_transcode = transcode.c SOURCES_stream_out_duplicate = duplicate.c SOURCES_stream_out_es = es.c SOURCES_stream_out_display = display.c +SOURCES_stream_out_gather = gather.c