本文整理汇总了C++中CCdInfo::SetTrackInformation方法的典型用法代码示例。如果您正苦于以下问题:C++ CCdInfo::SetTrackInformation方法的具体用法?C++ CCdInfo::SetTrackInformation怎么用?C++ CCdInfo::SetTrackInformation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCdInfo
的用法示例。
在下文中一共展示了CCdInfo::SetTrackInformation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetCdInfo
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;
ti.nMins = 0;
ti.nSecs = 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;
}
//.........这里部分代码省略.........
示例2: GetCdInfo
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)
{
char buf[1024];
sprintf(buf, "%s: Error in automatically selecting driver with input\n",
__FUNCTION__);
OutputDebugString( buf );
return NULL;
}
bool bIsCDRom = true;
m_nFirstTrackNum = ::cdio_get_first_track_num(cdio);
if (m_nFirstTrackNum == CDIO_INVALID_TRACK)
{
#ifndef __APPLE__
::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)
{
#ifndef __APPLE__
::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))
{
char buf[1024];
trackinfo ti;
ti.nfsInfo = FS_UNKNOWN;
ti.ms_offset = 0;
ti.isofs_size = 0;
ti.nJolietLevel = 0;
ti.nFrames = 0;
cdtext_init(&ti.cdtext);
info->SetTrackInformation( i, ti );
sprintf( buf, "cdio_track_msf for track %i failed, I give up.\n", i);
OutputDebugString( buf );
delete info;
::cdio_destroy(cdio);
return NULL;
}
trackinfo ti_0, ti;
cdtext_init(&ti_0.cdtext);
cdtext_init(&ti.cdtext);
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)
{
GetCdTextInfo(&ti_0, 0);
info->SetDiscCDTextInformation( ti_0.cdtext );
}
// Get this tracks info
GetCdTextInfo(&ti, i);
}
else
//.........这里部分代码省略.........