diff options
Diffstat (limited to 'lib/rbcodec/codecs/libopus/ogg')
-rw-r--r-- | lib/rbcodec/codecs/libopus/ogg/os_types.h | 66 |
1 files changed, 32 insertions, 34 deletions
diff --git a/lib/rbcodec/codecs/libopus/ogg/os_types.h b/lib/rbcodec/codecs/libopus/ogg/os_types.h index 55f0bf559c..c97f4072a3 100644 --- a/lib/rbcodec/codecs/libopus/ogg/os_types.h +++ b/lib/rbcodec/codecs/libopus/ogg/os_types.h | |||
@@ -1,56 +1,54 @@ | |||
1 | #include "config.h" | 1 | #ifndef OS_TYPES_H |
2 | #include <stdint.h> | 2 | #define OS_TYPES_H |
3 | #include "codeclib.h" | 3 | #include "codeclib.h" |
4 | #include <stdint.h> | ||
5 | #include <tlsf.h> | ||
4 | 6 | ||
5 | #ifdef SIMULATOR | 7 | static inline void ogg_malloc_init(void) |
6 | |||
7 | #include <stdio.h> | ||
8 | |||
9 | static inline void* _ogg_malloc(size_t size) | ||
10 | { | 8 | { |
11 | void *buf; | 9 | size_t bufsize; |
12 | 10 | void* buf = ci->codec_get_buffer(&bufsize); | |
13 | printf("ogg_malloc %d", size); | 11 | init_memory_pool(bufsize, buf); |
14 | buf = codec_malloc(size); | ||
15 | printf(" = %p\n", buf); | ||
16 | |||
17 | return buf; | ||
18 | } | 12 | } |
19 | 13 | ||
20 | static inline void* _ogg_calloc(size_t nmemb, size_t size) | 14 | static inline void ogg_malloc_destroy(void) |
21 | { | 15 | { |
22 | printf("ogg_calloc %d %d\n", nmemb, size); | 16 | size_t bufsize; |
23 | return codec_calloc(nmemb, size); | 17 | void* buf = ci->codec_get_buffer(&bufsize); |
18 | destroy_memory_pool(buf); | ||
24 | } | 19 | } |
25 | 20 | ||
26 | static inline void* _ogg_realloc(void *ptr, size_t size) | 21 | static inline void *_ogg_malloc(size_t size) |
27 | { | 22 | { |
28 | void *buf; | 23 | void* x = tlsf_malloc(size); |
29 | 24 | DEBUGF("ogg_malloc %zu = %p\n", size, x); | |
30 | printf("ogg_realloc %p %d", ptr, size); | 25 | return x; |
31 | buf = codec_realloc(ptr, size); | ||
32 | printf(" = %p\n", buf); | ||
33 | return buf; | ||
34 | } | 26 | } |
35 | 27 | ||
36 | static inline void _ogg_free(void *ptr) | 28 | static inline void *_ogg_calloc(size_t nmemb, size_t size) |
37 | { | 29 | { |
38 | printf("ogg_free %p\n", ptr); | 30 | void *x = tlsf_calloc(nmemb, size); |
39 | codec_free(ptr); | 31 | DEBUGF("ogg_calloc %zu %zu\n", nmemb, size); |
32 | return x; | ||
40 | } | 33 | } |
41 | 34 | ||
42 | #else | 35 | static inline void *_ogg_realloc(void *ptr, size_t size) |
43 | 36 | { | |
44 | #define _ogg_malloc codec_malloc | 37 | void *x = tlsf_realloc(ptr, size); |
45 | #define _ogg_calloc codec_calloc | 38 | DEBUGF("ogg_realloc %p %zu = %p\n", ptr, size, x); |
46 | #define _ogg_realloc codec_realloc | 39 | return x; |
47 | #define _ogg_free codec_free | 40 | } |
48 | 41 | ||
49 | #endif | 42 | static inline void _ogg_free(void* ptr) |
43 | { | ||
44 | DEBUGF("ogg_free %p\n", ptr); | ||
45 | tlsf_free(ptr); | ||
46 | } | ||
50 | 47 | ||
51 | typedef int16_t ogg_int16_t; | 48 | typedef int16_t ogg_int16_t; |
52 | typedef uint16_t ogg_uint16_t; | 49 | typedef uint16_t ogg_uint16_t; |
53 | typedef int32_t ogg_int32_t; | 50 | typedef int32_t ogg_int32_t; |
54 | typedef uint32_t ogg_uint32_t; | 51 | typedef uint32_t ogg_uint32_t; |
55 | typedef int64_t ogg_int64_t; | 52 | typedef int64_t ogg_int64_t; |
53 | #endif /* OS_TYPES_H */ | ||
56 | 54 | ||