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

int K3bDevice::Device::getDataMode ( const K3b::Msf sector  )  const

Returns:
the mode of a data track. K3bDevice::Track::MODE1, K3bDevice::Track::MODE2, K3bDevice::Track::XA_FORM1, or K3bDevice::Track::XA_FORM2.

Definition at line 704 of file k3bdevice.cpp.

References close(), isOpen(), open(), and readCdMsf().

Referenced by getTrackDataMode().

{
  bool needToClose = !isOpen();

  int ret = Track::UNKNOWN;

  if( !open() )
    return ret;

  // we use readCdMsf here since it's defined mandatory in MMC1 and
  // we only use this method for CDs anyway
  unsigned char data[2352];
  bool readSuccess = readCdMsf( data, 2352,
                        0,      // all sector types
                        false,  // no dap
                        sector,
                        sector+1,
                        true, // SYNC
                        true, // HEADER
                        true, // SUBHEADER
                        true, // USER DATA
                        true, // EDC/ECC
                        0,    // no c2 info
                        0 );

  if( readSuccess ) {
    if ( data[15] == 0x1 )
      ret = Track::MODE1;
    else if ( data[15] == 0x2 )
      ret = Track::MODE2;
    if ( ret == Track::MODE2 ) {
      if ( data[16] == data[20] &&
           data[17] == data[21] &&
           data[18] == data[22] &&
           data[19] == data[23] ) {
      if ( data[18] & 0x20 )
        ret = Track::XA_FORM2;
      else
        ret = Track::XA_FORM1;
      }
    }
  }

  if( needToClose )
    close();

  return ret;
}


Generated by  Doxygen 1.6.0   Back to index