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 ...@@ -566,21 +566,9 @@ static inline char * __config_GetLabel( vlc_object_t *p_this, const char *psz_na
bool b_cache_equal = true; bool b_cache_equal = true;
int i_cache = config_GetInt( p_intf, "file-caching"); int i_cache = config_GetInt( p_intf, "file-caching");
TestCaC( "udp-caching" ); TestCaC( "network-caching" );
if( module_exists ("dvdread") ) TestCaC( "disc-caching" );
TestCaC( "dvdread-caching" ); TestCaC( "live-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 );
if( b_cache_equal ) if( b_cache_equal )
{ {
[o_input_cachelevel_pop selectItemWithTag: i_cache]; [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 ...@@ -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 CaCi( name, int ) config_PutInt( p_intf, name, int * [[o_input_cachelevel_pop selectedItem] tag] )
#define CaC( name ) CaCi( name, 1 ) #define CaC( name ) CaCi( name, 1 )
msg_Dbg( p_intf, "Adjusting all cache values to: %i", (int)[[o_input_cachelevel_pop selectedItem] tag] ); msg_Dbg( p_intf, "Adjusting all cache values to: %i", (int)[[o_input_cachelevel_pop selectedItem] tag] );
CaC( "udp-caching" ); CaC( "network-caching" );
if( module_exists ( "dvdread" ) ) CaC( "disc-caching" );
CaC( "dvdread-caching" ); CaC( "live-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 );
b_inputSettingChanged = NO; b_inputSettingChanged = NO;
} }
......
...@@ -289,8 +289,8 @@ void FileOpenPanel::updateMRL() ...@@ -289,8 +289,8 @@ void FileOpenPanel::updateMRL()
mrl.append( " :sub-file=" + colon_escape( ui.subInput->text() ) ); mrl.append( " :sub-file=" + colon_escape( ui.subInput->text() ) );
} }
emit mrlUpdated( fileList, mrl );
emit methodChanged( "file-caching" ); emit methodChanged( "file-caching" );
emit mrlUpdated( fileList, mrl );
} }
/* Function called by Open Dialog when clicke on Play/Enqueue */ /* Function called by Open Dialog when clicke on Play/Enqueue */
...@@ -494,11 +494,6 @@ void DiscOpenPanel::updateMRL() ...@@ -494,11 +494,6 @@ void DiscOpenPanel::updateMRL()
else else
mrl = "dvdsimple://" LOCALHOST + discPath; mrl = "dvdsimple://" LOCALHOST + discPath;
if( !ui.dvdsimple->isChecked() )
emit methodChanged( "dvdnav-caching" );
else
emit methodChanged( "dvdread-caching" );
if ( ui.titleSpin->value() > 0 ) { if ( ui.titleSpin->value() > 0 ) {
mrl += QString("@%1").arg( ui.titleSpin->value() ); mrl += QString("@%1").arg( ui.titleSpin->value() );
if ( ui.chapterSpin->value() > 0 ) { if ( ui.chapterSpin->value() > 0 ) {
...@@ -509,7 +504,6 @@ void DiscOpenPanel::updateMRL() ...@@ -509,7 +504,6 @@ void DiscOpenPanel::updateMRL()
/* VCD */ /* VCD */
} else if ( ui.vcdRadioButton->isChecked() ) { } else if ( ui.vcdRadioButton->isChecked() ) {
mrl = "vcd://" LOCALHOST + discPath; mrl = "vcd://" LOCALHOST + discPath;
emit methodChanged( "vcd-caching" );
if( ui.titleSpin->value() > 0 ) { if( ui.titleSpin->value() > 0 ) {
mrl += QString("@E%1").arg( ui.titleSpin->value() ); mrl += QString("@E%1").arg( ui.titleSpin->value() );
...@@ -518,8 +512,8 @@ void DiscOpenPanel::updateMRL() ...@@ -518,8 +512,8 @@ void DiscOpenPanel::updateMRL()
/* CDDA */ /* CDDA */
} else { } else {
mrl = "cdda://" LOCALHOST + discPath; mrl = "cdda://" LOCALHOST + discPath;
emit methodChanged( "cdda-caching" );
} }
emit methodChanged( "disc-caching" );
fileList << mrl; mrl = ""; fileList << mrl; mrl = "";
...@@ -612,47 +606,11 @@ void NetOpenPanel::onFocus() ...@@ -612,47 +606,11 @@ void NetOpenPanel::onFocus()
ui.urlComboBox->lineEdit()->selectAll(); 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() 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(); QString url = ui.urlComboBox->lineEdit()->text();
if( !url.contains( "://") )
return; /* nothing to do this far */
/* Match the correct item in the comboBox */ emit methodChanged( qfu( "network-caching" ) );
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" ) );
QStringList qsl; QStringList qsl;
qsl << url; qsl << url;
...@@ -839,27 +797,16 @@ void CaptureOpenPanel::initialize() ...@@ -839,27 +797,16 @@ void CaptureOpenPanel::initialize()
/* Jack Props panel */ /* 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 */ /* Pace */
jackPace = new QCheckBox(qtr( "Use VLC pace" )); jackPace = new QCheckBox(qtr( "Use VLC pace" ));
jackPropLayout->addWidget( jackPace, 2, 1 ); jackPropLayout->addWidget( jackPace, 1, 1 );
/* Auto Connect */ /* Auto Connect */
jackConnect = new QCheckBox( qtr( "Auto connection" )); jackConnect = new QCheckBox( qtr( "Auto connection" ));
jackPropLayout->addWidget( jackConnect, 2, 2 ); jackPropLayout->addWidget( jackConnect, 1, 2 );
/* Jack CONNECTs */ /* Jack CONNECTs */
CuMRL( jackChannels, valueChanged( int ) ); CuMRL( jackChannels, valueChanged( int ) );
CuMRL( jackCaching, valueChanged( int ) );
CuMRL( jackPace, stateChanged( int ) ); CuMRL( jackPace, stateChanged( int ) );
CuMRL( jackConnect, stateChanged( int ) ); CuMRL( jackConnect, stateChanged( int ) );
CuMRL( jackPortsSelected, textChanged( const QString& ) ); CuMRL( jackPortsSelected, textChanged( const QString& ) );
...@@ -1101,7 +1048,6 @@ void CaptureOpenPanel::updateMRL() ...@@ -1101,7 +1048,6 @@ void CaptureOpenPanel::updateMRL()
colon_escape( QString("%1").arg( adevDshowW->getValue() ) )+" "; colon_escape( QString("%1").arg( adevDshowW->getValue() ) )+" ";
if( dshowVSizeLine->isModified() ) if( dshowVSizeLine->isModified() )
mrl += ":dshow-size=" + dshowVSizeLine->text(); mrl += ":dshow-size=" + dshowVSizeLine->text();
emit methodChanged( "dshow-caching" );
break; break;
#else #else
case V4L2_DEVICE: case V4L2_DEVICE:
...@@ -1115,7 +1061,6 @@ void CaptureOpenPanel::updateMRL() ...@@ -1115,7 +1061,6 @@ void CaptureOpenPanel::updateMRL()
mrl += ":ports=" + jackPortsSelected->text(); mrl += ":ports=" + jackPortsSelected->text();
fileList << mrl; mrl = ""; fileList << mrl; mrl = "";
mrl += " :jack-input-caching=" + QString::number( jackCaching->value() );
if ( jackPace->isChecked() ) if ( jackPace->isChecked() )
{ {
mrl += " :jack-input-use-vlc-pace"; mrl += " :jack-input-use-vlc-pace";
...@@ -1172,10 +1117,10 @@ void CaptureOpenPanel::updateMRL() ...@@ -1172,10 +1117,10 @@ void CaptureOpenPanel::updateMRL()
case SCREEN_DEVICE: case SCREEN_DEVICE:
fileList << "screen://"; fileList << "screen://";
mrl = " :screen-fps=" + QString::number( screenFPS->value(), 'f' ); mrl = " :screen-fps=" + QString::number( screenFPS->value(), 'f' );
emit methodChanged( "screen-caching" );
updateButtons(); updateButtons();
break; break;
} }
emit methodChanged( "live-caching" );
if( !advMRL.isEmpty() ) mrl += advMRL; if( !advMRL.isEmpty() ) mrl += advMRL;
......
...@@ -207,7 +207,7 @@ private: ...@@ -207,7 +207,7 @@ private:
QComboBox *v4l2VideoDevice, *v4l2AudioDevice; QComboBox *v4l2VideoDevice, *v4l2AudioDevice;
QLineEdit *pvrDevice, *pvrRadioDevice; QLineEdit *pvrDevice, *pvrRadioDevice;
QComboBox *v4l2StdBox, *pvrNormBox; QComboBox *v4l2StdBox, *pvrNormBox;
QSpinBox *jackChannels, *jackCaching; QSpinBox *jackChannels;
QCheckBox *jackPace, *jackConnect; QCheckBox *jackPace, *jackConnect;
QLineEdit *jackPortsSelected; QLineEdit *jackPortsSelected;
#endif #endif
......
...@@ -491,43 +491,16 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -491,43 +491,16 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
#define TestCaC( name ) \ #define TestCaC( name ) \
b_cache_equal = b_cache_equal && \ b_cache_equal = b_cache_equal && \
( i_cache == config_GetInt( p_intf, name ) ) ( 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 */ /* Select the accurate value of the ComboBox */
bool b_cache_equal = true; bool b_cache_equal = true;
int i_cache = config_GetInt( p_intf, "file-caching"); int i_cache = config_GetInt( p_intf, "file-caching");
TestCaC( "udp-caching" ); TestCaC( "network-caching" );
if (module_exists ("dvdread")) TestCaC( "disc-caching" );
TestCaC( "dvdread-caching" ); TestCaC( "live-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 );
if( b_cache_equal == 1 ) if( b_cache_equal == 1 )
ui.cachingCombo->setCurrentIndex( ui.cachingCombo->setCurrentIndex(
ui.cachingCombo->findData( QVariant( i_cache ) ) ); ui.cachingCombo->findData( QVariant( i_cache ) ) );
#undef TestCaCi
#undef TestCaC #undef TestCaC
END_SPREFS_CAT; END_SPREFS_CAT;
...@@ -792,41 +765,18 @@ void SPrefsPanel::apply() ...@@ -792,41 +765,18 @@ void SPrefsPanel::apply()
config_PutPsz( p_intf, "cd-audio", devicepath ); config_PutPsz( p_intf, "cd-audio", devicepath );
} }
#define CaCi( name, int ) config_PutInt( p_intf, name, int * i_comboValue ) #define CaC( name ) config_PutInt( p_intf, name, i_comboValue )
#define CaC( name ) CaCi( name, 1 )
/* Caching */ /* Caching */
QComboBox *cachingCombo = qobject_cast<QComboBox *>(optionWidgets[cachingCoB]); QComboBox *cachingCombo = qobject_cast<QComboBox *>(optionWidgets[cachingCoB]);
int i_comboValue = cachingCombo->itemData( cachingCombo->currentIndex() ).toInt(); int i_comboValue = cachingCombo->itemData( cachingCombo->currentIndex() ).toInt();
if( i_comboValue ) if( i_comboValue )
{ {
CaC( "udp-caching" ); CaC( "network-caching" );
if (module_exists ("dvdread" )) CaC( "disc-caching" );
CaC( "dvdread-caching" ); CaC( "live-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...
} }
break; break;
#undef CaC #undef CaC
#undef CaCi
} }
/* Interfaces */ /* 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