1 module derelict.mpg123.libmpg123; 2 3 private { 4 import derelict.util.loader; 5 import derelict.util.system; 6 import derelict.util.exception; 7 8 static if(Derelict_OS_Windows) 9 enum libNames = "libmpg123-0.dll"; 10 else static if(Derelict_OS_Linux) 11 enum libNames = "libmpg123.so"; 12 else 13 static assert(0, "Add libmpg123 library name for your platform."); 14 } 15 16 /** \file fmt123.h Audio format definitions. */ 17 18 /** \defgroup mpg123_enc mpg123 PCM sample encodings 19 * These are definitions for audio formats used by libmpg123 and 20 * libout123. 21 * 22 * @{ 23 */ 24 25 /** An enum over all sample types possibly known to mpg123. 26 * The values are designed as bit flags to allow bitmasking for encoding 27 * families. 28 * This is also why the enum is not used as type for actual encoding variables, 29 * plain integers (at least 16 bit, 15 bit being used) cover the possible 30 * combinations of these flags. 31 * 32 * Note that (your build of) libmpg123 does not necessarily support all these. 33 * Usually, you can expect the 8bit encodings and signed 16 bit. 34 * Also 32bit float will be usual beginning with mpg123-1.7.0 . 35 * What you should bear in mind is that (SSE, etc) optimized routines may be 36 * absent for some formats. We do have SSE for 16, 32 bit and float, though. 37 * 24 bit integer is done via postprocessing of 32 bit output -- just cutting 38 * the last byte, no rounding, even. If you want better, do it yourself. 39 * 40 * All formats are in native byte order. If you need different endinaness, you 41 * can simply postprocess the output buffers (libmpg123 wouldn't do anything 42 * else). The macro MPG123_SAMPLESIZE() can be helpful there. 43 */ 44 enum mpg123_enc_enum 45 { 46 /* 0000 0000 0000 1111 Some 8 bit integer encoding. */ 47 MPG123_ENC_8 = 0x00f 48 /* 0000 0000 0100 0000 Some 16 bit integer encoding. */ 49 , MPG123_ENC_16 = 0x040 50 /* 0100 0000 0000 0000 Some 24 bit integer encoding. */ 51 , MPG123_ENC_24 = 0x4000 52 /* 0000 0001 0000 0000 Some 32 bit integer encoding. */ 53 , MPG123_ENC_32 = 0x100 54 /* 0000 0000 1000 0000 Some signed integer encoding. */ 55 , MPG123_ENC_SIGNED = 0x080 56 /* 0000 1110 0000 0000 Some float encoding. */ 57 , MPG123_ENC_FLOAT = 0xe00 58 /* 0000 0000 1101 0000 signed 16 bit */ 59 , MPG123_ENC_SIGNED_16 = (MPG123_ENC_16|MPG123_ENC_SIGNED|0x10) 60 /* 0000 0000 0110 0000 unsigned 16 bit */ 61 , MPG123_ENC_UNSIGNED_16 = (MPG123_ENC_16|0x20) 62 /* 0000 0000 0000 0001 unsigned 8 bit */ 63 , MPG123_ENC_UNSIGNED_8 = 0x01 64 /* 0000 0000 1000 0010 signed 8 bit */ 65 , MPG123_ENC_SIGNED_8 = (MPG123_ENC_SIGNED|0x02) 66 /* 0000 0000 0000 0100 ulaw 8 bit */ 67 , MPG123_ENC_ULAW_8 = 0x04 68 /* 0000 0000 0000 1000 alaw 8 bit */ 69 , MPG123_ENC_ALAW_8 = 0x08 70 /* 0001 0001 1000 0000 signed 32 bit */ 71 , MPG123_ENC_SIGNED_32 = MPG123_ENC_32|MPG123_ENC_SIGNED|0x1000 72 /* 0010 0001 0000 0000 unsigned 32 bit */ 73 , MPG123_ENC_UNSIGNED_32 = MPG123_ENC_32|0x2000 74 /* 0101 0000 1000 0000 signed 24 bit */ 75 , MPG123_ENC_SIGNED_24 = MPG123_ENC_24|MPG123_ENC_SIGNED|0x1000 76 /* 0110 0000 0000 0000 unsigned 24 bit */ 77 , MPG123_ENC_UNSIGNED_24 = MPG123_ENC_24|0x2000 78 /* 0000 0010 0000 0000 32bit float */ 79 , MPG123_ENC_FLOAT_32 = 0x200 80 /* 0000 0100 0000 0000 64bit float */ 81 , MPG123_ENC_FLOAT_64 = 0x400 82 /* Any possibly known encoding from the list above. */ 83 , MPG123_ENC_ANY = ( MPG123_ENC_SIGNED_16 | MPG123_ENC_UNSIGNED_16 84 | MPG123_ENC_UNSIGNED_8 | MPG123_ENC_SIGNED_8 85 | MPG123_ENC_ULAW_8 | MPG123_ENC_ALAW_8 86 | MPG123_ENC_SIGNED_32 | MPG123_ENC_UNSIGNED_32 87 | MPG123_ENC_SIGNED_24 | MPG123_ENC_UNSIGNED_24 88 | MPG123_ENC_FLOAT_32 | MPG123_ENC_FLOAT_64 ) 89 } 90 91 /** Get size of one PCM sample with given encoding. 92 * This is included both in libmpg123 and libout123. Both offer 93 * an API function to provide the macro results from library 94 * compile-time, not that of you application. This most likely 95 * does not matter as I do not expect any fresh PCM sample 96 * encoding to appear. But who knows? Perhaps the encoding type 97 * will be abused for funny things in future, not even plain PCM. 98 * And, by the way: Thomas really likes the ?: operator. 99 * \param enc the encoding (mpg123_enc_enum value) 100 * \return size of one sample in bytes 101 */ 102 103 int MPG123_SAMPLESIZE(int enc) { 104 return (enc) & mpg123_enc_enum.MPG123_ENC_8 105 ? 1 106 : ( (enc) & mpg123_enc_enum.MPG123_ENC_16 107 ? 2 108 : ( (enc) & mpg123_enc_enum.MPG123_ENC_24 109 ? 3 110 : ( ( (enc) & mpg123_enc_enum.MPG123_ENC_32 111 || (enc) == mpg123_enc_enum.MPG123_ENC_FLOAT_32 ) 112 ? 4 113 : ( (enc) == mpg123_enc_enum.MPG123_ENC_FLOAT_64 114 ? 8 115 : 0 116 ) ) ) ); 117 118 } 119 120 /** Structure defining an audio format. 121 * Providing the members as individual function arguments to define a certain 122 * output format is easy enough. This struct makes is more comfortable to deal 123 * with a list of formats. 124 * Negative values for the members might be used to communicate use of default 125 * values. 126 */ 127 struct mpg123_fmt_struct 128 { 129 int rate; /**< sampling rate in Hz */ 130 int channels; /**< channel count */ 131 /** encoding code, can be single value or bitwise or of members of 132 * mpg123_enc_enum */ 133 int encoding; 134 } 135 136 /* @} */ 137 138 /** \file mpg123.h The header file for the libmpg123 MPEG Audio decoder */ 139 140 /** A macro to check at compile time which set of API functions to expect. 141 * This should be incremented at least each time a new symbol is added 142 * to the header. 143 */ 144 enum MPG123_API_VERSION = 42; 145 146 alias off_t = ptrdiff_t; 147 alias ssize_t = ptrdiff_t; 148 149 //#include <stdlib.h> 150 //#include <sys/types.h> 151 152 /* Simplified large file handling. 153 I used to have a check here that prevents building for a library with conflicting large file setup 154 (application that uses 32 bit offsets with library that uses 64 bits). 155 While that was perfectly fine in an environment where there is one incarnation of the library, 156 it hurt GNU/Linux and Solaris systems with multilib where the distribution fails to provide the 157 correct header matching the 32 bit library (where large files need explicit support) or 158 the 64 bit library (where there is no distinction). 159 160 New approach: When the app defines _FILE_OFFSET_BITS, it wants non-default large file support, 161 and thus functions with added suffix (mpg123_open_64). 162 Any mismatch will be caught at link time because of the _FILE_OFFSET_BITS setting used when 163 building libmpg123. Plus, there's dual mode large file support in mpg123 since 1.12 now. 164 Link failure is not the expected outcome of any half-sane usage anymore. 165 166 More complication: What about client code defining _LARGEFILE64_SOURCE? It might want direct access to the _64 functions, along with the ones without suffix. Well, that's possible now via defining MPG123_NO_LARGENAME and MPG123_LARGESUFFIX, respectively, for disabling or enforcing the suffix names. 167 */ 168 169 /* 170 Now, the renaming of large file aware functions. 171 By default, it appends underscore _FILE_OFFSET_BITS (so, mpg123_seek_64 for mpg123_seek), if _FILE_OFFSET_BITS is defined. You can force a different suffix via MPG123_LARGESUFFIX (that must include the underscore), or you can just disable the whole mess by defining MPG123_NO_LARGENAME. 172 */ 173 /+ 174 #if (!defined MPG123_NO_LARGENAME) && ((defined _FILE_OFFSET_BITS) || (defined MPG123_LARGESUFFIX)) 175 176 /* Need some trickery to concatenate the value(s) of the given macro(s). */ 177 #define MPG123_MACROCAT_REALLY(a, b) a ## b 178 #define MPG123_MACROCAT(a, b) MPG123_MACROCAT_REALLY(a, b) 179 #ifndef MPG123_LARGESUFFIX 180 #define MPG123_LARGESUFFIX MPG123_MACROCAT(_, _FILE_OFFSET_BITS) 181 #endif 182 #define MPG123_LARGENAME(func) MPG123_MACROCAT(func, MPG123_LARGESUFFIX) 183 184 #define mpg123_open MPG123_LARGENAME(mpg123_open) 185 #define mpg123_open_fd MPG123_LARGENAME(mpg123_open_fd) 186 #define mpg123_open_handle MPG123_LARGENAME(mpg123_open_handle) 187 #define mpg123_framebyframe_decode MPG123_LARGENAME(mpg123_framebyframe_decode) 188 #define mpg123_decode_frame MPG123_LARGENAME(mpg123_decode_frame) 189 #define mpg123_tell MPG123_LARGENAME(mpg123_tell) 190 #define mpg123_tellframe MPG123_LARGENAME(mpg123_tellframe) 191 #define mpg123_tell_stream MPG123_LARGENAME(mpg123_tell_stream) 192 #define mpg123_seek MPG123_LARGENAME(mpg123_seek) 193 #define mpg123_feedseek MPG123_LARGENAME(mpg123_feedseek) 194 #define mpg123_seek_frame MPG123_LARGENAME(mpg123_seek_frame) 195 #define mpg123_timeframe MPG123_LARGENAME(mpg123_timeframe) 196 #define mpg123_index MPG123_LARGENAME(mpg123_index) 197 #define mpg123_set_index MPG123_LARGENAME(mpg123_set_index) 198 #define mpg123_position MPG123_LARGENAME(mpg123_position) 199 #define mpg123_length MPG123_LARGENAME(mpg123_length) 200 #define mpg123_framelength MPG123_LARGENAME(mpg123_framelength) 201 #define mpg123_set_filesize MPG123_LARGENAME(mpg123_set_filesize) 202 #define mpg123_replace_reader MPG123_LARGENAME(mpg123_replace_reader) 203 #define mpg123_replace_reader_handle MPG123_LARGENAME(mpg123_replace_reader_handle) 204 #define mpg123_framepos MPG123_LARGENAME(mpg123_framepos) 205 206 #endif /* largefile hackery */ 207 208 #endif /* MPG123_NO_CONFIGURE */ 209 +/ 210 211 extern(C) { 212 213 /** \defgroup mpg123_init mpg123 library and handle setup 214 * 215 * Functions to initialise and shutdown the mpg123 library and handles. 216 * The parameters of handles have workable defaults, you only have to tune them when you want to tune something;-) 217 * Tip: Use a RVA setting... 218 * 219 * @{ 220 */ 221 222 /** Opaque structure for the libmpg123 decoder handle. */ 223 //struct mpg123_handle_struct; 224 struct mpg123_handle; 225 226 /** Opaque structure for the libmpg123 decoder handle. 227 * Most functions take a pointer to a mpg123_handle as first argument and operate on its data in an object-oriented manner. 228 */ 229 //typedef struct mpg123_handle_struct mpg123_handle; 230 231 /** Function to initialise the mpg123 library. 232 * This function is not thread-safe. Call it exactly once per process, before any other (possibly threaded) work with the library. 233 * 234 * \return MPG123_OK if successful, otherwise an error number. 235 */ 236 alias da_mpg123_init = int function(); 237 238 /** Function to close down the mpg123 library. 239 * This function is not thread-safe. Call it exactly once per process, before any other (possibly threaded) work with the library. */ 240 //void mpg123_exit(); 241 alias da_mpg123_exit = void function(); 242 243 /** Create a handle with optional choice of decoder (named by a string, see mpg123_decoders() or mpg123_supported_decoders()). 244 * and optional retrieval of an error code to feed to mpg123_plain_strerror(). 245 * Optional means: Any of or both the parameters may be NULL. 246 * 247 * \param decoder optional choice of decoder variant (NULL for default) 248 * \param error optional address to store error codes 249 * \return Non-NULL pointer to fresh handle when successful. 250 */ 251 //mpg123_handle *mpg123_new(const char* decoder, int *error); 252 alias da_mpg123_new = mpg123_handle * function(const char* decoder, int *error); 253 254 /** Delete handle, mh is either a valid mpg123 handle or NULL. 255 * \param mh handle 256 */ 257 //void mpg123_delete(mpg123_handle *mh); 258 alias da_mpg123_delete = void function(mpg123_handle *mh); 259 260 /** Enumeration of the parameters types that it is possible to set/get. */ 261 enum mpg123_parms 262 { 263 MPG123_VERBOSE = 0, /**< set verbosity value for enabling messages to stderr, >= 0 makes sense (integer) */ 264 MPG123_FLAGS, /**< set all flags, p.ex val = MPG123_GAPLESS|MPG123_MONO_MIX (integer) */ 265 MPG123_ADD_FLAGS, /**< add some flags (integer) */ 266 MPG123_FORCE_RATE, /**< when value > 0, force output rate to that value (integer) */ 267 MPG123_DOWN_SAMPLE, /**< 0=native rate, 1=half rate, 2=quarter rate (integer) */ 268 MPG123_RVA, /**< one of the RVA choices above (integer) */ 269 MPG123_DOWNSPEED, /**< play a frame N times (integer) */ 270 MPG123_UPSPEED, /**< play every Nth frame (integer) */ 271 MPG123_START_FRAME, /**< start with this frame (skip frames before that, integer) */ 272 MPG123_DECODE_FRAMES, /**< decode only this number of frames (integer) */ 273 MPG123_ICY_INTERVAL, /**< stream contains ICY metadata with this interval (integer) */ 274 MPG123_OUTSCALE, /**< the scale for output samples (amplitude - integer or float according to mpg123 output format, normally integer) */ 275 MPG123_TIMEOUT, /**< timeout for reading from a stream (not supported on win32, integer) */ 276 MPG123_REMOVE_FLAGS, /**< remove some flags (inverse of MPG123_ADD_FLAGS, integer) */ 277 MPG123_RESYNC_LIMIT, /**< Try resync on frame parsing for that many bytes or until end of stream (<0 ... integer). This can enlarge the limit for skipping junk on beginning, too (but not reduce it). */ 278 MPG123_INDEX_SIZE /**< Set the frame index size (if supported). Values <0 mean that the index is allowed to grow dynamically in these steps (in positive direction, of course) -- Use this when you really want a full index with every individual frame. */ 279 ,MPG123_PREFRAMES /**< Decode/ignore that many frames in advance for layer 3. This is needed to fill bit reservoir after seeking, for example (but also at least one frame in advance is needed to have all "normal" data for layer 3). Give a positive integer value, please.*/ 280 ,MPG123_FEEDPOOL /**< For feeder mode, keep that many buffers in a pool to avoid frequent malloc/free. The pool is allocated on mpg123_open_feed(). If you change this parameter afterwards, you can trigger growth and shrinkage during decoding. The default value could change any time. If you care about this, then set it. (integer) */ 281 ,MPG123_FEEDBUFFER /**< Minimal size of one internal feeder buffer, again, the default value is subject to change. (integer) */ 282 } 283 284 /** Flag bits for MPG123_FLAGS, use the usual binary or to combine. */ 285 enum mpg123_param_flags 286 { 287 MPG123_FORCE_MONO = 0x7 /**< 0111 Force some mono mode: This is a test bitmask for seeing if any mono forcing is active. */ 288 ,MPG123_MONO_LEFT = 0x1 /**< 0001 Force playback of left channel only. */ 289 ,MPG123_MONO_RIGHT = 0x2 /**< 0010 Force playback of right channel only. */ 290 ,MPG123_MONO_MIX = 0x4 /**< 0100 Force playback of mixed mono. */ 291 ,MPG123_FORCE_STEREO = 0x8 /**< 1000 Force stereo output. */ 292 ,MPG123_FORCE_8BIT = 0x10 /**< 00010000 Force 8bit formats. */ 293 ,MPG123_QUIET = 0x20 /**< 00100000 Suppress any printouts (overrules verbose). */ 294 ,MPG123_GAPLESS = 0x40 /**< 01000000 Enable gapless decoding (default on if libmpg123 has support). */ 295 ,MPG123_NO_RESYNC = 0x80 /**< 10000000 Disable resync stream after error. */ 296 ,MPG123_SEEKBUFFER = 0x100 /**< 000100000000 Enable small buffer on non-seekable streams to allow some peek-ahead (for better MPEG sync). */ 297 ,MPG123_FUZZY = 0x200 /**< 001000000000 Enable fuzzy seeks (guessing byte offsets or using approximate seek points from Xing TOC) */ 298 ,MPG123_FORCE_FLOAT = 0x400 /**< 010000000000 Force floating point output (32 or 64 bits depends on mpg123 internal precision). */ 299 ,MPG123_PLAIN_ID3TEXT = 0x800 /**< 100000000000 Do not translate ID3 text data to UTF-8. ID3 strings will contain the raw text data, with the first byte containing the ID3 encoding code. */ 300 ,MPG123_IGNORE_STREAMLENGTH = 0x1000 /**< 1000000000000 Ignore any stream length information contained in the stream, which can be contained in a 'TLEN' frame of an ID3v2 tag or a Xing tag */ 301 ,MPG123_SKIP_ID3V2 = 0x2000 /**< 10 0000 0000 0000 Do not parse ID3v2 tags, just skip them. */ 302 ,MPG123_IGNORE_INFOFRAME = 0x4000 /**< 100 0000 0000 0000 Do not parse the LAME/Xing info frame, treat it as normal MPEG data. */ 303 ,MPG123_AUTO_RESAMPLE = 0x8000 /**< 1000 0000 0000 0000 Allow automatic internal resampling of any kind (default on if supported). Especially when going lowlevel with replacing output buffer, you might want to unset this flag. Setting MPG123_DOWNSAMPLE or MPG123_FORCE_RATE will override this. */ 304 ,MPG123_PICTURE = 0x10000 /**< 17th bit: Enable storage of pictures from tags (ID3v2 APIC). */ 305 } 306 307 /** choices for MPG123_RVA */ 308 enum mpg123_param_rva 309 { 310 MPG123_RVA_OFF = 0 /**< RVA disabled (default). */ 311 ,MPG123_RVA_MIX = 1 /**< Use mix/track/radio gain. */ 312 ,MPG123_RVA_ALBUM = 2 /**< Use album/audiophile gain */ 313 ,MPG123_RVA_MAX = MPG123_RVA_ALBUM /**< The maximum RVA code, may increase in future. */ 314 } 315 316 /** Set a specific parameter, for a specific mpg123_handle, using a parameter 317 * type key chosen from the mpg123_parms enumeration, to the specified value. 318 * \param mh handle 319 * \param type parameter choice 320 * \param value integer value 321 * \param fvalue floating point value 322 * \return MPG123_OK on success 323 */ 324 //int mpg123_param( mpg123_handle *mh 325 // , mpg123_parms type, long value, double fvalue ); 326 alias da_mpg123_param = int function( mpg123_handle *mh 327 , mpg123_parms type, long value, double fvalue ); 328 329 /** Get a specific parameter, for a specific mpg123_handle. 330 * See the mpg123_parms enumeration for a list of available parameters. 331 * \param mh handle 332 * \param type parameter choice 333 * \param value integer value return address 334 * \param fvalue floating point value return address 335 * \return MPG123_OK on success 336 */ 337 //int mpg123_getparam( mpg123_handle *mh 338 // , mpg123_parms type, long *value, double *fvalue ); 339 alias da_mpg123_getparam = int function( mpg123_handle *mh 340 , mpg123_parms type, long *value, double *fvalue ); 341 342 /** Feature set available for query with mpg123_feature. */ 343 enum mpg123_feature_set 344 { 345 MPG123_FEATURE_ABI_UTF8OPEN = 0 /**< mpg123 expects path names to be given in UTF-8 encoding instead of plain native. */ 346 ,MPG123_FEATURE_OUTPUT_8BIT /**< 8bit output */ 347 ,MPG123_FEATURE_OUTPUT_16BIT /**< 16bit output */ 348 ,MPG123_FEATURE_OUTPUT_32BIT /**< 32bit output */ 349 ,MPG123_FEATURE_INDEX /**< support for building a frame index for accurate seeking */ 350 ,MPG123_FEATURE_PARSE_ID3V2 /**< id3v2 parsing */ 351 ,MPG123_FEATURE_DECODE_LAYER1 /**< mpeg layer-1 decoder enabled */ 352 ,MPG123_FEATURE_DECODE_LAYER2 /**< mpeg layer-2 decoder enabled */ 353 ,MPG123_FEATURE_DECODE_LAYER3 /**< mpeg layer-3 decoder enabled */ 354 ,MPG123_FEATURE_DECODE_ACCURATE /**< accurate decoder rounding */ 355 ,MPG123_FEATURE_DECODE_DOWNSAMPLE /**< downsample (sample omit) */ 356 ,MPG123_FEATURE_DECODE_NTOM /**< flexible rate decoding */ 357 ,MPG123_FEATURE_PARSE_ICY /**< ICY support */ 358 ,MPG123_FEATURE_TIMEOUT_READ /**< Reader with timeout (network). */ 359 ,MPG123_FEATURE_EQUALIZER /**< tunable equalizer */ 360 } 361 362 /** Query libmpg123 features. 363 * \param key feature selection 364 * \return 1 for success, 0 for unimplemented functions 365 */ 366 //int mpg123_feature(const mpg123_feature_set key); 367 alias da_mpg123_feature = int function(const mpg123_feature_set key); 368 369 /* @} */ 370 371 372 /** \defgroup mpg123_error mpg123 error handling 373 * 374 * Functions to get text version of the error numbers and an enumeration 375 * of the error codes returned by libmpg123. 376 * 377 * Most functions operating on a mpg123_handle simply return MPG123_OK (0) 378 * on success and MPG123_ERR (-1) on failure, setting the internal error 379 * variable of the handle to the specific error code. If there was not a valid 380 * (non-NULL) handle provided to a function operating on one, MPG123_BAD_HANDLE 381 * may be returned if this can not be confused with a valid positive return 382 * value. 383 * Meaning: A function expected to return positive integers on success will 384 * always indicate error or a special condition by returning a negative one. 385 * 386 * Decoding/seek functions may also return message codes MPG123_DONE, 387 * MPG123_NEW_FORMAT and MPG123_NEED_MORE (all negative, see below on how to 388 * react). Note that calls to those can be nested, so generally watch out 389 * for these codes after initial handle setup. 390 * Especially any function that needs information about the current stream 391 * to work will try to at least parse the beginning if that did not happen 392 * yet. 393 * 394 * On a function that is supposed to return MPG123_OK on success and 395 * MPG123_ERR on failure, make sure you check for != MPG123_OK, not 396 * == MPG123_ERR, as the error code could get more specific in future, 397 * or there is just a special message from a decoding routine as indicated 398 * above. 399 * 400 * @{ 401 */ 402 403 /** Enumeration of the message and error codes and returned by libmpg123 functions. */ 404 alias mpg123_errors = int; 405 enum 406 { 407 MPG123_DONE=-12, /**< Message: Track ended. Stop decoding. */ 408 MPG123_NEW_FORMAT=-11, /**< Message: Output format will be different on next call. Note that some libmpg123 versions between 1.4.3 and 1.8.0 insist on you calling mpg123_getformat() after getting this message code. Newer verisons behave like advertised: You have the chance to call mpg123_getformat(), but you can also just continue decoding and get your data. */ 409 MPG123_NEED_MORE=-10, /**< Message: For feed reader: "Feed me more!" (call mpg123_feed() or mpg123_decode() with some new input data). */ 410 MPG123_ERR=-1, /**< Generic Error */ 411 MPG123_OK=0, /**< Success */ 412 MPG123_BAD_OUTFORMAT, /**< Unable to set up output format! */ 413 MPG123_BAD_CHANNEL, /**< Invalid channel number specified. */ 414 MPG123_BAD_RATE, /**< Invalid sample rate specified. */ 415 MPG123_ERR_16TO8TABLE, /**< Unable to allocate memory for 16 to 8 converter table! */ 416 MPG123_BAD_PARAM, /**< Bad parameter id! */ 417 MPG123_BAD_BUFFER, /**< Bad buffer given -- invalid pointer or too small size. */ 418 MPG123_OUT_OF_MEM, /**< Out of memory -- some malloc() failed. */ 419 MPG123_NOT_INITIALIZED, /**< You didn't initialize the library! */ 420 MPG123_BAD_DECODER, /**< Invalid decoder choice. */ 421 MPG123_BAD_HANDLE, /**< Invalid mpg123 handle. */ 422 MPG123_NO_BUFFERS, /**< Unable to initialize frame buffers (out of memory?). */ 423 MPG123_BAD_RVA, /**< Invalid RVA mode. */ 424 MPG123_NO_GAPLESS, /**< This build doesn't support gapless decoding. */ 425 MPG123_NO_SPACE, /**< Not enough buffer space. */ 426 MPG123_BAD_TYPES, /**< Incompatible numeric data types. */ 427 MPG123_BAD_BAND, /**< Bad equalizer band. */ 428 MPG123_ERR_NULL, /**< Null pointer given where valid storage address needed. */ 429 MPG123_ERR_READER, /**< Error reading the stream. */ 430 MPG123_NO_SEEK_FROM_END,/**< Cannot seek from end (end is not known). */ 431 MPG123_BAD_WHENCE, /**< Invalid 'whence' for seek function.*/ 432 MPG123_NO_TIMEOUT, /**< Build does not support stream timeouts. */ 433 MPG123_BAD_FILE, /**< File access error. */ 434 MPG123_NO_SEEK, /**< Seek not supported by stream. */ 435 MPG123_NO_READER, /**< No stream opened. */ 436 MPG123_BAD_PARS, /**< Bad parameter handle. */ 437 MPG123_BAD_INDEX_PAR, /**< Bad parameters to mpg123_index() and mpg123_set_index() */ 438 MPG123_OUT_OF_SYNC, /**< Lost track in bytestream and did not try to resync. */ 439 MPG123_RESYNC_FAIL, /**< Resync failed to find valid MPEG data. */ 440 MPG123_NO_8BIT, /**< No 8bit encoding possible. */ 441 MPG123_BAD_ALIGN, /**< Stack aligmnent error */ 442 MPG123_NULL_BUFFER, /**< NULL input buffer with non-zero size... */ 443 MPG123_NO_RELSEEK, /**< Relative seek not possible (screwed up file offset) */ 444 MPG123_NULL_POINTER, /**< You gave a null pointer somewhere where you shouldn't have. */ 445 MPG123_BAD_KEY, /**< Bad key value given. */ 446 MPG123_NO_INDEX, /**< No frame index in this build. */ 447 MPG123_INDEX_FAIL, /**< Something with frame index went wrong. */ 448 MPG123_BAD_DECODER_SETUP, /**< Something prevents a proper decoder setup */ 449 MPG123_MISSING_FEATURE /**< This feature has not been built into libmpg123. */ 450 ,MPG123_BAD_VALUE /**< A bad value has been given, somewhere. */ 451 ,MPG123_LSEEK_FAILED /**< Low-level seek failed. */ 452 ,MPG123_BAD_CUSTOM_IO /**< Custom I/O not prepared. */ 453 ,MPG123_LFS_OVERFLOW /**< Offset value overflow during translation of large file API calls -- your client program cannot handle that large file. */ 454 ,MPG123_INT_OVERFLOW /**< Some integer overflow. */ 455 } 456 457 /** Look up error strings given integer code. 458 * \param errcode integer error code 459 * \return string describing what that error error code means 460 */ 461 //const (char)* mpg123_plain_strerror(int errcode); 462 alias da_mpg123_plain_strerror = const (char)* function(int errcode); 463 464 /** Give string describing what error has occured in the context of handle mh. 465 * When a function operating on an mpg123 handle returns MPG123_ERR, you should check for the actual reason via 466 * char *errmsg = mpg123_strerror(mh) 467 * This function will catch mh == NULL and return the message for MPG123_BAD_HANDLE. 468 * \param mh handle 469 * \return error message 470 */ 471 //const (char)* mpg123_strerror(mpg123_handle *mh); 472 alias da_mpg123_strerror = const (char)* function(mpg123_handle *mh); 473 474 /** Return the plain errcode intead of a string. 475 * \param mh handle 476 * \return error code recorded in handle or MPG123_BAD_HANDLE 477 */ 478 //int mpg123_errcode(mpg123_handle *mh); 479 alias da_mpg123_errcode = int function(mpg123_handle *mh); 480 481 /*@}*/ 482 483 484 /** \defgroup mpg123_decoder mpg123 decoder selection 485 * 486 * Functions to list and select the available decoders. 487 * Perhaps the most prominent feature of mpg123: You have several (optimized) decoders to choose from (on x86 and PPC (MacOS) systems, that is). 488 * 489 * @{ 490 */ 491 492 /** Get available decoder list. 493 * \return NULL-terminated array of generally available decoder names (plain 8bit ASCII) 494 */ 495 //const (char) **mpg123_decoders(); 496 alias da_mpg123_decoders = const (char) **function(); 497 498 /** Get supported decoder list. 499 * \return NULL-terminated array of the decoders supported by the CPU (plain 8bit ASCII) 500 */ 501 //const (char) **mpg123_supported_decoders(); 502 alias da_mpg123_supported_decoders = const (char) **function(); 503 504 /** Set the active decoder. 505 * \param mh handle 506 * \param decoder_name name of decoder 507 * \return MPG123_OK on success 508 */ 509 //int mpg123_decoder(mpg123_handle *mh, const char* decoder_name); 510 alias da_mpg123_decoder = int function(mpg123_handle *mh, const char* decoder_name); 511 512 /** Get the currently active decoder name. 513 * The active decoder engine can vary depening on output constraints, 514 * mostly non-resampling, integer output is accelerated via 3DNow & Co. but for 515 * other modes a fallback engine kicks in. 516 * Note that this can return a decoder that is only active in the hidden and not 517 * available as decoder choice from the outside. 518 * \param mh handle 519 * \return The decoder name or NULL on error. 520 */ 521 //const (char)* mpg123_current_decoder(mpg123_handle *mh); 522 alias da_mpg123_current_decoder = const (char)* function(mpg123_handle *mh); 523 524 /*@}*/ 525 526 527 /** \defgroup mpg123_output mpg123 output audio format 528 * 529 * Functions to get and select the format of the decoded audio. 530 * 531 * Before you dive in, please be warned that you might get confused by this. This seems to happen a lot, therefore I am trying to explain in advance. 532 * 533 * The mpg123 library decides what output format to use when encountering the first frame in a stream, or actually any frame that is still valid but differs from the frames before in the prompted output format. At such a deciding point, an internal table of allowed encodings, sampling rates and channel setups is consulted. According to this table, an output format is chosen and the decoding engine set up accordingly (including ptimized routines for different output formats). This might seem unusual but it just follows from the non-existence of "MPEG audio files" with defined overall properties. There are streams, streams are concatenations of (semi) independent frames. We store streams on disk and call them "MPEG audio files", but that does not change their nature as the decoder is concerned (the LAME/Xing header for gapless decoding makes things interesting again). 534 * 535 * To get to the point: What you do with mpg123_format() and friends is to fill the internal table of allowed formats before it is used. That includes removing support for some formats or adding your forced sample rate (see MPG123_FORCE_RATE) that will be used with the crude internal resampler. Also keep in mind that the sample encoding is just a question of choice -- the MPEG frames do only indicate their native sampling rate and channel count. If you want to decode to integer or float samples, 8 or 16 bit ... that is your decision. In a "clean" world, libmpg123 would always decode to 32 bit float and let you handle any sample conversion. But there are optimized routines that work faster by directly decoding to the desired encoding / accuracy. We prefer efficiency over conceptual tidyness. 536 * 537 * People often start out thinking that mpg123_format() should change the actual decoding format on the fly. That is wrong. It only has effect on the next natural change of output format, when libmpg123 will consult its format table again. To make life easier, you might want to call mpg123_format_none() before any thing else and then just allow one desired encoding and a limited set of sample rates / channel choices that you actually intend to deal with. You can force libmpg123 to decode everything to 44100 KHz, stereo, 16 bit integer ... it will duplicate mono channels and even do resampling if needed (unless that feature is disabled in the build, same with some encodings). But I have to stress that the resampling of libmpg123 is very crude and doesn't even contain any kind of "proper" interpolation. 538 * 539 * In any case, watch out for MPG123_NEW_FORMAT as return message from decoding routines and call mpg123_getformat() to get the currently active output format. 540 * 541 * @{ 542 */ 543 544 /** They can be combined into one number (3) to indicate mono and stereo... */ 545 enum mpg123_channelcount 546 { 547 MPG123_MONO = 1 /**< mono */ 548 ,MPG123_STEREO = 2 /**< stereo */ 549 }; 550 551 /** An array of supported standard sample rates 552 * These are possible native sample rates of MPEG audio files. 553 * You can still force mpg123 to resample to a different one, but by default you will only get audio in one of these samplings. 554 * \param list Store a pointer to the sample rates array there. 555 * \param number Store the number of sample rates there. */ 556 //void mpg123_rates(const long **list, size_t *number); 557 alias da_mpg123_rates = void function(const long **list, size_t *number); 558 559 /** An array of supported audio encodings. 560 * An audio encoding is one of the fully qualified members of mpg123_enc_enum (MPG123_ENC_SIGNED_16, not MPG123_SIGNED). 561 * \param list Store a pointer to the encodings array there. 562 * \param number Store the number of encodings there. */ 563 //void mpg123_encodings(const int **list, size_t *number); 564 alias da_mpg123_encodings = void function(const int **list, size_t *number); 565 566 /** Return the size (in bytes) of one mono sample of the named encoding. 567 * \param encoding The encoding value to analyze. 568 * \return positive size of encoding in bytes, 0 on invalid encoding. */ 569 //int mpg123_encsize(int encoding); 570 alias da_mpg123_encsize = int function(int encoding); 571 572 /** Configure a mpg123 handle to accept no output format at all, 573 * use before specifying supported formats with mpg123_format 574 * \param mh handle 575 * \return MPG123_OK on success 576 */ 577 //int mpg123_format_none(mpg123_handle *mh); 578 alias da_mpg123_format_none = int function(mpg123_handle *mh); 579 580 /** Configure mpg123 handle to accept all formats 581 * (also any custom rate you may set) -- this is default. 582 * \param mh handle 583 * \return MPG123_OK on success 584 */ 585 //int mpg123_format_all(mpg123_handle *mh); 586 alias da_mpg123_format_all = int function(mpg123_handle *mh); 587 588 /** Set the audio format support of a mpg123_handle in detail: 589 * \param mh handle 590 * \param rate The sample rate value (in Hertz). 591 * \param channels A combination of MPG123_STEREO and MPG123_MONO. 592 * \param encodings A combination of accepted encodings for rate and channels, p.ex MPG123_ENC_SIGNED16 | MPG123_ENC_ULAW_8 (or 0 for no support). Please note that some encodings may not be supported in the library build and thus will be ignored here. 593 * \return MPG123_OK on success, MPG123_ERR if there was an error. */ 594 //int mpg123_format( mpg123_handle *mh 595 // , long rate, int channels, int encodings ); 596 alias da_mpg123_format = int function( mpg123_handle *mh 597 , long rate, int channels, int encodings ); 598 599 /** Check to see if a specific format at a specific rate is supported 600 * by mpg123_handle. 601 * \param mh handle 602 * \param rate sampling rate 603 * \param encoding encoding 604 * \return 0 for no support (that includes invalid parameters), MPG123_STEREO, 605 * MPG123_MONO or MPG123_STEREO|MPG123_MONO. */ 606 //int mpg123_format_support( mpg123_handle *mh 607 // , long rate, int encoding ); 608 alias da_mpg123_format_support = int function( mpg123_handle *mh 609 , long rate, int encoding ); 610 611 /** Get the current output format written to the addresses given. 612 * \param mh handle 613 * \param rate sampling rate return address 614 * \param channels channel count return address 615 * \param encoding encoding return address 616 * \return MPG123_OK on success 617 */ 618 //int mpg123_getformat( mpg123_handle *mh 619 // , long *rate, int *channels, int *encoding ); 620 alias da_mpg123_getformat = int function( mpg123_handle *mh 621 , int *rate, int *channels, int *encoding ); 622 623 /*@}*/ 624 625 626 /** \defgroup mpg123_input mpg123 file input and decoding 627 * 628 * Functions for input bitstream and decoding operations. 629 * Decoding/seek functions may also return message codes MPG123_DONE, MPG123_NEW_FORMAT and MPG123_NEED_MORE (please read up on these on how to react!). 630 * @{ 631 */ 632 633 /* reading samples / triggering decoding, possible return values: */ 634 /** Enumeration of the error codes returned by libmpg123 functions. */ 635 636 /** Open and prepare to decode the specified file by filesystem path. 637 * This does not open HTTP urls; libmpg123 contains no networking code. 638 * If you want to decode internet streams, use mpg123_open_fd() or mpg123_open_feed(). 639 * \param mh handle 640 * \param path filesystem path 641 * \return MPG123_OK on success 642 */ 643 //int mpg123_open(mpg123_handle *mh, const char *path); 644 alias da_mpg123_open = int function(mpg123_handle *mh, const char *path); 645 646 /** Use an already opened file descriptor as the bitstream input 647 * mpg123_close() will _not_ close the file descriptor. 648 * \param mh handle 649 * \param fd file descriptor 650 * \return MPG123_OK on success 651 */ 652 //int mpg123_open_fd(mpg123_handle *mh, int fd); 653 alias da_mpg123_open_fd = int function(mpg123_handle *mh, int fd); 654 655 /** Use an opaque handle as bitstream input. This works only with the 656 * replaced I/O from mpg123_replace_reader_handle()! 657 * mpg123_close() will call the cleanup callback for your handle (if you gave one). 658 * \param mh handle 659 * \param iohandle your handle 660 * \return MPG123_OK on success 661 */ 662 //int mpg123_open_handle(mpg123_handle *mh, void *iohandle); 663 alias da_mpg123_open_handle = int function(mpg123_handle *mh, void *iohandle); 664 665 /** Open a new bitstream and prepare for direct feeding 666 * This works together with mpg123_decode(); you are responsible for reading and feeding the input bitstream. 667 * \param mh handle 668 * \return MPG123_OK on success 669 */ 670 //int mpg123_open_feed(mpg123_handle *mh); 671 alias da_mpg123_open_feed = int function(mpg123_handle *mh); 672 673 /** Closes the source, if libmpg123 opened it. 674 * \param mh handle 675 * \return MPG123_OK on success 676 */ 677 //int mpg123_close(mpg123_handle *mh); 678 alias da_mpg123_close = int function(mpg123_handle *mh); 679 680 /** Read from stream and decode up to outmemsize bytes. 681 * \param mh handle 682 * \param outmemory address of output buffer to write to 683 * \param outmemsize maximum number of bytes to write 684 * \param done address to store the number of actually decoded bytes to 685 * \return MPG123_OK or error/message code 686 */ 687 //int mpg123_read(mpg123_handle *mh 688 // , ubyte*outmemory, size_t outmemsize, size_t *done ); 689 alias da_mpg123_read = int function(mpg123_handle *mh 690 , ubyte*outmemory, size_t outmemsize, size_t *done ); 691 692 /** Feed data for a stream that has been opened with mpg123_open_feed(). 693 * It's give and take: You provide the bytestream, mpg123 gives you the decoded samples. 694 * \param mh handle 695 * \param in input buffer 696 * \param size number of input bytes 697 * \return MPG123_OK or error/message code. 698 */ 699 //int mpg123_feed( mpg123_handle *mh 700 // , const ubyte* in_, size_t size ); 701 alias da_mpg123_feed = int function( mpg123_handle *mh 702 , const ubyte* in_, size_t size ); 703 704 /** Decode MPEG Audio from inmemory to outmemory. 705 * This is very close to a drop-in replacement for old mpglib. 706 * When you give zero-sized output buffer the input will be parsed until 707 * decoded data is available. This enables you to get MPG123_NEW_FORMAT (and query it) 708 * without taking decoded data. 709 * Think of this function being the union of mpg123_read() and mpg123_feed() (which it actually is, sort of;-). 710 * You can actually always decide if you want those specialized functions in separate steps or one call this one here. 711 * \param mh handle 712 * \param inmemory input buffer 713 * \param inmemsize number of input bytes 714 * \param outmemory output buffer 715 * \param outmemsize maximum number of output bytes 716 * \param done address to store the number of actually decoded bytes to 717 * \return error/message code (watch out especially for MPG123_NEED_MORE) 718 */ 719 //int mpg123_decode( mpg123_handle *mh 720 // , const ubyte*inmemory, size_t inmemsize 721 // , ubyte*outmemory, size_t outmemsize, size_t *done ); 722 alias da_mpg123_decode = int function( mpg123_handle *mh 723 , const ubyte*inmemory, size_t inmemsize 724 , ubyte*outmemory, size_t outmemsize, size_t *done ); 725 726 /** Decode next MPEG frame to internal buffer 727 * or read a frame and return after setting a new format. 728 * \param mh handle 729 * \param num current frame offset gets stored there 730 * \param audio This pointer is set to the internal buffer to read the decoded audio from. 731 * \param bytes number of output bytes ready in the buffer 732 * \return MPG123_OK or error/message code 733 */ 734 //int mpg123_decode_frame( mpg123_handle *mh 735 // , off_t *num, ubyte**audio, size_t *bytes ); 736 alias da_mpg123_decode_frame = int function( mpg123_handle *mh 737 , off_t *num, ubyte**audio, size_t *bytes ); 738 739 /** Decode current MPEG frame to internal buffer. 740 * Warning: This is experimental API that might change in future releases! 741 * Please watch mpg123 development closely when using it. 742 * \param mh handle 743 * \param num last frame offset gets stored there 744 * \param audio this pointer is set to the internal buffer to read the decoded audio from. 745 * \param bytes number of output bytes ready in the buffer 746 * \return MPG123_OK or error/message code 747 */ 748 //int mpg123_framebyframe_decode( mpg123_handle *mh 749 // , off_t *num, ubyte**audio, size_t *bytes ); 750 alias da_mpg123_framebyframe_decode = int function( mpg123_handle *mh 751 , off_t *num, ubyte**audio, size_t *bytes ); 752 753 /** Find, read and parse the next mp3 frame 754 * Warning: This is experimental API that might change in future releases! 755 * Please watch mpg123 development closely when using it. 756 * \param mh handle 757 * \return MPG123_OK or error/message code 758 */ 759 //int mpg123_framebyframe_next(mpg123_handle *mh); 760 alias da_mpg123_framebyframe_next = int function(mpg123_handle *mh); 761 762 /** Get access to the raw input data for the last parsed frame. 763 * This gives you a direct look (and write access) to the frame body data. 764 * Together with the raw header, you can reconstruct the whole raw MPEG stream without junk and meta data, or play games by actually modifying the frame body data before decoding this frame (mpg123_framebyframe_decode()). 765 * A more sane use would be to use this for CRC checking (see mpg123_info() and MPG123_CRC), the first two bytes of the body make up the CRC16 checksum, if present. 766 * You can provide NULL for a parameter pointer when you are not interested in the value. 767 * 768 * \param mh handle 769 * \param header the 4-byte MPEG header 770 * \param bodydata pointer to the frame body stored in the handle (without the header) 771 * \param bodybytes size of frame body in bytes (without the header) 772 * \return MPG123_OK if there was a yet un-decoded frame to get the 773 * data from, MPG123_BAD_HANDLE or MPG123_ERR otherwise (without further 774 * explanation, the error state of the mpg123_handle is not modified by 775 * this function). 776 */ 777 //int mpg123_framedata( mpg123_handle *mh 778 // , uint *header, ubyte**bodydata, size_t *bodybytes ); 779 alias da_mpg123_framedata = int function( mpg123_handle *mh 780 , uint *header, ubyte**bodydata, size_t *bodybytes ); 781 782 /** Get the input position (byte offset in stream) of the last parsed frame. 783 * This can be used for external seek index building, for example. 784 * It just returns the internally stored offset, regardless of validity -- 785 * you ensure that a valid frame has been parsed before! 786 * \param mh handle 787 * \return byte offset in stream 788 */ 789 //off_t mpg123_framepos(mpg123_handle *mh); 790 alias da_mpg123_framepos = off_t function(mpg123_handle *mh); 791 792 /*@}*/ 793 794 795 /** \defgroup mpg123_seek mpg123 position and seeking 796 * 797 * Functions querying and manipulating position in the decoded audio bitstream. 798 * The position is measured in decoded audio samples, or MPEG frame offset for the specific functions. 799 * If gapless code is in effect, the positions are adjusted to compensate the skipped padding/delay - meaning, you should not care about that at all and just use the position defined for the samples you get out of the decoder;-) 800 * The general usage is modelled after stdlib's ftell() and fseek(). 801 * Especially, the whence parameter for the seek functions has the same meaning as the one for fseek() and needs the same constants from stdlib.h: 802 * - SEEK_SET: set position to (or near to) specified offset 803 * - SEEK_CUR: change position by offset from now 804 * - SEEK_END: set position to offset from end 805 * 806 * Note that sample-accurate seek only works when gapless support has been enabled at compile time; seek is frame-accurate otherwise. 807 * Also, really sample-accurate seeking (meaning that you get the identical sample value after seeking compared to plain decoding up to the position) is only guaranteed when you do not mess with the position code by using MPG123_UPSPEED, MPG123_DOWNSPEED or MPG123_START_FRAME. The first two mainly should cause trouble with NtoM resampling, but in any case with these options in effect, you have to keep in mind that the sample offset is not the same as counting the samples you get from decoding since mpg123 counts the skipped samples, too (or the samples played twice only once)! 808 * Short: When you care about the sample position, don't mess with those parameters;-) 809 * Also, seeking is not guaranteed to work for all streams (underlying stream may not support it). 810 * And yet another caveat: If the stream is concatenated out of differing pieces (Frankenstein stream), seeking may suffer, too. 811 * 812 * @{ 813 */ 814 815 /** Returns the current position in samples. 816 * On the next successful read, you'd get that sample. 817 * \param mh handle 818 * \return sample offset or MPG123_ERR (null handle) 819 */ 820 //off_t mpg123_tell(mpg123_handle *mh); 821 alias da_mpg123_tell = off_t function(mpg123_handle *mh); 822 823 /** Returns the frame number that the next read will give you data from. 824 * \param mh handle 825 * \return frame offset or MPG123_ERR (null handle) 826 */ 827 //off_t mpg123_tellframe(mpg123_handle *mh); 828 alias da_mpg123_tellframe = off_t function(mpg123_handle *mh); 829 830 /** Returns the current byte offset in the input stream. 831 * \param mh handle 832 * \return byte offset or MPG123_ERR (null handle) 833 */ 834 //off_t mpg123_tell_stream(mpg123_handle *mh); 835 alias da_mpg123_tell_stream = off_t function(mpg123_handle *mh); 836 837 /** Seek to a desired sample offset. 838 * Usage is modelled afer the standard lseek(). 839 * \param mh handle 840 * \param sampleoff offset in PCM samples 841 * \param whence one of SEEK_SET, SEEK_CUR or SEEK_END 842 * \return The resulting offset >= 0 or error/message code 843 */ 844 //off_t mpg123_seek( mpg123_handle *mh 845 // , off_t sampleoff, int whence ); 846 alias da_mpg123_seek = off_t function( mpg123_handle *mh 847 , off_t sampleoff, int whence ); 848 849 /** Seek to a desired sample offset in data feeding mode. 850 * This just prepares things to be right only if you ensure that the next chunk of input data will be from input_offset byte position. 851 * \param mh handle 852 * \param sampleoff offset in PCM samples 853 * \param whence one of SEEK_SET, SEEK_CUR or SEEK_END 854 * \param input_offset The position it expects to be at the 855 * next time data is fed to mpg123_decode(). 856 * \return The resulting offset >= 0 or error/message code */ 857 //off_t mpg123_feedseek( mpg123_handle *mh 858 // , off_t sampleoff, int whence, off_t *input_offset ); 859 alias da_mpg123_feedseek = off_t function( mpg123_handle *mh 860 , off_t sampleoff, int whence, off_t *input_offset ); 861 862 /** Seek to a desired MPEG frame offset. 863 * Usage is modelled afer the standard lseek(). 864 * \param mh handle 865 * \param frameoff offset in MPEG frames 866 * \param whence one of SEEK_SET, SEEK_CUR or SEEK_END 867 * \return The resulting offset >= 0 or error/message code */ 868 //off_t mpg123_seek_frame( mpg123_handle *mh 869 // , off_t frameoff, int whence ); 870 alias da_mpg123_seek_frame = off_t function( mpg123_handle *mh 871 , off_t frameoff, int whence ); 872 873 /** Return a MPEG frame offset corresponding to an offset in seconds. 874 * This assumes that the samples per frame do not change in the file/stream, which is a good assumption for any sane file/stream only. 875 * \return frame offset >= 0 or error/message code */ 876 //off_t mpg123_timeframe(mpg123_handle *mh, double sec); 877 alias da_mpg123_timeframe = off_t function(mpg123_handle *mh, double sec); 878 879 /** Give access to the frame index table that is managed for seeking. 880 * You are asked not to modify the values... Use mpg123_set_index to set the 881 * seek index 882 * \param mh handle 883 * \param offsets pointer to the index array 884 * \param step one index byte offset advances this many MPEG frames 885 * \param fill number of recorded index offsets; size of the array 886 * \return MPG123_OK on success 887 */ 888 //int mpg123_index( mpg123_handle *mh 889 // , off_t **offsets, off_t *step, size_t *fill ); 890 alias da_mpg123_index = int function ( mpg123_handle *mh 891 , off_t **offsets, off_t *step, size_t *fill ); 892 893 /** Set the frame index table 894 * Setting offsets to NULL and fill > 0 will allocate fill entries. Setting offsets 895 * to NULL and fill to 0 will clear the index and free the allocated memory used by the index. 896 * \param mh handle 897 * \param offsets pointer to the index array 898 * \param step one index byte offset advances this many MPEG frames 899 * \param fill number of recorded index offsets; size of the array 900 * \return MPG123_OK on success 901 */ 902 //int mpg123_set_index( mpg123_handle *mh 903 // , off_t *offsets, off_t step, size_t fill ); 904 alias da_mpg123_set_index = int function( mpg123_handle *mh 905 , off_t *offsets, off_t step, size_t fill ); 906 907 /** An old crutch to keep old mpg123 binaries happy. 908 * WARNING: This function is there only to avoid runtime linking errors with 909 * standalone mpg123 before version 1.23.0 (if you strangely update the 910 * library but not the end-user program) and actually is broken 911 * for various cases (p.ex. 24 bit output). Do never use. It might eventually 912 * be purged from the library. 913 */ 914 //int mpg123_position( mpg123_handle *mh, off_t frame_offset, off_t buffered_bytes, off_t *current_frame, off_t *frames_left, double *current_seconds, double *seconds_left); 915 alias da_mpg123_position = int function( mpg123_handle *mh, off_t frame_offset, off_t buffered_bytes, off_t *current_frame, off_t *frames_left, double *current_seconds, double *seconds_left); 916 917 /*@}*/ 918 919 920 /** \defgroup mpg123_voleq mpg123 volume and equalizer 921 * 922 * @{ 923 */ 924 925 /** another channel enumeration, for left/right choice */ 926 enum mpg123_channels 927 { 928 MPG123_LEFT=0x1 /**< The Left Channel. */ 929 ,MPG123_RIGHT=0x2 /**< The Right Channel. */ 930 ,MPG123_LR=0x3 /**< Both left and right channel; same as MPG123_LEFT|MPG123_RIGHT */ 931 }; 932 933 /** Set the 32 Band Audio Equalizer settings. 934 * \param mh handle 935 * \param channel Can be MPG123_LEFT, MPG123_RIGHT or MPG123_LEFT|MPG123_RIGHT for both. 936 * \param band The equaliser band to change (from 0 to 31) 937 * \param val The (linear) adjustment factor. 938 * \return MPG123_OK on success 939 */ 940 //int mpg123_eq( mpg123_handle *mh 941 // , mpg123_channels channel, int band, double val ); 942 alias da_mpg123_eq = int function( mpg123_handle *mh 943 , mpg123_channels channel, int band, double val ); 944 945 /** Get the 32 Band Audio Equalizer settings. 946 * \param mh handle 947 * \param channel Can be MPG123_LEFT, MPG123_RIGHT or MPG123_LEFT|MPG123_RIGHT for (arithmetic mean of) both. 948 * \param band The equaliser band to change (from 0 to 31) 949 * \return The (linear) adjustment factor (zero for pad parameters) */ 950 //double mpg123_geteq(mpg123_handle *mh 951 // , mpg123_channels channel, int band); 952 alias da_mpg123_geteq = double function(mpg123_handle *mh 953 , mpg123_channels channel, int band); 954 955 /** Reset the 32 Band Audio Equalizer settings to flat 956 * \param mh handle 957 * \return MPG123_OK on success 958 */ 959 //int mpg123_reset_eq(mpg123_handle *mh); 960 alias da_mpg123_reset_eq = int function(mpg123_handle *mh); 961 962 /** Set the absolute output volume including the RVA setting, 963 * vol<0 just applies (a possibly changed) RVA setting. 964 * \param mh handle 965 * \param vol volume value (linear factor) 966 * \return MPG123_OK on success 967 */ 968 //int mpg123_volume(mpg123_handle *mh, double vol); 969 alias da_mpg123_volume = int function(mpg123_handle *mh, double vol); 970 971 /** Adjust output volume including the RVA setting by chosen amount 972 * \param mh handle 973 * \param change volume value (linear factor increment) 974 * \return MPG123_OK on success 975 */ 976 //int mpg123_volume_change(mpg123_handle *mh, double change); 977 alias da_mpg123_volume_change = int function(mpg123_handle *mh, double change); 978 979 /** Return current volume setting, the actual value due to RVA, and the RVA 980 * adjustment itself. It's all as double float value to abstract the sample 981 * format. The volume values are linear factors / amplitudes (not percent) 982 * and the RVA value is in decibels. 983 * \param mh handle 984 * \param base return address for base volume (linear factor) 985 * \param really return address for actual volume (linear factor) 986 * \param rva_db return address for RVA value (decibels) 987 * \return MPG123_OK on success 988 */ 989 //int mpg123_getvolume(mpg123_handle *mh, double *base, double *really, double *rva_db); 990 alias da_mpg123_getvolume = int function(mpg123_handle *mh, double *base, double *really, double *rva_db); 991 992 /* TODO: Set some preamp in addition / to replace internal RVA handling? */ 993 994 /*@}*/ 995 996 997 /** \defgroup mpg123_status mpg123 status and information 998 * 999 * @{ 1000 */ 1001 1002 /** Enumeration of the mode types of Variable Bitrate */ 1003 enum mpg123_vbr { 1004 MPG123_CBR=0, /**< Constant Bitrate Mode (default) */ 1005 MPG123_VBR, /**< Variable Bitrate Mode */ 1006 MPG123_ABR /**< Average Bitrate Mode */ 1007 }; 1008 1009 /** Enumeration of the MPEG Versions */ 1010 enum mpg123_version { 1011 MPG123_1_0=0, /**< MPEG Version 1.0 */ 1012 MPG123_2_0, /**< MPEG Version 2.0 */ 1013 MPG123_2_5 /**< MPEG Version 2.5 */ 1014 }; 1015 1016 1017 /** Enumeration of the MPEG Audio mode. 1018 * Only the mono mode has 1 channel, the others have 2 channels. */ 1019 enum mpg123_mode { 1020 MPG123_M_STEREO=0, /**< Standard Stereo. */ 1021 MPG123_M_JOINT, /**< Joint Stereo. */ 1022 MPG123_M_DUAL, /**< Dual Channel. */ 1023 MPG123_M_MONO /**< Single Channel. */ 1024 }; 1025 1026 1027 /** Enumeration of the MPEG Audio flag bits */ 1028 enum mpg123_flags { 1029 MPG123_CRC=0x1, /**< The bitstream is error protected using 16-bit CRC. */ 1030 MPG123_COPYRIGHT=0x2, /**< The bitstream is copyrighted. */ 1031 MPG123_PRIVATE=0x4, /**< The private bit has been set. */ 1032 MPG123_ORIGINAL=0x8 /**< The bitstream is an original, not a copy. */ 1033 }; 1034 1035 /** Data structure for storing information about a frame of MPEG Audio */ 1036 struct mpg123_frameinfo 1037 { 1038 mpg123_version version_; /**< The MPEG version (1.0/2.0/2.5). */ 1039 int layer; /**< The MPEG Audio Layer (MP1/MP2/MP3). */ 1040 long rate; /**< The sampling rate in Hz. */ 1041 mpg123_mode mode; /**< The audio mode (Mono, Stereo, Joint-stero, Dual Channel). */ 1042 int mode_ext; /**< The mode extension bit flag. */ 1043 int framesize; /**< The size of the frame (in bytes, including header). */ 1044 mpg123_flags flags; /**< MPEG Audio flag bits. Just now I realize that it should be declared as int, not enum. It's a bitwise combination of the enum values. */ 1045 int emphasis; /**< The emphasis type. */ 1046 int bitrate; /**< Bitrate of the frame (kbps). */ 1047 int abr_rate; /**< The target average bitrate. */ 1048 mpg123_vbr vbr; /**< The VBR mode. */ 1049 }; 1050 1051 /** Get frame information about the MPEG audio bitstream and store it in a mpg123_frameinfo structure. 1052 * \param mh handle 1053 * \param mi address of existing frameinfo structure to write to 1054 * \return MPG123_OK on success 1055 */ 1056 //int mpg123_info(mpg123_handle *mh, mpg123_frameinfo *mi); 1057 alias da_mpg123_info = int function(mpg123_handle *mh, mpg123_frameinfo *mi); 1058 1059 /** Get the safe output buffer size for all cases 1060 * (when you want to replace the internal buffer) 1061 * \return safe buffer size 1062 */ 1063 //size_t mpg123_safe_buffer(); 1064 alias da_mpg123_safe_buffer = size_t function(); 1065 1066 /** Make a full parsing scan of each frame in the file. ID3 tags are found. An 1067 * accurate length value is stored. Seek index will be filled. A seek back to 1068 * current position is performed. At all, this function refuses work when 1069 * stream is not seekable. 1070 * \param mh handle 1071 * \return MPG123_OK on success 1072 */ 1073 //int mpg123_scan(mpg123_handle *mh); 1074 alias da_mpg123_scan = int function(mpg123_handle *mh); 1075 1076 /** Return, if possible, the full (expected) length of current track in frames. 1077 * \param mh handle 1078 * \return length >= 0 or MPG123_ERR if there is no length guess possible. 1079 */ 1080 //off_t mpg123_framelength(mpg123_handle *mh); 1081 alias da_mpg123_framelength = off_t function(mpg123_handle *mh); 1082 1083 /** Return, if possible, the full (expected) length of current track in samples. 1084 * \param mh handle 1085 * \return length >= 0 or MPG123_ERR if there is no length guess possible. 1086 */ 1087 //off_t mpg123_length(mpg123_handle *mh); 1088 alias da_mpg123_length = off_t function(mpg123_handle *mh); 1089 1090 /** Override the value for file size in bytes. 1091 * Useful for getting sensible track length values in feed mode or for HTTP streams. 1092 * \param mh handle 1093 * \param size file size in bytes 1094 * \return MPG123_OK on success 1095 */ 1096 //int mpg123_set_filesize(mpg123_handle *mh, off_t size); 1097 alias da_mpg123_set_filesize = int function(mpg123_handle *mh, off_t size); 1098 1099 /** Get MPEG frame duration in seconds. 1100 * \param mh handle 1101 * \return frame duration in seconds, <0 on error 1102 */ 1103 //double mpg123_tpf(mpg123_handle *mh); 1104 alias da_mpg123_tpf = double function(mpg123_handle *mh); 1105 1106 /** Get MPEG frame duration in samples. 1107 * \param mh handle 1108 * \return samples per frame for the most recently parsed frame; <0 on errors 1109 */ 1110 //int mpg123_spf(mpg123_handle *mh); 1111 alias da_mpg123_spf = int function(mpg123_handle *mh); 1112 1113 /** Get and reset the clip count. 1114 * \param mh handle 1115 * \return count of clipped samples 1116 */ 1117 //long mpg123_clip(mpg123_handle *mh); 1118 alias da_mpg123_clip = long function(mpg123_handle *mh); 1119 1120 1121 /** The key values for state information from mpg123_getstate(). */ 1122 enum mpg123_state 1123 { 1124 MPG123_ACCURATE = 1 /**< Query if positons are currently accurate (integer value, 0 if false, 1 if true). */ 1125 ,MPG123_BUFFERFILL /**< Get fill of internal (feed) input buffer as integer byte count returned as long and as double. An error is returned on integer overflow while converting to (signed) long, but the returned floating point value shold still be fine. */ 1126 ,MPG123_FRANKENSTEIN /**< Stream consists of carelessly stitched together files. Seeking may yield unexpected results (also with MPG123_ACCURATE, it may be confused). */ 1127 ,MPG123_FRESH_DECODER /**< Decoder structure has been updated, possibly indicating changed stream (integer value, 0 if false, 1 if true). Flag is cleared after retrieval. */ 1128 }; 1129 1130 /** Get various current decoder/stream state information. 1131 * \param mh handle 1132 * \param key the key to identify the information to give. 1133 * \param val the address to return (long) integer values to 1134 * \param fval the address to return floating point values to 1135 * \return MPG123_OK on success 1136 */ 1137 //int mpg123_getstate( mpg123_handle *mh 1138 // , mpg123_state key, long *val, double *fval ); 1139 alias da_mpg123_getstate = int function( mpg123_handle *mh 1140 , mpg123_state key, long *val, double *fval ); 1141 1142 /*@}*/ 1143 1144 1145 /** \defgroup mpg123_metadata mpg123 metadata handling 1146 * 1147 * Functions to retrieve the metadata from MPEG Audio files and streams. 1148 * Also includes string handling functions. 1149 * 1150 * @{ 1151 */ 1152 1153 /** Data structure for storing strings in a safer way than a standard C-String. 1154 * Can also hold a number of null-terminated strings. */ 1155 struct mpg123_string 1156 { 1157 char* p; /**< pointer to the string data */ 1158 size_t size; /**< raw number of bytes allocated */ 1159 size_t fill; /**< number of used bytes (including closing zero byte) */ 1160 } 1161 1162 /** Create and allocate memory for a new mpg123_string 1163 * \param sb string handle (address of existing structure on your side) 1164 */ 1165 //void mpg123_init_string(mpg123_string* sb); 1166 alias da_mpg123_init_string = void function(mpg123_string* sb); 1167 1168 /** Free-up mempory for an existing mpg123_string 1169 * \param sb string handle 1170 */ 1171 //void mpg123_free_string(mpg123_string* sb); 1172 alias da_mpg123_free_string = void function(mpg123_string* sb); 1173 1174 /** Change the size of a mpg123_string 1175 * \param sb string handle 1176 * \param news new size in bytes 1177 * \return 0 on error, 1 on success 1178 */ 1179 //int mpg123_resize_string(mpg123_string* sb, size_t news); 1180 alias da_mpg123_resize_string = int function(mpg123_string* sb, size_t news); 1181 1182 /** Increase size of a mpg123_string if necessary (it may stay larger). 1183 * Note that the functions for adding and setting in current libmpg123 1184 * use this instead of mpg123_resize_string(). 1185 * That way, you can preallocate memory and safely work afterwards with 1186 * pieces. 1187 * \param sb string handle 1188 * \param news new minimum size 1189 * \return 0 on error, 1 on success 1190 */ 1191 //int mpg123_grow_string(mpg123_string* sb, size_t news); 1192 alias da_mpg123_grow_string = int function(mpg123_string* sb, size_t news); 1193 1194 /** Copy the contents of one mpg123_string string to another. 1195 * Yes the order of arguments is reversed compated to memcpy(). 1196 * \param from string handle 1197 * \param to string handle 1198 * \return 0 on error, 1 on success 1199 */ 1200 //int mpg123_copy_string(mpg123_string* from, mpg123_string* to); 1201 alias da_mpg123_copy_string = int function(mpg123_string* from, mpg123_string* to); 1202 1203 /** Append a C-String to an mpg123_string 1204 * \param sb string handle 1205 * \param stuff to append 1206 * \return 0 on error, 1 on success 1207 */ 1208 //int mpg123_add_string(mpg123_string* sb, const char* stuff); 1209 alias da_mpg123_add_string = int function(mpg123_string* sb, const char* stuff); 1210 1211 /** Append a C-substring to an mpg123 string 1212 * \param sb string handle 1213 * \param stuff content to copy 1214 * \param from offset to copy from 1215 * \param count number of characters to copy (a null-byte is always appended) 1216 * \return 0 on error, 1 on success 1217 */ 1218 //int mpg123_add_substring( mpg123_string *sb 1219 // , const char *stuff, size_t from, size_t count ); 1220 alias da_mpg123_add_substring = int function( mpg123_string *sb 1221 , const char *stuff, size_t from, size_t count ); 1222 1223 /** Set the content of a mpg123_string to a C-string 1224 * \param sb string handle 1225 * \param stuff content to copy 1226 * \return 0 on error, 1 on success 1227 */ 1228 //int mpg123_set_string(mpg123_string* sb, const char* stuff); 1229 alias da_mpg123_set_string = int function(mpg123_string* sb, const char* stuff); 1230 1231 /** Set the content of a mpg123_string to a C-substring 1232 * \param sb string handle 1233 * \param stuff the future content 1234 * \param from offset to copy from 1235 * \param count number of characters to copy (a null-byte is always appended) 1236 * \return 0 on error, 1 on success 1237 */ 1238 //int mpg123_set_substring( mpg123_string *sb 1239 // , const char *stuff, size_t from, size_t count ); 1240 alias da_mpg123_set_substring = int function( mpg123_string *sb 1241 , const char *stuff, size_t from, size_t count ); 1242 1243 /** Count characters in a mpg123 string (non-null bytes or UTF-8 characters). 1244 * Even with the fill property, the character count is not obvious as there could be multiple trailing null bytes. 1245 * \param sb string handle 1246 * \param utf8 a flag to tell if the string is in utf8 encoding 1247 * \return character count 1248 */ 1249 //size_t mpg123_strlen(mpg123_string *sb, int utf8); 1250 alias da_mpg123_strlen = size_t function(mpg123_string *sb, int utf8); 1251 1252 /** Remove trailing \\r and \\n, if present. 1253 * \param sb string handle 1254 * \return 0 on error, 1 on success 1255 */ 1256 //int mpg123_chomp_string(mpg123_string *sb); 1257 alias da_mpg123_chomp_string = int function(mpg123_string *sb); 1258 1259 /** The mpg123 text encodings. This contains encodings we encounter in ID3 tags or ICY meta info. */ 1260 enum mpg123_text_encoding 1261 { 1262 mpg123_text_unknown = 0 /**< Unkown encoding... mpg123_id3_encoding can return that on invalid codes. */ 1263 ,mpg123_text_utf8 = 1 /**< UTF-8 */ 1264 ,mpg123_text_latin1 = 2 /**< ISO-8859-1. Note that sometimes latin1 in ID3 is abused for totally different encodings. */ 1265 ,mpg123_text_icy = 3 /**< ICY metadata encoding, usually CP-1252 but we take it as UTF-8 if it qualifies as such. */ 1266 ,mpg123_text_cp1252 = 4 /**< Really CP-1252 without any guessing. */ 1267 ,mpg123_text_utf16 = 5 /**< Some UTF-16 encoding. The last of a set of leading BOMs (byte order mark) rules. 1268 * When there is no BOM, big endian ordering is used. Note that UCS-2 qualifies as UTF-8 when 1269 * you don't mess with the reserved code points. If you want to decode little endian data 1270 * without BOM you need to prepend 0xff 0xfe yourself. */ 1271 ,mpg123_text_utf16bom = 6 /**< Just an alias for UTF-16, ID3v2 has this as distinct code. */ 1272 ,mpg123_text_utf16be = 7 /**< Another alias for UTF16 from ID3v2. Note, that, because of the mess that is reality, 1273 * BOMs are used if encountered. There really is not much distinction between the UTF16 types for mpg123 1274 * One exception: Since this is seen in ID3v2 tags, leading null bytes are skipped for all other UTF16 1275 * types (we expect a BOM before real data there), not so for utf16be!*/ 1276 ,mpg123_text_max = 7 /**< Placeholder for the maximum encoding value. */ 1277 } 1278 1279 /** The encoding byte values from ID3v2. */ 1280 enum mpg123_id3_enc 1281 { 1282 mpg123_id3_latin1 = 0 /**< Note: This sometimes can mean anything in practice... */ 1283 ,mpg123_id3_utf16bom = 1 /**< UTF16, UCS-2 ... it's all the same for practical purposes. */ 1284 ,mpg123_id3_utf16be = 2 /**< Big-endian UTF-16, BOM see note for mpg123_text_utf16be. */ 1285 ,mpg123_id3_utf8 = 3 /**< Our lovely overly ASCII-compatible 8 byte encoding for the world. */ 1286 ,mpg123_id3_enc_max = 3 /**< Placeholder to check valid range of encoding byte. */ 1287 } 1288 1289 /** Convert ID3 encoding byte to mpg123 encoding index. 1290 * \param id3_enc_byte the ID3 encoding code 1291 * \return the mpg123 encoding index 1292 */ 1293 //pg123_text_encoding mpg123_enc_from_id3(ubyte id3_enc_byte); 1294 alias da_mpg123_enc_from_id3 = mpg123_text_encoding function(ubyte id3_enc_byte); 1295 1296 /** Store text data in string, after converting to UTF-8 from indicated encoding 1297 * A prominent error can be that you provided an unknown encoding value, or this build of libmpg123 lacks support for certain encodings (ID3 or ICY stuff missing). 1298 * Also, you might want to take a bit of care with preparing the data; for example, strip leading zeroes (I have seen that). 1299 * \param sb target string 1300 * \param enc mpg123 text encoding value 1301 * \param source source buffer with plain unsigned bytes (you might need to cast from signed char) 1302 * \param source_size number of bytes in the source buffer 1303 * \return 0 on error, 1 on success (on error, mpg123_free_string is called on sb) 1304 */ 1305 //int mpg123_store_utf8(mpg123_string *sb, mpg123_text_encoding enc, const ubyte*source, size_t source_size); 1306 alias da_mpg123_store_utf8 = int function(mpg123_string *sb, mpg123_text_encoding enc, const ubyte*source, size_t source_size); 1307 1308 /** Sub data structure for ID3v2, for storing various text fields (including comments). 1309 * This is for ID3v2 COMM, TXXX and all the other text fields. 1310 * Only COMM and TXXX have a description, only COMM and USLT have a language. 1311 * You should consult the ID3v2 specification for the use of the various text fields ("frames" in ID3v2 documentation, I use "fields" here to separate from MPEG frames). */ 1312 struct mpg123_text 1313 { 1314 char[3] lang; /**< Three-letter language code (not terminated). */ 1315 char[4] id; /**< The ID3v2 text field id, like TALB, TPE2, ... (4 characters, no string termination). */ 1316 mpg123_string description; /**< Empty for the generic comment... */ 1317 mpg123_string text; /**< ... */ 1318 } 1319 1320 /** The picture type values from ID3v2. */ 1321 enum mpg123_id3_pic_type 1322 { 1323 mpg123_id3_pic_other = 0 /**< see ID3v2 docs */ 1324 ,mpg123_id3_pic_icon = 1 /**< see ID3v2 docs */ 1325 ,mpg123_id3_pic_other_icon = 2 /**< see ID3v2 docs */ 1326 ,mpg123_id3_pic_front_cover = 3 /**< see ID3v2 docs */ 1327 ,mpg123_id3_pic_back_cover = 4 /**< see ID3v2 docs */ 1328 ,mpg123_id3_pic_leaflet = 5 /**< see ID3v2 docs */ 1329 ,mpg123_id3_pic_media = 6 /**< see ID3v2 docs */ 1330 ,mpg123_id3_pic_lead = 7 /**< see ID3v2 docs */ 1331 ,mpg123_id3_pic_artist = 8 /**< see ID3v2 docs */ 1332 ,mpg123_id3_pic_conductor = 9 /**< see ID3v2 docs */ 1333 ,mpg123_id3_pic_orchestra = 10 /**< see ID3v2 docs */ 1334 ,mpg123_id3_pic_composer = 11 /**< see ID3v2 docs */ 1335 ,mpg123_id3_pic_lyricist = 12 /**< see ID3v2 docs */ 1336 ,mpg123_id3_pic_location = 13 /**< see ID3v2 docs */ 1337 ,mpg123_id3_pic_recording = 14 /**< see ID3v2 docs */ 1338 ,mpg123_id3_pic_performance = 15 /**< see ID3v2 docs */ 1339 ,mpg123_id3_pic_video = 16 /**< see ID3v2 docs */ 1340 ,mpg123_id3_pic_fish = 17 /**< see ID3v2 docs */ 1341 ,mpg123_id3_pic_illustration = 18 /**< see ID3v2 docs */ 1342 ,mpg123_id3_pic_artist_logo = 19 /**< see ID3v2 docs */ 1343 ,mpg123_id3_pic_publisher_logo = 20 /**< see ID3v2 docs */ 1344 }; 1345 1346 /** Sub data structure for ID3v2, for storing picture data including comment. 1347 * This is for the ID3v2 APIC field. You should consult the ID3v2 specification 1348 * for the use of the APIC field ("frames" in ID3v2 documentation, I use "fields" 1349 * here to separate from MPEG frames). */ 1350 struct mpg123_picture 1351 { 1352 char type; /**< mpg123_id3_pic_type value */ 1353 mpg123_string description; /**< description string */ 1354 mpg123_string mime_type; /**< MIME type */ 1355 size_t size; /**< size in bytes */ 1356 ubyte* data; /**< pointer to the image data */ 1357 } 1358 1359 /** Data structure for storing IDV3v2 tags. 1360 * This structure is not a direct binary mapping with the file contents. 1361 * The ID3v2 text frames are allowed to contain multiple strings. 1362 * So check for null bytes until you reach the mpg123_string fill. 1363 * All text is encoded in UTF-8. */ 1364 struct mpg123_id3v2 1365 { 1366 ubyte version_; /**< 3 or 4 for ID3v2.3 or ID3v2.4. */ 1367 mpg123_string *title; /**< Title string (pointer into text_list). */ 1368 mpg123_string *artist; /**< Artist string (pointer into text_list). */ 1369 mpg123_string *album; /**< Album string (pointer into text_list). */ 1370 mpg123_string *year; /**< The year as a string (pointer into text_list). */ 1371 mpg123_string *genre; /**< Genre String (pointer into text_list). The genre string(s) may very well need postprocessing, esp. for ID3v2.3. */ 1372 mpg123_string *comment; /**< Pointer to last encountered comment text with empty description. */ 1373 /* Encountered ID3v2 fields are appended to these lists. 1374 There can be multiple occurences, the pointers above always point to the last encountered data. */ 1375 mpg123_text *comment_list; /**< Array of comments. */ 1376 size_t comments; /**< Number of comments. */ 1377 mpg123_text *text; /**< Array of ID3v2 text fields (including USLT) */ 1378 size_t texts; /**< Numer of text fields. */ 1379 mpg123_text *extra; /**< The array of extra (TXXX) fields. */ 1380 size_t extras; /**< Number of extra text (TXXX) fields. */ 1381 mpg123_picture *picture; /**< Array of ID3v2 pictures fields (APIC). */ 1382 size_t pictures; /**< Number of picture (APIC) fields. */ 1383 } 1384 1385 /** Data structure for ID3v1 tags (the last 128 bytes of a file). 1386 * Don't take anything for granted (like string termination)! 1387 * Also note the change ID3v1.1 did: comment[28] = 0; comment[29] = track_number 1388 * It is your task to support ID3v1 only or ID3v1.1 ...*/ 1389 struct mpg123_id3v1 1390 { 1391 char[3] tag; /**< Always the string "TAG", the classic intro. */ 1392 char[30] title; /**< Title string. */ 1393 char[30] artist; /**< Artist string. */ 1394 char[30] album; /**< Album string. */ 1395 char[4] year; /**< Year string. */ 1396 char[30] comment; /**< Comment string. */ 1397 ubyte genre; /**< Genre index. */ 1398 } 1399 1400 enum MPG123_ID3 = 0x3; /**< 0011 There is some ID3 info. Also matches 0010 or NEW_ID3. */ 1401 enum MPG123_NEW_ID3 = 0x1; /**< 0001 There is ID3 info that changed since last call to mpg123_id3. */ 1402 enum MPG123_ICY = 0xc; /**< 1100 There is some ICY info. Also matches 0100 or NEW_ICY.*/ 1403 enum MPG123_NEW_ICY = 0x4; /**< 0100 There is ICY info that changed since last call to mpg123_icy. */ 1404 1405 /** Query if there is (new) meta info, be it ID3 or ICY (or something new in future). 1406 * \param mh handle 1407 * \return combination of flags, 0 on error (same as "nothing new") 1408 */ 1409 //int mpg123_meta_check(mpg123_handle *mh); 1410 alias da_mpg123_meta_check = int function(mpg123_handle *mh); 1411 1412 /** Clean up meta data storage (ID3v2 and ICY), freeing memory. 1413 * \param mh handle 1414 */ 1415 //void mpg123_meta_free(mpg123_handle *mh); 1416 alias da_mpg123_meta_free = void function(mpg123_handle *mh); 1417 1418 /** Point v1 and v2 to existing data structures wich may change on any next read/decode function call. 1419 * v1 and/or v2 can be set to NULL when there is no corresponding data. 1420 * \return MPG123_OK on success 1421 */ 1422 //int mpg123_id3( mpg123_handle *mh 1423 // , mpg123_id3v1 **v1, mpg123_id3v2 **v2 ); 1424 alias da_mpg123_id3 = int function( mpg123_handle *mh 1425 , mpg123_id3v1 **v1, mpg123_id3v2 **v2 ); 1426 1427 /** Point icy_meta to existing data structure wich may change on any next read/decode function call. 1428 * \param mh handle 1429 * \param icy_meta return address for ICY meta string (set to NULL if nothing there) 1430 * \return MPG123_OK on success 1431 */ 1432 //int mpg123_icy(mpg123_handle *mh, char **icy_meta); 1433 alias da_mpg123_icy = int function(mpg123_handle *mh, char **icy_meta); 1434 1435 /** Decode from windows-1252 (the encoding ICY metainfo used) to UTF-8. 1436 * Note that this is very similar to mpg123_store_utf8(&sb, mpg123_text_icy, icy_text, strlen(icy_text+1)) . 1437 * \param icy_text The input data in ICY encoding 1438 * \return pointer to newly allocated buffer with UTF-8 data (You free() it!) */ 1439 //char* mpg123_icy2utf8(const char* icy_text); 1440 alias da_mpg123_icy2utf8 = char* function(const char* icy_text); 1441 1442 1443 /* @} */ 1444 1445 1446 /** \defgroup mpg123_advpar mpg123 advanced parameter API 1447 * 1448 * Direct access to a parameter set without full handle around it. 1449 * Possible uses: 1450 * - Influence behaviour of library _during_ initialization of handle (MPG123_VERBOSE). 1451 * - Use one set of parameters for multiple handles. 1452 * 1453 * The functions for handling mpg123_pars (mpg123_par() and mpg123_fmt() 1454 * family) directly return a fully qualified mpg123 error code, the ones 1455 * operating on full handles normally MPG123_OK or MPG123_ERR, storing the 1456 * specific error code itseld inside the handle. 1457 * 1458 * @{ 1459 */ 1460 1461 /** Opaque structure for the libmpg123 decoder parameters. */ 1462 struct mpg123_pars; 1463 //struct mpg123_pars_struct; 1464 1465 /** Opaque structure for the libmpg123 decoder parameters. */ 1466 //typedef struct mpg123_pars_struct mpg123_pars; 1467 1468 /** Create a handle with preset parameters. 1469 * \param mp parameter handle 1470 * \param decoder decoder choice 1471 * \param error error code return address 1472 * \return mpg123 handle 1473 */ 1474 //mpg123_handle *mpg123_parnew( mpg123_pars *mp 1475 // , const char* decoder, int *error ); 1476 alias da_mpg123_parnew = mpg123_handle *function( mpg123_pars *mp 1477 , const char* decoder, int *error ); 1478 1479 /** Allocate memory for and return a pointer to a new mpg123_pars 1480 * \param error error code return address 1481 * \return new parameter handle 1482 */ 1483 //mpg123_pars *mpg123_new_pars(int *error); 1484 alias da_mpg123_new_pars = mpg123_pars *function(int *error); 1485 1486 /** Delete and free up memory used by a mpg123_pars data structure 1487 * \param mp parameter handle 1488 */ 1489 //void mpg123_delete_pars(mpg123_pars* mp); 1490 alias da_mpg123_delete_pars = void function(mpg123_pars* mp); 1491 1492 /** Configure mpg123 parameters to accept no output format at all, 1493 * use before specifying supported formats with mpg123_format 1494 * \param mp parameter handle 1495 * \return MPG123_OK on success 1496 */ 1497 //int mpg123_fmt_none(mpg123_pars *mp); 1498 alias da_mpg123_fmt_none = int function(mpg123_pars *mp); 1499 1500 /** Configure mpg123 parameters to accept all formats 1501 * (also any custom rate you may set) -- this is default. 1502 * \param mp parameter handle 1503 * \return MPG123_OK on success 1504 */ 1505 //int mpg123_fmt_all(mpg123_pars *mp); 1506 alias da_mpg123_fmt_all = int function(mpg123_pars *mp); 1507 1508 /** Set the audio format support of a mpg123_pars in detail: 1509 * \param mp parameter handle 1510 * \param rate The sample rate value (in Hertz). 1511 * \param channels A combination of MPG123_STEREO and MPG123_MONO. 1512 * \param encodings A combination of accepted encodings for rate and channels, 1513 * p.ex MPG123_ENC_SIGNED16|MPG123_ENC_ULAW_8 (or 0 for no 1514 * support). 1515 * \return MPG123_OK on success 1516 */ 1517 //int mpg123_fmt(mpg123_pars *mp 1518 // , long rate, int channels, int encodings); 1519 alias da_mpg123_fmt = int function(mpg123_pars *mp 1520 , long rate, int channels, int encodings); 1521 1522 /** Check to see if a specific format at a specific rate is supported 1523 * by mpg123_pars. 1524 * \param mp parameter handle 1525 * \param rate sampling rate 1526 * \param encoding encoding 1527 * \return 0 for no support (that includes invalid parameters), MPG123_STEREO, 1528 * MPG123_MONO or MPG123_STEREO|MPG123_MONO. */ 1529 //int mpg123_fmt_support(mpg123_pars *mp, long rate, int encoding); 1530 alias da_mpg123_fmt_support = int function(mpg123_pars *mp, long rate, int encoding); 1531 1532 /** Set a specific parameter, for a specific mpg123_pars, using a parameter 1533 * type key chosen from the mpg123_parms enumeration, to the specified value. 1534 * \param mp parameter handle 1535 * \param type parameter choice 1536 * \param value integer value 1537 * \param fvalue floating point value 1538 * \return MPG123_OK on success 1539 */ 1540 //int mpg123_par( mpg123_pars *mp 1541 // , mpg123_parms type, long value, double fvalue ); 1542 alias da_mpg123_par = int function( mpg123_pars *mp 1543 , mpg123_parms type, long value, double fvalue ); 1544 1545 /** Get a specific parameter, for a specific mpg123_pars. 1546 * See the mpg123_parms enumeration for a list of available parameters. 1547 * \param mp parameter handle 1548 * \param type parameter choice 1549 * \param value integer value return address 1550 * \param fvalue floating point value return address 1551 * \return MPG123_OK on success 1552 */ 1553 //int mpg123_getpar( mpg123_pars *mp 1554 // , mpg123_parms type, long *value, double *fvalue); 1555 alias da_mpg123_getpar = int function( mpg123_pars *mp 1556 , mpg123_parms type, long *value, double *fvalue); 1557 1558 /* @} */ 1559 1560 1561 /** \defgroup mpg123_lowio mpg123 low level I/O 1562 * You may want to do tricky stuff with I/O that does not work with mpg123's default file access or you want to make it decode into your own pocket... 1563 * 1564 * @{ */ 1565 1566 /** Replace default internal buffer with user-supplied buffer. 1567 * Instead of working on it's own private buffer, mpg123 will directly use the one you provide for storing decoded audio. 1568 * Note that the required buffer size could be bigger than expected from output 1569 * encoding if libmpg123 has to convert from primary decoder output (p.ex. 32 bit 1570 * storage for 24 bit output). 1571 * \param mh handle 1572 * \param data pointer to user buffer 1573 * \param size of buffer in bytes 1574 * \return MPG123_OK on success 1575 */ 1576 //int mpg123_replace_buffer(mpg123_handle *mh 1577 // , ubyte*data, size_t size); 1578 alias da_mpg123_replace_buffer = int function(mpg123_handle *mh 1579 , ubyte*data, size_t size); 1580 1581 /** The max size of one frame's decoded output with current settings. 1582 * Use that to determine an appropriate minimum buffer size for decoding one frame. 1583 * \param mh handle 1584 * \return maximum decoded data size in bytes 1585 */ 1586 //size_t mpg123_outblock(mpg123_handle *mh); 1587 alias da_mpg123_outblock = size_t function(mpg123_handle *mh); 1588 1589 /** Replace low-level stream access functions; read and lseek as known in POSIX. 1590 * You can use this to make any fancy file opening/closing yourself, 1591 * using mpg123_open_fd() to set the file descriptor for your read/lseek 1592 * (doesn't need to be a "real" file descriptor...). 1593 * Setting a function to NULL means that the default internal read is 1594 * used (active from next mpg123_open call on). 1595 * Note: As it would be troublesome to mess with this while having a file open, 1596 * this implies mpg123_close(). 1597 * \param mh handle 1598 * \param r_read callback for reading (behaviour like POSIX read) 1599 * \param r_lseek callback for seeking (like POSIX lseek) 1600 * \return MPG123_OK on success 1601 */ 1602 //int mpg123_replace_reader( mpg123_handle *mh 1603 // , ssize_t function (int, void *, size_t) r_read 1604 // , off_t function (int, off_t, int) r_lseek 1605 // ); 1606 alias da_mpg123_replace_reader = int function( mpg123_handle *mh 1607 , ssize_t function (int, void *, size_t) r_read 1608 , off_t function (int, off_t, int) r_lseek 1609 ); 1610 1611 /** Replace I/O functions with your own ones operating on some kind of 1612 * handle instead of integer descriptors. 1613 * The handle is a void pointer, so you can pass any data you want... 1614 * mpg123_open_handle() is the call you make to use the I/O defined here. 1615 * There is no fallback to internal read/seek here. 1616 * Note: As it would be troublesome to mess with this while having a file open, 1617 * this mpg123_close() is implied here. 1618 * \param mh handle 1619 * \param r_read callback for reading (behaviour like POSIX read) 1620 * \param r_lseek callback for seeking (like POSIX lseek) 1621 * \param cleanup A callback to clean up an I/O handle on mpg123_close, 1622 * can be NULL for none (you take care of cleaning your handles). 1623 * \return MPG123_OK on success 1624 */ 1625 //int mpg123_replace_reader_handle( mpg123_handle *mh 1626 // , ssize_t function(void *, void *, size_t) r_read 1627 // , off_t function (void *, off_t, int) r_lseek 1628 // , void function(void*)cleanup); 1629 alias da_mpg123_replace_reader_handle = int function( mpg123_handle *mh 1630 , ssize_t function(void *, void *, size_t) r_read 1631 , off_t function (void *, off_t, int) r_lseek 1632 , void function(void*)cleanup); 1633 1634 /* @} */ 1635 } 1636 1637 __gshared { 1638 da_mpg123_init mpg123_init; 1639 da_mpg123_exit mpg123_exit; 1640 da_mpg123_new mpg123_new; 1641 da_mpg123_delete mpg123_delete; 1642 da_mpg123_param mpg123_param; 1643 da_mpg123_getparam mpg123_getparam; 1644 da_mpg123_feature mpg123_feature; 1645 da_mpg123_plain_strerror mpg123_plain_strerror; 1646 da_mpg123_strerror mpg123_strerror; 1647 da_mpg123_errcode mpg123_errcode; 1648 da_mpg123_decoders mpg123_decoders; 1649 da_mpg123_supported_decoders mpg123_supported_decoders; 1650 da_mpg123_decoder mpg123_decoder; 1651 da_mpg123_current_decoder mpg123_current_decoder; 1652 da_mpg123_rates mpg123_rates; 1653 da_mpg123_encodings mpg123_encodings; 1654 da_mpg123_encsize mpg123_encsize; 1655 da_mpg123_format_none mpg123_format_none; 1656 da_mpg123_format_all mpg123_format_all; 1657 da_mpg123_format mpg123_format; 1658 da_mpg123_format_support mpg123_format_support; 1659 da_mpg123_getformat mpg123_getformat; 1660 da_mpg123_open mpg123_open; 1661 da_mpg123_open_fd mpg123_open_fd; 1662 da_mpg123_open_handle mpg123_open_handle; 1663 da_mpg123_open_feed mpg123_open_feed; 1664 da_mpg123_close mpg123_close; 1665 da_mpg123_read mpg123_read; 1666 da_mpg123_feed mpg123_feed; 1667 da_mpg123_decode mpg123_decode; 1668 da_mpg123_decode_frame mpg123_decode_frame; 1669 da_mpg123_framebyframe_decode mpg123_framebyframe_decode; 1670 da_mpg123_framebyframe_next mpg123_framebyframe_next; 1671 da_mpg123_framedata mpg123_framedata; 1672 da_mpg123_framepos mpg123_framepos; 1673 da_mpg123_tell mpg123_tell; 1674 da_mpg123_tellframe mpg123_tellframe; 1675 da_mpg123_tell_stream mpg123_tell_stream; 1676 da_mpg123_seek mpg123_seek; 1677 da_mpg123_feedseek mpg123_feedseek; 1678 da_mpg123_seek_frame mpg123_seek_frame; 1679 da_mpg123_timeframe mpg123_timeframe; 1680 da_mpg123_index mpg123_index; 1681 da_mpg123_set_index mpg123_set_index; 1682 da_mpg123_position mpg123_position; 1683 da_mpg123_eq mpg123_eq; 1684 da_mpg123_geteq mpg123_geteq; 1685 da_mpg123_reset_eq mpg123_reset_eq; 1686 da_mpg123_volume mpg123_volume; 1687 da_mpg123_volume_change mpg123_volume_change; 1688 da_mpg123_info mpg123_info; 1689 da_mpg123_safe_buffer mpg123_safe_buffer; 1690 da_mpg123_scan mpg123_scan; 1691 da_mpg123_framelength mpg123_framelength; 1692 da_mpg123_length mpg123_length; 1693 da_mpg123_set_filesize mpg123_set_filesize; 1694 da_mpg123_tpf mpg123_tpf; 1695 da_mpg123_spf mpg123_spf; 1696 da_mpg123_clip mpg123_clip; 1697 da_mpg123_getstate mpg123_getstate; 1698 da_mpg123_init_string mpg123_init_string; 1699 da_mpg123_free_string mpg123_free_string; 1700 da_mpg123_resize_string mpg123_resize_string; 1701 da_mpg123_grow_string mpg123_grow_string; 1702 da_mpg123_copy_string mpg123_copy_string; 1703 da_mpg123_add_string mpg123_add_string; 1704 da_mpg123_add_substring mpg123_add_substring; 1705 da_mpg123_set_string mpg123_set_string; 1706 da_mpg123_set_substring mpg123_set_substring; 1707 da_mpg123_strlen mpg123_strlen; 1708 da_mpg123_chomp_string mpg123_chomp_string; 1709 da_mpg123_enc_from_id3 mpg123_enc_from_id3; 1710 da_mpg123_store_utf8 mpg123_store_utf8; 1711 da_mpg123_meta_check mpg123_meta_check; 1712 da_mpg123_meta_free mpg123_meta_free; 1713 da_mpg123_id3 mpg123_id3; 1714 da_mpg123_icy mpg123_icy; 1715 da_mpg123_icy2utf8 mpg123_icy2utf8; 1716 da_mpg123_parnew mpg123_parnew; 1717 da_mpg123_new_pars mpg123_new_pars; 1718 da_mpg123_delete_pars mpg123_delete_pars; 1719 da_mpg123_fmt_none mpg123_fmt_none; 1720 da_mpg123_fmt_all mpg123_fmt_all; 1721 da_mpg123_fmt mpg123_fmt; 1722 da_mpg123_fmt_support mpg123_fmt_support; 1723 da_mpg123_par mpg123_par; 1724 da_mpg123_getpar mpg123_getpar; 1725 da_mpg123_replace_buffer mpg123_replace_buffer; 1726 da_mpg123_outblock mpg123_outblock; 1727 da_mpg123_replace_reader mpg123_replace_reader; 1728 da_mpg123_replace_reader_handle mpg123_replace_reader_handle; 1729 } 1730 1731 1732 class DerelictMPG123Loader : SharedLibLoader { 1733 public this() { 1734 super(libNames); 1735 } 1736 1737 protected override void loadSymbols() 1738 { 1739 bindFunc(cast(void**)&mpg123_init, "mpg123_init"); 1740 bindFunc(cast(void**)&mpg123_exit, "mpg123_exit"); 1741 bindFunc(cast(void**)&mpg123_new, "mpg123_new"); 1742 bindFunc(cast(void**)&mpg123_delete, "mpg123_delete"); 1743 bindFunc(cast(void**)&mpg123_param, "mpg123_param"); 1744 bindFunc(cast(void**)&mpg123_getparam, "mpg123_getparam"); 1745 bindFunc(cast(void**)&mpg123_feature, "mpg123_feature"); 1746 bindFunc(cast(void**)&mpg123_plain_strerror, "mpg123_plain_strerror"); 1747 bindFunc(cast(void**)&mpg123_strerror, "mpg123_strerror"); 1748 bindFunc(cast(void**)&mpg123_errcode, "mpg123_errcode"); 1749 bindFunc(cast(void**)&mpg123_decoders, "mpg123_decoders"); 1750 bindFunc(cast(void**)&mpg123_supported_decoders, "mpg123_supported_decoders"); 1751 bindFunc(cast(void**)&mpg123_decoder, "mpg123_decoder"); 1752 bindFunc(cast(void**)&mpg123_current_decoder, "mpg123_current_decoder"); 1753 bindFunc(cast(void**)&mpg123_rates, "mpg123_rates"); 1754 bindFunc(cast(void**)&mpg123_encodings, "mpg123_encodings"); 1755 bindFunc(cast(void**)&mpg123_encsize, "mpg123_encsize"); 1756 bindFunc(cast(void**)&mpg123_format_none, "mpg123_format_none"); 1757 bindFunc(cast(void**)&mpg123_format_all, "mpg123_format_all"); 1758 bindFunc(cast(void**)&mpg123_format, "mpg123_format"); 1759 bindFunc(cast(void**)&mpg123_format_support, "mpg123_format_support"); 1760 bindFunc(cast(void**)&mpg123_getformat, "mpg123_getformat"); 1761 bindFunc(cast(void**)&mpg123_open, "mpg123_open"); 1762 bindFunc(cast(void**)&mpg123_open_fd, "mpg123_open_fd"); 1763 bindFunc(cast(void**)&mpg123_open_handle, "mpg123_open_handle"); 1764 bindFunc(cast(void**)&mpg123_open_feed, "mpg123_open_feed"); 1765 bindFunc(cast(void**)&mpg123_close, "mpg123_close"); 1766 bindFunc(cast(void**)&mpg123_read, "mpg123_read"); 1767 bindFunc(cast(void**)&mpg123_feed, "mpg123_feed"); 1768 bindFunc(cast(void**)&mpg123_decode, "mpg123_decode"); 1769 bindFunc(cast(void**)&mpg123_decode_frame, "mpg123_decode_frame"); 1770 bindFunc(cast(void**)&mpg123_framebyframe_decode, "mpg123_framebyframe_decode"); 1771 bindFunc(cast(void**)&mpg123_framebyframe_next, "mpg123_framebyframe_next"); 1772 bindFunc(cast(void**)&mpg123_framedata, "mpg123_framedata"); 1773 bindFunc(cast(void**)&mpg123_framepos, "mpg123_framepos"); 1774 bindFunc(cast(void**)&mpg123_tell, "mpg123_tell"); 1775 bindFunc(cast(void**)&mpg123_tellframe, "mpg123_tellframe"); 1776 bindFunc(cast(void**)&mpg123_tell_stream, "mpg123_tell_stream"); 1777 bindFunc(cast(void**)&mpg123_seek, "mpg123_seek"); 1778 bindFunc(cast(void**)&mpg123_feedseek, "mpg123_feedseek"); 1779 bindFunc(cast(void**)&mpg123_seek_frame, "mpg123_seek_frame"); 1780 bindFunc(cast(void**)&mpg123_timeframe, "mpg123_timeframe"); 1781 bindFunc(cast(void**)&mpg123_index, "mpg123_index"); 1782 bindFunc(cast(void**)&mpg123_set_index, "mpg123_set_index"); 1783 bindFunc(cast(void**)&mpg123_position, "mpg123_position"); 1784 bindFunc(cast(void**)&mpg123_eq, "mpg123_eq"); 1785 bindFunc(cast(void**)&mpg123_geteq, "mpg123_geteq"); 1786 bindFunc(cast(void**)&mpg123_reset_eq, "mpg123_reset_eq"); 1787 bindFunc(cast(void**)&mpg123_volume, "mpg123_volume"); 1788 bindFunc(cast(void**)&mpg123_volume_change, "mpg123_volume_change"); 1789 bindFunc(cast(void**)&mpg123_info, "mpg123_info"); 1790 bindFunc(cast(void**)&mpg123_safe_buffer, "mpg123_safe_buffer"); 1791 bindFunc(cast(void**)&mpg123_scan, "mpg123_scan"); 1792 bindFunc(cast(void**)&mpg123_framelength, "mpg123_framelength"); 1793 bindFunc(cast(void**)&mpg123_length, "mpg123_length"); 1794 bindFunc(cast(void**)&mpg123_set_filesize, "mpg123_set_filesize"); 1795 bindFunc(cast(void**)&mpg123_tpf, "mpg123_tpf"); 1796 bindFunc(cast(void**)&mpg123_spf, "mpg123_spf"); 1797 bindFunc(cast(void**)&mpg123_clip, "mpg123_clip"); 1798 bindFunc(cast(void**)&mpg123_getstate, "mpg123_getstate"); 1799 bindFunc(cast(void**)&mpg123_init_string, "mpg123_init_string"); 1800 bindFunc(cast(void**)&mpg123_free_string, "mpg123_free_string"); 1801 bindFunc(cast(void**)&mpg123_resize_string, "mpg123_resize_string"); 1802 bindFunc(cast(void**)&mpg123_grow_string, "mpg123_grow_string"); 1803 bindFunc(cast(void**)&mpg123_copy_string, "mpg123_copy_string"); 1804 bindFunc(cast(void**)&mpg123_add_string, "mpg123_add_string"); 1805 bindFunc(cast(void**)&mpg123_add_substring, "mpg123_add_substring"); 1806 bindFunc(cast(void**)&mpg123_set_string, "mpg123_set_string"); 1807 bindFunc(cast(void**)&mpg123_set_substring, "mpg123_set_substring"); 1808 bindFunc(cast(void**)&mpg123_strlen, "mpg123_strlen"); 1809 bindFunc(cast(void**)&mpg123_chomp_string, "mpg123_chomp_string"); 1810 bindFunc(cast(void**)&mpg123_enc_from_id3, "mpg123_enc_from_id3"); 1811 bindFunc(cast(void**)&mpg123_store_utf8, "mpg123_store_utf8"); 1812 bindFunc(cast(void**)&mpg123_meta_check, "mpg123_meta_check"); 1813 bindFunc(cast(void**)&mpg123_meta_free, "mpg123_meta_free"); 1814 bindFunc(cast(void**)&mpg123_id3, "mpg123_id3"); 1815 bindFunc(cast(void**)&mpg123_icy, "mpg123_icy"); 1816 bindFunc(cast(void**)&mpg123_icy2utf8, "mpg123_icy2utf8"); 1817 bindFunc(cast(void**)&mpg123_parnew, "mpg123_parnew"); 1818 bindFunc(cast(void**)&mpg123_new_pars, "mpg123_new_pars"); 1819 bindFunc(cast(void**)&mpg123_delete_pars, "mpg123_delete_pars"); 1820 bindFunc(cast(void**)&mpg123_fmt_none, "mpg123_fmt_none"); 1821 bindFunc(cast(void**)&mpg123_fmt_all, "mpg123_fmt_all"); 1822 bindFunc(cast(void**)&mpg123_fmt, "mpg123_fmt"); 1823 bindFunc(cast(void**)&mpg123_fmt_support, "mpg123_fmt_support"); 1824 bindFunc(cast(void**)&mpg123_par, "mpg123_par"); 1825 bindFunc(cast(void**)&mpg123_getpar, "mpg123_getpar"); 1826 bindFunc(cast(void**)&mpg123_replace_buffer, "mpg123_replace_buffer"); 1827 bindFunc(cast(void**)&mpg123_outblock, "mpg123_outblock"); 1828 bindFunc(cast(void**)&mpg123_replace_reader, "mpg123_replace_reader"); 1829 bindFunc(cast(void**)&mpg123_replace_reader_handle, "mpg123_replace_reader_handle"); 1830 } 1831 } 1832 1833 1834 __gshared DerelictMPG123Loader DerelictMPG123; 1835 1836 shared static this() { 1837 DerelictMPG123 = new DerelictMPG123Loader(); 1838 }