]> git.sesse.net Git - vlc/commitdiff
* all: rework of the input.
authorLaurent Aimar <fenrir@videolan.org>
Tue, 22 Jun 2004 19:34:20 +0000 (19:34 +0000)
committerLaurent Aimar <fenrir@videolan.org>
Tue, 22 Jun 2004 19:34:20 +0000 (19:34 +0000)
modules/gui/ncurses.c
modules/gui/wxwindows/bookmarks.cpp
modules/gui/wxwindows/dialogs.cpp
modules/gui/wxwindows/fileinfo.cpp
modules/gui/wxwindows/interface.cpp
modules/gui/wxwindows/timer.cpp
modules/gui/wxwindows/video.cpp

index 2bfadfb36236dd3ee6ab9f5c78b346e3c16a6bc1..362109b74989fc465e940c9d38284474fe403b81 100644 (file)
@@ -1018,7 +1018,8 @@ static void Redraw ( intf_thread_t *p_intf, time_t *t_last_refresh )
         vlc_value_t val_list;
 
         /* Source */
-        mvnprintw( y++, 0, COLS, " Source   : %s", p_input->psz_source );
+        mvnprintw( y++, 0, COLS, " Source   : %s",
+                   p_input->input.p_item->psz_uri );
 
         /* State */
         var_Get( p_input, "state", &val );
@@ -1173,10 +1174,10 @@ static void Redraw ( intf_thread_t *p_intf, time_t *t_last_refresh )
         if( p_input )
         {
             int i,j;
-            vlc_mutex_lock( &p_input->p_item->lock );
-            for ( i = 0; i < p_input->p_item->i_categories; i++ )
+            vlc_mutex_lock( &p_input->input.p_item->lock );
+            for ( i = 0; i < p_input->input.p_item->i_categories; i++ )
             {
-                info_category_t *p_category = p_input->p_item->pp_categories[i];
+                info_category_t *p_category = p_input->input.p_item->pp_categories[i];
                 if( y >= y_end ) break;
                 MainBoxWrite( p_intf, l++, 1, "  [%s]", p_category->psz_name );
                 for ( j = 0; j < p_category->i_infos; j++ )
@@ -1186,7 +1187,7 @@ static void Redraw ( intf_thread_t *p_intf, time_t *t_last_refresh )
                     MainBoxWrite( p_intf, l++, 1, "      %s: %s", p_info->psz_name, p_info->psz_value );
                 }
             }
-            vlc_mutex_unlock( &p_input->p_item->lock );
+            vlc_mutex_unlock( &p_input->input.p_item->lock );
         }
         else
         {
index 9dbd58463bf9da03828efb262bc3b7a00c03566e..4548457021708c8678a53722d5690577cc36c228 100644 (file)
@@ -340,14 +340,25 @@ void BookmarksDialog::OnAdd( wxCommandEvent& event )
 
     seekpoint_t bookmark;
     vlc_value_t pos;
+    bookmark.psz_name = NULL;
+    bookmark.i_byte_offset = 0;
+    bookmark.i_time_offset = 0;
+
+
+    /* FIXME --fenrir
+     * - stream_Tell can't be use (not reentrant)
+     * - nobody except src/input/ could touch p_input
+     *   -> create new INPUT_CONTROL ...
+     */
+#if 0
     var_Get( p_input, "position", &pos );
     bookmark.psz_name = NULL;
-    bookmark.i_byte_offset =
-      (int64_t)((double)pos.f_float * p_input->stream.p_selected_area->i_size);
+    bookmark.i_byte_offset = stream_Tell( p_input->input.p_stream );
+      (int64_t)((double)pos.f_float * p_input->input.p_access->info.i_size);
     var_Get( p_input, "time", &pos );
     bookmark.i_time_offset = pos.i_time;
     input_Control( p_input, INPUT_ADD_BOOKMARK, &bookmark );
-
+#endif
     vlc_object_release( p_input );
 
     Update();
@@ -424,7 +435,7 @@ void BookmarksDialog::OnExtract( wxCommandEvent& event )
     if( i_first < i_bookmarks && i_second <= i_bookmarks )
     {
         WizardDialog *p_wizard_dialog = new WizardDialog( p_intf, this,
-                               p_input->p_item->psz_uri,
+                               p_input->input.p_item->psz_uri,
                                pp_bookmarks[i_first]->i_time_offset/1000000,
                                pp_bookmarks[i_second]->i_time_offset/1000000 );
         vlc_object_release( p_input );
index d0ec7dec037aa05df557d0a3141696b9b56a12d5..2d06ba3ac27097639b7c0d8e1605b583af7f433a 100644 (file)
@@ -32,7 +32,6 @@
 #include <vlc/vlc.h>
 #include <vlc/aout.h>
 #include <vlc/intf.h>
-#include "stream_control.h"
 
 #include "wxwindows.h"
 
index fe30bf1601f1b0a2cbb43eee4468509207fd5f44..f0cdb34d0dfdcbeb246c7a10e1732307cda7cc31 100644 (file)
@@ -87,7 +87,7 @@ void FileInfo::UpdateFileInfo()
 {
     input_thread_t *p_input = p_intf->p_sys->p_input;
 
-    if( !p_input || p_input->b_dead || !p_input->psz_name )
+    if( !p_input || p_input->b_dead || p_input->input.p_item->psz_name )
     {
         if( fileinfo_root )
         {
@@ -103,22 +103,22 @@ void FileInfo::UpdateFileInfo()
          * retrieved with the GetItemText() method, but it doesn't work on
          * Windows when the wxTR_HIDE_ROOT style is set. That's why we need to
          * use the fileinfo_root_label variable... */
-        fileinfo_root = fileinfo_tree->AddRoot( wxL2U(p_input->psz_name) );
-        fileinfo_root_label = wxL2U(p_input->psz_name);
+        fileinfo_root = fileinfo_tree->AddRoot( wxL2U(p_input->input.p_item->psz_name) );
+        fileinfo_root_label = wxL2U(p_input->input.p_item->psz_name);
     }
-    else if( fileinfo_root_label == wxL2U(p_input->psz_name) )
+    else if( fileinfo_root_label == wxL2U(p_input->input.p_item->psz_name) )
     {
         return;
     }
 
     /* We rebuild the tree from scratch */
     fileinfo_tree->DeleteChildren( fileinfo_root );
-    fileinfo_root_label = wxL2U(p_input->psz_name);
+    fileinfo_root_label = wxL2U(p_input->input.p_item->psz_name);
 
-    vlc_mutex_lock( &p_input->p_item->lock );
-    for( int i = 0; i < p_input->p_item->i_categories; i++ )
+    vlc_mutex_lock( &p_input->input.p_item->lock );
+    for( int i = 0; i < p_input->input.p_item->i_categories; i++ )
     {
-        info_category_t *p_cat = p_input->p_item->pp_categories[i];
+        info_category_t *p_cat = p_input->input.p_item->pp_categories[i];
 
         wxTreeItemId cat = fileinfo_tree->AppendItem( fileinfo_root,
                                                       wxL2U(p_cat->psz_name) );
@@ -131,7 +131,7 @@ void FileInfo::UpdateFileInfo()
         }
         fileinfo_tree->Expand( cat );
     }
-    vlc_mutex_unlock( &p_input->p_item->lock );
+    vlc_mutex_unlock( &p_input->input.p_item->lock );
 
     return;
 }
index 34c85516bd603ad3efe1f748836dc65af9a0f842..dbe90e1e97ac11f8ff2300c1bfb54d280101da94 100644 (file)
@@ -28,7 +28,6 @@
 #include <vlc/aout.h>
 #include <vlc/vout.h>
 #include <vlc/intf.h>
-#include "stream_control.h"
 
 #include "wxwindows.h"
 
@@ -1259,7 +1258,8 @@ void Interface::OnPrevStream( wxCommandEvent& WXUNUSED(event) )
         return;
     }
 
-    vlc_mutex_lock( &p_playlist->object_lock );
+    /* FIXME --fenrir */
+#if 0
     if( p_playlist->p_input != NULL )
     {
         vlc_mutex_lock( &p_playlist->p_input->stream.stream_lock );
@@ -1272,6 +1272,7 @@ void Interface::OnPrevStream( wxCommandEvent& WXUNUSED(event) )
             vlc_mutex_unlock( &p_playlist->p_input->stream.stream_lock );
     }
     vlc_mutex_unlock( &p_playlist->object_lock );
+#endif
 
     playlist_Prev( p_playlist );
     vlc_object_release( p_playlist );
@@ -1287,6 +1288,9 @@ void Interface::OnNextStream( wxCommandEvent& WXUNUSED(event) )
         return;
     }
 
+    /* FIXME --fenrir */
+#if 0
+    var_Change( p_input, "title", VLC_VAR_CHOICESCOUNT, &val, NULL );
     vlc_mutex_lock( &p_playlist->object_lock );
     if( p_playlist->p_input != NULL )
     {
@@ -1302,7 +1306,7 @@ void Interface::OnNextStream( wxCommandEvent& WXUNUSED(event) )
             vlc_mutex_unlock( &p_playlist->p_input->stream.stream_lock );
     }
     vlc_mutex_unlock( &p_playlist->object_lock );
-
+#endif
     playlist_Next( p_playlist );
     vlc_object_release( p_playlist );
 }
index 28fd9f36629e9f04c729bc49951c61f53cbd0793..3d88da14a7f11f23a9b8fa1377583cf1458fed36 100644 (file)
@@ -50,7 +50,7 @@ Timer::Timer( intf_thread_t *_p_intf, Interface *_p_main_interface )
     p_intf = _p_intf;
     p_main_interface = _p_main_interface;
     i_old_playing_status = PAUSE_S;
-    i_old_rate = DEFAULT_RATE;
+    i_old_rate = INPUT_RATE_DEFAULT;
 
     /* Register callback for the intf-popupmenu variable */
     playlist_t *p_playlist =
@@ -106,7 +106,7 @@ void Timer::Notify()
             b_old_seekable = VLC_FALSE;
 
             p_main_interface->statusbar->SetStatusText(
-                wxU(p_intf->p_sys->p_input->p_item->psz_name), 2 );
+                wxU(p_intf->p_sys->p_input->input.p_item->psz_name), 2 );
 
             p_main_interface->TogglePlayButton( PLAYING_S );
             i_old_playing_status = PLAYING_S;
@@ -135,15 +135,71 @@ void Timer::Notify()
     if( p_intf->p_sys->p_input )
     {
         input_thread_t *p_input = p_intf->p_sys->p_input;
-
-        vlc_mutex_lock( &p_input->stream.stream_lock );
+        vlc_value_t val;
 
         if( !p_input->b_die )
         {
+            vlc_value_t pos;
+
             /* New input or stream map change */
             p_intf->p_sys->b_playing = 1;
 
             /* Manage the slider */
+            /* FIXME --fenrir */
+            /* Change the name of b_old_seekable into b_show_bar or something like that */
+            var_Get( p_input, "position", &pos );
+
+            if( !b_old_seekable )
+            {
+                if( pos.f_float > 0.0 )
+                {
+                    /* Done like this, as it's the only way to know if the slider
+                     * has to be displayed */
+                    b_old_seekable = VLC_TRUE;
+                    p_main_interface->slider_frame->Show();
+                    p_main_interface->frame_sizer->Show(
+                        p_main_interface->slider_frame );
+                    p_main_interface->frame_sizer->Layout();
+                    p_main_interface->frame_sizer->Fit( p_main_interface );
+
+                }
+            }
+
+            if( p_intf->p_sys->b_playing && b_old_seekable )
+            {
+                /* Update the slider if the user isn't dragging it. */
+                if( p_intf->p_sys->b_slider_free )
+                {
+                    char psz_time[ MSTRTIME_MAX_SIZE ];
+                    char psz_total[ MSTRTIME_MAX_SIZE ];
+                    vlc_value_t time;
+                    mtime_t i_seconds;
+
+                    /* Update the value */
+                    if( pos.f_float >= 0.0 )
+                    {
+                        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;
+                        secstotimestr ( psz_time, i_seconds );
+
+                        var_Get( p_intf->p_sys->p_input, "length",  &time );
+                        i_seconds = time.i_time / 1000000;
+                        secstotimestr ( psz_total, i_seconds );
+
+                        p_main_interface->statusbar->SetStatusText(
+                            wxU(psz_time) + wxString(wxT(" / ")) +
+                            wxU(psz_total), 0 );
+                    }
+                }
+            }
+#if 0
+        vlc_mutex_lock( &p_input->stream.stream_lock );
             if( p_intf->p_sys->p_input->stream.b_seekable && !b_old_seekable )
             {
                 /* Done like this because b_seekable is set slightly after
@@ -190,14 +246,16 @@ void Timer::Notify()
                     }
                 }
             }
-
+        vlc_mutex_unlock( &p_input->stream.stream_lock );
+#endif
             /* Take care of the volume, etc... */
             p_main_interface->Update();
 
             /* Manage Playing status */
-            if( i_old_playing_status != p_input->stream.control.i_status )
+            var_Get( p_input, "state", &val );
+            if( i_old_playing_status != val.i_int )
             {
-                if( p_input->stream.control.i_status == PAUSE_S )
+                if( val.i_int == PAUSE_S )
                 {
                     p_main_interface->TogglePlayButton( PAUSE_S );
                 }
@@ -205,20 +263,20 @@ void Timer::Notify()
                 {
                     p_main_interface->TogglePlayButton( PLAYING_S );
                 }
-                i_old_playing_status = p_input->stream.control.i_status;
+                i_old_playing_status = val.i_int;
             }
 
             /* Manage Speed status */
-            if( i_old_rate != p_input->stream.control.i_rate )
+            var_Get( p_input, "rate", &val );
+            if( i_old_rate != val.i_int )
             {
                 p_main_interface->statusbar->SetStatusText(
                     wxString::Format(wxT("x%.2f"),
-                    1000.0 / p_input->stream.control.i_rate), 1 );
-                i_old_rate = p_input->stream.control.i_rate;
+                    (float)INPUT_RATE_DEFAULT / val.i_int ), 1 );
+                i_old_rate = val.i_int;
             }
         }
 
-        vlc_mutex_unlock( &p_input->stream.stream_lock );
     }
     else if( p_intf->p_sys->b_playing && !p_intf->b_die )
     {
index fd5f65f2bbf0d9b3bf257816a7d515f27faef237..fcf317d60ac7a2c8ff098cd2126292ffa725f5da 100644 (file)
@@ -27,7 +27,6 @@
 #include <vlc/vlc.h>
 #include <vlc/vout.h>
 #include <vlc/intf.h>
-#include "stream_control.h"
 
 #include "wxwindows.h"