00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00026
00027 #ifndef __CDIO_TYPES_H__
00028 #define __CDIO_TYPES_H__
00029
00030 #ifdef __cplusplus
00031 extern "C" {
00032 #endif
00033
00034 #ifndef LIBCDIO_CONFIG_H
00035 #include <cdio/cdio_config.h>
00036 #endif
00037
00038
00039
00040 #if defined(HAVE_SYS_TYPES_H)
00041 #include <sys/types.h>
00042 #endif
00043
00044 #if defined(HAVE_STDINT_H)
00045 # include <stdint.h>
00046 #elif defined(HAVE_INTTYPES_H)
00047 # include <inttypes.h>
00048 #elif defined(AMIGA) || defined(__linux__)
00049 typedef u_int8_t uint8_t;
00050 typedef u_int16_t uint16_t;
00051 typedef u_int32_t uint32_t;
00052 typedef u_int64_t uint64_t;
00053 #else
00054
00055
00056 #endif
00057
00058
00059 #if defined(__hpux__)
00060 # undef UINT16_C
00061 # undef UINT32_C
00062 # undef UINT64_C
00063 # undef INT64_C
00064 #endif
00065
00066
00067
00068
00069 #ifndef UINT16_C
00070 # define UINT16_C(c) c ## U
00071 #endif
00072
00073 #ifndef UINT32_C
00074 # if defined (SIZEOF_INT) && SIZEOF_INT == 4
00075 # define UINT32_C(c) c ## U
00076 # elif defined (SIZEOF_LONG) && SIZEOF_LONG == 4
00077 # define UINT32_C(c) c ## UL
00078 # else
00079 # define UINT32_C(c) c ## U
00080 # endif
00081 #endif
00082
00083 #ifndef UINT64_C
00084 # if defined (SIZEOF_LONG) && SIZEOF_LONG == 8
00085 # define UINT64_C(c) c ## UL
00086 # elif defined (SIZEOF_INT) && SIZEOF_INT == 8
00087 # define UINT64_C(c) c ## U
00088 # else
00089 # define UINT64_C(c) c ## ULL
00090 # endif
00091 #endif
00092
00093 #ifndef INT64_C
00094 # if defined (SIZEOF_LONG) && SIZEOF_LONG == 8
00095 # define INT64_C(c) c ## L
00096 # elif defined (SIZEOF_INT) && SIZEOF_INT == 8
00097 # define INT64_C(c) c
00098 # else
00099 # define INT64_C(c) c ## LL
00100 # endif
00101 #endif
00102
00103 #ifndef __cplusplus
00104 # if defined(HAVE_STDBOOL_H)
00105 # include <stdbool.h>
00106 # else
00107
00108
00109 # define false 0
00110 # define true 1
00111 # define bool uint8_t
00112 # endif
00113 #endif
00114
00115
00116
00117 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
00118 #define GNUC_PRINTF( format_idx, arg_idx ) \
00119 __attribute__((format (printf, format_idx, arg_idx)))
00120 #define GNUC_SCANF( format_idx, arg_idx ) \
00121 __attribute__((format (scanf, format_idx, arg_idx)))
00122 #define GNUC_FORMAT( arg_idx ) \
00123 __attribute__((format_arg (arg_idx)))
00124 #define GNUC_NORETURN \
00125 __attribute__((noreturn))
00126 #define GNUC_CONST \
00127 __attribute__((const))
00128 #define GNUC_UNUSED \
00129 __attribute__((unused))
00130 #define GNUC_PACKED \
00131 __attribute__((packed))
00132 #else
00133 #define GNUC_PRINTF( format_idx, arg_idx )
00134 #define GNUC_SCANF( format_idx, arg_idx )
00135 #define GNUC_FORMAT( arg_idx )
00136 #define GNUC_NORETURN
00137 #define GNUC_CONST
00138 #define GNUC_UNUSED
00139 #define GNUC_PACKED
00140 #endif
00141
00142 #if defined(__GNUC__)
00143
00144 # define PRAGMA_BEGIN_PACKED
00145 # define PRAGMA_END_PACKED
00146 #elif defined(HAVE_ISOC99_PRAGMA)
00147
00148 # define PRAGMA_BEGIN_PACKED _Pragma("pack(1)")
00149 # define PRAGMA_END_PACKED _Pragma("pack()")
00150 #else
00151
00152 # define PRAGMA_BEGIN_PACKED
00153 # define PRAGMA_END_PACKED
00154 #endif
00155
00156
00157
00158
00159 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 95)
00160 # define GNUC_LIKELY(x) __builtin_expect((x),true)
00161 # define GNUC_UNLIKELY(x) __builtin_expect((x),false)
00162 #else
00163 # define GNUC_LIKELY(x) (x)
00164 # define GNUC_UNLIKELY(x) (x)
00165 #endif
00166
00167 #ifndef NULL
00168 # define NULL ((void*) 0)
00169 #endif
00170
00171
00172 #define __cd_offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
00173
00188 PRAGMA_BEGIN_PACKED
00189 struct msf_s {
00190 uint8_t m, s, f;
00191 } GNUC_PACKED;
00192 PRAGMA_END_PACKED
00193
00194 typedef struct msf_s msf_t;
00195
00196 #define msf_t_SIZEOF 3
00197
00198 typedef enum {
00199 nope = 0,
00200 yep = 1,
00201 dunno = 2
00202 } bool_3way_t;
00203
00204
00205 #if defined(__GNUC__)
00206
00207
00208 typedef unsigned int bitfield_t;
00209 #else
00210
00211
00212
00213 typedef uint8_t bitfield_t;
00214 #endif
00215
00221 typedef int32_t lba_t;
00222
00228 typedef int32_t lsn_t;
00229
00230
00231 union cdio_cdrom_addr
00232 {
00233 msf_t msf;
00234 lba_t lba;
00235 };
00236
00238 typedef uint8_t track_t;
00239
00241 typedef uint8_t session_t;
00242
00246 #define CDIO_INVALID_SESSION 0xFF
00247
00253 #define CDIO_INVALID_LBA -45301
00254
00258 #define CDIO_INVALID_LSN CDIO_INVALID_LBA
00259
00263 #define CDIO_MCN_SIZE 13
00264
00269 typedef char cdio_mcn_t[CDIO_MCN_SIZE+1];
00270
00271
00275 #define CDIO_ISRC_SIZE 12
00276
00281 typedef char cdio_isrc_t[CDIO_ISRC_SIZE+1];
00282
00283 typedef int cdio_fs_anal_t;
00284
00289 typedef enum {
00290 CDIO_TRACK_FLAG_NONE = 0x00,
00291 CDIO_TRACK_FLAG_PRE_EMPHASIS = 0x01,
00293 CDIO_TRACK_FLAG_COPY_PERMITTED = 0x02,
00294 CDIO_TRACK_FLAG_DATA = 0x04,
00295 CDIO_TRACK_FLAG_FOUR_CHANNEL_AUDIO = 0x08,
00296 CDIO_TRACK_FLAG_SCMS = 0x10
00297 } cdio_track_flag;
00298
00299 #ifdef __cplusplus
00300 }
00301 #endif
00302
00303 #endif
00304
00305
00306
00307
00308
00309
00310
00311
00312