/* NOTE : static internal functions does not check anything on incomming parameters
* Caller should takecare it
*/
-static size_t _pkt_calculate_video_buffer_size(media_packet_s *pkt);
-static size_t _pkt_calculate_audio_buffer_size(media_packet_s *pkt);
-static size_t _pkt_calculate_text_buffer_size(media_packet_s *pkt);
+static size_t __pkt_calculate_video_buffer_size(media_packet_s *pkt);
+static size_t __pkt_calculate_audio_buffer_size(media_packet_s *pkt);
+static size_t __pkt_calculate_text_buffer_size(media_packet_s *pkt);
static uint32_t _convert_to_tbm_surface_format(media_format_mimetype_e format_type);
-static void *_aligned_malloc_normal_buffer_type(size_t size, int alignment);
-static void _aligned_free_normal_buffer_type(void *buffer_ptr);
-static int _pkt_alloc_buffer(media_packet_s *pkt);
-static int _pkt_dealloc_buffer(media_packet_s *handle);
+static void *__aligned_malloc_normal_buffer_type(size_t size, int alignment);
+static void __aligned_free_normal_buffer_type(void *buffer_ptr);
+static int __pkt_alloc_buffer(media_packet_s *pkt);
+static int __pkt_dealloc_buffer(media_packet_s *handle);
int media_packet_create_alloc(media_format_h fmt, media_packet_finalize_cb fcb, void *fcb_data, media_packet_h *packet)
{
handle->format = MEDIA_FORMAT_CAST(fmt);
/* alloc buffer */
- ret = _pkt_alloc_buffer(handle);
+ ret = __pkt_alloc_buffer(handle);
if (ret != MEDIA_PACKET_ERROR_NONE) {
- LOGE("[%s] failed _pkt_alloc_buffer(), err = (0x%08x)", __FUNCTION__, ret); //LCOV_EXCL_LINE
+ LOGE("[%s] failed __pkt_alloc_buffer(), err = (0x%08x)", __FUNCTION__, ret); //LCOV_EXCL_LINE
goto fail;
}
handle = (media_packet_s *)packet;
/* alloc buffer */
- int err = _pkt_alloc_buffer(handle);
+ int err = __pkt_alloc_buffer(handle);
if (err != MEDIA_PACKET_ERROR_NONE) {
LOGE("[%s] MEDIA_PACKET_ERROR_OUT_OF_MEMORY(0x%08x)", __FUNCTION__, MEDIA_PACKET_ERROR_OUT_OF_MEMORY); //LCOV_EXCL_LINE
ret = err;
}
-static int _pkt_alloc_buffer(media_packet_s *pkt)
+static int __pkt_alloc_buffer(media_packet_s *pkt)
{
/* skip validating pkt */
size_t buffersize = 0;
if (pkt->type == MEDIA_BUFFER_TYPE_NORMAL) {
/* need to use format,width,height to get buffer size */
if (MEDIA_FORMAT_IS_VIDEO(pkt->format))
- buffersize = _pkt_calculate_video_buffer_size(pkt);
+ buffersize = __pkt_calculate_video_buffer_size(pkt);
else if (MEDIA_FORMAT_IS_AUDIO(pkt->format))
- buffersize = _pkt_calculate_audio_buffer_size(pkt);
+ buffersize = __pkt_calculate_audio_buffer_size(pkt);
else
- buffersize = _pkt_calculate_text_buffer_size(pkt);
+ buffersize = __pkt_calculate_text_buffer_size(pkt);
/* 16bytes aligned malloc */
- pkt->data = _aligned_malloc_normal_buffer_type(buffersize, 16);
+ pkt->data = __aligned_malloc_normal_buffer_type(buffersize, 16);
if (!pkt->data)
return MEDIA_PACKET_ERROR_OUT_OF_MEMORY;
pkt->size = buffersize;
return MEDIA_PACKET_ERROR_NONE;
}
-static int _pkt_dealloc_buffer(media_packet_s *handle)
+static int __pkt_dealloc_buffer(media_packet_s *handle)
{
if (handle->type == MEDIA_BUFFER_TYPE_TBM_SURFACE) {
if (handle->surface_data)
tbm_surface_destroy((tbm_surface_h)handle->surface_data);
} else if (handle->type == MEDIA_BUFFER_TYPE_NORMAL) {
if (handle->data) {
- _aligned_free_normal_buffer_type(handle->data);
+ __aligned_free_normal_buffer_type(handle->data);
handle->data = NULL;
}
} else if (handle->type == MEDIA_BUFFER_TYPE_EXTERNAL_TBM_SURFACE || handle->type == MEDIA_BUFFER_TYPE_EXTERNAL_MEMORY) {
#define _ROUND_UP_X(v, x) (((v) + _GEN_MASK(x)) & ~_GEN_MASK(x))
#define _DIV_ROUND_UP_X(v, x) (((v) + _GEN_MASK(x)) >> (x))
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
-static size_t _pkt_calculate_video_buffer_size(media_packet_s *pkt)
+static size_t __pkt_calculate_video_buffer_size(media_packet_s *pkt)
{
int stride = 0;
int width = 0;
#define EAC3_MAX_NCH (2)
#define OPUS_MAX_NCH (2)
-static size_t _pkt_calculate_audio_buffer_size(media_packet_s *pkt)
+static size_t __pkt_calculate_audio_buffer_size(media_packet_s *pkt)
{
int channel = 0;
int bit = 0;
}
#define TXT_MAX_FRM_SIZE (2048)
-static size_t _pkt_calculate_text_buffer_size(media_packet_s *pkt)
+static size_t __pkt_calculate_text_buffer_size(media_packet_s *pkt)
{
size_t buffersize = 0;
switch (pkt->format->mimetype) {
}
}
- ret = _pkt_dealloc_buffer(handle);
+ ret = __pkt_dealloc_buffer(handle);
if (ret != MEDIA_PACKET_ERROR_NONE) {
- LOGE("[%s] failed _pkt_dealloc_buffer(), err = (0x%08x)", __FUNCTION__, ret); //LCOV_EXCL_LINE
+ LOGE("[%s] failed __pkt_dealloc_buffer(), err = (0x%08x)", __FUNCTION__, ret); //LCOV_EXCL_LINE
return ret;
}
/* unreference media_format */
return tbm_format;
}
-static void *_aligned_malloc_normal_buffer_type(size_t size, int alignment)
+static void *__aligned_malloc_normal_buffer_type(size_t size, int alignment)
{
unsigned char *buffer_ptr;
unsigned char *temp_ptr;
return NULL;
}
-static void _aligned_free_normal_buffer_type(void *buffer_ptr)
+static void __aligned_free_normal_buffer_type(void *buffer_ptr)
{
unsigned char *ptr;
if (buffer_ptr == NULL)
#include <media_packet_pool.h>
#include <media_packet_pool_private.h>
-static gboolean _is_packet_in_queue(media_packet_pool_s *pool_handle, media_packet_h packet);
-static int _packet_finalize_cb(media_packet_h packet, int error_code, void *user_data);
+static gboolean __is_packet_in_queue(media_packet_pool_s *pool_handle, media_packet_h packet);
+static int __packet_finalize_cb(media_packet_h packet, int error_code, void *user_data);
int media_packet_pool_create(media_packet_pool_h *pool)
{
return MEDIA_PACKET_ERROR_NONE;
}
-static int _packet_finalize_cb(media_packet_h packet, int error_code, void *user_data)
+static int __packet_finalize_cb(media_packet_h packet, int error_code, void *user_data)
{
int ret = MEDIA_PACKET_ERROR_NONE;
media_packet_pool_h pool = NULL;
}
for (i = 0; i < pool_handle->pool_size_min; i++) {
- if (media_packet_create_alloc(pool_handle->fmt_h, _packet_finalize_cb, pool_handle, &pool_handle->packet[i]) != MEDIA_PACKET_ERROR_NONE) {
+ if (media_packet_create_alloc(pool_handle->fmt_h, __packet_finalize_cb, pool_handle, &pool_handle->packet[i]) != MEDIA_PACKET_ERROR_NONE) {
LOGE("The media packet pool is full or out of memory..."); //LCOV_EXCL_LINE
return MEDIA_PACKET_ERROR_INVALID_OPERATION;
}
LOGD("no packet in pool, but able to allocate new one [%d/%d]",
pool_handle->pool_size, pool_handle->pool_size_max);
- if (media_packet_create_alloc(pool_handle->fmt_h, _packet_finalize_cb,
+ if (media_packet_create_alloc(pool_handle->fmt_h, __packet_finalize_cb,
pool_handle, &pool_handle->packet[pool_handle->pool_size]) != MEDIA_PACKET_ERROR_NONE) {
LOGE("failed to allocate new packet");
ret = MEDIA_PACKET_ERROR_INVALID_OPERATION;
return ret;
}
-static gboolean _is_packet_in_queue(media_packet_pool_s *pool_handle, media_packet_h packet)
+static gboolean __is_packet_in_queue(media_packet_pool_s *pool_handle, media_packet_h packet)
{
int i;
for (i = 0; i < pool_handle->pool_size; i++) {
return MEDIA_PACKET_ERROR_INVALID_OPERATION;
}
- if (_is_packet_in_queue(pool_handle, pkt)) {
+ if (__is_packet_in_queue(pool_handle, pkt)) {
g_queue_push_tail(pool_handle->queue, pkt);
g_cond_signal(&pool_handle->queue_cond);
LOGD("The packet released to pool is %p..\n", pkt);