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