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