CCdInfo* CMediaManager::GetCdInfo(const std::string& devicePath) { #ifdef TARGET_WINDOWS if(!m_bhasoptical) return NULL; std::string strDevice = TranslateDevicePath(devicePath, false); std::map<std::string,CCdInfo*>::iterator it; { CSingleLock waitLock(m_muAutoSource); it = m_mapCdInfo.find(strDevice); if(it != m_mapCdInfo.end()) return it->second; } CCdInfo* pCdInfo=NULL; CCdIoSupport cdio; pCdInfo = cdio.GetCdInfo((char*)strDevice.c_str()); if(pCdInfo!=NULL) { CSingleLock waitLock(m_muAutoSource); m_mapCdInfo.insert(std::pair<std::string,CCdInfo*>(strDevice,pCdInfo)); } return pCdInfo; #else return MEDIA_DETECT::CDetectDVDMedia::GetCdInfo(); #endif }
// Generates the drive url, (like iso9660://) // from the CCdInfo class void CDetectDVDMedia::DetectMediaType() { bool bCDDA(false); CLog::Log(LOGINFO, "Detecting DVD-ROM media filesystem..."); CStdString strNewUrl; CCdIoSupport cdio; // Delete old CD-Information if ( m_pCdInfo != NULL ) { delete m_pCdInfo; m_pCdInfo = NULL; } // Detect new CD-Information m_pCdInfo = cdio.GetCdInfo(); if (m_pCdInfo == NULL) { CLog::Log(LOGERROR, "Detection of DVD-ROM media failed."); return ; } CLog::Log(LOGINFO, "Tracks overall:%i; Audio tracks:%i; Data tracks:%i", m_pCdInfo->GetTrackCount(), m_pCdInfo->GetAudioTrackCount(), m_pCdInfo->GetDataTrackCount() ); // Detect ISO9660(mode1/mode2), CDDA filesystem or UDF if (m_pCdInfo->IsISOHFS(1) || m_pCdInfo->IsIso9660(1) || m_pCdInfo->IsIso9660Interactive(1)) { strNewUrl = "iso9660://"; m_isoReader.Scan(); } else { if (m_pCdInfo->IsUDF(1) || m_pCdInfo->IsUDFX(1)) strNewUrl = "D:\\"; else if (m_pCdInfo->IsAudio(1)) { strNewUrl = "cdda://local/"; bCDDA = true; } else strNewUrl = "D:\\"; } if (m_pCdInfo->IsISOUDF(1)) { if (!g_advancedSettings.m_detectAsUdf) { strNewUrl = "iso9660://"; m_isoReader.Scan(); } else { strNewUrl = "D:\\"; } } CLog::Log(LOGINFO, "Using protocol %s", strNewUrl.c_str()); if (m_pCdInfo->IsValidFs()) { if (!m_pCdInfo->IsAudio(1)) CLog::Log(LOGINFO, "Disc label: %s", m_pCdInfo->GetDiscLabel().c_str()); } else { CLog::Log(LOGWARNING, "Filesystem is not supported"); } CStdString strLabel = ""; if (bCDDA) { strLabel = "Audio-CD"; } else { strLabel = m_pCdInfo->GetDiscLabel(); strLabel.TrimRight(" "); } SetNewDVDShareUrl( strNewUrl , bCDDA, strLabel); }