Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/mythtv/libs/libmythtv/bdringbuffer.cpp b/mythtv/libs/libmythtv/bdringbuffer.cpp
- index 8028527..142e352 100644
- --- a/mythtv/libs/libmythtv/bdringbuffer.cpp
- +++ b/mythtv/libs/libmythtv/bdringbuffer.cpp
- @@ -272,8 +272,15 @@ void BDRingBuffer::ProgressUpdate(void)
- bool BDRingBuffer::OpenFile(const QString &lfilename, uint retry_ms)
- {
- - safefilename = lfilename;
- - filename = lfilename;
- + // clean path filename
- + QString filename = QDir(QDir::cleanPath(lfilename)).canonicalPath();
- + if (filename.isEmpty())
- + {
- + LOG(VB_GENERAL, LOG_ERR, LOC +
- + QString("%1 nonexistent").arg(lfilename));
- + filename = lfilename;
- + }
- + safefilename = filename;
- LOG(VB_GENERAL, LOG_INFO, LOC + QString("Opened BDRingBuffer device at %1")
- .arg(filename.toLatin1().data()));
- diff --git a/mythtv/libs/libmythtv/ringbuffer.cpp b/mythtv/libs/libmythtv/ringbuffer.cpp
- index 6940300..7ca602d 100644
- --- a/mythtv/libs/libmythtv/ringbuffer.cpp
- +++ b/mythtv/libs/libmythtv/ringbuffer.cpp
- @@ -113,6 +113,7 @@ RingBuffer *RingBuffer::Create(
- bool dvdurl = lower.startsWith("dvd:");
- bool dvdext = lower.endsWith(".img") || lower.endsWith(".iso");
- + LOG(VB_GENERAL, LOG_ERR, QString("filename2 =%1").arg(xfilename));
- if (httpurl)
- return new StreamingRingBuffer(lfilename);
- @@ -154,11 +155,10 @@ RingBuffer *RingBuffer::Create(
- }
- else if (!stream_only && (bdurl || bddir))
- {
- - if (lfilename.left(5) == "bd://") // 'Play DVD' sends "bd:/" + dev
- - lfilename.remove(0,4); // e.g. "bd://dev/sda"
- - else if (lfilename.left(4) == "bd:/") // Less correct URI "bd:" + path
- + if (lfilename.left(3) == "bd:") // Less correct URI "bd:" + path
- lfilename.remove(0,3); // e.g. "bd:/videos/ET"
- + LOG(VB_GENERAL, LOG_ERR, QString("lfilename =%1").arg(lfilename));
- if (mythurl || QFile::exists(lfilename))
- LOG(VB_PLAYBACK, LOG_INFO, "Trying BD at " + lfilename);
- else
- diff --git a/mythtv/programs/mythfrontend/main.cpp b/mythtv/programs/mythfrontend/main.cpp
- index da7e267..8b67945 100644
- --- a/mythtv/programs/mythfrontend/main.cpp
- +++ b/mythtv/programs/mythfrontend/main.cpp
- @@ -655,89 +655,84 @@ static void jumpScreenVideoDefault() { RunVideoScreen(VideoDialog::DLG_DEFAULT,
- QString gDVDdevice;
- +static QString preparePlayCommand(QString command, QString replacement)
- +{
- + if ((command.indexOf("internal", 0, Qt::CaseInsensitive) > -1) ||
- + (command.length() < 1))
- + {
- + return "Internal";
- + }
- + if (command.contains("%d"))
- + {
- + //
- + // Need to do device substitution
- + //
- + command.replace(QRegExp("%d"), replacement);
- + }
- + return command;
- +}
- +
- static void playDisc()
- {
- //
- - // Get the command string to play a DVD
- + // Get the command string to play a DVD / BluRay
- //
- - bool isBD = false;
- + QString dvd_device = gDVDdevice;
- + QString bd_device = QDir(
- + QDir::cleanPath(gCoreContext->GetSetting("BluRayMountpoint",
- + "/media/cdrom")))
- + .canonicalPath();
- + QDir bdtest(bd_device + "/BDMV");
- - QString command_string =
- - gCoreContext->GetSetting("mythdvd.DVDPlayerCommand");
- - QString bluray_mountpoint =
- - gCoreContext->GetSetting("BluRayMountpoint", "/media/cdrom");
- - QDir bdtest(bluray_mountpoint + "/BDMV");
- + bool isBD = QDir(bd_device + "/BDMV").exists();
- - if (bdtest.exists())
- - isBD = true;
- + if (dvd_device.isEmpty())
- + dvd_device = MediaMonitor::defaultDVDdevice();
- + if (!isBD && dvd_device.isEmpty())
- + return; // User cancelled in the Popup
- - if (isBD)
- - {
- - GetMythUI()->AddCurrentLocation("playdisc");
- -
- - QString filename = QString("bd:/%1/").arg(bluray_mountpoint);
- + QString filename = isBD ? QString("bd:%1").arg(bd_device) : dvd_device;
- + QString command_string =
- + preparePlayCommand(gCoreContext->GetSetting("mythdvd.DVDPlayerCommand"),
- + filename);
- - GetMythMainWindow()->HandleMedia("Internal", filename, "", "", "", "",
- - 0, 0, "", 0, "", "", true);
- + GetMythUI()->AddCurrentLocation("playdisc");
- - GetMythUI()->RemoveCurrentLocation();
- - }
- - else
- + if (command_string == "Internal")
- {
- - QString dvd_device = gDVDdevice;
- -
- - if (dvd_device.isEmpty())
- - dvd_device = MediaMonitor::defaultDVDdevice();
- -
- - if (dvd_device.isEmpty())
- - return; // User cancelled in the Popup
- -
- - GetMythUI()->AddCurrentLocation("playdisc");
- -
- - if ((command_string.indexOf("internal", 0, Qt::CaseInsensitive) > -1) ||
- - (command_string.length() < 1))
- + if (!isBD)
- {
- #ifdef Q_OS_MAC
- // Convert a BSD 'leaf' name into a raw device path
- - QString filename = "dvd://dev/r"; // e.g. 'dvd://dev/rdisk2'
- + QString prefix = "dvd://dev/r"; // e.g. 'dvd://dev/rdisk2'
- #elif USING_MINGW
- - QString filename = "dvd:"; // e.g. 'dvd:E\\'
- + QString prefix = "dvd:"; // e.g. 'dvd:E\\'
- #else
- - QString filename = "dvd:/"; // e.g. 'dvd://dev/sda'
- + QString prefix = "dvd:/"; // e.g. 'dvd://dev/sda'
- #endif
- - filename += dvd_device;
- -
- - command_string = "Internal";
- - GetMythMainWindow()->HandleMedia(command_string, filename, "", "",
- - "", "", 0, 0, "", 0, "", "", true);
- - GetMythUI()->RemoveCurrentLocation();
- -
- - return;
- + filename = prefix + filename;
- }
- - else
- +
- + GetMythMainWindow()->HandleMedia("Internal", filename, "", "", "", "",
- + 0, 0, "", 0, "", "", true);
- + }
- + else
- + {
- + LOG(VB_MEDIA, LOG_INFO, QString("Called external command %1")
- + .arg(command_string));
- + sendPlaybackStart();
- + myth_system(command_string);
- + sendPlaybackEnd();
- + if (GetMythMainWindow())
- {
- - if (command_string.contains("%d"))
- - {
- - //
- - // Need to do device substitution
- - //
- - command_string =
- - command_string.replace(QRegExp("%d"), dvd_device);
- - }
- - sendPlaybackStart();
- - myth_system(command_string);
- - sendPlaybackEnd();
- - if (GetMythMainWindow())
- - {
- - GetMythMainWindow()->raise();
- - GetMythMainWindow()->activateWindow();
- - if (GetMythMainWindow()->currentWidget())
- - GetMythMainWindow()->currentWidget()->setFocus();
- - }
- + GetMythMainWindow()->raise();
- + GetMythMainWindow()->activateWindow();
- + if (GetMythMainWindow()->currentWidget())
- + GetMythMainWindow()->currentWidget()->setFocus();
- }
- - GetMythUI()->RemoveCurrentLocation();
- }
- + GetMythUI()->RemoveCurrentLocation();
- }
- /////////////////////////////////////////////////
Advertisement
Add Comment
Please, Sign In to add comment