Linus Nielsen Feltzing | 1c497e6 | 2005-06-05 23:05:10 +0000 | [diff] [blame] | 1 | /*************************************************************************** |
| 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 Stenberg | 1dd672f | 2005-06-22 19:41:30 +0000 | [diff] [blame] | 20 | #include "config.h" |
| 21 | #include "codecs.h" |
Thom Johansen | c91e0bb | 2005-10-13 11:32:52 +0000 | [diff] [blame] | 22 | #include "system.h" |
| 23 | #include <sys/types.h> |
Daniel Stenberg | 1dd672f | 2005-06-22 19:41:30 +0000 | [diff] [blame] | 24 | |
Thom Johansen | c91e0bb | 2005-10-13 11:32:52 +0000 | [diff] [blame] | 25 | #define MALLOC_BUFSIZE (512*1024) |
Linus Nielsen Feltzing | 1c497e6 | 2005-06-05 23:05:10 +0000 | [diff] [blame] | 26 | |
Linus Nielsen Feltzing | 1c497e6 | 2005-06-05 23:05:10 +0000 | [diff] [blame] | 27 | extern int mem_ptr; |
| 28 | extern int bufsize; |
Thom Johansen | c91e0bb | 2005-10-13 11:32:52 +0000 | [diff] [blame] | 29 | extern unsigned char* mp3buf; // The actual MP3 buffer from Rockbox |
| 30 | extern unsigned char* mallocbuf; // 512K from the start of MP3 buffer |
| 31 | extern 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 Feltzing | 1c497e6 | 2005-06-05 23:05:10 +0000 | [diff] [blame] | 35 | void* codec_malloc(size_t size); |
| 36 | void* codec_calloc(size_t nmemb, size_t size); |
Linus Nielsen Feltzing | 1c497e6 | 2005-06-05 23:05:10 +0000 | [diff] [blame] | 37 | void* codec_realloc(void* ptr, size_t size); |
| 38 | void codec_free(void* ptr); |
Magnus Holmgren | f5ec0fa | 2005-09-18 12:44:27 +0000 | [diff] [blame] | 39 | |
Linus Nielsen Feltzing | 1c497e6 | 2005-06-05 23:05:10 +0000 | [diff] [blame] | 40 | void *memcpy(void *dest, const void *src, size_t n); |
| 41 | void *memset(void *s, int c, size_t n); |
| 42 | int memcmp(const void *s1, const void *s2, size_t n); |
Dave Chapman | c3f901b | 2005-10-31 20:41:54 +0000 | [diff] [blame] | 43 | void *memmove(void *s1, const void *s2, size_t n); |
Thom Johansen | c91e0bb | 2005-10-13 11:32:52 +0000 | [diff] [blame] | 44 | |
| 45 | size_t strlen(const char *s); |
| 46 | char *strcpy(char *dest, const char *src); |
| 47 | char *strcat(char *dest, const char *src); |
| 48 | int strcmp(const char *, const char *); |
| 49 | int strcasecmp(const char *, const char *); |
| 50 | |
| 51 | void 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 Feltzing | 1c497e6 | 2005-06-05 23:05:10 +0000 | [diff] [blame] | 57 | |
Daniel Stenberg | 1dd672f | 2005-06-22 19:41:30 +0000 | [diff] [blame] | 58 | int codec_init(struct codec_api* rb); |
Magnus Holmgren | 4a53787 | 2005-07-24 15:32:28 +0000 | [diff] [blame] | 59 | void codec_set_replaygain(struct mp3entry* id3); |
Thom Johansen | c91e0bb | 2005-10-13 11:32:52 +0000 | [diff] [blame] | 60 | |
Brandon Low | 05dccc3 | 2006-01-18 20:54:13 +0000 | [diff] [blame^] | 61 | #ifdef RB_PROFILE |
| 62 | void __cyg_profile_func_enter(void *this_fn, void *call_site) |
| 63 | NO_PROF_ATTR ICODE_ATTR; |
| 64 | void __cyg_profile_func_exit(void *this_fn, void *call_site) |
| 65 | NO_PROF_ATTR ICODE_ATTR; |
| 66 | #endif |