Mercurial > audlegacy
annotate Plugins/Input/mpg123/mpg123.h @ 127:05d824e30afd trunk
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
author | nenolod |
---|---|
date | Wed, 09 Nov 2005 16:40:03 -0800 |
parents | fa848bd484d8 |
children | a008c0b15ac8 |
rev | line source |
---|---|
61 | 1 /* |
2 * mpg123 defines | |
3 * used source: musicout.h from mpegaudio package | |
4 */ | |
5 | |
6 #ifndef __MPG123_H__ | |
7 #define __MPG123_H__ | |
8 | |
9 #ifdef HAVE_CONFIG_H | |
10 # include "config.h" | |
11 #endif | |
12 | |
13 #include <glib.h> | |
14 | |
15 | |
16 enum { | |
17 SYNTH_AUTO, | |
18 SYNTH_FPU, | |
19 SYNTH_3DNOW, | |
20 SYNTH_MMX, | |
21 }; | |
22 | |
23 enum { | |
24 DETECT_EXTENSION, | |
25 DETECT_CONTENT, | |
26 DETECT_BOTH | |
27 }; | |
28 | |
29 #include <gtk/gtk.h> | |
30 | |
31 #include "audacious/plugin.h" | |
32 #include "dxhead.h" | |
33 #include "xmms-id3.h" | |
34 | |
35 #define real float | |
36 | |
37 #define SBLIMIT 32 | |
38 #define SCALE_BLOCK 12 | |
39 #define SSLIMIT 18 | |
40 | |
41 #define MPG_MD_STEREO 0 | |
42 #define MPG_MD_JOINT_STEREO 1 | |
43 #define MPG_MD_DUAL_CHANNEL 2 | |
44 #define MPG_MD_MONO 3 | |
45 | |
46 #define ENCODING_SEPARATOR " ,:;|/" | |
47 | |
127
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
48 #define MAXFRAMESIZE 4096 |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
49 |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
50 #define DOUBLE_TO_REAL(x) (x) |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
51 #define REAL_MUL(x, y) (x * y) |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
52 |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
53 #ifndef REAL_PLUS_32767 |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
54 # define REAL_PLUS_32767 32767.0 |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
55 #endif |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
56 #ifndef REAL_MINUS_32768 |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
57 # define REAL_MINUS_32768 -32768.0 |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
58 #endif |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
59 |
61 | 60 struct id3v1tag_t { |
61 char tag[3]; /* always "TAG": defines ID3v1 tag 128 bytes before EOF */ | |
62 char title[30]; | |
63 char artist[30]; | |
64 char album[30]; | |
65 char year[4]; | |
66 union { | |
67 struct { | |
68 char comment[30]; | |
69 } v1_0; | |
70 struct { | |
71 char comment[28]; | |
72 char __zero; | |
73 unsigned char track_number; | |
74 } v1_1; | |
75 } u; | |
76 unsigned char genre; | |
77 }; | |
78 | |
79 struct id3tag_t { | |
80 char title[64]; | |
81 char artist[64]; | |
82 char album[64]; | |
83 char comment[256]; | |
84 char genre[256]; | |
85 gint year; | |
86 gint track_number; | |
87 }; | |
88 | |
89 typedef struct { | |
90 int going, num_frames, eof, jump_to_time, eq_active; | |
91 int songtime; | |
92 double tpf; | |
93 float eq_mul[576]; | |
94 gboolean output_audio, first_frame, network_stream; | |
95 guint32 filesize; /* Filesize without junk */ | |
96 } PlayerInfo; | |
97 | |
98 void mpg123_set_eq(int on, float preamp, float *band); | |
99 void mpg123_file_info_box(char *); | |
100 | |
101 extern PlayerInfo *mpg123_info; | |
102 extern InputPlugin mpg123_ip; | |
103 | |
104 struct al_table { | |
105 short bits; | |
106 short d; | |
107 }; | |
108 | |
109 struct frame { | |
110 struct al_table *alloc; | |
111 int (*synth) (real *, int, unsigned char *, int *); | |
112 int (*synth_mono) (real *, unsigned char *, int *); | |
113 #ifdef USE_SIMD | |
114 void (*dct36) (real *, real *, real *, real *, real *); | |
115 #endif | |
116 int stereo; | |
117 int jsbound; | |
118 int single; | |
119 int II_sblimit; | |
120 int down_sample_sblimit; | |
121 int lsf; | |
122 int mpeg25; | |
123 int down_sample; | |
124 int header_change; | |
125 int lay; | |
126 int (*do_layer) (struct frame * fr); | |
127 int error_protection; | |
128 int bitrate_index; | |
129 int sampling_frequency; | |
130 int padding; | |
131 int extension; | |
132 int mode; | |
133 int mode_ext; | |
134 int copyright; | |
135 int original; | |
136 int emphasis; | |
137 int framesize; /* computed framesize */ | |
138 int synth_type; | |
139 }; | |
140 | |
141 void mpg123_configure(void); | |
142 | |
143 typedef struct { | |
144 gint resolution; | |
145 gint channels; | |
146 gint downsample; | |
147 gint http_buffer_size; | |
148 gint http_prebuffer; | |
149 gboolean use_proxy; | |
150 gchar *proxy_host; | |
151 gint proxy_port; | |
152 gboolean proxy_use_auth; | |
153 gchar *proxy_user, *proxy_pass; | |
154 gboolean save_http_stream; | |
155 gchar *save_http_path; | |
156 gboolean use_udp_channel; | |
157 gchar *id3_format; | |
158 gboolean title_override, disable_id3v2; | |
159 gboolean title_encoding_enabled; | |
160 gchar *title_encoding; | |
161 int detect_by; | |
162 int default_synth; | |
163 } MPG123Config; | |
164 | |
165 extern MPG123Config mpg123_cfg; | |
166 | |
167 struct bitstream_info { | |
168 int bitindex; | |
169 unsigned char *wordpointer; | |
170 }; | |
171 | |
172 extern struct bitstream_info bsi; | |
173 | |
127
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
174 struct mpstr { |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
175 int bsize; |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
176 int framesize; |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
177 int fsizeold; |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
178 struct frame fr; |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
179 /* int (*do_layer)(struct mpstr *,struct frame *fr,int,struct audio_info_struct *); */ |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
180 unsigned char bsspace[2][MAXFRAMESIZE+512]; /* MAXFRAMESIZE */ |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
181 real hybrid_block[2][2][SBLIMIT*SSLIMIT]; |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
182 int hybrid_blc[2]; |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
183 unsigned long header; |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
184 int bsnum; |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
185 real synth_buffs[2][2][0x110]; |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
186 int synth_bo; |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
187 |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
188 struct bitstream_info bsi; |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
189 }; |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
190 |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
191 |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
192 #define AUSHIFT 3 |
05d824e30afd
[svn] Synchronize mpg123 code with mpg123-0.59s.mc3. This brings us superior accuracy to libMAD, apparently.
nenolod
parents:
61
diff
changeset
|
193 |
61 | 194 /* ------ Declarations from "http.c" ------ */ |
195 | |
196 extern int mpg123_http_open(char *url); | |
197 int mpg123_http_read(gpointer data, gint length); | |
198 void mpg123_http_close(void); | |
199 char *mpg123_http_get_title(char *url); | |
200 int mpg123_http_get_length(void); | |
201 void mpg123_http_seek(long pos); | |
202 | |
203 /* ------ Declarations from "common.c" ------ */ | |
204 extern unsigned int mpg123_get1bit(void); | |
205 extern unsigned int mpg123_getbits(int); | |
206 extern unsigned int mpg123_getbits_fast(int); | |
207 | |
208 extern void mpg123_open_stream(char *bs_filenam, int fd); | |
209 extern int mpg123_head_check(unsigned long); | |
210 extern void mpg123_stream_close(void); | |
211 | |
212 extern void mpg123_set_pointer(long); | |
213 | |
214 extern unsigned char *mpg123_pcm_sample; | |
215 extern int mpg123_pcm_point; | |
216 | |
217 struct gr_info_s { | |
218 int scfsi; | |
219 unsigned part2_3_length; | |
220 unsigned big_values; | |
221 unsigned scalefac_compress; | |
222 unsigned block_type; | |
223 unsigned mixed_block_flag; | |
224 unsigned table_select[3]; | |
225 unsigned subblock_gain[3]; | |
226 unsigned maxband[3]; | |
227 unsigned maxbandl; | |
228 unsigned maxb; | |
229 unsigned region1start; | |
230 unsigned region2start; | |
231 unsigned preflag; | |
232 unsigned scalefac_scale; | |
233 unsigned count1table_select; | |
234 real *full_gain[3]; | |
235 real *pow2gain; | |
236 }; | |
237 | |
238 struct III_sideinfo { | |
239 unsigned main_data_begin; | |
240 unsigned private_bits; | |
241 struct { | |
242 struct gr_info_s gr[2]; | |
243 } ch[2]; | |
244 }; | |
245 | |
246 extern void open_stream(char *, int fd); | |
247 extern long mpg123_tell_stream(void); | |
248 extern void mpg123_read_frame_init(void); | |
249 extern int mpg123_read_frame(struct frame *fr); | |
250 extern int mpg123_back_frame(struct frame *fr, int num); | |
251 int mpg123_stream_jump_to_frame(struct frame *fr, int frame); | |
252 int mpg123_stream_jump_to_byte(struct frame *fr, int byte); | |
253 int mpg123_stream_check_for_xing_header(struct frame *fr, | |
254 xing_header_t * xhead); | |
255 int mpg123_calc_numframes(struct frame *fr); | |
256 | |
257 extern int mpg123_do_layer3(struct frame *fr); | |
258 extern int mpg123_do_layer2(struct frame *fr); | |
259 extern int mpg123_do_layer1(struct frame *fr); | |
260 | |
261 extern int mpg123_synth_1to1(real *, int, unsigned char *, int *); | |
262 extern int mpg123_synth_1to1_8bit(real *, int, unsigned char *, int *); | |
263 extern int mpg123_synth_1to1_mono(real *, unsigned char *, int *); | |
264 extern int mpg123_synth_1to1_mono2stereo(real *, unsigned char *, int *); | |
265 extern int mpg123_synth_1to1_8bit_mono(real *, unsigned char *, int *); | |
266 extern int mpg123_synth_1to1_8bit_mono2stereo(real *, unsigned char *, | |
267 int *); | |
268 | |
269 extern int mpg123_synth_2to1(real *, int, unsigned char *, int *); | |
270 extern int mpg123_synth_2to1_8bit(real *, int, unsigned char *, int *); | |
271 extern int mpg123_synth_2to1_mono(real *, unsigned char *, int *); | |
272 extern int mpg123_synth_2to1_mono2stereo(real *, unsigned char *, int *); | |
273 extern int mpg123_synth_2to1_8bit_mono(real *, unsigned char *, int *); | |
274 extern int mpg123_synth_2to1_8bit_mono2stereo(real *, unsigned char *, | |
275 int *); | |
276 | |
277 extern int mpg123_synth_4to1(real *, int, unsigned char *, int *); | |
278 extern int mpg123_synth_4to1_8bit(real *, int, unsigned char *, int *); | |
279 extern int mpg123_synth_4to1_mono(real *, unsigned char *, int *); | |
280 extern int mpg123_synth_4to1_mono2stereo(real *, unsigned char *, int *); | |
281 extern int mpg123_synth_4to1_8bit_mono(real *, unsigned char *, int *); | |
282 extern int mpg123_synth_4to1_8bit_mono2stereo(real *, unsigned char *, | |
283 int *); | |
284 | |
285 extern void mpg123_rewindNbits(int bits); | |
286 extern int mpg123_hsstell(void); | |
287 extern void mpg123_set_pointer(long); | |
288 extern void mpg123_huffman_decoder(int, int *); | |
289 extern void mpg123_huffman_count1(int, int *); | |
290 extern int mpg123_get_songlen(struct frame *fr, int no); | |
291 | |
292 #ifdef USE_SIMD | |
293 void mpg123_dct64_mmx(real *, real *, real *); | |
294 int mpg123_synth_1to1_mmx(real *, int, unsigned char *, int *); | |
295 | |
296 void mpg123_dct36(real *, real *, real *, real *, real *); | |
297 void dct36_3dnow(real *, real *, real *, real *, real *); | |
298 int mpg123_synth_1to1_3dnow(real *, int, unsigned char *, int *); | |
299 | |
300 int mpg123_getcpuflags(guint32 * fflags, guint32 * efflags); | |
301 #else | |
302 #define mpg123_getcpuflags(a, b) \ | |
303 do { \ | |
304 *(a) = 0; \ | |
305 *(b) = 0; \ | |
306 } while (0) | |
307 #endif | |
308 | |
309 void mpg123_init_layer3(int); | |
310 void mpg123_init_layer2(gboolean); | |
311 void mpg123_make_decode_tables(long scaleval); | |
312 void mpg123_make_conv16to8_table(void); | |
313 void mpg123_dct64(real *, real *, real *); | |
314 | |
315 int mpg123_decode_header(struct frame *fr, unsigned long newhead); | |
316 double mpg123_compute_bpf(struct frame *fr); | |
317 double mpg123_compute_tpf(struct frame *fr); | |
318 guint mpg123_strip_spaces(char *src, size_t n); | |
319 void mpg123_get_id3v2(struct id3_tag *id3d, struct id3tag_t *tag); | |
320 gchar *mpg123_format_song_title(struct id3tag_t *tag, gchar * filename); | |
321 double mpg123_relative_pos(void); | |
322 | |
323 | |
324 extern gchar ** mpg123_id3_encoding_list; | |
325 extern unsigned char *mpg123_conv16to8; | |
326 extern const int mpg123_freqs[9]; | |
327 extern real mpg123_muls[27][64]; | |
328 extern real mpg123_decwin[512 + 32]; | |
329 extern real *mpg123_pnts[5]; | |
330 | |
331 #define GENRE_MAX 0x94 | |
332 extern const char *mpg123_id3_genres[GENRE_MAX]; | |
333 extern const int tabsel_123[2][3][16]; | |
334 | |
335 #endif |