mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-05 09:06:50 +08:00
[osal]: add ion on android os_allocator
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@144 6e48237b-75ef-9749-8fc9-41990f28c85a
This commit is contained in:
@@ -28,20 +28,19 @@
|
||||
*/
|
||||
typedef struct {
|
||||
size_t alignment;
|
||||
MppBufferType type;
|
||||
} allocator_impl;
|
||||
} allocator_ctx;
|
||||
|
||||
MPP_RET os_allocator_normal_open(void **ctx, size_t alignment)
|
||||
{
|
||||
MPP_RET ret = MPP_OK;
|
||||
allocator_impl *p = NULL;
|
||||
allocator_ctx *p = NULL;
|
||||
|
||||
if (NULL == ctx) {
|
||||
mpp_err("os_allocator_open Linux do not accept NULL input\n");
|
||||
return MPP_ERR_NULL_PTR;
|
||||
}
|
||||
|
||||
p = mpp_malloc(allocator_impl, 1);
|
||||
p = mpp_malloc(allocator_ctx, 1);
|
||||
if (NULL == p) {
|
||||
mpp_err("os_allocator_open Linux failed to allocate context\n");
|
||||
ret = MPP_ERR_MALLOC;
|
||||
@@ -54,21 +53,22 @@ MPP_RET os_allocator_normal_open(void **ctx, size_t alignment)
|
||||
|
||||
MPP_RET os_allocator_normal_alloc(void *ctx, MppBufferInfo *info)
|
||||
{
|
||||
allocator_impl *p = NULL;
|
||||
allocator_ctx *p = NULL;
|
||||
|
||||
if (NULL == ctx) {
|
||||
mpp_err("os_allocator_alloc Linux found NULL context input\n");
|
||||
return MPP_ERR_NULL_PTR;
|
||||
}
|
||||
|
||||
p = (allocator_impl *)ctx;
|
||||
p = (allocator_ctx *)ctx;
|
||||
return os_malloc(&info->ptr, p->alignment, info->size);
|
||||
}
|
||||
|
||||
MPP_RET os_allocator_normal_free(void *ctx, MppBufferInfo *info)
|
||||
{
|
||||
(void) ctx;
|
||||
os_free(info->ptr);
|
||||
if (info->ptr)
|
||||
os_free(info->ptr);
|
||||
return MPP_OK;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user