libcdio  2.1.0
About: GNU libcdio is a library for CD-ROM and CD image access.
  Fossies Dox: libcdio-2.1.0.tar.bz2  ("inofficial" and yet experimental doxygen-generated source code documentation)  

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  */
CDIO_CD_SYNC_SIZE
#define CDIO_CD_SYNC_SIZE
Definition: sector.h:139
M2F2_SECTOR_SIZE
#define M2F2_SECTOR_SIZE
Definition: sector.h:193
lba_t
int32_t lba_t
Definition: types.h:259
CDIO_CD_FRAMESIZE_SUB
#define CDIO_CD_FRAMESIZE_SUB
Definition: sector.h:142
CDIO_CD_SECS_PER_MIN
#define CDIO_CD_SECS_PER_MIN
Definition: sector.h:137
CDIO_SUBCHANNEL_MEDIA_CATALOG
Definition: sector.h:75
PRE_EMPHASIS
Definition: sector.h:84
NONE
Definition: sector.h:83
SCMS
Definition: sector.h:88
CDIO_CD_HEADER_SIZE
#define CDIO_CD_HEADER_SIZE
Definition: sector.h:143
cdio_lsn_to_lba
lba_t cdio_lsn_to_lba(lsn_t i_lsn)
Definition: sector.c:114
types.h
Common type definitions used pervasively in libcdio.
cdio_cd_enums
cdio_cd_enums
Definition: sector.h:99
lsn_t
int32_t lsn_t
Definition: types.h:266
CDIO_CD_FRAMESIZE_RAWER
#define CDIO_CD_FRAMESIZE_RAWER
Definition: sector.h:160
cdio_lba_to_msf
void cdio_lba_to_msf(lba_t i_lba, msf_t *p_msf)
Definition: sector.c:124
CDIO_CD_ECC_SIZE
#define CDIO_CD_ECC_SIZE
Definition: sector.h:155
DATA
Definition: sector.h:86
CDIO_CD_FRAMESIZE
#define CDIO_CD_FRAMESIZE
Definition: sector.h:158
cdio_msf_to_lsn
lsn_t cdio_msf_to_lsn(const msf_t *p_msf)
Definition: sector.c:157
CDIO_SUBCHANNEL_SUBQ_DATA
Definition: sector.h:73
CDIO_CD_FRAMESIZE_RAW1
#define CDIO_CD_FRAMESIZE_RAW1
Definition: sector.h:163
cdio_msf3_to_lba
lba_t cdio_msf3_to_lba(unsigned int minutes, unsigned int seconds, unsigned int frames)
Definition: sector.c:180
CDIO_CD_MIN_LSN
#define CDIO_CD_MIN_LSN
Definition: sector.h:205
CDIO_CD_FRAMES_PER_SEC
#define CDIO_CD_FRAMES_PER_SEC
Definition: sector.h:138
CDIO_CD_MINS
#define CDIO_CD_MINS
Definition: sector.h:134
CDIO_CD_MAX_SECTORS
Definition: sector.h:217
CDIO_SUBCHANNEL_CURRENT_POSITION
Definition: sector.h:74
CDIO_CD_74MIN_SECTORS
Definition: sector.h:213
UINT32_C
#define UINT32_C(c)
Definition: types.h:82
CDIO_CD_SUBHEADER_SIZE
#define CDIO_CD_SUBHEADER_SIZE
Definition: sector.h:146
CDIO_CD_80MIN_SECTORS
Definition: sector.h:214
CDIO_CD_CHUNK_SIZE
#define CDIO_CD_CHUNK_SIZE
Definition: sector.h:140
cdio_lsn_to_msf
void cdio_lsn_to_msf(lsn_t i_lsn, msf_t *p_msf)
Definition: sector.c:62
cdio_lba_to_lsn
lba_t cdio_lba_to_lsn(lba_t i_lba)
Definition: sector.c:50
CDIO_CD_NUM_OF_CHUNKS
#define CDIO_CD_NUM_OF_CHUNKS
Definition: sector.h:141
FOUR_CHANNEL_AUDIO
Definition: sector.h:87
cdio_mmssff_to_lba
lba_t cdio_mmssff_to_lba(const char *psz_mmssff)
Definition: sector.c:192
CDIO_CD_MAX_LSN
#define CDIO_CD_MAX_LSN
Definition: sector.h:203
CDIO_CD_90MIN_SECTORS
Definition: sector.h:215
msf_s
MSF (minute/second/frame) structure.
Definition: types.h:219
CDIO_SUBCHANNEL_TRACK_ISRC
Definition: sector.h:76
cdio_msf_to_lba
lba_t cdio_msf_to_lba(const msf_t *p_msf)
Definition: sector.c:135
cdio_msf_to_str
char * cdio_msf_to_str(const msf_t *p_msf)
Definition: sector.c:166
CDIO_CD_MIN_SESSION_NO
#define CDIO_CD_MIN_SESSION_NO
Definition: sector.h:200
cdio_lba_to_msf_str
char * cdio_lba_to_msf_str(lba_t i_lba)
Definition: sector.c:96
M2RAW_SECTOR_SIZE
#define M2RAW_SECTOR_SIZE
Definition: sector.h:195
CDIO_CD_FRAMES_PER_MIN
#define CDIO_CD_FRAMES_PER_MIN
Definition: sector.h:208
CDIO_SECTOR_SYNC_HEADER
const uint8_t CDIO_SECTOR_SYNC_HEADER[12]
Definition: sector.c:42
CDIO_CD_FRAMESIZE_RAW
#define CDIO_CD_FRAMESIZE_RAW
Definition: sector.h:159
CDIO_PREGAP_SECTORS
#define CDIO_PREGAP_SECTORS
Definition: sector.h:91
CDIO_CD_FRAMESIZE_RAW0
#define CDIO_CD_FRAMESIZE_RAW0
Definition: sector.h:164
m2_sector_enums
m2_sector_enums
Definition: sector.h:187
cdio_subchannel
cdio_subchannel
Definition: sector.h:71
CDIO_CD_MAX_SESSIONS
#define CDIO_CD_MAX_SESSIONS
Definition: sector.h:198
M2SUB_SECTOR_SIZE
#define M2SUB_SECTOR_SIZE
Definition: sector.h:194
cdio_cd_minutes_sectors
cdio_cd_minutes_sectors
Definition: sector.h:211
COPY_PERMITTED
Definition: sector.h:85
flag_t
flag_t
Definition: sector.h:82