00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00060
00061 #ifndef _CDIO_SECTOR_H_
00062 #define _CDIO_SECTOR_H_
00063
00064 #ifdef __cplusplus
00065 extern "C" {
00066 #endif
00067
00068 #include <cdio/types.h>
00069
00073 #define CDIO_SUBCHANNEL_SUBQ_DATA 0
00074 #define CDIO_SUBCHANNEL_CURRENT_POSITION 1
00075 #define CDIO_SUBCHANNEL_MEDIA_CATALOG 2
00076 #define CDIO_SUBCHANNEL_TRACK_ISRC 3
00077
00081 typedef enum {
00082 NONE = 0x00,
00083 PRE_EMPHASIS = 0x01,
00084 COPY_PERMITTED = 0x02,
00085 DATA = 0x04,
00086 FOUR_CHANNEL_AUDIO = 0x08,
00087 SCMS = 0x10
00088 } flag_t;
00089
00090 #define CDIO_PREGAP_SECTORS 150
00091 #define CDIO_POSTGAP_SECTORS 150
00092
00098 extern enum cdio_cd_enums {
00099 CDIO_CD_MINS = 74,
00101 CDIO_CD_SECS_PER_MIN = 60,
00102 CDIO_CD_FRAMES_PER_SEC = 75,
00103 CDIO_CD_SYNC_SIZE = 12,
00105 CDIO_CD_CHUNK_SIZE = 24,
00107 CDIO_CD_NUM_OF_CHUNKS = 98,
00108 CDIO_CD_FRAMESIZE_SUB = 96,
00109 CDIO_CD_HEADER_SIZE = 4,
00111 CDIO_CD_SUBHEADER_SIZE = 8,
00113 CDIO_CD_ECC_SIZE = 276,
00115 CDIO_CD_FRAMESIZE = 2048,
00117 CDIO_CD_FRAMESIZE_RAW = 2352,
00118 CDIO_CD_FRAMESIZE_RAWER = 2646,
00120 CDIO_CD_FRAMESIZE_RAW1 = 2340,
00121 CDIO_CD_FRAMESIZE_RAW0 = 2336,
00122 CDIO_CD_MAX_SESSIONS = 99,
00123 CDIO_CD_MIN_SESSION_NO = 1,
00124 CDIO_CD_MAX_LSN = 450150,
00125 CDIO_CD_MIN_LSN = -450150,
00126 } cdio_cd_enums;
00127
00133 #define CDIO_CD_MINS 74
00135 #define CDIO_CD_SECS_PER_MIN 60
00136 #define CDIO_CD_FRAMES_PER_SEC 75
00137 #define CDIO_CD_SYNC_SIZE 12
00138 #define CDIO_CD_CHUNK_SIZE 24
00139 #define CDIO_CD_NUM_OF_CHUNKS 98
00140 #define CDIO_CD_FRAMESIZE_SUB 96
00141 #define CDIO_CD_HEADER_SIZE 4
00143 #define CDIO_CD_SUBHEADER_SIZE 8
00145 #define CDIO_CD_EDC_SIZE 4
00147 #define CDIO_CD_M1F1_ZERO_SIZE 8
00149 #define CDIO_CD_ECC_SIZE 276
00151 #define CDIO_CD_FRAMESIZE 2048
00152 #define CDIO_CD_FRAMESIZE_RAW 2352
00153 #define CDIO_CD_FRAMESIZE_RAWER 2646
00155 #define CDIO_CD_FRAMESIZE_RAW1 (CDIO_CD_CD_FRAMESIZE_RAW-CDIO_CD_SYNC_SIZE)
00156 #define CDIO_CD_FRAMESIZE_RAW0 (CDIO_CD_FRAMESIZE_RAW-CDIO_CD_SYNC_SIZE-CDIO_CD_HEADER_SIZE)
00157
00159 #define CDIO_CD_XA_HEADER (CDIO_CD_HEADER_SIZE+CDIO_CD_SUBHEADER_SIZE)
00160
00162 #define CDIO_CD_XA_TAIL (CDIO_CD_EDC_SIZE+CDIO_CD_ECC_SIZE)
00163
00165 #define CDIO_CD_XA_SYNC_HEADER (CDIO_CD_SYNC_SIZE+CDIO_CD_XA_HEADER)
00166
00169 extern const uint8_t CDIO_SECTOR_SYNC_HEADER[CDIO_CD_SYNC_SIZE];
00179 extern enum m2_sector_enums {
00180 M2F2_SECTOR_SIZE = 2324,
00181 M2SUB_SECTOR_SIZE = 2332,
00182 M2RAW_SECTOR_SIZE = 2336
00183 } m2_sector_enums;
00184
00185 #define M2F2_SECTOR_SIZE 2324
00186 #define M2SUB_SECTOR_SIZE 2332
00187 #define M2RAW_SECTOR_SIZE 2336
00188
00190 #define CDIO_CD_MAX_SESSIONS 99
00191
00192 #define CDIO_CD_MIN_SESSION_NO 1
00193
00195 #define CDIO_CD_MAX_LSN 450150
00196
00197 #define CDIO_CD_MIN_LSN -450150
00198
00199
00200 #define CDIO_CD_FRAMES_PER_MIN \
00201 (CDIO_CD_FRAMES_PER_SEC*CDIO_CD_SECS_PER_MIN)
00202
00203 #define CDIO_CD_74MIN_SECTORS (UINT32_C(74)*CDIO_CD_FRAMES_PER_MIN)
00204 #define CDIO_CD_80MIN_SECTORS (UINT32_C(80)*CDIO_CD_FRAMES_PER_MIN)
00205 #define CDIO_CD_90MIN_SECTORS (UINT32_C(90)*CDIO_CD_FRAMES_PER_MIN)
00206
00207 #define CDIO_CD_MAX_SECTORS \
00208 (UINT32_C(100)*CDIO_CD_FRAMES_PER_MIN-CDIO_PREGAP_SECTORS)
00209
00210 #define msf_t_SIZEOF 3
00211
00215 char *cdio_lba_to_msf_str (lba_t i_lba);
00216
00220 char *cdio_msf_to_str (const msf_t *p_msf);
00221
00225 lba_t cdio_lba_to_lsn (lba_t i_lba);
00226
00230 void cdio_lba_to_msf(lba_t i_lba, msf_t *p_msf);
00231
00236 lba_t cdio_lsn_to_lba (lsn_t i_lsn);
00237
00241 void cdio_lsn_to_msf (lsn_t i_lsn, msf_t *p_msf);
00242
00247 lba_t cdio_msf_to_lba (const msf_t *p_msf);
00248
00253 lsn_t cdio_msf_to_lsn (const msf_t *p_msf);
00254
00260 lba_t cdio_msf3_to_lba (unsigned int minutes, unsigned int seconds,
00261 unsigned int frames);
00262
00267 lba_t cdio_mmssff_to_lba (const char *psz_mmssff);
00268
00269 #ifdef __cplusplus
00270 }
00271 #endif
00272
00273 #endif
00274
00275
00276
00277
00278
00279
00280
00281
00282