当前位置: 首页>>代码示例>>C++>>正文


C++ CCdInfo::SetFirstTrack方法代码示例

本文整理汇总了C++中CCdInfo::SetFirstTrack方法的典型用法代码示例。如果您正苦于以下问题:C++ CCdInfo::SetFirstTrack方法的具体用法?C++ CCdInfo::SetFirstTrack怎么用?C++ CCdInfo::SetFirstTrack使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CCdInfo的用法示例。


在下文中一共展示了CCdInfo::SetFirstTrack方法的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;
    }
//.........这里部分代码省略.........
开发者ID:69thelememt,项目名称:xbmc,代码行数:101,代码来源:cdioSupport.cpp

示例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
//.........这里部分代码省略.........
开发者ID:derobert,项目名称:debianlink-xbmc,代码行数:101,代码来源:cdioSupport.cpp


注:本文中的CCdInfo::SetFirstTrack方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。