comparison 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
comparison
equal deleted inserted replaced
561:f2985e08589c 562:7e08477b0fc1
1 /*
2 mpg123lib_intern: Common non-public stuff for libmpg123
3
4 copyright 1995-2008 by the mpg123 project - free software under the terms of the LGPL 2.1
5 see COPYING and AUTHORS files in distribution or http://mpg123.org
6
7 derived from the old mpg123.h
8 */
9
10 #ifndef MPG123_H_INTERN
11 #define MPG123_H_INTERN
12
13 #define MPG123_RATES 9
14 #define MPG123_ENCODINGS 10
15
16 /* ABI conformance for other compilers.
17 mpg123 needs 16byte-aligned stack for SSE and friends.
18 gcc provides that, but others don't necessarily. */
19 #ifndef attribute_align_arg
20 #if defined(__GNUC__) && (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__>1)
21 # define attribute_align_arg __attribute__((force_align_arg_pointer))
22 /* The gcc that can align the stack does not need the check... nor does it work with gcc 4.3+, anyway. */
23 #else
24 # define attribute_align_arg
25 # define NEED_ALIGNCHECK /* Other compilers get code to catch misaligned stack. */
26 #endif
27 #endif
28
29 /* export DLL symbols */
30 #if defined(WIN32) && defined(DYNAMIC_BUILD)
31 #define BUILD_MPG123_DLL
32 #endif
33 #include "config.h" /* Load this before mpg123.h, for example for largefile stuff. */
34 #include "compat.h"
35 #include "mpg123.h"
36
37 #define SKIP_JUNK 1
38
39 #ifndef M_PI
40 # define M_PI 3.14159265358979323846
41 #endif
42 #ifndef M_SQRT2
43 # define M_SQRT2 1.41421356237309504880
44 #endif
45
46 #ifdef SUNOS
47 #define memmove(dst,src,size) bcopy(src,dst,size)
48 #endif
49
50 /* some stuff has to go back to mpg123.h */
51 #ifdef REAL_IS_FLOAT
52 # define real float
53 # define REAL_SCANF "%f"
54 # define REAL_PRINTF "%f"
55 #elif defined(REAL_IS_LONG_DOUBLE)
56 # define real long double
57 # define REAL_SCANF "%Lf"
58 # define REAL_PRINTF "%Lf"
59 #elif defined(REAL_IS_FIXED)
60 # define real long
61
62 # define REAL_RADIX 15
63 # define REAL_FACTOR (32.0 * 1024.0)
64
65 # define REAL_PLUS_32767 ( 32767 << REAL_RADIX )
66 # define REAL_MINUS_32768 ( -32768 << REAL_RADIX )
67
68 /* I just changed the (int) to (long) there... seemed right. */
69 # define DOUBLE_TO_REAL(x) ((long)((x) * REAL_FACTOR))
70 # define REAL_TO_DOUBLE(x) ((double)(x) / REAL_FACTOR)
71 # define REAL_TO_SHORT(x) ((x) >> REAL_RADIX)
72 # define REAL_MUL(x, y) (((long long)(x) * (long long)(y)) >> REAL_RADIX)
73 # define REAL_SCANF "%ld"
74 # define REAL_PRINTF "%ld"
75
76 #else
77 # define real double
78 # define REAL_SCANF "%lf"
79 # define REAL_PRINTF "%f"
80 #endif
81
82 #ifndef DOUBLE_TO_REAL
83 # define DOUBLE_TO_REAL(x) (x)
84 #endif
85 #ifndef REAL_TO_DOUBLE
86 # define REAL_TO_DOUBLE(x) (x)
87 #endif
88 #ifndef REAL_TO_SHORT
89 # define REAL_TO_SHORT(x) (x)
90 #endif
91 #ifndef REAL_PLUS_32767
92 # define REAL_PLUS_32767 32767.0
93 #endif
94 #ifndef REAL_MINUS_32768
95 # define REAL_MINUS_32768 -32768.0
96 #endif
97 #ifndef REAL_MUL
98 # define REAL_MUL(x, y) ((x) * (y))
99 #endif
100
101 /* used to be: AUDIOBUFSIZE = n*64 with n=1,2,3 ...
102 now: factor on minimum frame buffer size (which takes upsampling into account) */
103 #define AUDIOBUFSIZE 2
104
105 #include "true.h"
106
107 #define MAX_NAME_SIZE 81
108 #define SBLIMIT 32
109 #define SCALE_BLOCK 12
110 #define SSLIMIT 18
111
112 /* Same as MPG_M_* */
113 #define MPG_MD_STEREO 0
114 #define MPG_MD_JOINT_STEREO 1
115 #define MPG_MD_DUAL_CHANNEL 2
116 #define MPG_MD_MONO 3
117
118 /* float output only for generic decoder! */
119 #ifdef FLOATOUT
120 #define MAXOUTBURST 1.0
121 #define scale_t double
122 #else
123 /* I suspect that 32767 would be a better idea here, but Michael put this in... */
124 #define MAXOUTBURST 32768
125 #define scale_t long
126 #endif
127
128 /* Pre Shift fo 16 to 8 bit converter table */
129 #define AUSHIFT (3)
130
131 #include "decode.h"
132 #include "parse.h"
133 #include "optimize.h"
134 #include "frame.h"
135
136 /* fr is a mpg123_handle* by convention here... */
137 #define NOQUIET (!(fr->p.flags & MPG123_QUIET))
138 #define VERBOSE (NOQUIET && fr->p.verbose)
139 #define VERBOSE2 (NOQUIET && fr->p.verbose > 1)
140 #define VERBOSE3 (NOQUIET && fr->p.verbose > 2)
141 #define VERBOSE4 (NOQUIET && fr->p.verbose > 3)
142 #define PVERB(mp, level) (!((mp)->flags & MPG123_QUIET) && (mp)->verbose >= (level))
143
144 int decode_update(mpg123_handle *mh);
145
146 #endif