Mercurial > SDL_sound_CoreAudio
diff decoders/libmpg123/mpg123lib_intern.h @ 562:7e08477b0fc1
MP3 decoder upgrade work.
Ripped out SMPEG and mpglib support, replaced it with "mpg123.c" and libmpg123.
libmpg123 is a much better version of mpglib, so it should solve all the
problems about MP3's not seeking, or most modern MP3's not playing at all,
etc. Since you no longer have to make a tradeoff with SMPEG for features, and
SMPEG is basically rotting, I removed it from the project.
There is still work to be done with libmpg123...there are MMX, 3DNow, SSE,
Altivec, etc decoders which we don't have enabled at the moment, and the
build system could use some work to make this compile more cleanly, etc.
Still: huge win.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Fri, 30 Jan 2009 02:44:47 -0500 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/decoders/libmpg123/mpg123lib_intern.h Fri Jan 30 02:44:47 2009 -0500 @@ -0,0 +1,146 @@ +/* + mpg123lib_intern: Common non-public stuff for libmpg123 + + copyright 1995-2008 by the mpg123 project - free software under the terms of the LGPL 2.1 + see COPYING and AUTHORS files in distribution or http://mpg123.org + + derived from the old mpg123.h +*/ + +#ifndef MPG123_H_INTERN +#define MPG123_H_INTERN + +#define MPG123_RATES 9 +#define MPG123_ENCODINGS 10 + +/* ABI conformance for other compilers. + mpg123 needs 16byte-aligned stack for SSE and friends. + gcc provides that, but others don't necessarily. */ +#ifndef attribute_align_arg +#if defined(__GNUC__) && (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__>1) +# define attribute_align_arg __attribute__((force_align_arg_pointer)) +/* The gcc that can align the stack does not need the check... nor does it work with gcc 4.3+, anyway. */ +#else +# define attribute_align_arg +# define NEED_ALIGNCHECK /* Other compilers get code to catch misaligned stack. */ +#endif +#endif + +/* export DLL symbols */ +#if defined(WIN32) && defined(DYNAMIC_BUILD) +#define BUILD_MPG123_DLL +#endif +#include "config.h" /* Load this before mpg123.h, for example for largefile stuff. */ +#include "compat.h" +#include "mpg123.h" + +#define SKIP_JUNK 1 + +#ifndef M_PI +# define M_PI 3.14159265358979323846 +#endif +#ifndef M_SQRT2 +# define M_SQRT2 1.41421356237309504880 +#endif + +#ifdef SUNOS +#define memmove(dst,src,size) bcopy(src,dst,size) +#endif + +/* some stuff has to go back to mpg123.h */ +#ifdef REAL_IS_FLOAT +# define real float +# define REAL_SCANF "%f" +# define REAL_PRINTF "%f" +#elif defined(REAL_IS_LONG_DOUBLE) +# define real long double +# define REAL_SCANF "%Lf" +# define REAL_PRINTF "%Lf" +#elif defined(REAL_IS_FIXED) +# define real long + +# define REAL_RADIX 15 +# define REAL_FACTOR (32.0 * 1024.0) + +# define REAL_PLUS_32767 ( 32767 << REAL_RADIX ) +# define REAL_MINUS_32768 ( -32768 << REAL_RADIX ) + +/* I just changed the (int) to (long) there... seemed right. */ +# define DOUBLE_TO_REAL(x) ((long)((x) * REAL_FACTOR)) +# define REAL_TO_DOUBLE(x) ((double)(x) / REAL_FACTOR) +# define REAL_TO_SHORT(x) ((x) >> REAL_RADIX) +# define REAL_MUL(x, y) (((long long)(x) * (long long)(y)) >> REAL_RADIX) +# define REAL_SCANF "%ld" +# define REAL_PRINTF "%ld" + +#else +# define real double +# define REAL_SCANF "%lf" +# define REAL_PRINTF "%f" +#endif + +#ifndef DOUBLE_TO_REAL +# define DOUBLE_TO_REAL(x) (x) +#endif +#ifndef REAL_TO_DOUBLE +# define REAL_TO_DOUBLE(x) (x) +#endif +#ifndef REAL_TO_SHORT +# define REAL_TO_SHORT(x) (x) +#endif +#ifndef REAL_PLUS_32767 +# define REAL_PLUS_32767 32767.0 +#endif +#ifndef REAL_MINUS_32768 +# define REAL_MINUS_32768 -32768.0 +#endif +#ifndef REAL_MUL +# define REAL_MUL(x, y) ((x) * (y)) +#endif + +/* used to be: AUDIOBUFSIZE = n*64 with n=1,2,3 ... + now: factor on minimum frame buffer size (which takes upsampling into account) */ +#define AUDIOBUFSIZE 2 + +#include "true.h" + +#define MAX_NAME_SIZE 81 +#define SBLIMIT 32 +#define SCALE_BLOCK 12 +#define SSLIMIT 18 + +/* Same as MPG_M_* */ +#define MPG_MD_STEREO 0 +#define MPG_MD_JOINT_STEREO 1 +#define MPG_MD_DUAL_CHANNEL 2 +#define MPG_MD_MONO 3 + +/* float output only for generic decoder! */ +#ifdef FLOATOUT +#define MAXOUTBURST 1.0 +#define scale_t double +#else +/* I suspect that 32767 would be a better idea here, but Michael put this in... */ +#define MAXOUTBURST 32768 +#define scale_t long +#endif + +/* Pre Shift fo 16 to 8 bit converter table */ +#define AUSHIFT (3) + +#include "decode.h" +#include "parse.h" +#include "optimize.h" +#include "frame.h" + +/* fr is a mpg123_handle* by convention here... */ +#define NOQUIET (!(fr->p.flags & MPG123_QUIET)) +#define VERBOSE (NOQUIET && fr->p.verbose) +#define VERBOSE2 (NOQUIET && fr->p.verbose > 1) +#define VERBOSE3 (NOQUIET && fr->p.verbose > 2) +#define VERBOSE4 (NOQUIET && fr->p.verbose > 3) +#define PVERB(mp, level) (!((mp)->flags & MPG123_QUIET) && (mp)->verbose >= (level)) + +int decode_update(mpg123_handle *mh); + +#endif