diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2005-06-05 23:05:10 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2005-06-05 23:05:10 +0000 |
commit | 1c497e60457a2e125a3e4fc839d6453bfe585834 (patch) | |
tree | 4688a25afda658a88e900a0c5a6d4f6f755c3268 /apps/plugins/lib | |
parent | b1e1e44041f7c078a8a1e4f31ab0cde03efd1b2a (diff) |
First audio codec playback attempt by Miikka Pekkarinen
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6574 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/lib')
-rw-r--r-- | apps/plugins/lib/SOURCES | 3 | ||||
-rw-r--r-- | apps/plugins/lib/codeclib.c | 36 | ||||
-rw-r--r-- | apps/plugins/lib/codeclib.h | 46 | ||||
-rw-r--r-- | apps/plugins/lib/xxx2wav.c | 9 | ||||
-rw-r--r-- | apps/plugins/lib/xxx2wav.h | 1 |
5 files changed, 93 insertions, 2 deletions
diff --git a/apps/plugins/lib/SOURCES b/apps/plugins/lib/SOURCES index 0e8e14cbdf..58356af1ec 100644 --- a/apps/plugins/lib/SOURCES +++ b/apps/plugins/lib/SOURCES @@ -35,4 +35,7 @@ playergfx.c #endif #if CONFIG_HWCODEC == MASNONE /* software codec platforms */ xxx2wav.c +#ifdef IRIVER_H100 +codeclib.c +#endif #endif diff --git a/apps/plugins/lib/codeclib.c b/apps/plugins/lib/codeclib.c new file mode 100644 index 0000000000..d9866ef98d --- /dev/null +++ b/apps/plugins/lib/codeclib.c @@ -0,0 +1,36 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2005 Dave Chapman + * + * 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. + * + ****************************************************************************/ + +/* Various "helper functions" common to all the xxx2wav decoder plugins */ + +#include "plugin.h" +#include "playback.h" +#include "codeclib.h" + +struct plugin_api* local_rb; + +int codec_init(struct plugin_api* rb, struct codec_api* ci) { + local_rb = rb; + + xxx2wav_set_api(rb); + mem_ptr = 0; + mallocbuf = (unsigned char *)ci->get_codec_memory((size_t *)&bufsize); + + return 0; +} diff --git a/apps/plugins/lib/codeclib.h b/apps/plugins/lib/codeclib.h new file mode 100644 index 0000000000..876e69b57e --- /dev/null +++ b/apps/plugins/lib/codeclib.h @@ -0,0 +1,46 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2005 Dave Chapman + * + * 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. + * + ****************************************************************************/ + +/* Various "helper functions" common to all the xxx2wav decoder plugins */ + +#if CONFIG_CPU == MCF5249 && !defined(SIMULATOR) +#define ICODE_ATTR __attribute__ ((section(".icode"))) +#define IDATA_ATTR __attribute__ ((section(".idata"))) +#define USE_IRAM 1 +#else +#define ICODE_ATTR +#define IDATA_ATTR +#endif + +extern int mem_ptr; +extern int bufsize; +extern unsigned char* mallocbuf; // 512K from the start of MP3 buffer + +void* codec_malloc(size_t size); +void* codec_calloc(size_t nmemb, size_t size); +void* codec_alloca(size_t size); +void* codec_realloc(void* ptr, size_t size); +void codec_free(void* ptr); +void *memcpy(void *dest, const void *src, size_t n); +void *memset(void *s, int c, size_t n); +int memcmp(const void *s1, const void *s2, size_t n); +void* memmove(const void *s1, const void *s2, size_t n); + +int codec_init(struct plugin_api* rb, struct codec_api* ci); + diff --git a/apps/plugins/lib/xxx2wav.c b/apps/plugins/lib/xxx2wav.c index d864527fc2..ed67184a05 100644 --- a/apps/plugins/lib/xxx2wav.c +++ b/apps/plugins/lib/xxx2wav.c @@ -40,14 +40,14 @@ void* codec_malloc(size_t size) { x=&mallocbuf[mem_ptr]; mem_ptr+=(size+3)&~3; // Keep memory 32-bit aligned (if it was already?) - +/* if(TIME_AFTER(*(local_rb->current_tick), last_tick + HZ)) { local_rb->snprintf(s,30,"Memory used: %d",mem_ptr); local_rb->lcd_putsxy(0,80,s); last_tick = *(local_rb->current_tick); local_rb->lcd_update(); - } + }*/ return(x); } @@ -162,6 +162,11 @@ static unsigned char wav_header[44]={'R','I','F','F', // 0 - ChunkID }; +void xxx2wav_set_api(struct plugin_api* rb) +{ + local_rb = rb; +} + int local_init(char* infilename, char* outfilename, file_info_struct* file_info, struct plugin_api* rb) { char s[32]; int i,n,bytesleft; diff --git a/apps/plugins/lib/xxx2wav.h b/apps/plugins/lib/xxx2wav.h index 7e3afceaba..7e1b942820 100644 --- a/apps/plugins/lib/xxx2wav.h +++ b/apps/plugins/lib/xxx2wav.h @@ -64,3 +64,4 @@ void* memmove(const void *s1, const void *s2, size_t n); void display_status(file_info_struct* file_info); int local_init(char* infilename, char* outfilename, file_info_struct* file_info, struct plugin_api* rb); void close_wav(file_info_struct* file_info); +void xxx2wav_set_api(struct plugin_api* rb); |