# HG changeset patch # User Matti Hamalainen # Date 1212113865 -10800 # Node ID 053341c248efd5342eb5da7a79e99707e6dbd31e # Parent 3f931f9337507dedeca86c69b14b42ecff4ebec1 "Fix" demac plugin not to arbitrarily determine that all files belong to it... this plugin could use some serious cleanups, tho. diff -r 3f931f933750 -r 053341c248ef src/demac/plugin.c --- a/src/demac/plugin.c Thu May 29 02:35:19 2008 +0300 +++ b/src/demac/plugin.c Fri May 30 05:17:45 2008 +0300 @@ -274,7 +274,6 @@ Tuple *demac_probe_for_tuple (gchar *uri, VFSFile *vfd) { AUDDBG("** demac: plugin.c: demac_probe_for_tuple()\n"); - Tuple *tpl = aud_tuple_new_from_filename(uri); gchar codec_string[32]; if (aud_vfs_is_streaming(vfd)) { @@ -282,6 +281,15 @@ return NULL; } + APEContext *ctx = calloc(sizeof(APEContext), 1); + aud_vfs_rewind(vfd); + if (ape_read_header(ctx, vfd, 1) < 0) { + free(ctx); + aud_vfs_rewind(vfd); + return NULL; + } + + Tuple *tpl = aud_tuple_new_from_filename(uri); mowgli_dictionary_t *tag = NULL; gchar *item; if ((tag = parse_apev2_tag(vfd)) != NULL) { @@ -294,11 +302,8 @@ if((item = mowgli_dictionary_retrieve(tag, "Year")) != NULL) aud_tuple_associate_int(tpl, FIELD_YEAR, NULL, atoi(item)); } - APEContext *ctx = calloc(sizeof(APEContext), 1); - aud_vfs_rewind(vfd); - ape_read_header(ctx, vfd, 1); aud_tuple_associate_int(tpl, FIELD_LENGTH, NULL, ctx->duration); - g_sprintf(codec_string, "Monkey's Audio v%4.2f", (float)ctx->fileversion/1000.0); + g_snprintf(codec_string, sizeof(codec_string), "Monkey's Audio v%4.2f", (float)ctx->fileversion/1000.0); AUDDBG("** demac: plugin.c: Codec: %s\n", codec_string); aud_tuple_associate_string(tpl, FIELD_CODEC, NULL, codec_string); aud_tuple_associate_string(tpl, FIELD_QUALITY, NULL, "lossless");