Skip to content

Commit

Permalink
fixed: cdda/dvd playdisk (attempt 4)
Browse files Browse the repository at this point in the history
It still needs more work..
  • Loading branch information
elupus committed Dec 28, 2011
1 parent f2c5b33 commit ee8b61c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 48 deletions.
62 changes: 15 additions & 47 deletions xbmc/Autorun.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -72,24 +73,6 @@ void CAutorun::ExecuteAutorun( bool bypassSettings, bool ignoreplaying, bool sta
PlayDisc("", bypassSettings, startFromBeginning);
}

bool CAutorun::RunCdda()
{
CFileItemList vecItems;

auto_ptr<IDirectory> 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"))
Expand All @@ -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<IDirectory> pDir ( CFactoryDirectory::Create( mediaPath ));
Expand Down Expand Up @@ -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++)
{
Expand Down
1 change: 0 additions & 1 deletion xbmc/Autorun.h
Expand Up @@ -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;
};
Expand Down

2 comments on commit ee8b61c

@ScudLee
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to include the iso9660:// part for all systems? Prior to this it was only for non-Windows.

Previously:

GetDiskUniqueId: Trying to retrieve ID for path D:\VIDEO_TS
CMediaManager::HashDVD - Adding file content for dvd file: VIDEO_TS.IFO
...
CMediaManager::HashDVD - Adding file content for dvd file: VTS_11_0.IFO
GetDiskUniqueId: Got ID removable://MONTE_CRISTO_VOL3_94b96961 for DVD disk

Currently:

GetDiskUniqueId: Trying to retrieve ID for path iso9660://VIDEO_TS
CMediaManager::HashDVD - Adding file content for dvd file: VIDEO_TS.IFO
...
CMediaManager::HashDVD - Adding file content for dvd file: VTS_11_0.IFO
GetDiskUniqueId: Got ID removable://_c9344d08 for DVD disk

(Same disk both times)

Looks like CMediaManager::GetDiskLabel doesn't like what now gets passed to it (on Windows). Plus the hash is different (obviously).

@elupus
Copy link
Contributor

@elupus elupus commented on ee8b61c Dec 28, 2011 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.