Commit f5bf2d94 authored by Jean-Baptiste Kempf's avatar 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.
parent 87e6fa63
/***************************************************************************** /*****************************************************************************
* extended_panels.cpp : Extended controls panels * extended_panels.cpp : Extended controls panels
**************************************************************************** ****************************************************************************
* Copyright (C) 2006-2007 the VideoLAN team * Copyright (C) 2006-2008 the VideoLAN team
* $Id$ * $Id$
* *
* Authors: Clément Stenac <zorglub@videolan.org> * Authors: Clément Stenac <zorglub@videolan.org>
...@@ -1266,6 +1266,8 @@ SyncControls::SyncControls( intf_thread_t *_p_intf, QWidget *_parent ) : ...@@ -1266,6 +1266,8 @@ SyncControls::SyncControls( intf_thread_t *_p_intf, QWidget *_parent ) :
QToolButton *updateButton; QToolButton *updateButton;
b_userAction = true;
QGridLayout *mainLayout = new QGridLayout( this ); QGridLayout *mainLayout = new QGridLayout( this );
/* AV sync */ /* AV sync */
...@@ -1296,7 +1298,7 @@ SyncControls::SyncControls( intf_thread_t *_p_intf, QWidget *_parent ) : ...@@ -1296,7 +1298,7 @@ SyncControls::SyncControls( intf_thread_t *_p_intf, QWidget *_parent ) :
AVSpin->setSingleStep( 0.1 ); AVSpin->setSingleStep( 0.1 );
AVSpin->setToolTip( qtr( "A positive value means that\n" AVSpin->setToolTip( qtr( "A positive value means that\n"
"the audio is ahead of the video" ) ); "the audio is ahead of the video" ) );
AVSpin->setSuffix( "s" ); AVSpin->setSuffix( " s" );
AVLayout->addWidget( AVSpin, 0, 2, 1, 1 ); AVLayout->addWidget( AVSpin, 0, 2, 1, 1 );
mainLayout->addWidget( AVBox, 1, 0, 1, 5 ); mainLayout->addWidget( AVBox, 1, 0, 1, 5 );
...@@ -1329,7 +1331,7 @@ SyncControls::SyncControls( intf_thread_t *_p_intf, QWidget *_parent ) : ...@@ -1329,7 +1331,7 @@ SyncControls::SyncControls( intf_thread_t *_p_intf, QWidget *_parent ) :
subsSpin->setSingleStep( 0.1 ); subsSpin->setSingleStep( 0.1 );
subsSpin->setToolTip( qtr( "A positive value means that\n" subsSpin->setToolTip( qtr( "A positive value means that\n"
"the subtitles are ahead of the video" ) ); "the subtitles are ahead of the video" ) );
subsSpin->setSuffix( "s" ); subsSpin->setSuffix( " s" );
subsLayout->addWidget( subsSpin, 0, 2, 1, 1 ); subsLayout->addWidget( subsSpin, 0, 2, 1, 1 );
...@@ -1355,6 +1357,7 @@ SyncControls::SyncControls( intf_thread_t *_p_intf, QWidget *_parent ) : ...@@ -1355,6 +1357,7 @@ SyncControls::SyncControls( intf_thread_t *_p_intf, QWidget *_parent ) :
subSpeedSpin->setMinimum( 1 ); subSpeedSpin->setMinimum( 1 );
subSpeedSpin->setMaximum( 100 ); subSpeedSpin->setMaximum( 100 );
subSpeedSpin->setSingleStep( 0.2 ); subSpeedSpin->setSingleStep( 0.2 );
subSpeedSpin->setSuffix( " fps" );
subsLayout->addWidget( subSpeedSpin, 1, 2, 1, 1 ); subsLayout->addWidget( subSpeedSpin, 1, 2, 1, 1 );
mainLayout->addWidget( subsBox, 2, 0, 2, 5 ); mainLayout->addWidget( subsBox, 2, 0, 2, 5 );
...@@ -1375,6 +1378,8 @@ SyncControls::SyncControls( intf_thread_t *_p_intf, QWidget *_parent ) : ...@@ -1375,6 +1378,8 @@ SyncControls::SyncControls( intf_thread_t *_p_intf, QWidget *_parent ) :
CONNECT( subsSpin, valueChanged ( double ), this, advanceSubs( double ) ) ; CONNECT( subsSpin, valueChanged ( double ), this, advanceSubs( double ) ) ;
CONNECT( subSpeedSpin, valueChanged ( double ), CONNECT( subSpeedSpin, valueChanged ( double ),
this, adjustSubsSpeed( double ) ); this, adjustSubsSpeed( double ) );
CONNECT( THEMIM->getIM(), synchroChanged(), this, update() );
BUTTON_SET_ACT_I( updateButton, "", update, BUTTON_SET_ACT_I( updateButton, "", update,
qtr( "Force update of this dialog's values" ), update() ); qtr( "Force update of this dialog's values" ), update() );
...@@ -1384,48 +1389,50 @@ SyncControls::SyncControls( intf_thread_t *_p_intf, QWidget *_parent ) : ...@@ -1384,48 +1389,50 @@ SyncControls::SyncControls( intf_thread_t *_p_intf, QWidget *_parent ) :
void SyncControls::clean() void SyncControls::clean()
{ {
b_userAction = false;
AVSpin->setValue( 0.0 ); AVSpin->setValue( 0.0 );
subsSpin->setValue( 0.0 ); subsSpin->setValue( 0.0 );
subSpeedSpin->setValue( 1.0 ); subSpeedSpin->setValue( 1.0 );
b_userAction = true;
} }
void SyncControls::update() void SyncControls::update()
{ {
b_userAction = false;
int64_t i_delay; int64_t i_delay;
if( THEMIM->getInput() ) 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" ); 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 ); subsSpin->setValue( ( (double)i_delay ) / 1000000 );
subSpeedSpin->setValue( var_GetFloat( THEMIM->getInput(), "sub-fps" ) ); subSpeedSpin->setValue( var_GetFloat( THEMIM->getInput(), "sub-fps" ) );
} }
b_userAction = true;
} }
void SyncControls::advanceAudio( double f_advance ) void SyncControls::advanceAudio( double f_advance )
{ {
if( THEMIM->getInput() ) if( THEMIM->getInput() && b_userAction )
{ {
int64_t i_delay = var_GetTime( THEMIM->getInput(), "audio-delay" ); int64_t i_delay = f_advance * 1000000;
i_delay = f_advance * 1000000;
var_SetTime( THEMIM->getInput(), "audio-delay", i_delay ); var_SetTime( THEMIM->getInput(), "audio-delay", i_delay );
} }
} }
void SyncControls::advanceSubs( double f_advance ) void SyncControls::advanceSubs( double f_advance )
{ {
if( THEMIM->getInput() ) if( THEMIM->getInput() && b_userAction )
{ {
int64_t i_delay = var_GetTime( THEMIM->getInput(), "spu-delay" ); int64_t i_delay = f_advance * 1000000;
i_delay = f_advance * 1000000;
var_SetTime( THEMIM->getInput(), "spu-delay", i_delay ); 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 ) void SyncControls::adjustSubsSpeed( double f_fps )
{ {
if( THEMIM->getInput() ) if( THEMIM->getInput() && b_userAction )
{ {
var_SetFloat( THEMIM->getInput(), "sub-fps", f_fps ); var_SetFloat( THEMIM->getInput(), "sub-fps", f_fps );
} }
......
...@@ -156,6 +156,9 @@ private: ...@@ -156,6 +156,9 @@ private:
QDoubleSpinBox *AVSpin; QDoubleSpinBox *AVSpin;
QDoubleSpinBox *subsSpin; QDoubleSpinBox *subsSpin;
QDoubleSpinBox *subSpeedSpin; QDoubleSpinBox *subSpeedSpin;
bool b_userAction;
void clean(); void clean();
public slots: public slots:
void update(); void update();
......
...@@ -163,7 +163,8 @@ void InputManager::customEvent( QEvent *event ) ...@@ -163,7 +163,8 @@ void InputManager::customEvent( QEvent *event )
i_type != InterfaceVoutUpdate_Type && i_type != InterfaceVoutUpdate_Type &&
i_type != MetaChanged_Type && i_type != MetaChanged_Type &&
i_type != NameChanged_Type && i_type != NameChanged_Type &&
i_type != InfoChanged_Type ) i_type != InfoChanged_Type &&
i_type != SynchroChanged_Type )
return; return;
if( !hasInput() ) return; if( !hasInput() ) return;
...@@ -177,7 +178,8 @@ void InputManager::customEvent( QEvent *event ) ...@@ -177,7 +178,8 @@ void InputManager::customEvent( QEvent *event )
i_type != InterfaceVoutUpdate_Type && i_type != InterfaceVoutUpdate_Type &&
i_type != MetaChanged_Type && i_type != MetaChanged_Type &&
i_type != NameChanged_Type && i_type != NameChanged_Type &&
i_type != InfoChanged_Type i_type != InfoChanged_Type &&
i_type != SynchroChanged_Type
) )
&& ( i_input_id != ple->i_id ) ) && ( i_input_id != ple->i_id ) )
return; return;
...@@ -236,6 +238,9 @@ void InputManager::customEvent( QEvent *event ) ...@@ -236,6 +238,9 @@ void InputManager::customEvent( QEvent *event )
case InterfaceVoutUpdate_Type: case InterfaceVoutUpdate_Type:
UpdateVout(); UpdateVout();
break; break;
case SynchroChanged_Type:
emit synchroChanged();
break;
default: default:
msg_Warn( p_intf, "This shouldn't happen: %i", i_type ); 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 *, ...@@ -804,11 +809,14 @@ static int InputEvent( vlc_object_t *p_this, const char *,
event = new IMEvent( NameChanged_Type, 0 ); event = new IMEvent( NameChanged_Type, 0 );
break; 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_PROGRAM:
case INPUT_EVENT_RECORD: case INPUT_EVENT_RECORD:
case INPUT_EVENT_SIGNAL: case INPUT_EVENT_SIGNAL:
case INPUT_EVENT_AUDIO_DELAY:
case INPUT_EVENT_SUBTITLE_DELAY:
case INPUT_EVENT_BOOKMARK: case INPUT_EVENT_BOOKMARK:
case INPUT_EVENT_CACHE: case INPUT_EVENT_CACHE:
default: default:
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include <QObject> #include <QObject>
#include <QEvent> #include <QEvent>
enum { enum {
PositionUpdate_Type = QEvent::User + IMEventType + 1, PositionUpdate_Type = QEvent::User + IMEventType + 1,
ItemChanged_Type, ItemChanged_Type,
...@@ -46,10 +47,11 @@ enum { ...@@ -46,10 +47,11 @@ enum {
ItemEsChanged_Type, ItemEsChanged_Type,
ItemTeletextChanged_Type, ItemTeletextChanged_Type,
InterfaceVoutUpdate_Type, InterfaceVoutUpdate_Type,
StatisticsUpdate_Type, StatisticsUpdate_Type, /*10*/
MetaChanged_Type, MetaChanged_Type,
NameChanged_Type, NameChanged_Type,
InfoChanged_Type, InfoChanged_Type,
SynchroChanged_Type,
FullscreenControlToggle_Type = QEvent::User + IMEventType + 20, FullscreenControlToggle_Type = QEvent::User + IMEventType + 20,
FullscreenControlShow_Type, FullscreenControlShow_Type,
...@@ -170,6 +172,7 @@ signals: ...@@ -170,6 +172,7 @@ signals:
void AtoBchanged( bool, bool ); void AtoBchanged( bool, bool );
/// Vout /// Vout
void voutChanged( bool ); void voutChanged( bool );
void synchroChanged();
}; };
class MainInputManager : public QObject class MainInputManager : public QObject
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment