From 9393e4c24b4c18d7fe1fa8313008f30370cb726e Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Fri, 26 Nov 2010 18:02:50 +0000 Subject: Change how all the metadata parsers are read from a giant swich/case to function pointers via array index. Also unify the api. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28672 a1c6a512-1295-4272-9138-f99709370657 --- apps/metadata.c | 368 +++++++++------------------------------ apps/metadata.h | 13 +- apps/metadata/asap.c | 3 +- apps/metadata/metadata_parsers.h | 3 +- apps/metadata/monkeys.c | 2 + apps/metadata/mp3.c | 8 +- apps/metadata/mpc.c | 2 + apps/metadata/spc.c | 3 + apps/metadata/wavpack.c | 1 + 9 files changed, 99 insertions(+), 304 deletions(-) diff --git a/apps/metadata.c b/apps/metadata.c index 15b7d9f72b..fb0ce0341c 100644 --- a/apps/metadata.c +++ b/apps/metadata.c @@ -37,154 +37,171 @@ #include "metadata/metadata_common.h" +static bool get_shn_metadata(int fd, struct mp3entry *id3) +{ + /* TODO: read the id3v2 header if it exists */ + id3->vbr = true; + id3->filesize = filesize(fd); + return skip_id3v2(fd, id3); +} + +static bool get_other_asap_metadata(int fd, struct mp3entry *id3) +{ + id3->bitrate = 706; + id3->frequency = 44100; + id3->vbr = false; + id3->filesize = filesize(fd); + id3->genre_string = id3_get_num_genre(36); + return true; +} #endif /* CONFIG_CODEC == SWCODEC */ const struct afmt_entry audio_formats[AFMT_NUM_CODECS] = { /* Unknown file format */ [AFMT_UNKNOWN] = - AFMT_ENTRY("???", NULL, NULL, NULL ), + AFMT_ENTRY("???", NULL, NULL, NULL, NULL ), /* MPEG Audio layer 1 */ [AFMT_MPA_L1] = - AFMT_ENTRY("MP1", "mpa", NULL, "mp1\0" ), + AFMT_ENTRY("MP1", "mpa", NULL, get_mp3_metadata, "mp1\0"), /* MPEG Audio layer 2 */ [AFMT_MPA_L2] = - AFMT_ENTRY("MP2", "mpa", NULL, "mpa\0mp2\0" ), + AFMT_ENTRY("MP2", "mpa", NULL, get_mp3_metadata, "mpa\0mp2\0"), /* MPEG Audio layer 3 */ [AFMT_MPA_L3] = - AFMT_ENTRY("MP3", "mpa", "mp3_enc", "mp3\0" ), + AFMT_ENTRY("MP3", "mpa", "mp3_enc", get_mp3_metadata, "mp3\0"), #if CONFIG_CODEC == SWCODEC /* Audio Interchange File Format */ [AFMT_AIFF] = - AFMT_ENTRY("AIFF", "aiff", "aiff_enc", "aiff\0aif\0"), + AFMT_ENTRY("AIFF", "aiff", "aiff_enc", get_aiff_metadata, "aiff\0aif\0"), /* Uncompressed PCM in a WAV file OR ATRAC3 stream in WAV file (.at3) */ [AFMT_PCM_WAV] = - AFMT_ENTRY("WAV", "wav", "wav_enc", "wav\0at3\0" ), + AFMT_ENTRY("WAV", "wav", "wav_enc", get_wave_metadata, "wav\0at3\0"), /* Ogg Vorbis */ [AFMT_OGG_VORBIS] = - AFMT_ENTRY("Ogg", "vorbis", NULL, "ogg\0oga\0" ), + AFMT_ENTRY("Ogg", "vorbis", NULL, get_ogg_metadata, "ogg\0oga\0"), /* FLAC */ [AFMT_FLAC] = - AFMT_ENTRY("FLAC", "flac", NULL, "flac\0" ), + AFMT_ENTRY("FLAC", "flac", NULL, get_flac_metadata, "flac\0"), /* Musepack */ [AFMT_MPC] = - AFMT_ENTRY("MPC", "mpc", NULL, "mpc\0" ), - /* A/52 (aka AC3) audio */ + AFMT_ENTRY("MPC", "mpc", NULL, get_musepack_metadata,"mpc\0"), + /* A/52 (aka AC3) audio */ [AFMT_A52] = - AFMT_ENTRY("AC3", "a52", NULL, "a52\0ac3\0" ), + AFMT_ENTRY("AC3", "a52", NULL, get_a52_metadata, "a52\0ac3\0"), /* WavPack */ [AFMT_WAVPACK] = - AFMT_ENTRY("WV", "wavpack", "wavpack_enc", "wv\0" ), + AFMT_ENTRY("WV","wavpack","wavpack_enc",get_wavpack_metadata,"wv\0"), /* Apple Lossless Audio Codec */ [AFMT_MP4_ALAC] = - AFMT_ENTRY("ALAC", "alac", NULL, "m4a\0m4b\0" ), + AFMT_ENTRY("ALAC", "alac", NULL, get_mp4_metadata, "m4a\0m4b\0"), /* Advanced Audio Coding in M4A container */ [AFMT_MP4_AAC] = - AFMT_ENTRY("AAC", "aac", NULL, "mp4\0" ), + AFMT_ENTRY("AAC", "aac", NULL, get_mp4_metadata, "mp4\0"), /* Shorten */ [AFMT_SHN] = - AFMT_ENTRY("SHN", "shorten", NULL, "shn\0" ), + AFMT_ENTRY("SHN","shorten", NULL, get_shn_metadata, "shn\0"), /* SID File Format */ [AFMT_SID] = - AFMT_ENTRY("SID", "sid", NULL, "sid\0" ), + AFMT_ENTRY("SID", "sid", NULL, get_sid_metadata, "sid\0"), /* ADX File Format */ [AFMT_ADX] = - AFMT_ENTRY("ADX", "adx", NULL, "adx\0" ), + AFMT_ENTRY("ADX", "adx", NULL, get_adx_metadata, "adx\0"), /* NESM (NES Sound Format) */ [AFMT_NSF] = - AFMT_ENTRY("NSF", "nsf", NULL, "nsf\0nsfe\0" ), - /* Speex File Format */ + AFMT_ENTRY("NSF", "nsf", NULL, get_nsf_metadata, "nsf\0nsfe\0"), + /* Speex File Format */ [AFMT_SPEEX] = - AFMT_ENTRY("Speex","speex", NULL, "spx\0" ), + AFMT_ENTRY("Speex", "speex",NULL, get_ogg_metadata, "spx\0"), /* SPC700 Save State */ [AFMT_SPC] = - AFMT_ENTRY("SPC", "spc", NULL, "spc\0" ), + AFMT_ENTRY("SPC", "spc", NULL, get_spc_metadata, "spc\0"), /* APE (Monkey's Audio) */ [AFMT_APE] = - AFMT_ENTRY("APE", "ape", NULL, "ape\0mac\0" ), + AFMT_ENTRY("APE", "ape", NULL, get_monkeys_metadata,"ape\0mac\0"), /* WMA (WMAV1/V2 in ASF) */ [AFMT_WMA] = - AFMT_ENTRY("WMA", "wma", NULL, "wma\0wmv\0asf\0" ), + AFMT_ENTRY("WMA", "wma", NULL, get_asf_metadata,"wma\0wmv\0asf\0"), /* WMA Professional in ASF */ [AFMT_WMAPRO] = - AFMT_ENTRY("WMAPro", "wmapro", NULL, "wma\0wmv\0asf\0" ), + AFMT_ENTRY("WMAPro","wmapro",NULL, NULL, "wma\0wmv\0asf\0"), /* Amiga MOD File */ [AFMT_MOD] = - AFMT_ENTRY("MOD", "mod", NULL, "mod\0" ), + AFMT_ENTRY("MOD", "mod", NULL, get_mod_metadata, "mod\0"), /* Atari SAP File */ [AFMT_SAP] = - AFMT_ENTRY("SAP", "asap", NULL, "sap\0" ), + AFMT_ENTRY("SAP", "asap", NULL, get_asap_metadata, "sap\0"), /* Cook in RM/RA */ [AFMT_RM_COOK] = - AFMT_ENTRY("Cook", "cook", NULL, "rm\0ra\0rmvb\0" ), + AFMT_ENTRY("Cook", "cook", NULL, get_rm_metadata,"rm\0ra\0rmvb\0"), /* AAC in RM/RA */ [AFMT_RM_AAC] = - AFMT_ENTRY("RAAC", "raac", NULL, "rm\0ra\0rmvb\0" ), + AFMT_ENTRY("RAAC", "raac", NULL, NULL, "rm\0ra\0rmvb\0"), /* AC3 in RM/RA */ [AFMT_RM_AC3] = - AFMT_ENTRY("AC3", "a52_rm", NULL, "rm\0ra\0rmvb\0" ), + AFMT_ENTRY("AC3", "a52_rm", NULL, NULL, "rm\0ra\0rmvb\0"), /* ATRAC3 in RM/RA */ [AFMT_RM_ATRAC3] = - AFMT_ENTRY("ATRAC3","atrac3_rm", NULL, "rm\0ra\0rmvb\0" ), + AFMT_ENTRY("ATRAC3","atrac3_rm",NULL, NULL, "rm\0ra\0rmvb\0"), /* Atari CMC File */ [AFMT_CMC] = - AFMT_ENTRY("CMC", "asap", NULL, "cmc\0" ), + AFMT_ENTRY("CMC", "asap", NULL, get_other_asap_metadata,"cmc\0"), /* Atari CM3 File */ [AFMT_CM3] = - AFMT_ENTRY("CM3", "asap", NULL, "cm3\0" ), + AFMT_ENTRY("CM3", "asap", NULL, get_other_asap_metadata,"cm3\0"), /* Atari CMR File */ [AFMT_CMR] = - AFMT_ENTRY("CMR", "asap", NULL, "cmr\0" ), + AFMT_ENTRY("CMR", "asap", NULL, get_other_asap_metadata,"cmr\0"), /* Atari CMS File */ [AFMT_CMS] = - AFMT_ENTRY("CMS", "asap", NULL, "cms\0" ), + AFMT_ENTRY("CMS", "asap", NULL, get_other_asap_metadata,"cms\0"), /* Atari DMC File */ [AFMT_DMC] = - AFMT_ENTRY("DMC", "asap", NULL, "dmc\0" ), + AFMT_ENTRY("DMC", "asap", NULL, get_other_asap_metadata,"dmc\0"), /* Atari DLT File */ [AFMT_DLT] = - AFMT_ENTRY("DLT", "asap", NULL, "dlt\0" ), + AFMT_ENTRY("DLT", "asap", NULL, get_other_asap_metadata,"dlt\0"), /* Atari MPT File */ [AFMT_MPT] = - AFMT_ENTRY("MPT", "asap", NULL, "mpt\0" ), + AFMT_ENTRY("MPT", "asap", NULL, get_other_asap_metadata,"mpt\0"), /* Atari MPD File */ [AFMT_MPD] = - AFMT_ENTRY("MPD", "asap", NULL, "mpd\0" ), + AFMT_ENTRY("MPD", "asap", NULL, get_other_asap_metadata,"mpd\0"), /* Atari RMT File */ - [AFMT_RMT] = - AFMT_ENTRY("RMT", "asap", NULL, "rmt\0" ), + [AFMT_RMT] = + AFMT_ENTRY("RMT", "asap", NULL, get_other_asap_metadata,"rmt\0"), /* Atari TMC File */ [AFMT_TMC] = - AFMT_ENTRY("TMC", "asap", NULL, "tmc\0" ), + AFMT_ENTRY("TMC", "asap", NULL, get_other_asap_metadata,"tmc\0"), /* Atari TM8 File */ [AFMT_TM8] = - AFMT_ENTRY("TM8", "asap", NULL, "tm8\0" ), + AFMT_ENTRY("TM8", "asap", NULL, get_other_asap_metadata,"tm8\0"), /* Atari TM2 File */ [AFMT_TM2] = - AFMT_ENTRY("TM2", "asap", NULL, "tm2\0" ), + AFMT_ENTRY("TM2", "asap", NULL, get_other_asap_metadata,"tm2\0"), /* Atrac3 in Sony OMA Container */ [AFMT_OMA_ATRAC3] = - AFMT_ENTRY("ATRAC3", "atrac3_oma", NULL, "oma\0aa3\0" ), + AFMT_ENTRY("ATRAC3","atrac3_oma",NULL, get_oma_metadata, "oma\0aa3\0"), /* SMAF (Synthetic music Mobile Application Format) */ [AFMT_SMAF] = - AFMT_ENTRY("SMAF", "smaf", NULL, "mmf\0" ), + AFMT_ENTRY("SMAF", "smaf", NULL, get_smaf_metadata, "mmf\0"), /* Sun Audio file */ [AFMT_AU] = - AFMT_ENTRY("AU", "au", NULL, "au\0snd\0" ), + AFMT_ENTRY("AU", "au", NULL, get_au_metadata, "au\0snd\0"), /* VOX (Dialogic telephony file formats) */ [AFMT_VOX] = - AFMT_ENTRY("VOX", "vox", NULL, "vox\0" ), + AFMT_ENTRY("VOX", "vox", NULL, get_vox_metadata, "vox\0"), /* Wave64 */ [AFMT_WAVE64] = - AFMT_ENTRY("WAVE64", "wav64", NULL, "w64\0" ), + AFMT_ENTRY("WAVE64","wav64",NULL, get_wave64_metadata,"w64\0"), /* True Audio */ - [AFMT_TTA] = - AFMT_ENTRY("TTA", "tta", NULL, "tta\0" ), + [AFMT_TTA] = + AFMT_ENTRY("TTA", "tta", NULL, get_tta_metadata, "tta\0"), /* WMA Voice in ASF */ [AFMT_WMAVOICE] = - AFMT_ENTRY("WMAVoice", "wmavoice", NULL, "wma\0wmv\0asf\0" ), + AFMT_ENTRY("WMAVoice","wmavoice",NULL, NULL, "wma\0wmv\0"), #endif }; @@ -261,7 +278,7 @@ bool mp3info(struct mp3entry *entry, const char *filename) if (fd < 0) return true; - result = !get_mp3_metadata(fd, entry, filename); + result = !get_mp3_metadata(fd, entry); close(fd); @@ -273,255 +290,30 @@ bool mp3info(struct mp3entry *entry, const char *filename) */ bool get_metadata(struct mp3entry* id3, int fd, const char* trackname) { + const struct afmt_entry *entry; /* Clear the mp3entry to avoid having bogus pointers appear */ memset(id3, 0, sizeof(struct mp3entry)); /* Take our best guess at the codec type based on file extension */ id3->codectype = probe_file_format(trackname); + entry = &audio_formats[id3->codectype]; + /* Load codec specific track tag information and confirm the codec type. */ - switch (id3->codectype) + if (!entry->parse_func) { - case AFMT_MPA_L1: - case AFMT_MPA_L2: - case AFMT_MPA_L3: - if (!get_mp3_metadata(fd, id3, trackname)) - { - return false; - } - - break; - -#if CONFIG_CODEC == SWCODEC - case AFMT_FLAC: - if (!get_flac_metadata(fd, id3)) - { - return false; - } - - break; - - case AFMT_WMA: - if (!get_asf_metadata(fd, id3)) - { - return false; - } - break; - - case AFMT_APE: - if (!get_monkeys_metadata(fd, id3)) - { - return false; - } - read_ape_tags(fd, id3); - break; - - case AFMT_MPC: - if (!get_musepack_metadata(fd, id3)) - return false; - read_ape_tags(fd, id3); - break; - - case AFMT_OGG_VORBIS: - case AFMT_SPEEX: - if (!get_ogg_metadata(fd, id3))/*detects and handles Ogg/Speex files*/ - { - return false; - } - - break; - - case AFMT_PCM_WAV: - if (!get_wave_metadata(fd, id3)) - { - return false; - } - - break; - - case AFMT_WAVPACK: - if (!get_wavpack_metadata(fd, id3)) - { - return false; - } - - read_ape_tags(fd, id3); /* use any apetag info we find */ - break; - - case AFMT_A52: - if (!get_a52_metadata(fd, id3)) - { - return false; - } - - break; - - case AFMT_MP4_ALAC: - case AFMT_MP4_AAC: - if (!get_mp4_metadata(fd, id3)) - { - return false; - } - - break; - - case AFMT_MOD: - if (!get_mod_metadata(fd, id3)) - { - return false; - } - - break; - - case AFMT_SHN: - id3->vbr = true; - id3->filesize = filesize(fd); - if (!skip_id3v2(fd, id3)) - { - return false; - } - /* TODO: read the id3v2 header if it exists */ - break; - - case AFMT_SID: - if (!get_sid_metadata(fd, id3)) - { - return false; - } - break; - - case AFMT_SPC: - if (!get_spc_metadata(fd, id3)) - { - DEBUGF("get_spc_metadata error\n"); - return false; - } - id3->filesize = filesize(fd); - id3->genre_string = id3_get_num_genre(36); - break; - - case AFMT_ADX: - if (!get_adx_metadata(fd, id3)) - { - DEBUGF("get_adx_metadata error\n"); - return false; - } - - break; - - case AFMT_NSF: - if (!get_nsf_metadata(fd, id3)) - { - DEBUGF("get_nsf_metadata error\n"); - return false; - } - break; - - case AFMT_AIFF: - if (!get_aiff_metadata(fd, id3)) - { - return false; - } - - break; - - case AFMT_SAP: - if (!get_asap_metadata(fd, id3)) - { - DEBUGF("get_sap_metadata error\n"); - return false; - } - id3->filesize = filesize(fd); - id3->genre_string = id3_get_num_genre(36); - break; - - case AFMT_CMC: - case AFMT_CM3: - case AFMT_CMR: - case AFMT_CMS: - case AFMT_DMC: - case AFMT_DLT: - case AFMT_MPT: - case AFMT_MPD: - case AFMT_RMT: - case AFMT_TMC: - case AFMT_TM8: - case AFMT_TM2: - id3->bitrate = 706; - id3->frequency = 44100; - id3->vbr = false; - id3->filesize = filesize(fd); - id3->genre_string = id3_get_num_genre(36); - break; - case AFMT_RM_COOK: - if (!get_rm_metadata(fd, id3)) - { - DEBUGF("get_rm_metadata error\n"); - return false; - } - break; - case AFMT_OMA_ATRAC3: - if (!get_oma_metadata(fd, id3)) - { - DEBUGF("get_oma_metadata error\n"); - return false; - } - break; - - case AFMT_SMAF: - if (!get_smaf_metadata(fd, id3)) - { - DEBUGF("get_smaf_metadata error\n"); - return false; - } - break; + DEBUGF("nothing to parse for %s (format %s)", trackname, entry->label); + return false; + } - case AFMT_AU: - if (!get_au_metadata(fd, id3)) - { - DEBUGF("get_au_metadata error\n"); - return false; - } - break; - - case AFMT_VOX: - if (!get_vox_metadata(fd, id3)) - { - DEBUGF("get_vox_metadata error\n"); - return false; - } - break; - - case AFMT_WAVE64: - if (!get_wave64_metadata(fd, id3)) - { - DEBUGF("get_wave64_metadata error\n"); - return false; - } - break; - - case AFMT_TTA: - if (!get_tta_metadata(fd, id3)) - { - DEBUGF("get_tta_metadata error\n"); - return false; - } - break; - -#endif /* CONFIG_CODEC == SWCODEC */ - - default: - /* If we don't know how to read the metadata, assume we can't play - the file */ + if (!entry->parse_func(fd, id3)) + { + DEBUGF("parsing %s failed (format: %s)", trackname, entry->label); return false; - break; } - /* We have successfully read the metadata from the file */ - - lseek(fd, 0, SEEK_SET); strlcpy(id3->path, trackname, sizeof(id3->path)); - + /* We have successfully read the metadata from the file */ return true; } diff --git a/apps/metadata.h b/apps/metadata.h index 39da30e1a5..e2deece727 100644 --- a/apps/metadata.h +++ b/apps/metadata.h @@ -108,7 +108,6 @@ enum #define CODEC_EXTENSION "codec" #ifdef HAVE_RECORDING -#define ENCODER_SUFFIX "_enc" enum rec_format_indexes { __REC_FORMAT_START_INDEX = -1, @@ -139,11 +138,11 @@ extern const int rec_format_afmt[REC_NUM_FORMATS]; /* get AFMT_* corresponding REC_FORMAT_* */ extern const int afmt_rec_format[AFMT_NUM_CODECS]; -#define AFMT_ENTRY(label, root_fname, enc_root_fname, ext_list) \ - { label, root_fname, enc_root_fname, ext_list } +#define AFMT_ENTRY(label, root_fname, enc_root_fname, func, ext_list) \ + { label, root_fname, enc_root_fname, func, ext_list } #else /* !HAVE_RECORDING */ -#define AFMT_ENTRY(label, root_fname, enc_root_fname, ext_list) \ - { label, root_fname, ext_list } +#define AFMT_ENTRY(label, root_fname, enc_root_fname, func, ext_list) \ + { label, root_fname, func, ext_list } #endif /* HAVE_RECORDING */ #else /* !SWCODEC */ @@ -154,6 +153,7 @@ extern const int afmt_rec_format[AFMT_NUM_CODECS]; /** Database of audio formats **/ /* record describing the audio format */ +struct mp3entry; struct afmt_entry { const char *label; /* format label */ @@ -163,7 +163,8 @@ struct afmt_entry const char *codec_enc_root_fn; /* filename of encoder codec */ #endif #endif - const char *ext_list; /* double NULL terminated extension + bool (*parse_func)(int fd, struct mp3entry *id3); /* return true on success */ + const char *ext_list; /* NULL terminated extension list for type with the first as the default for recording */ }; diff --git a/apps/metadata/asap.c b/apps/metadata/asap.c index 0472798462..9e7f227031 100644 --- a/apps/metadata/asap.c +++ b/apps/metadata/asap.c @@ -248,6 +248,7 @@ bool get_asap_metadata(int fd, struct mp3entry* id3) id3->vbr = false; id3->filesize = filelength; - + id3->genre_string = id3_get_num_genre(36); + return true; } diff --git a/apps/metadata/metadata_parsers.h b/apps/metadata/metadata_parsers.h index 7238b71a30..7797b47094 100644 --- a/apps/metadata/metadata_parsers.h +++ b/apps/metadata/metadata_parsers.h @@ -23,8 +23,7 @@ char* id3_get_num_genre(unsigned int genre_num); int getid3v2len(int fd); bool setid3v1title(int fd, struct mp3entry *entry); void setid3v2title(int fd, struct mp3entry *entry); -bool get_mp3_metadata(int fd, struct mp3entry* id3, const char *filename); - +bool get_mp3_metadata(int fd, struct mp3entry* id3); bool get_adx_metadata(int fd, struct mp3entry* id3); bool get_aiff_metadata(int fd, struct mp3entry* id3); bool get_flac_metadata(int fd, struct mp3entry* id3); diff --git a/apps/metadata/monkeys.c b/apps/metadata/monkeys.c index 1cacff13af..4aff1412aa 100644 --- a/apps/metadata/monkeys.c +++ b/apps/metadata/monkeys.c @@ -91,5 +91,7 @@ bool get_monkeys_metadata(int fd, struct mp3entry* id3) id3->length = ((int64_t) totalsamples * 1000) / id3->frequency; id3->bitrate = (id3->filesize * 8) / id3->length; + + read_ape_tags(fd, id3); return true; } diff --git a/apps/metadata/mp3.c b/apps/metadata/mp3.c index c65fb39cd8..9309242604 100644 --- a/apps/metadata/mp3.c +++ b/apps/metadata/mp3.c @@ -163,14 +163,8 @@ static int getsonglength(int fd, struct mp3entry *entry) * about an MP3 file and updates it's entry accordingly. * Note, that this returns true for successful, false for error! */ -bool get_mp3_metadata(int fd, struct mp3entry *entry, const char *filename) +bool get_mp3_metadata(int fd, struct mp3entry *entry) { -#if CONFIG_CODEC != SWCODEC - memset(entry, 0, sizeof(struct mp3entry)); -#endif - - strlcpy(entry->path, filename, sizeof(entry->path)); - entry->title = NULL; entry->filesize = filesize(fd); entry->id3v2len = getid3v2len(fd); diff --git a/apps/metadata/mpc.c b/apps/metadata/mpc.c index c6f3c3df72..f70e1d35df 100644 --- a/apps/metadata/mpc.c +++ b/apps/metadata/mpc.c @@ -211,5 +211,7 @@ bool get_musepack_metadata(int fd, struct mp3entry *id3) id3->filesize = filesize(fd); id3->bitrate = id3->filesize * 8 / id3->length; + + read_ape_tags(fd, id3); return true; } diff --git a/apps/metadata/spc.c b/apps/metadata/spc.c index 786c678c4c..f1fcb81707 100644 --- a/apps/metadata/spc.c +++ b/apps/metadata/spc.c @@ -124,5 +124,8 @@ bool get_spc_metadata(int fd, struct mp3entry* id3) id3->length = length+fade; + id3->filesize = filesize(fd); + id3->genre_string = id3_get_num_genre(36); + return true; } diff --git a/apps/metadata/wavpack.c b/apps/metadata/wavpack.c index a6ab6f2bd5..bb181b8d3f 100644 --- a/apps/metadata/wavpack.c +++ b/apps/metadata/wavpack.c @@ -136,6 +136,7 @@ bool get_wavpack_metadata(int fd, struct mp3entry* id3) id3->length = ((int64_t) totalsamples * 1000) / id3->frequency; id3->bitrate = filesize (fd) / (id3->length / 8); + read_ape_tags(fd, id3); return true; } -- cgit v1.2.3