forked from len0rd/rockbox
Patch #1421483 - AIFF codec by Jvo Studer
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8524 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
6479e4c95e
commit
fbd8e5d29c
9 changed files with 407 additions and 2 deletions
|
|
@ -63,6 +63,7 @@ $(OBJDIR)/wavpack.elf: $(OBJDIR)/wavpack.o $(CODECDEPS) $(BUILDDIR)/libwavpack.a
|
||||||
$(OBJDIR)/alac.elf: $(OBJDIR)/alac.o $(CODECDEPS) $(BUILDDIR)/libalac.a $(BUILDDIR)/libm4a.a
|
$(OBJDIR)/alac.elf: $(OBJDIR)/alac.o $(CODECDEPS) $(BUILDDIR)/libalac.a $(BUILDDIR)/libm4a.a
|
||||||
$(OBJDIR)/aac.elf: $(OBJDIR)/aac.o $(CODECDEPS) $(BUILDDIR)/libfaad.a $(BUILDDIR)/libm4a.a
|
$(OBJDIR)/aac.elf: $(OBJDIR)/aac.o $(CODECDEPS) $(BUILDDIR)/libfaad.a $(BUILDDIR)/libm4a.a
|
||||||
$(OBJDIR)/shorten.elf: $(OBJDIR)/shorten.o $(CODECDEPS) $(BUILDDIR)/libffmpegFLAC.a
|
$(OBJDIR)/shorten.elf: $(OBJDIR)/shorten.o $(CODECDEPS) $(BUILDDIR)/libffmpegFLAC.a
|
||||||
|
$(OBJDIR)/aiff.elf: $(OBJDIR)/aiff.o $(CODECDEPS)
|
||||||
|
|
||||||
$(OBJDIR)/%.elf: $(OBJDIR)/%.o $(CODECDEPS)
|
$(OBJDIR)/%.elf: $(OBJDIR)/%.o $(CODECDEPS)
|
||||||
$(ELFIT)
|
$(ELFIT)
|
||||||
|
|
|
||||||
|
|
@ -11,4 +11,5 @@ alac.c
|
||||||
aac.c
|
aac.c
|
||||||
#endif
|
#endif
|
||||||
shorten.c
|
shorten.c
|
||||||
|
aiff.c
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
314
apps/codecs/aiff.c
Normal file
314
apps/codecs/aiff.c
Normal file
|
|
@ -0,0 +1,314 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* __________ __ ___.
|
||||||
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
|
* \/ \/ \/ \/ \/
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Copyright (c) 2005 Jvo Studer
|
||||||
|
*
|
||||||
|
* All files in this archive are subject to the GNU General Public License.
|
||||||
|
* See the file COPYING in the source tree root for full license agreement.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "codeclib.h"
|
||||||
|
#include "inttypes.h"
|
||||||
|
|
||||||
|
CODEC_HEADER
|
||||||
|
|
||||||
|
struct codec_api* rb;
|
||||||
|
|
||||||
|
/* This codec supports AIFF files with the following formats:
|
||||||
|
* - PCM, 8 and 16 bits, mono or stereo
|
||||||
|
*/
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
AIFF_FORMAT_PCM = 0x0001, /* AIFF PCM Format (big endian) */
|
||||||
|
IEEE_FORMAT_FLOAT = 0x0003, /* IEEE Float */
|
||||||
|
AIFF_FORMAT_ALAW = 0x0004, /* AIFC ALaw compressed */
|
||||||
|
AIFF_FORMAT_ULAW = 0x0005 /* AIFC uLaw compressed */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Maximum number of bytes to process in one iteration */
|
||||||
|
/* for 44.1kHz stereo 16bits, this represents 0.023s ~= 1/50s */
|
||||||
|
#define AIF_CHUNK_SIZE (1024*2)
|
||||||
|
|
||||||
|
#ifdef USE_IRAM
|
||||||
|
extern char iramcopy[];
|
||||||
|
extern char iramstart[];
|
||||||
|
extern char iramend[];
|
||||||
|
extern char iedata[];
|
||||||
|
extern char iend[];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static int16_t int16_samples[AIF_CHUNK_SIZE] IBSS_ATTR;
|
||||||
|
|
||||||
|
|
||||||
|
/* this is the codec entry point */
|
||||||
|
enum codec_status codec_start(struct codec_api* api)
|
||||||
|
{
|
||||||
|
struct codec_api* ci;
|
||||||
|
uint32_t numbytes, bytesdone;
|
||||||
|
uint16_t numChannels = 0;
|
||||||
|
uint32_t numSampleFrames = 0;
|
||||||
|
uint16_t sampleSize = 0;
|
||||||
|
uint32_t sampleRate = 0;
|
||||||
|
uint32_t i;
|
||||||
|
size_t n, aifbufsize;
|
||||||
|
int endofstream;
|
||||||
|
unsigned char* buf;
|
||||||
|
uint16_t* aifbuf;
|
||||||
|
long chunksize;
|
||||||
|
uint32_t offset2snd = 0;
|
||||||
|
uint16_t blockSize = 0;
|
||||||
|
uint32_t avgbytespersec = 0;
|
||||||
|
off_t firstblockposn; /* position of the first block in file */
|
||||||
|
int shortorlong = 1; /* do we output shorts (1) or longs (2)? */
|
||||||
|
int32_t * const int32_samples = (int32_t*)int16_samples;
|
||||||
|
|
||||||
|
/* Generic codec initialisation */
|
||||||
|
rb = api;
|
||||||
|
ci = api;
|
||||||
|
|
||||||
|
#ifdef USE_IRAM
|
||||||
|
ci->memcpy(iramstart, iramcopy, iramend-iramstart);
|
||||||
|
ci->memset(iedata, 0, iend - iedata);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
ci->configure(CODEC_SET_FILEBUF_WATERMARK, (int *)(1024*512));
|
||||||
|
ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, (int *)(1024*256));
|
||||||
|
|
||||||
|
ci->configure(DSP_DITHER, (bool *)false);
|
||||||
|
|
||||||
|
next_track:
|
||||||
|
|
||||||
|
if (codec_init(api)) {
|
||||||
|
i = CODEC_ERROR;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (!*ci->taginfo_ready)
|
||||||
|
ci->yield();
|
||||||
|
|
||||||
|
/* assume the AIFF header is less than 1024 bytes */
|
||||||
|
buf=ci->request_buffer((long *)&n,1024);
|
||||||
|
if (n<44) {
|
||||||
|
i = CODEC_ERROR;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
if ((memcmp(buf,"FORM",4)!=0) || (memcmp(&buf[8],"AIFF",4)!=0)) {
|
||||||
|
i = CODEC_ERROR;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
buf += 12;
|
||||||
|
n -= 12;
|
||||||
|
numbytes = 0;
|
||||||
|
|
||||||
|
/* read until 'SSND' chunk, which typically is last */
|
||||||
|
while(numbytes == 0 && n >= 8) {
|
||||||
|
/* chunkSize */
|
||||||
|
i = ((buf[4]<<24)|(buf[5]<<16)|(buf[6]<<8)|buf[7]);
|
||||||
|
if (memcmp(buf,"COMM",4)==0) {
|
||||||
|
if (i != 18) {
|
||||||
|
DEBUGF("CODEC_ERROR: 'COMM' chunk size=%lu != 18\n",i);
|
||||||
|
i = CODEC_ERROR;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
/* numChannels */
|
||||||
|
numChannels = ((buf[8]<<8)|buf[9]);
|
||||||
|
/* numSampleFrames */
|
||||||
|
numSampleFrames = ((buf[10]<<24)|(buf[11]<<16)|(buf[12]<<8)|buf[13]);
|
||||||
|
/* sampleSize */
|
||||||
|
sampleSize = ((buf[14]<<8)|buf[15]);
|
||||||
|
/* sampleRate (don't use last 4 bytes, only integer fs) */
|
||||||
|
if (buf[16] != 0x40) {
|
||||||
|
DEBUGF("CODEC_ERROR: wierd sampling rate (no @)\n",i);
|
||||||
|
i = CODEC_ERROR;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
sampleRate = ((buf[18]<<24)|(buf[19]<<16)|(buf[20]<<8)|buf[21])+1;
|
||||||
|
sampleRate = sampleRate >> (16+14-buf[17]);
|
||||||
|
/* calc average bytes per second */
|
||||||
|
avgbytespersec = sampleRate*numChannels*sampleSize/8;
|
||||||
|
}
|
||||||
|
else if (memcmp(buf,"SSND",4)==0) {
|
||||||
|
if (sampleSize == 0) {
|
||||||
|
DEBUGF("CODEC_ERROR: unsupported chunk order\n");
|
||||||
|
i = CODEC_ERROR;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
/* offset2snd */
|
||||||
|
offset2snd = ((buf[8]<<8)|buf[9]);
|
||||||
|
/* blockSize */
|
||||||
|
blockSize = ((buf[10]<<8)|buf[11]);
|
||||||
|
if (blockSize == 0)
|
||||||
|
blockSize = numChannels*sampleSize;
|
||||||
|
numbytes = i-8-offset2snd;
|
||||||
|
i = 8+offset2snd; /* advance to the beginning of data */
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
DEBUGF("unsupported AIFF chunk: '%c%c%c%c', size=%lu\n",
|
||||||
|
buf[0], buf[1], buf[2], buf[3], i);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i & 0x01) /* odd chunk sizes must be padded */
|
||||||
|
i++;
|
||||||
|
buf += i+8;
|
||||||
|
if (n < (i+8)) {
|
||||||
|
DEBUGF("CODEC_ERROR: AIFF header size > 1024\n");
|
||||||
|
i = CODEC_ERROR;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
n -= i+8;
|
||||||
|
} /* while 'SSND' */
|
||||||
|
|
||||||
|
if (numChannels == 0) {
|
||||||
|
DEBUGF("CODEC_ERROR: 'COMM' chunk not found or 0-channels file\n");
|
||||||
|
i = CODEC_ERROR;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
if (numbytes == 0) {
|
||||||
|
DEBUGF("CODEC_ERROR: 'SSND' chunk not found or has zero length\n");
|
||||||
|
i = CODEC_ERROR;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
if (sampleSize > 24) {
|
||||||
|
DEBUGF("CODEC_ERROR: PCM with more than 24 bits per sample "
|
||||||
|
"is unsupported\n");
|
||||||
|
i = CODEC_ERROR;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
ci->configure(CODEC_DSP_ENABLE, (bool *)true);
|
||||||
|
ci->configure(DSP_SET_FREQUENCY, (long *)(ci->id3->frequency));
|
||||||
|
|
||||||
|
if (sampleSize <= 16) {
|
||||||
|
ci->configure(DSP_SET_SAMPLE_DEPTH, (int *)(16));
|
||||||
|
} else {
|
||||||
|
shortorlong = 2;
|
||||||
|
ci->configure(DSP_DITHER, (bool *)false);
|
||||||
|
ci->configure(DSP_SET_SAMPLE_DEPTH, (long *) (32));
|
||||||
|
ci->configure(DSP_SET_CLIP_MAX, (long *) (2147483647));
|
||||||
|
ci->configure(DSP_SET_CLIP_MIN, (long *) (-2147483647-1));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (numChannels == 2) {
|
||||||
|
ci->configure(DSP_SET_STEREO_MODE, (int *)STEREO_INTERLEAVED);
|
||||||
|
} else if (numChannels == 1) {
|
||||||
|
ci->configure(DSP_SET_STEREO_MODE, (int *)STEREO_MONO);
|
||||||
|
} else {
|
||||||
|
DEBUGF("CODEC_ERROR: more than 2 channels unsupported\n");
|
||||||
|
i = CODEC_ERROR;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
firstblockposn = (1024-n);
|
||||||
|
ci->advance_buffer(firstblockposn);
|
||||||
|
|
||||||
|
/* The main decoder loop */
|
||||||
|
|
||||||
|
bytesdone=0;
|
||||||
|
ci->set_elapsed(0);
|
||||||
|
endofstream=0;
|
||||||
|
/* chunksize is computed so that one chunk is about 1/50s.
|
||||||
|
* this make 4096 for 44.1kHz 16bits stereo.
|
||||||
|
* It also has to be a multiple of blockalign */
|
||||||
|
chunksize = (1 + avgbytespersec / (50*blockSize)) * blockSize;
|
||||||
|
/* check that the output buffer is big enough (convert to samplespersec,
|
||||||
|
then round to the blockSize multiple below) */
|
||||||
|
if (((uint64_t)chunksize*ci->id3->frequency*numChannels*shortorlong)
|
||||||
|
/ (uint64_t)avgbytespersec >= AIF_CHUNK_SIZE) {
|
||||||
|
chunksize = ((uint64_t)AIF_CHUNK_SIZE * avgbytespersec
|
||||||
|
/ ((uint64_t)ci->id3->frequency * numChannels * shortorlong
|
||||||
|
* blockSize)) * blockSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (!endofstream) {
|
||||||
|
uint8_t *aifbuf8;
|
||||||
|
|
||||||
|
ci->yield();
|
||||||
|
if (ci->stop_codec || ci->reload_codec) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ci->seek_time) {
|
||||||
|
uint32_t newpos;
|
||||||
|
|
||||||
|
/* use avgbytespersec to round to the closest blockalign multiple,
|
||||||
|
add firstblockposn. 64-bit casts to avoid overflows. */
|
||||||
|
newpos = (((uint64_t)avgbytespersec * (ci->seek_time - 1))
|
||||||
|
/ (1000LL*blockSize)) * blockSize;
|
||||||
|
if (newpos > numbytes)
|
||||||
|
break;
|
||||||
|
if (ci->seek_buffer(firstblockposn + newpos)) {
|
||||||
|
bytesdone = newpos;
|
||||||
|
}
|
||||||
|
ci->seek_complete();
|
||||||
|
}
|
||||||
|
aifbuf=ci->request_buffer((long *)&n,chunksize);
|
||||||
|
aifbuf8 = (uint8_t*)aifbuf;
|
||||||
|
|
||||||
|
if (n==0)
|
||||||
|
break; /* End of stream */
|
||||||
|
|
||||||
|
if (bytesdone + n > numbytes) {
|
||||||
|
n = numbytes - bytesdone;
|
||||||
|
endofstream = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
aifbufsize = sizeof(int16_samples);
|
||||||
|
|
||||||
|
if (sampleSize > 24) {
|
||||||
|
for (i=0;i<n;i+=4) {
|
||||||
|
int32_samples[i/4]=(int32_t)((aifbuf8[i]<<24)|
|
||||||
|
(aifbuf8[i+1]<<16)|(aifbuf8[i+2]<<8)|aifbuf8[i+3]);
|
||||||
|
}
|
||||||
|
aifbufsize = n;
|
||||||
|
} else if (sampleSize > 16) {
|
||||||
|
for (i=0;i<n;i+=3) {
|
||||||
|
int32_samples[i/3]=(int32_t)((aifbuf8[i]<<24)|
|
||||||
|
(aifbuf8[i+1]<<16)|(aifbuf8[i+2]<<8));
|
||||||
|
}
|
||||||
|
aifbufsize = n*4/3;
|
||||||
|
} else if (sampleSize > 8) {
|
||||||
|
/* copy data. */
|
||||||
|
for (i=0;i<n;i+=2) {
|
||||||
|
int16_samples[i/2]=(int16_t)((aifbuf8[i]<<8)|aifbuf8[i+1]);
|
||||||
|
}
|
||||||
|
aifbufsize = n;
|
||||||
|
} else {
|
||||||
|
for (i=0;i<n;i++) {
|
||||||
|
int16_samples[i] = (aifbuf8[i]<<8) - 0x8000;
|
||||||
|
}
|
||||||
|
aifbufsize = n*2;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (!ci->pcmbuf_insert((char*)int16_samples, aifbufsize)) {
|
||||||
|
ci->yield();
|
||||||
|
}
|
||||||
|
|
||||||
|
ci->advance_buffer(n);
|
||||||
|
bytesdone += n;
|
||||||
|
if (bytesdone >= numbytes) {
|
||||||
|
endofstream=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
ci->set_elapsed(bytesdone*1000LL/avgbytespersec);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ci->request_next_track())
|
||||||
|
goto next_track;
|
||||||
|
|
||||||
|
i = CODEC_OK;
|
||||||
|
exit:
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -78,6 +78,8 @@ static const struct format_list formats[] =
|
||||||
{ AFMT_ALAC, "m4a" },
|
{ AFMT_ALAC, "m4a" },
|
||||||
{ AFMT_AAC, "mp4" },
|
{ AFMT_AAC, "mp4" },
|
||||||
{ AFMT_SHN, "shn" },
|
{ AFMT_SHN, "shn" },
|
||||||
|
{ AFMT_AIFF, "aif" },
|
||||||
|
{ AFMT_AIFF, "aiff" },
|
||||||
};
|
};
|
||||||
|
|
||||||
static const unsigned short a52_bitrates[] =
|
static const unsigned short a52_bitrates[] =
|
||||||
|
|
@ -894,7 +896,6 @@ static bool get_wave_metadata(int fd, struct mp3entry* id3)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static bool get_m4a_metadata(int fd, struct mp3entry* id3)
|
static bool get_m4a_metadata(int fd, struct mp3entry* id3)
|
||||||
{
|
{
|
||||||
unsigned char* buf;
|
unsigned char* buf;
|
||||||
|
|
@ -1245,6 +1246,76 @@ static bool get_musepack_metadata(int fd, struct mp3entry *id3)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool get_aiff_metadata(int fd, struct mp3entry* id3)
|
||||||
|
{
|
||||||
|
/* Use the trackname part of the id3 structure as a temporary buffer */
|
||||||
|
unsigned char* buf = id3->path;
|
||||||
|
unsigned long numChannels = 0;
|
||||||
|
unsigned long numSampleFrames = 0;
|
||||||
|
unsigned long sampleSize = 0;
|
||||||
|
unsigned long sampleRate = 0;
|
||||||
|
unsigned long numbytes = 0;
|
||||||
|
int read_bytes;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if ((lseek(fd, 0, SEEK_SET) < 0)
|
||||||
|
|| ((read_bytes = read(fd, buf, sizeof(id3->path))) < 44))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((memcmp(buf, "FORM",4) != 0)
|
||||||
|
|| (memcmp(&buf[8], "AIFF", 4) !=0 ))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
buf += 12;
|
||||||
|
read_bytes -= 12;
|
||||||
|
|
||||||
|
while ((numbytes == 0) && (read_bytes >= 8))
|
||||||
|
{
|
||||||
|
/* chunkSize */
|
||||||
|
i = ((buf[4]<<24)|(buf[5]<<16)|(buf[6]<<8)|buf[7]);
|
||||||
|
|
||||||
|
if (memcmp(buf, "COMM", 4) == 0)
|
||||||
|
{
|
||||||
|
/* numChannels */
|
||||||
|
numChannels = ((buf[8]<<8)|buf[9]);
|
||||||
|
/* numSampleFrames */
|
||||||
|
numSampleFrames =((buf[10]<<24)|(buf[11]<<16)|(buf[12]<<8)|buf[13]);
|
||||||
|
/* sampleSize */
|
||||||
|
sampleSize = ((buf[14]<<8)|buf[15]);
|
||||||
|
/* sampleRate */
|
||||||
|
sampleRate = ((buf[18]<<24)|(buf[19]<<16)|(buf[20]<<8)|buf[21]);
|
||||||
|
sampleRate = sampleRate >> (16+14-buf[17]);
|
||||||
|
/* save format infos */
|
||||||
|
id3->bitrate = (sampleSize * numChannels * sampleRate) / 1000;
|
||||||
|
id3->frequency = sampleRate;
|
||||||
|
id3->length = (numSampleFrames / id3->frequency) * 1000;
|
||||||
|
id3->vbr = false; /* AIFF files are CBR */
|
||||||
|
id3->filesize = filesize(fd);
|
||||||
|
}
|
||||||
|
else if (memcmp(buf, "SSND", 4) == 0)
|
||||||
|
{
|
||||||
|
numbytes = i - 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i & 0x01)
|
||||||
|
{
|
||||||
|
i++; /* odd chunk sizes must be padded */
|
||||||
|
}
|
||||||
|
buf += i + 8;
|
||||||
|
read_bytes -= i + 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((numbytes == 0) || (numChannels == 0))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/* Simple file type probing by looking at the filename extension. */
|
/* Simple file type probing by looking at the filename extension. */
|
||||||
static unsigned int probe_file_format(const char *filename)
|
static unsigned int probe_file_format(const char *filename)
|
||||||
{
|
{
|
||||||
|
|
@ -1448,6 +1519,14 @@ bool get_metadata(struct track_info* track, int fd, const char* trackname,
|
||||||
/* TODO: read the id3v2 header if it exists */
|
/* TODO: read the id3v2 header if it exists */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case AFMT_AIFF:
|
||||||
|
if (!get_aiff_metadata(fd, &(track->id3)))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
/* If we don't know how to read the metadata, assume we can't play
|
/* If we don't know how to read the metadata, assume we can't play
|
||||||
the file */
|
the file */
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,7 @@ static volatile bool paused;
|
||||||
#define CODEC_ALAC "/.rockbox/codecs/alac.codec"
|
#define CODEC_ALAC "/.rockbox/codecs/alac.codec"
|
||||||
#define CODEC_AAC "/.rockbox/codecs/aac.codec"
|
#define CODEC_AAC "/.rockbox/codecs/aac.codec"
|
||||||
#define CODEC_SHN "/.rockbox/codecs/shorten.codec"
|
#define CODEC_SHN "/.rockbox/codecs/shorten.codec"
|
||||||
|
#define CODEC_AIFF "/.rockbox/codecs/aiff.codec"
|
||||||
|
|
||||||
#define AUDIO_DEFAULT_FIRST_LIMIT (1024*1024*10)
|
#define AUDIO_DEFAULT_FIRST_LIMIT (1024*1024*10)
|
||||||
#define AUDIO_FILL_CYCLE (1024*256)
|
#define AUDIO_FILL_CYCLE (1024*256)
|
||||||
|
|
@ -950,6 +951,10 @@ static bool loadcodec(bool start_play)
|
||||||
logf("Codec: SHN");
|
logf("Codec: SHN");
|
||||||
codec_path = CODEC_SHN;
|
codec_path = CODEC_SHN;
|
||||||
break;
|
break;
|
||||||
|
case AFMT_AIFF:
|
||||||
|
logf("Codec: PCM AIFF");
|
||||||
|
codec_path = CODEC_AIFF;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
logf("Codec: Unsupported");
|
logf("Codec: Unsupported");
|
||||||
codec_path = NULL;
|
codec_path = NULL;
|
||||||
|
|
|
||||||
|
|
@ -93,6 +93,8 @@ const struct filetype filetypes[] = {
|
||||||
{ "m4a", TREE_ATTR_MPA, Icon_Audio, VOICE_EXT_MPA },
|
{ "m4a", TREE_ATTR_MPA, Icon_Audio, VOICE_EXT_MPA },
|
||||||
{ "mp4", TREE_ATTR_MPA, Icon_Audio, VOICE_EXT_MPA },
|
{ "mp4", TREE_ATTR_MPA, Icon_Audio, VOICE_EXT_MPA },
|
||||||
{ "shn", TREE_ATTR_MPA, Icon_Audio, VOICE_EXT_MPA },
|
{ "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 },
|
||||||
#endif
|
#endif
|
||||||
{ "m3u", TREE_ATTR_M3U, Icon_Playlist, LANG_PLAYLIST },
|
{ "m3u", TREE_ATTR_M3U, Icon_Playlist, LANG_PLAYLIST },
|
||||||
{ "cfg", TREE_ATTR_CFG, Icon_Config, VOICE_EXT_CFG },
|
{ "cfg", TREE_ATTR_CFG, Icon_Config, VOICE_EXT_CFG },
|
||||||
|
|
|
||||||
|
|
@ -161,3 +161,4 @@ Tomasz Malesinski
|
||||||
Andrew Pilley
|
Andrew Pilley
|
||||||
Matt v.d. Westhuizen
|
Matt v.d. Westhuizen
|
||||||
Tim Crist
|
Tim Crist
|
||||||
|
Jvo Studer
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ enum {
|
||||||
AFMT_ALAC, /* Apple Lossless Audio Codec */
|
AFMT_ALAC, /* Apple Lossless Audio Codec */
|
||||||
AFMT_AAC, /* Advanced Audio Coding (AAC) in M4A container */
|
AFMT_AAC, /* Advanced Audio Coding (AAC) in M4A container */
|
||||||
AFMT_SHN, /* Shorten */
|
AFMT_SHN, /* Shorten */
|
||||||
|
AFMT_AIFF, /* Audio Interchange File Format */
|
||||||
|
|
||||||
/* New formats must be added to the end of this list */
|
/* New formats must be added to the end of this list */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -102,6 +102,7 @@ static const char* const codec_labels[] = {
|
||||||
"ALAC", /* Apple Lossless Audio Codec */
|
"ALAC", /* Apple Lossless Audio Codec */
|
||||||
"AAC", /* Advanced Audio Coding in M4A container */
|
"AAC", /* Advanced Audio Coding in M4A container */
|
||||||
"SHN", /* Shorten */
|
"SHN", /* Shorten */
|
||||||
|
"AIFF", /* Audio Interchange File Format */
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue