changeset 706:6bc134eec1f3 trunk

[svn] - make use of the new id3_file_vfsopen() function. Patch by Christian Birchinger (joker).
author nenolod
date Sat, 24 Feb 2007 07:49:06 -0800
parents 541854f0605c
children 88d78a61a9fb
files ChangeLog src/madplug/input.c src/madplug/replaygain.c
diffstat 3 files changed, 28 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Feb 24 05:58:15 2007 -0800
+++ b/ChangeLog	Sat Feb 24 07:49:06 2007 -0800
@@ -1,3 +1,10 @@
+2007-02-24 13:58:15 +0000  Tony Vroon <chainsaw@gentoo.org>
+  revision [1496]
+  Steal parser from paranormal and make sure all datestamps are the same so yacc does not run.
+  trunk/src/rovascope/libcalc/parser.y |    3 +++
+  1 file changed, 3 insertions(+)
+
+
 2007-02-24 04:30:42 +0000  William Pitcock <nenolod@sacredspiral.co.uk>
   revision [1494]
   - VFS probing support patch by Christian Birchinger (joker).
--- a/src/madplug/input.c	Sat Feb 24 05:58:15 2007 -0800
+++ b/src/madplug/input.c	Sat Feb 24 07:49:06 2007 -0800
@@ -345,7 +345,10 @@
     else
         title_input = info->tuple;
 
-    info->id3file = id3_file_open(info->filename, ID3_FILE_MODE_READONLY);
+    if(info->infile)
+      info->id3file = id3_file_vfsopen(info->infile, ID3_FILE_MODE_READONLY);
+    else
+      info->id3file = id3_file_open(info->filename, ID3_FILE_MODE_READONLY);
     if (!info->id3file) {
         return;
     }
--- a/src/madplug/replaygain.c	Sat Feb 24 05:58:15 2007 -0800
+++ b/src/madplug/replaygain.c	Sat Feb 24 07:49:06 2007 -0800
@@ -202,16 +202,21 @@
     file_info->mp3gain_undo = -77;
     file_info->mp3gain_minmax = -77;
 
-
     VFSFile *fp;
+    glong curpos = 0;
 
-    if ((fp = vfs_fopen(file_info->filename, "rb")) == NULL)
-        return;
-
-    if (vfs_fseek(fp, 0L, SEEK_END) != 0) {
-        vfs_fclose(fp);
-        return;
+    if (file_info->infile) {
+        fp = file_info->infile;
+        curpos = vfs_ftell(fp);
+    } else {
+        if ((fp = vfs_fopen(file_info->filename, "rb")) == NULL)
+            return;
+        if (vfs_fseek(fp, 0L, SEEK_END) != 0) {
+            vfs_fclose(fp);
+            return;
+        }
     }
+    
     long pos = vfs_ftell(fp);
     int res = -1;
     int try = 0;
@@ -249,5 +254,9 @@
         || file_info->replaygain_track_scale != -1)
         file_info->has_replaygain = TRUE;
 
-    vfs_fclose(fp);
+    if (curpos)
+        vfs_fseek(fp, curpos, SEEK_SET);
+    else
+        vfs_fclose(fp);
+        
 }