From 8a29849250a13d93e27f1b39c64593c26503173b Mon Sep 17 00:00:00 2001 From: enen92 <92enen@gmail.com> Date: Mon, 17 Jul 2023 00:08:42 +0100 Subject: [PATCH] [discs] Fix playback of optical dvds without mount support Co-authored-by: Don Mahurin <@> --- xbmc/Autorun.cpp | 11 ++++++++++- xbmc/cores/VideoPlayer/VideoPlayer.cpp | 11 ++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/xbmc/Autorun.cpp b/xbmc/Autorun.cpp index 87a77857e8563..b7aac6855ed92 100644 --- a/xbmc/Autorun.cpp +++ b/xbmc/Autorun.cpp @@ -148,7 +148,16 @@ bool CAutorun::RunDisc(IDirectory* pDir, const std::string& strDrive, int& nAdde bool bPlaying(false); CFileItemList vecItems; - const CURL pathToUrl(strDrive); + CURL pathToUrl{strDrive}; + // if the url being requested is a generic "iso9660://" we need to expand it with the current drive device. + // use the hostname section to prepend the drive path + if (pathToUrl.GetRedacted() == "iso9660://") + { + pathToUrl.Reset(); + pathToUrl.SetProtocol("iso9660"); + pathToUrl.SetHostName(CServiceBroker::GetMediaManager().TranslateDevicePath("")); + } + if ( !pDir->GetDirectory( pathToUrl, vecItems ) ) { return false; diff --git a/xbmc/cores/VideoPlayer/VideoPlayer.cpp b/xbmc/cores/VideoPlayer/VideoPlayer.cpp index 3b3f876eebe75..7de70724e11b8 100644 --- a/xbmc/cores/VideoPlayer/VideoPlayer.cpp +++ b/xbmc/cores/VideoPlayer/VideoPlayer.cpp @@ -767,12 +767,17 @@ bool CVideoPlayer::OpenInputStream() CLog::Log(LOGINFO, "Creating InputStream"); // correct the filename if needed - std::string filename(m_item.GetPath()); - if (URIUtils::IsProtocol(filename, "dvd") || - StringUtils::EqualsNoCase(filename, "iso9660://video_ts/video_ts.ifo")) + const CURL url{m_item.GetPath()}; + if (url.GetProtocol() == "dvd") { + // FIXME: we should deprecate this when more than one device drive is supported m_item.SetPath(CServiceBroker::GetMediaManager().TranslateDevicePath("")); } + else if (url.GetProtocol() == "iso9660" && !url.GetHostName().empty() && + url.GetFileName() == "VIDEO_TS/video_ts.ifo") + { + m_item.SetPath(url.GetHostName()); + } m_pInputStream = CDVDFactoryInputStream::CreateInputStream(this, m_item, true); if (m_pInputStream == nullptr)