mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-05-12 11:43:16 -04:00
Compare commits
6 commits
481cc70fe0
...
8a773fb29f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8a773fb29f | ||
|
|
dada036b10 | ||
|
|
6c6bdbf60e | ||
|
|
5e5b434ce8 | ||
|
|
1203b8657e | ||
|
|
e94a96cdcf |
24 changed files with 124 additions and 188 deletions
|
|
@ -263,7 +263,7 @@ const char *get_id3_token(struct wps_token *token, struct mp3entry *id3,
|
|||
case SKIN_TOKEN_METADATA_TRACK_NUMBER:
|
||||
if (id3->track_string)
|
||||
return id3->track_string;
|
||||
if (id3->tracknum) {
|
||||
if (id3->tracknum >= 0) {
|
||||
itoa_buf(buf, buf_size, id3->tracknum);
|
||||
return buf;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ void finalize_id3(struct mp3entry *id3)
|
|||
id3->codectype = mul_id3.codectype;
|
||||
id3->vbr = mul_id3.vbr;
|
||||
id3->discnum = 0;
|
||||
id3->tracknum = 0;
|
||||
id3->tracknum = -1;
|
||||
id3->track_level = 0;
|
||||
id3->album_level = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,4 @@ version 0.31 which is licensed under the GPL version 2:
|
|||
|
||||
gmtime.c
|
||||
strftime.c
|
||||
strpbrk.c
|
||||
strtol.c
|
||||
strtoul.c
|
||||
strstr.c
|
||||
|
|
|
|||
|
|
@ -33,8 +33,6 @@ rocklib_img.c
|
|||
tlsf_helper.c
|
||||
strftime.c
|
||||
strpbrk.c
|
||||
strtoul.c
|
||||
strtol.c
|
||||
strstr.c
|
||||
rocklua.c
|
||||
luadir.c
|
||||
|
|
|
|||
|
|
@ -43,8 +43,6 @@
|
|||
|
||||
extern char curpath[MAX_PATH];
|
||||
struct tm *gmtime(const time_t *timep);
|
||||
long strtol(const char *nptr, char **endptr, int base);
|
||||
unsigned long strtoul(const char *str, char **endptr, int base);
|
||||
size_t strftime(char* dst, size_t max, const char* format, const struct tm* tm);
|
||||
long lfloor(long x);
|
||||
long lpow(long x, long y);
|
||||
|
|
@ -64,6 +62,8 @@ int splash_scroller(int timeout, const char* str);
|
|||
#define strcmp rb->strcmp
|
||||
#define strcpy rb->strcpy
|
||||
#define strlen rb->strlen
|
||||
#define strtol rb->strtol
|
||||
#define strtoul rb->strtoul
|
||||
#define yield() rb->yield()
|
||||
|
||||
#endif /* _ROCKCONF_H_ */
|
||||
|
|
|
|||
|
|
@ -1,27 +0,0 @@
|
|||
#include "rocklibc.h"
|
||||
|
||||
extern unsigned long int strtoul(const char *ptr, char **endptr, int base);
|
||||
|
||||
#define ABS_LONG_MIN LONG_MAX
|
||||
long int strtol(const char *nptr, char **endptr, int base)
|
||||
{
|
||||
int neg=0;
|
||||
unsigned long int v;
|
||||
const char*orig=nptr;
|
||||
|
||||
while(__unlikely(isspace(*nptr))) nptr++;
|
||||
|
||||
if (*nptr == '-' && isalnum(nptr[1])) { neg=-1; ++nptr; }
|
||||
v=strtoul(nptr,endptr,base);
|
||||
if (endptr && *endptr==nptr) *endptr=(char *)orig;
|
||||
if (__unlikely(v>=ABS_LONG_MIN)) {
|
||||
if (v==ABS_LONG_MIN && neg) {
|
||||
errno=0;
|
||||
return v;
|
||||
}
|
||||
errno=ERANGE;
|
||||
return (neg?LONG_MIN:LONG_MAX);
|
||||
}
|
||||
return (neg?-v:v);
|
||||
}
|
||||
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
#include "rocklibc.h"
|
||||
|
||||
unsigned long int strtoul(const char *ptr, char **endptr, int base)
|
||||
{
|
||||
int neg = 0, overflow = 0;
|
||||
unsigned long int v=0;
|
||||
const char* orig;
|
||||
const char* nptr=ptr;
|
||||
|
||||
while(__unlikely(isspace(*nptr))) ++nptr;
|
||||
|
||||
if (*nptr == '-') { neg=1; nptr++; }
|
||||
else if (*nptr == '+') ++nptr;
|
||||
orig=nptr;
|
||||
if (base==16 && nptr[0]=='0') goto skip0x;
|
||||
if (base) {
|
||||
register unsigned int b=base-2;
|
||||
if (__unlikely(b>34)) { errno=EINVAL; return 0; }
|
||||
} else {
|
||||
if (*nptr=='0') {
|
||||
base=8;
|
||||
skip0x:
|
||||
if ((nptr[1]=='x'||nptr[1]=='X') && isxdigit(nptr[2])) {
|
||||
nptr+=2;
|
||||
base=16;
|
||||
}
|
||||
} else
|
||||
base=10;
|
||||
}
|
||||
while(__likely(*nptr)) {
|
||||
register unsigned char c=*nptr;
|
||||
c=(c>='a'?c-'a'+10:c>='A'?c-'A'+10:c<='9'?c-'0':0xff);
|
||||
if (__unlikely(c>=base)) break; /* out of base */
|
||||
{
|
||||
register unsigned long x=(v&0xff)*base+c;
|
||||
register unsigned long w=(v>>8)*base+(x>>8);
|
||||
if (w>(ULONG_MAX>>8)) overflow=1;
|
||||
v=(w<<8)+(x&0xff);
|
||||
}
|
||||
++nptr;
|
||||
}
|
||||
if (__unlikely(nptr==orig)) { /* no conversion done */
|
||||
nptr=ptr;
|
||||
errno=EINVAL;
|
||||
v=0;
|
||||
}
|
||||
if (endptr) *endptr=(char *)nptr;
|
||||
if (overflow) {
|
||||
errno=ERANGE;
|
||||
return ULONG_MAX;
|
||||
}
|
||||
return (neg?-v:v);
|
||||
}
|
||||
|
|
@ -571,7 +571,7 @@ static const char * id3_get_or_speak_info(int selected_item, void* data,
|
|||
if(say_it)
|
||||
say_number_and_spell(val, true);
|
||||
}
|
||||
else if (id3->tracknum)
|
||||
else if (id3->tracknum >= 0)
|
||||
{
|
||||
itoa_buf(buffer, buffer_len, id3->tracknum);
|
||||
val = buffer;
|
||||
|
|
|
|||
|
|
@ -2322,7 +2322,7 @@ static void NO_INLINE add_tagcache(char *path, unsigned long mtime)
|
|||
|
||||
logf("-> %s", path);
|
||||
|
||||
if (id3.tracknum <= 0) /* Track number missing? */
|
||||
if (id3.tracknum < 0) /* Track number missing? */
|
||||
{
|
||||
id3.tracknum = -1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#if CPU_MIPS == 32
|
||||
#if (CPU_MIPS == 32)
|
||||
#include "thread-mips32.c"
|
||||
#else
|
||||
#error Missing thread impl
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
/* The following file is (with slight modifications for Rockbox) from dietlibc
|
||||
* version 0.31 which is licensed under the GPL version 2: */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
/* The following file is (with slight modifications for Rockbox) from dietlibc
|
||||
* version 0.31 which is licensed under the GPL version 2: */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <ctype.h>
|
||||
|
|
|
|||
|
|
@ -70,8 +70,6 @@ bool get_aac_metadata(int fd, struct mp3entry *entry)
|
|||
unsigned char buf[5];
|
||||
|
||||
entry->title = NULL;
|
||||
entry->tracknum = 0;
|
||||
entry->discnum = 0;
|
||||
entry->id3v1len = 0;
|
||||
entry->id3v2len = getid3v2len(fd);
|
||||
entry->first_frame_offset = entry->id3v2len;
|
||||
|
|
|
|||
|
|
@ -36,8 +36,6 @@
|
|||
|
||||
static void read_id3_tags(int fd, struct mp3entry* id3)
|
||||
{
|
||||
id3->tracknum = 0;
|
||||
id3->discnum = 0;
|
||||
setid3v2title(fd, id3);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <inttypes.h>
|
||||
#include <errno.h>
|
||||
#include "platform.h"
|
||||
|
||||
#include "metadata.h"
|
||||
|
|
@ -473,7 +474,12 @@ static int asf_parse_header(int fd, struct mp3entry* id3,
|
|||
if (type == 0) {
|
||||
id3->track_string = id3buf;
|
||||
asf_utf16LEdecode(fd, length, &id3buf, &id3buf_remaining);
|
||||
id3->tracknum = atoi(id3->track_string);
|
||||
if (strlen(id3->track_string)) {
|
||||
char *p = NULL;
|
||||
int tracknum = strtol(id3->track_string, &p, 0);
|
||||
if (!(tracknum == 0 && (errno || *p)))
|
||||
id3->tracknum = tracknum;
|
||||
}
|
||||
} else if ((type >=2) && (type <= 5)) {
|
||||
id3->tracknum = asf_intdecode(fd, type, length);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -243,7 +243,12 @@ static int skip_unsynched(int fd, int len)
|
|||
/* parse numeric value from string */
|
||||
static int parsetracknum( struct mp3entry* entry, char* tag, int bufferpos )
|
||||
{
|
||||
entry->tracknum = atoi( tag );
|
||||
if (strlen(tag)) {
|
||||
char *p = NULL;
|
||||
int tracknum = strtol(tag, &p, 0);
|
||||
if (!(tracknum == 0 && (errno || *p)))
|
||||
entry->tracknum = tracknum;
|
||||
}
|
||||
return bufferpos;
|
||||
}
|
||||
|
||||
|
|
@ -826,7 +831,7 @@ void setid3v2title(int fd, struct mp3entry *entry)
|
|||
return;
|
||||
}
|
||||
entry->id3version = version;
|
||||
entry->tracknum = entry->year = entry->discnum = 0;
|
||||
entry->year = entry->discnum = 0;
|
||||
entry->title = entry->artist = entry->album = NULL; /* FIXME incomplete */
|
||||
|
||||
global_flags = header[5];
|
||||
|
|
|
|||
|
|
@ -452,6 +452,8 @@ bool get_metadata_ex(struct mp3entry* id3, int fd, const char* trackname, int fl
|
|||
id3->has_embedded_cuesheet = false;
|
||||
id3->embedded_cuesheet.pos = 0;
|
||||
|
||||
id3->tracknum = -1;
|
||||
|
||||
entry = &audio_formats[id3->codectype];
|
||||
|
||||
/* Load codec specific track tag information and confirm the codec type. */
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <inttypes.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "platform.h"
|
||||
#include "metadata.h"
|
||||
|
|
@ -315,7 +316,12 @@ long parse_tag(const char* name, char* value, struct mp3entry* id3,
|
|||
if (((item == eTRACK && (type == TAGTYPE_APE)))
|
||||
|| (item == eTRACKNUMBER && (type == TAGTYPE_VORBIS)))
|
||||
{
|
||||
id3->tracknum = atoi(value);
|
||||
if (strlen(value)) {
|
||||
char *p = NULL;
|
||||
int tracknum = strtol(value, &p, 0);
|
||||
if (!(tracknum == 0 && (errno || *p)))
|
||||
id3->tracknum = tracknum;
|
||||
}
|
||||
p = &(id3->track_string);
|
||||
}
|
||||
else if (item == eDISCNUMBER || item == eDISC)
|
||||
|
|
|
|||
|
|
@ -166,8 +166,6 @@ bool get_mp3_metadata(int fd, struct mp3entry *entry)
|
|||
entry->filesize = filesize(fd);
|
||||
entry->id3v1len = getid3v1len(fd);
|
||||
entry->id3v2len = getid3v2len(fd);
|
||||
entry->tracknum = 0;
|
||||
entry->discnum = 0;
|
||||
|
||||
if (entry->id3v2len)
|
||||
setid3v2title(fd, entry);
|
||||
|
|
|
|||
|
|
@ -481,10 +481,14 @@ static bool read_mp4_tags(int fd, struct mp3entry* id3,
|
|||
read_mp4_tag_i_from_n(fd, &id3->discnum, &id3->disc_string, size, &buffer_left, &buffer);
|
||||
break;
|
||||
|
||||
case MP4_trkn:
|
||||
read_mp4_tag_i_from_n(fd, &id3->tracknum, &id3->track_string, size, &buffer_left, &buffer);
|
||||
case MP4_trkn: {
|
||||
char *p = NULL;
|
||||
int tracknum = 0;
|
||||
read_mp4_tag_i_from_n(fd, &tracknum, &id3->track_string, size, &buffer_left, &buffer);
|
||||
if (!(tracknum == 0 && (errno || *p)))
|
||||
id3->tracknum = tracknum;
|
||||
break;
|
||||
|
||||
}
|
||||
#ifdef HAVE_ALBUMART
|
||||
case MP4_covr:
|
||||
{
|
||||
|
|
|
|||
|
|
@ -56,8 +56,6 @@ static void read_id3_tags(int fd, struct mp3entry* id3)
|
|||
id3->title = NULL;
|
||||
id3->filesize = filesize(fd);
|
||||
id3->id3v2len = getid3v2len(fd);
|
||||
id3->tracknum = 0;
|
||||
id3->discnum = 0;
|
||||
id3->vbr = false; /* All TTA files are CBR */
|
||||
|
||||
/* first get id3v2 tags. if no id3v2 tags ware found, get id3v1 tags */
|
||||
|
|
|
|||
|
|
@ -732,7 +732,7 @@ static void print_mp3entry(const struct mp3entry *id3, FILE *f)
|
|||
if (id3->album) fprintf(f, "Album: %s\n", id3->album);
|
||||
if (id3->genre_string) fprintf(f, "Genre: %s\n", id3->genre_string);
|
||||
if (id3->disc_string || id3->discnum) fprintf(f, "Disc: %s (%d)\n", id3->disc_string, id3->discnum);
|
||||
if (id3->track_string || id3->tracknum) fprintf(f, "Track: %s (%d)\n", id3->track_string, id3->tracknum);
|
||||
if (id3->track_string || id3->tracknum >= 0) fprintf(f, "Track: %s (%d)\n", id3->track_string, id3->tracknum);
|
||||
if (id3->year_string || id3->year) fprintf(f, "Year: %s (%d)\n", id3->year_string, id3->year);
|
||||
if (id3->composer) fprintf(f, "Composer: %s\n", id3->composer);
|
||||
if (id3->comment) fprintf(f, "Comment: %s\n", id3->comment);
|
||||
|
|
|
|||
22
tools/configure
vendored
22
tools/configure
vendored
|
|
@ -4727,9 +4727,9 @@ if [ -z "$arch" ]; then
|
|||
arch="m68k"
|
||||
elif [ -n "$(echo $cpp_defines | grep -w __arm__)" ]; then
|
||||
arch="arm"
|
||||
# cpp defines like "#define __ARM_ARCH_4TE__ 1" (where we want to extract the 4)
|
||||
arch_version="$(echo $cpp_defines | tr ' ' '\012' | grep __ARM_ARCH | sed -e 's,.*\([0-9]\).*,\1,' | grep -v __ARM_ARCH | head -1)"
|
||||
arch_profile="$(echo "$cpp_defines" | grep 'define __ARM_ARCH_PROFILE' | sed -e 's,.* \([0-9]\+\)$,\1,')"
|
||||
# cpp defines like "#define __ARM_ARCH 4" (where we want to extract the 4)
|
||||
arch_version="$(echo "$cpp_defines" | grep 'define __ARM_ARCH ' | sed -e 's,.* \([0-9]\).*,\1,')"
|
||||
arch_profile="$(echo "$cpp_defines" | grep 'define __ARM_ARCH_PROFILE ' | sed -e 's,.* \([0-9]\+\)$,\1,')"
|
||||
if test "$gccnum" -ge "800"; then
|
||||
# GCC8+ can natively emit unified asm syntax
|
||||
GCCOPTS="$GCCOPTS -masm-syntax-unified"
|
||||
|
|
@ -4770,13 +4770,9 @@ if [ -z "$arch" ]; then
|
|||
esac
|
||||
elif [ -n "$(echo $cpp_defines | grep -w __aarch64__)" ]; then
|
||||
arch="arm64"
|
||||
# cpp defines like "#define __ARM_ARCH_8A__ 1" (where we want to extract the 8)
|
||||
arch_version="$(echo $cpp_defines | tr ' ' '\012' | grep __ARM_ARCH | sed -e 's,.*\([0-9]\).*,\1,' | grep -v __ARM_ARCH | head -1)"
|
||||
arch_profile="$(echo "$cpp_defines" | grep 'define __ARM_ARCH_PROFILE' | sed -e 's,.* \([0-9]\+\)$,\1,')"
|
||||
if test "$gccnum" -ge "800"; then
|
||||
# GCC8+ can natively emit unified asm syntax
|
||||
GCCOPTS="$GCCOPTS -masm-syntax-unified"
|
||||
fi
|
||||
# cpp defines like "#define __ARM_ARCH 8" (where we want to extract the 8)
|
||||
arch_version="$(echo "$cpp_defines" | grep 'define __ARM_ARCH ' | sed -e 's,.* \([0-9]\).*,\1,')"
|
||||
arch_profile="$(echo "$cpp_defines" | grep 'define __ARM_ARCH_PROFILE ' | sed -e 's,.* \([0-9]\+\)$,\1,')"
|
||||
case "$arch_profile" in
|
||||
65) # Cortex-A
|
||||
arch_profile=application
|
||||
|
|
@ -4788,7 +4784,11 @@ if [ -z "$arch" ]; then
|
|||
esac
|
||||
elif [ -n "$(echo $cpp_defines | grep -w __mips__)" ]; then
|
||||
arch="mips"
|
||||
arch_version="$(echo $cpp_defines | tr ' ' '\012' | grep _MIPS_ARCH_MIPS | sed -e 's,.*\([0-9][0-9]\).*,\1,' | grep -v _MIPS_ARCH_MIPS)"
|
||||
arch_version="$(echo "$cpp_defines" | grep 'define __mips ' | sed -e 's,.* \([0-9]\+\).*,\1,')"
|
||||
# arch_revision="$(echo "$cpp_defines" | grep 'define __mips_isa_rev ' | sed -e 's,.* \([0-9]\+\).*,\1,')"
|
||||
# if [ -n "$arch_revision" ] ; then
|
||||
# arch_version="${arch_version}r${arch_revision}"
|
||||
# fi
|
||||
elif [ -n "$(echo $cpp_defines | grep -w __i386__)" ]; then
|
||||
arch="x86"
|
||||
elif [ -n "$(echo $cpp_defines | grep -w __x86_64__)" ]; then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue