libcdio  0.93
sector.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003, 2004, 2005, 2006, 2008, 2012
3  Rocky Bernstein <rocky@gnu.org>
4  Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
5 
6  This program is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
58 
59 #ifndef CDIO_SECTOR_H_
60 #define CDIO_SECTOR_H_
61 
62 #ifdef __cplusplus
63  extern "C" {
64 #endif
65 
66 #include <cdio/types.h>
67 
71  typedef enum cdio_subchannel
72  {
78 
82  typedef enum {
83  NONE = 0x00, /* no flags set */
84  PRE_EMPHASIS = 0x01, /* audio track recorded with pre-emphasis */
85  COPY_PERMITTED = 0x02, /* digital copy permitted */
86  DATA = 0x04, /* data track */
87  FOUR_CHANNEL_AUDIO = 0x08, /* 4 audio channels */
88  SCMS = 0x10 /* SCMS (5.29.2.7) */
89  } flag_t;
90 
91 #define CDIO_PREGAP_SECTORS 150
92 #define CDIO_POSTGAP_SECTORS 150
93 
99  extern enum cdio_cd_enums {
125  CDIO_CD_MAX_LSN = 450150,
126  CDIO_CD_MIN_LSN = -450150,
127  } cdio_cd_enums;
128 
134 #define CDIO_CD_MINS 74
136 #define CDIO_CD_SECS_PER_MIN 60
137 #define CDIO_CD_FRAMES_PER_SEC 75
138 #define CDIO_CD_SYNC_SIZE 12
139 #define CDIO_CD_CHUNK_SIZE 24
140 #define CDIO_CD_NUM_OF_CHUNKS 98
141 #define CDIO_CD_FRAMESIZE_SUB 96
142 #define CDIO_CD_HEADER_SIZE 4
144 #define CDIO_CD_SUBHEADER_SIZE 8
146 #define CDIO_CD_EDC_SIZE 4
148 #define CDIO_CD_M1F1_ZERO_SIZE 8
150 #define CDIO_CD_ECC_SIZE 276
152 #define CDIO_CD_FRAMESIZE 2048
153 #define CDIO_CD_FRAMESIZE_RAW 2352
154 #define CDIO_CD_FRAMESIZE_RAWER 2646
156 #define CDIO_CD_FRAMESIZE_RAW1 (CDIO_CD_FRAMESIZE_RAW-CDIO_CD_SYNC_SIZE) /*2340*/
157 #define CDIO_CD_FRAMESIZE_RAW0 (CDIO_CD_FRAMESIZE_RAW-CDIO_CD_SYNC_SIZE-CDIO_CD_HEADER_SIZE) /*2336*/
158 
160 #define CDIO_CD_XA_HEADER (CDIO_CD_HEADER_SIZE+CDIO_CD_SUBHEADER_SIZE)
161 
163 #define CDIO_CD_XA_TAIL (CDIO_CD_EDC_SIZE+CDIO_CD_ECC_SIZE)
164 
166 #define CDIO_CD_XA_SYNC_HEADER (CDIO_CD_SYNC_SIZE+CDIO_CD_XA_HEADER)
167 
180  extern enum m2_sector_enums {
181  M2F2_SECTOR_SIZE = 2324,
182  M2SUB_SECTOR_SIZE = 2332,
183  M2RAW_SECTOR_SIZE = 2336
184  } m2_sector_enums;
185 
186 #define M2F2_SECTOR_SIZE 2324
187 #define M2SUB_SECTOR_SIZE 2332
188 #define M2RAW_SECTOR_SIZE 2336
189 
191 #define CDIO_CD_MAX_SESSIONS 99
192 
193 #define CDIO_CD_MIN_SESSION_NO 1
194 
196 #define CDIO_CD_MAX_LSN 450150
197 
198 #define CDIO_CD_MIN_LSN -450150
199 
200 
201 #define CDIO_CD_FRAMES_PER_MIN \
202  (CDIO_CD_FRAMES_PER_SEC*CDIO_CD_SECS_PER_MIN)
203 
204 typedef enum cdio_cd_minutes_sectors
205 {
209 
212 
213 #define msf_t_SIZEOF 3
214 
218  char *cdio_lba_to_msf_str (lba_t i_lba);
219 
223  char *cdio_msf_to_str (const msf_t *p_msf);
224 
228  lba_t cdio_lba_to_lsn (lba_t i_lba);
229 
233  void cdio_lba_to_msf(lba_t i_lba, msf_t *p_msf);
234 
239  lba_t cdio_lsn_to_lba (lsn_t i_lsn);
240 
244  void cdio_lsn_to_msf (lsn_t i_lsn, msf_t *p_msf);
245 
250  lba_t cdio_msf_to_lba (const msf_t *p_msf);
251 
256  lsn_t cdio_msf_to_lsn (const msf_t *p_msf);
257 
263  lba_t cdio_msf3_to_lba (unsigned int minutes, unsigned int seconds,
264  unsigned int frames);
265 
270  lba_t cdio_mmssff_to_lba (const char *psz_mmssff);
271 
272 #ifdef __cplusplus
273  }
274 #endif
275 
276 #ifndef DO_NOT_WANT_PARANOIA_COMPATIBILITY
277 
278 #define CD_FRAMESIZE_RAW CDIO_CD_FRAMESIZE_RAW
279 #endif /*DO_NOT_WANT_PARANOIA_COMPATIBILITY*/
280 
281 #endif /* CDIO_SECTOR_H_ */
282 
283 
284 /*
285  * Local variables:
286  * c-file-style: "gnu"
287  * tab-width: 8
288  * indent-tabs-mode: nil
289  * End:
290  */
#define CDIO_CD_MIN_SESSION_NO
Definition: sector.h:200
Common type definitions used pervasively in libcdio.
Definition: sector.h:84
#define M2SUB_SECTOR_SIZE
Definition: sector.h:194
#define CDIO_CD_FRAMESIZE_RAW
Definition: sector.h:159
Definition: sector.h:217
#define CDIO_CD_CHUNK_SIZE
Definition: sector.h:140
lba_t cdio_msf_to_lba(const msf_t *p_msf)
#define CDIO_CD_SUBHEADER_SIZE
Definition: sector.h:146
int32_t lsn_t
Definition: types.h:265
void cdio_lsn_to_msf(lsn_t i_lsn, msf_t *p_msf)
#define CDIO_CD_MAX_SESSIONS
Definition: sector.h:198
Definition: sector.h:213
Definition: sector.h:214
#define CDIO_CD_NUM_OF_CHUNKS
Definition: sector.h:141
lba_t cdio_lsn_to_lba(lsn_t i_lsn)
Definition: sector.h:74
cdio_cd_enums
Definition: sector.h:99
typedefPRAGMA_END_PACKED struct msf_s msf_t
Definition: types.h:223
Definition: sector.h:83
lba_t cdio_mmssff_to_lba(const char *psz_mmssff)
int32_t lba_t
Definition: types.h:258
Definition: sector.h:88
#define CDIO_CD_FRAMESIZE_RAWER
Definition: sector.h:160
#define CDIO_CD_FRAMESIZE_RAW0
Definition: sector.h:164
cdio_subchannel
Definition: sector.h:71
cdio_cd_minutes_sectors
Definition: sector.h:211
char * cdio_msf_to_str(const msf_t *p_msf)
Definition: sector.h:215
Definition: sector.h:75
#define CDIO_CD_FRAMESIZE
Definition: sector.h:158
lba_t cdio_msf3_to_lba(unsigned int minutes, unsigned int seconds, unsigned int frames)
lsn_t cdio_msf_to_lsn(const msf_t *p_msf)
#define CDIO_CD_FRAMESIZE_SUB
Definition: sector.h:142
#define CDIO_CD_FRAMES_PER_SEC
Definition: sector.h:138
m2_sector_enums
Definition: sector.h:187
#define CDIO_CD_FRAMESIZE_RAW1
Definition: sector.h:163
#define CDIO_CD_HEADER_SIZE
Definition: sector.h:143
lba_t cdio_lba_to_lsn(lba_t i_lba)
Definition: sector.h:73
#define CDIO_CD_ECC_SIZE
Definition: sector.h:155
Definition: sector.h:86
const uint8_t CDIO_SECTOR_SYNC_HEADER[CDIO_CD_SYNC_SIZE]
#define CDIO_CD_SECS_PER_MIN
Definition: sector.h:137
flag_t
Definition: sector.h:82
#define CDIO_CD_MINS
Definition: sector.h:134
#define CDIO_PREGAP_SECTORS
Definition: sector.h:91
#define CDIO_CD_SYNC_SIZE
Definition: sector.h:139
Definition: sector.h:87
Definition: sector.h:85
#define M2F2_SECTOR_SIZE
Definition: sector.h:193
#define UINT32_C(c)
Definition: types.h:82
#define CDIO_CD_MIN_LSN
Definition: sector.h:205
char * cdio_lba_to_msf_str(lba_t i_lba)
#define CDIO_CD_MAX_LSN
Definition: sector.h:203
Definition: sector.h:76
#define M2RAW_SECTOR_SIZE
Definition: sector.h:195
#define CDIO_CD_FRAMES_PER_MIN
Definition: sector.h:208
void cdio_lba_to_msf(lba_t i_lba, msf_t *p_msf)