Mercurial > audlegacy
annotate Plugins/Input/mpg123/mpg123.c @ 352:f13ab2d8e9cf trunk
[svn] various fixes :(
author | nenolod |
---|---|
date | Mon, 26 Dec 2005 14:12:35 -0800 |
parents | e7e9a86c0c01 |
children | 18f881216679 |
rev | line source |
---|---|
61 | 1 #include "mpg123.h" |
2 | |
3 #include <glib.h> | |
4 #include <glib/gi18n.h> | |
5 #include <gtk/gtk.h> | |
6 #include <stdlib.h> | |
7 #include <string.h> | |
8 | |
9 #include <libaudacious/util.h> | |
10 #include <libaudacious/configdb.h> | |
11 #include <libaudacious/vfs.h> | |
12 #include <libaudacious/titlestring.h> | |
13 | |
14 #include "audacious/util.h" | |
15 | |
16 static const long outscale = 32768; | |
17 | |
18 static struct frame fr, temp_fr; | |
19 | |
20 PlayerInfo *mpg123_info = NULL; | |
21 static GThread *decode_thread; | |
22 | |
23 static gboolean audio_error = FALSE, output_opened = FALSE, dopause = FALSE; | |
24 gint mpg123_bitrate, mpg123_frequency, mpg123_length, mpg123_layer, | |
25 mpg123_lsf; | |
26 gchar *mpg123_title = NULL, *mpg123_filename = NULL; | |
27 static int disp_bitrate, skip_frames = 0; | |
28 static int cpu_fflags, cpu_efflags; | |
29 gboolean mpg123_stereo, mpg123_mpeg25; | |
30 int mpg123_mode; | |
31 | |
32 gchar **mpg123_id3_encoding_list = NULL; | |
33 | |
34 const char *mpg123_id3_genres[GENRE_MAX] = { | |
35 N_("Blues"), N_("Classic Rock"), N_("Country"), N_("Dance"), | |
36 N_("Disco"), N_("Funk"), N_("Grunge"), N_("Hip-Hop"), | |
37 N_("Jazz"), N_("Metal"), N_("New Age"), N_("Oldies"), | |
38 N_("Other"), N_("Pop"), N_("R&B"), N_("Rap"), N_("Reggae"), | |
39 N_("Rock"), N_("Techno"), N_("Industrial"), N_("Alternative"), | |
40 N_("Ska"), N_("Death Metal"), N_("Pranks"), N_("Soundtrack"), | |
41 N_("Euro-Techno"), N_("Ambient"), N_("Trip-Hop"), N_("Vocal"), | |
42 N_("Jazz+Funk"), N_("Fusion"), N_("Trance"), N_("Classical"), | |
43 N_("Instrumental"), N_("Acid"), N_("House"), N_("Game"), | |
44 N_("Sound Clip"), N_("Gospel"), N_("Noise"), N_("AlternRock"), | |
45 N_("Bass"), N_("Soul"), N_("Punk"), N_("Space"), | |
46 N_("Meditative"), N_("Instrumental Pop"), | |
47 N_("Instrumental Rock"), N_("Ethnic"), N_("Gothic"), | |
48 N_("Darkwave"), N_("Techno-Industrial"), N_("Electronic"), | |
49 N_("Pop-Folk"), N_("Eurodance"), N_("Dream"), | |
50 N_("Southern Rock"), N_("Comedy"), N_("Cult"), | |
51 N_("Gangsta Rap"), N_("Top 40"), N_("Christian Rap"), | |
52 N_("Pop/Funk"), N_("Jungle"), N_("Native American"), | |
53 N_("Cabaret"), N_("New Wave"), N_("Psychedelic"), N_("Rave"), | |
54 N_("Showtunes"), N_("Trailer"), N_("Lo-Fi"), N_("Tribal"), | |
55 N_("Acid Punk"), N_("Acid Jazz"), N_("Polka"), N_("Retro"), | |
56 N_("Musical"), N_("Rock & Roll"), N_("Hard Rock"), N_("Folk"), | |
57 N_("Folk/Rock"), N_("National Folk"), N_("Swing"), | |
58 N_("Fast-Fusion"), N_("Bebob"), N_("Latin"), N_("Revival"), | |
59 N_("Celtic"), N_("Bluegrass"), N_("Avantgarde"), | |
60 N_("Gothic Rock"), N_("Progressive Rock"), | |
61 N_("Psychedelic Rock"), N_("Symphonic Rock"), N_("Slow Rock"), | |
62 N_("Big Band"), N_("Chorus"), N_("Easy Listening"), | |
63 N_("Acoustic"), N_("Humour"), N_("Speech"), N_("Chanson"), | |
64 N_("Opera"), N_("Chamber Music"), N_("Sonata"), N_("Symphony"), | |
65 N_("Booty Bass"), N_("Primus"), N_("Porn Groove"), | |
66 N_("Satire"), N_("Slow Jam"), N_("Club"), N_("Tango"), | |
67 N_("Samba"), N_("Folklore"), N_("Ballad"), N_("Power Ballad"), | |
68 N_("Rhythmic Soul"), N_("Freestyle"), N_("Duet"), | |
69 N_("Punk Rock"), N_("Drum Solo"), N_("A Cappella"), | |
70 N_("Euro-House"), N_("Dance Hall"), N_("Goa"), | |
71 N_("Drum & Bass"), N_("Club-House"), N_("Hardcore"), | |
72 N_("Terror"), N_("Indie"), N_("BritPop"), N_("Negerpunk"), | |
73 N_("Polsk Punk"), N_("Beat"), N_("Christian Gangsta Rap"), | |
74 N_("Heavy Metal"), N_("Black Metal"), N_("Crossover"), | |
75 N_("Contemporary Christian"), N_("Christian Rock"), | |
76 N_("Merengue"), N_("Salsa"), N_("Thrash Metal"), | |
77 N_("Anime"), N_("JPop"), N_("Synthpop") | |
78 }; | |
79 | |
80 double | |
81 mpg123_compute_tpf(struct frame *fr) | |
82 { | |
83 const int bs[4] = { 0, 384, 1152, 1152 }; | |
84 double tpf; | |
85 | |
86 tpf = bs[fr->lay]; | |
87 tpf /= mpg123_freqs[fr->sampling_frequency] << (fr->lsf); | |
88 return tpf; | |
89 } | |
90 | |
91 static void | |
92 set_synth_functions(struct frame *fr) | |
93 { | |
94 typedef int (*func) (real *, int, unsigned char *, int *); | |
95 typedef int (*func_mono) (real *, unsigned char *, int *); | |
96 typedef void (*func_dct36) (real *, real *, real *, real *, real *); | |
97 | |
98 int ds = fr->down_sample; | |
99 int p8 = 0; | |
100 | |
101 static func funcs[][3] = { | |
102 {mpg123_synth_1to1, | |
103 mpg123_synth_2to1, | |
104 mpg123_synth_4to1}, | |
105 {mpg123_synth_1to1_8bit, | |
106 mpg123_synth_2to1_8bit, | |
107 mpg123_synth_4to1_8bit}, | |
108 }; | |
109 | |
110 static func_mono funcs_mono[2][4] = { | |
111 {mpg123_synth_1to1_mono, | |
112 mpg123_synth_2to1_mono, | |
113 mpg123_synth_4to1_mono}, | |
114 {mpg123_synth_1to1_8bit_mono, | |
115 mpg123_synth_2to1_8bit_mono, | |
116 mpg123_synth_4to1_8bit_mono} | |
117 }; | |
118 | |
119 if (mpg123_cfg.resolution == 8) | |
120 p8 = 1; | |
121 fr->synth = funcs[p8][ds]; | |
122 fr->synth_mono = funcs_mono[p8][ds]; | |
123 fr->synth_type = SYNTH_FPU; | |
124 | |
125 if (p8) { | |
126 mpg123_make_conv16to8_table(); | |
127 } | |
128 } | |
129 | |
130 static void | |
131 init(void) | |
132 { | |
133 ConfigDb *db; | |
134 | |
135 mpg123_make_decode_tables(outscale); | |
136 | |
137 mpg123_cfg.resolution = 16; | |
138 mpg123_cfg.channels = 2; | |
139 mpg123_cfg.downsample = 0; | |
140 mpg123_cfg.http_buffer_size = 128; | |
141 mpg123_cfg.http_prebuffer = 25; | |
142 mpg123_cfg.proxy_port = 8080; | |
143 mpg123_cfg.proxy_use_auth = FALSE; | |
144 mpg123_cfg.proxy_user = NULL; | |
145 mpg123_cfg.proxy_pass = NULL; | |
146 mpg123_cfg.use_udp_channel = TRUE; | |
147 mpg123_cfg.title_override = FALSE; | |
148 mpg123_cfg.disable_id3v2 = FALSE; | |
149 mpg123_cfg.detect_by = DETECT_EXTENSION; | |
150 mpg123_cfg.default_synth = SYNTH_AUTO; | |
151 | |
152 mpg123_cfg.title_encoding_enabled = FALSE; | |
153 mpg123_cfg.title_encoding = NULL; | |
154 | |
155 db = bmp_cfg_db_open(); | |
156 | |
157 bmp_cfg_db_get_int(db, "MPG123", "resolution", &mpg123_cfg.resolution); | |
158 bmp_cfg_db_get_int(db, "MPG123", "channels", &mpg123_cfg.channels); | |
159 bmp_cfg_db_get_int(db, "MPG123", "downsample", &mpg123_cfg.downsample); | |
160 bmp_cfg_db_get_int(db, "MPG123", "http_buffer_size", | |
161 &mpg123_cfg.http_buffer_size); | |
162 bmp_cfg_db_get_int(db, "MPG123", "http_prebuffer", | |
163 &mpg123_cfg.http_prebuffer); | |
164 bmp_cfg_db_get_bool(db, "MPG123", "save_http_stream", | |
165 &mpg123_cfg.save_http_stream); | |
166 if (!bmp_cfg_db_get_string | |
167 (db, "MPG123", "save_http_path", &mpg123_cfg.save_http_path)) | |
168 mpg123_cfg.save_http_path = g_strdup(g_get_home_dir()); | |
169 | |
170 bmp_cfg_db_get_bool(db, "MPG123", "use_udp_channel", | |
171 &mpg123_cfg.use_udp_channel); | |
172 | |
173 bmp_cfg_db_get_bool(db, "MPG123", "use_proxy", &mpg123_cfg.use_proxy); | |
174 if (!bmp_cfg_db_get_string | |
175 (db, "MPG123", "proxy_host", &mpg123_cfg.proxy_host)) | |
176 mpg123_cfg.proxy_host = g_strdup("localhost"); | |
177 bmp_cfg_db_get_int(db, "MPG123", "proxy_port", &mpg123_cfg.proxy_port); | |
178 bmp_cfg_db_get_bool(db, "MPG123", "proxy_use_auth", | |
179 &mpg123_cfg.proxy_use_auth); | |
180 bmp_cfg_db_get_string(db, "MPG123", "proxy_user", &mpg123_cfg.proxy_user); | |
181 bmp_cfg_db_get_string(db, "MPG123", "proxy_pass", &mpg123_cfg.proxy_pass); | |
182 | |
183 bmp_cfg_db_get_bool(db, "MPG123", "title_override", | |
184 &mpg123_cfg.title_override); | |
185 bmp_cfg_db_get_bool(db, "MPG123", "disable_id3v2", | |
186 &mpg123_cfg.disable_id3v2); | |
187 if (!bmp_cfg_db_get_string | |
188 (db, "MPG123", "id3_format", &mpg123_cfg.id3_format)) | |
189 mpg123_cfg.id3_format = g_strdup("%p - %t"); | |
190 bmp_cfg_db_get_int(db, "MPG123", "detect_by", &mpg123_cfg.detect_by); | |
191 bmp_cfg_db_get_int(db, "MPG123", "default_synth", | |
192 &mpg123_cfg.default_synth); | |
193 | |
194 bmp_cfg_db_get_bool(db, "MPG123", "title_encoding_enabled", &mpg123_cfg.title_encoding_enabled); | |
195 bmp_cfg_db_get_string(db, "MPG123", "title_encoding", &mpg123_cfg.title_encoding); | |
196 if (mpg123_cfg.title_encoding_enabled) | |
197 mpg123_id3_encoding_list = g_strsplit_set(mpg123_cfg.title_encoding, ENCODING_SEPARATOR, 0); | |
198 | |
199 bmp_cfg_db_close(db); | |
200 | |
201 if (mpg123_cfg.resolution != 16 && mpg123_cfg.resolution != 8) | |
202 mpg123_cfg.resolution = 16; | |
203 | |
204 mpg123_cfg.channels = CLAMP(mpg123_cfg.channels, 0, 2); | |
205 mpg123_cfg.downsample = CLAMP(mpg123_cfg.downsample, 0, 2); | |
206 mpg123_getcpuflags(&cpu_fflags, &cpu_efflags); | |
207 } | |
208 | |
209 static void | |
210 cleanup(void) | |
211 { | |
212 g_strfreev(mpg123_id3_encoding_list); | |
213 } | |
214 | |
215 /* needed for is_our_file() */ | |
216 static int | |
217 read_n_bytes(VFSFile * file, guint8 * buf, int n) | |
218 { | |
219 | |
220 if (vfs_fread(buf, 1, n, file) != n) { | |
221 return FALSE; | |
222 } | |
223 return TRUE; | |
224 } | |
225 | |
226 static guint32 | |
227 convert_to_header(guint8 * buf) | |
228 { | |
229 | |
230 return (buf[0] << 24) + (buf[1] << 16) + (buf[2] << 8) + buf[3]; | |
231 } | |
232 | |
233 static guint32 | |
234 convert_to_long(guint8 * buf) | |
235 { | |
236 | |
237 return (buf[3] << 24) + (buf[2] << 16) + (buf[1] << 8) + buf[0]; | |
238 } | |
239 | |
240 static guint16 | |
241 read_wav_id(char *filename) | |
242 { | |
243 VFSFile *file; | |
244 guint16 wavid; | |
245 guint8 buf[4]; | |
246 guint32 head; | |
247 long seek; | |
248 | |
249 if (!(file = vfs_fopen(filename, "rb"))) { /* Could not open file */ | |
250 return 0; | |
251 } | |
252 if (!(read_n_bytes(file, buf, 4))) { | |
253 vfs_fclose(file); | |
254 return 0; | |
255 } | |
256 head = convert_to_header(buf); | |
257 if (head == ('R' << 24) + ('I' << 16) + ('F' << 8) + 'F') { /* Found a riff -- maybe WAVE */ | |
258 if (vfs_fseek(file, 4, SEEK_CUR) != 0) { /* some error occured */ | |
259 vfs_fclose(file); | |
260 return 0; | |
261 } | |
262 if (!(read_n_bytes(file, buf, 4))) { | |
263 vfs_fclose(file); | |
264 return 0; | |
265 } | |
266 head = convert_to_header(buf); | |
267 if (head == ('W' << 24) + ('A' << 16) + ('V' << 8) + 'E') { /* Found a WAVE */ | |
268 seek = 0; | |
269 do { | |
270 /* we'll be looking for the fmt-chunk which comes before the data-chunk */ | |
271 /* A chunk consists of an header identifier (4 bytes), the length of the chunk | |
272 (4 bytes), and the chunkdata itself, padded to be an even number of bytes. | |
273 We'll skip all chunks until we find the "data"-one which could contain | |
274 mpeg-data */ | |
275 if (seek != 0) { | |
276 if (vfs_fseek(file, seek, SEEK_CUR) != 0) { /* some error occured */ | |
277 vfs_fclose(file); | |
278 return 0; | |
279 } | |
280 } | |
281 if (!(read_n_bytes(file, buf, 4))) { | |
282 vfs_fclose(file); | |
283 return 0; | |
284 } | |
285 head = convert_to_header(buf); | |
286 if (!(read_n_bytes(file, buf, 4))) { | |
287 vfs_fclose(file); | |
288 return 0; | |
289 } | |
290 seek = convert_to_long(buf); | |
291 seek = seek + (seek % 2); /* Has to be even (padding) */ | |
292 if (seek >= 2 | |
293 && head == ('f' << 24) + ('m' << 16) + ('t' << 8) + ' ') { | |
294 if (!(read_n_bytes(file, buf, 2))) { | |
295 vfs_fclose(file); | |
296 return 0; | |
297 } | |
298 wavid = buf[0] + 256 * buf[1]; | |
299 seek -= 2; | |
300 /* we could go on looking for | |
301 other things, but all we | |
302 wanted was the wavid */ | |
303 vfs_fclose(file); | |
304 return wavid; | |
305 } | |
306 } | |
307 while (head != ('d' << 24) + ('a' << 16) + ('t' << 8) + 'a'); | |
308 /* it's RIFF WAVE */ | |
309 } | |
310 /* it's RIFF */ | |
311 } | |
312 /* it's not even RIFF */ | |
313 vfs_fclose(file); | |
314 return 0; | |
315 } | |
316 | |
317 #define DET_BUF_SIZE 1024 | |
318 | |
319 static gboolean | |
320 mpg123_detect_by_content(char *filename) | |
321 { | |
322 VFSFile *file; | |
323 guchar tmp[4]; | |
324 guint32 head; | |
325 struct frame fr; | |
326 guchar buf[DET_BUF_SIZE]; | |
327 int in_buf, i; | |
328 gboolean ret = FALSE; | |
329 | |
330 if ((file = vfs_fopen(filename, "rb")) == NULL) | |
331 return FALSE; | |
332 if (vfs_fread(tmp, 1, 4, file) != 4) | |
333 goto done; | |
334 head = convert_to_header(tmp); | |
335 while (!mpg123_head_check(head)) { | |
336 /* | |
337 * The mpeg-stream can start anywhere in the file, | |
338 * so we check the entire file | |
339 */ | |
340 /* Optimize this */ | |
341 in_buf = vfs_fread(buf, 1, DET_BUF_SIZE, file); | |
342 if (in_buf == 0) | |
343 goto done; | |
344 | |
345 for (i = 0; i < in_buf; i++) { | |
346 head <<= 8; | |
347 head |= buf[i]; | |
348 if (mpg123_head_check(head)) { | |
349 vfs_fseek(file, i + 1 - in_buf, SEEK_CUR); | |
350 break; | |
351 } | |
352 } | |
353 } | |
354 if (mpg123_decode_header(&fr, head)) { | |
355 /* | |
356 * We found something which looks like a MPEG-header. | |
357 * We check the next frame too, to be sure | |
358 */ | |
359 | |
360 if (vfs_fseek(file, fr.framesize, SEEK_CUR) != 0) | |
361 goto done; | |
362 if (vfs_fread(tmp, 1, 4, file) != 4) | |
363 goto done; | |
364 head = convert_to_header(tmp); | |
365 if (mpg123_head_check(head) && mpg123_decode_header(&fr, head)) | |
366 ret = TRUE; | |
367 } | |
368 | |
369 done: | |
370 vfs_fclose(file); | |
371 return ret; | |
372 } | |
373 | |
374 static int | |
375 is_our_file(char *filename) | |
376 { | |
377 char *ext; | |
378 guint16 wavid; | |
379 | |
380 /* FIXME: wtf? */ | |
381 /* We assume all http:// (except those ending in .ogg) are mpeg -- | |
382 * why do we do that? */ | |
383 if (!strncasecmp(filename, "http://", 7)) { | |
384 ext = strrchr(filename, '.'); | |
385 if (ext) { | |
386 if (!strncasecmp(ext, ".ogg", 4)) | |
387 return FALSE; | |
388 if (!strncasecmp(ext, ".rm", 3) || | |
389 !strncasecmp(ext, ".ra", 3) || | |
390 !strncasecmp(ext, ".rpm", 4) || | |
391 !strncasecmp(ext, ".ram", 4)) | |
392 return FALSE; | |
393 } | |
394 return TRUE; | |
395 } | |
396 if (mpg123_cfg.detect_by == DETECT_CONTENT) | |
397 return (mpg123_detect_by_content(filename)); | |
398 | |
399 ext = strrchr(filename, '.'); | |
400 if (ext) { | |
401 if (!strncasecmp(ext, ".mp2", 4) || !strncasecmp(ext, ".mp3", 4)) { | |
402 return TRUE; | |
403 } | |
404 if (!strncasecmp(ext, ".wav", 4)) { | |
405 wavid = read_wav_id(filename); | |
406 if (wavid == 85 || wavid == 80) { /* Microsoft says 80, files say 85... */ | |
407 return TRUE; | |
408 } | |
409 } | |
410 } | |
411 | |
412 if (mpg123_cfg.detect_by == DETECT_BOTH) | |
413 return (mpg123_detect_by_content(filename)); | |
414 return FALSE; | |
415 } | |
416 | |
417 static void | |
418 play_frame(struct frame *fr) | |
419 { | |
420 if (fr->error_protection) { | |
421 bsi.wordpointer += 2; | |
422 /* mpg123_getbits(16); *//* skip crc */ | |
423 } | |
424 if (!fr->do_layer(fr)) { | |
425 skip_frames = 2; | |
426 mpg123_info->output_audio = FALSE; | |
427 } | |
428 else { | |
429 if (!skip_frames) | |
430 mpg123_info->output_audio = TRUE; | |
431 else | |
432 skip_frames--; | |
433 } | |
434 } | |
435 | |
436 static const char * | |
437 get_id3_genre(unsigned char genre_code) | |
438 { | |
439 if (genre_code < GENRE_MAX) | |
440 return gettext(mpg123_id3_genres[genre_code]); | |
441 | |
442 return ""; | |
443 } | |
444 | |
445 guint | |
446 mpg123_strip_spaces(char *src, size_t n) | |
447 { | |
448 gchar *space = NULL, /* last space in src */ | |
449 *start = src; | |
450 | |
451 while (n--) | |
452 switch (*src++) { | |
453 case '\0': | |
454 n = 0; /* breaks out of while loop */ | |
455 | |
456 src--; | |
457 break; | |
458 case ' ': | |
459 if (space == NULL) | |
460 space = src - 1; | |
461 break; | |
462 default: | |
463 space = NULL; /* don't terminate intermediate spaces */ | |
464 | |
465 break; | |
466 } | |
467 if (space != NULL) { | |
468 src = space; | |
469 *src = '\0'; | |
470 } | |
471 return src - start; | |
472 } | |
473 | |
474 /* | |
475 * Function extname (filename) | |
476 * | |
477 * Return pointer within filename to its extenstion, or NULL if | |
478 * filename has no extension. | |
479 * | |
480 */ | |
481 static gchar * | |
482 extname(const char *filename) | |
483 { | |
484 gchar *ext = strrchr(filename, '.'); | |
485 | |
486 if (ext != NULL) | |
487 ++ext; | |
488 | |
489 return ext; | |
490 } | |
491 | |
492 /* | |
493 * Function id3v1_to_id3v2 (v1, v2) | |
494 * | |
495 * Convert ID3v1 tag `v1' to ID3v2 tag `v2'. | |
496 * | |
497 */ | |
498 void | |
499 mpg123_id3v1_to_id3v2(struct id3v1tag_t *v1, struct id3tag_t *v2) | |
500 { | |
501 memset(v2, 0, sizeof(struct id3tag_t)); | |
502 strncpy(v2->title, v1->title, 30); | |
503 strncpy(v2->artist, v1->artist, 30); | |
504 strncpy(v2->album, v1->album, 30); | |
505 strncpy(v2->comment, v1->u.v1_0.comment, 30); | |
506 strncpy(v2->genre, get_id3_genre(v1->genre), sizeof(v2->genre)); | |
507 g_strstrip(v2->title); | |
508 g_strstrip(v2->artist); | |
509 g_strstrip(v2->album); | |
510 g_strstrip(v2->comment); | |
511 g_strstrip(v2->genre); | |
512 v2->year = atoi(v1->year); | |
513 | |
514 /* Check for v1.1 tags. */ | |
515 if (v1->u.v1_1.__zero == 0) | |
516 v2->track_number = v1->u.v1_1.track_number; | |
517 else | |
518 v2->track_number = 0; | |
519 } | |
520 | |
521 static char * | |
522 mpg123_getstr(char *str) | |
523 { | |
524 if (str && strlen(str) > 0) | |
525 return str; | |
526 return NULL; | |
527 } | |
528 | |
529 static gchar * | |
530 convert_id3_title(gchar * title) | |
531 { | |
532 gchar **encoding = mpg123_id3_encoding_list; | |
533 gchar *new_title = NULL; | |
534 | |
535 if (g_utf8_validate(title, -1, NULL)) | |
536 return title; | |
537 | |
538 while (*encoding && !new_title) { | |
539 new_title = g_convert(title, strlen(title), "UTF-8", *encoding++, | |
540 NULL, NULL, NULL); | |
541 } | |
542 | |
543 if (new_title) { | |
544 g_free(title); | |
545 return new_title; | |
546 } | |
547 | |
548 /* FIXME: We're relying on BMP core to provide fallback | |
549 * conversion */ | |
550 return title; | |
551 } | |
552 | |
553 /* | |
554 * Function mpg123_format_song_title (tag, filename) | |
555 * | |
556 * Create song title according to `tag' and/or `filename' and | |
557 * return it. The title must be subsequently freed using g_free(). | |
558 * | |
559 */ | |
560 gchar * | |
561 mpg123_format_song_title(struct id3tag_t * tag, gchar * filename) | |
562 { | |
563 gchar *title = NULL; | |
564 TitleInput *input; | |
565 | |
566 input = bmp_title_input_new(); | |
567 | |
568 if (tag) { | |
569 input->performer = mpg123_getstr(tag->artist); | |
570 input->album_name = mpg123_getstr(tag->album); | |
571 input->track_name = mpg123_getstr(tag->title); | |
572 input->year = tag->year; | |
573 input->track_number = tag->track_number; | |
574 input->genre = mpg123_getstr(tag->genre); | |
575 input->comment = mpg123_getstr(tag->comment); | |
576 } | |
577 | |
578 input->file_name = g_path_get_basename(filename); | |
579 input->file_path = g_path_get_dirname(filename); | |
580 input->file_ext = extname(filename); | |
581 | |
582 title = xmms_get_titlestring(mpg123_cfg.title_override ? | |
583 mpg123_cfg.id3_format : | |
584 xmms_get_gentitle_format(), input); | |
585 | |
586 if (!title) { | |
587 /* Format according to filename. */ | |
588 title = g_path_get_basename(filename); | |
589 if (extname(title)) | |
590 *(extname(title) - 1) = '\0'; /* removes period */ | |
591 } | |
592 | |
593 g_free(input->file_path); | |
594 g_free(input->file_name); | |
595 g_free(input); | |
596 | |
597 if (mpg123_cfg.title_encoding_enabled) | |
598 title = convert_id3_title(title); | |
599 | |
600 return title; | |
601 } | |
602 | |
603 /* | |
604 * Function mpg123_get_id3v2 (id3d, tag) | |
605 * | |
606 * Get desired contents from the indicated id3tag and store it in | |
607 * `tag'. | |
608 * | |
609 */ | |
610 void | |
611 mpg123_get_id3v2(struct id3_tag *id3d, struct id3tag_t *tag) | |
612 { | |
613 struct id3_frame *id3frm; | |
614 gchar *txt; | |
615 gint tlen, num; | |
616 | |
617 #define ID3_SET(_tid,_fld) \ | |
618 { \ | |
619 id3frm = id3_get_frame( id3d, _tid, 1 ); \ | |
620 if (id3frm) { \ | |
621 txt = _tid == ID3_TCON ? id3_get_content(id3frm) \ | |
622 : id3_get_text(id3frm); \ | |
623 if(txt) \ | |
624 { \ | |
625 tlen = strlen(txt); \ | |
626 if ( tlen >= sizeof(tag->_fld) ) \ | |
627 tlen = sizeof(tag->_fld)-1; \ | |
628 strncpy( tag->_fld, txt, tlen ); \ | |
629 tag->_fld[tlen] = 0; \ | |
630 g_free(txt); \ | |
631 } \ | |
632 else \ | |
633 tag->_fld[0] = 0; \ | |
634 } else { \ | |
635 tag->_fld[0] = 0; \ | |
636 } \ | |
637 } | |
638 | |
639 #define ID3_SET_NUM(_tid,_fld) \ | |
640 { \ | |
641 id3frm = id3_get_frame(id3d, _tid, 1); \ | |
642 if (id3frm) { \ | |
643 num = id3_get_text_number(id3frm); \ | |
644 tag->_fld = num >= 0 ? num : 0; \ | |
645 } else \ | |
646 tag->_fld = 0; \ | |
647 } | |
648 | |
649 ID3_SET(ID3_TIT2, title); | |
650 ID3_SET(ID3_TPE1, artist); | |
651 if (strlen(tag->artist) == 0) | |
652 ID3_SET(ID3_TPE2, artist); | |
653 ID3_SET(ID3_TALB, album); | |
654 ID3_SET_NUM(ID3_TYER, year); | |
655 ID3_SET_NUM(ID3_TRCK, track_number); | |
656 ID3_SET(ID3_COMM, comment); | |
657 ID3_SET(ID3_TCON, genre); | |
658 } | |
659 | |
660 | |
661 /* | |
662 * Function get_song_title (fd, filename) | |
663 * | |
664 * Get song title of file. File position of `fd' will be | |
665 * clobbered. `fd' may be NULL, in which case `filename' is opened | |
666 * separately. The returned song title must be subsequently freed | |
667 * using g_free(). | |
668 * | |
669 */ | |
670 static gchar * | |
671 get_song_title(VFSFile * fd, char *filename) | |
672 { | |
673 VFSFile *file = fd; | |
674 char *ret = NULL; | |
675 struct id3v1tag_t id3v1tag; | |
676 struct id3tag_t id3tag; | |
677 | |
678 if (file || (file = vfs_fopen(filename, "rb")) != 0) { | |
679 struct id3_tag *id3 = NULL; | |
680 | |
681 /* | |
682 * Try reading ID3v2 tag. | |
683 */ | |
684 if (!mpg123_cfg.disable_id3v2) { | |
685 vfs_fseek(file, 0, SEEK_SET); | |
686 id3 = id3_open_fp(file, 0); | |
687 if (id3) { | |
688 mpg123_get_id3v2(id3, &id3tag); | |
689 ret = mpg123_format_song_title(&id3tag, filename); | |
690 id3_close(id3); | |
691 } | |
692 } | |
693 | |
694 /* | |
695 * Try reading ID3v1 tag. | |
696 */ | |
697 if (!id3 && (vfs_fseek(file, -1 * sizeof(id3v1tag), SEEK_END) == 0) && | |
698 (vfs_fread(&id3v1tag, 1, sizeof(id3v1tag), file) == | |
699 sizeof(id3v1tag)) && (strncmp(id3v1tag.tag, "TAG", 3) == 0)) { | |
700 mpg123_id3v1_to_id3v2(&id3v1tag, &id3tag); | |
701 ret = mpg123_format_song_title(&id3tag, filename); | |
702 } | |
703 | |
704 if (!fd) | |
705 /* | |
706 * File was opened in this function. | |
707 */ | |
708 vfs_fclose(file); | |
709 } | |
710 | |
711 if (ret == NULL) | |
712 /* | |
713 * Unable to get ID3 tag. | |
714 */ | |
715 ret = mpg123_format_song_title(NULL, filename); | |
716 | |
717 return ret; | |
718 } | |
719 | |
720 static long | |
721 get_song_length(VFSFile * file) | |
722 { | |
723 int len; | |
724 char tmp[4]; | |
725 | |
726 vfs_fseek(file, 0, SEEK_END); | |
727 len = vfs_ftell(file); | |
728 vfs_fseek(file, -128, SEEK_END); | |
729 vfs_fread(tmp, 1, 3, file); | |
730 if (!strncmp(tmp, "TAG", 3)) | |
731 len -= 128; | |
732 return len; | |
733 } | |
734 | |
735 | |
736 static guint | |
737 get_song_time(VFSFile * file) | |
738 { | |
739 guint32 head; | |
740 guchar tmp[4], *buf; | |
741 struct frame frm; | |
742 xing_header_t xing_header; | |
743 double tpf, bpf; | |
744 guint32 len; | |
745 | |
746 if (!file) | |
747 return -1; | |
748 | |
749 vfs_fseek(file, 0, SEEK_SET); | |
750 if (vfs_fread(tmp, 1, 4, file) != 4) | |
751 return 0; | |
752 head = convert_to_header(tmp); | |
753 while (!mpg123_head_check(head)) { | |
754 head <<= 8; | |
755 if (vfs_fread(tmp, 1, 1, file) != 1) | |
756 return 0; | |
757 head |= tmp[0]; | |
758 } | |
759 if (mpg123_decode_header(&frm, head)) { | |
760 buf = g_malloc(frm.framesize + 4); | |
761 vfs_fseek(file, -4, SEEK_CUR); | |
762 vfs_fread(buf, 1, frm.framesize + 4, file); | |
763 tpf = mpg123_compute_tpf(&frm); | |
764 if (mpg123_get_xing_header(&xing_header, buf)) { | |
765 g_free(buf); | |
766 if (xing_header.bytes == 0) | |
767 xing_header.bytes = get_song_length(file); | |
768 return (tpf * xing_header.frames * 1000); | |
769 } | |
770 g_free(buf); | |
771 bpf = mpg123_compute_bpf(&frm); | |
772 len = get_song_length(file); | |
773 return ((guint) (len / bpf) * tpf * 1000); | |
774 } | |
775 return 0; | |
776 } | |
777 | |
778 static void | |
779 get_song_info(char *filename, char **title_real, int *len_real) | |
780 { | |
781 VFSFile *file; | |
782 | |
783 (*len_real) = -1; | |
784 (*title_real) = NULL; | |
785 | |
786 /* | |
787 * TODO: Getting song info from http streams. | |
788 */ | |
789 if (!strncasecmp(filename, "http://", 7)) | |
790 return; | |
791 | |
792 if ((file = vfs_fopen(filename, "rb")) != NULL) { | |
793 (*len_real) = get_song_time(file); | |
794 (*title_real) = get_song_title(file, filename); | |
795 vfs_fclose(file); | |
796 } | |
797 } | |
798 | |
799 static int | |
800 open_output(void) | |
801 { | |
802 int r; | |
803 AFormat fmt = mpg123_cfg.resolution == 16 ? FMT_S16_NE : FMT_U8; | |
804 int freq = mpg123_freqs[fr.sampling_frequency] >> mpg123_cfg.downsample; | |
805 int channels = mpg123_cfg.channels == 2 ? fr.stereo : 1; | |
806 r = mpg123_ip.output->open_audio(fmt, freq, channels); | |
807 | |
808 if (r && dopause) { | |
809 mpg123_ip.output->pause(TRUE); | |
810 dopause = FALSE; | |
811 } | |
812 | |
813 return r; | |
814 } | |
815 | |
816 | |
817 static int | |
818 mpg123_seek(struct frame *fr, xing_header_t * xh, gboolean vbr, int time) | |
819 { | |
820 int jumped = -1; | |
821 | |
822 if (xh) { | |
823 int percent = ((double) time * 100.0) / | |
824 (mpg123_info->num_frames * mpg123_info->tpf); | |
825 int byte = mpg123_seek_point(xh, percent); | |
826 jumped = mpg123_stream_jump_to_byte(fr, byte); | |
827 } | |
828 else if (vbr && mpg123_length > 0) { | |
829 int byte = ((guint64) time * 1000 * mpg123_info->filesize) / | |
830 mpg123_length; | |
831 jumped = mpg123_stream_jump_to_byte(fr, byte); | |
832 } | |
833 else { | |
834 int frame = time / mpg123_info->tpf; | |
835 jumped = mpg123_stream_jump_to_frame(fr, frame); | |
836 } | |
837 | |
838 return jumped; | |
839 } | |
840 | |
841 | |
842 static void * | |
843 decode_loop(void *arg) | |
844 { | |
845 gboolean have_xing_header = FALSE, vbr = FALSE; | |
846 int disp_count = 0, temp_time; | |
847 char *filename = arg; | |
848 xing_header_t xing_header; | |
849 | |
850 /* This is used by fileinfo on http streams */ | |
851 mpg123_bitrate = 0; | |
852 | |
853 mpg123_pcm_sample = g_malloc0(32768); | |
854 mpg123_pcm_point = 0; | |
855 mpg123_filename = filename; | |
856 | |
857 mpg123_read_frame_init(); | |
858 | |
859 mpg123_open_stream(filename, -1); | |
860 | |
861 if (mpg123_info->eof || !mpg123_read_frame(&fr)) | |
862 mpg123_info->eof = TRUE; | |
863 | |
864 if (!mpg123_info->eof && mpg123_info->going) { | |
865 if (mpg123_cfg.channels == 2) | |
866 fr.single = -1; | |
867 else | |
868 fr.single = 3; | |
869 | |
870 fr.down_sample = mpg123_cfg.downsample; | |
871 fr.down_sample_sblimit = SBLIMIT >> mpg123_cfg.downsample; | |
872 set_synth_functions(&fr); | |
873 mpg123_init_layer3(fr.down_sample_sblimit); | |
874 | |
875 mpg123_info->tpf = mpg123_compute_tpf(&fr); | |
876 if (strncasecmp(filename, "http://", 7)) { | |
877 if (mpg123_stream_check_for_xing_header(&fr, &xing_header)) { | |
878 mpg123_info->num_frames = xing_header.frames; | |
879 have_xing_header = TRUE; | |
880 mpg123_read_frame(&fr); | |
881 } | |
882 } | |
883 | |
884 for (;;) { | |
885 memcpy(&temp_fr, &fr, sizeof(struct frame)); | |
886 if (!mpg123_read_frame(&temp_fr)) { | |
887 mpg123_info->eof = TRUE; | |
888 break; | |
889 } | |
890 if (fr.lay != temp_fr.lay || | |
891 fr.sampling_frequency != temp_fr.sampling_frequency || | |
892 fr.stereo != temp_fr.stereo || fr.lsf != temp_fr.lsf) | |
893 memcpy(&fr, &temp_fr, sizeof(struct frame)); | |
894 else | |
895 break; | |
896 } | |
897 | |
898 if (!have_xing_header && strncasecmp(filename, "http://", 7)) | |
899 mpg123_info->num_frames = mpg123_calc_numframes(&fr); | |
900 | |
901 memcpy(&fr, &temp_fr, sizeof(struct frame)); | |
902 mpg123_bitrate = tabsel_123[fr.lsf][fr.lay - 1][fr.bitrate_index]; | |
903 disp_bitrate = mpg123_bitrate; | |
904 mpg123_frequency = mpg123_freqs[fr.sampling_frequency]; | |
905 mpg123_stereo = fr.stereo; | |
906 mpg123_layer = fr.lay; | |
907 mpg123_lsf = fr.lsf; | |
908 mpg123_mpeg25 = fr.mpeg25; | |
909 mpg123_mode = fr.mode; | |
910 | |
911 if (strncasecmp(filename, "http://", 7)) { | |
912 mpg123_length = mpg123_info->num_frames * mpg123_info->tpf * 1000; | |
913 if (!mpg123_title) | |
914 mpg123_title = get_song_title(NULL, filename); | |
915 } | |
916 else { | |
917 if (!mpg123_title) | |
918 mpg123_title = mpg123_http_get_title(filename); | |
919 mpg123_length = -1; | |
920 } | |
921 | |
922 mpg123_ip.set_info(mpg123_title, mpg123_length, | |
923 mpg123_bitrate * 1000, | |
924 mpg123_freqs[fr.sampling_frequency], fr.stereo); | |
925 | |
926 output_opened = TRUE; | |
927 | |
928 if (!open_output()) { | |
929 audio_error = TRUE; | |
930 mpg123_info->eof = TRUE; | |
931 } | |
932 else | |
933 play_frame(&fr); | |
934 } | |
935 | |
936 mpg123_info->first_frame = FALSE; | |
937 while (mpg123_info->going) { | |
938 if (mpg123_info->jump_to_time != -1) { | |
939 void *xp = NULL; | |
940 if (have_xing_header) | |
941 xp = &xing_header; | |
942 if (mpg123_seek(&fr, xp, vbr, mpg123_info->jump_to_time) > -1) { | |
943 mpg123_ip.output->flush(mpg123_info->jump_to_time * 1000); | |
944 mpg123_info->eof = FALSE; | |
945 } | |
946 mpg123_info->jump_to_time = -1; | |
947 } | |
948 if (!mpg123_info->eof) { | |
949 if (mpg123_read_frame(&fr) != 0) { | |
950 if (fr.lay != mpg123_layer || fr.lsf != mpg123_lsf) { | |
951 memcpy(&temp_fr, &fr, sizeof(struct frame)); | |
952 if (mpg123_read_frame(&temp_fr) != 0) { | |
953 if (fr.lay == temp_fr.lay && fr.lsf == temp_fr.lsf) { | |
954 mpg123_layer = fr.lay; | |
955 mpg123_lsf = fr.lsf; | |
956 memcpy(&fr, &temp_fr, sizeof(struct frame)); | |
957 } | |
958 else { | |
959 memcpy(&fr, &temp_fr, sizeof(struct frame)); | |
960 skip_frames = 2; | |
961 mpg123_info->output_audio = FALSE; | |
962 continue; | |
963 } | |
964 | |
965 } | |
966 } | |
967 if (mpg123_freqs[fr.sampling_frequency] != mpg123_frequency | |
968 || mpg123_stereo != fr.stereo) { | |
969 memcpy(&temp_fr, &fr, sizeof(struct frame)); | |
970 if (mpg123_read_frame(&temp_fr) != 0) { | |
971 if (fr.sampling_frequency == | |
972 temp_fr.sampling_frequency | |
973 && temp_fr.stereo == fr.stereo) { | |
974 mpg123_ip.output->buffer_free(); | |
975 mpg123_ip.output->buffer_free(); | |
976 while (mpg123_ip.output->buffer_playing() | |
977 && mpg123_info->going | |
978 && mpg123_info->jump_to_time == -1) | |
979 xmms_usleep(20000); | |
980 if (!mpg123_info->going) | |
981 break; | |
982 temp_time = mpg123_ip.output->output_time(); | |
983 mpg123_ip.output->close_audio(); | |
984 mpg123_frequency = | |
985 mpg123_freqs[fr.sampling_frequency]; | |
986 mpg123_stereo = fr.stereo; | |
987 if (!mpg123_ip.output-> | |
988 open_audio(mpg123_cfg.resolution == | |
989 16 ? FMT_S16_NE : FMT_U8, | |
990 mpg123_freqs[fr.sampling_frequency] | |
991 >> mpg123_cfg.downsample, | |
992 mpg123_cfg.channels == | |
993 2 ? fr.stereo : 1)) { | |
994 audio_error = TRUE; | |
995 mpg123_info->eof = TRUE; | |
996 } | |
997 mpg123_ip.output->flush(temp_time); | |
998 mpg123_ip.set_info(mpg123_title, mpg123_length, | |
999 mpg123_bitrate * 1000, | |
1000 mpg123_frequency, | |
1001 mpg123_stereo); | |
1002 memcpy(&fr, &temp_fr, sizeof(struct frame)); | |
1003 } | |
1004 else { | |
1005 memcpy(&fr, &temp_fr, sizeof(struct frame)); | |
1006 skip_frames = 2; | |
1007 mpg123_info->output_audio = FALSE; | |
1008 continue; | |
1009 } | |
1010 } | |
1011 } | |
1012 | |
1013 if (tabsel_123[fr.lsf][fr.lay - 1][fr.bitrate_index] != | |
1014 mpg123_bitrate) | |
1015 mpg123_bitrate = | |
1016 tabsel_123[fr.lsf][fr.lay - 1][fr.bitrate_index]; | |
1017 | |
1018 if (!disp_count) { | |
1019 disp_count = 20; | |
1020 if (mpg123_bitrate != disp_bitrate) { | |
1021 /* FIXME networks streams */ | |
1022 disp_bitrate = mpg123_bitrate; | |
1023 if (!have_xing_header | |
1024 && strncasecmp(filename, "http://", 7)) { | |
1025 double rel = mpg123_relative_pos(); | |
1026 if (rel) { | |
1027 mpg123_length = | |
1028 mpg123_ip.output->written_time() / rel; | |
1029 vbr = TRUE; | |
1030 } | |
1031 | |
1032 if (rel == 0 || !(mpg123_length > 0)) { | |
1033 mpg123_info->num_frames = | |
1034 mpg123_calc_numframes(&fr); | |
1035 mpg123_info->tpf = mpg123_compute_tpf(&fr); | |
1036 mpg123_length = | |
1037 mpg123_info->num_frames * | |
1038 mpg123_info->tpf * 1000; | |
1039 } | |
1040 | |
1041 | |
1042 } | |
1043 mpg123_ip.set_info(mpg123_title, mpg123_length, | |
1044 mpg123_bitrate * 1000, | |
1045 mpg123_frequency, mpg123_stereo); | |
1046 } | |
1047 } | |
1048 else | |
1049 disp_count--; | |
1050 play_frame(&fr); | |
1051 } | |
1052 else { | |
1053 mpg123_ip.output->buffer_free(); | |
1054 mpg123_ip.output->buffer_free(); | |
1055 mpg123_info->eof = TRUE; | |
1056 xmms_usleep(10000); | |
1057 } | |
1058 } | |
1059 else { | |
1060 xmms_usleep(10000); | |
1061 } | |
1062 } | |
1063 g_free(mpg123_title); | |
1064 mpg123_title = NULL; | |
1065 mpg123_stream_close(); | |
1066 if (output_opened && !audio_error) | |
1067 mpg123_ip.output->close_audio(); | |
1068 g_free(mpg123_pcm_sample); | |
1069 mpg123_filename = NULL; | |
1070 g_free(filename); | |
1071 | |
1072 return NULL; | |
1073 } | |
1074 | |
1075 static void | |
1076 play_file(char *filename) | |
1077 { | |
1078 memset(&fr, 0, sizeof(struct frame)); | |
1079 memset(&temp_fr, 0, sizeof(struct frame)); | |
1080 | |
1081 mpg123_info = g_malloc0(sizeof(PlayerInfo)); | |
1082 mpg123_info->going = 1; | |
1083 mpg123_info->first_frame = TRUE; | |
1084 mpg123_info->output_audio = TRUE; | |
1085 mpg123_info->jump_to_time = -1; | |
1086 skip_frames = 0; | |
1087 audio_error = FALSE; | |
1088 output_opened = FALSE; | |
1089 dopause = FALSE; | |
1090 | |
1091 decode_thread = g_thread_create(decode_loop, g_strdup(filename), TRUE, | |
1092 NULL); | |
1093 } | |
1094 | |
1095 static void | |
1096 stop(void) | |
1097 { | |
1098 if (mpg123_info && mpg123_info->going) { | |
1099 mpg123_info->going = FALSE; | |
1100 g_thread_join(decode_thread); | |
1101 g_free(mpg123_info); | |
1102 mpg123_info = NULL; | |
1103 } | |
1104 } | |
1105 | |
1106 static void | |
1107 seek(int time) | |
1108 { | |
1109 mpg123_info->jump_to_time = time; | |
1110 | |
1111 while (mpg123_info->jump_to_time != -1) | |
1112 xmms_usleep(10000); | |
1113 } | |
1114 | |
1115 static void | |
1116 do_pause(short p) | |
1117 { | |
1118 if (output_opened) | |
1119 mpg123_ip.output->pause(p); | |
1120 else | |
1121 dopause = p; | |
1122 } | |
1123 | |
1124 static int | |
1125 get_time(void) | |
1126 { | |
1127 if (audio_error) | |
1128 return -2; | |
1129 if (!mpg123_info) | |
1130 return -1; | |
1131 if (!mpg123_info->going | |
1132 || (mpg123_info->eof && !mpg123_ip.output->buffer_playing())) | |
1133 return -1; | |
1134 return mpg123_ip.output->output_time(); | |
1135 } | |
1136 | |
1137 static void | |
1138 aboutbox(void) | |
1139 { | |
1140 static GtkWidget *aboutbox; | |
1141 | |
1142 if (aboutbox != NULL) | |
1143 return; | |
1144 | |
1145 aboutbox = xmms_show_message(_("About MPEG Audio Plugin"), | |
223
e7e9a86c0c01
[svn] Update credits on here reflecting audacious-decoder changes.
nenolod
parents:
177
diff
changeset
|
1146 _("Audacious decoding engine by William Pitcock <nenolod@nenolod.net>, derived from:\n" |
e7e9a86c0c01
[svn] Update credits on here reflecting audacious-decoder changes.
nenolod
parents:
177
diff
changeset
|
1147 "mpg123 decoding engine by Michael Hipp <mh@mpg123.de>\n" |
e7e9a86c0c01
[svn] Update credits on here reflecting audacious-decoder changes.
nenolod
parents:
177
diff
changeset
|
1148 "Derived partially from mpg123 0.59s.mc3 as well.\n" |
129
ce9d4aa5889a
[svn] Update the credits to note the code sync that occured.
nenolod
parents:
61
diff
changeset
|
1149 "Based on the original XMMS plugin."), |
ce9d4aa5889a
[svn] Update the credits to note the code sync that occured.
nenolod
parents:
61
diff
changeset
|
1150 _("Ok"), |
ce9d4aa5889a
[svn] Update the credits to note the code sync that occured.
nenolod
parents:
61
diff
changeset
|
1151 FALSE, NULL, NULL); |
61 | 1152 |
1153 g_signal_connect(G_OBJECT(aboutbox), "destroy", | |
1154 G_CALLBACK(gtk_widget_destroyed), &aboutbox); | |
1155 } | |
1156 | |
1157 InputPlugin mpg123_ip = { | |
1158 NULL, | |
1159 NULL, | |
1160 NULL, /* Description */ | |
1161 init, | |
1162 aboutbox, | |
1163 mpg123_configure, | |
1164 is_our_file, | |
1165 NULL, | |
1166 play_file, | |
1167 stop, | |
1168 do_pause, | |
1169 seek, | |
1170 mpg123_set_eq, | |
1171 get_time, | |
1172 NULL, NULL, | |
1173 cleanup, | |
1174 NULL, | |
1175 NULL, NULL, NULL, | |
1176 get_song_info, | |
1177 mpg123_file_info_box, /* file_info_box */ | |
1178 NULL | |
1179 }; | |
1180 | |
1181 InputPlugin * | |
1182 get_iplugin_info(void) | |
1183 { | |
1184 mpg123_ip.description = g_strdup_printf(_("MPEG Audio Plugin")); | |
1185 return &mpg123_ip; | |
1186 } |