diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2020-07-17 00:01:32 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2020-07-24 21:20:13 +0000 |
commit | 8cb555460ff79e636a7907fb2589e16db98c8600 (patch) | |
tree | 930a3878c7641c9ce045b24f0ade1309e36d5806 /lib/rbcodec | |
parent | 0c4f89370d05056faa789aa9cabcccc4e509fb9f (diff) | |
download | rockbox-8cb555460ff79e636a7907fb2589e16db98c8600.tar.gz rockbox-8cb555460ff79e636a7907fb2589e16db98c8600.zip |
[3/4] Completely remove HWCODEC support
'swcodec' is now always set (and recording_swcodec for recording-capable
units) in feature.txt so the manual and language strings don't need to
all be fixed up.
Change-Id: Ib2c9d5d157af8d33653e2d4b4a12881b9aa6ddb0
Diffstat (limited to 'lib/rbcodec')
-rw-r--r-- | lib/rbcodec/SOURCES | 2 | ||||
-rw-r--r-- | lib/rbcodec/codecs/codecs.h | 10 | ||||
-rw-r--r-- | lib/rbcodec/codecs/lib/SOURCES | 3 | ||||
-rw-r--r-- | lib/rbcodec/metadata/id3tags.c | 24 | ||||
-rw-r--r-- | lib/rbcodec/metadata/metadata.c | 23 | ||||
-rw-r--r-- | lib/rbcodec/metadata/metadata.h | 19 | ||||
-rw-r--r-- | lib/rbcodec/metadata/metadata_parsers.h | 4 | ||||
-rw-r--r-- | lib/rbcodec/metadata/mp3.c | 4 | ||||
-rw-r--r-- | lib/rbcodec/metadata/mp3data.c | 13 | ||||
-rw-r--r-- | lib/rbcodec/rbcodec.make | 4 |
10 files changed, 16 insertions, 90 deletions
diff --git a/lib/rbcodec/SOURCES b/lib/rbcodec/SOURCES index 9180237632..c288bb6de4 100644 --- a/lib/rbcodec/SOURCES +++ b/lib/rbcodec/SOURCES | |||
@@ -2,7 +2,6 @@ metadata/metadata.c | |||
2 | metadata/id3tags.c | 2 | metadata/id3tags.c |
3 | metadata/mp3.c | 3 | metadata/mp3.c |
4 | metadata/mp3data.c | 4 | metadata/mp3data.c |
5 | #if CONFIG_CODEC == SWCODEC | ||
6 | dsp/channel_mode.c | 5 | dsp/channel_mode.c |
7 | dsp/compressor.c | 6 | dsp/compressor.c |
8 | dsp/crossfeed.c | 7 | dsp/crossfeed.c |
@@ -64,4 +63,3 @@ metadata/vox.c | |||
64 | metadata/wave.c | 63 | metadata/wave.c |
65 | metadata/wavpack.c | 64 | metadata/wavpack.c |
66 | metadata/aac.c | 65 | metadata/aac.c |
67 | #endif | ||
diff --git a/lib/rbcodec/codecs/codecs.h b/lib/rbcodec/codecs/codecs.h index e04727fea8..6048e5012c 100644 --- a/lib/rbcodec/codecs/codecs.h +++ b/lib/rbcodec/codecs/codecs.h | |||
@@ -34,14 +34,12 @@ | |||
34 | #include "profile.h" | 34 | #include "profile.h" |
35 | #include "thread.h" | 35 | #include "thread.h" |
36 | #endif | 36 | #endif |
37 | #if (CONFIG_CODEC == SWCODEC) | ||
38 | #ifdef HAVE_RECORDING | 37 | #ifdef HAVE_RECORDING |
39 | #include "enc_base.h" | 38 | #include "enc_base.h" |
40 | #endif | 39 | #endif |
41 | #include "dsp_core.h" | 40 | #include "dsp_core.h" |
42 | #include "dsp_misc.h" | 41 | #include "dsp_misc.h" |
43 | #include "dsp-util.h" | 42 | #include "dsp-util.h" |
44 | #endif | ||
45 | 43 | ||
46 | #include "gcc_extensions.h" | 44 | #include "gcc_extensions.h" |
47 | #include "load_code.h" | 45 | #include "load_code.h" |
@@ -281,18 +279,18 @@ int codec_load_buf(int hid, struct codec_api *api); | |||
281 | int codec_load_file(const char* codec, struct codec_api *api); | 279 | int codec_load_file(const char* codec, struct codec_api *api); |
282 | int codec_run_proc(void); | 280 | int codec_run_proc(void); |
283 | int codec_close(void); | 281 | int codec_close(void); |
284 | #if CONFIG_CODEC == SWCODEC && defined(HAVE_RECORDING) | 282 | #if defined(HAVE_RECORDING) |
285 | enc_callback_t codec_get_enc_callback(void); | 283 | enc_callback_t codec_get_enc_callback(void); |
286 | #else | ||
287 | #define codec_get_enc_callback() NULL | ||
288 | #endif | 284 | #endif |
289 | 285 | ||
290 | /* defined by the codec */ | 286 | /* defined by the codec */ |
291 | enum codec_status codec_start(enum codec_entry_call_reason reason); | 287 | enum codec_status codec_start(enum codec_entry_call_reason reason); |
292 | enum codec_status codec_main(enum codec_entry_call_reason reason); | 288 | enum codec_status codec_main(enum codec_entry_call_reason reason); |
293 | enum codec_status codec_run(void); | 289 | enum codec_status codec_run(void); |
294 | #if CONFIG_CODEC == SWCODEC && defined(HAVE_RECORDING) | 290 | #if defined(HAVE_RECORDING) |
295 | int enc_callback(enum enc_callback_reason reason, void *params); | 291 | int enc_callback(enum enc_callback_reason reason, void *params); |
292 | #else | ||
293 | #define codec_get_enc_callback() NULL | ||
296 | #endif | 294 | #endif |
297 | 295 | ||
298 | #endif /* _CODECS_H_ */ | 296 | #endif /* _CODECS_H_ */ |
diff --git a/lib/rbcodec/codecs/lib/SOURCES b/lib/rbcodec/codecs/lib/SOURCES index f4b951a5eb..ffa7184019 100644 --- a/lib/rbcodec/codecs/lib/SOURCES +++ b/lib/rbcodec/codecs/lib/SOURCES | |||
@@ -1,4 +1,3 @@ | |||
1 | #if CONFIG_CODEC == SWCODEC /* software codec platforms */ | ||
2 | codeclib.c | 1 | codeclib.c |
3 | ffmpeg_bitstream.c | 2 | ffmpeg_bitstream.c |
4 | 3 | ||
@@ -6,6 +5,6 @@ mdct_lookup.c | |||
6 | fft-ffmpeg.c | 5 | fft-ffmpeg.c |
7 | mdct.c | 6 | mdct.c |
8 | 7 | ||
9 | #elif (CONFIG_PLATFORM & PLATFORM_HOSTED) && defined(__APPLE__) | 8 | #if (CONFIG_PLATFORM & PLATFORM_HOSTED) && defined(__APPLE__) |
10 | osx.dummy.c | 9 | osx.dummy.c |
11 | #endif | 10 | #endif |
diff --git a/lib/rbcodec/metadata/id3tags.c b/lib/rbcodec/metadata/id3tags.c index 84b3c593ef..c3a0473e7e 100644 --- a/lib/rbcodec/metadata/id3tags.c +++ b/lib/rbcodec/metadata/id3tags.c | |||
@@ -43,9 +43,7 @@ | |||
43 | 43 | ||
44 | #include "metadata.h" | 44 | #include "metadata.h" |
45 | #include "mp3data.h" | 45 | #include "mp3data.h" |
46 | #if CONFIG_CODEC == SWCODEC | ||
47 | #include "metadata_common.h" | 46 | #include "metadata_common.h" |
48 | #endif | ||
49 | #include "metadata_parsers.h" | 47 | #include "metadata_parsers.h" |
50 | #include "misc.h" | 48 | #include "misc.h" |
51 | 49 | ||
@@ -91,9 +89,6 @@ static const char* const genres[] = { | |||
91 | "Synthpop" | 89 | "Synthpop" |
92 | }; | 90 | }; |
93 | 91 | ||
94 | #if CONFIG_CODEC != SWCODEC | ||
95 | static | ||
96 | #endif | ||
97 | char* id3_get_num_genre(unsigned int genre_num) | 92 | char* id3_get_num_genre(unsigned int genre_num) |
98 | { | 93 | { |
99 | if (genre_num < ARRAYLEN(genres)) | 94 | if (genre_num < ARRAYLEN(genres)) |
@@ -376,23 +371,20 @@ static int parseuser( struct mp3entry* entry, char* tag, int bufferpos ) | |||
376 | /* At least part of the value was read, so we can safely try to | 371 | /* At least part of the value was read, so we can safely try to |
377 | * parse it */ | 372 | * parse it */ |
378 | value = tag + desc_len + 1; | 373 | value = tag + desc_len + 1; |
379 | 374 | ||
380 | if (!strcasecmp(tag, "ALBUM ARTIST")) { | 375 | if (!strcasecmp(tag, "ALBUM ARTIST")) { |
381 | length = strlen(value) + 1; | 376 | length = strlen(value) + 1; |
382 | strlcpy(tag, value, length); | 377 | strlcpy(tag, value, length); |
383 | entry->albumartist = tag; | 378 | entry->albumartist = tag; |
384 | #if CONFIG_CODEC == SWCODEC | ||
385 | } else { | 379 | } else { |
386 | /* Call parse_replaygain(). */ | 380 | /* Call parse_replaygain(). */ |
387 | parse_replaygain(tag, value, entry); | 381 | parse_replaygain(tag, value, entry); |
388 | #endif | ||
389 | } | 382 | } |
390 | } | 383 | } |
391 | 384 | ||
392 | return tag - entry->id3v2buf + length; | 385 | return tag - entry->id3v2buf + length; |
393 | } | 386 | } |
394 | 387 | ||
395 | #if CONFIG_CODEC == SWCODEC | ||
396 | /* parse RVA2 binary data and convert to replaygain information. */ | 388 | /* parse RVA2 binary data and convert to replaygain information. */ |
397 | static int parserva2( struct mp3entry* entry, char* tag, int bufferpos) | 389 | static int parserva2( struct mp3entry* entry, char* tag, int bufferpos) |
398 | { | 390 | { |
@@ -452,13 +444,12 @@ static int parserva2( struct mp3entry* entry, char* tag, int bufferpos) | |||
452 | return start_pos; | 444 | return start_pos; |
453 | } | 445 | } |
454 | } | 446 | } |
455 | 447 | ||
456 | parse_replaygain_int(album, gain, peak * 2, entry); | 448 | parse_replaygain_int(album, gain, peak * 2, entry); |
457 | } | 449 | } |
458 | 450 | ||
459 | return start_pos; | 451 | return start_pos; |
460 | } | 452 | } |
461 | #endif | ||
462 | 453 | ||
463 | static int parsembtid( struct mp3entry* entry, char* tag, int bufferpos ) | 454 | static int parsembtid( struct mp3entry* entry, char* tag, int bufferpos ) |
464 | { | 455 | { |
@@ -514,9 +505,7 @@ static const struct tag_resolver taglist[] = { | |||
514 | { "PIC", 3, 0, &parsealbumart, true }, | 505 | { "PIC", 3, 0, &parsealbumart, true }, |
515 | #endif | 506 | #endif |
516 | { "TXXX", 4, 0, &parseuser, false }, | 507 | { "TXXX", 4, 0, &parseuser, false }, |
517 | #if CONFIG_CODEC == SWCODEC | ||
518 | { "RVA2", 4, 0, &parserva2, true }, | 508 | { "RVA2", 4, 0, &parserva2, true }, |
519 | #endif | ||
520 | { "UFID", 4, 0, &parsembtid, false }, | 509 | { "UFID", 4, 0, &parsembtid, false }, |
521 | }; | 510 | }; |
522 | 511 | ||
@@ -738,9 +727,7 @@ void setid3v2title(int fd, struct mp3entry *entry) | |||
738 | bool unsynch = false; | 727 | bool unsynch = false; |
739 | int i, j; | 728 | int i, j; |
740 | int rc; | 729 | int rc; |
741 | #if CONFIG_CODEC == SWCODEC | ||
742 | bool itunes_gapless = false; | 730 | bool itunes_gapless = false; |
743 | #endif | ||
744 | 731 | ||
745 | #ifdef HAVE_ALBUMART | 732 | #ifdef HAVE_ALBUMART |
746 | entry->has_embedded_albumart = false; | 733 | entry->has_embedded_albumart = false; |
@@ -984,14 +971,11 @@ void setid3v2title(int fd, struct mp3entry *entry) | |||
984 | (tr->tag_length == 3 && !memcmp( header, "COM", 3))) { | 971 | (tr->tag_length == 3 && !memcmp( header, "COM", 3))) { |
985 | int offset; | 972 | int offset; |
986 | if(bytesread >= 8 && !strncmp(tag+4, "iTun", 4)) { | 973 | if(bytesread >= 8 && !strncmp(tag+4, "iTun", 4)) { |
987 | #if CONFIG_CODEC == SWCODEC | ||
988 | /* check for iTunes gapless information */ | 974 | /* check for iTunes gapless information */ |
989 | if(bytesread >= 12 && !strncmp(tag+4, "iTunSMPB", 8)) | 975 | if(bytesread >= 12 && !strncmp(tag+4, "iTunSMPB", 8)) |
990 | itunes_gapless = true; | 976 | itunes_gapless = true; |
991 | else | 977 | else |
992 | #endif | 978 | break; /* ignore other with iTunes tags */ |
993 | /* ignore other with iTunes tags */ | ||
994 | break; | ||
995 | } | 979 | } |
996 | 980 | ||
997 | offset = 3 + unicode_len(*tag, tag + 4); | 981 | offset = 3 + unicode_len(*tag, tag + 4); |
@@ -1071,7 +1055,6 @@ void setid3v2title(int fd, struct mp3entry *entry) | |||
1071 | tag[bytesread] = 0; | 1055 | tag[bytesread] = 0; |
1072 | bufferpos += bytesread + 1; | 1056 | bufferpos += bytesread + 1; |
1073 | 1057 | ||
1074 | #if CONFIG_CODEC == SWCODEC | ||
1075 | /* parse the tag if it contains iTunes gapless info */ | 1058 | /* parse the tag if it contains iTunes gapless info */ |
1076 | if (itunes_gapless) | 1059 | if (itunes_gapless) |
1077 | { | 1060 | { |
@@ -1079,7 +1062,6 @@ void setid3v2title(int fd, struct mp3entry *entry) | |||
1079 | entry->lead_trim = get_itunes_int32(tag, 1); | 1062 | entry->lead_trim = get_itunes_int32(tag, 1); |
1080 | entry->tail_trim = get_itunes_int32(tag, 2); | 1063 | entry->tail_trim = get_itunes_int32(tag, 2); |
1081 | } | 1064 | } |
1082 | #endif | ||
1083 | 1065 | ||
1084 | /* Note that parser functions sometimes set *ptag to NULL, so | 1066 | /* Note that parser functions sometimes set *ptag to NULL, so |
1085 | * the "!*ptag" check here doesn't always have the desired | 1067 | * the "!*ptag" check here doesn't always have the desired |
diff --git a/lib/rbcodec/metadata/metadata.c b/lib/rbcodec/metadata/metadata.c index c24a27df2b..9c41347975 100644 --- a/lib/rbcodec/metadata/metadata.c +++ b/lib/rbcodec/metadata/metadata.c | |||
@@ -29,8 +29,6 @@ | |||
29 | 29 | ||
30 | #include "metadata_parsers.h" | 30 | #include "metadata_parsers.h" |
31 | 31 | ||
32 | #if CONFIG_CODEC == SWCODEC | ||
33 | |||
34 | /* For trailing tag stripping and base audio data types */ | 32 | /* For trailing tag stripping and base audio data types */ |
35 | #include "buffering.h" | 33 | #include "buffering.h" |
36 | 34 | ||
@@ -53,7 +51,6 @@ static bool get_other_asap_metadata(int fd, struct mp3entry *id3) | |||
53 | id3->genre_string = id3_get_num_genre(36); | 51 | id3->genre_string = id3_get_num_genre(36); |
54 | return true; | 52 | return true; |
55 | } | 53 | } |
56 | #endif /* CONFIG_CODEC == SWCODEC */ | ||
57 | bool write_metadata_log = false; | 54 | bool write_metadata_log = false; |
58 | 55 | ||
59 | const struct afmt_entry audio_formats[AFMT_NUM_CODECS] = | 56 | const struct afmt_entry audio_formats[AFMT_NUM_CODECS] = |
@@ -66,13 +63,7 @@ const struct afmt_entry audio_formats[AFMT_NUM_CODECS] = | |||
66 | [AFMT_MPA_L2] = | 63 | [AFMT_MPA_L2] = |
67 | AFMT_ENTRY("MP2", "mpa", NULL, get_mp3_metadata, "mpa\0mp2\0"), | 64 | AFMT_ENTRY("MP2", "mpa", NULL, get_mp3_metadata, "mpa\0mp2\0"), |
68 | 65 | ||
69 | #if CONFIG_CODEC != SWCODEC | 66 | /* MPEG Audio layer 3 */ |
70 | /* MPEG Audio layer 3 on HWCODEC: .talk clips, no encoder */ | ||
71 | [AFMT_MPA_L3] = | ||
72 | AFMT_ENTRY("MP3", "mpa", NULL, get_mp3_metadata, "mp3\0talk\0"), | ||
73 | |||
74 | #else /* CONFIG_CODEC == SWCODEC */ | ||
75 | /* MPEG Audio layer 3 on SWCODEC */ | ||
76 | [AFMT_MPA_L3] = | 67 | [AFMT_MPA_L3] = |
77 | AFMT_ENTRY("MP3", "mpa", "mp3_enc", get_mp3_metadata, "mp3\0"), | 68 | AFMT_ENTRY("MP3", "mpa", "mp3_enc", get_mp3_metadata, "mp3\0"), |
78 | 69 | ||
@@ -238,10 +229,9 @@ const struct afmt_entry audio_formats[AFMT_NUM_CODECS] = | |||
238 | /* AAC bitstream format */ | 229 | /* AAC bitstream format */ |
239 | [AFMT_AAC_BSF] = | 230 | [AFMT_AAC_BSF] = |
240 | AFMT_ENTRY("AAC", "aac_bsf", NULL, get_aac_metadata, "aac\0"), | 231 | AFMT_ENTRY("AAC", "aac_bsf", NULL, get_aac_metadata, "aac\0"), |
241 | #endif | ||
242 | }; | 232 | }; |
243 | 233 | ||
244 | #if CONFIG_CODEC == SWCODEC && defined (HAVE_RECORDING) | 234 | #if defined (HAVE_RECORDING) |
245 | /* get REC_FORMAT_* corresponding AFMT_* */ | 235 | /* get REC_FORMAT_* corresponding AFMT_* */ |
246 | const int rec_format_afmt[REC_NUM_FORMATS] = | 236 | const int rec_format_afmt[REC_NUM_FORMATS] = |
247 | { | 237 | { |
@@ -267,9 +257,8 @@ const int afmt_rec_format[AFMT_NUM_CODECS] = | |||
267 | [AFMT_PCM_WAV] = REC_FORMAT_PCM_WAV, | 257 | [AFMT_PCM_WAV] = REC_FORMAT_PCM_WAV, |
268 | }; | 258 | }; |
269 | #endif | 259 | #endif |
270 | #endif /* CONFIG_CODEC == SWCODEC && defined (HAVE_RECORDING) */ | 260 | #endif /* defined (HAVE_RECORDING) */ |
271 | 261 | ||
272 | #if CONFIG_CODEC == SWCODEC | ||
273 | /* Get the canonical AFMT type */ | 262 | /* Get the canonical AFMT type */ |
274 | int get_audio_base_codec_type(int type) | 263 | int get_audio_base_codec_type(int type) |
275 | { | 264 | { |
@@ -357,8 +346,6 @@ bool format_buffers_with_offset(int afmt) | |||
357 | return false; | 346 | return false; |
358 | } | 347 | } |
359 | } | 348 | } |
360 | #endif /* CONFIG_CODEC == SWCODEC */ | ||
361 | |||
362 | 349 | ||
363 | /* Simple file type probing by looking at the filename extension. */ | 350 | /* Simple file type probing by looking at the filename extension. */ |
364 | unsigned int probe_file_format(const char *filename) | 351 | unsigned int probe_file_format(const char *filename) |
@@ -464,7 +451,6 @@ bool get_metadata(struct mp3entry* id3, int fd, const char* trackname) | |||
464 | } | 451 | } |
465 | 452 | ||
466 | #ifndef __PCTOOL__ | 453 | #ifndef __PCTOOL__ |
467 | #if CONFIG_CODEC == SWCODEC | ||
468 | void strip_tags(int handle_id) | 454 | void strip_tags(int handle_id) |
469 | { | 455 | { |
470 | static const unsigned char tag[] = "TAG"; | 456 | static const unsigned char tag[] = "TAG"; |
@@ -500,7 +486,6 @@ void strip_tags(int handle_id) | |||
500 | logf("Cutting off APE tag (%ldB)", len); | 486 | logf("Cutting off APE tag (%ldB)", len); |
501 | bufcuttail(handle_id, len); | 487 | bufcuttail(handle_id, len); |
502 | } | 488 | } |
503 | #endif /* CONFIG_CODEC == SWCODEC */ | ||
504 | #endif /* ! __PCTOOL__ */ | 489 | #endif /* ! __PCTOOL__ */ |
505 | 490 | ||
506 | #define MOVE_ENTRY(x) if (x) x += offset; | 491 | #define MOVE_ENTRY(x) if (x) x += offset; |
@@ -544,7 +529,6 @@ void wipe_mp3entry(struct mp3entry *id3) | |||
544 | memset(id3, 0, sizeof (struct mp3entry)); | 529 | memset(id3, 0, sizeof (struct mp3entry)); |
545 | } | 530 | } |
546 | 531 | ||
547 | #if CONFIG_CODEC == SWCODEC | ||
548 | /* Glean what is possible from the filename alone - does not parse metadata */ | 532 | /* Glean what is possible from the filename alone - does not parse metadata */ |
549 | void fill_metadata_from_path(struct mp3entry *id3, const char *trackname) | 533 | void fill_metadata_from_path(struct mp3entry *id3, const char *trackname) |
550 | { | 534 | { |
@@ -574,4 +558,3 @@ void fill_metadata_from_path(struct mp3entry *id3, const char *trackname) | |||
574 | /* Copy the path info */ | 558 | /* Copy the path info */ |
575 | strlcpy(id3->path, trackname, sizeof (id3->path)); | 559 | strlcpy(id3->path, trackname, sizeof (id3->path)); |
576 | } | 560 | } |
577 | #endif /* CONFIG_CODEC == SWCODEC */ | ||
diff --git a/lib/rbcodec/metadata/metadata.h b/lib/rbcodec/metadata/metadata.h index a7ebcf16e5..5c78eae9d4 100644 --- a/lib/rbcodec/metadata/metadata.h +++ b/lib/rbcodec/metadata/metadata.h | |||
@@ -37,7 +37,6 @@ enum | |||
37 | AFMT_MPA_L2, /* MPEG Audio layer 2 */ | 37 | AFMT_MPA_L2, /* MPEG Audio layer 2 */ |
38 | AFMT_MPA_L3, /* MPEG Audio layer 3 */ | 38 | AFMT_MPA_L3, /* MPEG Audio layer 3 */ |
39 | 39 | ||
40 | #if CONFIG_CODEC == SWCODEC | ||
41 | AFMT_AIFF, /* Audio Interchange File Format */ | 40 | AFMT_AIFF, /* Audio Interchange File Format */ |
42 | AFMT_PCM_WAV, /* Uncompressed PCM in a WAV file */ | 41 | AFMT_PCM_WAV, /* Uncompressed PCM in a WAV file */ |
43 | AFMT_OGG_VORBIS, /* Ogg Vorbis */ | 42 | AFMT_OGG_VORBIS, /* Ogg Vorbis */ |
@@ -91,7 +90,6 @@ enum | |||
91 | AFMT_KSS, /* KSS (MSX computer KSS Music File) */ | 90 | AFMT_KSS, /* KSS (MSX computer KSS Music File) */ |
92 | AFMT_OPUS, /* Opus (see http://www.opus-codec.org ) */ | 91 | AFMT_OPUS, /* Opus (see http://www.opus-codec.org ) */ |
93 | AFMT_AAC_BSF, | 92 | AFMT_AAC_BSF, |
94 | #endif | ||
95 | 93 | ||
96 | /* add new formats at any index above this line to have a sensible order - | 94 | /* add new formats at any index above this line to have a sensible order - |
97 | specified array index inits are used */ | 95 | specified array index inits are used */ |
@@ -99,7 +97,7 @@ enum | |||
99 | 97 | ||
100 | AFMT_NUM_CODECS, | 98 | AFMT_NUM_CODECS, |
101 | 99 | ||
102 | #if CONFIG_CODEC == SWCODEC && defined(HAVE_RECORDING) | 100 | #if defined(HAVE_RECORDING) |
103 | /* masks to decompose parts */ | 101 | /* masks to decompose parts */ |
104 | CODEC_AFMT_MASK = 0x0fff, | 102 | CODEC_AFMT_MASK = 0x0fff, |
105 | CODEC_TYPE_MASK = 0x7000, | 103 | CODEC_TYPE_MASK = 0x7000, |
@@ -107,10 +105,9 @@ enum | |||
107 | /* switch for specifying codec type when requesting a filename */ | 105 | /* switch for specifying codec type when requesting a filename */ |
108 | CODEC_TYPE_DECODER = (0 << 12), /* default */ | 106 | CODEC_TYPE_DECODER = (0 << 12), /* default */ |
109 | CODEC_TYPE_ENCODER = (1 << 12), | 107 | CODEC_TYPE_ENCODER = (1 << 12), |
110 | #endif /* CONFIG_CODEC == SWCODEC && defined(HAVE_RECORDING) */ | 108 | #endif /* defined(HAVE_RECORDING) */ |
111 | }; | 109 | }; |
112 | 110 | ||
113 | #if CONFIG_CODEC == SWCODEC | ||
114 | #if (CONFIG_PLATFORM & PLATFORM_ANDROID) | 111 | #if (CONFIG_PLATFORM & PLATFORM_ANDROID) |
115 | #define CODEC_EXTENSION "so" | 112 | #define CODEC_EXTENSION "so" |
116 | #define CODEC_PREFIX "lib" | 113 | #define CODEC_PREFIX "lib" |
@@ -157,24 +154,16 @@ extern const int rec_format_afmt[REC_NUM_FORMATS]; | |||
157 | { label, root_fname, func, ext_list } | 154 | { label, root_fname, func, ext_list } |
158 | #endif /* HAVE_RECORDING */ | 155 | #endif /* HAVE_RECORDING */ |
159 | 156 | ||
160 | #else /* !SWCODEC */ | ||
161 | |||
162 | #define AFMT_ENTRY(label, root_fname, enc_root_fname, func, ext_list) \ | ||
163 | { label, func, ext_list } | ||
164 | #endif /* CONFIG_CODEC == SWCODEC */ | ||
165 | |||
166 | /** Database of audio formats **/ | 157 | /** Database of audio formats **/ |
167 | /* record describing the audio format */ | 158 | /* record describing the audio format */ |
168 | struct mp3entry; | 159 | struct mp3entry; |
169 | struct afmt_entry | 160 | struct afmt_entry |
170 | { | 161 | { |
171 | const char *label; /* format label */ | 162 | const char *label; /* format label */ |
172 | #if CONFIG_CODEC == SWCODEC | ||
173 | const char *codec_root_fn; /* root codec filename (sans _enc and .codec) */ | 163 | const char *codec_root_fn; /* root codec filename (sans _enc and .codec) */ |
174 | #ifdef HAVE_RECORDING | 164 | #ifdef HAVE_RECORDING |
175 | const char *codec_enc_root_fn; /* filename of encoder codec */ | 165 | const char *codec_enc_root_fn; /* filename of encoder codec */ |
176 | #endif | 166 | #endif |
177 | #endif | ||
178 | bool (*parse_func)(int fd, struct mp3entry *id3); /* return true on success */ | 167 | bool (*parse_func)(int fd, struct mp3entry *id3); /* return true on success */ |
179 | const char *ext_list; /* NULL terminated extension | 168 | const char *ext_list; /* NULL terminated extension |
180 | list for type with the first as | 169 | list for type with the first as |
@@ -305,14 +294,12 @@ struct mp3entry { | |||
305 | #endif | 294 | #endif |
306 | 295 | ||
307 | /* replaygain support */ | 296 | /* replaygain support */ |
308 | #if CONFIG_CODEC == SWCODEC | ||
309 | long track_level; /* holds the level in dB * (1<<FP_BITS) */ | 297 | long track_level; /* holds the level in dB * (1<<FP_BITS) */ |
310 | long album_level; | 298 | long album_level; |
311 | long track_gain; /* s19.12 signed fixed point. 0 for no gain. */ | 299 | long track_gain; /* s19.12 signed fixed point. 0 for no gain. */ |
312 | long album_gain; | 300 | long album_gain; |
313 | long track_peak; /* s19.12 signed fixed point. 0 for no peak. */ | 301 | long track_peak; /* s19.12 signed fixed point. 0 for no peak. */ |
314 | long album_peak; | 302 | long album_peak; |
315 | #endif | ||
316 | 303 | ||
317 | #ifdef HAVE_ALBUMART | 304 | #ifdef HAVE_ALBUMART |
318 | bool has_embedded_albumart; | 305 | bool has_embedded_albumart; |
@@ -335,13 +322,11 @@ void adjust_mp3entry(struct mp3entry *entry, void *dest, const void *orig); | |||
335 | void copy_mp3entry(struct mp3entry *dest, const struct mp3entry *orig); | 322 | void copy_mp3entry(struct mp3entry *dest, const struct mp3entry *orig); |
336 | void wipe_mp3entry(struct mp3entry *id3); | 323 | void wipe_mp3entry(struct mp3entry *id3); |
337 | 324 | ||
338 | #if CONFIG_CODEC == SWCODEC | ||
339 | void fill_metadata_from_path(struct mp3entry *id3, const char *trackname); | 325 | void fill_metadata_from_path(struct mp3entry *id3, const char *trackname); |
340 | int get_audio_base_codec_type(int type); | 326 | int get_audio_base_codec_type(int type); |
341 | void strip_tags(int handle_id); | 327 | void strip_tags(int handle_id); |
342 | bool rbcodec_format_is_atomic(int afmt); | 328 | bool rbcodec_format_is_atomic(int afmt); |
343 | bool format_buffers_with_offset(int afmt); | 329 | bool format_buffers_with_offset(int afmt); |
344 | #endif | ||
345 | 330 | ||
346 | #endif | 331 | #endif |
347 | 332 | ||
diff --git a/lib/rbcodec/metadata/metadata_parsers.h b/lib/rbcodec/metadata/metadata_parsers.h index 45cf140012..cc7d8a102e 100644 --- a/lib/rbcodec/metadata/metadata_parsers.h +++ b/lib/rbcodec/metadata/metadata_parsers.h | |||
@@ -19,15 +19,12 @@ | |||
19 | * | 19 | * |
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | 21 | ||
22 | #if CONFIG_CODEC == SWCODEC | ||
23 | char* id3_get_num_genre(unsigned int genre_num); | 22 | char* id3_get_num_genre(unsigned int genre_num); |
24 | #endif | ||
25 | int getid3v1len(int fd); | 23 | int getid3v1len(int fd); |
26 | int getid3v2len(int fd); | 24 | int getid3v2len(int fd); |
27 | bool setid3v1title(int fd, struct mp3entry *entry); | 25 | bool setid3v1title(int fd, struct mp3entry *entry); |
28 | void setid3v2title(int fd, struct mp3entry *entry); | 26 | void setid3v2title(int fd, struct mp3entry *entry); |
29 | bool get_mp3_metadata(int fd, struct mp3entry* id3); | 27 | bool get_mp3_metadata(int fd, struct mp3entry* id3); |
30 | #if CONFIG_CODEC == SWCODEC | ||
31 | bool get_adx_metadata(int fd, struct mp3entry* id3); | 28 | bool get_adx_metadata(int fd, struct mp3entry* id3); |
32 | bool get_aiff_metadata(int fd, struct mp3entry* id3); | 29 | bool get_aiff_metadata(int fd, struct mp3entry* id3); |
33 | bool get_flac_metadata(int fd, struct mp3entry* id3); | 30 | bool get_flac_metadata(int fd, struct mp3entry* id3); |
@@ -58,4 +55,3 @@ bool get_sgc_metadata(int fd, struct mp3entry* id3); | |||
58 | bool get_vgm_metadata(int fd, struct mp3entry* id3); | 55 | bool get_vgm_metadata(int fd, struct mp3entry* id3); |
59 | bool get_kss_metadata(int fd, struct mp3entry* id3); | 56 | bool get_kss_metadata(int fd, struct mp3entry* id3); |
60 | bool get_aac_metadata(int fd, struct mp3entry* id3); | 57 | bool get_aac_metadata(int fd, struct mp3entry* id3); |
61 | #endif /* CONFIG_CODEC == SWCODEC */ | ||
diff --git a/lib/rbcodec/metadata/mp3.c b/lib/rbcodec/metadata/mp3.c index 2096e70898..ffe20fb3ea 100644 --- a/lib/rbcodec/metadata/mp3.c +++ b/lib/rbcodec/metadata/mp3.c | |||
@@ -108,11 +108,9 @@ static int getsonglength(int fd, struct mp3entry *entry) | |||
108 | entry->frequency = info.frequency; | 108 | entry->frequency = info.frequency; |
109 | entry->layer = info.layer; | 109 | entry->layer = info.layer; |
110 | switch(entry->layer) { | 110 | switch(entry->layer) { |
111 | #if CONFIG_CODEC==SWCODEC | ||
112 | case 0: | 111 | case 0: |
113 | entry->codectype=AFMT_MPA_L1; | 112 | entry->codectype=AFMT_MPA_L1; |
114 | break; | 113 | break; |
115 | #endif | ||
116 | case 1: | 114 | case 1: |
117 | entry->codectype=AFMT_MPA_L2; | 115 | entry->codectype=AFMT_MPA_L2; |
118 | break; | 116 | break; |
@@ -143,12 +141,10 @@ static int getsonglength(int fd, struct mp3entry *entry) | |||
143 | entry->vbr = info.is_vbr; | 141 | entry->vbr = info.is_vbr; |
144 | entry->has_toc = info.has_toc; | 142 | entry->has_toc = info.has_toc; |
145 | 143 | ||
146 | #if CONFIG_CODEC==SWCODEC | ||
147 | if (!entry->lead_trim) | 144 | if (!entry->lead_trim) |
148 | entry->lead_trim = info.enc_delay; | 145 | entry->lead_trim = info.enc_delay; |
149 | if (!entry->tail_trim) | 146 | if (!entry->tail_trim) |
150 | entry->tail_trim = info.enc_padding; | 147 | entry->tail_trim = info.enc_padding; |
151 | #endif | ||
152 | 148 | ||
153 | memcpy(entry->toc, info.toc, sizeof(info.toc)); | 149 | memcpy(entry->toc, info.toc, sizeof(info.toc)); |
154 | 150 | ||
diff --git a/lib/rbcodec/metadata/mp3data.c b/lib/rbcodec/metadata/mp3data.c index 49f9786c29..83605126d6 100644 --- a/lib/rbcodec/metadata/mp3data.c +++ b/lib/rbcodec/metadata/mp3data.c | |||
@@ -115,11 +115,6 @@ static bool is_mp3frameheader(unsigned long head) | |||
115 | return false; | 115 | return false; |
116 | if (!(head & LAYER_MASK)) /* no layer? */ | 116 | if (!(head & LAYER_MASK)) /* no layer? */ |
117 | return false; | 117 | return false; |
118 | #if CONFIG_CODEC != SWCODEC | ||
119 | /* The MAS can't decode layer 1, so treat layer 1 data as invalid */ | ||
120 | if ((head & LAYER_MASK) == LAYER_MASK) | ||
121 | return false; | ||
122 | #endif | ||
123 | if ((head & BITRATE_MASK) == BITRATE_MASK) /* bad bitrate? */ | 118 | if ((head & BITRATE_MASK) == BITRATE_MASK) /* bad bitrate? */ |
124 | return false; | 119 | return false; |
125 | if (!(head & BITRATE_MASK)) /* no bitrate? */ | 120 | if (!(head & BITRATE_MASK)) /* no bitrate? */ |
@@ -454,7 +449,6 @@ static void get_xing_info(struct mp3info *info, unsigned char *buf) | |||
454 | /* We don't care about this, but need to skip it */ | 449 | /* We don't care about this, but need to skip it */ |
455 | i += 4; | 450 | i += 4; |
456 | } | 451 | } |
457 | #if CONFIG_CODEC==SWCODEC | ||
458 | i += 21; | 452 | i += 21; |
459 | info->enc_delay = ((int)buf[i ] << 4) | (buf[i+1] >> 4); | 453 | info->enc_delay = ((int)buf[i ] << 4) | (buf[i+1] >> 4); |
460 | info->enc_padding = ((int)(buf[i+1]&0xF) << 8) | buf[i+2]; | 454 | info->enc_padding = ((int)(buf[i+1]&0xF) << 8) | buf[i+2]; |
@@ -467,7 +461,6 @@ static void get_xing_info(struct mp3info *info, unsigned char *buf) | |||
467 | info->enc_delay = -1; | 461 | info->enc_delay = -1; |
468 | info->enc_padding = -1; | 462 | info->enc_padding = -1; |
469 | } | 463 | } |
470 | #endif | ||
471 | } | 464 | } |
472 | 465 | ||
473 | /* Extract information from a 'VBRI' header. */ | 466 | /* Extract information from a 'VBRI' header. */ |
@@ -541,18 +534,16 @@ int get_mp3file_info(int fd, struct mp3info *info) | |||
541 | /* Initialize info and frame */ | 534 | /* Initialize info and frame */ |
542 | memset(info, 0, sizeof(struct mp3info)); | 535 | memset(info, 0, sizeof(struct mp3info)); |
543 | memset(frame, 0, sizeof(frame)); | 536 | memset(frame, 0, sizeof(frame)); |
544 | 537 | ||
545 | #if CONFIG_CODEC==SWCODEC | ||
546 | /* These two are needed for proper LAME gapless MP3 playback */ | 538 | /* These two are needed for proper LAME gapless MP3 playback */ |
547 | info->enc_delay = -1; | 539 | info->enc_delay = -1; |
548 | info->enc_padding = -1; | 540 | info->enc_padding = -1; |
549 | #endif | ||
550 | 541 | ||
551 | /* Get the very first single MPEG frame. */ | 542 | /* Get the very first single MPEG frame. */ |
552 | result = get_next_header_info(fd, &bytecount, info, true); | 543 | result = get_next_header_info(fd, &bytecount, info, true); |
553 | if(result) | 544 | if(result) |
554 | return result; | 545 | return result; |
555 | 546 | ||
556 | /* Read the amount of frame data to the buffer that is required for the | 547 | /* Read the amount of frame data to the buffer that is required for the |
557 | * vbr tag parsing. Skip the rest. */ | 548 | * vbr tag parsing. Skip the rest. */ |
558 | buf_size = MIN(info->frame_size-4, (int)sizeof(frame)); | 549 | buf_size = MIN(info->frame_size-4, (int)sizeof(frame)); |
diff --git a/lib/rbcodec/rbcodec.make b/lib/rbcodec/rbcodec.make index bc4e54fddf..f2a7c7e569 100644 --- a/lib/rbcodec/rbcodec.make +++ b/lib/rbcodec/rbcodec.make | |||
@@ -22,6 +22,4 @@ CORE_LIBS := $(RBCODECLIB) $(CORE_LIBS) | |||
22 | $(RBCODECLIB): $(RBCODECLIB_OBJ) | 22 | $(RBCODECLIB): $(RBCODECLIB_OBJ) |
23 | $(call PRINTS,AR $(@F))$(AR) rcs $@ $^ >/dev/null | 23 | $(call PRINTS,AR $(@F))$(AR) rcs $@ $^ >/dev/null |
24 | 24 | ||
25 | ifdef SOFTWARECODECS | 25 | include $(RBCODECLIB_DIR)/codecs/codecs.make |
26 | include $(RBCODECLIB_DIR)/codecs/codecs.make | ||
27 | endif | ||