Mercurial > audlegacy-plugins
comparison src/madplug/plugin.c @ 788:2461b711162b trunk
[svn] - revert r1664 as it breaks too much
| author | nenolod |
|---|---|
| date | Tue, 06 Mar 2007 15:43:15 -0800 |
| parents | 83a38bcfe7c8 |
| children | 354c69a939bc |
comparison
equal
deleted
inserted
replaced
| 787:9794a5487524 | 788:2461b711162b |
|---|---|
| 222 gint cyc = 0; | 222 gint cyc = 0; |
| 223 guchar buf[4]; | 223 guchar buf[4]; |
| 224 guchar tmp[4096]; | 224 guchar tmp[4096]; |
| 225 gint ret, i; | 225 gint ret, i; |
| 226 | 226 |
| 227 if (fin == NULL) | |
| 228 return 0; | |
| 229 | |
| 230 info.remote = FALSE; | 227 info.remote = FALSE; |
| 231 | 228 |
| 232 if(audmad_is_remote(filename)) | 229 if(audmad_is_remote(filename)) |
| 233 info.remote = TRUE; | 230 info.remote = TRUE; |
| 234 | 231 |
| 237 if ((ext != NULL) && | 234 if ((ext != NULL) && |
| 238 (!strcasecmp("flac", ext) || !strcasecmp("mpc", ext) || | 235 (!strcasecmp("flac", ext) || !strcasecmp("mpc", ext) || |
| 239 !strcasecmp("tta", ext) || !strcasecmp("ogg", ext) || | 236 !strcasecmp("tta", ext) || !strcasecmp("ogg", ext) || |
| 240 !strcasecmp("wma", ext) ) | 237 !strcasecmp("wma", ext) ) |
| 241 ) | 238 ) |
| 242 return 0; | 239 return FALSE; |
| 243 | 240 |
| 244 if(vfs_fread(buf, 1, 4, fin) == 0) | 241 if (fin == NULL) |
| 245 return 0; | 242 return FALSE; |
| 243 | |
| 244 vfs_fread(buf, 1, 4, fin); | |
| 246 | 245 |
| 247 check = mp3_head_convert(buf); | 246 check = mp3_head_convert(buf); |
| 248 | 247 |
| 249 if (memcmp(buf, "ID3", 3) == 0) | 248 if (memcmp(buf, "ID3", 3) == 0) |
| 250 return 1; | 249 return 1; |
| 251 else if (memcmp(buf, "OggS", 4) == 0) | 250 else if (memcmp(buf, "OggS", 4) == 0) |
| 252 return 0; | 251 return 0; |
| 253 else if (memcmp(buf, "RIFF", 4) == 0) | 252 else if (memcmp(buf, "RIFF", 4) == 0) |
| 254 { | 253 { |
| 255 vfs_fseek(fin, 4, SEEK_CUR); | 254 vfs_fseek(fin, 4, SEEK_CUR); |
| 256 if(vfs_fread(buf, 1, 4, fin) == 0) | 255 vfs_fread(buf, 1, 4, fin); |
| 257 return 0; | |
| 258 | 256 |
| 259 if (memcmp(buf, "RMP3", 4) == 0) | 257 if (memcmp(buf, "RMP3", 4) == 0) |
| 260 return 1; | 258 return 1; |
| 261 } | 259 } |
| 262 | 260 |
| 263 while (!mp3_head_check(check)) | 261 while (!mp3_head_check(check)) |
| 264 { | 262 { |
| 265 if(vfs_fread(tmp, 1, 4096, fin) == 0) | 263 ret = vfs_fread(tmp, 1, 4096, fin); |
| 264 if (ret == 0) | |
| 266 return 0; | 265 return 0; |
| 267 | 266 |
| 268 for (i = 0; i < ret; i++) | 267 for (i = 0; i < ret; i++) |
| 269 { | 268 { |
| 270 check <<= 8; | 269 check <<= 8; |
