summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2020-07-17 00:01:32 -0400
committerSolomon Peachy <pizza@shaftnet.org>2020-07-24 21:20:13 +0000
commit8cb555460ff79e636a7907fb2589e16db98c8600 (patch)
tree930a3878c7641c9ce045b24f0ade1309e36d5806 /lib
parent0c4f89370d05056faa789aa9cabcccc4e509fb9f (diff)
downloadrockbox-8cb555460ff79e636a7907fb2589e16db98c8600.tar.gz
rockbox-8cb555460ff79e636a7907fb2589e16db98c8600.tar.bz2
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')
-rw-r--r--lib/rbcodec/SOURCES2
-rw-r--r--lib/rbcodec/codecs/codecs.h10
-rw-r--r--lib/rbcodec/codecs/lib/SOURCES3
-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
-rw-r--r--lib/rbcodec/rbcodec.make4
-rw-r--r--lib/skin_parser/tag_table.h2
11 files changed, 17 insertions, 91 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
metadata/id3tags.c
metadata/mp3.c
metadata/mp3data.c
-#if CONFIG_CODEC == SWCODEC
dsp/channel_mode.c
dsp/compressor.c
dsp/crossfeed.c
@@ -64,4 +63,3 @@ metadata/vox.c
metadata/wave.c
metadata/wavpack.c
metadata/aac.c
-#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 @@
#include "profile.h"
#include "thread.h"
#endif
-#if (CONFIG_CODEC == SWCODEC)
#ifdef HAVE_RECORDING
#include "enc_base.h"
#endif
#include "dsp_core.h"
#include "dsp_misc.h"
#include "dsp-util.h"
-#endif
#include "gcc_extensions.h"
#include "load_code.h"
@@ -281,18 +279,18 @@ int codec_load_buf(int hid, struct codec_api *api);
int codec_load_file(const char* codec, struct codec_api *api);
int codec_run_proc(void);
int codec_close(void);
-#if CONFIG_CODEC == SWCODEC && defined(HAVE_RECORDING)
+#if defined(HAVE_RECORDING)
enc_callback_t codec_get_enc_callback(void);
-#else
-#define codec_get_enc_callback() NULL
#endif
/* defined by the codec */
enum codec_status codec_start(enum codec_entry_call_reason reason);
enum codec_status codec_main(enum codec_entry_call_reason reason);
enum codec_status codec_run(void);
-#if CONFIG_CODEC == SWCODEC && defined(HAVE_RECORDING)
+#if defined(HAVE_RECORDING)
int enc_callback(enum enc_callback_reason reason, void *params);
+#else
+#define codec_get_enc_callback() NULL
#endif
#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 @@
-#if CONFIG_CODEC == SWCODEC /* software codec platforms */
codeclib.c
ffmpeg_bitstream.c
@@ -6,6 +5,6 @@ mdct_lookup.c
fft-ffmpeg.c
mdct.c
-#elif (CONFIG_PLATFORM & PLATFORM_HOSTED) && defined(__APPLE__)
+#if (CONFIG_PLATFORM & PLATFORM_HOSTED) && defined(__APPLE__)
osx.dummy.c
#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 @@
#include "metadata.h"
#include "mp3data.h"
-#if CONFIG_CODEC == SWCODEC
#include "metadata_common.h"
-#endif
#include "metadata_parsers.h"
#include "misc.h"
@@ -91,9 +89,6 @@ static const char* const genres[] = {
"Synthpop"
};
-#if CONFIG_CODEC != SWCODEC
-static
-#endif
char* id3_get_num_genre(unsigned int genre_num)
{
if (genre_num < ARRAYLEN(genres))
@@ -376,23 +371,20 @@ static int parseuser( struct mp3entry* entry, char* tag, int bufferpos )
/* At least part of the value was read, so we can safely try to
* parse it */
value = tag + desc_len + 1;
-
+
if (!strcasecmp(tag, "ALBUM ARTIST")) {
length = strlen(value) + 1;
strlcpy(tag, value, length);
entry->albumartist = tag;
-#if CONFIG_CODEC == SWCODEC
} else {
/* Call parse_replaygain(). */
parse_replaygain(tag, value, entry);
-#endif
}
}
return tag - entry->id3v2buf + length;
}
-#if CONFIG_CODEC == SWCODEC
/* parse RVA2 binary data and convert to replaygain information. */
static int parserva2( struct mp3entry* entry, char* tag, int bufferpos)
{
@@ -452,13 +444,12 @@ static int parserva2( struct mp3entry* entry, char* tag, int bufferpos)
return start_pos;
}
}
-
+
parse_replaygain_int(album, gain, peak * 2, entry);
}
return start_pos;
}
-#endif
static int parsembtid( struct mp3entry* entry, char* tag, int bufferpos )
{
@@ -514,9 +505,7 @@ static const struct tag_resolver taglist[] = {
{ "PIC", 3, 0, &parsealbumart, true },
#endif
{ "TXXX", 4, 0, &parseuser, false },
-#if CONFIG_CODEC == SWCODEC
{ "RVA2", 4, 0, &parserva2, true },
-#endif
{ "UFID", 4, 0, &parsembtid, false },
};
@@ -738,9 +727,7 @@ void setid3v2title(int fd, struct mp3entry *entry)
bool unsynch = false;
int i, j;
int rc;
-#if CONFIG_CODEC == SWCODEC
bool itunes_gapless = false;
-#endif
#ifdef HAVE_ALBUMART
entry->has_embedded_albumart = false;
@@ -984,14 +971,11 @@ void setid3v2title(int fd, struct mp3entry *entry)
(tr->tag_length == 3 && !memcmp( header, "COM", 3))) {
int offset;
if(bytesread >= 8 && !strncmp(tag+4, "iTun", 4)) {
-#if CONFIG_CODEC == SWCODEC
/* check for iTunes gapless information */
if(bytesread >= 12 && !strncmp(tag+4, "iTunSMPB", 8))
itunes_gapless = true;
else
-#endif
- /* ignore other with iTunes tags */
- break;
+ break; /* ignore other with iTunes tags */
}
offset = 3 + unicode_len(*tag, tag + 4);
@@ -1071,7 +1055,6 @@ void setid3v2title(int fd, struct mp3entry *entry)
tag[bytesread] = 0;
bufferpos += bytesread + 1;
-#if CONFIG_CODEC == SWCODEC
/* parse the tag if it contains iTunes gapless info */
if (itunes_gapless)
{
@@ -1079,7 +1062,6 @@ void setid3v2title(int fd, struct mp3entry *entry)
entry->lead_trim = get_itunes_int32(tag, 1);
entry->tail_trim = get_itunes_int32(tag, 2);
}
-#endif
/* Note that parser functions sometimes set *ptag to NULL, so
* 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 @@
#include "metadata_parsers.h"
-#if CONFIG_CODEC == SWCODEC
-
/* For trailing tag stripping and base audio data types */
#include "buffering.h"
@@ -53,7 +51,6 @@ static bool get_other_asap_metadata(int fd, struct mp3entry *id3)
id3->genre_string = id3_get_num_genre(36);
return true;
}
-#endif /* CONFIG_CODEC == SWCODEC */
bool write_metadata_log = false;
const struct afmt_entry audio_formats[AFMT_NUM_CODECS] =
@@ -66,13 +63,7 @@ const struct afmt_entry audio_formats[AFMT_NUM_CODECS] =
[AFMT_MPA_L2] =
AFMT_ENTRY("MP2", "mpa", NULL, get_mp3_metadata, "mpa\0mp2\0"),
-#if CONFIG_CODEC != SWCODEC
- /* MPEG Audio layer 3 on HWCODEC: .talk clips, no encoder */
- [AFMT_MPA_L3] =
- AFMT_ENTRY("MP3", "mpa", NULL, get_mp3_metadata, "mp3\0talk\0"),
-
-#else /* CONFIG_CODEC == SWCODEC */
- /* MPEG Audio layer 3 on SWCODEC */
+ /* MPEG Audio layer 3 */
[AFMT_MPA_L3] =
AFMT_ENTRY("MP3", "mpa", "mp3_enc", get_mp3_metadata, "mp3\0"),
@@ -238,10 +229,9 @@ const struct afmt_entry audio_formats[AFMT_NUM_CODECS] =
/* AAC bitstream format */
[AFMT_AAC_BSF] =
AFMT_ENTRY("AAC", "aac_bsf", NULL, get_aac_metadata, "aac\0"),
-#endif
};
-#if CONFIG_CODEC == SWCODEC && defined (HAVE_RECORDING)
+#if defined (HAVE_RECORDING)
/* get REC_FORMAT_* corresponding AFMT_* */
const int rec_format_afmt[REC_NUM_FORMATS] =
{
@@ -267,9 +257,8 @@ const int afmt_rec_format[AFMT_NUM_CODECS] =
[AFMT_PCM_WAV] = REC_FORMAT_PCM_WAV,
};
#endif
-#endif /* CONFIG_CODEC == SWCODEC && defined (HAVE_RECORDING) */
+#endif /* defined (HAVE_RECORDING) */
-#if CONFIG_CODEC == SWCODEC
/* Get the canonical AFMT type */
int get_audio_base_codec_type(int type)
{
@@ -357,8 +346,6 @@ bool format_buffers_with_offset(int afmt)
return false;
}
}
-#endif /* CONFIG_CODEC == SWCODEC */
-
/* Simple file type probing by looking at the filename extension. */
unsigned int probe_file_format(const char *filename)
@@ -464,7 +451,6 @@ bool get_metadata(struct mp3entry* id3, int fd, const char* trackname)
}
#ifndef __PCTOOL__
-#if CONFIG_CODEC == SWCODEC
void strip_tags(int handle_id)
{
static const unsigned char tag[] = "TAG";
@@ -500,7 +486,6 @@ void strip_tags(int handle_id)
logf("Cutting off APE tag (%ldB)", len);
bufcuttail(handle_id, len);
}
-#endif /* CONFIG_CODEC == SWCODEC */
#endif /* ! __PCTOOL__ */
#define MOVE_ENTRY(x) if (x) x += offset;
@@ -544,7 +529,6 @@ void wipe_mp3entry(struct mp3entry *id3)
memset(id3, 0, sizeof (struct mp3entry));
}
-#if CONFIG_CODEC == SWCODEC
/* Glean what is possible from the filename alone - does not parse metadata */
void fill_metadata_from_path(struct mp3entry *id3, const char *trackname)
{
@@ -574,4 +558,3 @@ void fill_metadata_from_path(struct mp3entry *id3, const char *trackname)
/* Copy the path info */
strlcpy(id3->path, trackname, sizeof (id3->path));
}
-#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
AFMT_MPA_L2, /* MPEG Audio layer 2 */
AFMT_MPA_L3, /* MPEG Audio layer 3 */
-#if CONFIG_CODEC == SWCODEC
AFMT_AIFF, /* Audio Interchange File Format */
AFMT_PCM_WAV, /* Uncompressed PCM in a WAV file */
AFMT_OGG_VORBIS, /* Ogg Vorbis */
@@ -91,7 +90,6 @@ enum
AFMT_KSS, /* KSS (MSX computer KSS Music File) */
AFMT_OPUS, /* Opus (see http://www.opus-codec.org ) */
AFMT_AAC_BSF,
-#endif
/* add new formats at any index above this line to have a sensible order -
specified array index inits are used */
@@ -99,7 +97,7 @@ enum
AFMT_NUM_CODECS,
-#if CONFIG_CODEC == SWCODEC && defined(HAVE_RECORDING)
+#if defined(HAVE_RECORDING)
/* masks to decompose parts */
CODEC_AFMT_MASK = 0x0fff,
CODEC_TYPE_MASK = 0x7000,
@@ -107,10 +105,9 @@ enum
/* switch for specifying codec type when requesting a filename */
CODEC_TYPE_DECODER = (0 << 12), /* default */
CODEC_TYPE_ENCODER = (1 << 12),
-#endif /* CONFIG_CODEC == SWCODEC && defined(HAVE_RECORDING) */
+#endif /* defined(HAVE_RECORDING) */
};
-#if CONFIG_CODEC == SWCODEC
#if (CONFIG_PLATFORM & PLATFORM_ANDROID)
#define CODEC_EXTENSION "so"
#define CODEC_PREFIX "lib"
@@ -157,24 +154,16 @@ extern const int rec_format_afmt[REC_NUM_FORMATS];
{ label, root_fname, func, ext_list }
#endif /* HAVE_RECORDING */
-#else /* !SWCODEC */
-
-#define AFMT_ENTRY(label, root_fname, enc_root_fname, func, ext_list) \
- { label, func, ext_list }
-#endif /* CONFIG_CODEC == SWCODEC */
-
/** Database of audio formats **/
/* record describing the audio format */
struct mp3entry;
struct afmt_entry
{
const char *label; /* format label */
-#if CONFIG_CODEC == SWCODEC
const char *codec_root_fn; /* root codec filename (sans _enc and .codec) */
#ifdef HAVE_RECORDING
const char *codec_enc_root_fn; /* filename of encoder codec */
#endif
-#endif
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
@@ -305,14 +294,12 @@ struct mp3entry {
#endif
/* replaygain support */
-#if CONFIG_CODEC == SWCODEC
long track_level; /* holds the level in dB * (1<<FP_BITS) */
long album_level;
long track_gain; /* s19.12 signed fixed point. 0 for no gain. */
long album_gain;
long track_peak; /* s19.12 signed fixed point. 0 for no peak. */
long album_peak;
-#endif
#ifdef HAVE_ALBUMART
bool has_embedded_albumart;
@@ -335,13 +322,11 @@ void adjust_mp3entry(struct mp3entry *entry, void *dest, const void *orig);
void copy_mp3entry(struct mp3entry *dest, const struct mp3entry *orig);
void wipe_mp3entry(struct mp3entry *id3);
-#if CONFIG_CODEC == SWCODEC
void fill_metadata_from_path(struct mp3entry *id3, const char *trackname);
int get_audio_base_codec_type(int type);
void strip_tags(int handle_id);
bool rbcodec_format_is_atomic(int afmt);
bool format_buffers_with_offset(int afmt);
-#endif
#endif
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 @@
*
****************************************************************************/
-#if CONFIG_CODEC == SWCODEC
char* id3_get_num_genre(unsigned int genre_num);
-#endif
int getid3v1len(int fd);
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);
-#if CONFIG_CODEC == SWCODEC
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);
@@ -58,4 +55,3 @@ bool get_sgc_metadata(int fd, struct mp3entry* id3);
bool get_vgm_metadata(int fd, struct mp3entry* id3);
bool get_kss_metadata(int fd, struct mp3entry* id3);
bool get_aac_metadata(int fd, struct mp3entry* id3);
-#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)
entry->frequency = info.frequency;
entry->layer = info.layer;
switch(entry->layer) {
-#if CONFIG_CODEC==SWCODEC
case 0:
entry->codectype=AFMT_MPA_L1;
break;
-#endif
case 1:
entry->codectype=AFMT_MPA_L2;
break;
@@ -143,12 +141,10 @@ static int getsonglength(int fd, struct mp3entry *entry)
entry->vbr = info.is_vbr;
entry->has_toc = info.has_toc;
-#if CONFIG_CODEC==SWCODEC
if (!entry->lead_trim)
entry->lead_trim = info.enc_delay;
if (!entry->tail_trim)
entry->tail_trim = info.enc_padding;
-#endif
memcpy(entry->toc, info.toc, sizeof(info.toc));
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)
return false;
if (!(head & LAYER_MASK)) /* no layer? */
return false;
-#if CONFIG_CODEC != SWCODEC
- /* The MAS can't decode layer 1, so treat layer 1 data as invalid */
- if ((head & LAYER_MASK) == LAYER_MASK)
- return false;
-#endif
if ((head & BITRATE_MASK) == BITRATE_MASK) /* bad bitrate? */
return false;
if (!(head & BITRATE_MASK)) /* no bitrate? */
@@ -454,7 +449,6 @@ static void get_xing_info(struct mp3info *info, unsigned char *buf)
/* We don't care about this, but need to skip it */
i += 4;
}
-#if CONFIG_CODEC==SWCODEC
i += 21;
info->enc_delay = ((int)buf[i ] << 4) | (buf[i+1] >> 4);
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)
info->enc_delay = -1;
info->enc_padding = -1;
}
-#endif
}
/* Extract information from a 'VBRI' header. */
@@ -541,18 +534,16 @@ int get_mp3file_info(int fd, struct mp3info *info)
/* Initialize info and frame */
memset(info, 0, sizeof(struct mp3info));
memset(frame, 0, sizeof(frame));
-
-#if CONFIG_CODEC==SWCODEC
+
/* These two are needed for proper LAME gapless MP3 playback */
info->enc_delay = -1;
info->enc_padding = -1;
-#endif
/* Get the very first single MPEG frame. */
result = get_next_header_info(fd, &bytecount, info, true);
if(result)
return result;
-
+
/* Read the amount of frame data to the buffer that is required for the
* vbr tag parsing. Skip the rest. */
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)
$(RBCODECLIB): $(RBCODECLIB_OBJ)
$(call PRINTS,AR $(@F))$(AR) rcs $@ $^ >/dev/null
-ifdef SOFTWARECODECS
- include $(RBCODECLIB_DIR)/codecs/codecs.make
-endif
+include $(RBCODECLIB_DIR)/codecs/codecs.make
diff --git a/lib/skin_parser/tag_table.h b/lib/skin_parser/tag_table.h
index dc0c11f0ad..54ba23ce6e 100644
--- a/lib/skin_parser/tag_table.h
+++ b/lib/skin_parser/tag_table.h
@@ -256,7 +256,7 @@ enum skin_token_type {
SKIN_TOKEN_IS_RECORDING,
SKIN_TOKEN_REC_FREQ,
SKIN_TOKEN_REC_ENCODER,
- SKIN_TOKEN_REC_BITRATE, /* SWCODEC: MP3 bitrate, HWCODEC: MP3 "quality" */
+ SKIN_TOKEN_REC_BITRATE,
SKIN_TOKEN_REC_MONO,
SKIN_TOKEN_REC_SECONDS,
SKIN_TOKEN_REC_MINUTES,