Mercurial > audlegacy-plugins
diff src/madplug/replaygain.c @ 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 | 3f7a52adfe0e |
children | 90d02e8da818 |
line wrap: on
line diff
--- 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); + }