libcdio
0.82
|
00001 /* 00002 $Id: sector.h,v 1.38 2008/03/25 15:59:09 karl Exp $ 00003 00004 Copyright (C) 2003, 2004, 2005, 2006, 2008 Rocky Bernstein <rocky@gnu.org> 00005 Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org> 00006 00007 This program is free software: you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation, either version 3 of the License, or 00010 (at your option) any later version. 00011 00012 This program is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with this program. If not, see <http://www.gnu.org/licenses/>. 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, /* no flags set */ 00082 PRE_EMPHASIS = 0x01, /* audio track recorded with pre-emphasis */ 00083 COPY_PERMITTED = 0x02, /* digital copy permitted */ 00084 DATA = 0x04, /* data track */ 00085 FOUR_CHANNEL_AUDIO = 0x08, /* 4 audio channels */ 00086 SCMS = 0x10 /* SCMS (5.29.2.7) */ 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) /*2340*/ 00155 #define CDIO_CD_FRAMESIZE_RAW0 (CDIO_CD_FRAMESIZE_RAW-CDIO_CD_SYNC_SIZE-CDIO_CD_HEADER_SIZE) /*2336*/ 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 /*DO_NOT_WANT_PARANOIA_COMPATIBILITY*/ 00276 00277 #endif /* _CDIO_SECTOR_H_ */ 00278 00279 00280 /* 00281 * Local variables: 00282 * c-file-style: "gnu" 00283 * tab-width: 8 00284 * indent-tabs-mode: nil 00285 * End: 00286 */