/*****************************************************************************
* 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>
QToolButton *updateButton;
+ b_userAction = true;
+
QGridLayout *mainLayout = new QGridLayout( this );
/* AV sync */
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 );
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 );
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 );
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() );
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 );
}
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;
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;
case InterfaceVoutUpdate_Type:
UpdateVout();
break;
+ case SynchroChanged_Type:
+ emit synchroChanged();
+ break;
default:
msg_Warn( p_intf, "This shouldn't happen: %i", i_type );
}
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: