[vlc-commits] Qt4: encode disc MRL correctly (fix #5638)
Rémi Denis-Courmont
git at videolan.org
Wed Feb 8 18:54:28 CET 2012
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Feb 8 19:53:53 2012 +0200| [9b247e7c299f53c905278c45bf45545dc4bcd390] | committer: Rémi Denis-Courmont
Qt4: encode disc MRL correctly (fix #5638)
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9b247e7c299f53c905278c45bf45545dc4bcd390
---
modules/gui/qt4/components/open_panels.cpp | 48 +++++++++++++--------------
1 files changed, 23 insertions(+), 25 deletions(-)
diff --git a/modules/gui/qt4/components/open_panels.cpp b/modules/gui/qt4/components/open_panels.cpp
index 809e08d..b79d621 100644
--- a/modules/gui/qt4/components/open_panels.cpp
+++ b/modules/gui/qt4/components/open_panels.cpp
@@ -489,16 +489,9 @@ void DiscOpenPanel::updateButtons()
#undef setDrive
-#if !defined( WIN32 ) && !defined( __OS2__ )
-# define LOCALHOST ""
-#else
-# define LOCALHOST "/"
-#endif
-
/* Update the current MRL */
void DiscOpenPanel::updateMRL()
{
- QString mrl;
QString discPath;
QStringList fileList;
@@ -508,56 +501,61 @@ void DiscOpenPanel::updateMRL()
discPath = ui.deviceCombo->currentText();
/* MRL scheme */
+ const char *scheme;
/* DVD */
if( ui.dvdRadioButton->isChecked() ) {
if( !ui.dvdsimple->isChecked() )
- mrl = "dvd://" LOCALHOST;
+ scheme = "dvd";
else
- mrl = "dvdsimple://" LOCALHOST;
+ scheme = "dvdsimple";
} else if ( ui.bdRadioButton->isChecked() )
- mrl = "bluray://" LOCALHOST;
+ scheme = "bluray";
/* VCD */
else if ( ui.vcdRadioButton->isChecked() )
- mrl = "vcd://" LOCALHOST;
+ scheme = "vcd";
/* CDDA */
else
- mrl = "cdda://" LOCALHOST;
+ scheme = "cdda";
- mrl += discPath;
+ char *mrl = make_URI( qtu(discPath), scheme );
+ if( unlikely(mrl == NULL) )
+ return;
/* Title/chapter encoded in MRL */
+ QString anchor = "";
if( ui.titleSpin->value() > 0 ) {
if( ui.dvdRadioButton->isChecked() || ui.bdRadioButton->isChecked() ) {
- mrl += QString("#%1").arg( ui.titleSpin->value() );
+ anchor = QString("#%1").arg( ui.titleSpin->value() );
if ( ui.chapterSpin->value() > 0 )
- mrl+= QString(":%1").arg( ui.chapterSpin->value() );
+ anchor += QString(":%1").arg( ui.chapterSpin->value() );
}
else if ( ui.vcdRadioButton->isChecked() )
- mrl += QString("#%1").arg( ui.titleSpin->value() );
+ anchor = QString("#%1").arg( ui.titleSpin->value() );
}
emit methodChanged( "disc-caching" );
- fileList << mrl; mrl = "";
+ fileList << (qfu(mrl) + anchor);
+ free(mrl);
+
+ QString opts = "";
/* Input item options */
if ( ui.dvdRadioButton->isChecked() || ui.vcdRadioButton->isChecked() )
{
- if ( ui.audioSpin->value() >= 0 ) {
- mrl += " :audio-track=" +
+ if ( ui.audioSpin->value() >= 0 )
+ opts += " :audio-track=" +
QString("%1").arg( ui.audioSpin->value() );
- }
- if ( ui.subtitlesSpin->value() >= 0 ) {
- mrl += " :sub-track=" +
+ if ( ui.subtitlesSpin->value() >= 0 )
+ opts += " :sub-track=" +
QString("%1").arg( ui.subtitlesSpin->value() );
- }
}
if( ui.audioCDRadioButton->isChecked() )
{
if( ui.titleSpin->value() > 0 )
- mrl += QString(" :cdda-track=%1").arg( ui.titleSpin->value() );
+ opts += QString(" :cdda-track=%1").arg( ui.titleSpin->value() );
}
- emit mrlUpdated( fileList, mrl );
+ emit mrlUpdated( fileList, opts );
}
void DiscOpenPanel::browseDevice()
More information about the vlc-commits
mailing list