summaryrefslogtreecommitdiff
path: root/lib/rbcodec/metadata
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rbcodec/metadata')
-rw-r--r--lib/rbcodec/metadata/id3tags.c24
-rw-r--r--lib/rbcodec/metadata/metadata.c23
-rw-r--r--lib/rbcodec/metadata/metadata.h19
-rw-r--r--lib/rbcodec/metadata/metadata_parsers.h4
-rw-r--r--lib/rbcodec/metadata/mp3.c4
-rw-r--r--lib/rbcodec/metadata/mp3data.c13
6 files changed, 10 insertions, 77 deletions
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
95static
96#endif
97char* id3_get_num_genre(unsigned int genre_num) 92char* 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. */
397static int parserva2( struct mp3entry* entry, char* tag, int bufferpos) 389static 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
463static int parsembtid( struct mp3entry* entry, char* tag, int bufferpos ) 454static 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 */
57bool write_metadata_log = false; 54bool write_metadata_log = false;
58 55
59const struct afmt_entry audio_formats[AFMT_NUM_CODECS] = 56const 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_* */
246const int rec_format_afmt[REC_NUM_FORMATS] = 236const 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 */
274int get_audio_base_codec_type(int type) 263int 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. */
364unsigned int probe_file_format(const char *filename) 351unsigned 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
468void strip_tags(int handle_id) 454void 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 */
549void fill_metadata_from_path(struct mp3entry *id3, const char *trackname) 533void 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 */
168struct mp3entry; 159struct mp3entry;
169struct afmt_entry 160struct 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);
335void copy_mp3entry(struct mp3entry *dest, const struct mp3entry *orig); 322void copy_mp3entry(struct mp3entry *dest, const struct mp3entry *orig);
336void wipe_mp3entry(struct mp3entry *id3); 323void wipe_mp3entry(struct mp3entry *id3);
337 324
338#if CONFIG_CODEC == SWCODEC
339void fill_metadata_from_path(struct mp3entry *id3, const char *trackname); 325void fill_metadata_from_path(struct mp3entry *id3, const char *trackname);
340int get_audio_base_codec_type(int type); 326int get_audio_base_codec_type(int type);
341void strip_tags(int handle_id); 327void strip_tags(int handle_id);
342bool rbcodec_format_is_atomic(int afmt); 328bool rbcodec_format_is_atomic(int afmt);
343bool format_buffers_with_offset(int afmt); 329bool 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
23char* id3_get_num_genre(unsigned int genre_num); 22char* id3_get_num_genre(unsigned int genre_num);
24#endif
25int getid3v1len(int fd); 23int getid3v1len(int fd);
26int getid3v2len(int fd); 24int getid3v2len(int fd);
27bool setid3v1title(int fd, struct mp3entry *entry); 25bool setid3v1title(int fd, struct mp3entry *entry);
28void setid3v2title(int fd, struct mp3entry *entry); 26void setid3v2title(int fd, struct mp3entry *entry);
29bool get_mp3_metadata(int fd, struct mp3entry* id3); 27bool get_mp3_metadata(int fd, struct mp3entry* id3);
30#if CONFIG_CODEC == SWCODEC
31bool get_adx_metadata(int fd, struct mp3entry* id3); 28bool get_adx_metadata(int fd, struct mp3entry* id3);
32bool get_aiff_metadata(int fd, struct mp3entry* id3); 29bool get_aiff_metadata(int fd, struct mp3entry* id3);
33bool get_flac_metadata(int fd, struct mp3entry* id3); 30bool get_flac_metadata(int fd, struct mp3entry* id3);
@@ -58,4 +55,3 @@ bool get_sgc_metadata(int fd, struct mp3entry* id3);
58bool get_vgm_metadata(int fd, struct mp3entry* id3); 55bool get_vgm_metadata(int fd, struct mp3entry* id3);
59bool get_kss_metadata(int fd, struct mp3entry* id3); 56bool get_kss_metadata(int fd, struct mp3entry* id3);
60bool get_aac_metadata(int fd, struct mp3entry* id3); 57bool 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));