comparison src/wavpack/libwavpack.cxx @ 566:98c4735c3c2e trunk

[svn] - update to new input plugin API
author nenolod
date Mon, 29 Jan 2007 03:26:26 -0800
parents 7385182ae4b8
children b1128efde471
comparison
equal deleted inserted replaced
565:c2f3df58cad6 566:98c4735c3c2e
31 #define BUFFER_SIZE 256 // read buffer size, in samples 31 #define BUFFER_SIZE 256 // read buffer size, in samples
32 32
33 extern "C" InputPlugin * get_iplugin_info(void); 33 extern "C" InputPlugin * get_iplugin_info(void);
34 static void wv_load_config(); 34 static void wv_load_config();
35 static int wv_is_our_fd(gchar *filename, VFSFile *file); 35 static int wv_is_our_fd(gchar *filename, VFSFile *file);
36 static void wv_play(char *); 36 static void wv_play(InputPlayback *);
37 static void wv_stop(void); 37 static void wv_stop(InputPlayback *);
38 static void wv_pause(short); 38 static void wv_pause(InputPlayback *, short);
39 static void wv_seek(int); 39 static void wv_seek(InputPlayback *, int);
40 static int wv_get_time(void); 40 static int wv_get_time(InputPlayback *);
41 static void wv_get_song_info(char *, char **, int *); 41 static void wv_get_song_info(char *, char **, int *);
42 static char *generate_title(const char *, WavpackContext *ctx); 42 static char *generate_title(const char *, WavpackContext *ctx);
43 static double isSeek; 43 static double isSeek;
44 static short paused; 44 static short paused;
45 static bool killDecodeThread; 45 static bool killDecodeThread;
347 } 347 }
348 return end_thread(); 348 return end_thread();
349 } 349 }
350 350
351 static void 351 static void
352 wv_play(char *filename) 352 wv_play(InputPlayback *data)
353 { 353 {
354 paused = 0; 354 paused = 0;
355 isSeek = -1; 355 isSeek = -1;
356 killDecodeThread = false; 356 killDecodeThread = false;
357 AudioError = false; 357 AudioError = false;
358 thread_handle = g_thread_create(DecodeThread, (void *) filename, TRUE, NULL); 358 thread_handle = g_thread_create(DecodeThread, (void *) data->filename, TRUE, NULL);
359 return; 359 return;
360 } 360 }
361 361
362 static TitleInput * 362 static TitleInput *
363 tuple_from_WavpackContext(const char *fn, WavpackContext *ctx) 363 tuple_from_WavpackContext(const char *fn, WavpackContext *ctx)
443 *title = generate_title(filename, d.ctx); 443 *title = generate_title(filename, d.ctx);
444 DBG("title for %s = %s\n", filename, *title); 444 DBG("title for %s = %s\n", filename, *title);
445 } 445 }
446 446
447 static int 447 static int
448 wv_get_time(void) 448 wv_get_time(InputPlayback *data)
449 { 449 {
450 if (!mod.output) 450 if (data->output == NULL)
451 return -1; 451 return -1;
452 if (AudioError) 452 if (AudioError)
453 return -2; 453 return -2;
454 if (killDecodeThread && !mod.output->buffer_playing()) 454 if (killDecodeThread && !data->output->buffer_playing())
455 return -1; 455 return -1;
456 return mod.output->output_time(); 456 return data->output->output_time();
457 } 457 }
458
459 458
460 static void 459 static void
461 wv_seek(int sec) 460 wv_seek(InputPlayback *data, int sec)
462 { 461 {
463 isSeek = sec; 462 isSeek = sec;
464 mod.output->flush((int) (1000 * isSeek)); 463 data->output->flush((int) (1000 * isSeek));
465 } 464 }
466 465
467 static void 466 static void
468 wv_pause(short pause) 467 wv_pause(InputPlayback *data, short pause)
469 { 468 {
470 mod.output->pause(paused = pause); 469 data->output->pause(paused = pause);
471 } 470 }
472 471
473 static void 472 static void
474 wv_stop(void) 473 wv_stop(InputPlayback *data)
475 { 474 {
476 killDecodeThread = true; 475 killDecodeThread = true;
477 if (thread_handle != 0) { 476 if (thread_handle != 0) {
478 g_thread_join(thread_handle); 477 g_thread_join(thread_handle);
479 if (openedAudio) { 478 if (openedAudio) {