summaryrefslogtreecommitdiffstats
path: root/lib/rbcodec/codecs/libopus/ogg/os_types.h
blob: c97f4072a37c0a202700976a344998b0db23c2d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef OS_TYPES_H
#define OS_TYPES_H
#include "codeclib.h"
#include <stdint.h>
#include <tlsf.h>

static inline void ogg_malloc_init(void)
{
    size_t bufsize;
    void* buf = ci->codec_get_buffer(&bufsize);
    init_memory_pool(bufsize, buf);
}

static inline void ogg_malloc_destroy(void)
{
    size_t bufsize;
    void* buf = ci->codec_get_buffer(&bufsize);
    destroy_memory_pool(buf);
}

static inline void *_ogg_malloc(size_t size)
{
    void* x = tlsf_malloc(size);
    DEBUGF("ogg_malloc %zu = %p\n", size, x);
    return x;
}

static inline void *_ogg_calloc(size_t nmemb, size_t size)
{
    void *x = tlsf_calloc(nmemb, size);
    DEBUGF("ogg_calloc %zu %zu\n", nmemb, size);
    return x;
}

static inline void *_ogg_realloc(void *ptr, size_t size)
{
    void *x = tlsf_realloc(ptr, size);
    DEBUGF("ogg_realloc %p %zu = %p\n", ptr, size, x);
    return x;
}

static inline void _ogg_free(void* ptr)
{
    DEBUGF("ogg_free %p\n", ptr);
    tlsf_free(ptr);
}

typedef int16_t ogg_int16_t;
typedef uint16_t ogg_uint16_t;
typedef int32_t ogg_int32_t;
typedef uint32_t ogg_uint32_t;
typedef int64_t ogg_int64_t;
#endif /* OS_TYPES_H */