comparison src/flacng/plugin.c @ 1257:574ee15195f3

- Fixes for flac_is_our_fd
author Ralf Ertzinger <ralf@skytale.net>
date Fri, 13 Jul 2007 13:28:18 +0200
parents 37598c8f4425
children 47559538ce3d
comparison
equal deleted inserted replaced
1256:84b837791e36 1257:574ee15195f3
570 xmms_usleep(20000); 570 xmms_usleep(20000);
571 571
572 /* 572 /*
573 * Open the file 573 * Open the file
574 */ 574 */
575 if (NULL == (fd = vfs_fopen(filename, "rb"))) { 575 if (NULL == (fd = vfs_fopen(input->filename, "rb"))) {
576 _ERROR("Could not open file for reading! (%s)", filename); 576 _ERROR("Could not open file for reading! (%s)", input->filename);
577 _LEAVE; 577 _LEAVE;
578 } 578 }
579 579
580 if (FALSE == read_metadata(fd, main_decoder, main_info)) { 580 if (FALSE == read_metadata(fd, main_decoder, main_info)) {
581 _ERROR("Could not prepare file for playing!"); 581 _ERROR("Could not prepare file for playing!");
664 /* --- */ 664 /* --- */
665 665
666 void flac_get_song_info(gchar* filename, gchar** title, gint* length) { 666 void flac_get_song_info(gchar* filename, gchar** title, gint* length) {
667 667
668 gint l; 668 gint l;
669 669 VFSFile* fd;
670 _ENTER; 670
671 671 _ENTER;
672 if (FALSE == read_metadata(filename, test_decoder, test_info)) { 672
673 _DEBUG("Testing file: %s", filename);
674 /*
675 * Open the file
676 */
677 if (NULL == (fd = vfs_fopen(filename, "rb"))) {
678 _ERROR("Could not open file for reading! (%s)", filename);
679 _LEAVE;
680 }
681
682 if (FALSE == read_metadata(fd, test_decoder, test_info)) {
673 _ERROR("Could not read file info!"); 683 _ERROR("Could not read file info!");
674 *length = -1; 684 *length = -1;
675 *title = g_strdup(""); 685 *title = g_strdup("");
686 vfs_fclose(fd);
676 _LEAVE; 687 _LEAVE;
677 } 688 }
678 689
679 /* 690 /*
680 * Calculate the stream length (milliseconds) 691 * Calculate the stream length (milliseconds)
697 708
698 /* --- */ 709 /* --- */
699 710
700 TitleInput *flac_get_song_tuple(gchar* filename) { 711 TitleInput *flac_get_song_tuple(gchar* filename) {
701 712
713 VFSFile *fd;
702 TitleInput *tuple; 714 TitleInput *tuple;
703 715
704 _ENTER; 716 _ENTER;
705 717
706 if (FALSE == read_metadata(filename, test_decoder, test_info)) { 718 _DEBUG("Testing file: %s", filename);
719 /*
720 * Open the file
721 */
722 if (NULL == (fd = vfs_fopen(filename, "rb"))) {
723 _ERROR("Could not open file for reading! (%s)", filename);
724 _LEAVE NULL;
725 }
726
727 if (FALSE == read_metadata(fd, test_decoder, test_info)) {
707 _ERROR("Could not read metadata tuple for file <%s>", filename); 728 _ERROR("Could not read metadata tuple for file <%s>", filename);
729 vfs_fclose(fd);
708 _LEAVE NULL; 730 _LEAVE NULL;
709 } 731 }
710 732
711 tuple = get_tuple(filename, test_info); 733 tuple = get_tuple(filename, test_info);
712 734