1
0
Fork 0
forked from len0rd/rockbox

Patch #1203309 by David Bryant - WavPack codec fix and performance enhancement

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6481 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Linus Nielsen Feltzing 2005-05-17 06:32:49 +00:00
parent fe1ce9d842
commit 6705a88347
6 changed files with 512 additions and 271 deletions

View file

@ -19,6 +19,8 @@
#include <string.h>
static void strcpy_loc (char *dst, char *src) { while (*src) *dst++ = *src++; *dst = 0; }
///////////////////////////// local table storage ////////////////////////////
const ulong sample_rates [] = { 6000, 8000, 9600, 11025, 12000, 16000, 22050,
@ -49,7 +51,6 @@ WavpackContext *WavpackOpenFileInput (read_stream infile, char *error)
{
WavpackStream *wps = &wpc.stream;
ulong bcount;
(void)error;
CLEAR (wpc);
wpc.infile = infile;
@ -64,12 +65,12 @@ WavpackContext *WavpackOpenFileInput (read_stream infile, char *error)
bcount = read_next_header (wpc.infile, &wps->wphdr);
if (bcount == (ulong) -1) {
/*strcpy (error, "not compatible with this version of WavPack file!");*/
strcpy_loc (error, "invalid WavPack file!");
return NULL;
}
if ((wps->wphdr.flags & UNKNOWN_FLAGS) || wps->wphdr.version < 0x402 || wps->wphdr.version > 0x40f) {
/*strcpy (error, "not compatible with this version of WavPack file!");*/
strcpy_loc (error, "invalid WavPack file!");
return NULL;
}
@ -77,8 +78,8 @@ WavpackContext *WavpackOpenFileInput (read_stream infile, char *error)
wpc.total_samples = wps->wphdr.total_samples;
if (!unpack_init (&wpc)) {
/*strcpy (error, wpc.error_message [0] ? wpc.error_message :
"not compatible with this version of WavPack file!");*/
strcpy_loc (error, wpc.error_message [0] ? wpc.error_message :
"invalid WavPack file!");
return NULL;
}
@ -170,7 +171,7 @@ ulong WavpackUnpackSamples (WavpackContext *wpc, long *buffer, ulong samples)
break;
if (wps->wphdr.version < 0x402 || wps->wphdr.version > 0x40f) {
/*strcpy (wpc->error_message, "not compatible with this version of WavPack file!");*/
strcpy_loc (wpc->error_message, "invalid WavPack file!");
break;
}