changeset 1257:574ee15195f3

- Fixes for flac_is_our_fd
author Ralf Ertzinger <ralf@skytale.net>
date Fri, 13 Jul 2007 13:28:18 +0200
parents 84b837791e36
children 486bbb62c3c1
files src/flacng/plugin.c
diffstat 1 files changed, 26 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/flacng/plugin.c	Fri Jul 13 13:13:00 2007 +0200
+++ b/src/flacng/plugin.c	Fri Jul 13 13:28:18 2007 +0200
@@ -572,8 +572,8 @@
     /*
      * Open the file
      */
-    if (NULL == (fd = vfs_fopen(filename, "rb"))) {
-        _ERROR("Could not open file for reading! (%s)", filename);
+    if (NULL == (fd = vfs_fopen(input->filename, "rb"))) {
+        _ERROR("Could not open file for reading! (%s)", input->filename);
         _LEAVE;
     }
 
@@ -666,13 +666,24 @@
 void flac_get_song_info(gchar* filename, gchar** title, gint* length) {
 
     gint l;
+    VFSFile* fd;
 
     _ENTER;
 
-    if (FALSE == read_metadata(filename, test_decoder, test_info)) {
+    _DEBUG("Testing file: %s", filename);
+    /*
+     * Open the file
+     */
+    if (NULL == (fd = vfs_fopen(filename, "rb"))) {
+        _ERROR("Could not open file for reading! (%s)", filename);
+        _LEAVE;
+    }
+
+    if (FALSE == read_metadata(fd, test_decoder, test_info)) {
         _ERROR("Could not read file info!");
         *length = -1;
         *title = g_strdup("");
+        vfs_fclose(fd);
         _LEAVE;
     }
 
@@ -699,12 +710,23 @@
 
 TitleInput *flac_get_song_tuple(gchar* filename) {
 
+    VFSFile *fd;
     TitleInput *tuple;
 
     _ENTER;
 
-    if (FALSE == read_metadata(filename, test_decoder, test_info)) {
+    _DEBUG("Testing file: %s", filename);
+    /*
+     * Open the file
+     */
+    if (NULL == (fd = vfs_fopen(filename, "rb"))) {
+        _ERROR("Could not open file for reading! (%s)", filename);
+        _LEAVE NULL;
+    }
+
+    if (FALSE == read_metadata(fd, test_decoder, test_info)) {
         _ERROR("Could not read metadata tuple for file <%s>", filename);
+        vfs_fclose(fd);
         _LEAVE NULL;
     }