blob: c2e7869aa4a0653c34d562588c8894b215f93863 [file] [log] [blame]
Linus Nielsen Feltzing1c497e62005-06-05 23:05:10 +00001/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2005 Dave Chapman
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
Daniel Stenberg1dd672f2005-06-22 19:41:30 +000020#include "config.h"
21#include "codecs.h"
Thom Johansenc91e0bb2005-10-13 11:32:52 +000022#include "system.h"
23#include <sys/types.h>
Daniel Stenberg1dd672f2005-06-22 19:41:30 +000024
Thom Johansenc91e0bb2005-10-13 11:32:52 +000025#define MALLOC_BUFSIZE (512*1024)
Linus Nielsen Feltzing1c497e62005-06-05 23:05:10 +000026
Linus Nielsen Feltzing1c497e62005-06-05 23:05:10 +000027extern int mem_ptr;
28extern int bufsize;
Thom Johansenc91e0bb2005-10-13 11:32:52 +000029extern unsigned char* mp3buf; // The actual MP3 buffer from Rockbox
30extern unsigned char* mallocbuf; // 512K from the start of MP3 buffer
31extern unsigned char* filebuf; // The rest of the MP3 buffer
32
33/* Standard library functions that are used by the codecs follow here */
34
Linus Nielsen Feltzing1c497e62005-06-05 23:05:10 +000035void* codec_malloc(size_t size);
36void* codec_calloc(size_t nmemb, size_t size);
Linus Nielsen Feltzing1c497e62005-06-05 23:05:10 +000037void* codec_realloc(void* ptr, size_t size);
38void codec_free(void* ptr);
Magnus Holmgrenf5ec0fa2005-09-18 12:44:27 +000039
Linus Nielsen Feltzing1c497e62005-06-05 23:05:10 +000040void *memcpy(void *dest, const void *src, size_t n);
41void *memset(void *s, int c, size_t n);
42int memcmp(const void *s1, const void *s2, size_t n);
Dave Chapmanc3f901b2005-10-31 20:41:54 +000043void *memmove(void *s1, const void *s2, size_t n);
Thom Johansenc91e0bb2005-10-13 11:32:52 +000044
45size_t strlen(const char *s);
46char *strcpy(char *dest, const char *src);
47char *strcat(char *dest, const char *src);
48int strcmp(const char *, const char *);
49int strcasecmp(const char *, const char *);
50
51void qsort(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *));
52
53#define abs(x) ((x)>0?(x):-(x))
54#define labs(x) abs(x)
55
56/* Various codec helper functions */
Linus Nielsen Feltzing1c497e62005-06-05 23:05:10 +000057
Daniel Stenberg1dd672f2005-06-22 19:41:30 +000058int codec_init(struct codec_api* rb);
Magnus Holmgren4a537872005-07-24 15:32:28 +000059void codec_set_replaygain(struct mp3entry* id3);
Thom Johansenc91e0bb2005-10-13 11:32:52 +000060
Brandon Low05dccc32006-01-18 20:54:13 +000061#ifdef RB_PROFILE
62void __cyg_profile_func_enter(void *this_fn, void *call_site)
63 NO_PROF_ATTR ICODE_ATTR;
64void __cyg_profile_func_exit(void *this_fn, void *call_site)
65 NO_PROF_ATTR ICODE_ATTR;
66#endif