Mercurial > audlegacy-plugins
comparison 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 |
comparison
equal
deleted
inserted
replaced
705:541854f0605c | 706:6bc134eec1f3 |
---|---|
200 file_info->replaygain_album_scale = -1; | 200 file_info->replaygain_album_scale = -1; |
201 file_info->replaygain_track_scale = -1; | 201 file_info->replaygain_track_scale = -1; |
202 file_info->mp3gain_undo = -77; | 202 file_info->mp3gain_undo = -77; |
203 file_info->mp3gain_minmax = -77; | 203 file_info->mp3gain_minmax = -77; |
204 | 204 |
205 | |
206 VFSFile *fp; | 205 VFSFile *fp; |
207 | 206 glong curpos = 0; |
208 if ((fp = vfs_fopen(file_info->filename, "rb")) == NULL) | 207 |
209 return; | 208 if (file_info->infile) { |
210 | 209 fp = file_info->infile; |
211 if (vfs_fseek(fp, 0L, SEEK_END) != 0) { | 210 curpos = vfs_ftell(fp); |
212 vfs_fclose(fp); | 211 } else { |
213 return; | 212 if ((fp = vfs_fopen(file_info->filename, "rb")) == NULL) |
214 } | 213 return; |
214 if (vfs_fseek(fp, 0L, SEEK_END) != 0) { | |
215 vfs_fclose(fp); | |
216 return; | |
217 } | |
218 } | |
219 | |
215 long pos = vfs_ftell(fp); | 220 long pos = vfs_ftell(fp); |
216 int res = -1; | 221 int res = -1; |
217 int try = 0; | 222 int try = 0; |
218 while (res != 0 && try < 10) { | 223 while (res != 0 && try < 10) { |
219 // try skipping an id3 tag | 224 // try skipping an id3 tag |
247 | 252 |
248 if (file_info->replaygain_album_scale != -1 | 253 if (file_info->replaygain_album_scale != -1 |
249 || file_info->replaygain_track_scale != -1) | 254 || file_info->replaygain_track_scale != -1) |
250 file_info->has_replaygain = TRUE; | 255 file_info->has_replaygain = TRUE; |
251 | 256 |
252 vfs_fclose(fp); | 257 if (curpos) |
253 } | 258 vfs_fseek(fp, curpos, SEEK_SET); |
259 else | |
260 vfs_fclose(fp); | |
261 | |
262 } |