00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00059
00060 #ifndef _CDIO_SECTOR_H_
00061 #define _CDIO_SECTOR_H_
00062
00063 #ifdef __cplusplus
00064 extern "C" {
00065 #endif
00066
00067 #include <cdio/types.h>
00068
00072 #define CDIO_SUBCHANNEL_SUBQ_DATA 0
00073 #define CDIO_SUBCHANNEL_CURRENT_POSITION 1
00074 #define CDIO_SUBCHANNEL_MEDIA_CATALOG 2
00075 #define CDIO_SUBCHANNEL_TRACK_ISRC 3
00076
00080 typedef enum {
00081 NONE = 0x00,
00082 PRE_EMPHASIS = 0x01,
00083 COPY_PERMITTED = 0x02,
00084 DATA = 0x04,
00085 FOUR_CHANNEL_AUDIO = 0x08,
00086 SCMS = 0x10
00087 } flag_t;
00088
00089 #define CDIO_PREGAP_SECTORS 150
00090 #define CDIO_POSTGAP_SECTORS 150
00091
00097 extern enum cdio_cd_enums {
00098 CDIO_CD_MINS = 74,
00100 CDIO_CD_SECS_PER_MIN = 60,
00101 CDIO_CD_FRAMES_PER_SEC = 75,
00102 CDIO_CD_SYNC_SIZE = 12,
00104 CDIO_CD_CHUNK_SIZE = 24,
00106 CDIO_CD_NUM_OF_CHUNKS = 98,
00107 CDIO_CD_FRAMESIZE_SUB = 96,
00108 CDIO_CD_HEADER_SIZE = 4,
00110 CDIO_CD_SUBHEADER_SIZE = 8,
00112 CDIO_CD_ECC_SIZE = 276,
00114 CDIO_CD_FRAMESIZE = 2048,
00116 CDIO_CD_FRAMESIZE_RAW = 2352,
00117 CDIO_CD_FRAMESIZE_RAWER = 2646,
00119 CDIO_CD_FRAMESIZE_RAW1 = 2340,
00120 CDIO_CD_FRAMESIZE_RAW0 = 2336,
00121 CDIO_CD_MAX_SESSIONS = 99,
00122 CDIO_CD_MIN_SESSION_NO = 1,
00123 CDIO_CD_MAX_LSN = 450150,
00124 CDIO_CD_MIN_LSN = -450150,
00125 } cdio_cd_enums;
00126
00132 #define CDIO_CD_MINS 74
00134 #define CDIO_CD_SECS_PER_MIN 60
00135 #define CDIO_CD_FRAMES_PER_SEC 75
00136 #define CDIO_CD_SYNC_SIZE 12
00137 #define CDIO_CD_CHUNK_SIZE 24
00138 #define CDIO_CD_NUM_OF_CHUNKS 98
00139 #define CDIO_CD_FRAMESIZE_SUB 96
00140 #define CDIO_CD_HEADER_SIZE 4
00142 #define CDIO_CD_SUBHEADER_SIZE 8
00144 #define CDIO_CD_EDC_SIZE 4
00146 #define CDIO_CD_M1F1_ZERO_SIZE 8
00148 #define CDIO_CD_ECC_SIZE 276
00150 #define CDIO_CD_FRAMESIZE 2048
00151 #define CDIO_CD_FRAMESIZE_RAW 2352
00152 #define CDIO_CD_FRAMESIZE_RAWER 2646
00154 #define CDIO_CD_FRAMESIZE_RAW1 (CDIO_CD_CD_FRAMESIZE_RAW-CDIO_CD_SYNC_SIZE)
00155 #define CDIO_CD_FRAMESIZE_RAW0 (CDIO_CD_FRAMESIZE_RAW-CDIO_CD_SYNC_SIZE-CDIO_CD_HEADER_SIZE)
00156
00158 #define CDIO_CD_XA_HEADER (CDIO_CD_HEADER_SIZE+CDIO_CD_SUBHEADER_SIZE)
00159
00161 #define CDIO_CD_XA_TAIL (CDIO_CD_EDC_SIZE+CDIO_CD_ECC_SIZE)
00162
00164 #define CDIO_CD_XA_SYNC_HEADER (CDIO_CD_SYNC_SIZE+CDIO_CD_XA_HEADER)
00165
00168 extern const uint8_t CDIO_SECTOR_SYNC_HEADER[CDIO_CD_SYNC_SIZE];
00178 extern enum m2_sector_enums {
00179 M2F2_SECTOR_SIZE = 2324,
00180 M2SUB_SECTOR_SIZE = 2332,
00181 M2RAW_SECTOR_SIZE = 2336
00182 } m2_sector_enums;
00183
00184 #define M2F2_SECTOR_SIZE 2324
00185 #define M2SUB_SECTOR_SIZE 2332
00186 #define M2RAW_SECTOR_SIZE 2336
00187
00189 #define CDIO_CD_MAX_SESSIONS 99
00190
00191 #define CDIO_CD_MIN_SESSION_NO 1
00192
00194 #define CDIO_CD_MAX_LSN 450150
00195
00196 #define CDIO_CD_MIN_LSN -450150
00197
00198
00199 #define CDIO_CD_FRAMES_PER_MIN \
00200 (CDIO_CD_FRAMES_PER_SEC*CDIO_CD_SECS_PER_MIN)
00201
00202 #define CDIO_CD_74MIN_SECTORS (UINT32_C(74)*CDIO_CD_FRAMES_PER_MIN)
00203 #define CDIO_CD_80MIN_SECTORS (UINT32_C(80)*CDIO_CD_FRAMES_PER_MIN)
00204 #define CDIO_CD_90MIN_SECTORS (UINT32_C(90)*CDIO_CD_FRAMES_PER_MIN)
00205
00206 #define CDIO_CD_MAX_SECTORS \
00207 (UINT32_C(100)*CDIO_CD_FRAMES_PER_MIN-CDIO_PREGAP_SECTORS)
00208
00209 #define msf_t_SIZEOF 3
00210
00214 char *cdio_lba_to_msf_str (lba_t i_lba);
00215
00219 char *cdio_msf_to_str (const msf_t *p_msf);
00220
00224 lba_t cdio_lba_to_lsn (lba_t i_lba);
00225
00229 void cdio_lba_to_msf(lba_t i_lba, msf_t *p_msf);
00230
00235 lba_t cdio_lsn_to_lba (lsn_t i_lsn);
00236
00240 void cdio_lsn_to_msf (lsn_t i_lsn, msf_t *p_msf);
00241
00246 lba_t cdio_msf_to_lba (const msf_t *p_msf);
00247
00252 lsn_t cdio_msf_to_lsn (const msf_t *p_msf);
00253
00259 lba_t cdio_msf3_to_lba (unsigned int minutes, unsigned int seconds,
00260 unsigned int frames);
00261
00266 lba_t cdio_mmssff_to_lba (const char *psz_mmssff);
00267
00268 #ifdef __cplusplus
00269 }
00270 #endif
00271
00272 #ifndef DO_NOT_WANT_PARANOIA_COMPATIBILITY
00273
00274 #define CD_FRAMESIZE_RAW CDIO_CD_FRAMESIZE_RAW
00275 #endif
00276
00277 #endif
00278
00279
00280
00281
00282
00283
00284
00285
00286