Patch #5157 by Rainer Sinsch - SID codec
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10237 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
c5addb17ee
commit
752faa4351
9 changed files with 1405 additions and 0 deletions
|
@ -47,6 +47,7 @@ all: $(ROCKS)
|
|||
|
||||
ifndef SIMVER
|
||||
$(OBJDIR)/wav.elf : $(OBJDIR)/wav.o
|
||||
$(OBJDIR)/sid.elf : $(OBJDIR)/sid.o
|
||||
$(OBJDIR)/aiff.elf : $(OBJDIR)/aiff.o
|
||||
$(OBJDIR)/mpa.elf : $(OBJDIR)/mpa.o $(BUILDDIR)/libmad.a
|
||||
$(OBJDIR)/a52.elf : $(OBJDIR)/a52.o $(BUILDDIR)/liba52.a
|
||||
|
|
|
@ -12,4 +12,5 @@ aac.c
|
|||
#endif
|
||||
shorten.c
|
||||
aiff.c
|
||||
sid.c
|
||||
#endif
|
||||
|
|
1342
apps/codecs/sid.c
Normal file
1342
apps/codecs/sid.c
Normal file
File diff suppressed because it is too large
Load diff
|
@ -81,6 +81,7 @@ static const struct format_list formats[] =
|
|||
{ AFMT_SHN, "shn" },
|
||||
{ AFMT_AIFF, "aif" },
|
||||
{ AFMT_AIFF, "aiff" },
|
||||
{ AFMT_SID, "sid" },
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -1341,6 +1342,50 @@ static bool get_aiff_metadata(int fd, struct mp3entry* id3)
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool get_sid_metadata(int fd, struct mp3entry* id3)
|
||||
{
|
||||
/* Use the trackname part of the id3 structure as a temporary buffer */
|
||||
unsigned char* buf = id3->path;
|
||||
int read_bytes;
|
||||
char *p;
|
||||
|
||||
|
||||
if ((lseek(fd, 0, SEEK_SET) < 0)
|
||||
|| ((read_bytes = read(fd, buf, sizeof(id3->path))) < 44))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((memcmp(buf, "PSID",4) != 0))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
p = id3->id3v2buf;
|
||||
|
||||
/* Copy Title */
|
||||
strcpy(p, &buf[0x16]);
|
||||
id3->title = p;
|
||||
p += strlen(p)+1;
|
||||
|
||||
/* Copy Artist */
|
||||
strcpy(p, &buf[0x36]);
|
||||
id3->artist = p;
|
||||
p += strlen(p)+1;
|
||||
|
||||
id3->bitrate = 706;
|
||||
id3->frequency = 44100;
|
||||
/* New idea as posted by Marco Alanen (ravon):
|
||||
* Set the songlength in seconds to the number of subsongs
|
||||
* so every second represents a subsong.
|
||||
* Users can then skip the current subsong by seeking */
|
||||
id3->length = (buf[0xf]-1)*1000;
|
||||
id3->vbr = false;
|
||||
id3->filesize = filesize(fd);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Simple file type probing by looking at the filename extension. */
|
||||
unsigned int probe_file_format(const char *filename)
|
||||
{
|
||||
|
@ -1546,6 +1591,14 @@ bool get_metadata(struct track_info* track, int fd, const char* trackname,
|
|||
}
|
||||
/* TODO: read the id3v2 header if it exists */
|
||||
break;
|
||||
|
||||
case AFMT_SID:
|
||||
if (!get_sid_metadata(fd, &(track->id3)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
#endif /* CONFIG_CODEC == SWCODEC */
|
||||
|
||||
case AFMT_AIFF:
|
||||
|
|
|
@ -96,6 +96,7 @@ static volatile bool paused;
|
|||
#define CODEC_AAC "/.rockbox/codecs/aac.codec"
|
||||
#define CODEC_SHN "/.rockbox/codecs/shorten.codec"
|
||||
#define CODEC_AIFF "/.rockbox/codecs/aiff.codec"
|
||||
#define CODEC_SID "/.rockbox/codecs/sid.codec"
|
||||
|
||||
/* default point to start buffer refill */
|
||||
#define AUDIO_DEFAULT_WATERMARK (1024*512)
|
||||
|
@ -1475,6 +1476,9 @@ static const char *get_codec_path(int codectype) {
|
|||
case AFMT_AIFF:
|
||||
logf("Codec: PCM AIFF");
|
||||
return CODEC_AIFF;
|
||||
case AFMT_SID:
|
||||
logf("Codec: SID");
|
||||
return CODEC_SID;
|
||||
default:
|
||||
logf("Codec: Unsupported");
|
||||
return NULL;
|
||||
|
|
|
@ -101,6 +101,7 @@ const struct filetype filetypes[] = {
|
|||
{ "shn", TREE_ATTR_MPA, Icon_Audio, VOICE_EXT_MPA },
|
||||
{ "aif", TREE_ATTR_MPA, Icon_Audio, VOICE_EXT_MPA },
|
||||
{ "aiff",TREE_ATTR_MPA, Icon_Audio, VOICE_EXT_MPA },
|
||||
{ "sid", TREE_ATTR_MPA, Icon_Audio, VOICE_EXT_MPA },
|
||||
#endif
|
||||
{ "m3u", TREE_ATTR_M3U, Icon_Playlist, LANG_PLAYLIST },
|
||||
{ "cfg", TREE_ATTR_CFG, Icon_Config, VOICE_EXT_CFG },
|
||||
|
|
|
@ -214,3 +214,4 @@ Ulrich Pegelow
|
|||
Andreas Mattsson
|
||||
Daniel Ankers
|
||||
Paul Louden
|
||||
Rainer Sinsch
|
||||
|
|
|
@ -42,6 +42,7 @@ enum {
|
|||
AFMT_AAC, /* Advanced Audio Coding (AAC) in M4A container */
|
||||
AFMT_SHN, /* Shorten */
|
||||
AFMT_AIFF, /* Audio Interchange File Format */
|
||||
AFMT_SID, /* SID File Format */
|
||||
|
||||
/* New formats must be added to the end of this list */
|
||||
|
||||
|
|
|
@ -103,6 +103,7 @@ static const char* const codec_labels[] = {
|
|||
"AAC", /* Advanced Audio Coding in M4A container */
|
||||
"SHN", /* Shorten */
|
||||
"AIFF", /* Audio Interchange File Format */
|
||||
"SID", /* SID File Format */
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue