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
00212 typedef char cdio_utf8_t;
00213
00214 typedef enum {
00215 nope = 0,
00216 yep = 1,
00217 dunno = 2
00218 } bool_3way_t;
00219
00220
00221 #if defined(__GNUC__)
00222
00223
00224 typedef unsigned int bitfield_t;
00225 #else
00226
00227
00228
00229 typedef uint8_t bitfield_t;
00230 #endif
00231
00237 typedef int32_t lba_t;
00238
00244 typedef int32_t lsn_t;
00245
00246
00247 union cdio_cdrom_addr
00248 {
00249 msf_t msf;
00250 lba_t lba;
00251 };
00252
00254 typedef uint8_t track_t;
00255
00257 typedef uint8_t session_t;
00258
00262 #define CDIO_INVALID_SESSION 0xFF
00263
00269 #define CDIO_INVALID_LBA -45301
00270
00274 #define CDIO_INVALID_LSN CDIO_INVALID_LBA
00275
00279 #define CDIO_MCN_SIZE 13
00280
00285 typedef char cdio_mcn_t[CDIO_MCN_SIZE+1];
00286
00287
00291 #define CDIO_ISRC_SIZE 12
00292
00297 typedef char cdio_isrc_t[CDIO_ISRC_SIZE+1];
00298
00299 typedef int cdio_fs_anal_t;
00300
00305 typedef enum {
00306 CDIO_TRACK_FLAG_NONE = 0x00,
00307 CDIO_TRACK_FLAG_PRE_EMPHASIS = 0x01,
00309 CDIO_TRACK_FLAG_COPY_PERMITTED = 0x02,
00310 CDIO_TRACK_FLAG_DATA = 0x04,
00311 CDIO_TRACK_FLAG_FOUR_CHANNEL_AUDIO = 0x08,
00312 CDIO_TRACK_FLAG_SCMS = 0x10
00313 } cdio_track_flag;
00314
00315 #ifdef __cplusplus
00316 }
00317 #endif
00318
00319 #endif
00320
00321
00322
00323
00324
00325
00326
00327
00328