Mercurial > audlegacy-plugins
comparison src/madplug/plugin.c @ 613:85a70ace8c02 trunk
[svn] - press F5 on not yet played stream no longer hangs.
- some cleanups.
author | yaz |
---|---|
date | Wed, 07 Feb 2007 01:10:37 -0800 |
parents | 951b24719ce9 |
children | a7a28782c1b0 |
comparison
equal
deleted
inserted
replaced
612:951b24719ce9 | 613:85a70ace8c02 |
---|---|
195 gint cyc = 0; | 195 gint cyc = 0; |
196 guchar buf[4]; | 196 guchar buf[4]; |
197 guchar tmp[4096]; | 197 guchar tmp[4096]; |
198 gint ret, i; | 198 gint ret, i; |
199 | 199 |
200 info.remote = FALSE; | |
201 | |
200 #if 1 | 202 #if 1 |
201 // XXX: temporary fix | 203 // XXX: temporary fix |
202 if (!strncasecmp("http://", filename, 7) || !strncasecmp("https://", filename, 8)) { | 204 if (!strncasecmp("http://", filename, 7) || !strncasecmp("https://", filename, 8)) { |
203 g_message("audmad_is_our_fe: remote"); | 205 g_message("audmad_is_our_fd: remote"); |
204 info.remote = TRUE; | 206 info.remote = TRUE; |
205 } | 207 } |
206 #endif | 208 #endif |
207 | 209 |
208 /* I've seen some flac files beginning with id3 frames.. | 210 /* I've seen some flac files beginning with id3 frames.. |
318 | 320 |
319 if (rtn == FALSE) { | 321 if (rtn == FALSE) { |
320 g_message("error reading input info"); | 322 g_message("error reading input info"); |
321 return; | 323 return; |
322 } | 324 } |
323 | 325 g_mutex_lock(pb_mutex); |
324 info.playback = playback; | 326 info.playback = playback; |
325 info.playback->playing = 1; | 327 info.playback->playing = 1; |
328 g_mutex_unlock(pb_mutex); | |
326 | 329 |
327 decode_thread = g_thread_create(decode_loop, (void *) &info, TRUE, NULL); | 330 decode_thread = g_thread_create(decode_loop, (void *) &info, TRUE, NULL); |
328 } | 331 } |
329 | 332 |
330 static void audmad_pause(InputPlayback *playback, short paused) | 333 static void audmad_pause(InputPlayback *playback, short paused) |
355 struct mad_info_t myinfo; | 358 struct mad_info_t myinfo; |
356 #ifdef DEBUG | 359 #ifdef DEBUG |
357 g_message("f: audmad_get_song_info: %s", url); | 360 g_message("f: audmad_get_song_info: %s", url); |
358 #endif /* DEBUG */ | 361 #endif /* DEBUG */ |
359 | 362 |
360 input_init(&myinfo, url); | 363 if (input_init(&myinfo, url) == FALSE) { |
364 g_message("error initialising input"); | |
365 return; | |
366 } | |
367 | |
368 // don't try to get from stopped stream. | |
369 if(myinfo.remote && (!myinfo.playback || !myinfo.playback->playing)){ | |
370 g_print("get_song_info: remote!\n"); | |
371 return; | |
372 } | |
361 | 373 |
362 if (input_get_info(&myinfo, info.remote ? TRUE : audmad_config.fast_play_time_calc) == TRUE) { | 374 if (input_get_info(&myinfo, info.remote ? TRUE : audmad_config.fast_play_time_calc) == TRUE) { |
363 if(myinfo.tuple->track_name) | 375 if(myinfo.tuple->track_name) |
364 *title = strdup(myinfo.tuple->track_name); | 376 *title = strdup(myinfo.tuple->track_name); |
365 else | 377 else |
450 struct id3_tag *tag = NULL; | 462 struct id3_tag *tag = NULL; |
451 | 463 |
452 #ifdef DEBUG | 464 #ifdef DEBUG |
453 string = str_to_utf8(filename); | 465 string = str_to_utf8(filename); |
454 g_message("f: mad: audmad_get_song_tuple: %s", string); | 466 g_message("f: mad: audmad_get_song_tuple: %s", string); |
455 if (string) { | 467 g_free(string); |
456 g_free(string); | 468 string = NULL; |
457 string = NULL; | 469 #endif |
458 } | 470 |
459 #endif | |
460 | |
461 // can't re-open remote stream | |
462 if(info.remote){ | 471 if(info.remote){ |
463 tuple = bmp_title_input_new(); | 472 if(info.playback && info.playback->playing) { |
464 | 473 tuple = bmp_title_input_new(); |
465 tuple->track_name = vfs_get_metadata(info.infile, "track-name"); | 474 #ifdef DEBUG |
466 tuple->album_name = vfs_get_metadata(info.infile, "stream-name"); | 475 printf("info.playback->playing = %d\n",info.playback->playing); |
467 #ifdef DEBUG | 476 #endif |
468 printf("audmad_get_song_tuple: track_name = %s\n", tuple->track_name); | 477 tuple->track_name = vfs_get_metadata(info.infile, "track-name"); |
469 printf("audmad_get_song_tuple: stream_name = %s\n", tuple->album_name); | 478 tuple->album_name = vfs_get_metadata(info.infile, "stream-name"); |
470 #endif | 479 #ifdef DEBUG |
471 tuple->file_name = g_path_get_basename(filename); | 480 printf("audmad_get_song_tuple: track_name = %s\n", tuple->track_name); |
472 tuple->file_path = g_path_get_dirname(filename); | 481 printf("audmad_get_song_tuple: stream_name = %s\n", tuple->album_name); |
473 tuple->file_ext = extname(filename); | 482 #endif |
474 tuple->length = -1; | 483 tuple->file_name = g_path_get_basename(filename); |
475 tuple->mtime = 0; // this indicates streaming | 484 tuple->file_path = g_path_get_dirname(filename); |
476 | 485 tuple->file_ext = extname(filename); |
477 return tuple; | 486 tuple->length = -1; |
487 tuple->mtime = 0; // this indicates streaming | |
488 #ifdef DEBUG | |
489 printf("get_song_tuple remote: tuple\n"); | |
490 #endif | |
491 return tuple; | |
492 } | |
493 #ifdef DEBUG | |
494 printf("get_song_tuple: remote: NULL\n"); | |
495 #endif | |
496 return NULL; | |
478 } | 497 } |
479 | 498 |
480 if ((file = vfs_fopen(filename, "rb")) != NULL) { | 499 if ((file = vfs_fopen(filename, "rb")) != NULL) { |
481 | 500 |
482 tuple = bmp_title_input_new(); | 501 tuple = bmp_title_input_new(); |
526 string = NULL; | 545 string = NULL; |
527 } | 546 } |
528 // genre | 547 // genre |
529 tuple->genre = input_id3_get_string(tag, ID3_FRAME_GENRE); | 548 tuple->genre = input_id3_get_string(tag, ID3_FRAME_GENRE); |
530 #ifdef DEBUG | 549 #ifdef DEBUG |
531 g_message("genre = %s\n", tuple->genre); | 550 g_message("genre = %s", tuple->genre); |
532 #endif | 551 #endif |
533 // comment | 552 // comment |
534 tuple->comment = | 553 tuple->comment = |
535 input_id3_get_string(tag, ID3_FRAME_COMMENT); | 554 input_id3_get_string(tag, ID3_FRAME_COMMENT); |
536 | 555 |