Commit e683b9ce authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Update user interface for caching unification

parent 31ac20b2
......@@ -566,21 +566,9 @@ static inline char * __config_GetLabel( vlc_object_t *p_this, const char *psz_na
bool b_cache_equal = true;
int i_cache = config_GetInt( p_intf, "file-caching");
TestCaC( "udp-caching" );
if( module_exists ("dvdread") )
TestCaC( "dvdread-caching" );
if( module_exists ("dvdnav") )
TestCaC( "dvdnav-caching" );
TestCaC( "tcp-caching" );
TestCaC( "cdda-caching" );
TestCaC( "screen-caching" );
TestCaC( "vcd-caching" );
TestCaCi( "rtsp-caching", 4 );
TestCaCi( "ftp-caching", 2 );
TestCaCi( "http-caching", 4 );
if(module_exists ("access_realrtsp"))
TestCaCi( "realrtsp-caching", 10 );
TestCaCi( "mms-caching", 19 );
TestCaC( "network-caching" );
TestCaC( "disc-caching" );
TestCaC( "live-caching" );
if( b_cache_equal )
{
[o_input_cachelevel_pop selectItemWithTag: i_cache];
......@@ -886,19 +874,9 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch
#define CaCi( name, int ) config_PutInt( p_intf, name, int * [[o_input_cachelevel_pop selectedItem] tag] )
#define CaC( name ) CaCi( name, 1 )
msg_Dbg( p_intf, "Adjusting all cache values to: %i", (int)[[o_input_cachelevel_pop selectedItem] tag] );
CaC( "udp-caching" );
if( module_exists ( "dvdread" ) )
CaC( "dvdread-caching" );
if( module_exists ( "dvdnav" ) )
CaC( "dvdnav-caching" );
CaC( "tcp-caching" ); CaC( "vcd-caching" );
CaC( "cdda-caching" ); CaC( "file-caching" );
CaC( "screen-caching" );
CaCi( "rtsp-caching", 4 ); CaCi( "ftp-caching", 2 );
CaCi( "http-caching", 4 );
if( module_exists ( "access_realrtsp" ) )
CaCi( "realrtsp-caching", 10 );
CaCi( "mms-caching", 19 );
CaC( "network-caching" );
CaC( "disc-caching" );
CaC( "live-caching" );
b_inputSettingChanged = NO;
}
......
......@@ -289,8 +289,8 @@ void FileOpenPanel::updateMRL()
mrl.append( " :sub-file=" + colon_escape( ui.subInput->text() ) );
}
emit mrlUpdated( fileList, mrl );
emit methodChanged( "file-caching" );
emit mrlUpdated( fileList, mrl );
}
/* Function called by Open Dialog when clicke on Play/Enqueue */
......@@ -494,11 +494,6 @@ void DiscOpenPanel::updateMRL()
else
mrl = "dvdsimple://" LOCALHOST + discPath;
if( !ui.dvdsimple->isChecked() )
emit methodChanged( "dvdnav-caching" );
else
emit methodChanged( "dvdread-caching" );
if ( ui.titleSpin->value() > 0 ) {
mrl += QString("@%1").arg( ui.titleSpin->value() );
if ( ui.chapterSpin->value() > 0 ) {
......@@ -509,7 +504,6 @@ void DiscOpenPanel::updateMRL()
/* VCD */
} else if ( ui.vcdRadioButton->isChecked() ) {
mrl = "vcd://" LOCALHOST + discPath;
emit methodChanged( "vcd-caching" );
if( ui.titleSpin->value() > 0 ) {
mrl += QString("@E%1").arg( ui.titleSpin->value() );
......@@ -518,8 +512,8 @@ void DiscOpenPanel::updateMRL()
/* CDDA */
} else {
mrl = "cdda://" LOCALHOST + discPath;
emit methodChanged( "cdda-caching" );
}
emit methodChanged( "disc-caching" );
fileList << mrl; mrl = "";
......@@ -612,47 +606,11 @@ void NetOpenPanel::onFocus()
ui.urlComboBox->lineEdit()->selectAll();
}
static int strcmp_void( const void *k, const void *e )
{
return strcmp( (const char *)k, (const char *)e );
}
void NetOpenPanel::updateMRL()
{
static const struct caching_map
{
char proto[6];
char caching[6];
} schemes[] =
{ /* KEEP alphabetical order on first column!! */
{ "dccp", "rtp" },
{ "ftp", "ftp" },
{ "ftps", "ftp" },
{ "http", "http" },
{ "https", "http" },
{ "mms", "mms" },
{ "mmsh", "mms" },
{ "mmst", "mms" },
{ "mmsu", "mms" },
{ "sftp", "sftp" },
{ "smb", "smb" },
{ "rtmp", "rtmp" },
{ "rtp", "rtp" },
{ "rtsp", "rtsp" },
{ "udp", "udp" },
};
QString url = ui.urlComboBox->lineEdit()->text();
if( !url.contains( "://") )
return; /* nothing to do this far */
/* Match the correct item in the comboBox */
QString proto = url.section( ':', 0, 0 );
const struct caching_map *r = (const struct caching_map *)
bsearch( qtu(proto), schemes, sizeof(schemes) / sizeof(schemes[0]),
sizeof(schemes[0]), strcmp_void );
if( r )
emit methodChanged( qfu( r->caching ) + qfu( "-caching" ) );
emit methodChanged( qfu( "network-caching" ) );
QStringList qsl;
qsl << url;
......@@ -839,27 +797,16 @@ void CaptureOpenPanel::initialize()
/* Jack Props panel */
/* Caching */
QLabel *jackCachingLabel = new QLabel( qtr( "Input caching:" ) );
jackPropLayout->addWidget( jackCachingLabel, 1 , 0 );
jackCaching = new QSpinBox;
setSpinBoxFreq( jackCaching );
jackCaching->setSuffix( " ms" );
jackCaching->setValue(1000);
jackCaching->setAlignment( Qt::AlignRight );
jackPropLayout->addWidget( jackCaching, 1 , 2 );
/* Pace */
jackPace = new QCheckBox(qtr( "Use VLC pace" ));
jackPropLayout->addWidget( jackPace, 2, 1 );
jackPropLayout->addWidget( jackPace, 1, 1 );
/* Auto Connect */
jackConnect = new QCheckBox( qtr( "Auto connection" ));
jackPropLayout->addWidget( jackConnect, 2, 2 );
jackPropLayout->addWidget( jackConnect, 1, 2 );
/* Jack CONNECTs */
CuMRL( jackChannels, valueChanged( int ) );
CuMRL( jackCaching, valueChanged( int ) );
CuMRL( jackPace, stateChanged( int ) );
CuMRL( jackConnect, stateChanged( int ) );
CuMRL( jackPortsSelected, textChanged( const QString& ) );
......@@ -1101,7 +1048,6 @@ void CaptureOpenPanel::updateMRL()
colon_escape( QString("%1").arg( adevDshowW->getValue() ) )+" ";
if( dshowVSizeLine->isModified() )
mrl += ":dshow-size=" + dshowVSizeLine->text();
emit methodChanged( "dshow-caching" );
break;
#else
case V4L2_DEVICE:
......@@ -1115,7 +1061,6 @@ void CaptureOpenPanel::updateMRL()
mrl += ":ports=" + jackPortsSelected->text();
fileList << mrl; mrl = "";
mrl += " :jack-input-caching=" + QString::number( jackCaching->value() );
if ( jackPace->isChecked() )
{
mrl += " :jack-input-use-vlc-pace";
......@@ -1172,10 +1117,10 @@ void CaptureOpenPanel::updateMRL()
case SCREEN_DEVICE:
fileList << "screen://";
mrl = " :screen-fps=" + QString::number( screenFPS->value(), 'f' );
emit methodChanged( "screen-caching" );
updateButtons();
break;
}
emit methodChanged( "live-caching" );
if( !advMRL.isEmpty() ) mrl += advMRL;
......
......@@ -207,7 +207,7 @@ private:
QComboBox *v4l2VideoDevice, *v4l2AudioDevice;
QLineEdit *pvrDevice, *pvrRadioDevice;
QComboBox *v4l2StdBox, *pvrNormBox;
QSpinBox *jackChannels, *jackCaching;
QSpinBox *jackChannels;
QCheckBox *jackPace, *jackConnect;
QLineEdit *jackPortsSelected;
#endif
......
......@@ -491,43 +491,16 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
#define TestCaC( name ) \
b_cache_equal = b_cache_equal && \
( i_cache == config_GetInt( p_intf, name ) )
#define TestCaCi( name, int ) \
b_cache_equal = b_cache_equal && \
( ( i_cache * int ) == config_GetInt( p_intf, name ) )
/* Select the accurate value of the ComboBox */
bool b_cache_equal = true;
int i_cache = config_GetInt( p_intf, "file-caching");
TestCaC( "udp-caching" );
if (module_exists ("dvdread"))
TestCaC( "dvdread-caching" );
if (module_exists ("dvdnav"))
TestCaC( "dvdnav-caching" );
TestCaC( "tcp-caching" );
TestCaC( "cdda-caching" );
TestCaC( "screen-caching" ); TestCaC( "vcd-caching" );
#ifdef WIN32
TestCaC( "dshow-caching" );
#else
if (module_exists ("access_jack"))
TestCaC( "jack-input-caching" );
if (module_exists ("v4l2"))
TestCaC( "v4l2-caching" );
if (module_exists ("pvr"))
TestCaC( "pvr-caching" );
#endif
if (module_exists ("livedotcom"))
TestCaCi( "rtsp-caching", 4 );
TestCaCi( "ftp-caching", 2 );
TestCaCi( "http-caching", 2 );
if (module_exists ("access_realrtsp"))
TestCaCi( "realrtsp-caching", 10 );
TestCaCi( "mms-caching", 10 );
TestCaC( "network-caching" );
TestCaC( "disc-caching" );
TestCaC( "live-caching" );
if( b_cache_equal == 1 )
ui.cachingCombo->setCurrentIndex(
ui.cachingCombo->findData( QVariant( i_cache ) ) );
#undef TestCaCi
#undef TestCaC
END_SPREFS_CAT;
......@@ -792,41 +765,18 @@ void SPrefsPanel::apply()
config_PutPsz( p_intf, "cd-audio", devicepath );
}
#define CaCi( name, int ) config_PutInt( p_intf, name, int * i_comboValue )
#define CaC( name ) CaCi( name, 1 )
#define CaC( name ) config_PutInt( p_intf, name, i_comboValue )
/* Caching */
QComboBox *cachingCombo = qobject_cast<QComboBox *>(optionWidgets[cachingCoB]);
int i_comboValue = cachingCombo->itemData( cachingCombo->currentIndex() ).toInt();
if( i_comboValue )
{
CaC( "udp-caching" );
if (module_exists ("dvdread" ))
CaC( "dvdread-caching" );
if (module_exists ("dvdnav" ))
CaC( "dvdnav-caching" );
CaC( "tcp-caching" ); CaC( "vcd-caching" );
CaC( "cdda-caching" ); CaC( "file-caching" );
CaC( "screen-caching" ); CaC( "bd-caching" );
CaCi( "rtsp-caching", 2 ); CaCi( "ftp-caching", 2 );
CaCi( "http-caching", 2 );
if (module_exists ("access_realrtsp" ))
CaCi( "realrtsp-caching", 10 );
CaCi( "mms-caching", 10 );
#ifdef WIN32
CaC( "dshow-caching" );
#else
if (module_exists ( "access_jack" ))
CaC( "jack-input-caching" );
if (module_exists ( "v4l2" ))
CaC( "v4l2-caching" );
if (module_exists ( "pvr" ))
CaC( "pvr-caching" );
#endif
//CaCi( "dv-caching" ) too short...
CaC( "network-caching" );
CaC( "disc-caching" );
CaC( "live-caching" );
}
break;
#undef CaC
#undef CaCi
}
/* Interfaces */
......
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