Use '__' prefix to static functions 40/250740/1
authorSangchul Lee <sc11.lee@samsung.com>
Mon, 4 Jan 2021 07:19:18 +0000 (16:19 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Mon, 4 Jan 2021 07:19:18 +0000 (16:19 +0900)
[Version] 0.1.24
[Issue Type] Coding convention

Change-Id: I1eb1e82c551a340e9b23d4eff32f4cb0754deab9
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
packaging/capi-media-tool.spec
src/media_format.c
src/media_packet.c
src/media_packet_pool.c

index 4f589999b166bb4e8602e33bed7b22dffa6e363e..89c112378341014a62ea5a88e7920251439428a7 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       capi-media-tool
 Summary:    A Core API media tool library in Tizen Native API
-Version:    0.1.23
+Version:    0.1.24
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 1e8cea88cc7b1d2a9fc871a085b5ea3f7a046270..c93095181b915a55040171e6bb396578fba7c997 100644 (file)
@@ -21,7 +21,7 @@
 #include <media_format.h>
 #include <media_format_private.h>
 
-static void _media_format_destroy(media_format_s *fmt);
+static void __media_format_destroy(media_format_s *fmt);
 
 static const media_format_channel_position_e default_channel_order[64] = {
        MEDIA_FORMAT_CHANNEL_POSITION_FRONT_LEFT,
@@ -111,7 +111,7 @@ int media_format_create(media_format_h *fmt)
        return ret;
 }
 
-static void _media_format_destroy(media_format_s *fmt)
+static void __media_format_destroy(media_format_s *fmt)
 {
        MEDIA_FORMAT_INSTANCE_CHEC_VOID(fmt);
 
@@ -698,7 +698,7 @@ int media_format_unref(media_format_h fmt)
        if (is_zero) {
                LOGI("The format handle(%p) will be destroyed..\n", fmt);
                /* if reference count become 0 , free fmt. */
-               _media_format_destroy(fmt_handle);
+               __media_format_destroy(fmt_handle);
        }
 
        return ret;
index c3a2592ce5bf66a533ce411aaac6b6a634ba003f..f8362cbff234d3c111f8d9f935fb17087587e8dd 100644 (file)
 /* 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)
 {
@@ -77,9 +77,9 @@ int media_packet_create_alloc(media_format_h fmt, media_packet_finalize_cb fcb,
        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;
        }
 
@@ -220,7 +220,7 @@ int media_packet_alloc(media_packet_h packet)
        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;
@@ -242,7 +242,7 @@ fail:
 
 }
 
-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;
@@ -256,14 +256,14 @@ static int _pkt_alloc_buffer(media_packet_s *pkt)
        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;
@@ -328,14 +328,14 @@ static int _pkt_alloc_buffer(media_packet_s *pkt)
        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) {
@@ -361,7 +361,7 @@ static int _pkt_dealloc_buffer(media_packet_s *handle)
 #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;
@@ -461,7 +461,7 @@ static size_t _pkt_calculate_video_buffer_size(media_packet_s *pkt)
 #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;
@@ -537,7 +537,7 @@ static size_t _pkt_calculate_audio_buffer_size(media_packet_s *pkt)
 }
 
 #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) {
@@ -1315,9 +1315,9 @@ int media_packet_destroy(media_packet_h packet)
                }
        }
 
-       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 */
@@ -1388,7 +1388,7 @@ static uint32_t _convert_to_tbm_surface_format(media_format_mimetype_e format_ty
        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;
@@ -1409,7 +1409,7 @@ static void *_aligned_malloc_normal_buffer_type(size_t size, int alignment)
        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)
index 805443d0318ecab1fb7c7acd3e2adc127525cafd..fd45de9312e2195e1dcc5a47f6657f87d04df211 100644 (file)
@@ -23,8 +23,8 @@
 #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)
 {
@@ -114,7 +114,7 @@ int media_packet_pool_get_size(media_packet_pool_h pool, int *min_size, int *max
        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;
@@ -159,7 +159,7 @@ int media_packet_pool_allocate(media_packet_pool_h pool)
        }
 
        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;
                }
@@ -209,7 +209,7 @@ int media_packet_pool_acquire_packet(media_packet_pool_h pool, media_packet_h *p
                        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;
@@ -243,7 +243,7 @@ int media_packet_pool_acquire_packet(media_packet_pool_h pool, media_packet_h *p
        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++) {
@@ -279,7 +279,7 @@ int media_packet_pool_release_packet(media_packet_pool_h pool, media_packet_h pk
                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);