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
****************************************************************************
* 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 );
}
......
......@@ -156,6 +156,9 @@ private:
QDoubleSpinBox *AVSpin;
QDoubleSpinBox *subsSpin;
QDoubleSpinBox *subSpeedSpin;
bool b_userAction;
void clean();
public slots:
void update();
......
......@@ -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:
......
......@@ -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
......
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