[vlc-devel] commit: Qt: connect the delay of ES to the extended panels. ( Jean-Baptiste Kempf )

git version control git at videolan.org
Fri Jan 2 16:03:04 CET 2009


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Fri Jan  2 13:20:00 2009 +0100| [f5bf2d945d431e7ded31b926e21f6540875aee26] | committer: Jean-Baptiste Kempf 

Qt: connect the delay of ES to the extended panels.

Don't loopback the audio-delay and spu-delay.
Now it finally seem to be working.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f5bf2d945d431e7ded31b926e21f6540875aee26
---

 modules/gui/qt4/components/extended_panels.cpp |   33 ++++++++++++++---------
 modules/gui/qt4/components/extended_panels.hpp |    3 ++
 modules/gui/qt4/input_manager.cpp              |   16 ++++++++---
 modules/gui/qt4/input_manager.hpp              |    5 +++-
 4 files changed, 39 insertions(+), 18 deletions(-)

diff --git a/modules/gui/qt4/components/extended_panels.cpp b/modules/gui/qt4/components/extended_panels.cpp
index 181c5ab..ccae230 100644
--- a/modules/gui/qt4/components/extended_panels.cpp
+++ b/modules/gui/qt4/components/extended_panels.cpp
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * extended_panels.cpp : Extended controls panels
  ****************************************************************************
- * Copyright (C) 2006-2007 the VideoLAN team
+ * Copyright (C) 2006-2008 the VideoLAN team
  * $Id$
  *
  * Authors: Clément Stenac <zorglub at videolan.org>
@@ -1266,6 +1266,8 @@ SyncControls::SyncControls( intf_thread_t *_p_intf, QWidget *_parent ) :
 
     QToolButton *updateButton;
 
+    b_userAction = true;
+
     QGridLayout *mainLayout = new QGridLayout( this );
 
     /* AV sync */
@@ -1296,7 +1298,7 @@ SyncControls::SyncControls( intf_thread_t *_p_intf, QWidget *_parent ) :
     AVSpin->setSingleStep( 0.1 );
     AVSpin->setToolTip( qtr( "A positive value means that\n"
                              "the audio is ahead of the video" ) );
-    AVSpin->setSuffix( "s" );
+    AVSpin->setSuffix( " s" );
     AVLayout->addWidget( AVSpin, 0, 2, 1, 1 );
     mainLayout->addWidget( AVBox, 1, 0, 1, 5 );
 
@@ -1329,7 +1331,7 @@ SyncControls::SyncControls( intf_thread_t *_p_intf, QWidget *_parent ) :
     subsSpin->setSingleStep( 0.1 );
     subsSpin->setToolTip( qtr( "A positive value means that\n"
                              "the subtitles are ahead of the video" ) );
-    subsSpin->setSuffix( "s" );
+    subsSpin->setSuffix( " s" );
     subsLayout->addWidget( subsSpin, 0, 2, 1, 1 );
 
 
@@ -1355,6 +1357,7 @@ SyncControls::SyncControls( intf_thread_t *_p_intf, QWidget *_parent ) :
     subSpeedSpin->setMinimum( 1 );
     subSpeedSpin->setMaximum( 100 );
     subSpeedSpin->setSingleStep( 0.2 );
+    subSpeedSpin->setSuffix( " fps" );
     subsLayout->addWidget( subSpeedSpin, 1, 2, 1, 1 );
 
     mainLayout->addWidget( subsBox, 2, 0, 2, 5 );
@@ -1375,6 +1378,8 @@ SyncControls::SyncControls( intf_thread_t *_p_intf, QWidget *_parent ) :
     CONNECT( subsSpin, valueChanged ( double ), this, advanceSubs( double ) ) ;
     CONNECT( subSpeedSpin, valueChanged ( double ),
              this, adjustSubsSpeed( double ) );
+
+    CONNECT( THEMIM->getIM(), synchroChanged(), this, update() );
     BUTTON_SET_ACT_I( updateButton, "", update,
             qtr( "Force update of this dialog's values" ), update() );
 
@@ -1384,48 +1389,50 @@ SyncControls::SyncControls( intf_thread_t *_p_intf, QWidget *_parent ) :
 
 void SyncControls::clean()
 {
+    b_userAction = false;
     AVSpin->setValue( 0.0 );
     subsSpin->setValue( 0.0 );
     subSpeedSpin->setValue( 1.0 );
+    b_userAction = true;
 }
 
 void SyncControls::update()
 {
+    b_userAction = false;
+
     int64_t i_delay;
     if( THEMIM->getInput() )
     {
-        i_delay = var_GetTime( THEMIM->getInput(), "spu-delay" );
-        AVSpin->setValue( ( (double)i_delay ) / 1000000 );
         i_delay = var_GetTime( THEMIM->getInput(), "audio-delay" );
+        AVSpin->setValue( ( (double)i_delay ) / 1000000 );
+        i_delay = var_GetTime( THEMIM->getInput(), "spu-delay" );
         subsSpin->setValue( ( (double)i_delay ) / 1000000 );
         subSpeedSpin->setValue( var_GetFloat( THEMIM->getInput(), "sub-fps" ) );
     }
+    b_userAction = true;
 }
 
 void SyncControls::advanceAudio( double f_advance )
 {
-    if( THEMIM->getInput() )
+    if( THEMIM->getInput() && b_userAction )
     {
-        int64_t i_delay = var_GetTime( THEMIM->getInput(), "audio-delay" );
-        i_delay = f_advance * 1000000;
+        int64_t i_delay = f_advance * 1000000;
         var_SetTime( THEMIM->getInput(), "audio-delay", i_delay );
     }
 }
 
 void SyncControls::advanceSubs( double f_advance )
 {
-    if( THEMIM->getInput() )
+    if( THEMIM->getInput() && b_userAction )
     {
-        int64_t i_delay = var_GetTime( THEMIM->getInput(), "spu-delay" );
-        i_delay = f_advance * 1000000;
+        int64_t i_delay = f_advance * 1000000;
         var_SetTime( THEMIM->getInput(), "spu-delay", i_delay );
-        msg_Dbg( p_intf, "I am advancing subtitles %d", f_advance );
     }
 }
 
 void SyncControls::adjustSubsSpeed( double f_fps )
 {
-    if( THEMIM->getInput() )
+    if( THEMIM->getInput() && b_userAction )
     {
         var_SetFloat( THEMIM->getInput(), "sub-fps", f_fps );
     }
diff --git a/modules/gui/qt4/components/extended_panels.hpp b/modules/gui/qt4/components/extended_panels.hpp
index 41a18d1..3d2f567 100644
--- a/modules/gui/qt4/components/extended_panels.hpp
+++ b/modules/gui/qt4/components/extended_panels.hpp
@@ -156,6 +156,9 @@ private:
     QDoubleSpinBox *AVSpin;
     QDoubleSpinBox *subsSpin;
     QDoubleSpinBox *subSpeedSpin;
+
+    bool b_userAction;
+
     void clean();
 public slots:
     void update();
diff --git a/modules/gui/qt4/input_manager.cpp b/modules/gui/qt4/input_manager.cpp
index cd265df..4ce1dd7 100644
--- a/modules/gui/qt4/input_manager.cpp
+++ b/modules/gui/qt4/input_manager.cpp
@@ -163,7 +163,8 @@ void InputManager::customEvent( QEvent *event )
          i_type != InterfaceVoutUpdate_Type &&
          i_type != MetaChanged_Type &&
          i_type != NameChanged_Type &&
-         i_type != InfoChanged_Type )
+         i_type != InfoChanged_Type &&
+         i_type != SynchroChanged_Type )
         return;
 
     if( !hasInput() ) return;
@@ -177,7 +178,8 @@ void InputManager::customEvent( QEvent *event )
           i_type != InterfaceVoutUpdate_Type &&
           i_type != MetaChanged_Type &&
           i_type != NameChanged_Type &&
-          i_type != InfoChanged_Type
+          i_type != InfoChanged_Type &&
+          i_type != SynchroChanged_Type
         )
         && ( i_input_id != ple->i_id ) )
         return;
@@ -236,6 +238,9 @@ void InputManager::customEvent( QEvent *event )
     case InterfaceVoutUpdate_Type:
         UpdateVout();
         break;
+    case SynchroChanged_Type:
+        emit synchroChanged();
+        break;
     default:
         msg_Warn( p_intf, "This shouldn't happen: %i", i_type );
     }
@@ -804,11 +809,14 @@ static int InputEvent( vlc_object_t *p_this, const char *,
         event = new IMEvent( NameChanged_Type, 0 );
         break;
 
+    case INPUT_EVENT_AUDIO_DELAY:
+    case INPUT_EVENT_SUBTITLE_DELAY:
+        event = new IMEvent( SynchroChanged_Type, 0 );
+        break;
+
     case INPUT_EVENT_PROGRAM:
     case INPUT_EVENT_RECORD:
     case INPUT_EVENT_SIGNAL:
-    case INPUT_EVENT_AUDIO_DELAY:
-    case INPUT_EVENT_SUBTITLE_DELAY:
     case INPUT_EVENT_BOOKMARK:
     case INPUT_EVENT_CACHE:
     default:
diff --git a/modules/gui/qt4/input_manager.hpp b/modules/gui/qt4/input_manager.hpp
index cfb020f..426e090 100644
--- a/modules/gui/qt4/input_manager.hpp
+++ b/modules/gui/qt4/input_manager.hpp
@@ -36,6 +36,7 @@
 #include <QObject>
 #include <QEvent>
 
+
 enum {
     PositionUpdate_Type = QEvent::User + IMEventType + 1,
     ItemChanged_Type,
@@ -46,10 +47,11 @@ enum {
     ItemEsChanged_Type,
     ItemTeletextChanged_Type,
     InterfaceVoutUpdate_Type,
-    StatisticsUpdate_Type,
+    StatisticsUpdate_Type, /*10*/
     MetaChanged_Type,
     NameChanged_Type,
     InfoChanged_Type,
+    SynchroChanged_Type,
 
     FullscreenControlToggle_Type = QEvent::User + IMEventType + 20,
     FullscreenControlShow_Type,
@@ -170,6 +172,7 @@ signals:
     void AtoBchanged( bool, bool );
     /// Vout
     void voutChanged( bool );
+    void synchroChanged();
 };
 
 class MainInputManager : public QObject




More information about the vlc-devel mailing list