From ee8b61c8687ad6a2c0c58c476b69d1b58364d43c Mon Sep 17 00:00:00 2001 From: elupus Date: Wed, 28 Dec 2011 22:34:33 +0100 Subject: [PATCH] fixed: cdda/dvd playdisk (attempt 4) It still needs more work.. --- xbmc/Autorun.cpp | 62 ++++++++++++------------------------------------ xbmc/Autorun.h | 1 - 2 files changed, 15 insertions(+), 48 deletions(-) diff --git a/xbmc/Autorun.cpp b/xbmc/Autorun.cpp index 8eef37e0f574c..4f49ff02ff281 100644 --- a/xbmc/Autorun.cpp +++ b/xbmc/Autorun.cpp @@ -42,6 +42,7 @@ #include "video/VideoDatabase.h" #include "dialogs/GUIDialogYesNo.h" #include "utils/URIUtils.h" +#include "utils/log.h" using namespace std; using namespace XFILE; @@ -72,24 +73,6 @@ void CAutorun::ExecuteAutorun( bool bypassSettings, bool ignoreplaying, bool sta PlayDisc("", bypassSettings, startFromBeginning); } -bool CAutorun::RunCdda() -{ - CFileItemList vecItems; - - auto_ptr pDir ( CFactoryDirectory::Create( "cdda://local/" ) ); - if ( !pDir->GetDirectory( "cdda://local/", vecItems ) ) - return false; - - if ( vecItems.Size() <= 0 ) - return false; - - g_playlistPlayer.ClearPlaylist(PLAYLIST_MUSIC); - g_playlistPlayer.Add(PLAYLIST_MUSIC, vecItems); - g_playlistPlayer.SetCurrentPlaylist(PLAYLIST_MUSIC); - g_playlistPlayer.Play(); - return true; -} - bool CAutorun::PlayDisc(const CStdString& path, bool bypassSettings, bool startFromBeginning) { if ( !bypassSettings && !g_guiSettings.GetBool("audiocds.autorun") && !g_guiSettings.GetBool("dvds.autorun")) @@ -98,24 +81,24 @@ bool CAutorun::PlayDisc(const CStdString& path, bool bypassSettings, bool startF int nSize = g_playlistPlayer.GetPlaylist( PLAYLIST_MUSIC ).size(); int nAddedToPlaylist = 0; - CStdString mediaPath = path; + CStdString mediaPath; + + CCdInfo* pInfo = g_mediaManager.GetCdInfo(path); + if (pInfo == NULL) + return false; + + if (mediaPath.IsEmpty() && pInfo->IsAudio(1)) + mediaPath = "cdda://local/"; + + if (mediaPath.IsEmpty() && (pInfo->IsISOUDF(1) || pInfo->IsISOHFS(1) || pInfo->IsIso9660(1) || pInfo->IsIso9660Interactive(1))) + mediaPath = "iso9660://"; -#ifdef _WIN32 if (mediaPath.IsEmpty()) - mediaPath = g_mediaManager.TranslateDevicePath(""); + mediaPath = path; -#else +#ifdef _WIN32 if (mediaPath.IsEmpty()) - { - CCdInfo* pInfo = g_mediaManager.GetCdInfo(); - if ( pInfo == NULL ) - return false; - - if (pInfo->IsISOUDF(1) || pInfo->IsISOHFS(1) || pInfo->IsIso9660(1) || pInfo->IsIso9660Interactive(1)) - mediaPath = "iso9660://"; - else - mediaPath = "D:\\"; // Is this XBOX remnant?? - } + mediaPath = g_mediaManager.TranslateDevicePath(""); #endif auto_ptr pDir ( CFactoryDirectory::Create( mediaPath )); @@ -159,21 +142,6 @@ bool CAutorun::RunDisc(IDirectory* pDir, const CStdString& strDrive, int& nAdded // is this a root folder we have to check the content to determine a disc type if( bRoot ) { - // check for audio cd first - CCdInfo* pInfo = g_mediaManager.GetCdInfo(); - - if ( pInfo->IsAudio( 1 ) ) - { - if( !bypassSettings && !g_guiSettings.GetBool("audiocds.autorun") ) - return false; - - if (!g_passwordManager.IsMasterLockUnlocked(false)) - if (g_settings.GetCurrentProfile().musicLocked()) - return false; - bPlaying = RunCdda(); - return bPlaying; - } - // check root folders next, for normal structured dvd's for (int i = 0; i < vecItems.Size(); i++) { diff --git a/xbmc/Autorun.h b/xbmc/Autorun.h index 693476e410244..4461b74db4eac 100644 --- a/xbmc/Autorun.h +++ b/xbmc/Autorun.h @@ -56,7 +56,6 @@ class CAutorun void HandleAutorun(); static void ExecuteAutorun(bool bypassSettings = false, bool ignoreplaying = false, bool startFromBeginning = false); protected: - static bool RunCdda(); static bool RunDisc(XFILE::IDirectory* pDir, const CStdString& strDrive, int& nAddedToPlaylist, bool bRoot, bool bypassSettings, bool startFromBeginning); bool m_bEnable; };