本文整理汇总了C++中CCdInfo类的典型用法代码示例。如果您正苦于以下问题:C++ CCdInfo类的具体用法?C++ CCdInfo怎么用?C++ CCdInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CCdInfo类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lock
CCdInfo* CCdIoSupport::GetCdInfo(char* cDeviceFileName)
{
CSingleLock lock(*m_cdio);
char* source_name;
if(cDeviceFileName == NULL)
source_name = m_cdio->GetDeviceFileName();
else
source_name = cDeviceFileName;
cdio = ::cdio_open(source_name, DRIVER_UNKNOWN);
if (cdio == NULL)
{
CLog::Log(LOGERROR, "%s: Error in automatically selecting driver with input", __FUNCTION__);
return NULL;
}
bool bIsCDRom = true;
m_nFirstTrackNum = ::cdio_get_first_track_num(cdio);
if (m_nFirstTrackNum == CDIO_INVALID_TRACK)
{
#if !defined(TARGET_DARWIN)
::cdio_destroy(cdio);
return NULL;
#else
m_nFirstTrackNum = 1;
bIsCDRom = false;
#endif
}
m_nNumTracks = ::cdio_get_num_tracks(cdio);
if (m_nNumTracks == CDIO_INVALID_TRACK)
{
#if !defined(TARGET_DARWIN)
::cdio_destroy(cdio);
return NULL;
#else
m_nNumTracks = 1;
bIsCDRom = false;
#endif
}
CCdInfo* info = new CCdInfo;
info->SetFirstTrack( m_nFirstTrackNum );
info->SetTrackCount( m_nNumTracks );
for (i = m_nFirstTrackNum; i <= CDIO_CDROM_LEADOUT_TRACK; i++)
{
msf_t msf;
if (bIsCDRom && !::cdio_get_track_msf(cdio, i, &msf))
{
trackinfo ti;
ti.nfsInfo = FS_UNKNOWN;
ti.ms_offset = 0;
ti.isofs_size = 0;
ti.nJolietLevel = 0;
ti.nFrames = 0;
info->SetTrackInformation( i, ti );
CLog::Log(LOGDEBUG, "cdio_track_msf for track %i failed, I give up.", i);
delete info;
::cdio_destroy(cdio);
return NULL;
}
trackinfo ti;
if (bIsCDRom && TRACK_FORMAT_AUDIO == ::cdio_get_track_format(cdio, i))
{
m_nNumAudio++;
ti.nfsInfo = FS_NO_DATA;
m_nFs = FS_NO_DATA;
int temp1 = ::cdio_get_track_lba(cdio, i) - CDIO_PREGAP_SECTORS;
int temp2 = ::cdio_get_track_lba(cdio, i + 1) - CDIO_PREGAP_SECTORS;
// the length is the address of the second track minus the address of the first track
temp2 -= temp1; // temp2 now has length of track1 in frames
ti.nMins = temp2 / (60 * 75); // calculate the number of minutes
temp2 %= 60 * 75; // calculate the left-over frames
ti.nSecs = temp2 / 75; // calculate the number of seconds
if ( -1 == m_nFirstAudio)
m_nFirstAudio = i;
// Make sure that we have the Disc related info available
if (i == 1)
{
xbmc_cdtext_t xcdt;
GetCdTextInfo(xcdt, 0);
info->SetDiscCDTextInformation( xcdt );
}
// Get this tracks info
GetCdTextInfo(ti.cdtext, i);
}
else
{
m_nNumData++;
if ( -1 == m_nFirstData)
m_nFirstData = i;
}
ti.nfsInfo = FS_NO_DATA;
ti.ms_offset = 0;
//.........这里部分代码省略.........
示例2: if
void CGUIWindowMusicSongs::GetContextButtons(int itemNumber, CContextButtons &buttons)
{
CFileItemPtr item;
if (itemNumber >= 0 && itemNumber < m_vecItems->Size())
item = m_vecItems->Get(itemNumber);
if (item)
{
// are we in the playlists location?
bool inPlaylists = m_vecItems->GetPath().Equals(CUtil::MusicPlaylistsLocation()) ||
m_vecItems->GetPath().Equals("special://musicplaylists/");
if (m_vecItems->IsVirtualDirectoryRoot())
{
// get the usual music shares, and anything for all media windows
CGUIDialogContextMenu::GetContextButtons("music", item, buttons);
#ifdef HAS_DVD_DRIVE
// enable Rip CD an audio disc
if (g_mediaManager.IsDiscInDrive() && item->IsCDDA())
{
// those cds can also include Audio Tracks: CDExtra and MixedMode!
CCdInfo *pCdInfo = g_mediaManager.GetCdInfo();
if (pCdInfo->IsAudio(1) || pCdInfo->IsCDExtra(1) || pCdInfo->IsMixedMode(1))
buttons.Add(CONTEXT_BUTTON_RIP_CD, 600);
}
#endif
CGUIMediaWindow::GetContextButtons(itemNumber, buttons);
}
else
{
CGUIWindowMusicBase::GetContextButtons(itemNumber, buttons);
if (item->GetProperty("pluginreplacecontextitems").asBoolean())
return;
if (!item->IsPlayList())
{
if (item->IsAudio() && !item->IsLastFM())
buttons.Add(CONTEXT_BUTTON_SONG_INFO, 658); // Song Info
else if (!item->IsParentFolder() && !item->IsLastFM() &&
!item->GetPath().Left(3).Equals("new") && item->m_bIsFolder)
{
#if 0
if (m_musicdatabase.GetAlbumIdByPath(item->GetPath()) > -1)
#endif
buttons.Add(CONTEXT_BUTTON_INFO, 13351); // Album Info
}
}
#ifdef HAS_DVD_DRIVE
// enable Rip CD Audio or Track button if we have an audio disc
if (g_mediaManager.IsDiscInDrive() && m_vecItems->IsCDDA())
{
// those cds can also include Audio Tracks: CDExtra and MixedMode!
CCdInfo *pCdInfo = g_mediaManager.GetCdInfo();
if (pCdInfo->IsAudio(1) || pCdInfo->IsCDExtra(1) || pCdInfo->IsMixedMode(1))
buttons.Add(CONTEXT_BUTTON_RIP_TRACK, 610);
}
#endif
// enable CDDB lookup if the current dir is CDDA
if (g_mediaManager.IsDiscInDrive() && m_vecItems->IsCDDA() &&
(g_settings.GetCurrentProfile().canWriteDatabases() || g_passwordManager.bMasterUser))
{
buttons.Add(CONTEXT_BUTTON_CDDB, 16002);
}
if (!item->IsParentFolder() && !item->IsReadOnly())
{
// either we're at the playlist location or its been explicitly allowed
if (inPlaylists || g_guiSettings.GetBool("filelists.allowfiledeletion"))
{
buttons.Add(CONTEXT_BUTTON_DELETE, 117);
buttons.Add(CONTEXT_BUTTON_RENAME, 118);
}
}
}
// Add the scan button(s)
if (g_application.IsMusicScanning())
buttons.Add(CONTEXT_BUTTON_STOP_SCANNING, 13353); // Stop Scanning
else if (!inPlaylists && !m_vecItems->IsInternetStream() &&
!item->IsLastFM() &&
!item->GetPath().Equals("add") && !item->IsParentFolder() &&
!item->IsPlugin() &&
(g_settings.GetCurrentProfile().canWriteDatabases() || g_passwordManager.bMasterUser))
{
buttons.Add(CONTEXT_BUTTON_SCAN, 13352);
}
if (item->IsPlugin() || item->IsScript() || m_vecItems->IsPlugin())
buttons.Add(CONTEXT_BUTTON_PLUGIN_SETTINGS, 1045);
}
if (!m_vecItems->IsVirtualDirectoryRoot())
buttons.Add(CONTEXT_BUTTON_SWITCH_MEDIA, 523);
CGUIWindowMusicBase::GetNonContextButtons(buttons);
}