/*****************************************************************************
* extended_panels.cpp : Extended controls panels
****************************************************************************
- * Copyright ( C ) 2006-2007 the VideoLAN team
+ * Copyright (C) 2006-2007 the VideoLAN team
* $Id$
*
* Authors: Clément Stenac <zorglub@videolan.org>
#include "dialogs/preferences.hpp"
#include "dialogs_provider.hpp"
#include "qt4.hpp"
+#include "input_manager.hpp"
#include "../../audio_filter/equalizer_presets.h"
#include <vlc_aout.h>
#include <vlc_vout.h>
#include <vlc_osd.h>
-#include <iostream>
-#include <string.h>
#if 0
class ConfClickHandler : public QObject
SETUP_VFILTER_OPTION( wallRowsSpin, valueChanged( int ) )
SETUP_VFILTER_OPTION( wallColsSpin, valueChanged( int ) )
+ SETUP_VFILTER( panoramix )
+ SETUP_VFILTER_OPTION( panoramixRowsSpin, valueChanged( int ) )
+ SETUP_VFILTER_OPTION( panoramixColsSpin, valueChanged( int ) )
+
+
SETUP_VFILTER( erase )
SETUP_VFILTER_OPTION( eraseMaskText, editingFinished() )
SETUP_VFILTER_OPTION( eraseYSpin, valueChanged( int ) )
#undef SETUP_VFILTER
#undef SETUP_VFILTER_OPTION
+
+ CONNECT( ui.cropTopPx, valueChanged( int ), this, cropChange() );
+ CONNECT( ui.cropBotPx, valueChanged( int ), this, cropChange() );
+ CONNECT( ui.cropLeftPx, valueChanged( int ), this, cropChange() );
+ CONNECT( ui.cropRightPx, valueChanged( int ), this, cropChange() );
+ CONNECT( ui.topBotCropSync, toggled( bool ),
+ ui.cropBotPx, setDisabled( bool ) );
+ CONNECT( ui.leftRightCropSync, toggled( bool ),
+ ui.cropRightPx, setDisabled( bool ) );
}
ExtVideo::~ExtVideo()
{
}
+void ExtVideo::cropChange()
+{
+ p_vout = ( vout_thread_t * )vlc_object_find( p_intf,
+ VLC_OBJECT_VOUT, FIND_CHILD );
+ if( p_vout )
+ {
+ var_SetInteger( p_vout, "crop-top", ui.cropTopPx->value() );
+ var_SetInteger( p_vout, "crop-bottom", ui.cropBotPx->value() );
+ var_SetInteger( p_vout, "crop-left", ui.cropLeftPx->value() );
+ var_SetInteger( p_vout, "crop-right", ui.cropRightPx->value() );
+ }
+}
+
void ExtVideo::ChangeVFiltersString( char *psz_name, vlc_bool_t b_add )
{
- vout_thread_t *p_vout;
char *psz_parser, *psz_string;
const char *psz_filter_type;
}
else
{
- psz_af = config_GetPsz( p_aout, "audio-filter" );
+ psz_af = config_GetPsz( p_intf, "audio-filter" );
for( int i = 0; i < NUM_SP_CTRL ; i++ )
{
controlVars[i] = config_GetFloat( p_intf, psz_control_names[i] );
// var_AddCallback( p_aout, "Spatializer-preamp", EqzCallback, this );
}
+#include <QToolButton>
+#include <QGridLayout>
+
+SyncControls::SyncControls( intf_thread_t *_p_intf, QWidget *_parent ) :
+ QWidget( _parent ) , p_intf( _p_intf )
+{
+ QGroupBox *AVBox, *subsBox;
+
+ QToolButton *moinsAV, *plusAV;
+ QToolButton *moinssubs, *plussubs;
+ QToolButton *moinssubSpeed, *plussubSpeed;
+
+ QToolButton *updateButton;
+
+ QGridLayout *mainLayout = new QGridLayout( this );
+
+ /* AV sync */
+ AVBox = new QGroupBox( qtr( "Audio/Video" ) );
+ QGridLayout *AVLayout = new QGridLayout( AVBox );
+
+ moinsAV = new QToolButton;
+ moinsAV->setToolButtonStyle( Qt::ToolButtonTextOnly );
+ moinsAV->setAutoRaise( true );
+ moinsAV->setText( "-" );
+ AVLayout->addWidget( moinsAV, 0, 1, 1, 1 );
+
+ plusAV = new QToolButton;
+ plusAV->setToolButtonStyle( Qt::ToolButtonTextOnly );
+ plusAV->setAutoRaise( true );
+ plusAV->setText( "+" );
+ AVLayout->addWidget( plusAV, 0, 3, 1, 1 );
+
+ QLabel *AVLabel = new QLabel;
+ AVLabel->setText( qtr( "Advance of audio over video:" ) );
+ AVLayout->addWidget( AVLabel, 0, 0, 1, 1 );
+
+ AVSpin = new QDoubleSpinBox;
+ AVSpin->setAlignment( Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter );
+ AVSpin->setDecimals( 3 );
+ AVSpin->setMinimum( -100 );
+ AVSpin->setMaximum( 100 );
+ AVSpin->setSingleStep( 0.1 );
+ AVSpin->setToolTip( qtr( "A positive value means that\n"
+ "the audio is ahead of the video" ) );
+ AVSpin->setSuffix( "s" );
+ AVLayout->addWidget( AVSpin, 0, 2, 1, 1 );
+ mainLayout->addWidget( AVBox, 1, 0, 1, 5 );
+
+
+ /* Subs */
+ subsBox = new QGroupBox( qtr( "Subtitles/Video" ) );
+ QGridLayout *subsLayout = new QGridLayout( subsBox );
+
+ moinssubs = new QToolButton;
+ moinssubs->setToolButtonStyle( Qt::ToolButtonTextOnly );
+ moinssubs->setAutoRaise( true );
+ moinssubs->setText( "-" );
+ subsLayout->addWidget( moinssubs, 0, 1, 1, 1 );
+
+ plussubs = new QToolButton;
+ plussubs->setToolButtonStyle( Qt::ToolButtonTextOnly );
+ plussubs->setAutoRaise( true );
+ plussubs->setText( "+" );
+ subsLayout->addWidget( plussubs, 0, 3, 1, 1 );
+
+ QLabel *subsLabel = new QLabel;
+ subsLabel->setText( qtr( "Advance of subtitles over video:" ) );
+ subsLayout->addWidget( subsLabel, 0, 0, 1, 1 );
+
+ subsSpin = new QDoubleSpinBox;
+ subsSpin->setAlignment( Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter );
+ subsSpin->setDecimals( 3 );
+ subsSpin->setMinimum( -100 );
+ subsSpin->setMaximum( 100 );
+ subsSpin->setSingleStep( 0.1 );
+ subsSpin->setToolTip( qtr( "A positive value means that\n"
+ "the subtitles are ahead of the video" ) );
+ subsSpin->setSuffix( "s" );
+ subsLayout->addWidget( subsSpin, 0, 2, 1, 1 );
+
+
+ moinssubSpeed = new QToolButton;
+ moinssubSpeed->setToolButtonStyle( Qt::ToolButtonTextOnly );
+ moinssubSpeed->setAutoRaise( true );
+ moinssubSpeed->setText( "-" );
+ subsLayout->addWidget( moinssubSpeed, 1, 1, 1, 1 );
+
+ plussubSpeed = new QToolButton;
+ plussubSpeed->setToolButtonStyle( Qt::ToolButtonTextOnly );
+ plussubSpeed->setAutoRaise( true );
+ plussubSpeed->setText( "+" );
+ subsLayout->addWidget( plussubSpeed, 1, 3, 1, 1 );
+
+ QLabel *subSpeedLabel = new QLabel;
+ subSpeedLabel->setText( qtr( "Speed of the subtitles:" ) );
+ subsLayout->addWidget( subSpeedLabel, 1, 0, 1, 3 );
+
+ subSpeedSpin = new QDoubleSpinBox;
+ subSpeedSpin->setAlignment( Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter );
+ subSpeedSpin->setDecimals( 3 );
+ subSpeedSpin->setMinimum( 1 );
+ subSpeedSpin->setMaximum( 100 );
+ subSpeedSpin->setSingleStep( 0.2 );
+ subsLayout->addWidget( subSpeedSpin, 1, 2, 1, 1 );
+
+ mainLayout->addWidget( subsBox, 2, 0, 2, 5 );
+
+ updateButton = new QToolButton;
+ updateButton->setAutoRaise( true );
+ updateButton->setText( "u" );
+ updateButton->setToolTip( qtr( "Force update of the values in this dialog" ) );
+ mainLayout->addWidget( updateButton, 0, 4, 1, 1 );
+
+
+ /* Various Connects */
+ CONNECT( moinsAV, clicked(), AVSpin, stepDown () );
+ CONNECT( plusAV, clicked(), AVSpin, stepUp () );
+ CONNECT( moinssubs, clicked(), subsSpin, stepDown () );
+ CONNECT( plussubs, clicked(), subsSpin, stepUp () );
+ CONNECT( moinssubSpeed, clicked(), subSpeedSpin, stepDown () );
+ CONNECT( plussubSpeed, clicked(), subSpeedSpin, stepUp () );
+ CONNECT( AVSpin, valueChanged ( double ), this, advanceAudio( double ) ) ;
+ CONNECT( subsSpin, valueChanged ( double ), this, advanceSubs( double ) ) ;
+ CONNECT( subSpeedSpin, valueChanged ( double ),
+ this, adjustSubsSpeed( double ) );
+ BUTTONACT( updateButton, update() );
+
+ /* Set it */
+ update();
+}
+
+void SyncControls::update()
+{
+ 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" );
+ subsSpin->setValue( ( (double)i_delay ) / 1000000 );
+ subSpeedSpin->setValue( var_GetFloat( THEMIM->getInput(), "sub-fps" ) );
+ }
+}
+
+void SyncControls::advanceAudio( double f_advance )
+{
+ if( THEMIM->getInput() )
+ {
+ int64_t i_delay = var_GetTime( THEMIM->getInput(), "audio-delay" );
+ i_delay += f_advance * 1000000;
+ var_SetTime( THEMIM->getInput(), "audio-delay", i_delay );
+ msg_Dbg( p_intf, "I am advancing Audio %d", f_advance );
+ }
+}
+
+void SyncControls::advanceSubs( double f_advance )
+{
+ if( THEMIM->getInput() )
+ {
+ int64_t i_delay = var_GetTime( THEMIM->getInput(), "spu-delay" );
+ 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() )
+ {
+ var_SetFloat( THEMIM->getInput(), "sub-fps", f_fps );
+ }
+}
+
/**********************************************************************
* Video filters / Adjust
**********************************************************************/