File indexing completed on 2025-03-23 04:28:12
0001 /* 0002 SPDX-FileCopyrightText: 1998-2009 Sebastian Trueg <trueg@k3b.org> 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 0006 0007 #ifndef K3BTRACK_H 0008 #define K3BTRACK_H 0009 0010 #include "k3bmsf.h" 0011 #include "k3bdevice_export.h" 0012 0013 #include <QSharedDataPointer> 0014 0015 namespace K3b { 0016 namespace Device 0017 { 0018 class LIBK3BDEVICE_EXPORT Track 0019 { 0020 public: 0021 enum TrackType { 0022 TYPE_AUDIO, 0023 TYPE_DATA, 0024 TYPE_UNKNOWN = -1 0025 }; 0026 0027 enum DataMode { 0028 MODE1, 0029 MODE2, 0030 XA_FORM1, 0031 XA_FORM2, 0032 DVD, 0033 UNKNOWN 0034 }; 0035 0036 Track(); 0037 Track( const Track& ); 0038 Track( const K3b::Msf& firstSector, 0039 const K3b::Msf& lastSector, 0040 TrackType type, 0041 DataMode mode = UNKNOWN ); 0042 ~Track(); 0043 0044 Track& operator=( const Track& ); 0045 0046 TrackType type() const; 0047 0048 void setType( TrackType ); 0049 0050 /** 0051 * UNKNOWN for DVDs and Audio CDs 0052 */ 0053 DataMode mode() const; 0054 0055 void setMode( DataMode ); 0056 0057 /** 0058 * Invalid for DVDs 0059 */ 0060 bool copyPermitted() const; 0061 void setCopyPermitted( bool b ); 0062 0063 /** 0064 * Only valid for audio tracks 0065 */ 0066 bool preEmphasis() const; 0067 void setPreEmphasis( bool b ); 0068 0069 bool recordedIncremental() const; 0070 bool recordedUninterrupted() const; 0071 0072 QByteArray isrc() const; 0073 void setIsrc( const QByteArray& s ); 0074 0075 K3b::Msf firstSector() const; 0076 K3b::Msf lastSector() const; 0077 void setFirstSector( const K3b::Msf& msf ); 0078 void setLastSector( const K3b::Msf& msf ); 0079 0080 K3b::Msf nextWritableAddress() const; 0081 void setNextWritableAddress( const K3b::Msf& ); 0082 0083 K3b::Msf freeBlocks() const; 0084 void setFreeBlocks( const K3b::Msf& ); 0085 0086 K3b::Msf length() const; 0087 0088 /** 0089 * This takes index0 into account 0090 */ 0091 K3b::Msf realAudioLength() const; 0092 0093 /** 0094 * 0 if unknown 0095 */ 0096 int session() const; 0097 void setSession( int s ); 0098 0099 /** 0100 * @return number of indices. This does not include index 0. 0101 */ 0102 int indexCount() const; 0103 0104 /** 0105 * Returns the index relative to the track's start. 0106 * If it is zero there is no index0. 0107 */ 0108 K3b::Msf index0() const; 0109 0110 /** 0111 * Set the track's index0 value. 0112 * @param msf offset relative to track start. 0113 */ 0114 void setIndex0( const K3b::Msf& msf ); 0115 0116 /** 0117 * All indices. Normally this list is empty as indices are rarely used. 0118 * Starts with index 2 (since index 1 are all other sectors FIXME) 0119 */ 0120 QList<K3b::Msf> indices() const; 0121 0122 void setIndices( const QList<K3b::Msf>& ); 0123 0124 bool operator==( const Track& ) const; 0125 bool operator!=( const Track& ) const; 0126 0127 private: 0128 class Private; 0129 QSharedDataPointer<Private> d; 0130 }; 0131 } 0132 } 0133 0134 LIBK3BDEVICE_EXPORT QDebug operator<<( QDebug s, const K3b::Device::Track& track ); 0135 0136 /** 0137 * Dummy implementation to allow compilation on Windows 0138 */ 0139 uint qHash( const K3b::Device::Track& key ); 0140 0141 #endif