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