Mercurial > audlegacy
annotate Plugins/Input/mpg123/mpg123.c @ 184:740c072f8e23 trunk
[svn] List sndfile extensions in the plugin configuration table.
author | chainsaw |
---|---|
date | Sun, 13 Nov 2005 14:27:07 -0800 |
parents | f394090439df |
children | e7e9a86c0c01 |
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 /* strips trailing spaces from string of length n | |
448 returns length of adjusted string */ | |
449 { | |
450 gchar *space = NULL, /* last space in src */ | |
451 *start = src; | |
452 | |
453 while (n--) | |
454 switch (*src++) { | |
455 case '\0': | |
456 n = 0; /* breaks out of while loop */ | |
457 | |
458 src--; | |
459 break; | |
460 case ' ': | |
461 if (space == NULL) | |
462 space = src - 1; | |
463 break; | |
464 default: | |
465 space = NULL; /* don't terminate intermediate spaces */ | |
466 | |
467 break; | |
468 } | |
469 if (space != NULL) { | |
470 src = space; | |
471 *src = '\0'; | |
472 } | |
473 return src - start; | |
474 } | |
475 | |
476 /* | |
477 * Function extname (filename) | |
478 * | |
479 * Return pointer within filename to its extenstion, or NULL if | |
480 * filename has no extension. | |
481 * | |
482 */ | |
483 static gchar * | |
484 extname(const char *filename) | |
485 { | |
486 gchar *ext = strrchr(filename, '.'); | |
487 | |
488 if (ext != NULL) | |
489 ++ext; | |
490 | |
491 return ext; | |
492 } | |
493 | |
494 /* | |
495 * Function id3v1_to_id3v2 (v1, v2) | |
496 * | |
497 * Convert ID3v1 tag `v1' to ID3v2 tag `v2'. | |
498 * | |
499 */ | |
500 void | |
501 mpg123_id3v1_to_id3v2(struct id3v1tag_t *v1, struct id3tag_t *v2) | |
502 { | |
503 memset(v2, 0, sizeof(struct id3tag_t)); | |
504 strncpy(v2->title, v1->title, 30); | |
505 strncpy(v2->artist, v1->artist, 30); | |
506 strncpy(v2->album, v1->album, 30); | |
507 strncpy(v2->comment, v1->u.v1_0.comment, 30); | |
508 strncpy(v2->genre, get_id3_genre(v1->genre), sizeof(v2->genre)); | |
509 g_strstrip(v2->title); | |
510 g_strstrip(v2->artist); | |
511 g_strstrip(v2->album); | |
512 g_strstrip(v2->comment); | |
513 g_strstrip(v2->genre); | |
514 v2->year = atoi(v1->year); | |
515 | |
516 /* Check for v1.1 tags. */ | |
517 if (v1->u.v1_1.__zero == 0) | |
518 v2->track_number = v1->u.v1_1.track_number; | |
519 else | |
520 v2->track_number = 0; | |
521 } | |
522 | |
523 static char * | |
524 mpg123_getstr(char *str) | |
525 { | |
526 if (str && strlen(str) > 0) | |
527 return str; | |
528 return NULL; | |
529 } | |
530 | |
531 static gchar * | |
532 convert_id3_title(gchar * title) | |
533 { | |
534 gchar **encoding = mpg123_id3_encoding_list; | |
535 gchar *new_title = NULL; | |
536 | |
537 if (g_utf8_validate(title, -1, NULL)) | |
538 return title; | |
539 | |
540 while (*encoding && !new_title) { | |
541 new_title = g_convert(title, strlen(title), "UTF-8", *encoding++, | |
542 NULL, NULL, NULL); | |
543 } | |
544 | |
545 if (new_title) { | |
546 g_free(title); | |
547 return new_title; | |
548 } | |
549 | |
550 /* FIXME: We're relying on BMP core to provide fallback | |
551 * conversion */ | |
552 return title; | |
553 } | |
554 | |
555 /* | |
556 * Function mpg123_format_song_title (tag, filename) | |
557 * | |
558 * Create song title according to `tag' and/or `filename' and | |
559 * return it. The title must be subsequently freed using g_free(). | |
560 * | |
561 */ | |
562 gchar * | |
563 mpg123_format_song_title(struct id3tag_t * tag, gchar * filename) | |
564 { | |
565 gchar *title = NULL; | |
566 TitleInput *input; | |
567 | |
568 input = bmp_title_input_new(); | |
569 | |
570 if (tag) { | |
571 input->performer = mpg123_getstr(tag->artist); | |
572 input->album_name = mpg123_getstr(tag->album); | |
573 input->track_name = mpg123_getstr(tag->title); | |
574 input->year = tag->year; | |
575 input->track_number = tag->track_number; | |
576 input->genre = mpg123_getstr(tag->genre); | |
577 input->comment = mpg123_getstr(tag->comment); | |
578 } | |
579 | |
580 input->file_name = g_path_get_basename(filename); | |
581 input->file_path = g_path_get_dirname(filename); | |
582 input->file_ext = extname(filename); | |
583 | |
584 title = xmms_get_titlestring(mpg123_cfg.title_override ? | |
585 mpg123_cfg.id3_format : | |
586 xmms_get_gentitle_format(), input); | |
587 | |
588 if (!title) { | |
589 /* Format according to filename. */ | |
590 title = g_path_get_basename(filename); | |
591 if (extname(title)) | |
592 *(extname(title) - 1) = '\0'; /* removes period */ | |
593 } | |
594 | |
595 g_free(input->file_path); | |
596 g_free(input->file_name); | |
597 g_free(input); | |
598 | |
599 if (mpg123_cfg.title_encoding_enabled) | |
600 title = convert_id3_title(title); | |
601 | |
602 return title; | |
603 } | |
604 | |
605 /* | |
606 * Function mpg123_get_id3v2 (id3d, tag) | |
607 * | |
608 * Get desired contents from the indicated id3tag and store it in | |
609 * `tag'. | |
610 * | |
611 */ | |
612 void | |
613 mpg123_get_id3v2(struct id3_tag *id3d, struct id3tag_t *tag) | |
614 { | |
615 struct id3_frame *id3frm; | |
616 gchar *txt; | |
617 gint tlen, num; | |
618 | |
619 #define ID3_SET(_tid,_fld) \ | |
620 { \ | |
621 id3frm = id3_get_frame( id3d, _tid, 1 ); \ | |
622 if (id3frm) { \ | |
623 txt = _tid == ID3_TCON ? id3_get_content(id3frm) \ | |
624 : id3_get_text(id3frm); \ | |
625 if(txt) \ | |
626 { \ | |
627 tlen = strlen(txt); \ | |
628 if ( tlen >= sizeof(tag->_fld) ) \ | |
629 tlen = sizeof(tag->_fld)-1; \ | |
630 strncpy( tag->_fld, txt, tlen ); \ | |
631 tag->_fld[tlen] = 0; \ | |
632 g_free(txt); \ | |
633 } \ | |
634 else \ | |
635 tag->_fld[0] = 0; \ | |
636 } else { \ | |
637 tag->_fld[0] = 0; \ | |
638 } \ | |
639 } | |
640 | |
641 #define ID3_SET_NUM(_tid,_fld) \ | |
642 { \ | |
643 id3frm = id3_get_frame(id3d, _tid, 1); \ | |
644 if (id3frm) { \ | |
645 num = id3_get_text_number(id3frm); \ | |
646 tag->_fld = num >= 0 ? num : 0; \ | |
647 } else \ | |
648 tag->_fld = 0; \ | |
649 } | |
650 | |
651 ID3_SET(ID3_TIT2, title); | |
652 ID3_SET(ID3_TPE1, artist); | |
653 if (strlen(tag->artist) == 0) | |
654 ID3_SET(ID3_TPE2, artist); | |
655 ID3_SET(ID3_TALB, album); | |
656 ID3_SET_NUM(ID3_TYER, year); | |
657 ID3_SET_NUM(ID3_TRCK, track_number); | |
658 ID3_SET(ID3_COMM, comment); | |
659 ID3_SET(ID3_TCON, genre); | |
660 } | |
661 | |
662 | |
663 /* | |
664 * Function get_song_title (fd, filename) | |
665 * | |
666 * Get song title of file. File position of `fd' will be | |
667 * clobbered. `fd' may be NULL, in which case `filename' is opened | |
668 * separately. The returned song title must be subsequently freed | |
669 * using g_free(). | |
670 * | |
671 */ | |
672 static gchar * | |
673 get_song_title(VFSFile * fd, char *filename) | |
674 { | |
675 VFSFile *file = fd; | |
676 char *ret = NULL; | |
677 struct id3v1tag_t id3v1tag; | |
678 struct id3tag_t id3tag; | |
679 | |
680 if (file || (file = vfs_fopen(filename, "rb")) != 0) { | |
681 struct id3_tag *id3 = NULL; | |
682 | |
683 /* | |
684 * Try reading ID3v2 tag. | |
685 */ | |
686 if (!mpg123_cfg.disable_id3v2) { | |
687 vfs_fseek(file, 0, SEEK_SET); | |
688 id3 = id3_open_fp(file, 0); | |
689 if (id3) { | |
690 mpg123_get_id3v2(id3, &id3tag); | |
691 ret = mpg123_format_song_title(&id3tag, filename); | |
692 id3_close(id3); | |
693 } | |
694 } | |
695 | |
696 /* | |
697 * Try reading ID3v1 tag. | |
698 */ | |
699 if (!id3 && (vfs_fseek(file, -1 * sizeof(id3v1tag), SEEK_END) == 0) && | |
700 (vfs_fread(&id3v1tag, 1, sizeof(id3v1tag), file) == | |
701 sizeof(id3v1tag)) && (strncmp(id3v1tag.tag, "TAG", 3) == 0)) { | |
702 mpg123_id3v1_to_id3v2(&id3v1tag, &id3tag); | |
703 ret = mpg123_format_song_title(&id3tag, filename); | |
704 } | |
705 | |
706 if (!fd) | |
707 /* | |
708 * File was opened in this function. | |
709 */ | |
710 vfs_fclose(file); | |
711 } | |
712 | |
713 if (ret == NULL) | |
714 /* | |
715 * Unable to get ID3 tag. | |
716 */ | |
717 ret = mpg123_format_song_title(NULL, filename); | |
718 | |
719 return ret; | |
720 } | |
721 | |
722 static long | |
723 get_song_length(VFSFile * file) | |
724 { | |
725 int len; | |
726 char tmp[4]; | |
727 | |
728 vfs_fseek(file, 0, SEEK_END); | |
729 len = vfs_ftell(file); | |
730 vfs_fseek(file, -128, SEEK_END); | |
731 vfs_fread(tmp, 1, 3, file); | |
732 if (!strncmp(tmp, "TAG", 3)) | |
733 len -= 128; | |
734 return len; | |
735 } | |
736 | |
737 | |
738 static guint | |
739 get_song_time(VFSFile * file) | |
740 { | |
741 guint32 head; | |
742 guchar tmp[4], *buf; | |
743 struct frame frm; | |
744 xing_header_t xing_header; | |
745 double tpf, bpf; | |
746 guint32 len; | |
747 | |
748 if (!file) | |
749 return -1; | |
750 | |
751 vfs_fseek(file, 0, SEEK_SET); | |
752 if (vfs_fread(tmp, 1, 4, file) != 4) | |
753 return 0; | |
754 head = convert_to_header(tmp); | |
755 while (!mpg123_head_check(head)) { | |
756 head <<= 8; | |
757 if (vfs_fread(tmp, 1, 1, file) != 1) | |
758 return 0; | |
759 head |= tmp[0]; | |
760 } | |
761 if (mpg123_decode_header(&frm, head)) { | |
762 buf = g_malloc(frm.framesize + 4); | |
763 vfs_fseek(file, -4, SEEK_CUR); | |
764 vfs_fread(buf, 1, frm.framesize + 4, file); | |
765 tpf = mpg123_compute_tpf(&frm); | |
766 if (mpg123_get_xing_header(&xing_header, buf)) { | |
767 g_free(buf); | |
768 if (xing_header.bytes == 0) | |
769 xing_header.bytes = get_song_length(file); | |
770 return (tpf * xing_header.frames * 1000); | |
771 } | |
772 g_free(buf); | |
773 bpf = mpg123_compute_bpf(&frm); | |
774 len = get_song_length(file); | |
775 return ((guint) (len / bpf) * tpf * 1000); | |
776 } | |
777 return 0; | |
778 } | |
779 | |
780 static void | |
781 get_song_info(char *filename, char **title_real, int *len_real) | |
782 { | |
783 VFSFile *file; | |
784 | |
785 (*len_real) = -1; | |
786 (*title_real) = NULL; | |
787 | |
788 /* | |
789 * TODO: Getting song info from http streams. | |
790 */ | |
791 if (!strncasecmp(filename, "http://", 7)) | |
792 return; | |
793 | |
794 if ((file = vfs_fopen(filename, "rb")) != NULL) { | |
795 (*len_real) = get_song_time(file); | |
796 (*title_real) = get_song_title(file, filename); | |
797 vfs_fclose(file); | |
798 } | |
799 } | |
800 | |
801 static int | |
802 open_output(void) | |
803 { | |
804 int r; | |
805 AFormat fmt = mpg123_cfg.resolution == 16 ? FMT_S16_NE : FMT_U8; | |
806 int freq = mpg123_freqs[fr.sampling_frequency] >> mpg123_cfg.downsample; | |
807 int channels = mpg123_cfg.channels == 2 ? fr.stereo : 1; | |
808 r = mpg123_ip.output->open_audio(fmt, freq, channels); | |
809 | |
810 if (r && dopause) { | |
811 mpg123_ip.output->pause(TRUE); | |
812 dopause = FALSE; | |
813 } | |
814 | |
815 return r; | |
816 } | |
817 | |
818 | |
819 static int | |
820 mpg123_seek(struct frame *fr, xing_header_t * xh, gboolean vbr, int time) | |
821 { | |
822 int jumped = -1; | |
823 | |
824 if (xh) { | |
825 int percent = ((double) time * 100.0) / | |
826 (mpg123_info->num_frames * mpg123_info->tpf); | |
827 int byte = mpg123_seek_point(xh, percent); | |
828 jumped = mpg123_stream_jump_to_byte(fr, byte); | |
829 } | |
830 else if (vbr && mpg123_length > 0) { | |
831 int byte = ((guint64) time * 1000 * mpg123_info->filesize) / | |
832 mpg123_length; | |
833 jumped = mpg123_stream_jump_to_byte(fr, byte); | |
834 } | |
835 else { | |
836 int frame = time / mpg123_info->tpf; | |
837 jumped = mpg123_stream_jump_to_frame(fr, frame); | |
838 } | |
839 | |
840 return jumped; | |
841 } | |
842 | |
843 | |
844 static void * | |
845 decode_loop(void *arg) | |
846 { | |
847 gboolean have_xing_header = FALSE, vbr = FALSE; | |
848 int disp_count = 0, temp_time; | |
849 char *filename = arg; | |
850 xing_header_t xing_header; | |
851 | |
852 /* This is used by fileinfo on http streams */ | |
853 mpg123_bitrate = 0; | |
854 | |
855 mpg123_pcm_sample = g_malloc0(32768); | |
856 mpg123_pcm_point = 0; | |
857 mpg123_filename = filename; | |
858 | |
859 mpg123_read_frame_init(); | |
860 | |
861 mpg123_open_stream(filename, -1); | |
862 | |
863 if (mpg123_info->eof || !mpg123_read_frame(&fr)) | |
864 mpg123_info->eof = TRUE; | |
865 | |
866 if (!mpg123_info->eof && mpg123_info->going) { | |
867 if (mpg123_cfg.channels == 2) | |
868 fr.single = -1; | |
869 else | |
870 fr.single = 3; | |
871 | |
872 fr.down_sample = mpg123_cfg.downsample; | |
873 fr.down_sample_sblimit = SBLIMIT >> mpg123_cfg.downsample; | |
874 set_synth_functions(&fr); | |
875 mpg123_init_layer3(fr.down_sample_sblimit); | |
876 | |
877 mpg123_info->tpf = mpg123_compute_tpf(&fr); | |
878 if (strncasecmp(filename, "http://", 7)) { | |
879 if (mpg123_stream_check_for_xing_header(&fr, &xing_header)) { | |
880 mpg123_info->num_frames = xing_header.frames; | |
881 have_xing_header = TRUE; | |
882 mpg123_read_frame(&fr); | |
883 } | |
884 } | |
885 | |
886 for (;;) { | |
887 memcpy(&temp_fr, &fr, sizeof(struct frame)); | |
888 if (!mpg123_read_frame(&temp_fr)) { | |
889 mpg123_info->eof = TRUE; | |
890 break; | |
891 } | |
892 if (fr.lay != temp_fr.lay || | |
893 fr.sampling_frequency != temp_fr.sampling_frequency || | |
894 fr.stereo != temp_fr.stereo || fr.lsf != temp_fr.lsf) | |
895 memcpy(&fr, &temp_fr, sizeof(struct frame)); | |
896 else | |
897 break; | |
898 } | |
899 | |
900 if (!have_xing_header && strncasecmp(filename, "http://", 7)) | |
901 mpg123_info->num_frames = mpg123_calc_numframes(&fr); | |
902 | |
903 memcpy(&fr, &temp_fr, sizeof(struct frame)); | |
904 mpg123_bitrate = tabsel_123[fr.lsf][fr.lay - 1][fr.bitrate_index]; | |
905 disp_bitrate = mpg123_bitrate; | |
906 mpg123_frequency = mpg123_freqs[fr.sampling_frequency]; | |
907 mpg123_stereo = fr.stereo; | |
908 mpg123_layer = fr.lay; | |
909 mpg123_lsf = fr.lsf; | |
910 mpg123_mpeg25 = fr.mpeg25; | |
911 mpg123_mode = fr.mode; | |
912 | |
913 if (strncasecmp(filename, "http://", 7)) { | |
914 mpg123_length = mpg123_info->num_frames * mpg123_info->tpf * 1000; | |
915 if (!mpg123_title) | |
916 mpg123_title = get_song_title(NULL, filename); | |
917 } | |
918 else { | |
919 if (!mpg123_title) | |
920 mpg123_title = mpg123_http_get_title(filename); | |
921 mpg123_length = -1; | |
922 } | |
923 | |
924 mpg123_ip.set_info(mpg123_title, mpg123_length, | |
925 mpg123_bitrate * 1000, | |
926 mpg123_freqs[fr.sampling_frequency], fr.stereo); | |
927 | |
928 output_opened = TRUE; | |
929 | |
930 if (!open_output()) { | |
931 audio_error = TRUE; | |
932 mpg123_info->eof = TRUE; | |
933 } | |
934 else | |
935 play_frame(&fr); | |
936 } | |
937 | |
938 mpg123_info->first_frame = FALSE; | |
939 while (mpg123_info->going) { | |
940 if (mpg123_info->jump_to_time != -1) { | |
941 void *xp = NULL; | |
942 if (have_xing_header) | |
943 xp = &xing_header; | |
944 if (mpg123_seek(&fr, xp, vbr, mpg123_info->jump_to_time) > -1) { | |
945 mpg123_ip.output->flush(mpg123_info->jump_to_time * 1000); | |
946 mpg123_info->eof = FALSE; | |
947 } | |
948 mpg123_info->jump_to_time = -1; | |
949 } | |
950 if (!mpg123_info->eof) { | |
951 if (mpg123_read_frame(&fr) != 0) { | |
952 if (fr.lay != mpg123_layer || fr.lsf != mpg123_lsf) { | |
953 memcpy(&temp_fr, &fr, sizeof(struct frame)); | |
954 if (mpg123_read_frame(&temp_fr) != 0) { | |
955 if (fr.lay == temp_fr.lay && fr.lsf == temp_fr.lsf) { | |
956 mpg123_layer = fr.lay; | |
957 mpg123_lsf = fr.lsf; | |
958 memcpy(&fr, &temp_fr, sizeof(struct frame)); | |
959 } | |
960 else { | |
961 memcpy(&fr, &temp_fr, sizeof(struct frame)); | |
962 skip_frames = 2; | |
963 mpg123_info->output_audio = FALSE; | |
964 continue; | |
965 } | |
966 | |
967 } | |
968 } | |
969 if (mpg123_freqs[fr.sampling_frequency] != mpg123_frequency | |
970 || mpg123_stereo != fr.stereo) { | |
971 memcpy(&temp_fr, &fr, sizeof(struct frame)); | |
972 if (mpg123_read_frame(&temp_fr) != 0) { | |
973 if (fr.sampling_frequency == | |
974 temp_fr.sampling_frequency | |
975 && temp_fr.stereo == fr.stereo) { | |
976 mpg123_ip.output->buffer_free(); | |
977 mpg123_ip.output->buffer_free(); | |
978 while (mpg123_ip.output->buffer_playing() | |
979 && mpg123_info->going | |
980 && mpg123_info->jump_to_time == -1) | |
981 xmms_usleep(20000); | |
982 if (!mpg123_info->going) | |
983 break; | |
984 temp_time = mpg123_ip.output->output_time(); | |
985 mpg123_ip.output->close_audio(); | |
986 mpg123_frequency = | |
987 mpg123_freqs[fr.sampling_frequency]; | |
988 mpg123_stereo = fr.stereo; | |
989 if (!mpg123_ip.output-> | |
990 open_audio(mpg123_cfg.resolution == | |
991 16 ? FMT_S16_NE : FMT_U8, | |
992 mpg123_freqs[fr.sampling_frequency] | |
993 >> mpg123_cfg.downsample, | |
994 mpg123_cfg.channels == | |
995 2 ? fr.stereo : 1)) { | |
996 audio_error = TRUE; | |
997 mpg123_info->eof = TRUE; | |
998 } | |
999 mpg123_ip.output->flush(temp_time); | |
1000 mpg123_ip.set_info(mpg123_title, mpg123_length, | |
1001 mpg123_bitrate * 1000, | |
1002 mpg123_frequency, | |
1003 mpg123_stereo); | |
1004 memcpy(&fr, &temp_fr, sizeof(struct frame)); | |
1005 } | |
1006 else { | |
1007 memcpy(&fr, &temp_fr, sizeof(struct frame)); | |
1008 skip_frames = 2; | |
1009 mpg123_info->output_audio = FALSE; | |
1010 continue; | |
1011 } | |
1012 } | |
1013 } | |
1014 | |
1015 if (tabsel_123[fr.lsf][fr.lay - 1][fr.bitrate_index] != | |
1016 mpg123_bitrate) | |
1017 mpg123_bitrate = | |
1018 tabsel_123[fr.lsf][fr.lay - 1][fr.bitrate_index]; | |
1019 | |
1020 if (!disp_count) { | |
1021 disp_count = 20; | |
1022 if (mpg123_bitrate != disp_bitrate) { | |
1023 /* FIXME networks streams */ | |
1024 disp_bitrate = mpg123_bitrate; | |
1025 if (!have_xing_header | |
1026 && strncasecmp(filename, "http://", 7)) { | |
1027 double rel = mpg123_relative_pos(); | |
1028 if (rel) { | |
1029 mpg123_length = | |
1030 mpg123_ip.output->written_time() / rel; | |
1031 vbr = TRUE; | |
1032 } | |
1033 | |
1034 if (rel == 0 || !(mpg123_length > 0)) { | |
1035 mpg123_info->num_frames = | |
1036 mpg123_calc_numframes(&fr); | |
1037 mpg123_info->tpf = mpg123_compute_tpf(&fr); | |
1038 mpg123_length = | |
1039 mpg123_info->num_frames * | |
1040 mpg123_info->tpf * 1000; | |
1041 } | |
1042 | |
1043 | |
1044 } | |
1045 mpg123_ip.set_info(mpg123_title, mpg123_length, | |
1046 mpg123_bitrate * 1000, | |
1047 mpg123_frequency, mpg123_stereo); | |
1048 } | |
1049 } | |
1050 else | |
1051 disp_count--; | |
1052 play_frame(&fr); | |
1053 } | |
1054 else { | |
1055 mpg123_ip.output->buffer_free(); | |
1056 mpg123_ip.output->buffer_free(); | |
1057 mpg123_info->eof = TRUE; | |
1058 xmms_usleep(10000); | |
1059 } | |
1060 } | |
1061 else { | |
1062 xmms_usleep(10000); | |
1063 } | |
1064 } | |
1065 g_free(mpg123_title); | |
1066 mpg123_title = NULL; | |
1067 mpg123_stream_close(); | |
1068 if (output_opened && !audio_error) | |
1069 mpg123_ip.output->close_audio(); | |
1070 g_free(mpg123_pcm_sample); | |
1071 mpg123_filename = NULL; | |
1072 g_free(filename); | |
1073 | |
1074 return NULL; | |
1075 } | |
1076 | |
1077 static void | |
1078 play_file(char *filename) | |
1079 { | |
1080 memset(&fr, 0, sizeof(struct frame)); | |
1081 memset(&temp_fr, 0, sizeof(struct frame)); | |
1082 | |
1083 mpg123_info = g_malloc0(sizeof(PlayerInfo)); | |
1084 mpg123_info->going = 1; | |
1085 mpg123_info->first_frame = TRUE; | |
1086 mpg123_info->output_audio = TRUE; | |
1087 mpg123_info->jump_to_time = -1; | |
1088 skip_frames = 0; | |
1089 audio_error = FALSE; | |
1090 output_opened = FALSE; | |
1091 dopause = FALSE; | |
1092 | |
1093 decode_thread = g_thread_create(decode_loop, g_strdup(filename), TRUE, | |
1094 NULL); | |
1095 } | |
1096 | |
1097 static void | |
1098 stop(void) | |
1099 { | |
1100 if (mpg123_info && mpg123_info->going) { | |
1101 mpg123_info->going = FALSE; | |
1102 g_thread_join(decode_thread); | |
1103 g_free(mpg123_info); | |
1104 mpg123_info = NULL; | |
1105 } | |
1106 } | |
1107 | |
1108 static void | |
1109 seek(int time) | |
1110 { | |
1111 mpg123_info->jump_to_time = time; | |
1112 | |
1113 while (mpg123_info->jump_to_time != -1) | |
1114 xmms_usleep(10000); | |
1115 } | |
1116 | |
1117 static void | |
1118 do_pause(short p) | |
1119 { | |
1120 if (output_opened) | |
1121 mpg123_ip.output->pause(p); | |
1122 else | |
1123 dopause = p; | |
1124 } | |
1125 | |
1126 static int | |
1127 get_time(void) | |
1128 { | |
1129 if (audio_error) | |
1130 return -2; | |
1131 if (!mpg123_info) | |
1132 return -1; | |
1133 if (!mpg123_info->going | |
1134 || (mpg123_info->eof && !mpg123_ip.output->buffer_playing())) | |
1135 return -1; | |
1136 return mpg123_ip.output->output_time(); | |
1137 } | |
1138 | |
1139 static void | |
1140 aboutbox(void) | |
1141 { | |
1142 static GtkWidget *aboutbox; | |
1143 | |
1144 if (aboutbox != NULL) | |
1145 return; | |
1146 | |
1147 aboutbox = xmms_show_message(_("About MPEG Audio Plugin"), | |
1148 _("mpg123 decoding engine by Michael Hipp <mh@mpg123.de>\n" | |
129
ce9d4aa5889a
[svn] Update the credits to note the code sync that occured.
nenolod
parents:
61
diff
changeset
|
1149 "Updated to 0.59s.mc3 by the Audacious team for greater accuracy and reliability.\n" |
ce9d4aa5889a
[svn] Update the credits to note the code sync that occured.
nenolod
parents:
61
diff
changeset
|
1150 "Based on the original XMMS plugin."), |
ce9d4aa5889a
[svn] Update the credits to note the code sync that occured.
nenolod
parents:
61
diff
changeset
|
1151 _("Ok"), |
ce9d4aa5889a
[svn] Update the credits to note the code sync that occured.
nenolod
parents:
61
diff
changeset
|
1152 FALSE, NULL, NULL); |
61 | 1153 |
1154 g_signal_connect(G_OBJECT(aboutbox), "destroy", | |
1155 G_CALLBACK(gtk_widget_destroyed), &aboutbox); | |
1156 } | |
1157 | |
1158 InputPlugin mpg123_ip = { | |
1159 NULL, | |
1160 NULL, | |
1161 NULL, /* Description */ | |
1162 init, | |
1163 aboutbox, | |
1164 mpg123_configure, | |
1165 is_our_file, | |
1166 NULL, | |
1167 play_file, | |
1168 stop, | |
1169 do_pause, | |
1170 seek, | |
1171 mpg123_set_eq, | |
1172 get_time, | |
1173 NULL, NULL, | |
1174 cleanup, | |
1175 NULL, | |
1176 NULL, NULL, NULL, | |
1177 get_song_info, | |
1178 mpg123_file_info_box, /* file_info_box */ | |
1179 NULL | |
1180 }; | |
1181 | |
1182 InputPlugin * | |
1183 get_iplugin_info(void) | |
1184 { | |
1185 mpg123_ip.description = g_strdup_printf(_("MPEG Audio Plugin")); | |
1186 return &mpg123_ip; | |
1187 } |