0
|
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
|
|
48 struct id3v1tag_t {
|
|
49 char tag[3]; /* always "TAG": defines ID3v1 tag 128 bytes before EOF */
|
|
50 char title[30];
|
|
51 char artist[30];
|
|
52 char album[30];
|
|
53 char year[4];
|
|
54 union {
|
|
55 struct {
|
|
56 char comment[30];
|
|
57 } v1_0;
|
|
58 struct {
|
|
59 char comment[28];
|
|
60 char __zero;
|
|
61 unsigned char track_number;
|
|
62 } v1_1;
|
|
63 } u;
|
|
64 unsigned char genre;
|
|
65 };
|
|
66
|
|
67 struct id3tag_t {
|
|
68 char title[64];
|
|
69 char artist[64];
|
|
70 char album[64];
|
|
71 char comment[256];
|
|
72 char genre[256];
|
|
73 gint year;
|
|
74 gint track_number;
|
|
75 };
|
|
76
|
|
77 typedef struct {
|
|
78 int going, num_frames, eof, jump_to_time, eq_active;
|
|
79 int songtime;
|
|
80 double tpf;
|
|
81 float eq_mul[576];
|
|
82 gboolean output_audio, first_frame, network_stream;
|
|
83 guint32 filesize; /* Filesize without junk */
|
|
84 } PlayerInfo;
|
|
85
|
|
86 void mpg123_set_eq(int on, float preamp, float *band);
|
|
87 void mpg123_file_info_box(char *);
|
|
88
|
|
89 extern PlayerInfo *mpg123_info;
|
|
90 extern InputPlugin mpg123_ip;
|
|
91
|
|
92 struct al_table {
|
|
93 short bits;
|
|
94 short d;
|
|
95 };
|
|
96
|
|
97 struct frame {
|
|
98 struct al_table *alloc;
|
|
99 int (*synth) (real *, int, unsigned char *, int *);
|
|
100 int (*synth_mono) (real *, unsigned char *, int *);
|
|
101 #ifdef USE_SIMD
|
|
102 void (*dct36) (real *, real *, real *, real *, real *);
|
|
103 #endif
|
|
104 int stereo;
|
|
105 int jsbound;
|
|
106 int single;
|
|
107 int II_sblimit;
|
|
108 int down_sample_sblimit;
|
|
109 int lsf;
|
|
110 int mpeg25;
|
|
111 int down_sample;
|
|
112 int header_change;
|
|
113 int lay;
|
|
114 int (*do_layer) (struct frame * fr);
|
|
115 int error_protection;
|
|
116 int bitrate_index;
|
|
117 int sampling_frequency;
|
|
118 int padding;
|
|
119 int extension;
|
|
120 int mode;
|
|
121 int mode_ext;
|
|
122 int copyright;
|
|
123 int original;
|
|
124 int emphasis;
|
|
125 int framesize; /* computed framesize */
|
|
126 int synth_type;
|
|
127 };
|
|
128
|
|
129 void mpg123_configure(void);
|
|
130
|
|
131 typedef struct {
|
|
132 gint resolution;
|
|
133 gint channels;
|
|
134 gint downsample;
|
|
135 gint http_buffer_size;
|
|
136 gint http_prebuffer;
|
|
137 gboolean use_proxy;
|
|
138 gchar *proxy_host;
|
|
139 gint proxy_port;
|
|
140 gboolean proxy_use_auth;
|
|
141 gchar *proxy_user, *proxy_pass;
|
|
142 gboolean save_http_stream;
|
|
143 gchar *save_http_path;
|
|
144 gboolean use_udp_channel;
|
|
145 gchar *id3_format;
|
|
146 gboolean title_override, disable_id3v2;
|
|
147 gboolean title_encoding_enabled;
|
|
148 gchar *title_encoding;
|
|
149 int detect_by;
|
|
150 int default_synth;
|
|
151 } MPG123Config;
|
|
152
|
|
153 extern MPG123Config mpg123_cfg;
|
|
154
|
|
155 struct bitstream_info {
|
|
156 int bitindex;
|
|
157 unsigned char *wordpointer;
|
|
158 };
|
|
159
|
|
160 extern struct bitstream_info bsi;
|
|
161
|
|
162 /* ------ Declarations from "http.c" ------ */
|
|
163
|
|
164 extern int mpg123_http_open(char *url);
|
|
165 int mpg123_http_read(gpointer data, gint length);
|
|
166 void mpg123_http_close(void);
|
|
167 char *mpg123_http_get_title(char *url);
|
|
168 int mpg123_http_get_length(void);
|
|
169 void mpg123_http_seek(long pos);
|
|
170
|
|
171 /* ------ Declarations from "common.c" ------ */
|
|
172 extern unsigned int mpg123_get1bit(void);
|
|
173 extern unsigned int mpg123_getbits(int);
|
|
174 extern unsigned int mpg123_getbits_fast(int);
|
|
175
|
|
176 extern void mpg123_open_stream(char *bs_filenam, int fd);
|
|
177 extern int mpg123_head_check(unsigned long);
|
|
178 extern void mpg123_stream_close(void);
|
|
179
|
|
180 extern void mpg123_set_pointer(long);
|
|
181
|
|
182 extern unsigned char *mpg123_pcm_sample;
|
|
183 extern int mpg123_pcm_point;
|
|
184
|
|
185 struct gr_info_s {
|
|
186 int scfsi;
|
|
187 unsigned part2_3_length;
|
|
188 unsigned big_values;
|
|
189 unsigned scalefac_compress;
|
|
190 unsigned block_type;
|
|
191 unsigned mixed_block_flag;
|
|
192 unsigned table_select[3];
|
|
193 unsigned subblock_gain[3];
|
|
194 unsigned maxband[3];
|
|
195 unsigned maxbandl;
|
|
196 unsigned maxb;
|
|
197 unsigned region1start;
|
|
198 unsigned region2start;
|
|
199 unsigned preflag;
|
|
200 unsigned scalefac_scale;
|
|
201 unsigned count1table_select;
|
|
202 real *full_gain[3];
|
|
203 real *pow2gain;
|
|
204 };
|
|
205
|
|
206 struct III_sideinfo {
|
|
207 unsigned main_data_begin;
|
|
208 unsigned private_bits;
|
|
209 struct {
|
|
210 struct gr_info_s gr[2];
|
|
211 } ch[2];
|
|
212 };
|
|
213
|
|
214 extern void open_stream(char *, int fd);
|
|
215 extern long mpg123_tell_stream(void);
|
|
216 extern void mpg123_read_frame_init(void);
|
|
217 extern int mpg123_read_frame(struct frame *fr);
|
|
218 extern int mpg123_back_frame(struct frame *fr, int num);
|
|
219 int mpg123_stream_jump_to_frame(struct frame *fr, int frame);
|
|
220 int mpg123_stream_jump_to_byte(struct frame *fr, int byte);
|
|
221 int mpg123_stream_check_for_xing_header(struct frame *fr,
|
|
222 xing_header_t * xhead);
|
|
223 int mpg123_calc_numframes(struct frame *fr);
|
|
224
|
|
225 extern int mpg123_do_layer3(struct frame *fr);
|
|
226 extern int mpg123_do_layer2(struct frame *fr);
|
|
227 extern int mpg123_do_layer1(struct frame *fr);
|
|
228
|
|
229 extern int mpg123_synth_1to1(real *, int, unsigned char *, int *);
|
|
230 extern int mpg123_synth_1to1_8bit(real *, int, unsigned char *, int *);
|
|
231 extern int mpg123_synth_1to1_mono(real *, unsigned char *, int *);
|
|
232 extern int mpg123_synth_1to1_mono2stereo(real *, unsigned char *, int *);
|
|
233 extern int mpg123_synth_1to1_8bit_mono(real *, unsigned char *, int *);
|
|
234 extern int mpg123_synth_1to1_8bit_mono2stereo(real *, unsigned char *,
|
|
235 int *);
|
|
236
|
|
237 extern int mpg123_synth_2to1(real *, int, unsigned char *, int *);
|
|
238 extern int mpg123_synth_2to1_8bit(real *, int, unsigned char *, int *);
|
|
239 extern int mpg123_synth_2to1_mono(real *, unsigned char *, int *);
|
|
240 extern int mpg123_synth_2to1_mono2stereo(real *, unsigned char *, int *);
|
|
241 extern int mpg123_synth_2to1_8bit_mono(real *, unsigned char *, int *);
|
|
242 extern int mpg123_synth_2to1_8bit_mono2stereo(real *, unsigned char *,
|
|
243 int *);
|
|
244
|
|
245 extern int mpg123_synth_4to1(real *, int, unsigned char *, int *);
|
|
246 extern int mpg123_synth_4to1_8bit(real *, int, unsigned char *, int *);
|
|
247 extern int mpg123_synth_4to1_mono(real *, unsigned char *, int *);
|
|
248 extern int mpg123_synth_4to1_mono2stereo(real *, unsigned char *, int *);
|
|
249 extern int mpg123_synth_4to1_8bit_mono(real *, unsigned char *, int *);
|
|
250 extern int mpg123_synth_4to1_8bit_mono2stereo(real *, unsigned char *,
|
|
251 int *);
|
|
252
|
|
253 extern void mpg123_rewindNbits(int bits);
|
|
254 extern int mpg123_hsstell(void);
|
|
255 extern void mpg123_set_pointer(long);
|
|
256 extern void mpg123_huffman_decoder(int, int *);
|
|
257 extern void mpg123_huffman_count1(int, int *);
|
|
258 extern int mpg123_get_songlen(struct frame *fr, int no);
|
|
259
|
|
260 #ifdef USE_SIMD
|
|
261 void mpg123_dct64_mmx(real *, real *, real *);
|
|
262 int mpg123_synth_1to1_mmx(real *, int, unsigned char *, int *);
|
|
263
|
|
264 void mpg123_dct36(real *, real *, real *, real *, real *);
|
|
265 void dct36_3dnow(real *, real *, real *, real *, real *);
|
|
266 int mpg123_synth_1to1_3dnow(real *, int, unsigned char *, int *);
|
|
267
|
|
268 int mpg123_getcpuflags(guint32 * fflags, guint32 * efflags);
|
|
269 #else
|
|
270 #define mpg123_getcpuflags(a, b) \
|
|
271 do { \
|
|
272 *(a) = 0; \
|
|
273 *(b) = 0; \
|
|
274 } while (0)
|
|
275 #endif
|
|
276
|
|
277 void mpg123_init_layer3(int);
|
|
278 void mpg123_init_layer2(gboolean);
|
|
279 void mpg123_make_decode_tables(long scaleval);
|
|
280 void mpg123_make_conv16to8_table(void);
|
|
281 void mpg123_dct64(real *, real *, real *);
|
|
282
|
|
283 int mpg123_decode_header(struct frame *fr, unsigned long newhead);
|
|
284 double mpg123_compute_bpf(struct frame *fr);
|
|
285 double mpg123_compute_tpf(struct frame *fr);
|
|
286 guint mpg123_strip_spaces(char *src, size_t n);
|
|
287 void mpg123_get_id3v2(struct id3_tag *id3d, struct id3tag_t *tag);
|
|
288 gchar *mpg123_format_song_title(struct id3tag_t *tag, gchar * filename);
|
|
289 double mpg123_relative_pos(void);
|
|
290
|
|
291
|
|
292 extern gchar ** mpg123_id3_encoding_list;
|
|
293 extern unsigned char *mpg123_conv16to8;
|
|
294 extern const int mpg123_freqs[9];
|
|
295 extern real mpg123_muls[27][64];
|
|
296 extern real mpg123_decwin[512 + 32];
|
|
297 extern real *mpg123_pnts[5];
|
|
298
|
|
299 #define GENRE_MAX 0x94
|
|
300 extern const char *mpg123_id3_genres[GENRE_MAX];
|
|
301 extern const int tabsel_123[2][3][16];
|
|
302
|
|
303 #endif
|