Mercurial > hg > xmms-sid
comparison src/xmms-sid.c @ 846:7b11ba6fc4cc
Improve and fix probing (FP backend wasn't used when checking filename
extensions).
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 08 Nov 2012 22:43:45 +0200 |
parents | 29f3c3f29c0d |
children | 2663b1ac9ce6 |
comparison
equal
deleted
inserted
replaced
845:f54ef18673e6 | 846:7b11ba6fc4cc |
---|---|
269 /* Check the filename */ | 269 /* Check the filename */ |
270 if (filename == NULL) | 270 if (filename == NULL) |
271 return FALSE; | 271 return FALSE; |
272 | 272 |
273 /* Try to detect via detection routine, if required */ | 273 /* Try to detect via detection routine, if required */ |
274 if (xs_cfg.detectMagic) | 274 if (xs_cfg.detectMagic && xs_status.engine->plrProbe != NULL) |
275 { | 275 { |
276 gboolean res = FALSE; | |
276 XSFile *f; | 277 XSFile *f; |
277 if ((f = xs_fopen(filename, "rb")) != NULL) | 278 if ((f = xs_fopen(filename, "rb")) != NULL) |
278 { | 279 { |
279 if (xs_status.engine->plrProbe(f)) | 280 res = xs_status.engine->plrProbe(f); |
280 return TRUE; | |
281 xs_fclose(f); | 281 xs_fclose(f); |
282 } | 282 } |
283 return res; | |
283 } | 284 } |
284 | 285 |
285 /* Detect just by checking filename extension */ | 286 /* Detect just by checking filename extension */ |
286 ext = strrchr(filename, '.'); | 287 ext = strrchr(filename, '.'); |
287 if (ext) | 288 if (ext) |
288 { | 289 { |
289 ext++; | 290 ext++; |
290 switch (xs_cfg.playerEngine) | 291 switch (xs_cfg.playerEngine) |
291 { | 292 { |
292 case XS_ENG_SIDPLAY1: | 293 case XS_ENG_SIDPLAY1: |
293 case XS_ENG_SIDPLAY2: | |
294 if (!g_strcasecmp(ext, "psid")) | 294 if (!g_strcasecmp(ext, "psid")) |
295 return TRUE; | 295 return TRUE; |
296 if (!g_strcasecmp(ext, "sid")) | 296 if (!g_strcasecmp(ext, "sid")) |
297 return TRUE; | 297 return TRUE; |
298 if (!g_strcasecmp(ext, "dat")) | 298 if (!g_strcasecmp(ext, "dat")) |
299 return TRUE; | 299 return TRUE; |
300 if (!g_strcasecmp(ext, "inf")) | 300 if (!g_strcasecmp(ext, "inf")) |
301 return TRUE; | 301 return TRUE; |
302 if (!g_strcasecmp(ext, "info")) | 302 if (!g_strcasecmp(ext, "info")) |
303 return TRUE; | |
304 break; | |
305 | |
306 case XS_ENG_SIDPLAY2: | |
307 case XS_ENG_SIDPLAYFP: | |
308 if (!g_strcasecmp(ext, "sid")) | |
303 return TRUE; | 309 return TRUE; |
304 break; | 310 break; |
305 } | 311 } |
306 } | 312 } |
307 | 313 |