]> git.sesse.net Git - vlc/commitdiff
Qt: connect the delay of ES to the extended panels.
authorJean-Baptiste Kempf <jb@videolan.org>
Fri, 2 Jan 2009 12:20:00 +0000 (13:20 +0100)
committerJean-Baptiste Kempf <jb@videolan.org>
Fri, 2 Jan 2009 15:02:04 +0000 (16:02 +0100)
Don't loopback the audio-delay and spu-delay.
Now it finally seem to be working.

modules/gui/qt4/components/extended_panels.cpp
modules/gui/qt4/components/extended_panels.hpp
modules/gui/qt4/input_manager.cpp
modules/gui/qt4/input_manager.hpp

index 181c5abf0b41379712f5c77f773d7fa6d6242f5e..ccae230bffa5a8164549bde6e8663c87b9aaa290 100644 (file)
@@ -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@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 );
     }
index 41a18d1ce012c9c5ffa9c2e94272ac684ee1cb30..3d2f567b33ad078a653d97713bc41397e08f629d 100644 (file)
@@ -156,6 +156,9 @@ private:
     QDoubleSpinBox *AVSpin;
     QDoubleSpinBox *subsSpin;
     QDoubleSpinBox *subSpeedSpin;
+
+    bool b_userAction;
+
     void clean();
 public slots:
     void update();
index cd265dfc20e5c5a1a09fa82fd94270eb4b12a03b..4ce1dd7fcd86db083dd94924cffb63f86f817ca6 100644 (file)
@@ -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:
index cfb020f167a4b8b4e7439021ddac1f0523386115..426e0908134919efd18be554944b4428475f9648 100644 (file)
@@ -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