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

int K3bDevice::Device::dvdMediaType (  )  const

Does only make sense for dvd media.

Returns:
-1 on error K3bDevice::MediaType otherwise

Definition at line 2112 of file k3bdevice.cpp.

References currentProfile(), readDvdStructure(), and readsDvd().

Referenced by diskInfo(), isDVD(), and readToc().

{
  int m = MEDIA_UNKNOWN;

  if( readsDvd() ) {
    m = currentProfile();
    if( !(m & (MEDIA_WRITABLE_DVD|MEDIA_DVD_ROM)) )
      m = MEDIA_UNKNOWN;  // no profile information or CD media

    if( m & (MEDIA_UNKNOWN|MEDIA_DVD_ROM) ) {
      //
      // We prefere the mediatype as reported by the media since this way
      // even ROM drives may report the correct type of writable media.
      //

      // 4 bytes header + 2048 bytes layer descriptor
      unsigned char* data = 0;
      int dataLen = 0;
      if( readDvdStructure( &data, dataLen ) ) {
      switch( data[4]&0xF0 ) {
      case 0x00: m = MEDIA_DVD_ROM; break;
      case 0x10: m = MEDIA_DVD_RAM; break;
      case 0x20: m = MEDIA_DVD_R; break; // there seems to be no value for DVD-R DL, it reports DVD-R
      case 0x30: m = MEDIA_DVD_RW; break;
      case 0x90: m = MEDIA_DVD_PLUS_RW; break;
      case 0xA0: m = MEDIA_DVD_PLUS_R; break;
      case 0xE0: m = MEDIA_DVD_PLUS_R_DL; break;
      default: 
        kdDebug() << "(K3bDevice::Device) unknown dvd media type: " << QString::number(data[4]&0xF0, 8) << endl;
        break; // unknown
      }

      delete [] data;
      }
    }
  }

  return m;
}


Generated by  Doxygen 1.6.0   Back to index