// // BwgBurn - CD-R/CD-RW/DVD-R/DVD-RW burning program for Windows XP // // Copyright (C) 2006 by Jack W. Griffin (butchg@comcast.net) // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License // for more details. // // You should have received a copy of the GNU General Public License along // with this program; if not, write to the // // Free Software Foundation, Inc., // 59 Temple Place, Suite 330, // Boston, MA 02111-1307 USA // using System; using System.Collections.Generic; using System.Text; namespace Bwg.Scsi { /// /// This data structure contains the results from call ReadTrackInformation() to read /// data about a track /// public class TrackInformation : Result { #region public types /// /// This type represents the data mode for the track /// public enum DataModeType { /// /// Mode 1 user data (digital data, 2048 bytes per sector) /// Mode1 = 0x01, /// /// Mode 2 user data (digital data, multiple forms) /// Mode2 = 0x02, /// /// Audio data, 2352 bytes of audio data per sector /// Audio = 0x0f } ; #endregion #region public Track Information Members /// /// /// public readonly ushort TrackNumber; /// /// /// public readonly ushort SessionNumber; /// /// /// public readonly bool Copy; /// /// /// public readonly bool Damage; /// /// /// public readonly byte TrackMode; /// /// /// public readonly bool RT; /// /// /// public readonly bool Blank; /// /// /// public readonly bool Packet; /// /// /// public readonly bool FP; /// /// /// public readonly DataModeType DataMode; /// /// /// public readonly bool LRA_V; /// /// /// public readonly bool NWA_V; /// /// /// public readonly int TrackStartAddress; /// /// /// public readonly int NextWritableAddress; /// /// /// public readonly int FreeBlocks; /// /// /// public readonly int FixedPacketSize; /// /// /// public readonly int TrackSize; /// /// /// public readonly int LastRecordedAddress; /// /// /// public readonly int ReadCompatLBA; #endregion /// /// Contruct a read track result object from the raw data. /// /// the raw data buffer /// the size of the raw buffer in bytes public TrackInformation(IntPtr buf, int size) : base(buf, size) { TrackNumber = Get16(32, 2) ; SessionNumber = Get16(33, 3) ; Copy = GetBit(5,4) ; Damage = GetBit(5,5) ; TrackMode = (byte)(Get8(5) & 0x0f) ; RT = GetBit(6,7) ; Blank = GetBit(6,6) ; Packet = GetBit(6,5) ; FP = GetBit(6,4) ; DataMode = (DataModeType)(Get8(6) & 0x0f); LRA_V = GetBit(7, 1) ; NWA_V = GetBit(7, 0) ; TrackStartAddress = (int)Get32(8) ; NextWritableAddress = (int)Get32(12) ; FreeBlocks = Get32Int(16) ; FixedPacketSize = Get32Int(20) ; TrackSize = Get32Int(24) ; LastRecordedAddress = (int)Get32(28) ; ReadCompatLBA = (int)Get32(36) ; } #region public properties /// /// An alias for fixed packet size depending on the mode of the track. /// public int BlockingFactor { get { return FixedPacketSize; } } #endregion } }