diff options
author | Miika Pekkarinen <miipekk@ihme.org> | 2006-03-26 11:33:42 +0000 |
---|---|---|
committer | Miika Pekkarinen <miipekk@ihme.org> | 2006-03-26 11:33:42 +0000 |
commit | 7c4e0c8730d5b076d4db4206361bc38d5256a23f (patch) | |
tree | 43382ae25de9bfa0bbabdff7d51c32b651ad47b5 /apps/metadata.c | |
parent | 50d40ea43409745bc828e56af5e3879ea6b48cf1 (diff) | |
download | rockbox-7c4e0c8730d5b076d4db4206361bc38d5256a23f.tar.gz rockbox-7c4e0c8730d5b076d4db4206361bc38d5256a23f.zip |
Initial version of tagcache! There are still some bugs in the engine
and much more problems with the UI.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9256 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/metadata.c')
-rw-r--r-- | apps/metadata.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/apps/metadata.c b/apps/metadata.c index 5481cbef58..09ccb3928d 100644 --- a/apps/metadata.c +++ b/apps/metadata.c | |||
@@ -68,6 +68,7 @@ static const struct format_list formats[] = | |||
68 | { AFMT_MPA_L2, "mp2" }, | 68 | { AFMT_MPA_L2, "mp2" }, |
69 | { AFMT_MPA_L2, "mpa" }, | 69 | { AFMT_MPA_L2, "mpa" }, |
70 | { AFMT_MPA_L3, "mp3" }, | 70 | { AFMT_MPA_L3, "mp3" }, |
71 | #if CONFIG_CODEC == SWCODEC | ||
71 | { AFMT_OGG_VORBIS, "ogg" }, | 72 | { AFMT_OGG_VORBIS, "ogg" }, |
72 | { AFMT_PCM_WAV, "wav" }, | 73 | { AFMT_PCM_WAV, "wav" }, |
73 | { AFMT_FLAC, "flac" }, | 74 | { AFMT_FLAC, "flac" }, |
@@ -80,8 +81,10 @@ static const struct format_list formats[] = | |||
80 | { AFMT_SHN, "shn" }, | 81 | { AFMT_SHN, "shn" }, |
81 | { AFMT_AIFF, "aif" }, | 82 | { AFMT_AIFF, "aif" }, |
82 | { AFMT_AIFF, "aiff" }, | 83 | { AFMT_AIFF, "aiff" }, |
84 | #endif | ||
83 | }; | 85 | }; |
84 | 86 | ||
87 | #if CONFIG_CODEC == SWCODEC | ||
85 | static const unsigned short a52_bitrates[] = | 88 | static const unsigned short a52_bitrates[] = |
86 | { | 89 | { |
87 | 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, | 90 | 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, |
@@ -1246,6 +1249,7 @@ static bool get_musepack_metadata(int fd, struct mp3entry *id3) | |||
1246 | id3->bitrate = id3->filesize*8/id3->length; | 1249 | id3->bitrate = id3->filesize*8/id3->length; |
1247 | return true; | 1250 | return true; |
1248 | } | 1251 | } |
1252 | #endif /* CONFIG_CODEC == SWCODEC */ | ||
1249 | 1253 | ||
1250 | static bool get_aiff_metadata(int fd, struct mp3entry* id3) | 1254 | static bool get_aiff_metadata(int fd, struct mp3entry* id3) |
1251 | { | 1255 | { |
@@ -1318,7 +1322,7 @@ static bool get_aiff_metadata(int fd, struct mp3entry* id3) | |||
1318 | } | 1322 | } |
1319 | 1323 | ||
1320 | /* Simple file type probing by looking at the filename extension. */ | 1324 | /* Simple file type probing by looking at the filename extension. */ |
1321 | static unsigned int probe_file_format(const char *filename) | 1325 | unsigned int probe_file_format(const char *filename) |
1322 | { | 1326 | { |
1323 | char *suffix; | 1327 | char *suffix; |
1324 | unsigned int i; | 1328 | unsigned int i; |
@@ -1349,9 +1353,11 @@ static unsigned int probe_file_format(const char *filename) | |||
1349 | bool get_metadata(struct track_info* track, int fd, const char* trackname, | 1353 | bool get_metadata(struct track_info* track, int fd, const char* trackname, |
1350 | bool v1first) | 1354 | bool v1first) |
1351 | { | 1355 | { |
1356 | #if CONFIG_CODEC == SWCODEC | ||
1352 | unsigned char* buf; | 1357 | unsigned char* buf; |
1353 | unsigned long totalsamples; | 1358 | unsigned long totalsamples; |
1354 | int i; | 1359 | int i; |
1360 | #endif | ||
1355 | 1361 | ||
1356 | /* Take our best guess at the codec type based on file extension */ | 1362 | /* Take our best guess at the codec type based on file extension */ |
1357 | track->id3.codectype = probe_file_format(trackname); | 1363 | track->id3.codectype = probe_file_format(trackname); |
@@ -1369,6 +1375,7 @@ bool get_metadata(struct track_info* track, int fd, const char* trackname, | |||
1369 | 1375 | ||
1370 | break; | 1376 | break; |
1371 | 1377 | ||
1378 | #if CONFIG_CODEC == SWCODEC | ||
1372 | case AFMT_FLAC: | 1379 | case AFMT_FLAC: |
1373 | if (!get_flac_metadata(fd, &(track->id3))) | 1380 | if (!get_flac_metadata(fd, &(track->id3))) |
1374 | { | 1381 | { |
@@ -1519,6 +1526,7 @@ bool get_metadata(struct track_info* track, int fd, const char* trackname, | |||
1519 | } | 1526 | } |
1520 | /* TODO: read the id3v2 header if it exists */ | 1527 | /* TODO: read the id3v2 header if it exists */ |
1521 | break; | 1528 | break; |
1529 | #endif /* CONFIG_CODEC == SWCODEC */ | ||
1522 | 1530 | ||
1523 | case AFMT_AIFF: | 1531 | case AFMT_AIFF: |
1524 | if (!get_aiff_metadata(fd, &(track->id3))) | 1532 | if (!get_aiff_metadata(fd, &(track->id3))) |
@@ -1543,3 +1551,4 @@ bool get_metadata(struct track_info* track, int fd, const char* trackname, | |||
1543 | 1551 | ||
1544 | return true; | 1552 | return true; |
1545 | } | 1553 | } |
1554 | |||