sector.h

Go to the documentation of this file.
00001 /*
00002     $Id: sector_8h-source.html,v 1.19 2006/10/27 11:16:41 rocky Exp $
00003 
00004     Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
00005     Copyright (C) 2003, 2004, 2005, 2006 Rocky Bernstein <rocky@panix.com>
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 2 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, write to the Free Software
00019     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
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,   /* no flags set */
00083         PRE_EMPHASIS =          0x01,   /* audio track recorded with pre-emphasis */
00084         COPY_PERMITTED =        0x02,   /* digital copy permitted */
00085         DATA =                  0x04,   /* data track */
00086         FOUR_CHANNEL_AUDIO =    0x08,   /* 4 audio channels */
00087         SCMS =                  0x10    /* SCMS (5.29.2.7) */
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) /*2340*/
00156 #define CDIO_CD_FRAMESIZE_RAW0 (CDIO_CD_FRAMESIZE_RAW-CDIO_CD_SYNC_SIZE-CDIO_CD_HEADER_SIZE) /*2336*/
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 /* _CDIO_SECTOR_H_ */
00274 
00275 
00276 /* 
00277  * Local variables:
00278  *  c-file-style: "gnu"
00279  *  tab-width: 8
00280  *  indent-tabs-mode: nil
00281  * End:
00282  */

Generated on Fri Oct 27 06:38:08 2006 for libcdio by  doxygen 1.4.6