]> git.sesse.net Git - vlc/commitdiff
* control: use new variables and 'title*', 'chapter*' ones.
authorLaurent Aimar <fenrir@videolan.org>
Sun, 7 Sep 2003 22:53:09 +0000 (22:53 +0000)
committerLaurent Aimar <fenrir@videolan.org>
Sun, 7 Sep 2003 22:53:09 +0000 (22:53 +0000)
 * 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 :)

modules/control/rc/rc.c
modules/gui/beos/InterfaceWindow.cpp
modules/gui/beos/MediaControlView.cpp
modules/gui/beos/VlcWrapper.cpp
modules/gui/wxwindows/interface.cpp
modules/gui/wxwindows/messages.cpp
modules/gui/wxwindows/timer.cpp
modules/misc/dummy/input.c
modules/stream_out/Modules.am

index 4d2530a000560ed3c51cad013ef06709de8a85c5..9d9560ea869c7deef5bb923cd2607c0630cc5cad 100644 (file)
@@ -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 <shurdeek@panorama.sth.ac.at>
  *
@@ -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;
index d0bce6bd29e0996f2b01b588eb38a306b4266145..66868474662c35091d72cb6adcb192305f71180a 100644 (file)
@@ -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 <polux@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -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();
    
index 4e0624eb0d5280b1d9c5292ef5763822cc7879c1..9aba3b7ae6cc0775ee56bbd53ee1426709c8be65 100644 (file)
@@ -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 <tony@castley.net>
  *          Stephan Aßmus <stippi@yellowbites.com>
@@ -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;
index 8accd59383a2b9440cb7a631684f4bd2e9ebd519..b1bdf8fd8a83990612bc30a574ba4cd429138a2f 100644 (file)
@@ -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 <fgp@phlo.org>
  *          Jon Lech Johansen <jon-vl@nanocrew.net>
@@ -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;
                }
index a2c23fd5379c2ab3fe770437efaecd01590789f8..aeeefc53c80b10a9dd9a88149b3847321e0b70b0 100644 (file)
@@ -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 <gbazin@netcourrier.com>
  *
@@ -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 );
     }
 }
index 0b30c5b7233fba95e2e4c4b9279a6a8d5e21abfb..9328275cc89f6638e80ec34101eb67614bc7a76b 100644 (file)
@@ -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 <ipkiss@via.ecp.fr>
  *
@@ -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 );
index 17def5be0ad6e8a519e93c513f5e2332724f1ef7..1b07d2f7c8d9fe1f3f84e71c1d63ed0ed933b0c1 100644 (file)
@@ -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 <gbazin@netcourrier.com>
  *
@@ -36,7 +36,7 @@
 #include "wxwindows.h"
 #include <wx/timer.h>
 
-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
index de4aa613594e5a8b3bfc6aa82aa9291ea065fee1..7771be72802c9c2ee923747f1da89cca552ff82f 100644 (file)
@@ -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 <sam@zoy.org>
  *
@@ -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 )
index eb58d74bf66d36c0251e9a4ae817733ae58eaa21..6f6925aa2d51dd2c3eff057dd5f750c4e4a78b40 100644 (file)
@@ -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