Logo Search packages:      
Sourcecode: k9copy version File versions  Download package

bool K3bDevice::Device::fixupToc ( K3bDevice::Toc toc  )  const [protected]

Fixes the last block on CD-Extra disks. This is needed if the readRawToc failed since in that case the first sector of the last session's first track is used as the previous session's last track's last sector which is wrong. There is a 11400 block session lead-in between them. This method fixes this only for the last session and only on linux.

Definition at line 1423 of file k3bdevice.cpp.

References K3bDevice::Toc::contentType(), numSessions(), and readTocPmaAtip().

Referenced by readToc().

{
  bool success = false;

  //
  // This is a very lame method of fixing the TOC of an Advanced Audio CD
  // (a CD with two sessions: one with audio tracks and one with the data track)
  // If a drive does not support reading raw toc or reading track info we only
  // get every track's first sector. But between sessions there is a gap which is used
  // for ms stuff. In this case it's 11400 sectors in size. When ripping ausio we would
  // include these 11400 sectors which would result in a strange ending audio file.
  //
  if( numSessions() > 1 || toc.contentType() == MIXED ) {
    kdDebug() << "(K3bDevice::Device) fixup multisession toc..." << endl;

    //
    // we need to update the last sector of every last track in every session
    // for now we only update the track before the last session...
    // This is the most often case: Advanced Audio CD
    //

    unsigned char* data = 0;
    int dataLen = 0;
    if( readTocPmaAtip( &data, dataLen, 1, false, 0 ) ) {

      //
      // data[6]    - first track number in last complete session
      // data[8-11] - start adress of first track in last session
      //

      toc[(unsigned int)data[6]-2].m_lastSector = from4Byte( &data[8] ) - 11400 - 1;

      delete [] data;
      success = true;
    }
    else
      kdDebug() << "(K3bDevice::Device) FIXUP TOC failed." << endl;
  }

  return success;
}


Generated by  Doxygen 1.6.0   Back to index