diff options
author | Dave Chapman <dave@dchapman.com> | 2005-06-18 16:24:27 +0000 |
---|---|---|
committer | Dave Chapman <dave@dchapman.com> | 2005-06-18 16:24:27 +0000 |
commit | 961c9a3e4103e766f52ff1d7c2af2db6119c72ec (patch) | |
tree | c4fd5b0ea3b7063315910fea159a590e74680ed4 /firmware/id3.c | |
parent | 2bfd2585a9cfb8541047a3f5eedbfd05fe36f9f9 (diff) | |
download | rockbox-961c9a3e4103e766f52ff1d7c2af2db6119c72ec.tar.gz rockbox-961c9a3e4103e766f52ff1d7c2af2db6119c72ec.zip |
Added %fc WPS tag to display codec type - moved codectype from track_info struct into mp3info struct, initialise it on MAS platforms, and add it to the WPS.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6748 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/id3.c')
-rw-r--r-- | firmware/id3.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/firmware/id3.c b/firmware/id3.c index becb6781cc..603639d1f5 100644 --- a/firmware/id3.c +++ b/firmware/id3.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <stdbool.h> | 33 | #include <stdbool.h> |
34 | #include <stddef.h> | 34 | #include <stddef.h> |
35 | #include <ctype.h> | 35 | #include <ctype.h> |
36 | #include "config.h" | ||
36 | #include "file.h" | 37 | #include "file.h" |
37 | #include "debug.h" | 38 | #include "debug.h" |
38 | #include "atoi.h" | 39 | #include "atoi.h" |
@@ -77,6 +78,31 @@ static const char* const genres[] = { | |||
77 | "Duet", "Punk Rock", "Drum Solo", "A capella", "Euro-House", "Dance Hall" | 78 | "Duet", "Punk Rock", "Drum Solo", "A capella", "Euro-House", "Dance Hall" |
78 | }; | 79 | }; |
79 | 80 | ||
81 | static const char* const codec_labels[] = { | ||
82 | "???", /* Unknown file format */ | ||
83 | |||
84 | #if CONFIG_HWCODEC==MASNONE | ||
85 | "MP1", /* MPEG Audio layer 1 */ | ||
86 | #endif | ||
87 | |||
88 | "MP2", /* MPEG Audio layer 2 */ | ||
89 | "MP3", /* MPEG Audio layer 3 */ | ||
90 | |||
91 | #if CONFIG_HWCODEC==MASNONE | ||
92 | "WAV", /* Uncompressed PCM in a WAV file */ | ||
93 | "OGG", /* Ogg Vorbis */ | ||
94 | "FLAC", /* FLAC */ | ||
95 | "MPC", /* Musepack */ | ||
96 | "AAC", /* AAC */ | ||
97 | "APE", /* Monkey's Audio */ | ||
98 | "WMA", /* Windows Media Audio */ | ||
99 | "AC3", /* A/52 (aka AC3) audio */ | ||
100 | "RA", /* Realaudio */ | ||
101 | "WV", /* WavPack */ | ||
102 | #endif | ||
103 | NULL | ||
104 | }; | ||
105 | |||
80 | char* id3_get_genre(const struct mp3entry* id3) | 106 | char* id3_get_genre(const struct mp3entry* id3) |
81 | { | 107 | { |
82 | if( id3->genre_string ) | 108 | if( id3->genre_string ) |
@@ -87,6 +113,15 @@ char* id3_get_genre(const struct mp3entry* id3) | |||
87 | return NULL; | 113 | return NULL; |
88 | } | 114 | } |
89 | 115 | ||
116 | char* id3_get_codec(const struct mp3entry* id3) | ||
117 | { | ||
118 | if ((id3->codectype >= 0) && (id3->codectype < AFMT_ENDMARKER)) { | ||
119 | return (char*)codec_labels[id3->codectype]; | ||
120 | } else { | ||
121 | return NULL; | ||
122 | } | ||
123 | } | ||
124 | |||
90 | /* | 125 | /* |
91 | HOW TO ADD ADDITIONAL ID3 VERSION 2 TAGS | 126 | HOW TO ADD ADDITIONAL ID3 VERSION 2 TAGS |
92 | Code and comments by Thomas Paul Diffenbach | 127 | Code and comments by Thomas Paul Diffenbach |
@@ -763,6 +798,19 @@ static int getsonglength(int fd, struct mp3entry *entry) | |||
763 | entry->frequency = info.frequency; | 798 | entry->frequency = info.frequency; |
764 | entry->version = info.version; | 799 | entry->version = info.version; |
765 | entry->layer = info.layer; | 800 | entry->layer = info.layer; |
801 | switch(entry->layer) { | ||
802 | #if CONFIG_HWCODEC==MASNONE | ||
803 | case 0: | ||
804 | entry->codectype=AFMT_MPA_L1; | ||
805 | break; | ||
806 | #endif | ||
807 | case 1: | ||
808 | entry->codectype=AFMT_MPA_L2; | ||
809 | break; | ||
810 | case 2: | ||
811 | entry->codectype=AFMT_MPA_L3; | ||
812 | break; | ||
813 | } | ||
766 | 814 | ||
767 | /* If the file time hasn't been established, this may be a fixed | 815 | /* If the file time hasn't been established, this may be a fixed |
768 | rate MP3, so just use the default formula */ | 816 | rate MP3, so just use the default formula */ |