]> git.sesse.net Git - vlc/commitdiff
Qt4 - We DO need pulling for the stats in MediaInfo Dialog... Revert part of 23590.
authorJean-Baptiste Kempf <jb@videolan.org>
Fri, 21 Dec 2007 19:59:39 +0000 (19:59 +0000)
committerJean-Baptiste Kempf <jb@videolan.org>
Fri, 21 Dec 2007 19:59:39 +0000 (19:59 +0000)
modules/gui/qt4/dialogs/mediainfo.cpp
modules/gui/qt4/dialogs/mediainfo.hpp

index 328bb9f84524e2aa8b72578c4e7970cbc6da4b08..40dcc28111d57610cf207427a7fdd3dc10e24d6e 100644 (file)
@@ -42,6 +42,7 @@ MediaInfoDialog::MediaInfoDialog( intf_thread_t *_p_intf,
 {
     p_item = _p_item;
     b_cleaned = true;
+    i_runs = 0;
 
     setWindowTitle( qtr( "Media information" ) );
     resize( 600 , 480 );
@@ -92,7 +93,9 @@ MediaInfoDialog::MediaInfoDialog( intf_thread_t *_p_intf,
 
     /* Call update by hand, so info is shown from current item too */
     if( THEMIM->getInput() )
-        update( input_GetItem(THEMIM->getInput()), true, true );
+        update( input_GetItem(THEMIM->getInput() ), true, true );
+    if( stats )
+        ON_TIMEOUT( updateOnTimeOut() );
 }
 
 MediaInfoDialog::~MediaInfoDialog()
@@ -138,6 +141,23 @@ void MediaInfoDialog::update( input_thread_t *p_input )
     vlc_object_release( p_input );
 }
 
+void MediaInfoDialog::updateOnTimeOut() 
+{
+    /* Timer runs at 150 ms, dont' update more than 2 times per second */ 
+    i_runs++; 
+    if( i_runs % 4 != 0 ) return; 
+
+    /* Get Input and clear if non-existant */ 
+    input_thread_t *p_input = THEMIM->getInput(); 
+
+    if( p_input && !p_input->b_dead )
+    {
+        vlc_object_yield( p_input );
+        update( input_GetItem(p_input), false, false);
+        vlc_object_release( p_input );
+    }
+}
+
 void MediaInfoDialog::update( input_item_t *p_item,
                               bool update_info,
                               bool update_meta )
index d99c0d58283574b0ce206216bb68ffcef658da19..a9ee843af90e084e5768617629ddb6cc70727ba9 100644 (file)
@@ -70,6 +70,7 @@ private:
     bool mainInput;
     bool stats;
     bool b_cleaned;
+    int i_runs;
 
     QTabWidget *IT;
     InputStatsPanel *ISP;
@@ -85,6 +86,7 @@ public slots:
     void update( input_item_t *, bool, bool );
 
 private slots:
+    void updateOnTimeOut();
     void close();
     void clear();
     void saveMeta();