本文整理汇总了C++中CCdInfo::GetTrackInformation方法的典型用法代码示例。如果您正苦于以下问题:C++ CCdInfo::GetTrackInformation方法的具体用法?C++ CCdInfo::GetTrackInformation怎么用?C++ CCdInfo::GetTrackInformation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCdInfo
的用法示例。
在下文中一共展示了CCdInfo::GetTrackInformation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Load
bool CMusicInfoTagLoaderCDDA::Load(const std::string& strFileName, CMusicInfoTag& tag, EmbeddedArt *art)
{
#ifdef HAS_DVD_DRIVE
try
{
tag.SetURL(strFileName);
bool bResult = false;
// Get information for the inserted disc
CCdInfo* pCdInfo = g_mediaManager.GetCdInfo();
if (pCdInfo == NULL)
return bResult;
// Prepare cddb
Xcddb cddb;
cddb.setCacheDir(CProfilesManager::GetInstance().GetCDDBFolder());
int iTrack = atoi(strFileName.substr(13, strFileName.size() - 13 - 5).c_str());
// duration is always available
tag.SetDuration( ( pCdInfo->GetTrackInformation(iTrack).nMins * 60 )
+ pCdInfo->GetTrackInformation(iTrack).nSecs );
// Only load cached cddb info in this tag loader, the internet database query is made in CCDDADirectory
if (pCdInfo->HasCDDBInfo() && cddb.isCDCached(pCdInfo))
{
// get cddb information
if (cddb.queryCDinfo(pCdInfo))
{
// Fill the fileitems music tag with cddb information, if available
std::string strTitle = cddb.getTrackTitle(iTrack);
if (!strTitle.empty())
{
// Tracknumber
tag.SetTrackNumber(iTrack);
// Title
tag.SetTitle(strTitle);
// Artist: Use track artist or disc artist
std::string strArtist = cddb.getTrackArtist(iTrack);
if (strArtist.empty())
cddb.getDiskArtist(strArtist);
tag.SetArtist(strArtist);
// Album
std::string strAlbum;
cddb.getDiskTitle( strAlbum );
tag.SetAlbum(strAlbum);
// Album Artist
std::string strAlbumArtist;
cddb.getDiskArtist(strAlbumArtist);
tag.SetAlbumArtist(strAlbumArtist);
// Year
SYSTEMTIME dateTime;
dateTime.wYear = atoi(cddb.getYear().c_str());
tag.SetReleaseDate( dateTime );
// Genre
tag.SetGenre( cddb.getGenre() );
tag.SetLoaded(true);
bResult = true;
}
}
}
else
{
// No cddb info, maybe we have CD-Text
trackinfo ti = pCdInfo->GetTrackInformation(iTrack);
// Fill the fileitems music tag with CD-Text information, if available
std::string strTitle = ti.cdtext[CDTEXT_TITLE];
if (!strTitle.empty())
{
// Tracknumber
tag.SetTrackNumber(iTrack);
// Title
tag.SetTitle(strTitle);
// Get info for track zero, as we may have and need CD-Text Album info
xbmc_cdtext_t discCDText = pCdInfo->GetDiscCDTextInformation();
// Artist: Use track artist or disc artist
std::string strArtist = ti.cdtext[CDTEXT_PERFORMER];
if (strArtist.empty())
strArtist = discCDText[CDTEXT_PERFORMER];
tag.SetArtist(strArtist);
// Album
std::string strAlbum;
strAlbum = discCDText[CDTEXT_TITLE];
tag.SetAlbum(strAlbum);
// Genre: use track or disc genre
std::string strGenre = ti.cdtext[CDTEXT_GENRE];
if (strGenre.empty())
//.........这里部分代码省略.........