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

K3b::Msf K3bDevice::Device::discSize (  )  const

Returns:
The media size.

Definition at line 600 of file k3bdevice.cpp.

References blockDeviceName(), close(), isOpen(), K3bDevice::Toc::lastSector(), open(), readDiscInfo(), and readToc().

{
  // if the device is already opened we do not close it
  // to allow fast multible method calls in a row
  bool needToClose = !isOpen();

  K3b::Msf ret(0);
  if( !open() )
    return ret;

  unsigned char* data = 0;
  int dataLen = 0;

  if( readDiscInfo( &data, dataLen ) ) {
    disc_info_t* inf = (disc_info_t*)data;
    if ( inf->lead_out_m != 0xFF && inf->lead_out_s != 0xFF && inf->lead_out_f != 0xFF ) {
      ret = K3b::Msf( inf->lead_out_m, inf->lead_out_s, inf->lead_out_f );
      ret -= 150;
    }

    delete [] data;
  }

  if( ret == 0 ) {
    kdDebug() << "(K3bDevice::Device) " << blockDeviceName()
            << "READ DISC INFORMATION failed. getting disk size via toc." << endl;
    Toc toc = readToc();
    ret = toc.lastSector();
  }

  if( needToClose )
    close();

  return ret;
}


Generated by  Doxygen 1.6.0   Back to index