apply tizen coding rules 79/83479/2
authorNAMJEONGYOON <just.nam@samsung.com>
Thu, 11 Aug 2016 07:02:38 +0000 (16:02 +0900)
committerNAMJEONGYOON <just.nam@samsung.com>
Thu, 11 Aug 2016 10:03:47 +0000 (19:03 +0900)
Change-Id: I81aa27e6df01bb57dc2928e277f911739fc23043

src/mm_player_capture.c
src/mm_player_common_priv.c
src/mm_player_es.c
src/mm_player_ini.c
src/mm_player_streaming.c

index 170d284..57a02f3 100644 (file)
@@ -1,12 +1,12 @@
 /*
  * libmm-player
  *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright(c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Contact: JongHyuk Choi <jhchoi.choi@samsung.com>, YeJin Cho <cho.yejin@samsung.com>,
  * Seungbae Shin <seungbae.shin@samsung.com>, YoungHwan An <younghwan_.an@samsung.com>
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0(the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
@@ -40,7 +40,7 @@
 /*---------------------------------------------------------------------------
 |    LOCAL FUNCTION PROTOTYPES:                                                                                                |
 ---------------------------------------------------------------------------*/
-static GstPadProbeReturn __mmplayer_video_capture_probe (GstPad *pad, GstPadProbeInfo *info, gpointer u_data);
+static GstPadProbeReturn __mmplayer_video_capture_probe(GstPad *pad, GstPadProbeInfo *info, gpointer u_data);
 static int  __mmplayer_get_video_frame_from_buffer(mm_player_t* player, GstPad *pad, GstBuffer *buffer);
 static gpointer __mmplayer_capture_thread(gpointer data);
 static void __csc_tiled_to_linear_crop(unsigned char *yuv420_dest, unsigned char *nv12t_src, int yuv420_width, int yuv420_height, int left, int top, int right, int buttom);
@@ -50,13 +50,13 @@ static int __mm_player_convert_colorspace(mm_player_t* player, unsigned char* sr
 /*===========================================================================================
 |                                                                                                                                                                                      |
 |  FUNCTION DEFINITIONS                                                                                                                                                |
-|                                                                                                                                                                                      |
+|                                                                                                                                                                                      |
 ========================================================================================== */
 int
 _mmplayer_initialize_video_capture(mm_player_t* player)
 {
        int ret = MM_ERROR_NONE;
-       MMPLAYER_RETURN_VAL_IF_FAIL ( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+       MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
        /* create capture mutex */
        g_mutex_init(&player->capture_thread_mutex);
 
@@ -68,10 +68,9 @@ _mmplayer_initialize_video_capture(mm_player_t* player)
 
        /* create video capture thread */
        player->capture_thread =
-                       g_thread_try_new ("capture_thread",__mmplayer_capture_thread, (gpointer)player, NULL);
+                       g_thread_try_new("capture_thread", __mmplayer_capture_thread, (gpointer)player, NULL);
 
-       if ( ! player->capture_thread )
-       {
+       if (!player->capture_thread) {
                ret = MM_ERROR_PLAYER_RESOURCE_LIMIT;
                goto ERROR;
        }
@@ -80,9 +79,9 @@ _mmplayer_initialize_video_capture(mm_player_t* player)
 
 ERROR:
        /* capture thread */
-       g_mutex_clear(&player->capture_thread_mutex );
+       g_mutex_clear(&player->capture_thread_mutex);
 
-       g_cond_clear (&player->capture_thread_cond );
+       g_cond_clear(&player->capture_thread_cond);
 
        return ret;
 }
@@ -90,17 +89,17 @@ ERROR:
 int
 _mmplayer_release_video_capture(mm_player_t* player)
 {
-       MMPLAYER_RETURN_VAL_IF_FAIL ( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+       MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
        /* release capture thread */
        g_mutex_lock(&player->capture_thread_mutex);
        player->capture_thread_exit = TRUE;
-       g_cond_signal( &player->capture_thread_cond );
+       g_cond_signal(&player->capture_thread_cond);
        g_mutex_unlock(&player->capture_thread_mutex);
 
        LOGD("waitting for capture thread exit");
-       g_thread_join ( player->capture_thread );
-       g_mutex_clear(&player->capture_thread_mutex );
-       g_cond_clear(&player->capture_thread_cond );
+       g_thread_join(player->capture_thread);
+       g_mutex_clear(&player->capture_thread_mutex);
+       g_cond_clear(&player->capture_thread_cond);
        LOGD("capture thread released");
 
        return MM_ERROR_NONE;
@@ -119,36 +118,31 @@ _mmplayer_do_video_capture(MMHandleType hplayer)
 
        /* capturing or not */
        if (player->video_capture_cb_probe_id || player->capture.data
-                       || player->captured.data[0] || player->captured.data[1]
-                       )
-       {
+                       || player->captured.data[0] || player->captured.data[1]) {
                LOGW("capturing... we can't do any more");
                return MM_ERROR_PLAYER_INVALID_STATE;
        }
        gint surface_type = 0;
-       mm_attrs_get_int_by_name (player->attrs, "display_surface_type", &surface_type);
+       mm_attrs_get_int_by_name(player->attrs, "display_surface_type", &surface_type);
 
        /* check if video pipeline is linked or not */
-       if (!player->pipeline->videobin)
-       {
-               if (surface_type == MM_DISPLAY_SURFACE_REMOTE && player->video_fakesink)
+       if (!player->pipeline->videobin) {
+               if (surface_type == MM_DISPLAY_SURFACE_REMOTE && player->video_fakesink) {
                        LOGD("it is evas surface type.");
-               else
-               {
+               } else {
                        LOGW("not ready to capture");
                        return MM_ERROR_PLAYER_INVALID_STATE;
                }
        }
 
        if (player->pipeline->videobin)
-               pad = gst_element_get_static_pad(player->pipeline->videobin[MMPLAYER_V_SINK].gst, "sink" );
+               pad = gst_element_get_static_pad(player->pipeline->videobin[MMPLAYER_V_SINK].gst, "sink");
        else // evas surface
-               pad = gst_element_get_static_pad (player->video_fakesink, "sink");
+               pad = gst_element_get_static_pad(player->video_fakesink, "sink");
 
-       if (player->state != MM_PLAYER_STATE_PLAYING)
-       {
-               if (player->state == MM_PLAYER_STATE_PAUSED) // get last buffer from video sink
-               {
+       if (player->state != MM_PLAYER_STATE_PLAYING) {
+               if (player->state == MM_PLAYER_STATE_PAUSED) {
+                       // get last buffer from video sink
                        GstSample *sample = NULL;
 
                        gst_element_get_state(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, NULL, NULL, 5 * GST_SECOND); //5 seconds
@@ -158,25 +152,18 @@ _mmplayer_do_video_capture(MMHandleType hplayer)
                        else // evas surface
                                g_object_get(player->video_fakesink, "last-sample", &sample, NULL);
 
-                       if (sample)
-                       {
+                       if (sample) {
                                GstBuffer *buf = NULL;
                                buf = gst_sample_get_buffer(sample);
 
                                if (buf)
-                               {
                                        ret = __mmplayer_get_video_frame_from_buffer(player, pad, buf);
-                               }
                                else
-                               {
                                        LOGW("failed to get video frame");
-                               }
                                gst_sample_unref(sample);
                        }
                        return ret;
-               }
-               else
-               {
+               } else {
                        LOGW("invalid state(%d) to capture", player->state);
                        return MM_ERROR_PLAYER_INVALID_STATE;
                }
@@ -195,106 +182,94 @@ _mmplayer_do_video_capture(MMHandleType hplayer)
 }
 
 int
-__mmplayer_handle_orientation (mm_player_t* player, int orientation, int format)
+__mmplayer_handle_orientation(mm_player_t* player, int orientation, int format)
 {
-    unsigned char *src_buffer = NULL;
-    int ret = MM_ERROR_NONE;
-    unsigned char *dst_frame = NULL;
-    unsigned int dst_width = 0;
-    unsigned int dst_height = 0;
-    unsigned int dst_size = 0;
-    mm_util_img_rotate_type rot_enum = MM_UTIL_ROTATE_NUM;
+       unsigned char *src_buffer = NULL;
+       int ret = MM_ERROR_NONE;
+       unsigned char *dst_frame = NULL;
+       unsigned int dst_width = 0;
+       unsigned int dst_height = 0;
+       unsigned int dst_size = 0;
+       mm_util_img_rotate_type rot_enum = MM_UTIL_ROTATE_NUM;
 
        player->capture.orientation = orientation;
 
-    if (orientation == 90 || orientation == 270)
-    {
+       if (orientation == 90 || orientation == 270) {
                dst_width = player->captured.height[0];
                dst_height = player->captured.width[0];
-               LOGD ("interchange width & height");
-    }
-    else if (orientation == 180)
-    {
+               LOGD("interchange width & height");
+       } else if (orientation == 180) {
                dst_width = player->captured.width[0];
                dst_height = player->captured.height[0];
-    }
-    else if (orientation == 0)
-    {
-               LOGE ("no need handle orientation : %d", orientation);
+       } else if (orientation == 0) {
+               LOGE("no need handle orientation : %d", orientation);
                player->capture.width = player->captured.width[0];
                player->capture.height = player->captured.height[0];
                return MM_ERROR_NONE;
-    }
-    else
-    {
-               LOGE ("wrong orientation value...");
-    }
+       } else
+               LOGE("wrong orientation value...");
 
     /* height & width will be interchanged for 90 and 270 orientation */
-    ret = mm_util_get_image_size(format, dst_width, dst_height, &dst_size);
-    if (ret != MM_ERROR_NONE)
-    {
+       ret = mm_util_get_image_size(format, dst_width, dst_height, &dst_size);
+       if (ret != MM_ERROR_NONE) {
                LOGE("failed to get destination frame size");
                return ret;
-    }
+       }
 
-    LOGD ("before rotation : dst_width = %d and dst_height = %d", dst_width, dst_height);
+       LOGD("before rotation : dst_width = %d and dst_height = %d", dst_width, dst_height);
 
-    dst_frame = (unsigned char*) malloc (dst_size);
-    if (!dst_frame)
-    {
-      LOGE("failed to allocate memory");
-      return MM_ERROR_PLAYER_NO_FREE_SPACE;
-    }
+       dst_frame = (unsigned char*) malloc(dst_size);
+       if (!dst_frame) {
+               LOGE("failed to allocate memory");
+               return MM_ERROR_PLAYER_NO_FREE_SPACE;
+       }
 
-    src_buffer = (unsigned char*)player->capture.data;
+       src_buffer = (unsigned char*)player->capture.data;
 
        /* convert orientation degree into enum here */
-       switch(orientation)
-       {
-               case 0:
-                       rot_enum = MM_UTIL_ROTATE_0;
+       switch (orientation) {
+       case 0:
+               rot_enum = MM_UTIL_ROTATE_0;
                break;
-               case 90:
-                       rot_enum = MM_UTIL_ROTATE_90;
+       case 90:
+               rot_enum = MM_UTIL_ROTATE_90;
                break;
-               case 180:
-                       rot_enum = MM_UTIL_ROTATE_180;
+       case 180:
+               rot_enum = MM_UTIL_ROTATE_180;
                break;
-               case 270:
-                       rot_enum = MM_UTIL_ROTATE_270;
+       case 270:
+               rot_enum = MM_UTIL_ROTATE_270;
                break;
-               default:
-                       LOGE("wrong rotate value");
+       default:
+               LOGE("wrong rotate value");
                break;
        }
 
-    LOGD ("source buffer for rotation = %p and rotation = %d", src_buffer, rot_enum);
+       LOGD("source buffer for rotation = %p and rotation = %d", src_buffer, rot_enum);
 
-    ret = mm_util_rotate_image (src_buffer,
+       ret = mm_util_rotate_image(src_buffer,
                        player->captured.width[0], player->captured.height[0], format,
                        dst_frame, &dst_width, &dst_height, rot_enum);
-    if (ret != MM_ERROR_NONE)
-    {
+       if (ret != MM_ERROR_NONE) {
                LOGE("failed to do rotate image");
                free(dst_frame);
                return ret;
-    }
+       }
 
-    LOGD ("after rotation same stride: dst_width = %d and dst_height = %d", dst_width, dst_height);
+       LOGD("after rotation same stride: dst_width = %d and dst_height = %d", dst_width, dst_height);
 
-    g_free (src_buffer);
+       g_free(src_buffer);
 
-    player->capture.data = dst_frame;
-    player->capture.size = dst_size;
+       player->capture.data = dst_frame;
+       player->capture.size = dst_size;
        player->capture.orientation = orientation;
        player->capture.width = dst_width;
-       player->capture.height= dst_height;
+       player->capture.height = dst_height;
 
-    player->captured.width[0] = player->captured.stride_width[0] = dst_width;
-    player->captured.height[0] = player->captured.stride_height[0] = dst_height;
+       player->captured.width[0] = player->captured.stride_width[0] = dst_width;
+       player->captured.height[0] = player->captured.stride_height[0] = dst_height;
 
-    return ret;
+       return ret;
 }
 
 
@@ -311,13 +286,11 @@ __mmplayer_capture_thread(gpointer data)
        MMPLAYER_RETURN_VAL_IF_FAIL(player, NULL);
 
        g_mutex_lock(&player->capture_thread_mutex);
-       while (!player->capture_thread_exit)
-       {
+       while (!player->capture_thread_exit) {
                LOGD("capture thread started. waiting for signal");
-               g_cond_wait(&player->capture_thread_cond, &player->capture_thread_mutex );
+               g_cond_wait(&player->capture_thread_cond, &player->capture_thread_mutex);
 
-               if ( player->capture_thread_exit )
-               {
+               if (player->capture_thread_exit) {
                        LOGD("exiting capture thread");
                        goto EXIT;
                }
@@ -326,8 +299,7 @@ __mmplayer_capture_thread(gpointer data)
                /* NOTE: Don't use MMPLAYER_CMD_LOCK() here.
                 * Because deadlock can be happened if other player api is used in message callback.
                 */
-               if (player->video_cs == MM_PLAYER_COLORSPACE_NV12_TILED)
-               {
+               if (player->video_cs == MM_PLAYER_COLORSPACE_NV12_TILED) {
                        /* Colorspace conversion : NV12T-> NV12-> RGB888 */
                        int ret = 0;
                        int linear_y_plane_size;
@@ -340,31 +312,28 @@ __mmplayer_capture_thread(gpointer data)
                        linear_uv_plane_size = (width * height / 2);
 
                        linear_y_plane = (unsigned char*) g_try_malloc(linear_y_plane_size);
-                       if (linear_y_plane == NULL)
-                       {
+                       if (linear_y_plane == NULL) {
                                msg.code = MM_ERROR_PLAYER_NO_FREE_SPACE;
                                goto ERROR;
                        }
 
                        linear_uv_plane = (unsigned char*) g_try_malloc(linear_uv_plane_size);
-                       if (linear_uv_plane == NULL)
-                       {
+                       if (linear_uv_plane == NULL) {
                                msg.code = MM_ERROR_PLAYER_NO_FREE_SPACE;
                                goto ERROR;
                        }
                        /* NV12 tiled to linear */
                        __csc_tiled_to_linear_crop(linear_y_plane,
-                                       player->captured.data[0], width, height, 0,0,0,0);
+                                       player->captured.data[0], width, height, 0, 0, 0, 0);
                        __csc_tiled_to_linear_crop(linear_uv_plane,
-                                       player->captured.data[1], width, height / 2, 0,0,0,0);
+                                       player->captured.data[1], width, height / 2, 0, 0, 0, 0);
 
                        MMPLAYER_FREEIF(player->captured.data[0]);
                        MMPLAYER_FREEIF(player->captured.data[1]);
 
                        src_buffer = (unsigned char*) g_try_malloc(linear_y_plane_size+linear_uv_plane_size);
 
-                       if (src_buffer == NULL)
-                       {
+                       if (src_buffer == NULL) {
                                msg.code = MM_ERROR_PLAYER_NO_FREE_SPACE;
                                goto ERROR;
                        }
@@ -376,8 +345,7 @@ __mmplayer_capture_thread(gpointer data)
                        ret = __mm_player_convert_colorspace(player, src_buffer, MM_UTIL_IMG_FMT_NV12,
                                width, height, MM_UTIL_IMG_FMT_RGB888);
 
-                       if (ret != MM_ERROR_NONE)
-                       {
+                       if (ret != MM_ERROR_NONE) {
                                LOGE("failed to convert nv12 linear");
                                goto ERROR;
                        }
@@ -386,7 +354,7 @@ __mmplayer_capture_thread(gpointer data)
                        MMPLAYER_FREEIF(linear_y_plane);
                        MMPLAYER_FREEIF(linear_uv_plane);
                } else if (MM_PLAYER_COLORSPACE_NV12 == player->video_cs) {
-                       #define MM_ALIGN(x, a)       (((x) + (a) - 1) & ~((a) - 1))
+                       #define MM_ALIGN(x, a)      (((x) +(a) - 1) & ~((a) - 1))
                        int ret = 0;
                        char *src_buffer = NULL;
                        /* using original width otherwises, app can't know aligned to resize */
@@ -438,25 +406,22 @@ __mmplayer_capture_thread(gpointer data)
                        /* NV12 -> RGB888 */
                        ret = __mm_player_convert_colorspace(player, (unsigned char*)src_buffer, MM_UTIL_IMG_FMT_NV12,
                                width_align, player->captured.height[0], MM_UTIL_IMG_FMT_RGB888);
-                       if (ret != MM_ERROR_NONE)
-                       {
+                       if (ret != MM_ERROR_NONE) {
                                LOGE("failed to convert nv12 linear");
                                goto ERROR;
                        }
                }
 
-               ret = _mmplayer_get_video_rotate_angle ((MMHandleType)player, &orientation);
-               if (ret != MM_ERROR_NONE)
-               {
+               ret = _mmplayer_get_video_rotate_angle((MMHandleType)player, &orientation);
+               if (ret != MM_ERROR_NONE) {
                        LOGE("failed to get rotation angle");
                        goto ERROR;
                }
 
-               LOGD ("orientation value = %d", orientation);
+               LOGD("orientation value = %d", orientation);
 
-               ret = __mmplayer_handle_orientation (player, orientation, MM_UTIL_IMG_FMT_RGB888);
-               if (ret != MM_ERROR_NONE)
-               {
+               ret = __mmplayer_handle_orientation(player, orientation, MM_UTIL_IMG_FMT_RGB888);
+               if (ret != MM_ERROR_NONE) {
                        LOGE("failed to convert nv12 linear");
                        goto ERROR;
                }
@@ -468,17 +433,15 @@ __mmplayer_capture_thread(gpointer data)
 //             msg.captured_frame.height = player->capture.height;
 //             msg.captured_frame.orientation = player->capture.orientation;
 
-               if (player->cmd >= MMPLAYER_COMMAND_START)
-               {
-                       MMPLAYER_POST_MSG( player, MM_MESSAGE_VIDEO_CAPTURED, &msg );
+               if (player->cmd >= MMPLAYER_COMMAND_START) {
+                       MMPLAYER_POST_MSG(player, MM_MESSAGE_VIDEO_CAPTURED, &msg);
                        LOGD("returned from capture message callback");
                }
 
                //MMPLAYER_FREEIF(player->capture.data);
                continue;
 ERROR:
-               if (player->video_cs == MM_PLAYER_COLORSPACE_NV12_TILED)
-               {
+               if (player->video_cs == MM_PLAYER_COLORSPACE_NV12_TILED) {
                        /* clean */
                        MMPLAYER_FREEIF(linear_y_plane);
                        MMPLAYER_FREEIF(linear_uv_plane);
@@ -491,7 +454,7 @@ ERROR:
 
                msg.union_type = MM_MSG_UNION_CODE;
 
-               MMPLAYER_POST_MSG( player, MM_MESSAGE_VIDEO_NOT_CAPTURED, &msg );
+               MMPLAYER_POST_MSG(player, MM_MESSAGE_VIDEO_NOT_CAPTURED, &msg);
        }
 
 EXIT:
@@ -518,39 +481,37 @@ __mmplayer_get_video_frame_from_buffer(mm_player_t* player, GstPad *pad, GstBuff
 
        MMPLAYER_FENTER();
 
-       MMPLAYER_RETURN_VAL_IF_FAIL ( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
-       MMPLAYER_RETURN_VAL_IF_FAIL ( buffer, MM_ERROR_INVALID_ARGUMENT );
+       MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+       MMPLAYER_RETURN_VAL_IF_FAIL(buffer, MM_ERROR_INVALID_ARGUMENT);
 
        /* get fourcc */
        caps = gst_pad_get_current_caps(pad);
 
-       MMPLAYER_RETURN_VAL_IF_FAIL ( caps, MM_ERROR_INVALID_ARGUMENT );
+       MMPLAYER_RETURN_VAL_IF_FAIL(caps, MM_ERROR_INVALID_ARGUMENT);
        MMPLAYER_LOG_GST_CAPS_TYPE(caps);
 
-       structure = gst_caps_get_structure (caps, 0);
+       structure = gst_caps_get_structure(caps, 0);
 
-       MMPLAYER_RETURN_VAL_IF_FAIL (structure != NULL, MM_ERROR_PLAYER_INTERNAL);
+       MMPLAYER_RETURN_VAL_IF_FAIL(structure != NULL, MM_ERROR_PLAYER_INTERNAL);
 
        /* init capture image buffer */
        memset(&player->capture, 0x00, sizeof(MMPlayerVideoCapture));
 
-       gst_structure_get_int (structure, "width", &src_width);
-       gst_structure_get_int (structure, "height", &src_height);
+       gst_structure_get_int(structure, "width", &src_width);
+       gst_structure_get_int(structure, "height", &src_height);
 
        /* check rgb or yuv */
-       if (gst_structure_has_name(structure, "video/x-raw"))
-       {
+       if (gst_structure_has_name(structure, "video/x-raw")) {
                /* NV12T */
                const gchar *gst_format = gst_structure_get_string(structure, "format");
-               if(!g_strcmp0(gst_format, "ST12") || !g_strcmp0(gst_format, "SN12"))
-               {
+               if (!g_strcmp0(gst_format, "ST12") || !g_strcmp0(gst_format, "SN12")) {
                        guint n;
                        tbm_bo_handle y_hnd;
                        tbm_bo_handle uv_hnd;
-                       LOGI ("captured format is %s\n", gst_format);
+                       LOGI("captured format is %s\n", gst_format);
 
                        MMVideoBuffer *proved = NULL;
-                       if(!g_strcmp0(gst_format, "ST12"))
+                       if (!g_strcmp0(gst_format, "ST12"))
                                player->video_cs = MM_PLAYER_COLORSPACE_NV12_TILED;
                        else
                                player->video_cs = MM_PLAYER_COLORSPACE_NV12;
@@ -561,7 +522,7 @@ __mmplayer_get_video_frame_from_buffer(mm_player_t* player, GstPad *pad, GstBuff
                        gst_memory_map(memory, &mapinfo, GST_MAP_READ);
                        proved = (MMVideoBuffer *)mapinfo.data;
 
-                       if ( !proved || !proved->data[0] || !proved->data[1] ) {
+                       if (!proved || !proved->data[0] || !proved->data[1]) {
                                LOGE("fail to gst_memory_map");
                                return MM_ERROR_PLAYER_INTERNAL;
                        }
@@ -570,10 +531,10 @@ __mmplayer_get_video_frame_from_buffer(mm_player_t* player, GstPad *pad, GstBuff
 
                        yplane_size = proved->size[0];
                        uvplane_size = proved->size[1];
-                       LOGI ("yplane_size=%d, uvplane_size=%d", yplane_size, uvplane_size);
+                       LOGI("yplane_size=%d, uvplane_size=%d", yplane_size, uvplane_size);
 
                        player->captured.data[0] = g_try_malloc(yplane_size);
-                       if ( !player->captured.data[0] ) {
+                       if (!player->captured.data[0]) {
                                gst_memory_unmap(memory, &mapinfo);
                                return MM_ERROR_SOUND_NO_FREE_SPACE;
                        }
@@ -582,33 +543,31 @@ __mmplayer_get_video_frame_from_buffer(mm_player_t* player, GstPad *pad, GstBuff
 #if 0
                        player->captured.data[1] = g_try_malloc(uvplane_size);
 #else
-                       if(uvplane_size < proved->stride_width[1] * proved->stride_height[1]) {
+                       if (uvplane_size < proved->stride_width[1] * proved->stride_height[1]) {
                                player->captured.data[1] =
                                        g_try_malloc(proved->stride_width[1] * proved->stride_height[1]);
-                       }
-                       else
+                       } else
                                player->captured.data[1] = g_try_malloc(uvplane_size);
 #endif
-                       if ( !player->captured.data[1] ) {
+                       if (!player->captured.data[1]) {
                                gst_memory_unmap(memory, &mapinfo);
                                return MM_ERROR_SOUND_NO_FREE_SPACE;
                        }
 
                        LOGD("Buffer type %d", proved->type);
-                       if(proved->type == MM_VIDEO_BUFFER_TYPE_TBM_BO) {
+                       if (proved->type == MM_VIDEO_BUFFER_TYPE_TBM_BO) {
                                tbm_bo_ref(proved->handle.bo[0]);
                                tbm_bo_ref(proved->handle.bo[1]);
                                y_hnd = tbm_bo_get_handle(proved->handle.bo[0], TBM_DEVICE_CPU);
                                LOGD("source y : %p, size %d", y_hnd.ptr, yplane_size);
-                               if(y_hnd.ptr) {
+                               if (y_hnd.ptr)
                                        memcpy(player->captured.data[0], y_hnd.ptr, yplane_size);
-                               }
 
                                uv_hnd = tbm_bo_get_handle(proved->handle.bo[1], TBM_DEVICE_CPU);
-                               LOGD("source uv : %p, size %d",uv_hnd.ptr, uvplane_size);
-                               if(uv_hnd.ptr) {
+                               LOGD("source uv : %p, size %d", uv_hnd.ptr, uvplane_size);
+                               if (uv_hnd.ptr)
                                        memcpy(player->captured.data[1], uv_hnd.ptr, uvplane_size);
-                               }
+
                                tbm_bo_unref(proved->handle.bo[0]);
                                tbm_bo_unref(proved->handle.bo[1]);
                        }
@@ -616,33 +575,27 @@ __mmplayer_get_video_frame_from_buffer(mm_player_t* player, GstPad *pad, GstBuff
                        gst_memory_unmap(memory, &mapinfo);
 
                        goto DONE;
-               }
-               else
-               {
+               } else {
                        GstVideoInfo format_info;
                        gst_video_info_from_caps(&format_info, caps);
 
-                       switch(GST_VIDEO_INFO_FORMAT(&format_info))
-                       {
-                               case GST_VIDEO_FORMAT_I420:
-                                       src_fmt = MM_UTIL_IMG_FMT_I420;
-                                       break;
-                               case GST_VIDEO_FORMAT_BGRA:
-                                       src_fmt = MM_UTIL_IMG_FMT_BGRA8888;
-                                       break;
-                               case GST_VIDEO_FORMAT_BGRx:
-                                       src_fmt = MM_UTIL_IMG_FMT_BGRX8888;
-                                       break;
-                               default:
-                                       goto UNKNOWN;
-                                       break;
+                       switch (GST_VIDEO_INFO_FORMAT(&format_info)) {
+                       case GST_VIDEO_FORMAT_I420:
+                               src_fmt = MM_UTIL_IMG_FMT_I420;
+                               break;
+                       case GST_VIDEO_FORMAT_BGRA:
+                               src_fmt = MM_UTIL_IMG_FMT_BGRA8888;
+                               break;
+                       case GST_VIDEO_FORMAT_BGRx:
+                               src_fmt = MM_UTIL_IMG_FMT_BGRX8888;
+                               break;
+                       default:
+                               goto UNKNOWN;
+                               break;
                        }
                }
-       }
-       else
-       {
+       } else
                goto UNKNOWN;
-       }
 
        gst_buffer_map(buffer, &mapinfo, GST_MAP_READ);
        __mm_player_convert_colorspace(player, mapinfo.data, src_fmt, src_width, src_height, dst_fmt);
@@ -650,7 +603,7 @@ __mmplayer_get_video_frame_from_buffer(mm_player_t* player, GstPad *pad, GstBuff
 
 DONE:
        /* do convert colorspace */
-       g_cond_signal( &player->capture_thread_cond );
+       g_cond_signal(&player->capture_thread_cond);
 
        MMPLAYER_FLEAVE();
 
@@ -662,27 +615,25 @@ UNKNOWN:
 }
 
 static GstPadProbeReturn
-__mmplayer_video_capture_probe (GstPad *pad, GstPadProbeInfo *info, gpointer u_data)
+__mmplayer_video_capture_probe(GstPad *pad, GstPadProbeInfo *info, gpointer u_data)
 {
        mm_player_t* player = (mm_player_t*) u_data;
        GstBuffer *buffer = NULL;
        int ret = MM_ERROR_NONE;
 
-       MMPLAYER_RETURN_VAL_IF_FAIL (info->data, GST_PAD_PROBE_REMOVE);
+       MMPLAYER_RETURN_VAL_IF_FAIL(info->data, GST_PAD_PROBE_REMOVE);
        MMPLAYER_FENTER();
 
        buffer = gst_pad_probe_info_get_buffer(info);
        ret = __mmplayer_get_video_frame_from_buffer(player, pad, buffer);
 
-       if ( ret != MM_ERROR_NONE)
-       {
+       if (ret != MM_ERROR_NONE) {
                LOGE("failed to get video frame");
                return GST_PAD_PROBE_REMOVE;
        }
 
        /* remove probe to be called at one time */
-       if (player->video_capture_cb_probe_id)
-       {
+       if (player->video_capture_cb_probe_id) {
                gst_pad_remove_probe(pad, player->video_capture_cb_probe_id);
                player->video_capture_cb_probe_id = 0;
        }
@@ -702,8 +653,7 @@ __mm_player_convert_colorspace(mm_player_t* player, unsigned char* src_data, mm_
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_INTERNAL);
        ret = mm_util_get_image_size(dst_fmt, src_w, src_h, &dst_size);
 
-       if (ret != MM_ERROR_NONE)
-       {
+       if (ret != MM_ERROR_NONE) {
                LOGE("failed to get image size for capture, %d\n", ret);
                return MM_ERROR_PLAYER_INTERNAL;
        }
@@ -712,8 +662,7 @@ __mm_player_convert_colorspace(mm_player_t* player, unsigned char* src_data, mm_
 
        dst_data = (unsigned char*)g_malloc0(dst_size);
 
-       if (!dst_data)
-       {
+       if (!dst_data) {
                LOGE("no free space to capture\n");
                g_free(dst_data);
                return MM_ERROR_PLAYER_NO_FREE_SPACE;
@@ -721,8 +670,7 @@ __mm_player_convert_colorspace(mm_player_t* player, unsigned char* src_data, mm_
 
        ret = mm_util_convert_colorspace(src_data, src_w, src_h, src_fmt, dst_data, dst_fmt);
 
-       if (ret != MM_ERROR_NONE)
-       {
+       if (ret != MM_ERROR_NONE) {
                LOGE("failed to convert for capture, %d\n", ret);
                g_free(dst_data);
                return MM_ERROR_PLAYER_INTERNAL;
@@ -755,42 +703,42 @@ __mm_player_convert_colorspace(mm_player_t* player, unsigned char* src_data, mm_
 static int
 __tile_4x2_read(int x_size, int y_size, int x_pos, int y_pos)
 {
-    int pixel_x_m1, pixel_y_m1;
-    int roundup_x;
-    int linear_addr0, linear_addr1, bank_addr ;
-    int x_addr;
-    int trans_addr;
-
-    pixel_x_m1 = x_size -1;
-    pixel_y_m1 = y_size -1;
-
-    roundup_x = ((pixel_x_m1 >> 7) + 1);
-
-    x_addr = x_pos >> 2;
-
-    if ((y_size <= y_pos+32) && ( y_pos < y_size) &&
-        (((pixel_y_m1 >> 5) & 0x1) == 0) && (((y_pos >> 5) & 0x1) == 0)) {
-        linear_addr0 = (((y_pos & 0x1f) <<4) | (x_addr & 0xf));
-        linear_addr1 = (((y_pos >> 6) & 0xff) * roundup_x + ((x_addr >> 6) & 0x3f));
-
-        if (((x_addr >> 5) & 0x1) == ((y_pos >> 5) & 0x1))
-            bank_addr = ((x_addr >> 4) & 0x1);
-        else
-            bank_addr = 0x2 | ((x_addr >> 4) & 0x1);
-    } else {
-        linear_addr0 = (((y_pos & 0x1f) << 4) | (x_addr & 0xf));
-        linear_addr1 = (((y_pos >> 6) & 0xff) * roundup_x + ((x_addr >> 5) & 0x7f));
-
-        if (((x_addr >> 5) & 0x1) == ((y_pos >> 5) & 0x1))
-            bank_addr = ((x_addr >> 4) & 0x1);
-        else
-            bank_addr = 0x2 | ((x_addr >> 4) & 0x1);
-    }
-
-    linear_addr0 = linear_addr0 << 2;
-    trans_addr = (linear_addr1 <<13) | (bank_addr << 11) | linear_addr0;
-
-    return trans_addr;
+       int pixel_x_m1, pixel_y_m1;
+       int roundup_x;
+       int linear_addr0, linear_addr1, bank_addr ;
+       int x_addr;
+       int trans_addr;
+
+       pixel_x_m1 = x_size -1;
+       pixel_y_m1 = y_size -1;
+
+       roundup_x = ((pixel_x_m1 >> 7) + 1);
+
+       x_addr = x_pos >> 2;
+
+       if ((y_size <= y_pos+32) && (y_pos < y_size) &&
+               (((pixel_y_m1 >> 5) & 0x1) == 0) && (((y_pos >> 5) & 0x1) == 0)) {
+               linear_addr0 = (((y_pos & 0x1f) <<4) | (x_addr & 0xf));
+               linear_addr1 = (((y_pos >> 6) & 0xff) * roundup_x +((x_addr >> 6) & 0x3f));
+
+               if (((x_addr >> 5) & 0x1) == ((y_pos >> 5) & 0x1))
+                       bank_addr = ((x_addr >> 4) & 0x1);
+               else
+                       bank_addr = 0x2 | ((x_addr >> 4) & 0x1);
+       } else {
+               linear_addr0 = (((y_pos & 0x1f) << 4) | (x_addr & 0xf));
+               linear_addr1 = (((y_pos >> 6) & 0xff) * roundup_x +((x_addr >> 5) & 0x7f));
+
+               if (((x_addr >> 5) & 0x1) == ((y_pos >> 5) & 0x1))
+                       bank_addr = ((x_addr >> 4) & 0x1);
+               else
+                       bank_addr = 0x2 | ((x_addr >> 4) & 0x1);
+       }
+
+       linear_addr0 = linear_addr0 << 2;
+       trans_addr = (linear_addr1 <<13) | (bank_addr << 11) | linear_addr0;
+
+       return trans_addr;
 }
 
 /*
@@ -826,162 +774,160 @@ __tile_4x2_read(int x_size, int y_size, int x_pos, int y_pos)
  */
 static void
 __csc_tiled_to_linear_crop(unsigned char *yuv420_dest, unsigned char *nv12t_src, int yuv420_width, int yuv420_height,
-                                int left, int top, int right, int buttom)
+                                                       int left, int top, int right, int buttom)
 {
-    int i, j;
-    int tiled_offset = 0, tiled_offset1 = 0;
-    int linear_offset = 0;
-    int temp1 = 0, temp2 = 0, temp3 = 0, temp4 = 0;
-
-    temp3 = yuv420_width-right;
-    temp1 = temp3-left;
-    /* real width is greater than or equal 256 */
-    if (temp1 >= 256) {
-        for (i=top; i<yuv420_height-buttom; i=i+1) {
-            j = left;
-            temp3 = (j>>8)<<8;
-            temp3 = temp3>>6;
-            temp4 = i>>5;
-            if (temp4 & 0x1) {
-                /* odd fomula: 2+x+(x>>2)<<2+x_block_num*(y-1) */
-                tiled_offset = temp4-1;
-                temp1 = ((yuv420_width+127)>>7)<<7;
-                tiled_offset = tiled_offset*(temp1>>6);
-                tiled_offset = tiled_offset+temp3;
-                tiled_offset = tiled_offset+2;
-                temp1 = (temp3>>2)<<2;
-                tiled_offset = tiled_offset+temp1;
-                tiled_offset = tiled_offset<<11;
-                tiled_offset1 = tiled_offset+2048*2;
-                temp4 = 8;
-            } else {
-                temp2 = ((yuv420_height+31)>>5)<<5;
-                if ((i+32)<temp2) {
-                    /* even1 fomula: x+((x+2)>>2)<<2+x_block_num*y */
-                    temp1 = temp3+2;
-                    temp1 = (temp1>>2)<<2;
-                    tiled_offset = temp3+temp1;
-                    temp1 = ((yuv420_width+127)>>7)<<7;
-                    tiled_offset = tiled_offset+temp4*(temp1>>6);
-                    tiled_offset = tiled_offset<<11;
-                    tiled_offset1 = tiled_offset+2048*6;
-                    temp4 = 8;
-                } else {
-                    /* even2 fomula: x+x_block_num*y */
-                    temp1 = ((yuv420_width+127)>>7)<<7;
-                    tiled_offset = temp4*(temp1>>6);
-                    tiled_offset = tiled_offset+temp3;
-                    tiled_offset = tiled_offset<<11;
-                    tiled_offset1 = tiled_offset+2048*2;
-                    temp4 = 4;
-                }
-            }
-
-            temp1 = i&0x1F;
-            tiled_offset = tiled_offset+64*(temp1);
-            tiled_offset1 = tiled_offset1+64*(temp1);
-            temp2 = yuv420_width-left-right;
-            linear_offset = temp2*(i-top);
-            temp3 = ((j+256)>>8)<<8;
-            temp3 = temp3-j;
-            temp1 = left&0x3F;
-            if (temp3 > 192) {
-                memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset+temp1, 64-temp1);
-                temp2 = ((left+63)>>6)<<6;
-                temp3 = ((yuv420_width-right)>>6)<<6;
-                if (temp2 == temp3) {
-                    temp2 = yuv420_width-right-(64-temp1);
-                }
-                memcpy(yuv420_dest+linear_offset+64-temp1, nv12t_src+tiled_offset+2048, 64);
-                memcpy(yuv420_dest+linear_offset+128-temp1, nv12t_src+tiled_offset1, 64);
-                memcpy(yuv420_dest+linear_offset+192-temp1, nv12t_src+tiled_offset1+2048, 64);
-                linear_offset = linear_offset+256-temp1;
-            } else if (temp3 > 128) {
-                memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset+2048+temp1, 64-temp1);
-                memcpy(yuv420_dest+linear_offset+64-temp1, nv12t_src+tiled_offset1, 64);
-                memcpy(yuv420_dest+linear_offset+128-temp1, nv12t_src+tiled_offset1+2048, 64);
-                linear_offset = linear_offset+192-temp1;
-            } else if (temp3 > 64) {
-                memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset1+temp1, 64-temp1);
-                memcpy(yuv420_dest+linear_offset+64-temp1, nv12t_src+tiled_offset1+2048, 64);
-                linear_offset = linear_offset+128-temp1;
-            } else if (temp3 > 0) {
-                memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset1+2048+temp1, 64-temp1);
-                linear_offset = linear_offset+64-temp1;
-            }
-
-            tiled_offset = tiled_offset+temp4*2048;
-            j = (left>>8)<<8;
-            j = j + 256;
-            temp2 = yuv420_width-right-256;
-            for (; j<=temp2; j=j+256) {
-                memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset, 64);
-                tiled_offset1 = tiled_offset1+temp4*2048;
-                memcpy(yuv420_dest+linear_offset+64, nv12t_src+tiled_offset+2048, 64);
-                memcpy(yuv420_dest+linear_offset+128, nv12t_src+tiled_offset1, 64);
-                tiled_offset = tiled_offset+temp4*2048;
-                memcpy(yuv420_dest+linear_offset+192, nv12t_src+tiled_offset1+2048, 64);
-                linear_offset = linear_offset+256;
-            }
-
-            tiled_offset1 = tiled_offset1+temp4*2048;
-            temp2 = yuv420_width-right-j;
-            if (temp2 > 192) {
-                memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset, 64);
-                memcpy(yuv420_dest+linear_offset+64, nv12t_src+tiled_offset+2048, 64);
-                memcpy(yuv420_dest+linear_offset+128, nv12t_src+tiled_offset1, 64);
-                memcpy(yuv420_dest+linear_offset+192, nv12t_src+tiled_offset1+2048, temp2-192);
-            } else if (temp2 > 128) {
-                memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset, 64);
-                memcpy(yuv420_dest+linear_offset+64, nv12t_src+tiled_offset+2048, 64);
-                memcpy(yuv420_dest+linear_offset+128, nv12t_src+tiled_offset1, temp2-128);
-            } else if (temp2 > 64) {
-                memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset, 64);
-                memcpy(yuv420_dest+linear_offset+64, nv12t_src+tiled_offset+2048, temp2-64);
-            } else {
-                memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset, temp2);
-            }
-        }
-    } else if (temp1 >= 64) {
-        for (i=top; i<(yuv420_height-buttom); i=i+1) {
-            j = left;
-            tiled_offset = __tile_4x2_read(yuv420_width, yuv420_height, j, i);
-            temp2 = ((j+64)>>6)<<6;
-            temp2 = temp2-j;
-            linear_offset = temp1*(i-top);
-            temp4 = j&0x3;
-            tiled_offset = tiled_offset+temp4;
-            memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset, temp2);
-            linear_offset = linear_offset+temp2;
-            j = j+temp2;
-            if ((j+64) <= temp3) {
-                tiled_offset = __tile_4x2_read(yuv420_width, yuv420_height, j, i);
-                memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset, 64);
-                linear_offset = linear_offset+64;
-                j = j+64;
-            }
-            if ((j+64) <= temp3) {
-                tiled_offset = __tile_4x2_read(yuv420_width, yuv420_height, j, i);
-                memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset, 64);
-                linear_offset = linear_offset+64;
-                j = j+64;
-            }
-            if (j < temp3) {
-                tiled_offset = __tile_4x2_read(yuv420_width, yuv420_height, j, i);
-                temp2 = temp3-j;
-                memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset, temp2);
-            }
-        }
-    } else {
-        for (i=top; i<(yuv420_height-buttom); i=i+1) {
-            linear_offset = temp1*(i-top);
-            for (j=left; j<(yuv420_width-right); j=j+2) {
-                tiled_offset = __tile_4x2_read(yuv420_width, yuv420_height, j, i);
-                temp4 = j&0x3;
-                tiled_offset = tiled_offset+temp4;
-                memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset, 2);
-                linear_offset = linear_offset+2;
-            }
-        }
-    }
+       int i, j;
+       int tiled_offset = 0, tiled_offset1 = 0;
+       int linear_offset = 0;
+       int temp1 = 0, temp2 = 0, temp3 = 0, temp4 = 0;
+
+       temp3 = yuv420_width-right;
+       temp1 = temp3-left;
+       /* real width is greater than or equal 256 */
+       if (temp1 >= 256) {
+               for (i = top; i < yuv420_height-buttom; i = i+1) {
+                       j = left;
+                       temp3 = (j>>8)<<8;
+                       temp3 = temp3>>6;
+                       temp4 = i>>5;
+                       if (temp4 & 0x1) {
+                               /* odd fomula: 2+x+(x>>2)<<2+x_block_num*(y-1) */
+                               tiled_offset = temp4-1;
+                               temp1 = ((yuv420_width+127)>>7)<<7;
+                               tiled_offset = tiled_offset*(temp1>>6);
+                               tiled_offset = tiled_offset+temp3;
+                               tiled_offset = tiled_offset+2;
+                               temp1 = (temp3>>2)<<2;
+                               tiled_offset = tiled_offset+temp1;
+                               tiled_offset = tiled_offset<<11;
+                               tiled_offset1 = tiled_offset+2048*2;
+                               temp4 = 8;
+                       } else {
+                               temp2 = ((yuv420_height+31)>>5)<<5;
+                               if ((i+32) < temp2) {
+                                       /* even1 fomula: x+((x+2)>>2)<<2+x_block_num*y */
+                                       temp1 = temp3+2;
+                                       temp1 = (temp1>>2)<<2;
+                                       tiled_offset = temp3+temp1;
+                                       temp1 = ((yuv420_width+127)>>7)<<7;
+                                       tiled_offset = tiled_offset+temp4*(temp1>>6);
+                                       tiled_offset = tiled_offset<<11;
+                                       tiled_offset1 = tiled_offset+2048*6;
+                                       temp4 = 8;
+                               } else {
+                                       /* even2 fomula: x+x_block_num*y */
+                                       temp1 = ((yuv420_width+127)>>7)<<7;
+                                       tiled_offset = temp4*(temp1>>6);
+                                       tiled_offset = tiled_offset+temp3;
+                                       tiled_offset = tiled_offset<<11;
+                                       tiled_offset1 = tiled_offset+2048*2;
+                                       temp4 = 4;
+                               }
+                       }
+
+                       temp1 = i&0x1F;
+                       tiled_offset = tiled_offset+64*(temp1);
+                       tiled_offset1 = tiled_offset1+64*(temp1);
+                       temp2 = yuv420_width-left-right;
+                       linear_offset = temp2*(i-top);
+                       temp3 = ((j+256)>>8)<<8;
+                       temp3 = temp3-j;
+                       temp1 = left&0x3F;
+                       if (temp3 > 192) {
+                               memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset+temp1, 64-temp1);
+                               temp2 = ((left+63)>>6)<<6;
+                               temp3 = ((yuv420_width-right)>>6)<<6;
+                               if (temp2 == temp3)
+                                       temp2 = yuv420_width-right-(64-temp1);
+                               memcpy(yuv420_dest+linear_offset+64-temp1, nv12t_src+tiled_offset+2048, 64);
+                               memcpy(yuv420_dest+linear_offset+128-temp1, nv12t_src+tiled_offset1, 64);
+                               memcpy(yuv420_dest+linear_offset+192-temp1, nv12t_src+tiled_offset1+2048, 64);
+                               linear_offset = linear_offset+256-temp1;
+                       } else if (temp3 > 128) {
+                               memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset+2048+temp1, 64-temp1);
+                               memcpy(yuv420_dest+linear_offset+64-temp1, nv12t_src+tiled_offset1, 64);
+                               memcpy(yuv420_dest+linear_offset+128-temp1, nv12t_src+tiled_offset1+2048, 64);
+                               linear_offset = linear_offset+192-temp1;
+                       } else if (temp3 > 64) {
+                               memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset1+temp1, 64-temp1);
+                               memcpy(yuv420_dest+linear_offset+64-temp1, nv12t_src+tiled_offset1+2048, 64);
+                               linear_offset = linear_offset+128-temp1;
+                       } else if (temp3 > 0) {
+                               memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset1+2048+temp1, 64-temp1);
+                               linear_offset = linear_offset+64-temp1;
+                       }
+
+                       tiled_offset = tiled_offset+temp4*2048;
+                       j = (left>>8)<<8;
+                       j = j + 256;
+                       temp2 = yuv420_width-right-256;
+                       for (; j <= temp2; j = j+256) {
+                               memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset, 64);
+                               tiled_offset1 = tiled_offset1+temp4*2048;
+                               memcpy(yuv420_dest+linear_offset+64, nv12t_src+tiled_offset+2048, 64);
+                               memcpy(yuv420_dest+linear_offset+128, nv12t_src+tiled_offset1, 64);
+                               tiled_offset = tiled_offset+temp4*2048;
+                               memcpy(yuv420_dest+linear_offset+192, nv12t_src+tiled_offset1+2048, 64);
+                               linear_offset = linear_offset+256;
+                       }
+
+                       tiled_offset1 = tiled_offset1+temp4*2048;
+                       temp2 = yuv420_width-right-j;
+                       if (temp2 > 192) {
+                               memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset, 64);
+                               memcpy(yuv420_dest+linear_offset+64, nv12t_src+tiled_offset+2048, 64);
+                               memcpy(yuv420_dest+linear_offset+128, nv12t_src+tiled_offset1, 64);
+                               memcpy(yuv420_dest+linear_offset+192, nv12t_src+tiled_offset1+2048, temp2-192);
+                       } else if (temp2 > 128) {
+                               memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset, 64);
+                               memcpy(yuv420_dest+linear_offset+64, nv12t_src+tiled_offset+2048, 64);
+                               memcpy(yuv420_dest+linear_offset+128, nv12t_src+tiled_offset1, temp2-128);
+                       } else if (temp2 > 64) {
+                               memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset, 64);
+                               memcpy(yuv420_dest+linear_offset+64, nv12t_src+tiled_offset+2048, temp2-64);
+                       } else
+                               memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset, temp2);
+               }
+       } else if (temp1 >= 64) {
+               for (i = top; i < (yuv420_height-buttom); i = i+1) {
+                       j = left;
+                       tiled_offset = __tile_4x2_read(yuv420_width, yuv420_height, j, i);
+                       temp2 = ((j+64)>>6)<<6;
+                       temp2 = temp2-j;
+                       linear_offset = temp1*(i-top);
+                       temp4 = j&0x3;
+                       tiled_offset = tiled_offset+temp4;
+                       memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset, temp2);
+                       linear_offset = linear_offset+temp2;
+                       j = j+temp2;
+                       if ((j+64) <= temp3) {
+                               tiled_offset = __tile_4x2_read(yuv420_width, yuv420_height, j, i);
+                               memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset, 64);
+                               linear_offset = linear_offset+64;
+                               j = j+64;
+                       }
+                       if ((j+64) <= temp3) {
+                               tiled_offset = __tile_4x2_read(yuv420_width, yuv420_height, j, i);
+                               memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset, 64);
+                               linear_offset = linear_offset+64;
+                               j = j+64;
+                       }
+                       if (j < temp3) {
+                               tiled_offset = __tile_4x2_read(yuv420_width, yuv420_height, j, i);
+                               temp2 = temp3-j;
+                               memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset, temp2);
+                       }
+               }
+       } else {
+               for (i = top; i < (yuv420_height-buttom); i = i+1) {
+                       linear_offset = temp1*(i-top);
+                       for (j = left; j < (yuv420_width-right); j = j+2) {
+                               tiled_offset = __tile_4x2_read(yuv420_width, yuv420_height, j, i);
+                               temp4 = j&0x3;
+                               tiled_offset = tiled_offset+temp4;
+                               memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset, 2);
+                               linear_offset = linear_offset+2;
+                       }
+               }
+       }
 }
index 74778eb..0619d85 100644 (file)
 /*---------------------------------------------------------------------------
 |    LOCAL FUNCTION PROTOTYPES:                                                                                                |
 ---------------------------------------------------------------------------*/
-static gint __gst_transform_gsterror( mm_player_t* player, GstMessage * message, GError* error);
+static gint __gst_transform_gsterror(mm_player_t* player, GstMessage * message, GError* error);
 
 /*===========================================================================================
 |                                                                                                                                                                                      |
 |  FUNCTION DEFINITIONS                                                                                                                                                |
-|                                                                                                                                                                                      |
+|                                                                                                                                                                                      |
 ========================================================================================== */
 int
 __mmplayer_check_state(mm_player_t* player, enum PlayerCommandState command)
@@ -92,168 +92,142 @@ __mmplayer_check_state(mm_player_t* player, enum PlayerCommandState command)
 
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
 
-       //LOGD("incomming command : %d \n", command );
+       //LOGD("incomming command : %d \n", command);
 
        current_state = MMPLAYER_CURRENT_STATE(player);
        pending_state = MMPLAYER_PENDING_STATE(player);
 
        MMPLAYER_PRINT_STATE(player);
 
-       switch( command )
+       switch (command) {
+       case MMPLAYER_COMMAND_CREATE:
        {
-               case MMPLAYER_COMMAND_CREATE:
-               {
-                       MMPLAYER_TARGET_STATE(player) = MM_PLAYER_STATE_NULL;
-
-                       if ( current_state == MM_PLAYER_STATE_NULL ||
-                               current_state == MM_PLAYER_STATE_READY ||
-                               current_state == MM_PLAYER_STATE_PAUSED ||
-                               current_state == MM_PLAYER_STATE_PLAYING )
-                               goto NO_OP;
-               }
-               break;
-
-               case MMPLAYER_COMMAND_DESTROY:
-               {
-                       /* destroy can called anytime */
+               MMPLAYER_TARGET_STATE(player) = MM_PLAYER_STATE_NULL;
 
-                       MMPLAYER_TARGET_STATE(player) = MM_PLAYER_STATE_NONE;
-               }
-               break;
-
-               case MMPLAYER_COMMAND_REALIZE:
-               {
-                       MMPLAYER_TARGET_STATE(player) = MM_PLAYER_STATE_READY;
+               if (current_state == MM_PLAYER_STATE_NULL ||
+                       current_state == MM_PLAYER_STATE_READY ||
+                       current_state == MM_PLAYER_STATE_PAUSED ||
+                       current_state == MM_PLAYER_STATE_PLAYING)
+                       goto NO_OP;
+       }
+       break;
 
-                       if ( pending_state != MM_PLAYER_STATE_NONE )
-                       {
-                               goto INVALID_STATE;
-                       }
-                       else
-                       {
-                               /* need ready state to realize */
-                               if ( current_state == MM_PLAYER_STATE_READY )
-                                       goto NO_OP;
+       case MMPLAYER_COMMAND_DESTROY:
+       {
+               /* destroy can called anytime */
 
-                               if ( current_state != MM_PLAYER_STATE_NULL )
-                                       goto INVALID_STATE;
-                       }
-               }
-               break;
+               MMPLAYER_TARGET_STATE(player) = MM_PLAYER_STATE_NONE;
+       }
+       break;
 
-               case MMPLAYER_COMMAND_UNREALIZE:
-               {
-                       MMPLAYER_TARGET_STATE(player) = MM_PLAYER_STATE_NULL;
+       case MMPLAYER_COMMAND_REALIZE:
+       {
+               MMPLAYER_TARGET_STATE(player) = MM_PLAYER_STATE_READY;
 
-                       if ( current_state == MM_PLAYER_STATE_NULL )
+               if (pending_state != MM_PLAYER_STATE_NONE) {
+                       goto INVALID_STATE;
+               } else {
+                       /* need ready state to realize */
+                       if (current_state == MM_PLAYER_STATE_READY)
                                goto NO_OP;
-               }
-               break;
 
-               case MMPLAYER_COMMAND_START:
-               {
-                       MMPLAYER_TARGET_STATE(player) = MM_PLAYER_STATE_PLAYING;
-
-                       if ( pending_state == MM_PLAYER_STATE_NONE )
-                       {
-                               if ( current_state == MM_PLAYER_STATE_PLAYING )
-                                       goto NO_OP;
-                               else if ( current_state  != MM_PLAYER_STATE_READY &&
-                                       current_state != MM_PLAYER_STATE_PAUSED )
-                                       goto INVALID_STATE;
-                       }
-                       else if ( pending_state == MM_PLAYER_STATE_PLAYING )
-                       {
-                               goto ALREADY_GOING;
-                       }
-                       else if ( pending_state == MM_PLAYER_STATE_PAUSED )
-                       {
-                               LOGD("player is going to paused state, just change the pending state as playing");
-                       }
-                       else
-                       {
+                       if (current_state != MM_PLAYER_STATE_NULL)
                                goto INVALID_STATE;
-                       }
                }
-               break;
+       }
+       break;
 
-               case MMPLAYER_COMMAND_STOP:
-               {
-                       MMPLAYER_TARGET_STATE(player) = MM_PLAYER_STATE_READY;
+       case MMPLAYER_COMMAND_UNREALIZE:
+       {
+               MMPLAYER_TARGET_STATE(player) = MM_PLAYER_STATE_NULL;
 
-                       if ( current_state == MM_PLAYER_STATE_READY )
-                               goto NO_OP;
+               if (current_state == MM_PLAYER_STATE_NULL)
+                       goto NO_OP;
+       }
+       break;
 
-                       /* need playing/paused state to stop */
-                       if ( current_state != MM_PLAYER_STATE_PLAYING &&
-                                current_state != MM_PLAYER_STATE_PAUSED )
-                               goto INVALID_STATE;
-               }
-               break;
+       case MMPLAYER_COMMAND_START:
+       {
+               MMPLAYER_TARGET_STATE(player) = MM_PLAYER_STATE_PLAYING;
 
-               case MMPLAYER_COMMAND_PAUSE:
-               {
-                       if ( MMPLAYER_IS_LIVE_STREAMING( player ) )
+               if (pending_state == MM_PLAYER_STATE_NONE) {
+                       if (current_state == MM_PLAYER_STATE_PLAYING)
                                goto NO_OP;
+                       else if (current_state  != MM_PLAYER_STATE_READY &&
+                               current_state != MM_PLAYER_STATE_PAUSED)
+                               goto INVALID_STATE;
+               } else if (pending_state == MM_PLAYER_STATE_PLAYING) {
+                       goto ALREADY_GOING;
+               } else if (pending_state == MM_PLAYER_STATE_PAUSED) {
+                       LOGD("player is going to paused state, just change the pending state as playing");
+               } else
+                       goto INVALID_STATE;
+       }
+       break;
 
-                       if (player->doing_seek)
-                               goto NOT_COMPLETED_SEEK;
+       case MMPLAYER_COMMAND_STOP:
+       {
+               MMPLAYER_TARGET_STATE(player) = MM_PLAYER_STATE_READY;
 
-                       MMPLAYER_TARGET_STATE(player) = MM_PLAYER_STATE_PAUSED;
+               if (current_state == MM_PLAYER_STATE_READY)
+                       goto NO_OP;
 
-                       if ( pending_state == MM_PLAYER_STATE_NONE )
-                       {
-                               if ( current_state == MM_PLAYER_STATE_PAUSED )
-                                       goto NO_OP;
-                               else if ( current_state != MM_PLAYER_STATE_PLAYING && current_state != MM_PLAYER_STATE_READY ) // support loading state of broswer
-                                       goto INVALID_STATE;
-                       }
-                       else if ( pending_state == MM_PLAYER_STATE_PAUSED )
-                       {
-                               goto ALREADY_GOING;
-                       }
-                       else if ( pending_state == MM_PLAYER_STATE_PLAYING )
-                       {
-                               if ( current_state == MM_PLAYER_STATE_PAUSED ) {
-                                       LOGD("player is PAUSED going to PLAYING, just change the pending state as PAUSED");
-                               } else {
-                                       goto INVALID_STATE;
-                               }
-                       }
-               }
-               break;
+               /* need playing/paused state to stop */
+               if (current_state != MM_PLAYER_STATE_PLAYING &&
+                        current_state != MM_PLAYER_STATE_PAUSED)
+                       goto INVALID_STATE;
+       }
+       break;
 
-               case MMPLAYER_COMMAND_RESUME:
-               {
+       case MMPLAYER_COMMAND_PAUSE:
+       {
+               if (MMPLAYER_IS_LIVE_STREAMING(player))
+                       goto NO_OP;
 
-                       if (player->doing_seek)
-                               goto NOT_COMPLETED_SEEK;
+               if (player->doing_seek)
+                       goto NOT_COMPLETED_SEEK;
 
-                       MMPLAYER_TARGET_STATE(player) = MM_PLAYER_STATE_PLAYING;
+               MMPLAYER_TARGET_STATE(player) = MM_PLAYER_STATE_PAUSED;
 
-                       if ( pending_state == MM_PLAYER_STATE_NONE )
-                       {
-                               if ( current_state == MM_PLAYER_STATE_PLAYING )
-                                       goto NO_OP;
-                               else if (  current_state != MM_PLAYER_STATE_PAUSED )
-                                       goto INVALID_STATE;
-                       }
-                       else if ( pending_state == MM_PLAYER_STATE_PLAYING )
-                       {
-                               goto ALREADY_GOING;
-                       }
-                       else if ( pending_state == MM_PLAYER_STATE_PAUSED )
-                       {
-                               LOGD("player is going to paused state, just change the pending state as playing");
-                       }
+               if (pending_state == MM_PLAYER_STATE_NONE) {
+                       if (current_state == MM_PLAYER_STATE_PAUSED)
+                               goto NO_OP;
+                       else if (current_state != MM_PLAYER_STATE_PLAYING && current_state != MM_PLAYER_STATE_READY) // support loading state of broswer
+                               goto INVALID_STATE;
+               } else if (pending_state == MM_PLAYER_STATE_PAUSED) {
+                       goto ALREADY_GOING;
+               } else if (pending_state == MM_PLAYER_STATE_PLAYING) {
+                       if (current_state == MM_PLAYER_STATE_PAUSED)
+                               LOGD("player is PAUSED going to PLAYING, just change the pending state as PAUSED");
                        else
-                       {
                                goto INVALID_STATE;
-                       }
                }
+       }
+       break;
+
+       case MMPLAYER_COMMAND_RESUME:
+       {
+
+               if (player->doing_seek)
+                       goto NOT_COMPLETED_SEEK;
+
+               MMPLAYER_TARGET_STATE(player) = MM_PLAYER_STATE_PLAYING;
+
+               if (pending_state == MM_PLAYER_STATE_NONE) {
+                       if (current_state == MM_PLAYER_STATE_PLAYING)
+                               goto NO_OP;
+                       else if (current_state != MM_PLAYER_STATE_PAUSED)
+                               goto INVALID_STATE;
+               } else if (pending_state == MM_PLAYER_STATE_PLAYING) {
+                       goto ALREADY_GOING;
+               } else if (pending_state == MM_PLAYER_STATE_PAUSED) {
+                       LOGD("player is going to paused state, just change the pending state as playing");
+               } else
+                       goto INVALID_STATE;
+       }
                break;
 
-               default:
+       default:
                break;
        }
        player->cmd = command;
@@ -279,7 +253,7 @@ ALREADY_GOING:
 }
 
 int
-__mmplayer_gst_set_state (mm_player_t* player, GstElement * element,  GstState state, gboolean async, gint timeout)
+__mmplayer_gst_set_state(mm_player_t* player, GstElement * element,  GstState state, gboolean async, gint timeout)
 {
        GstState element_state = GST_STATE_VOID_PENDING;
        GstState element_pending_state = GST_STATE_VOID_PENDING;
@@ -287,47 +261,44 @@ __mmplayer_gst_set_state (mm_player_t* player, GstElement * element,  GstState s
 
        MMPLAYER_FENTER();
 
-       MMPLAYER_RETURN_VAL_IF_FAIL ( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
-       MMPLAYER_RETURN_VAL_IF_FAIL ( element, MM_ERROR_INVALID_ARGUMENT );
+       MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+       MMPLAYER_RETURN_VAL_IF_FAIL(element, MM_ERROR_INVALID_ARGUMENT);
 
        LOGD("setting [%s] element state to : %s\n", GST_ELEMENT_NAME(element), gst_element_state_get_name(state));
 
        /* set state */
        ret = gst_element_set_state(element, state);
 
-       if ( ret == GST_STATE_CHANGE_FAILURE )
-       {
+       if (ret == GST_STATE_CHANGE_FAILURE) {
                LOGE("failed to set [%s] state\n", GST_ELEMENT_NAME(element));
 
                /* dump state of all element */
-               __mmplayer_dump_pipeline_state( player );
+               __mmplayer_dump_pipeline_state(player);
 
                return MM_ERROR_PLAYER_INTERNAL;
        }
 
        /* return here so state transition to be done in async mode */
-       if ( async )
-       {
+       if (async) {
                LOGD("async state transition. not waiting for state complete.\n");
                return MM_ERROR_NONE;
        }
 
        /* wait for state transition */
-       ret = gst_element_get_state( element, &element_state, &element_pending_state, timeout * GST_SECOND );
+       ret = gst_element_get_state(element, &element_state, &element_pending_state, timeout * GST_SECOND);
 
-       if ( ret == GST_STATE_CHANGE_FAILURE || ( state != element_state ) )
-       {
+       if (ret == GST_STATE_CHANGE_FAILURE || (state != element_state)) {
                LOGE("failed to change [%s] element state to [%s] within %d sec\n",
                        GST_ELEMENT_NAME(element),
-                       gst_element_state_get_name(state), timeout );
+                       gst_element_state_get_name(state), timeout);
 
                LOGE(" [%s] state : %s   pending : %s \n",
                        GST_ELEMENT_NAME(element),
                        gst_element_state_get_name(element_state),
-                       gst_element_state_get_name(element_pending_state) );
+                       gst_element_state_get_name(element_pending_state));
 
                /* dump state of all element */
-               __mmplayer_dump_pipeline_state( player );
+               __mmplayer_dump_pipeline_state(player);
 
                return MM_ERROR_PLAYER_INTERNAL;
        }
@@ -345,10 +316,9 @@ void __mmplayer_remove_g_source_from_context(GMainContext *context, guint source
 
        MMPLAYER_FENTER();
 
-       source = g_main_context_find_source_by_id (context, source_id);
+       source = g_main_context_find_source_by_id(context, source_id);
 
-       if (source != NULL)
-       {
+       if (source != NULL) {
                LOGW("context: %p, source id: %d, source: %p", context, source_id, source);
                g_source_destroy(source);
        }
@@ -357,7 +327,7 @@ void __mmplayer_remove_g_source_from_context(GMainContext *context, guint source
 }
 
 gboolean
-__mmplayer_dump_pipeline_state( mm_player_t* player )
+__mmplayer_dump_pipeline_state(mm_player_t* player)
 {
        GstIterator*iter = NULL;
        gboolean done = FALSE;
@@ -372,63 +342,58 @@ __mmplayer_dump_pipeline_state( mm_player_t* player )
 
        MMPLAYER_FENTER();
 
-       MMPLAYER_RETURN_VAL_IF_FAIL ( player &&
+       MMPLAYER_RETURN_VAL_IF_FAIL(player &&
                player->pipeline &&
                player->pipeline->mainbin,
-               FALSE );
+               FALSE);
 
-       iter = gst_bin_iterate_recurse(GST_BIN(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst) );
+       iter = gst_bin_iterate_recurse(GST_BIN(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst));
 
-       if ( iter != NULL )
-       {
+       if (iter != NULL) {
                while (!done) {
-                        switch ( gst_iterator_next (iter, &item) )
-                        {
-                          case GST_ITERATOR_OK:
+                       switch (gst_iterator_next(iter, &item)) {
+                       case GST_ITERATOR_OK:
                                element = g_value_get_object(&item);
-                               gst_element_get_state(element,&state, &pending,time);
+                               gst_element_get_state(element, &state, &pending, time);
 
-                               factory = gst_element_get_factory (element) ;
+                               factory = gst_element_get_factory(element) ;
                                if (factory)
-                               {
                                        LOGE("%s:%s : From:%s To:%s   refcount : %d\n", GST_OBJECT_NAME(factory) , GST_ELEMENT_NAME(element) ,
                                                gst_element_state_get_name(state), gst_element_state_get_name(pending) , GST_OBJECT_REFCOUNT_VALUE(element));
-                               }
-                                g_value_reset (&item);
-                                break;
-                          case GST_ITERATOR_RESYNC:
-                                gst_iterator_resync (iter);
-                                break;
-                          case GST_ITERATOR_ERROR:
-                                done = TRUE;
-                                break;
-                          case GST_ITERATOR_DONE:
-                                done = TRUE;
-                                break;
-                        }
+                               g_value_reset(&item);
+                               break;
+                       case GST_ITERATOR_RESYNC:
+                               gst_iterator_resync(iter);
+                               break;
+                       case GST_ITERATOR_ERROR:
+                               done = TRUE;
+                               break;
+                       case GST_ITERATOR_DONE:
+                               done = TRUE;
+                               break;
+                       }
                }
        }
 
        element = GST_ELEMENT(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst);
 
-       gst_element_get_state(element,&state, &pending,time);
+       gst_element_get_state(element, &state, &pending, time);
 
-       factory = gst_element_get_factory (element) ;
+       factory = gst_element_get_factory(element) ;
 
-       if (factory)
-       {
+       if (factory) {
                LOGE("%s:%s : From:%s To:%s  refcount : %d\n",
                        GST_OBJECT_NAME(factory),
                        GST_ELEMENT_NAME(element),
                        gst_element_state_get_name(state),
                        gst_element_state_get_name(pending),
-                       GST_OBJECT_REFCOUNT_VALUE(element) );
+                       GST_OBJECT_REFCOUNT_VALUE(element));
        }
 
        g_value_unset(&item);
 
-       if ( iter )
-               gst_iterator_free (iter);
+       if (iter)
+               gst_iterator_free(iter);
 
        MMPLAYER_FLEAVE();
 
@@ -436,97 +401,96 @@ __mmplayer_dump_pipeline_state( mm_player_t* player )
 }
 
 const gchar *
-__get_state_name ( int state )
+__get_state_name(int state)
 {
-       switch ( state )
-       {
-               case MM_PLAYER_STATE_NULL:
-                       return "NULL";
-               case MM_PLAYER_STATE_READY:
-                       return "READY";
-               case MM_PLAYER_STATE_PAUSED:
-                       return "PAUSED";
-               case MM_PLAYER_STATE_PLAYING:
-                       return "PLAYING";
-               case MM_PLAYER_STATE_NONE:
-                       return "NONE";
-               default:
-                       return "INVAID";
+       switch (state) {
+       case MM_PLAYER_STATE_NULL:
+               return "NULL";
+       case MM_PLAYER_STATE_READY:
+               return "READY";
+       case MM_PLAYER_STATE_PAUSED:
+               return "PAUSED";
+       case MM_PLAYER_STATE_PLAYING:
+               return "PLAYING";
+       case MM_PLAYER_STATE_NONE:
+               return "NONE";
+       default:
+               return "INVAID";
        }
 }
 
 gboolean
-__is_rtsp_streaming ( mm_player_t* player )
+__is_rtsp_streaming(mm_player_t* player)
 {
-       MMPLAYER_RETURN_VAL_IF_FAIL ( player, FALSE );
+       MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
 
-       return ( player->profile.uri_type == MM_PLAYER_URI_TYPE_URL_RTSP ) ? TRUE : FALSE;
+       return (player->profile.uri_type == MM_PLAYER_URI_TYPE_URL_RTSP) ? TRUE : FALSE;
 }
 
 gboolean
-__is_wfd_streaming ( mm_player_t* player )
+__is_wfd_streaming(mm_player_t* player)
 {
-  MMPLAYER_RETURN_VAL_IF_FAIL ( player, FALSE );
+       MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
 
-  return ( player->profile.uri_type == MM_PLAYER_URI_TYPE_URL_WFD ) ? TRUE : FALSE;
+       return (player->profile.uri_type == MM_PLAYER_URI_TYPE_URL_WFD) ? TRUE : FALSE;
 }
 
 gboolean
-__is_http_streaming ( mm_player_t* player )
+__is_http_streaming(mm_player_t* player)
 {
-       MMPLAYER_RETURN_VAL_IF_FAIL ( player, FALSE );
+       MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
 
-       return ( player->profile.uri_type == MM_PLAYER_URI_TYPE_URL_HTTP ) ? TRUE : FALSE;
+       return (player->profile.uri_type == MM_PLAYER_URI_TYPE_URL_HTTP) ? TRUE : FALSE;
 }
 
 gboolean
-__is_streaming ( mm_player_t* player )
+__is_streaming(mm_player_t* player)
 {
-       MMPLAYER_RETURN_VAL_IF_FAIL ( player, FALSE );
+       MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
 
-  return ( __is_http_progressive_down( player ) || __is_rtsp_streaming ( player ) || __is_wfd_streaming ( player ) || __is_http_streaming ( player )
-          || __is_http_live_streaming ( player ) || __is_dash_streaming ( player ) || __is_smooth_streaming(player) ) ? TRUE : FALSE;
+       return (__is_http_progressive_down(player) || __is_rtsp_streaming(player) || __is_wfd_streaming(player) || __is_http_streaming(player)
+               || __is_http_live_streaming(player) || __is_dash_streaming(player) || __is_smooth_streaming(player)) ? TRUE : FALSE;
 }
 
 gboolean
-__is_live_streaming ( mm_player_t* player )
+__is_live_streaming(mm_player_t* player)
 {
-       MMPLAYER_RETURN_VAL_IF_FAIL ( player, FALSE );
+       MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
 
-       return ( __is_rtsp_streaming ( player ) && player->streaming_type == STREAMING_SERVICE_LIVE ) ? TRUE : FALSE;
+       return (__is_rtsp_streaming(player) && player->streaming_type == STREAMING_SERVICE_LIVE) ? TRUE : FALSE;
 }
 
 gboolean
-__is_http_live_streaming( mm_player_t* player )
+__is_http_live_streaming(mm_player_t* player)
 {
-       MMPLAYER_RETURN_VAL_IF_FAIL( player, FALSE );
+       MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
 
-       return ( player->profile.uri_type == MM_PLAYER_URI_TYPE_HLS ) ? TRUE : FALSE;
+       return (player->profile.uri_type == MM_PLAYER_URI_TYPE_HLS) ? TRUE : FALSE;
 }
 
 gboolean
-__is_dash_streaming ( mm_player_t* player )
+__is_dash_streaming(mm_player_t* player)
 {
-       MMPLAYER_RETURN_VAL_IF_FAIL ( player, FALSE );
+       MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
 
-       return ( player->profile.uri_type == MM_PLAYER_URI_TYPE_DASH ) ? TRUE : FALSE;
+       return (player->profile.uri_type == MM_PLAYER_URI_TYPE_DASH) ? TRUE : FALSE;
 }
 
 gboolean
-__is_smooth_streaming ( mm_player_t* player )
+__is_smooth_streaming(mm_player_t* player)
 {
-       MMPLAYER_RETURN_VAL_IF_FAIL ( player, FALSE );
+       MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
 
-       return ( player->profile.uri_type == MM_PLAYER_URI_TYPE_SS ) ? TRUE : FALSE;
+       return (player->profile.uri_type == MM_PLAYER_URI_TYPE_SS) ? TRUE : FALSE;
 }
 
 
 gboolean
 __is_http_progressive_down(mm_player_t* player)
 {
-       MMPLAYER_RETURN_VAL_IF_FAIL( player, FALSE );
+       MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
 
-       return ((player->pd_mode) ? TRUE:FALSE);
+       return ((player->pd_mode) ? TRUE : FALSE);
 }
 
 /* if retval is FALSE, it will be dropped for perfomance. */
@@ -535,54 +499,51 @@ __mmplayer_check_useful_message(mm_player_t *player, GstMessage * message)
 {
        gboolean retval = FALSE;
 
-       if ( !(player->pipeline && player->pipeline->mainbin) )
-       {
+       if (!(player->pipeline && player->pipeline->mainbin)) {
                LOGE("player pipeline handle is null");
                return TRUE;
        }
 
-       switch (GST_MESSAGE_TYPE (message))
-       {
-               case GST_MESSAGE_TAG:
-               case GST_MESSAGE_EOS:
-               case GST_MESSAGE_ERROR:
-               case GST_MESSAGE_WARNING:
-               case GST_MESSAGE_CLOCK_LOST:
-               case GST_MESSAGE_NEW_CLOCK:
-               case GST_MESSAGE_ELEMENT:
-               case GST_MESSAGE_DURATION_CHANGED:
-               case GST_MESSAGE_ASYNC_START:
+       switch (GST_MESSAGE_TYPE(message)) {
+       case GST_MESSAGE_TAG:
+       case GST_MESSAGE_EOS:
+       case GST_MESSAGE_ERROR:
+       case GST_MESSAGE_WARNING:
+       case GST_MESSAGE_CLOCK_LOST:
+       case GST_MESSAGE_NEW_CLOCK:
+       case GST_MESSAGE_ELEMENT:
+       case GST_MESSAGE_DURATION_CHANGED:
+       case GST_MESSAGE_ASYNC_START:
+               retval = TRUE;
+               break;
+       case GST_MESSAGE_ASYNC_DONE:
+       case GST_MESSAGE_STATE_CHANGED:
+               /* we only handle messages from pipeline */
+               if ((message->src == (GstObject *)player->pipeline->mainbin[MMPLAYER_M_PIPE].gst) && (!player->gapless.reconfigure))
                        retval = TRUE;
-                       break;
-               case GST_MESSAGE_ASYNC_DONE:
-               case GST_MESSAGE_STATE_CHANGED:
-                       /* we only handle messages from pipeline */
-                       if(( message->src == (GstObject *)player->pipeline->mainbin[MMPLAYER_M_PIPE].gst ) && (!player->gapless.reconfigure))
-                               retval = TRUE;
-                       else
-                               retval = FALSE;
-                       break;
-               case GST_MESSAGE_BUFFERING:
-               {
-                       gint buffer_percent = 0;
-
-                       gst_message_parse_buffering (message, &buffer_percent);
-
-                       if ((MMPLAYER_IS_STREAMING(player)) &&
-                               (player->streamer) &&
-                               (player->streamer->is_buffering == TRUE) &&
-                               (buffer_percent == MAX_BUFFER_PERCENT))
-                       {
-                               LOGD (">>> [%s] Buffering DONE is detected !!\n", GST_OBJECT_NAME(GST_MESSAGE_SRC(message)));
-                               player->streamer->is_buffering_done = TRUE;
-                       }
+               else
+                       retval = FALSE;
+               break;
+       case GST_MESSAGE_BUFFERING:
+       {
+               gint buffer_percent = 0;
 
-                       retval = TRUE;
-                       break;
+               gst_message_parse_buffering(message, &buffer_percent);
+
+               if ((MMPLAYER_IS_STREAMING(player)) &&
+                       (player->streamer) &&
+                       (player->streamer->is_buffering == TRUE) &&
+                       (buffer_percent == MAX_BUFFER_PERCENT)) {
+                       LOGD(">>> [%s] Buffering DONE is detected !!\n", GST_OBJECT_NAME(GST_MESSAGE_SRC(message)));
+                       player->streamer->is_buffering_done = TRUE;
                }
-               default:
-                       retval = FALSE;
-                       break;
+
+               retval = TRUE;
+               break;
+       }
+       default:
+               retval = FALSE;
+               break;
        }
 
        return retval;
@@ -591,12 +552,10 @@ __mmplayer_check_useful_message(mm_player_t *player, GstMessage * message)
 gboolean
 __mmplayer_post_message(mm_player_t* player, enum MMMessageType msgtype, MMMessageParamType* param)
 {
-       MMPLAYER_RETURN_VAL_IF_FAIL( player, FALSE );
+       MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
 
-       if ( !player->msg_cb )
-       {
+       if (!player->msg_cb)
                return FALSE;
-       }
 
        //LOGD("Message (type : %d)  will be posted using msg-cb(%p). \n", msgtype, player->msg_cb);
 
@@ -606,52 +565,42 @@ __mmplayer_post_message(mm_player_t* player, enum MMMessageType msgtype, MMMessa
 }
 
 gboolean
-__mmplayer_handle_gst_error ( mm_player_t* player, GstMessage * message, GError* error )
+__mmplayer_handle_gst_error(mm_player_t* player, GstMessage * message, GError* error)
 {
        MMMessageParamType msg_param;
        gchar *msg_src_element;
 
        MMPLAYER_FENTER();
 
-       MMPLAYER_RETURN_VAL_IF_FAIL( player, FALSE );
-       MMPLAYER_RETURN_VAL_IF_FAIL( error, FALSE );
+       MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
+       MMPLAYER_RETURN_VAL_IF_FAIL(error, FALSE);
 
        /* NOTE : do somthing necessary inside of __gst_handle_XXX_error. not here */
 
-       memset (&msg_param, 0, sizeof(MMMessageParamType));
-
-       if ( error->domain == GST_CORE_ERROR )
-       {
-               msg_param.code = __gst_handle_core_error( player, error->code );
-       }
-       else if ( error->domain == GST_LIBRARY_ERROR )
-       {
-               msg_param.code = __gst_handle_library_error( player, error->code );
-       }
-       else if ( error->domain == GST_RESOURCE_ERROR )
-       {
-               msg_param.code = __gst_handle_resource_error( player, error->code );
-       }
-       else if ( error->domain == GST_STREAM_ERROR )
-       {
-               msg_param.code = __gst_handle_stream_error( player, error, message );
-       }
-       else
-       {
+       memset(&msg_param, 0, sizeof(MMMessageParamType));
+
+       if (error->domain == GST_CORE_ERROR) {
+               msg_param.code = __gst_handle_core_error(player, error->code);
+       } else if (error->domain == GST_LIBRARY_ERROR) {
+               msg_param.code = __gst_handle_library_error(player, error->code);
+       } else if (error->domain == GST_RESOURCE_ERROR) {
+               msg_param.code = __gst_handle_resource_error(player, error->code);
+       } else if (error->domain == GST_STREAM_ERROR) {
+               msg_param.code = __gst_handle_stream_error(player, error, message);
+       } else {
                LOGW("This error domain is not defined.\n");
 
                /* we treat system error as an internal error */
                msg_param.code = MM_ERROR_PLAYER_INVALID_STREAM;
        }
 
-       if ( message->src )
-       {
-               msg_src_element = GST_ELEMENT_NAME( GST_ELEMENT_CAST( message->src ) );
+       if (message->src) {
+               msg_src_element = GST_ELEMENT_NAME(GST_ELEMENT_CAST(message->src));
 
                msg_param.data = (void *) error->message;
 
                LOGE("-Msg src : [%s]   Domain : [%s]   Error : [%s]  Code : [%d] is tranlated to error code : [0x%x]\n",
-                       msg_src_element, g_quark_to_string (error->domain), error->message, error->code, msg_param.code);
+                       msg_src_element, g_quark_to_string(error->domain), error->message, error->code, msg_param.code);
        }
 
        /* no error */
@@ -659,16 +608,12 @@ __mmplayer_handle_gst_error ( mm_player_t* player, GstMessage * message, GError*
                return TRUE;
 
        /* post error to application */
-       if ( ! player->msg_posted )
-       {
-               MMPLAYER_POST_MSG( player, MM_MESSAGE_ERROR, &msg_param );
+       if (!player->msg_posted) {
+               MMPLAYER_POST_MSG(player, MM_MESSAGE_ERROR, &msg_param);
                /* don't post more if one was sent already */
                player->msg_posted = TRUE;
-       }
-       else
-       {
+       } else
                LOGD("skip error post because it's sent already.\n");
-       }
 
        MMPLAYER_FLEAVE();
 
@@ -676,33 +621,32 @@ __mmplayer_handle_gst_error ( mm_player_t* player, GstMessage * message, GError*
 }
 
 gint
-__gst_handle_core_error( mm_player_t* player, int code )
+__gst_handle_core_error(mm_player_t* player, int code)
 {
        gint trans_err = MM_ERROR_NONE;
 
        MMPLAYER_FENTER();
 
-       MMPLAYER_RETURN_VAL_IF_FAIL( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+       MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
 
-       switch ( code )
-       {
-               case GST_CORE_ERROR_MISSING_PLUGIN:
-                       return MM_ERROR_PLAYER_NOT_SUPPORTED_FORMAT;
-               case GST_CORE_ERROR_STATE_CHANGE:
-               case GST_CORE_ERROR_SEEK:
-               case GST_CORE_ERROR_NOT_IMPLEMENTED:
-               case GST_CORE_ERROR_FAILED:
-               case GST_CORE_ERROR_TOO_LAZY:
-               case GST_CORE_ERROR_PAD:
-               case GST_CORE_ERROR_THREAD:
-               case GST_CORE_ERROR_NEGOTIATION:
-               case GST_CORE_ERROR_EVENT:
-               case GST_CORE_ERROR_CAPS:
-               case GST_CORE_ERROR_TAG:
-               case GST_CORE_ERROR_CLOCK:
-               case GST_CORE_ERROR_DISABLED:
-               default:
-                       trans_err = MM_ERROR_PLAYER_INVALID_STREAM;
+       switch (code) {
+       case GST_CORE_ERROR_MISSING_PLUGIN:
+               return MM_ERROR_PLAYER_NOT_SUPPORTED_FORMAT;
+       case GST_CORE_ERROR_STATE_CHANGE:
+       case GST_CORE_ERROR_SEEK:
+       case GST_CORE_ERROR_NOT_IMPLEMENTED:
+       case GST_CORE_ERROR_FAILED:
+       case GST_CORE_ERROR_TOO_LAZY:
+       case GST_CORE_ERROR_PAD:
+       case GST_CORE_ERROR_THREAD:
+       case GST_CORE_ERROR_NEGOTIATION:
+       case GST_CORE_ERROR_EVENT:
+       case GST_CORE_ERROR_CAPS:
+       case GST_CORE_ERROR_TAG:
+       case GST_CORE_ERROR_CLOCK:
+       case GST_CORE_ERROR_DISABLED:
+       default:
+               trans_err = MM_ERROR_PLAYER_INVALID_STREAM;
                break;
        }
 
@@ -712,24 +656,23 @@ __gst_handle_core_error( mm_player_t* player, int code )
 }
 
 gint
-__gst_handle_library_error( mm_player_t* player, int code )
+__gst_handle_library_error(mm_player_t* player, int code)
 {
        gint trans_err = MM_ERROR_NONE;
 
        MMPLAYER_FENTER();
 
-       MMPLAYER_RETURN_VAL_IF_FAIL( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+       MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
 
-       switch ( code )
-       {
-               case GST_LIBRARY_ERROR_FAILED:
-               case GST_LIBRARY_ERROR_TOO_LAZY:
-               case GST_LIBRARY_ERROR_INIT:
-               case GST_LIBRARY_ERROR_SHUTDOWN:
-               case GST_LIBRARY_ERROR_SETTINGS:
-               case GST_LIBRARY_ERROR_ENCODE:
-               default:
-                       trans_err =  MM_ERROR_PLAYER_INVALID_STREAM;
+       switch (code) {
+       case GST_LIBRARY_ERROR_FAILED:
+       case GST_LIBRARY_ERROR_TOO_LAZY:
+       case GST_LIBRARY_ERROR_INIT:
+       case GST_LIBRARY_ERROR_SHUTDOWN:
+       case GST_LIBRARY_ERROR_SETTINGS:
+       case GST_LIBRARY_ERROR_ENCODE:
+       default:
+               trans_err =  MM_ERROR_PLAYER_INVALID_STREAM;
                break;
        }
 
@@ -739,47 +682,44 @@ __gst_handle_library_error( mm_player_t* player, int code )
 }
 
 gint
-__gst_handle_resource_error( mm_player_t* player, int code )
+__gst_handle_resource_error(mm_player_t* player, int code)
 {
        gint trans_err = MM_ERROR_NONE;
 
        MMPLAYER_FENTER();
 
-       MMPLAYER_RETURN_VAL_IF_FAIL( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+       MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
 
-       switch ( code )
-       {
-               case GST_RESOURCE_ERROR_NO_SPACE_LEFT:
-                       trans_err = MM_ERROR_PLAYER_NO_FREE_SPACE;
-                       break;
-               case GST_RESOURCE_ERROR_NOT_FOUND:
-               case GST_RESOURCE_ERROR_OPEN_READ:
-                       if ( MMPLAYER_IS_HTTP_STREAMING(player) || MMPLAYER_IS_HTTP_LIVE_STREAMING ( player )
-                               || MMPLAYER_IS_RTSP_STREAMING(player))
-                       {
-                               trans_err = MM_ERROR_PLAYER_STREAMING_CONNECTION_FAIL;
-                               break;
-                       }
-               case GST_RESOURCE_ERROR_READ:
-                       if ( MMPLAYER_IS_HTTP_STREAMING(player) ||  MMPLAYER_IS_HTTP_LIVE_STREAMING ( player )
-                               || MMPLAYER_IS_RTSP_STREAMING(player))
-                       {
-                               trans_err = MM_ERROR_PLAYER_STREAMING_FAIL;
-                               break;
-                       }
-               case GST_RESOURCE_ERROR_WRITE:
-               case GST_RESOURCE_ERROR_FAILED:
-               case GST_RESOURCE_ERROR_SEEK:
-               case GST_RESOURCE_ERROR_TOO_LAZY:
-               case GST_RESOURCE_ERROR_BUSY:
-               case GST_RESOURCE_ERROR_OPEN_WRITE:
-               case GST_RESOURCE_ERROR_OPEN_READ_WRITE:
-               case GST_RESOURCE_ERROR_CLOSE:
-               case GST_RESOURCE_ERROR_SYNC:
-               case GST_RESOURCE_ERROR_SETTINGS:
-               default:
-                       trans_err = MM_ERROR_PLAYER_INTERNAL;
+       switch (code) {
+       case GST_RESOURCE_ERROR_NO_SPACE_LEFT:
+               trans_err = MM_ERROR_PLAYER_NO_FREE_SPACE;
                break;
+       case GST_RESOURCE_ERROR_NOT_FOUND:
+       case GST_RESOURCE_ERROR_OPEN_READ:
+               if (MMPLAYER_IS_HTTP_STREAMING(player) || MMPLAYER_IS_HTTP_LIVE_STREAMING(player)
+                       || MMPLAYER_IS_RTSP_STREAMING(player)) {
+                       trans_err = MM_ERROR_PLAYER_STREAMING_CONNECTION_FAIL;
+                       break;
+               }
+       case GST_RESOURCE_ERROR_READ:
+               if (MMPLAYER_IS_HTTP_STREAMING(player) || MMPLAYER_IS_HTTP_LIVE_STREAMING(player)
+                       || MMPLAYER_IS_RTSP_STREAMING(player)) {
+                       trans_err = MM_ERROR_PLAYER_STREAMING_FAIL;
+                       break;
+               }
+       case GST_RESOURCE_ERROR_WRITE:
+       case GST_RESOURCE_ERROR_FAILED:
+       case GST_RESOURCE_ERROR_SEEK:
+       case GST_RESOURCE_ERROR_TOO_LAZY:
+       case GST_RESOURCE_ERROR_BUSY:
+       case GST_RESOURCE_ERROR_OPEN_WRITE:
+       case GST_RESOURCE_ERROR_OPEN_READ_WRITE:
+       case GST_RESOURCE_ERROR_CLOSE:
+       case GST_RESOURCE_ERROR_SYNC:
+       case GST_RESOURCE_ERROR_SETTINGS:
+       default:
+               trans_err = MM_ERROR_PLAYER_INTERNAL;
+       break;
        }
 
        MMPLAYER_FLEAVE();
@@ -788,36 +728,35 @@ __gst_handle_resource_error( mm_player_t* player, int code )
 }
 
 gint
-__gst_handle_stream_error( mm_player_t* player, GError* error, GstMessage * message )
+__gst_handle_stream_error(mm_player_t* player, GError* error, GstMessage * message)
 {
        gint trans_err = MM_ERROR_NONE;
 
        MMPLAYER_FENTER();
 
-       MMPLAYER_RETURN_VAL_IF_FAIL( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
-       MMPLAYER_RETURN_VAL_IF_FAIL( error, MM_ERROR_INVALID_ARGUMENT );
-       MMPLAYER_RETURN_VAL_IF_FAIL ( message, MM_ERROR_INVALID_ARGUMENT );
-
-       switch ( error->code )
-       {
-               case GST_STREAM_ERROR_FAILED:
-               case GST_STREAM_ERROR_TYPE_NOT_FOUND:
-               case GST_STREAM_ERROR_DECODE:
-               case GST_STREAM_ERROR_WRONG_TYPE:
-               case GST_STREAM_ERROR_DECRYPT:
-               case GST_STREAM_ERROR_DECRYPT_NOKEY:
-               case GST_STREAM_ERROR_CODEC_NOT_FOUND:
-                        trans_err = __gst_transform_gsterror( player, message, error );
+       MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+       MMPLAYER_RETURN_VAL_IF_FAIL(error, MM_ERROR_INVALID_ARGUMENT);
+       MMPLAYER_RETURN_VAL_IF_FAIL(message, MM_ERROR_INVALID_ARGUMENT);
+
+       switch (error->code) {
+       case GST_STREAM_ERROR_FAILED:
+       case GST_STREAM_ERROR_TYPE_NOT_FOUND:
+       case GST_STREAM_ERROR_DECODE:
+       case GST_STREAM_ERROR_WRONG_TYPE:
+       case GST_STREAM_ERROR_DECRYPT:
+       case GST_STREAM_ERROR_DECRYPT_NOKEY:
+       case GST_STREAM_ERROR_CODEC_NOT_FOUND:
+               trans_err = __gst_transform_gsterror(player, message, error);
                break;
 
-               case GST_STREAM_ERROR_NOT_IMPLEMENTED:
-               case GST_STREAM_ERROR_TOO_LAZY:
-               case GST_STREAM_ERROR_ENCODE:
-               case GST_STREAM_ERROR_DEMUX:
-               case GST_STREAM_ERROR_MUX:
-               case GST_STREAM_ERROR_FORMAT:
-               default:
-                       trans_err = MM_ERROR_PLAYER_INVALID_STREAM;
+       case GST_STREAM_ERROR_NOT_IMPLEMENTED:
+       case GST_STREAM_ERROR_TOO_LAZY:
+       case GST_STREAM_ERROR_ENCODE:
+       case GST_STREAM_ERROR_DEMUX:
+       case GST_STREAM_ERROR_MUX:
+       case GST_STREAM_ERROR_FORMAT:
+       default:
+               trans_err = MM_ERROR_PLAYER_INVALID_STREAM;
                break;
        }
 
@@ -828,7 +767,7 @@ __gst_handle_stream_error( mm_player_t* player, GError* error, GstMessage * mess
 
 /* NOTE : decide gstreamer state whether there is some playable track or not. */
 static gint
-__gst_transform_gsterror( mm_player_t* player, GstMessage * message, GError* error )
+__gst_transform_gsterror(mm_player_t* player, GstMessage * message, GError* error)
 {
        gchar *src_element_name = NULL;
        GstElement *src_element = NULL;
@@ -837,24 +776,24 @@ __gst_transform_gsterror( mm_player_t* player, GstMessage * message, GError* err
 
        MMPLAYER_FENTER();
 
-       MMPLAYER_RETURN_VAL_IF_FAIL ( message, MM_ERROR_INVALID_ARGUMENT );
-       MMPLAYER_RETURN_VAL_IF_FAIL ( message->src, MM_ERROR_INVALID_ARGUMENT );
-       MMPLAYER_RETURN_VAL_IF_FAIL ( error, MM_ERROR_INVALID_ARGUMENT );
+       MMPLAYER_RETURN_VAL_IF_FAIL(message, MM_ERROR_INVALID_ARGUMENT);
+       MMPLAYER_RETURN_VAL_IF_FAIL(message->src, MM_ERROR_INVALID_ARGUMENT);
+       MMPLAYER_RETURN_VAL_IF_FAIL(error, MM_ERROR_INVALID_ARGUMENT);
 
        src_element = GST_ELEMENT_CAST(message->src);
-       if ( !src_element )
+       if (!src_element)
                goto INTERNAL_ERROR;
 
        src_element_name = GST_ELEMENT_NAME(src_element);
-       if ( !src_element_name )
+       if (!src_element_name)
                goto INTERNAL_ERROR;
 
        factory = gst_element_get_factory(src_element);
-       if ( !factory )
+       if (!factory)
                goto INTERNAL_ERROR;
 
-       klass = gst_element_factory_get_metadata (factory, GST_ELEMENT_METADATA_KLASS);
-       if ( !klass )
+       klass = gst_element_factory_get_metadata(factory, GST_ELEMENT_METADATA_KLASS);
+       if (!klass)
                goto INTERNAL_ERROR;
 
        LOGD("error code=%d, msg=%s, src element=%s, class=%s\n",
@@ -865,14 +804,14 @@ __gst_transform_gsterror( mm_player_t* player, GstMessage * message, GError* err
                if (player->pipeline->mainbin[MMPLAYER_M_A_INPUT_SELECTOR].gst) {
                        int msg_src_pos = 0;
                        gint active_pad_index = player->selector[MM_PLAYER_TRACK_TYPE_AUDIO].active_pad_index;
-                       LOGD ("current  active pad index  -%d", active_pad_index);
+                       LOGD("current  active pad index  -%d", active_pad_index);
 
                        if  (src_element_name) {
                                int idx = 0;
 
                                if (player->audio_decoders) {
                                        GList *adec = player->audio_decoders;
-                                       for ( ;adec ; adec = g_list_next(adec)) {
+                                       for (adec ; adec = g_list_next(adec)) {
                                                gchar *name = adec->data;
 
                                                LOGD("found audio decoder name  = %s", name);
@@ -894,106 +833,75 @@ __gst_transform_gsterror( mm_player_t* player, GstMessage * message, GError* err
        }
        //-> check!! if needed or not
 
-       switch ( error->code )
+       switch (error->code) {
+       case GST_STREAM_ERROR_DECODE:
        {
-               case GST_STREAM_ERROR_DECODE:
-               {
-                       /* Demuxer can't parse one track because it's corrupted.
-                        * So, the decoder for it is not linked.
-                        * But, it has one playable track.
-                        */
-                       if ( g_strrstr(klass, "Demux") )
-                       {
-                               if ( player->can_support_codec == FOUND_PLUGIN_VIDEO )
-                               {
-                                       return MM_ERROR_PLAYER_AUDIO_CODEC_NOT_FOUND;
-                               }
-                               else if ( player->can_support_codec == FOUND_PLUGIN_AUDIO )
-                               {
+               /* Demuxer can't parse one track because it's corrupted.
+                * So, the decoder for it is not linked.
+                * But, it has one playable track.
+                */
+               if (g_strrstr(klass, "Demux")) {
+                       if (player->can_support_codec == FOUND_PLUGIN_VIDEO) {
+                               return MM_ERROR_PLAYER_AUDIO_CODEC_NOT_FOUND;
+                       } else if (player->can_support_codec == FOUND_PLUGIN_AUDIO) {
+                               return MM_ERROR_PLAYER_VIDEO_CODEC_NOT_FOUND;
+                       } else {
+                               if (player->pipeline->audiobin) // PCM
                                        return MM_ERROR_PLAYER_VIDEO_CODEC_NOT_FOUND;
-                               }
                                else
-                               {
-                                       if ( player->pipeline->audiobin ) // PCM
-                                       {
-                                               return MM_ERROR_PLAYER_VIDEO_CODEC_NOT_FOUND;
-                                       }
-                                       else
-                                       {
-                                               goto CODEC_NOT_FOUND;
-                                       }
-                               }
+                                       goto CODEC_NOT_FOUND;
                        }
-                       return MM_ERROR_PLAYER_INVALID_STREAM;
                }
+               return MM_ERROR_PLAYER_INVALID_STREAM;
+       }
                break;
 
-               case GST_STREAM_ERROR_CODEC_NOT_FOUND:
-               case GST_STREAM_ERROR_TYPE_NOT_FOUND:
-               case GST_STREAM_ERROR_WRONG_TYPE:
-                       return MM_ERROR_PLAYER_NOT_SUPPORTED_FORMAT;
-
-               case GST_STREAM_ERROR_FAILED:
-               {
-                       /* Decoder Custom Message */
-                       if ( strstr(error->message, "ongoing") )
-                       {
-                               if ( strncasecmp(klass, "audio", 5) )
-                               {
-                                       if ( ( player->can_support_codec & FOUND_PLUGIN_VIDEO ) )
-                                       {
-                                               LOGD("Video can keep playing.\n");
-                                               return MM_ERROR_PLAYER_AUDIO_CODEC_NOT_FOUND;
-                                       }
-                                       else
-                                       {
-                                               goto CODEC_NOT_FOUND;
-                                       }
+       case GST_STREAM_ERROR_CODEC_NOT_FOUND:
+       case GST_STREAM_ERROR_TYPE_NOT_FOUND:
+       case GST_STREAM_ERROR_WRONG_TYPE:
+               return MM_ERROR_PLAYER_NOT_SUPPORTED_FORMAT;
 
-                               }
-                               else if ( strncasecmp(klass, "video", 5) )
-                               {
-                                       if ( ( player->can_support_codec & FOUND_PLUGIN_AUDIO ) )
-                                       {
-                                               LOGD("Audio can keep playing.\n");
-                                               return MM_ERROR_PLAYER_VIDEO_CODEC_NOT_FOUND;
-                                       }
-                                       else
-                                       {
-                                               goto CODEC_NOT_FOUND;
-                                       }
-                               }
+       case GST_STREAM_ERROR_FAILED:
+       {
+               /* Decoder Custom Message */
+               if (strstr(error->message, "ongoing")) {
+                       if (strncasecmp(klass, "audio", 5)) {
+                               if ((player->can_support_codec & FOUND_PLUGIN_VIDEO)) {
+                                       LOGD("Video can keep playing.\n");
+                                       return MM_ERROR_PLAYER_AUDIO_CODEC_NOT_FOUND;
+                               } else
+                                       goto CODEC_NOT_FOUND;
+
+                       } else if (strncasecmp(klass, "video", 5)) {
+                               if ((player->can_support_codec & FOUND_PLUGIN_AUDIO)) {
+                                       LOGD("Audio can keep playing.\n");
+                                       return MM_ERROR_PLAYER_VIDEO_CODEC_NOT_FOUND;
+                               } else
+                                       goto CODEC_NOT_FOUND;
                        }
-                       return MM_ERROR_PLAYER_NOT_SUPPORTED_FORMAT;
                }
+               return MM_ERROR_PLAYER_NOT_SUPPORTED_FORMAT;
+       }
                break;
 
-               case GST_STREAM_ERROR_DECRYPT:
-               case GST_STREAM_ERROR_DECRYPT_NOKEY:
-               {
-                       LOGE("decryption error, [%s] failed, reason : [%s]\n", src_element_name, error->message);
-
-                       if ( strstr(error->message, "rights expired") )
-                       {
-                               return MM_ERROR_PLAYER_DRM_EXPIRED;
-                       }
-                       else if ( strstr(error->message, "no rights") )
-                       {
-                               return MM_ERROR_PLAYER_DRM_NO_LICENSE;
-                       }
-                       else if ( strstr(error->message, "has future rights") )
-                       {
-                               return MM_ERROR_PLAYER_DRM_FUTURE_USE;
-                       }
-                       else if ( strstr(error->message, "opl violation") )
-                       {
-                               return MM_ERROR_PLAYER_DRM_OUTPUT_PROTECTION;
-                       }
-                       return MM_ERROR_PLAYER_DRM_NOT_AUTHORIZED;
-               }
+       case GST_STREAM_ERROR_DECRYPT:
+       case GST_STREAM_ERROR_DECRYPT_NOKEY:
+       {
+               LOGE("decryption error, [%s] failed, reason : [%s]\n", src_element_name, error->message);
+
+               if (strstr(error->message, "rights expired"))
+                       return MM_ERROR_PLAYER_DRM_EXPIRED;
+               else if (strstr(error->message, "no rights"))
+                       return MM_ERROR_PLAYER_DRM_NO_LICENSE;
+               else if (strstr(error->message, "has future rights"))
+                       return MM_ERROR_PLAYER_DRM_FUTURE_USE;
+               else if (strstr(error->message, "opl violation"))
+                       return MM_ERROR_PLAYER_DRM_OUTPUT_PROTECTION;
+               return MM_ERROR_PLAYER_DRM_NOT_AUTHORIZED;
+       }
                break;
 
-               default:
+       default:
                break;
        }
 
@@ -1012,12 +920,11 @@ CODEC_NOT_FOUND:
 int
 __mmplayer_get_video_angle(mm_player_t* player, int *user_angle, int *org_angle)
 {
-       int user_angle_type= 0;
+       int user_angle_type = 0;
        gchar *org_orient = NULL;
        MMHandleType attrs = MMPLAYER_GET_ATTRS(player);
 
-       if ( !attrs )
-       {
+       if (!attrs) {
                LOGE("cannot get content attribute");
                return MM_ERROR_PLAYER_INTERNAL;
        }
@@ -1026,40 +933,35 @@ __mmplayer_get_video_angle(mm_player_t* player, int *user_angle, int *org_angle)
        mm_attrs_get_int_by_name(attrs, "display_rotation", &user_angle_type);
 
        /* get angle with user type */
-       switch(user_angle_type)
-       {
-               case MM_DISPLAY_ROTATION_NONE:
-                       *user_angle = 0;
-                       break;
-               case MM_DISPLAY_ROTATION_90: // counter-clockwise 90
-                       *user_angle = 270;
-                       break;
-               case MM_DISPLAY_ROTATION_180:
-                       *user_angle = 180;
-                       break;
-               case MM_DISPLAY_ROTATION_270: // clockwise 90
-                       *user_angle = 90;
-                       break;
+       switch (user_angle_type) {
+       case MM_DISPLAY_ROTATION_NONE:
+               *user_angle = 0;
+               break;
+       case MM_DISPLAY_ROTATION_90: /* counter-clockwise 90 */
+               *user_angle = 270;
+               break;
+       case MM_DISPLAY_ROTATION_180:
+               *user_angle = 180;
+               break;
+       case MM_DISPLAY_ROTATION_270: /* clockwise 90 */
+               *user_angle = 90;
+               break;
        }
 
        /* get original orientation */
        mm_attrs_get_string_by_name(attrs, "content_video_orientation", &org_orient);
 
-       if (org_orient)
-       {
-               if (!strcmp (org_orient, "rotate-90"))
+       if (org_orient) {
+               if (!strcmp(org_orient, "rotate-90"))
                        *org_angle = 90;
-               else if (!strcmp (org_orient, "rotate-180"))
+               else if (!strcmp(org_orient, "rotate-180"))
                        *org_angle = 180;
-               else if (!strcmp (org_orient, "rotate-270"))
+               else if (!strcmp(org_orient, "rotate-270"))
                        *org_angle = 270;
                else
-                       LOGD ("original rotation is %s", org_orient);
-       }
-       else
-       {
-               LOGD ("content_video_orientation get fail");
-       }
+                       LOGD("original rotation is %s", org_orient);
+       } else
+               LOGD("content_video_orientation get fail");
 
        LOGD("check user angle: %d, orientation: %d", *user_angle, *org_angle);
 
index 7545df5..5033f13 100644 (file)
@@ -1,12 +1,12 @@
 /*
  * libmm-player
  *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright(c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Contact: JongHyuk Choi <jhchoi.choi@samsung.com>, heechul jeon <heechul.jeon@samsung.co>,
  * YoungHwan An <younghwan_.an@samsung.com>, Eunhae Choi <eunhae1.choi@samsung.com>
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0(the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
 /*---------------------------------------------------------------------------
 |    LOCAL FUNCTION PROTOTYPES:                                                                                                |
 ---------------------------------------------------------------------------*/
-static int __parse_media_format (MMPlayerVideoStreamInfo * video, MMPlayerAudioStreamInfo * audio, media_format_h format);
-static int __convert_media_format_video_mime_to_str (MMPlayerVideoStreamInfo * video, media_format_mimetype_e mime);
-static int __convert_media_format_audio_mime_to_str (MMPlayerAudioStreamInfo * audio, media_format_mimetype_e mime);
+static int __parse_media_format(MMPlayerVideoStreamInfo * video, MMPlayerAudioStreamInfo * audio, media_format_h format);
+static int __convert_media_format_video_mime_to_str(MMPlayerVideoStreamInfo * video, media_format_mimetype_e mime);
+static int __convert_media_format_audio_mime_to_str(MMPlayerAudioStreamInfo * audio, media_format_mimetype_e mime);
 
 /*===========================================================================================
 |                                                                                                                                                                                      |
 |  FUNCTION DEFINITIONS                                                                                                                                                |
-|                                                                                                                                                                                      |
+|                                                                                                                                                                                      |
 ========================================================================================== */
 
 static int
-__convert_media_format_video_mime_to_str (MMPlayerVideoStreamInfo * video,
-    media_format_mimetype_e mime)
+__convert_media_format_video_mime_to_str(MMPlayerVideoStreamInfo * video,
+       media_format_mimetype_e mime)
 {
-  MMPLAYER_RETURN_VAL_IF_FAIL (video, MM_ERROR_INVALID_ARGUMENT);
-
-  switch (mime) {
-    case MEDIA_FORMAT_MPEG4_SP:
-      video->mime = g_strdup ("video/mpeg");
-      video->version = 4;
-      break;
-    case MEDIA_FORMAT_H264_SP:
+       MMPLAYER_RETURN_VAL_IF_FAIL(video, MM_ERROR_INVALID_ARGUMENT);
+
+       switch (mime) {
+       case MEDIA_FORMAT_MPEG4_SP:
+               video->mime = g_strdup("video/mpeg");
+               video->version = 4;
+               break;
+       case MEDIA_FORMAT_H264_SP:
        case MEDIA_FORMAT_H264_MP:
        case MEDIA_FORMAT_H264_HP:
-      video->mime = g_strdup ("video/x-h264");
-      break;
-    default:
-      video->mime = g_strdup ("unknown");
-      break;
-  }
-
-  return MM_ERROR_NONE;
+               video->mime = g_strdup("video/x-h264");
+               break;
+       default:
+               video->mime = g_strdup("unknown");
+               break;
+       }
+
+       return MM_ERROR_NONE;
 }
 
 static int
-__convert_media_format_audio_mime_to_str (MMPlayerAudioStreamInfo * audio,
-    media_format_mimetype_e mime)
+__convert_media_format_audio_mime_to_str(MMPlayerAudioStreamInfo * audio,
+       media_format_mimetype_e mime)
 {
-  MMPLAYER_RETURN_VAL_IF_FAIL (audio, MM_ERROR_INVALID_ARGUMENT);
-
-  switch (mime) {
-    case MEDIA_FORMAT_AAC:
-      audio->mime = g_strdup ("audio/mpeg");
-      audio->version = 2;
-      break;
-    default:
-      audio->mime = g_strdup ("unknown");
-      break;
-  }
-
-  return MM_ERROR_NONE;
+       MMPLAYER_RETURN_VAL_IF_FAIL(audio, MM_ERROR_INVALID_ARGUMENT);
+
+       switch (mime) {
+       case MEDIA_FORMAT_AAC:
+               audio->mime = g_strdup("audio/mpeg");
+               audio->version = 2;
+               break;
+       default:
+               audio->mime = g_strdup("unknown");
+               break;
+       }
+
+       return MM_ERROR_NONE;
 }
 
 static int
-__parse_media_format (MMPlayerVideoStreamInfo * video,
-    MMPlayerAudioStreamInfo * audio, media_format_h format)
+__parse_media_format(MMPlayerVideoStreamInfo * video,
+       MMPlayerAudioStreamInfo * audio, media_format_h format)
 {
-  if (audio) {
-    media_format_mimetype_e mime;
-    int channel;
-    int samplerate;
-    int avg_bps;
-
-    if (media_format_get_audio_info (format, &mime, &channel, &samplerate, NULL,
-            &avg_bps) != MEDIA_FORMAT_ERROR_NONE) {
-      LOGE ("media_format_get_audio_info failed");
-         return MM_ERROR_PLAYER_INTERNAL;
-    }
-
-    __convert_media_format_audio_mime_to_str (audio, mime);
-    audio->sample_rate = samplerate;
-    audio->channels = channel;
-//video->user_info = ;
-  }
-
-  if (video) {
+       if (audio) {
+               media_format_mimetype_e mime;
+               int channel;
+               int samplerate;
+               int avg_bps;
+
+               if (media_format_get_audio_info(format, &mime, &channel, &samplerate, NULL,
+                       &avg_bps) != MEDIA_FORMAT_ERROR_NONE) {
+                       LOGE("media_format_get_audio_info failed");
+                       return MM_ERROR_PLAYER_INTERNAL;
+               }
+
+               __convert_media_format_audio_mime_to_str(audio, mime);
+               audio->sample_rate = samplerate;
+               audio->channels = channel;
+               //video->user_info = ;
+       }
+
+       if (video) {
 #define DEFAULT_FRAMERATE_NUM 30
 #define DEFAULT_FRAMERATE_DEN 1
-    media_format_mimetype_e mime;
-    int width = 0;
-    int height = 0;
-    int avg_bps = 0;
-    int frame_rate = 0;
-
-    if (media_format_get_video_info (format, &mime, &width, &height, &avg_bps,
-            NULL) != MEDIA_FORMAT_ERROR_NONE) {
-      LOGE ("media_format_get_video_info failed");
-         return MM_ERROR_PLAYER_INTERNAL;
-    }
-
-    if (media_format_get_video_frame_rate(format, &frame_rate)) {
-        LOGW ("failed to get video frame rate, will be set 30.");
-    }
-    LOGD ("frame_rate %d", frame_rate);
-
-    __convert_media_format_video_mime_to_str (video, mime);
-
-    video->width = width;
-    video->height = height;
-    video->framerate_num = (frame_rate>0)?(frame_rate):(DEFAULT_FRAMERATE_NUM);
-    video->framerate_den = DEFAULT_FRAMERATE_DEN;
-  }
-
-  return MM_ERROR_NONE;
+               media_format_mimetype_e mime;
+               int width = 0;
+               int height = 0;
+               int avg_bps = 0;
+               int frame_rate = 0;
+
+               if (media_format_get_video_info(format, &mime, &width, &height, &avg_bps,
+                       NULL) != MEDIA_FORMAT_ERROR_NONE) {
+                       LOGE("media_format_get_video_info failed");
+                       return MM_ERROR_PLAYER_INTERNAL;
+               }
+
+               if (media_format_get_video_frame_rate(format, &frame_rate))
+                       LOGW("failed to get video frame rate, will be set 30.");
+
+               LOGD("frame_rate %d", frame_rate);
+
+               __convert_media_format_video_mime_to_str(video, mime);
+
+               video->width = width;
+               video->height = height;
+               video->framerate_num = (frame_rate > 0) ? (frame_rate) : (DEFAULT_FRAMERATE_NUM);
+               video->framerate_den = DEFAULT_FRAMERATE_DEN;
+       }
+
+       return MM_ERROR_NONE;
 }
 
 static gboolean
 __mmplayer_update_video_info(MMHandleType hplayer, media_format_h fmt)
 {
-  mm_player_t *player = (mm_player_t *) hplayer;
-  gboolean ret = FALSE;
-  GstStructure *str = NULL;
-  media_format_mimetype_e mimetype = 0;
-  gint cur_width = 0, width = 0;
-  gint cur_height = 0, height = 0;
-
-  MMPLAYER_FENTER ();
-
-  MMPLAYER_RETURN_VAL_IF_FAIL (player, FALSE);
-  MMPLAYER_RETURN_VAL_IF_FAIL (fmt, FALSE);
-
-  if (player->v_stream_caps)
-  {
-    str = gst_caps_get_structure (player->v_stream_caps, 0);
-    if ( !gst_structure_get_int (str, "width", &cur_width))
-    {
-      LOGD ("missing 'width' field in video caps");
-    }
-
-    if ( !gst_structure_get_int (str, "height", &cur_height))
-    {
-      LOGD ("missing 'height' field in video caps");
-    }
-
-    media_format_get_video_info(fmt, &mimetype, &width, &height, NULL, NULL);
-    if ((cur_width != width) || (cur_height != height))
-    {
-      LOGW ("resolution is changed %dx%d -> %dx%d",
-                          cur_width, cur_height, width, height);
-      _mmplayer_set_video_info(hplayer, fmt);
-      ret = TRUE;
-    }
-  }
-
-  MMPLAYER_FLEAVE ();
-  return ret;
+       mm_player_t *player = (mm_player_t *) hplayer;
+       gboolean ret = FALSE;
+       GstStructure *str = NULL;
+       media_format_mimetype_e mimetype = 0;
+       gint cur_width = 0, width = 0;
+       gint cur_height = 0, height = 0;
+
+       MMPLAYER_FENTER();
+
+       MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
+       MMPLAYER_RETURN_VAL_IF_FAIL(fmt, FALSE);
+
+       if (player->v_stream_caps) {
+               str = gst_caps_get_structure(player->v_stream_caps, 0);
+               if (!gst_structure_get_int(str, "width", &cur_width))
+                       LOGD("missing 'width' field in video caps");
+
+               if (!gst_structure_get_int(str, "height", &cur_height))
+                       LOGD("missing 'height' field in video caps");
+
+               media_format_get_video_info(fmt, &mimetype, &width, &height, NULL, NULL);
+               if ((cur_width != width) || (cur_height != height)) {
+                       LOGW("resolution is changed %dx%d -> %dx%d",
+                               cur_width, cur_height, width, height);
+                       _mmplayer_set_video_info(hplayer, fmt);
+                       ret = TRUE;
+               }
+       }
+
+       MMPLAYER_FLEAVE();
+       return ret;
 }
 
 
 int
 _mmplayer_set_media_stream_buffer_status_cb(MMHandleType hplayer,
-                                            MMPlayerStreamType type,
-                                            mm_player_media_stream_buffer_status_callback callback,
-                                            void *user_param)
+                                                                                       MMPlayerStreamType type,
+                                                                                       mm_player_media_stream_buffer_status_callback callback,
+                                                                                       void *user_param)
 {
        mm_player_t *player = (mm_player_t *) hplayer;
 
-       MMPLAYER_FENTER ();
+       MMPLAYER_FENTER();
 
-       MMPLAYER_RETURN_VAL_IF_FAIL (player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+       MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
 
        if ((type < MM_PLAYER_STREAM_TYPE_DEFAULT) || (type > MM_PLAYER_STREAM_TYPE_TEXT))
                return MM_ERROR_INVALID_ARGUMENT;
 
-       if (player->media_stream_buffer_status_cb[type])
-       {
+       if (player->media_stream_buffer_status_cb[type]) {
                if (!callback)
-               {
-                       LOGD ("[type:%d] will be clear.\n", type);
-               }
+                       LOGD("[type:%d] will be clear.\n", type);
                else
-               {
-                       LOGD ("[type:%d] will be overwritten.\n", type);
-               }
+                       LOGD("[type:%d] will be overwritten.\n", type);
        }
 
        player->media_stream_buffer_status_cb[type] = callback;
        player->buffer_cb_user_param = user_param;
 
-       LOGD ("player handle %p, type %d, callback %p\n", player, type,
+       LOGD("player handle %p, type %d, callback %p\n", player, type,
                player->media_stream_buffer_status_cb[type]);
 
-       MMPLAYER_FLEAVE ();
+       MMPLAYER_FLEAVE();
 
        return MM_ERROR_NONE;
 }
 
 int
 _mmplayer_set_media_stream_seek_data_cb(MMHandleType hplayer,
-                                        MMPlayerStreamType type,
-                                        mm_player_media_stream_seek_data_callback callback,
-                                        void *user_param)
+                                                                               MMPlayerStreamType type,
+                                                                               mm_player_media_stream_seek_data_callback callback,
+                                                                               void *user_param)
 {
        mm_player_t *player = (mm_player_t *) hplayer;
 
-       MMPLAYER_FENTER ();
+       MMPLAYER_FENTER();
 
-       MMPLAYER_RETURN_VAL_IF_FAIL (player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+       MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
 
        if ((type < MM_PLAYER_STREAM_TYPE_DEFAULT) || (type > MM_PLAYER_STREAM_TYPE_TEXT))
                return MM_ERROR_INVALID_ARGUMENT;
 
-       if (player->media_stream_seek_data_cb[type])
-       {
+       if (player->media_stream_seek_data_cb[type]) {
                if (!callback)
-               {
-                       LOGD ("[type:%d] will be clear.\n", type);
-               }
+                       LOGD("[type:%d] will be clear.\n", type);
                else
-               {
-                       LOGD ("[type:%d] will be overwritten.\n", type);
-               }
+                       LOGD("[type:%d] will be overwritten.\n", type);
        }
 
        player->media_stream_seek_data_cb[type] = callback;
        player->buffer_cb_user_param = user_param;
 
-       LOGD ("player handle %p, type %d, callback %p\n", player, type,
+       LOGD("player handle %p, type %d, callback %p\n", player, type,
                player->media_stream_seek_data_cb[type]);
 
-       MMPLAYER_FLEAVE ();
+       MMPLAYER_FLEAVE();
 
        return MM_ERROR_NONE;
 }
 
 static GstElement*
-__mmplayer_get_source_element (mm_player_t *player, MMPlayerStreamType type)
+__mmplayer_get_source_element(mm_player_t *player, MMPlayerStreamType type)
 {
        enum MainElementID elemId = MMPLAYER_M_NUM;
 
        if (player && player->pipeline && player->pipeline->mainbin) {
-
                /* get elem according to the stream type */
                if (type == MM_PLAYER_STREAM_TYPE_AUDIO) {
-                       if (player->pipeline->mainbin[MMPLAYER_M_2ND_SRC].gst) {
+                       if (player->pipeline->mainbin[MMPLAYER_M_2ND_SRC].gst)
                                elemId = MMPLAYER_M_2ND_SRC;
-                       } else if (g_strrstr (GST_ELEMENT_NAME (player->pipeline->mainbin[MMPLAYER_M_SRC].gst), "audio_appsrc")) {
+                       else if (g_strrstr(GST_ELEMENT_NAME(player->pipeline->mainbin[MMPLAYER_M_SRC].gst), "audio_appsrc"))
                                elemId = MMPLAYER_M_SRC;
-                       }
-               }
-               else if (type == MM_PLAYER_STREAM_TYPE_VIDEO) {
+               } else if (type == MM_PLAYER_STREAM_TYPE_VIDEO) {
                        elemId = MMPLAYER_M_SRC;
-               }
-               else if (type == MM_PLAYER_STREAM_TYPE_TEXT) {
+               } else if (type == MM_PLAYER_STREAM_TYPE_TEXT) {
                        elemId = MMPLAYER_M_SUBSRC;
                }
 
@@ -299,26 +279,26 @@ _mmplayer_set_media_stream_max_size(MMHandleType hplayer, MMPlayerStreamType typ
        mm_player_t *player = (mm_player_t *) hplayer;
        GstElement *element = NULL;
 
-       MMPLAYER_FENTER ();
-       MMPLAYER_RETURN_VAL_IF_FAIL (player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+       MMPLAYER_FENTER();
+       MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
 
        if ((type < MM_PLAYER_STREAM_TYPE_AUDIO) ||
                (type > MM_PLAYER_STREAM_TYPE_TEXT) ||
                (max_size == 0)) {
-               LOGE ("Invalid param type:%d, max_size:%d", type, max_size);
+               LOGE("Invalid param type:%d, max_size:%d", type, max_size);
                return MM_ERROR_INVALID_ARGUMENT;
        }
 
-       LOGD ("type %d, max_size %llu\n", type, max_size);
+       LOGD("type %d, max_size %llu\n", type, max_size);
 
        if ((element = __mmplayer_get_source_element(player, type))) {
-               LOGD ("update max_size of %s\n", GST_ELEMENT_NAME(element));
+               LOGD("update max_size of %s\n", GST_ELEMENT_NAME(element));
                g_object_set(G_OBJECT(element), "max-bytes", max_size, NULL);
        }
 
        player->media_stream_buffer_max_size[type] = max_size;
 
-       MMPLAYER_FLEAVE ();
+       MMPLAYER_FLEAVE();
        return MM_ERROR_NONE;
 }
 
@@ -327,17 +307,17 @@ _mmplayer_get_media_stream_max_size(MMHandleType hplayer, MMPlayerStreamType typ
 {
        mm_player_t *player = (mm_player_t *) hplayer;
 
-       MMPLAYER_FENTER ();
+       MMPLAYER_FENTER();
 
-       MMPLAYER_RETURN_VAL_IF_FAIL (player, MM_ERROR_PLAYER_NOT_INITIALIZED);
-       MMPLAYER_RETURN_VAL_IF_FAIL (max_size, MM_ERROR_INVALID_ARGUMENT);
+       MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+       MMPLAYER_RETURN_VAL_IF_FAIL(max_size, MM_ERROR_INVALID_ARGUMENT);
 
        if ((type < MM_PLAYER_STREAM_TYPE_DEFAULT) || (type > MM_PLAYER_STREAM_TYPE_TEXT))
                return MM_ERROR_INVALID_ARGUMENT;
 
        *max_size = player->media_stream_buffer_max_size[type];
 
-       MMPLAYER_FLEAVE ();
+       MMPLAYER_FLEAVE();
 
        return MM_ERROR_NONE;
 }
@@ -348,25 +328,25 @@ _mmplayer_set_media_stream_min_percent(MMHandleType hplayer, MMPlayerStreamType
        mm_player_t *player = (mm_player_t *) hplayer;
        GstElement *element = NULL;
 
-       MMPLAYER_FENTER ();
+       MMPLAYER_FENTER();
 
-       MMPLAYER_RETURN_VAL_IF_FAIL (player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+       MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
 
        if ((type < MM_PLAYER_STREAM_TYPE_AUDIO) || (type > MM_PLAYER_STREAM_TYPE_TEXT)) {
-               LOGE ("Invalid param type:%d", type);
+               LOGE("Invalid param type:%d", type);
                return MM_ERROR_INVALID_ARGUMENT;
        }
 
-       LOGD ("type %d, min_per %u\n", type, min_percent);
+       LOGD("type %d, min_per %u\n", type, min_percent);
 
        if ((element = __mmplayer_get_source_element(player, type))) {
-               LOGD ("update min_per of %s\n", GST_ELEMENT_NAME(element));
+               LOGD("update min_per of %s\n", GST_ELEMENT_NAME(element));
                g_object_set(G_OBJECT(element), "min-percent", min_percent, NULL);
        }
 
        player->media_stream_buffer_min_percent[type] = min_percent;
 
-       MMPLAYER_FLEAVE ();
+       MMPLAYER_FLEAVE();
        return MM_ERROR_NONE;
 }
 
@@ -375,17 +355,17 @@ _mmplayer_get_media_stream_min_percent(MMHandleType hplayer, MMPlayerStreamType
 {
        mm_player_t *player = (mm_player_t *) hplayer;
 
-       MMPLAYER_FENTER ();
+       MMPLAYER_FENTER();
 
-       MMPLAYER_RETURN_VAL_IF_FAIL (player, MM_ERROR_PLAYER_NOT_INITIALIZED);
-       MMPLAYER_RETURN_VAL_IF_FAIL (min_percent, MM_ERROR_INVALID_ARGUMENT);
+       MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+       MMPLAYER_RETURN_VAL_IF_FAIL(min_percent, MM_ERROR_INVALID_ARGUMENT);
 
        if ((type < MM_PLAYER_STREAM_TYPE_DEFAULT) || (type > MM_PLAYER_STREAM_TYPE_TEXT))
                return MM_ERROR_INVALID_ARGUMENT;
 
        *min_percent = player->media_stream_buffer_min_percent[type];
 
-       MMPLAYER_FLEAVE ();
+       MMPLAYER_FLEAVE();
 
        return MM_ERROR_NONE;
 }
@@ -397,35 +377,33 @@ __mmplayer_check_buffer_level(mm_player_t *player, GstElement* element, MMPlayer
        guint64 max_bytes = 0;
        guint current_level_per = 0;
 
-       MMPLAYER_FENTER ();
-       MMPLAYER_RETURN_VAL_IF_FAIL ( player && element, MM_ERROR_PLAYER_NOT_INITIALIZED);
+       MMPLAYER_FENTER();
+       MMPLAYER_RETURN_VAL_IF_FAIL(player && element, MM_ERROR_PLAYER_NOT_INITIALIZED);
 
-       if (player->media_stream_buffer_max_size[type] > 0) {
+       if (player->media_stream_buffer_max_size[type] > 0)
                max_bytes = player->media_stream_buffer_max_size[type];
-       } else {
+       else
                g_object_get(G_OBJECT(element), "max-bytes", &max_bytes, NULL);
-       }
 
        if (max_bytes == 0) {
-               LOGW ("buffer max size is zero.");
+               LOGW("buffer max size is zero.");
                return MM_ERROR_NONE;
        }
 
        g_object_get(G_OBJECT(element), "current-level-bytes", &current_level_bytes, NULL);
 
        if (max_bytes <= current_level_bytes) {
-               LOGE ("no available buffer space. type %d, max %lld, curr %lld", type, max_bytes, current_level_bytes);
+               LOGE("no available buffer space. type %d, max %lld, curr %lld", type, max_bytes, current_level_bytes);
                return MM_ERROR_PLAYER_BUFFER_SPACE;
        }
 
        if (MMPLAYER_CURRENT_STATE(player) != MM_PLAYER_STATE_PLAYING) {
-               if (!player->media_stream_buffer_status_cb[type]) {
+               if (!player->media_stream_buffer_status_cb[type])
                        return MM_ERROR_NONE;
-               }
 
                current_level_per = (guint)(gst_util_guint64_to_gdouble(current_level_bytes)/gst_util_guint64_to_gdouble(max_bytes)*100);
 
-               LOGD ("type %d, min_per %u, curr_per %u max %lld cur %lld\n",
+               LOGD("type %d, min_per %u, curr_per %u max %lld cur %lld\n",
                                        type, player->media_stream_buffer_min_percent[type],
                                        current_level_per,
                                        player->media_stream_buffer_max_size[type],
@@ -435,420 +413,414 @@ __mmplayer_check_buffer_level(mm_player_t *player, GstElement* element, MMPlayer
                        player->media_stream_buffer_status_cb[type](type, MM_PLAYER_MEDIA_STREAM_BUFFER_UNDERRUN, current_level_bytes, player->buffer_cb_user_param);
        }
 
-       MMPLAYER_FLEAVE ();
+       MMPLAYER_FLEAVE();
        return MM_ERROR_NONE;
 }
 
 int
-_mmplayer_submit_packet (MMHandleType hplayer, media_packet_h packet)
+_mmplayer_submit_packet(MMHandleType hplayer, media_packet_h packet)
 {
-  int ret = MM_ERROR_NONE;
-  GstBuffer *_buffer = NULL;
-  mm_player_t *player = (mm_player_t *) hplayer;
-  guint8 *buf = NULL;
-  uint64_t size = 0;
-  GstElement* element = NULL;
-  MMPlayerStreamType streamtype = MM_PLAYER_STREAM_TYPE_AUDIO;
-  media_format_h fmt = NULL;
-  bool flag = FALSE;
-  bool is_eos = FALSE;
-
-  MMPLAYER_RETURN_VAL_IF_FAIL (packet, MM_ERROR_INVALID_ARGUMENT);
-  MMPLAYER_RETURN_VAL_IF_FAIL ( player &&
-    player->pipeline &&
-    player->pipeline->mainbin &&
-    player->pipeline->mainbin[MMPLAYER_M_SRC].gst,
-    MM_ERROR_PLAYER_INTERNAL );
-
-  /* get stream type if audio or video */
-  media_packet_is_audio (packet, &flag);
-  if (flag) {
-    streamtype = MM_PLAYER_STREAM_TYPE_AUDIO;
-  } else {
-    media_packet_is_video (packet, &flag);
-    if (flag)
-      streamtype = MM_PLAYER_STREAM_TYPE_VIDEO;
-       else
-      streamtype = MM_PLAYER_STREAM_TYPE_TEXT;
-  }
-
-  element = __mmplayer_get_source_element(player, streamtype);
-  if (!element) {
-      LOGE ("there is no source element of type %d", streamtype);
-      ret = MM_ERROR_PLAYER_INTERNAL;
-      goto ERROR;
-  }
-
-  /* check buffer level */
-  ret = __mmplayer_check_buffer_level (player, element, streamtype);
-  if (ret != MM_ERROR_NONE)
-    return ret;
-
-  /* get data */
-  if (media_packet_get_buffer_data_ptr (packet, (void **) &buf) != MEDIA_PACKET_ERROR_NONE) {
-    LOGE("failed to get buffer data ptr");
-    ret = MM_ERROR_PLAYER_INTERNAL;
-    goto ERROR;
-  }
-
-  if (media_packet_get_buffer_size (packet, &size) != MEDIA_PACKET_ERROR_NONE) {
-    LOGE("failed to get buffer size");
-    ret = MM_ERROR_PLAYER_INTERNAL;
-    goto ERROR;
-  }
-
-  if (buf != NULL && size > 0) {
-    GstMapInfo buff_info = GST_MAP_INFO_INIT;
-    uint64_t pts = 0;
-
-    /* get size */
-    _buffer = gst_buffer_new_and_alloc (size);
-
-    if (!_buffer) {
-        LOGE("failed to allocate memory for push buffer\n");
-        ret = MM_ERROR_PLAYER_NO_FREE_SPACE;
-        goto ERROR;
-    }
-
-    if (gst_buffer_map (_buffer, &buff_info, GST_MAP_READWRITE)) {
-
-      memcpy (buff_info.data, buf, size);
-      buff_info.size = size;
-
-      gst_buffer_unmap (_buffer, &buff_info);
-    }
-
-    if (streamtype == MM_PLAYER_STREAM_TYPE_VIDEO) {
-      /* get format to check video format */
-      media_packet_get_format (packet, &fmt);
-      if (fmt) {
-        if (__mmplayer_update_video_info(hplayer, fmt)) {
-          LOGD("update video caps");
-          g_object_set(G_OBJECT(player->pipeline->mainbin[MMPLAYER_M_SRC].gst),
-                                    "caps", player->v_stream_caps, NULL);
-        }
-               media_format_unref(fmt);
-      }
-    }
-
-    /* get pts */
-    if (media_packet_get_pts (packet, &pts) != MEDIA_PACKET_ERROR_NONE) {
-      LOGE("failed to get pts info");
-      ret = MM_ERROR_PLAYER_INTERNAL;
-      goto ERROR;
-    }
-    GST_BUFFER_PTS (_buffer) = (GstClockTime)pts;
-       gst_app_src_push_buffer (GST_APP_SRC (element), _buffer);
-  }
-
-  /* check eos */
-  if (media_packet_is_end_of_stream(packet, &is_eos) != MEDIA_PACKET_ERROR_NONE) {
-    LOGE("failed to get eos info");
-    ret = MM_ERROR_PLAYER_INTERNAL;
-    goto ERROR;
-  }
-
-  if (is_eos) {
-    LOGW ("we got eos of stream type(%d)", streamtype);
-       g_signal_emit_by_name (element, "end-of-stream", &ret);
-  }
+       int ret = MM_ERROR_NONE;
+       GstBuffer *_buffer = NULL;
+       mm_player_t *player = (mm_player_t *) hplayer;
+       guint8 *buf = NULL;
+       uint64_t size = 0;
+       GstElement* element = NULL;
+       MMPlayerStreamType streamtype = MM_PLAYER_STREAM_TYPE_AUDIO;
+       media_format_h fmt = NULL;
+       bool flag = FALSE;
+       bool is_eos = FALSE;
+
+       MMPLAYER_RETURN_VAL_IF_FAIL(packet, MM_ERROR_INVALID_ARGUMENT);
+       MMPLAYER_RETURN_VAL_IF_FAIL(player &&
+       player->pipeline &&
+       player->pipeline->mainbin &&
+       player->pipeline->mainbin[MMPLAYER_M_SRC].gst,
+       MM_ERROR_PLAYER_INTERNAL);
+
+       /* get stream type if audio or video */
+       media_packet_is_audio(packet, &flag);
+       if (flag) {
+               streamtype = MM_PLAYER_STREAM_TYPE_AUDIO;
+       } else {
+               media_packet_is_video(packet, &flag);
+               if (flag)
+                       streamtype = MM_PLAYER_STREAM_TYPE_VIDEO;
+               else
+                       streamtype = MM_PLAYER_STREAM_TYPE_TEXT;
+       }
+
+       element = __mmplayer_get_source_element(player, streamtype);
+       if (!element) {
+               LOGE("there is no source element of type %d", streamtype);
+               ret = MM_ERROR_PLAYER_INTERNAL;
+               goto ERROR;
+       }
+
+       /* check buffer level */
+       ret = __mmplayer_check_buffer_level(player, element, streamtype);
+       if (ret != MM_ERROR_NONE)
+               return ret;
+
+       /* get data */
+       if (media_packet_get_buffer_data_ptr(packet, (void **) &buf) != MEDIA_PACKET_ERROR_NONE) {
+               LOGE("failed to get buffer data ptr");
+               ret = MM_ERROR_PLAYER_INTERNAL;
+               goto ERROR;
+       }
+
+       if (media_packet_get_buffer_size(packet, &size) != MEDIA_PACKET_ERROR_NONE) {
+               LOGE("failed to get buffer size");
+               ret = MM_ERROR_PLAYER_INTERNAL;
+               goto ERROR;
+       }
+
+       if (buf != NULL && size > 0) {
+               GstMapInfo buff_info = GST_MAP_INFO_INIT;
+               uint64_t pts = 0;
+
+               /* get size */
+               _buffer = gst_buffer_new_and_alloc(size);
+
+               if (!_buffer) {
+                       LOGE("failed to allocate memory for push buffer\n");
+                       ret = MM_ERROR_PLAYER_NO_FREE_SPACE;
+                       goto ERROR;
+               }
+
+               if (gst_buffer_map(_buffer, &buff_info, GST_MAP_READWRITE)) {
+                       memcpy(buff_info.data, buf, size);
+                       buff_info.size = size;
+
+                       gst_buffer_unmap(_buffer, &buff_info);
+               }
+
+               if (streamtype == MM_PLAYER_STREAM_TYPE_VIDEO) {
+                       /* get format to check video format */
+                       media_packet_get_format(packet, &fmt);
+                       if (fmt) {
+                               if (__mmplayer_update_video_info(hplayer, fmt)) {
+                                       LOGD("update video caps");
+                                       g_object_set(G_OBJECT(player->pipeline->mainbin[MMPLAYER_M_SRC].gst),
+                                               "caps", player->v_stream_caps, NULL);
+                               }
+                               media_format_unref(fmt);
+                       }
+               }
+
+               /* get pts */
+               if (media_packet_get_pts(packet, &pts) != MEDIA_PACKET_ERROR_NONE) {
+               LOGE("failed to get pts info");
+               ret = MM_ERROR_PLAYER_INTERNAL;
+               goto ERROR;
+               }
+               GST_BUFFER_PTS(_buffer) = (GstClockTime)pts;
+               gst_app_src_push_buffer(GST_APP_SRC(element), _buffer);
+       }
+
+       /* check eos */
+       if (media_packet_is_end_of_stream(packet, &is_eos) != MEDIA_PACKET_ERROR_NONE) {
+               LOGE("failed to get eos info");
+               ret = MM_ERROR_PLAYER_INTERNAL;
+               goto ERROR;
+       }
+
+       if (is_eos) {
+               LOGW("we got eos of stream type(%d)", streamtype);
+               g_signal_emit_by_name(element, "end-of-stream", &ret);
+       }
 
 ERROR:
-  return ret;
+       return ret;
 }
 
 static int
-__mmplayer_video_caps_new (MMHandleType hplayer, MMPlayerVideoStreamInfo * video,
-    const char *fieldname, ...)
+__mmplayer_video_caps_new(MMHandleType hplayer, MMPlayerVideoStreamInfo * video,
+       const char *fieldname, ...)
 {
-  int cap_size;
-  GstCaps *caps = NULL;
-  GstStructure *structure = NULL;
-  va_list var_args;
-  mm_player_t *player = MM_PLAYER_CAST (hplayer);
-
-  MMPLAYER_FENTER ();
-  MMPLAYER_RETURN_VAL_IF_FAIL (player, MM_ERROR_PLAYER_NOT_INITIALIZED);
-  MMPLAYER_RETURN_VAL_IF_FAIL (video, MM_ERROR_PLAYER_NOT_INITIALIZED);
-
-  LOGD ("width=%d height=%d framerate num=%d, den=%d",
-    video->width, video->height, video->framerate_num, video->framerate_den);
-
-  caps = gst_caps_new_simple (video->mime,
-      "width", G_TYPE_INT, video->width,
-      "height", G_TYPE_INT, video->height,
-      "framerate", GST_TYPE_FRACTION, video->framerate_num, video->framerate_den, NULL);
-
-  for (cap_size = 0; cap_size < gst_caps_get_size (caps); cap_size++) {
-    va_start (var_args, fieldname);
-    structure = gst_caps_get_structure (caps, cap_size);
-    gst_structure_set_valist (structure, fieldname, var_args);
-    va_end (var_args);
-  }
-
-  if (video->extradata_size) {
-    GstBuffer *buf = NULL;
-    GstMapInfo buff_info = GST_MAP_INFO_INIT;
-
-    buf = gst_buffer_new_and_alloc (video->extradata_size);
-
-    if (gst_buffer_map (buf, &buff_info, GST_MAP_READ)) {
-      memcpy (buff_info.data, video->codec_extradata, video->extradata_size);
-      buff_info.size = video->extradata_size;
-      gst_buffer_unmap (buf, &buff_info);
-    }
-
-    gst_caps_set_simple (caps, "codec_data", GST_TYPE_BUFFER, buf, NULL);
-    gst_buffer_unref (buf);
-  }
-
-  if (player->v_stream_caps)
-  {
-    LOGW ("caps will be updated ");
-
-    gst_caps_unref(player->v_stream_caps);
-    player->v_stream_caps = NULL;
-  }
-
-  player->v_stream_caps = gst_caps_copy (caps);
-  MMPLAYER_LOG_GST_CAPS_TYPE (player->v_stream_caps);
-  gst_caps_unref (caps);
-
-  MMPLAYER_FLEAVE ();
-
-  return MM_ERROR_NONE;
+       int cap_size;
+       GstCaps *caps = NULL;
+       GstStructure *structure = NULL;
+       va_list var_args;
+       mm_player_t *player = MM_PLAYER_CAST(hplayer);
+
+       MMPLAYER_FENTER();
+       MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+       MMPLAYER_RETURN_VAL_IF_FAIL(video, MM_ERROR_PLAYER_NOT_INITIALIZED);
+
+       LOGD("width=%d height=%d framerate num=%d, den=%d",
+       video->width, video->height, video->framerate_num, video->framerate_den);
+
+       caps = gst_caps_new_simple(video->mime,
+               "width", G_TYPE_INT, video->width,
+               "height", G_TYPE_INT, video->height,
+               "framerate", GST_TYPE_FRACTION, video->framerate_num, video->framerate_den, NULL);
+
+       for (cap_size = 0; cap_size < gst_caps_get_size(caps); cap_size++) {
+               va_start(var_args, fieldname);
+               structure = gst_caps_get_structure(caps, cap_size);
+               gst_structure_set_valist(structure, fieldname, var_args);
+               va_end(var_args);
+       }
+
+       if (video->extradata_size) {
+               GstBuffer *buf = NULL;
+               GstMapInfo buff_info = GST_MAP_INFO_INIT;
+
+               buf = gst_buffer_new_and_alloc(video->extradata_size);
+
+               if (gst_buffer_map(buf, &buff_info, GST_MAP_READ)) {
+                       memcpy(buff_info.data, video->codec_extradata, video->extradata_size);
+                       buff_info.size = video->extradata_size;
+                       gst_buffer_unmap(buf, &buff_info);
+               }
+
+               gst_caps_set_simple(caps, "codec_data", GST_TYPE_BUFFER, buf, NULL);
+               gst_buffer_unref(buf);
+       }
+
+       if (player->v_stream_caps) {
+               LOGW("caps will be updated ");
+
+               gst_caps_unref(player->v_stream_caps);
+               player->v_stream_caps = NULL;
+       }
+
+       player->v_stream_caps = gst_caps_copy(caps);
+       MMPLAYER_LOG_GST_CAPS_TYPE(player->v_stream_caps);
+       gst_caps_unref(caps);
+
+       MMPLAYER_FLEAVE();
+
+       return MM_ERROR_NONE;
 }
 
 static void
 __mmplayer_set_uri_type(mm_player_t *player)
 {
-       MMPLAYER_FENTER ();
+       MMPLAYER_FENTER();
 
        player->profile.uri_type = MM_PLAYER_URI_TYPE_MS_BUFF;
        player->es_player_push_mode = TRUE;
 
-       MMPLAYER_FLEAVE ();
+       MMPLAYER_FLEAVE();
        return;
 }
 
 int
-_mmplayer_set_video_info (MMHandleType hplayer, media_format_h format)
+_mmplayer_set_video_info(MMHandleType hplayer, media_format_h format)
 {
-  mm_player_t *player = MM_PLAYER_CAST (hplayer);
-  MMPlayerVideoStreamInfo video = { 0, };
-  int ret = MM_ERROR_NONE;
-  gboolean drc = FALSE;
-
-  MMPLAYER_FENTER ();
-
-  MMPLAYER_RETURN_VAL_IF_FAIL (player, MM_ERROR_PLAYER_NOT_INITIALIZED);
-
-  __mmplayer_set_uri_type(player);
-
-  ret = __parse_media_format (&video, NULL, format);
-  if(ret != MM_ERROR_NONE)
-    return ret;
-
-  mm_attrs_get_int_by_name(player->attrs, MM_PLAYER_DRC_MODE, &drc);
-
-  if (strstr (video.mime, "video/mpeg")) {
-    __mmplayer_video_caps_new (hplayer, &video,
-        "mpegversion", G_TYPE_INT, video.version,
-        "systemstream", G_TYPE_BOOLEAN, FALSE,
-        "adaptive-streaming", G_TYPE_BOOLEAN, drc, NULL);
-  } else if (strstr (video.mime, "video/x-h264")) {
-    //if (info.colordepth)
-    {
-      //      __mmplayer_video_caps_new(hplayer, &info,
-      //              "colordepth", G_TYPE_INT, info.colordepth, NULL);
-    }
-    //else
-    {
-      __mmplayer_video_caps_new (hplayer, &video,
-          "stream-format", G_TYPE_STRING, "byte-stream",
-          "alignment", G_TYPE_STRING, "au",
-          "adaptive-streaming", G_TYPE_BOOLEAN, drc, NULL);
-    }
-  }
+       mm_player_t *player = MM_PLAYER_CAST(hplayer);
+       MMPlayerVideoStreamInfo video = { 0, };
+       int ret = MM_ERROR_NONE;
+       gboolean drc = FALSE;
+
+       MMPLAYER_FENTER();
+
+       MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+
+       __mmplayer_set_uri_type(player);
+
+       ret = __parse_media_format(&video, NULL, format);
+       if (ret != MM_ERROR_NONE)
+               return ret;
+
+       mm_attrs_get_int_by_name(player->attrs, MM_PLAYER_DRC_MODE, &drc);
+
+       if (strstr(video.mime, "video/mpeg")) {
+               __mmplayer_video_caps_new(hplayer, &video,
+               "mpegversion", G_TYPE_INT, video.version,
+               "systemstream", G_TYPE_BOOLEAN, FALSE,
+               "adaptive-streaming", G_TYPE_BOOLEAN, drc, NULL);
+       } else if (strstr(video.mime, "video/x-h264")) {
+               /*
+               if (info.colordepth) {
+                       __mmplayer_video_caps_new(hplayer, &info,
+                               "colordepth", G_TYPE_INT, info.colordepth, NULL);
+               } else
+               */
+               {
+                       __mmplayer_video_caps_new(hplayer, &video,
+                       "stream-format", G_TYPE_STRING, "byte-stream",
+                       "alignment", G_TYPE_STRING, "au",
+                       "adaptive-streaming", G_TYPE_BOOLEAN, drc, NULL);
+               }
+       }
 #if 0
-  else if (strstr (info->mime, "video/x-wmv")) {
-    __mmplayer_video_caps_new (hplayer, &info,
-        "wmvversion", G_TYPE_INT, info.version, NULL);
-  } else if (strstr (info.mime, "video/x-pn-realvideo")) {
-    __mmplayer_video_caps_new (hplayer, &info,
-        "rmversion", G_TYPE_INT, info.version, NULL);
-  } else if (strstr (info.mime, "video/x-msmpeg")) {
-    __mmplayer_video_caps_new (hplayer, &info,
-        "msmpegversion", G_TYPE_INT, info.version, NULL);
-  } else if (strstr (info.mime, "video/x-h265")) {
-    if (info.colordepth) {
-      __mmplayer_video_caps_new (hplayer, &info,
-          "colordepth", G_TYPE_INT, info.colordepth, NULL);
-    } else {
-      __mmplayer_video_caps_new (hplayer, &info, NULL);
-    }
-  } else {
-    __mmplayer_video_caps_new (hplayer, &info, NULL);
-  }
+       else if (strstr(info->mime, "video/x-wmv")) {
+               __mmplayer_video_caps_new(hplayer, &info,
+               "wmvversion", G_TYPE_INT, info.version, NULL);
+       } else if (strstr(info.mime, "video/x-pn-realvideo")) {
+               __mmplayer_video_caps_new(hplayer, &info,
+               "rmversion", G_TYPE_INT, info.version, NULL);
+       } else if (strstr(info.mime, "video/x-msmpeg")) {
+               __mmplayer_video_caps_new(hplayer, &info,
+               "msmpegversion", G_TYPE_INT, info.version, NULL);
+       } else if (strstr(info.mime, "video/x-h265")) {
+               if (info.colordepth)
+                       __mmplayer_video_caps_new(hplayer, &info,
+                       "colordepth", G_TYPE_INT, info.colordepth, NULL);
+               else
+                       __mmplayer_video_caps_new(hplayer, &info, NULL);
+       } else
+               __mmplayer_video_caps_new(hplayer, &info, NULL);
 #endif
-  g_free ((char *) video.mime);
+       g_free((char *) video.mime);
 
-  MMPLAYER_FLEAVE ();
+       MMPLAYER_FLEAVE();
 
-  return MM_ERROR_NONE;
+       return MM_ERROR_NONE;
 }
 
 int
-_mmplayer_set_audio_info (MMHandleType hplayer, media_format_h format)
+_mmplayer_set_audio_info(MMHandleType hplayer, media_format_h format)
 {
-  mm_player_t *player = MM_PLAYER_CAST (hplayer);
-  GstCaps *caps = NULL;
-  MMPlayerAudioStreamInfo audio = { 0, };
-  int ret = MM_ERROR_NONE;
-
-  MMPLAYER_FENTER ();
-
-  MMPLAYER_RETURN_VAL_IF_FAIL (hplayer, MM_ERROR_PLAYER_NOT_INITIALIZED);
-
-  __mmplayer_set_uri_type(player);
-
-  ret = __parse_media_format (NULL, &audio, format);
-  if(ret != MM_ERROR_NONE)
-    return ret;
-
-  audio.user_info = 0;           //test
-
-  LOGD ("set audio player[%p] info [%p] version=%d rate=%d channel=%d",
-      player, audio, audio.version, audio.sample_rate, audio.channels);
-
-  if (strstr (audio.mime, "audio/mpeg")) {
-    if (audio.version == 1) {          // mp3
-      caps = gst_caps_new_simple ("audio/mpeg",
-          "channels", G_TYPE_INT, audio.channels,
-          "rate", G_TYPE_INT, audio.sample_rate,
-          "mpegversion", G_TYPE_INT, audio.version,
-          "layer", G_TYPE_INT, audio.user_info, NULL);
-    } else {                    // aac
-      gchar *format = NULL;
-
-      if (audio.user_info == 0)
-        format = g_strdup ("raw");
-      else if (audio.user_info == 1)
-        format = g_strdup ("adts");
-      else if (audio.user_info == 2)
-        format = g_strdup ("adif");
-
-      caps = gst_caps_new_simple ("audio/mpeg",
-          "channels", G_TYPE_INT, audio.channels,
-          "rate", G_TYPE_INT, audio.sample_rate,
-          "mpegversion", G_TYPE_INT, audio.version,
-          "stream-format", G_TYPE_STRING, format, NULL);
-
-      g_free (format);
-      format = NULL;
-    }
-  }
+       mm_player_t *player = MM_PLAYER_CAST(hplayer);
+       GstCaps *caps = NULL;
+       MMPlayerAudioStreamInfo audio = { 0, };
+       int ret = MM_ERROR_NONE;
+
+       MMPLAYER_FENTER();
+
+       MMPLAYER_RETURN_VAL_IF_FAIL(hplayer, MM_ERROR_PLAYER_NOT_INITIALIZED);
+
+       __mmplayer_set_uri_type(player);
+
+       ret = __parse_media_format(NULL, &audio, format);
+       if (ret != MM_ERROR_NONE)
+               return ret;
+
+       audio.user_info = 0;           //test
+
+       LOGD("set audio player[%p] info [%p] version=%d rate=%d channel=%d",
+       player, audio, audio.version, audio.sample_rate, audio.channels);
+
+       if (strstr(audio.mime, "audio/mpeg")) {
+               if (audio.version == 1) {       // mp3
+                       caps = gst_caps_new_simple("audio/mpeg",
+                       "channels", G_TYPE_INT, audio.channels,
+                       "rate", G_TYPE_INT, audio.sample_rate,
+                       "mpegversion", G_TYPE_INT, audio.version,
+                       "layer", G_TYPE_INT, audio.user_info, NULL);
+               } else {                    // aac
+                       gchar *format = NULL;
+
+                       if (audio.user_info == 0)
+                       format = g_strdup("raw");
+                       else if (audio.user_info == 1)
+                       format = g_strdup("adts");
+                       else if (audio.user_info == 2)
+                       format = g_strdup("adif");
+
+                       caps = gst_caps_new_simple("audio/mpeg",
+                       "channels", G_TYPE_INT, audio.channels,
+                       "rate", G_TYPE_INT, audio.sample_rate,
+                       "mpegversion", G_TYPE_INT, audio.version,
+                       "stream-format", G_TYPE_STRING, format, NULL);
+
+                       g_free(format);
+                       format = NULL;
+               }
+       }
 #if 0
-  else if (strstr (audio.mime, "audio/x-raw-int")) {
-    caps = gst_caps_new_simple ("audio/x-raw-int",
-        "width", G_TYPE_INT, audio.width,
-        "depth", G_TYPE_INT, audio.depth,
-        "endianness", G_TYPE_INT, audio.endianness,
-        "signed", G_TYPE_BOOLEAN, audio.signedness,
-        "channels", G_TYPE_INT, audio.channels,
-        "rate", G_TYPE_INT, audio.sample_rate, NULL);
-  } else {
-    caps = gst_caps_new_simple (audio.mime,
-        "channels", G_TYPE_INT, audio.channels,
-        "rate", G_TYPE_INT, audio.sample_rate, NULL);
-  }
+       else if (strstr(audio.mime, "audio/x-raw-int")) {
+               caps = gst_caps_new_simple("audio/x-raw-int",
+               "width", G_TYPE_INT, audio.width,
+               "depth", G_TYPE_INT, audio.depth,
+               "endianness", G_TYPE_INT, audio.endianness,
+               "signed", G_TYPE_BOOLEAN, audio.signedness,
+               "channels", G_TYPE_INT, audio.channels,
+               "rate", G_TYPE_INT, audio.sample_rate, NULL);
+       } else {
+               caps = gst_caps_new_simple(audio.mime,
+               "channels", G_TYPE_INT, audio.channels,
+               "rate", G_TYPE_INT, audio.sample_rate, NULL);
+       }
 #endif
 
-  if (audio.extradata_size) {
-    GstBuffer *buf = NULL;
-    GstMapInfo buff_info = GST_MAP_INFO_INIT;
+       if (audio.extradata_size) {
+               GstBuffer *buf = NULL;
+               GstMapInfo buff_info = GST_MAP_INFO_INIT;
 
-    buf = gst_buffer_new_and_alloc (audio.extradata_size);
+               buf = gst_buffer_new_and_alloc(audio.extradata_size);
 
-    if (gst_buffer_map (buf, &buff_info, GST_MAP_READ)) {
-      memcpy (buff_info.data, audio.codec_extradata, audio.extradata_size);
-      gst_buffer_unmap (buf, &buff_info);
-    }
+               if (gst_buffer_map(buf, &buff_info, GST_MAP_READ)) {
+                       memcpy(buff_info.data, audio.codec_extradata, audio.extradata_size);
+                       gst_buffer_unmap(buf, &buff_info);
+               }
 
-    gst_caps_set_simple (caps, "codec_data", GST_TYPE_BUFFER, buf, NULL);
-    gst_buffer_unref (buf);
-  }
+               gst_caps_set_simple(caps, "codec_data", GST_TYPE_BUFFER, buf, NULL);
+               gst_buffer_unref(buf);
+       }
 
-  g_free ((char *) audio.mime);
+       g_free((char *) audio.mime);
 
-  player->a_stream_caps = gst_caps_copy (caps);
-  gst_caps_unref (caps);
+       player->a_stream_caps = gst_caps_copy(caps);
+       gst_caps_unref(caps);
 
-  MMPLAYER_FLEAVE ();
+       MMPLAYER_FLEAVE();
 
-  return MM_ERROR_NONE;
+       return MM_ERROR_NONE;
 }
 
 int
-_mmplayer_set_subtitle_info (MMHandleType hplayer,
-    MMPlayerSubtitleStreamInfo * subtitle)
+_mmplayer_set_subtitle_info(MMHandleType hplayer,
+       MMPlayerSubtitleStreamInfo * subtitle)
 {
 #if 0                           //todo
+       mm_player_t *player = MM_PLAYER_CAST(hplayer);
+       GstCaps *caps = NULL;
 
-  mm_player_t *player = MM_PLAYER_CAST (hplayer);
-  GstCaps *caps = NULL;
-
-  MMPLAYER_FENTER ();
+       MMPLAYER_FENTER();
 
-  MMPLAYER_RETURN_VAL_IF_FAIL (player, MM_ERROR_PLAYER_NOT_INITIALIZED);
-  MMPLAYER_RETURN_VAL_IF_FAIL (info, MM_ERROR_PLAYER_NOT_INITIALIZED);
+       MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+       MMPLAYER_RETURN_VAL_IF_FAIL(info, MM_ERROR_PLAYER_NOT_INITIALIZED);
 
-  LOGD ("set subtitle player[%p] info [%p]", player, info);
+       LOGD("set subtitle player[%p] info [%p]", player, info);
 
 
-  caps = gst_caps_new_simple (info->mime, NULL, NULL);  // TO CHECK
-  if (NULL == caps)
-    return FALSE;
+       caps = gst_caps_new_simple(info->mime, NULL, NULL);  // TO CHECK
+       if (NULL == caps)
+               return FALSE;
 
-  if (strstr (info->mime, "application/x-xsub")) {
-    gst_caps_set_simple (caps, "codec_tag", G_TYPE_UINT, info->codec_tag, NULL);
-  } else if (strstr (info->mime, "application/x-smpte-text")) {
-    if (info->context) {
-      gst_caps_set_simple (caps, "ttml_priv_data", G_TYPE_POINTER,
-          info->context, NULL);
-    }
-  }
+       if (strstr(info->mime, "application/x-xsub")) {
+               gst_caps_set_simple(caps, "codec_tag", G_TYPE_UINT, info->codec_tag, NULL);
+       } else if (strstr(info->mime, "application/x-smpte-text")) {
+               if (info->context) {
+                       gst_caps_set_simple(caps, "ttml_priv_data", G_TYPE_POINTER,
+                       info->context, NULL);
+               }
+       }
 
-  player->s_stream_caps = gst_caps_copy (caps);
+       player->s_stream_caps = gst_caps_copy(caps);
 
-  gst_caps_unref (caps);
+       gst_caps_unref(caps);
 #endif
 
-  MMPLAYER_FLEAVE ();
+       MMPLAYER_FLEAVE();
 
-  return MM_ERROR_NONE;
+       return MM_ERROR_NONE;
 }
 
 int
 _mmplayer_set_media_stream_dynamic_resolution(MMHandleType hplayer, bool drc)
 {
-       mm_player_t *player = MM_PLAYER_CAST (hplayer);
+       mm_player_t *player = MM_PLAYER_CAST(hplayer);
        int ret = MM_ERROR_NONE;
 
-       MMPLAYER_FENTER ();
+       MMPLAYER_FENTER();
 
-       MMPLAYER_RETURN_VAL_IF_FAIL (player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+       MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
 
-       mm_attrs_set_int_by_name (player->attrs, MM_PLAYER_DRC_MODE, (int)drc);
-       if (player->v_stream_caps)
-       {
-               gst_caps_set_simple (player->v_stream_caps,
+       mm_attrs_set_int_by_name(player->attrs, MM_PLAYER_DRC_MODE, (int)drc);
+       if (player->v_stream_caps) {
+               gst_caps_set_simple(player->v_stream_caps,
                        "adaptive-streaming", G_TYPE_BOOLEAN, drc, NULL);
-               MMPLAYER_LOG_GST_CAPS_TYPE (player->v_stream_caps);
+               MMPLAYER_LOG_GST_CAPS_TYPE(player->v_stream_caps);
        }
 
-       MMPLAYER_FLEAVE ();
-       return ret;
-
+       MMPLAYER_FLEAVE();
 
+       return ret;
 }
+
index 41e05ec..6f025e6 100644 (file)
@@ -41,70 +41,51 @@ static void __get_element_list(mm_player_ini_t* ini, gchar* str, int keyword_typ
 static void __mm_player_ini_check_ini_status(void);
 
 /* macro */
-#define MMPLAYER_INI_GET_STRING( x_dict, x_item, x_ini, x_default ) \
-do \
-{ \
+#define MMPLAYER_INI_GET_STRING(x_dict, x_item, x_ini, x_default) \
+do { \
        gchar* str = iniparser_getstring(x_dict, x_ini, x_default); \
- \
-       if ( str &&  \
-               ( strlen( str ) > 0 ) && \
-               ( strlen( str ) < PLAYER_INI_MAX_STRLEN ) ) \
-       { \
-               strncpy ( x_item, str, PLAYER_INI_MAX_STRLEN-1 ); \
-       } \
+       if (str &&  \
+               (strlen(str) > 0) && \
+               (strlen(str) < PLAYER_INI_MAX_STRLEN)) \
+               strncpy(x_item, str, PLAYER_INI_MAX_STRLEN-1); \
        else \
-       { \
-               strncpy ( x_item, x_default, PLAYER_INI_MAX_STRLEN-1 ); \
-       } \
-}while(0)
-
-#define MMPLAYER_INI_GET_COLOR( x_dict, x_item, x_ini, x_default ) \
-do \
-{ \
-  gchar* str = iniparser_getstring(x_dict, x_ini, x_default); \
- \
-  if ( str &&  \
-    ( strlen( str ) > 0 ) && \
-    ( strlen( str ) < PLAYER_INI_MAX_STRLEN ) ) \
-  { \
-    x_item = (guint) strtoul(str, NULL, 16); \
-  } \
-  else \
-  { \
-    x_item = (guint) strtoul(x_default, NULL, 16); \
-  } \
-}while(0)
+               strncpy(x_item, x_default, PLAYER_INI_MAX_STRLEN-1); \
+} while (0)
+
+#define MMPLAYER_INI_GET_COLOR(x_dict, x_item, x_ini, x_default) \
+do { \
+       gchar* str = iniparser_getstring(x_dict, x_ini, x_default); \
+       if (str &&  \
+               (strlen(str) > 0) && \
+               (strlen(str) < PLAYER_INI_MAX_STRLEN)) \
+               x_item = (guint) strtoul(str, NULL, 16); \
+       else \
+               x_item = (guint) strtoul(x_default, NULL, 16); \
+} while (0)
 
 /* x_ini is the list of index to set TRUE at x_list[index] */
-#define MMPLAYER_INI_GET_BOOLEAN_FROM_LIST( x_dict, x_list, x_list_max, x_ini, x_default ) \
-do \
-{ \
+#define MMPLAYER_INI_GET_BOOLEAN_FROM_LIST(x_dict, x_list, x_list_max, x_ini, x_default) \
+do { \
                int index = 0; \
                const char *delimiters = " ,"; \
                char *usr_ptr = NULL; \
                char *token = NULL; \
                gchar temp_arr[PLAYER_INI_MAX_STRLEN] = {0}; \
-               MMPLAYER_INI_GET_STRING( x_dict, temp_arr, x_ini, x_default); \
-               token = strtok_r( temp_arr, delimiters, &usr_ptr ); \
-               while (token) \
-               { \
+               MMPLAYER_INI_GET_STRING(x_dict, temp_arr, x_ini, x_default); \
+               token = strtok_r(temp_arr, delimiters, &usr_ptr); \
+               while (token) { \
                        index = atoi(token); \
                        if (index < 0 || index > x_list_max -1) \
-                       { \
                                LOGW("%d is not valid index\n", index); \
-                       } \
                        else \
-                       { \
                                x_list[index] = TRUE; \
-                       } \
-                       token = strtok_r( NULL, delimiters, &usr_ptr ); \
+                       token = strtok_r(NULL, delimiters, &usr_ptr); \
                } \
-}while(0)
+} while (0)
 
 /* x_ini is the list of value to be set at x_list[index] */
-#define MMPLAYER_INI_GET_INT_FROM_LIST( x_dict, x_list, x_list_max, x_ini, x_default ) \
-do \
-{ \
+#define MMPLAYER_INI_GET_INT_FROM_LIST(x_dict, x_list, x_list_max, x_ini, x_default) \
+do { \
                int index = 0; \
                int value = 0; \
                const char *delimiters = " ,"; \
@@ -112,23 +93,19 @@ do \
                char *token = NULL; \
                gchar temp_arr[PLAYER_INI_MAX_STRLEN] = {0}; \
                MMPLAYER_INI_GET_STRING(x_dict, temp_arr, x_ini, x_default); \
-               token = strtok_r( temp_arr, delimiters, &usr_ptr ); \
-               while (token) \
-               { \
-                       if ( index > x_list_max -1) \
-                       { \
+               token = strtok_r(temp_arr, delimiters, &usr_ptr); \
+               while (token) { \
+                       if (index > x_list_max -1) { \
                                LOGE("%d is not valid index\n", index); \
                                break; \
-                       } \
-                       else \
-                       { \
+                       } else { \
                                value = atoi(token); \
                                x_list[index] = value; \
                                index++; \
                        } \
-                       token = strtok_r( NULL, delimiters, &usr_ptr ); \
+                       token = strtok_r(NULL, delimiters, &usr_ptr); \
                } \
-}while(0)
+} while (0)
 
 int
 mm_player_ini_load(mm_player_ini_t* ini)
@@ -142,19 +119,13 @@ mm_player_ini_load(mm_player_ini_t* ini)
        dict = iniparser_load(MM_PLAYER_INI_DEFAULT_PATH);
 
        /* if no file exists. create one with set of default values */
-       if ( !dict )
-       {
+       if (!dict) {
 #ifdef MM_PLAYER_DEFAULT_INI
                LOGD("No inifile found. player will create default inifile.\n");
-               if ( FALSE == __generate_default_ini() )
-               {
+               if (FALSE == __generate_default_ini())
                        LOGW("Creating default inifile failed. Player will use default values.\n");
-               }
                else
-               {
-                       /* load default ini */
-                       dict = iniparser_load(MM_PLAYER_INI_DEFAULT_PATH);
-               }
+                       dict = iniparser_load(MM_PLAYER_INI_DEFAULT_PATH);      /* load default ini */
 #else
                LOGD("No ini file found. \n");
                return MM_ERROR_FILE_NOT_FOUND;
@@ -162,10 +133,10 @@ mm_player_ini_load(mm_player_ini_t* ini)
        }
 
        /* get ini values */
-       memset( ini, 0, sizeof(mm_player_ini_t) );
+       memset(ini, 0, sizeof(mm_player_ini_t));
 
-       if ( dict ) /* if dict is available */
-       {
+       if (dict) {
+               /* if dict is available */
                /* general */
                ini->disable_segtrap = iniparser_getboolean(dict, "general:disable segtrap", DEFAULT_DISABLE_SEGTRAP);
                ini->skip_rescan = iniparser_getboolean(dict, "general:skip rescan", DEFAULT_SKIP_RESCAN);
@@ -184,22 +155,22 @@ mm_player_ini_load(mm_player_ini_t* ini)
                MMPLAYER_INI_GET_STRING(dict, ini->videosink_element_overlay, "general:videosink element overlay", DEFAULT_VIDEOSINK_OVERLAY);
                MMPLAYER_INI_GET_STRING(dict, ini->videosink_element_evas, "general:videosink element evas", DEFAULT_VIDEOSINK_EVAS);
                MMPLAYER_INI_GET_STRING(dict, ini->videosink_element_fake, "general:videosink element fake", DEFAULT_VIDEOSINK_FAKE);
-               MMPLAYER_INI_GET_STRING(dict, ini->audioresampler_element, "general:audio resampler element", DEFAULT_AUDIORESAMPLER );
-               MMPLAYER_INI_GET_STRING(dict, ini->audiosink_element, "general:audiosink element", DEFAULT_AUDIOSINK );
+               MMPLAYER_INI_GET_STRING(dict, ini->audioresampler_element, "general:audio resampler element", DEFAULT_AUDIORESAMPLER);
+               MMPLAYER_INI_GET_STRING(dict, ini->audiosink_element, "general:audiosink element", DEFAULT_AUDIOSINK);
                MMPLAYER_INI_GET_STRING(dict, ini->videocodec_element_hw, "general:video codec element hw", DEFAULT_VIDEOCODEC_HW);
-               MMPLAYER_INI_GET_STRING(dict, ini->videoconverter_element, "general:video converter element", DEFAULT_VIDEO_CONVERTER );
+               MMPLAYER_INI_GET_STRING(dict, ini->videoconverter_element, "general:video converter element", DEFAULT_VIDEO_CONVERTER);
 
                __get_element_list(ini,
                        iniparser_getstring(dict, "general:element exclude keyword", DEFAULT_EXCLUDE_KEYWORD), KEYWORD_EXCLUDE);
 
-               MMPLAYER_INI_GET_STRING(dict, ini->gst_param[0], "general:gstparam1", DEFAULT_GST_PARAM );
-               MMPLAYER_INI_GET_STRING(dict, ini->gst_param[1], "general:gstparam2", DEFAULT_GST_PARAM );
-               MMPLAYER_INI_GET_STRING(dict, ini->gst_param[2], "general:gstparam3", DEFAULT_GST_PARAM );
-               MMPLAYER_INI_GET_STRING(dict, ini->gst_param[3], "general:gstparam4", DEFAULT_GST_PARAM );
-               MMPLAYER_INI_GET_STRING(dict, ini->gst_param[4], "general:gstparam5", DEFAULT_GST_PARAM );
+               MMPLAYER_INI_GET_STRING(dict, ini->gst_param[0], "general:gstparam1", DEFAULT_GST_PARAM);
+               MMPLAYER_INI_GET_STRING(dict, ini->gst_param[1], "general:gstparam2", DEFAULT_GST_PARAM);
+               MMPLAYER_INI_GET_STRING(dict, ini->gst_param[2], "general:gstparam3", DEFAULT_GST_PARAM);
+               MMPLAYER_INI_GET_STRING(dict, ini->gst_param[3], "general:gstparam4", DEFAULT_GST_PARAM);
+               MMPLAYER_INI_GET_STRING(dict, ini->gst_param[4], "general:gstparam5", DEFAULT_GST_PARAM);
 
                /* http streaming */
-               MMPLAYER_INI_GET_STRING( dict, ini->httpsrc_element, "http streaming:httpsrc element", DEFAULT_HTTPSRC );
+               MMPLAYER_INI_GET_STRING(dict, ini->httpsrc_element, "http streaming:httpsrc element", DEFAULT_HTTPSRC);
                ini->http_use_file_buffer = iniparser_getboolean(dict, "http streaming:http use file buffer", DEFAULT_HTTP_USE_FILE_BUFFER);
                ini->http_ring_buffer_size = iniparser_getint(dict, "http streaming:http ring buffer size", DEFAULT_HTTP_RING_BUFFER_SIZE);
                ini->http_buffering_limit = iniparser_getdouble(dict, "http streaming:http buffering high limit", DEFAULT_HTTP_BUFFERING_LIMIT);
@@ -212,17 +183,16 @@ mm_player_ini_load(mm_player_ini_t* ini)
                        iniparser_getstring(dict, "general:dump element keyword", DEFAULT_EXCLUDE_KEYWORD), KEYWORD_DUMP);
 
                MMPLAYER_INI_GET_STRING(dict, ini->dump_element_path, "general:dump element path", DEFAULT_DUMP_ELEMENT_PATH);
-       }
-       else /* if dict is not available just fill the structure with default value */
-       {
+       } else {
+               /* if dict is not available just fill the structure with default value */
                LOGW("failed to load ini. using hardcoded default\n");
 
                /* general */
                ini->disable_segtrap = DEFAULT_DISABLE_SEGTRAP;
                ini->skip_rescan = DEFAULT_SKIP_RESCAN;
-               strncpy( ini->videosink_element_overlay, DEFAULT_VIDEOSINK_OVERLAY, PLAYER_INI_MAX_STRLEN - 1 );
-               strncpy( ini->videosink_element_evas, DEFAULT_VIDEOSINK_EVAS, PLAYER_INI_MAX_STRLEN - 1 );
-               strncpy( ini->videosink_element_fake, DEFAULT_VIDEOSINK_FAKE, PLAYER_INI_MAX_STRLEN - 1 );
+               strncpy(ini->videosink_element_overlay, DEFAULT_VIDEOSINK_OVERLAY, PLAYER_INI_MAX_STRLEN - 1);
+               strncpy(ini->videosink_element_evas, DEFAULT_VIDEOSINK_EVAS, PLAYER_INI_MAX_STRLEN - 1);
+               strncpy(ini->videosink_element_fake, DEFAULT_VIDEOSINK_FAKE, PLAYER_INI_MAX_STRLEN - 1);
                ini->generate_dot = DEFAULT_GENERATE_DOT;
                ini->use_system_clock = DEFAULT_USE_SYSTEM_CLOCK;
                ini->live_state_change_timeout = DEFAULT_LIVE_STATE_CHANGE_TIMEOUT;
@@ -235,21 +205,21 @@ mm_player_ini_load(mm_player_ini_t* ini)
                ini->num_of_video_bo = DEFAULT_NUM_OF_VIDEO_BO;
                ini->video_bo_timeout = DEFAULT_TIMEOUT_OF_VIDEO_BO;
 
-               strncpy( ini->audioresampler_element, DEFAULT_AUDIORESAMPLER, PLAYER_INI_MAX_STRLEN -1 );
-               strncpy( ini->audiosink_element, DEFAULT_AUDIOSINK, PLAYER_INI_MAX_STRLEN -1 );
-               strncpy( ini->videocodec_element_hw, DEFAULT_VIDEOCODEC_HW, PLAYER_INI_MAX_STRLEN - 1 );
-               strncpy( ini->videoconverter_element, DEFAULT_VIDEO_CONVERTER, PLAYER_INI_MAX_STRLEN -1 );
+               strncpy(ini->audioresampler_element, DEFAULT_AUDIORESAMPLER, PLAYER_INI_MAX_STRLEN -1);
+               strncpy(ini->audiosink_element, DEFAULT_AUDIOSINK, PLAYER_INI_MAX_STRLEN -1);
+               strncpy(ini->videocodec_element_hw, DEFAULT_VIDEOCODEC_HW, PLAYER_INI_MAX_STRLEN - 1);
+               strncpy(ini->videoconverter_element, DEFAULT_VIDEO_CONVERTER, PLAYER_INI_MAX_STRLEN -1);
 
                __get_element_list(ini, DEFAULT_EXCLUDE_KEYWORD, KEYWORD_EXCLUDE);
 
-               strncpy( ini->gst_param[0], DEFAULT_GST_PARAM, PLAYER_INI_MAX_PARAM_STRLEN - 1 );
-               strncpy( ini->gst_param[1], DEFAULT_GST_PARAM, PLAYER_INI_MAX_PARAM_STRLEN - 1 );
-               strncpy( ini->gst_param[2], DEFAULT_GST_PARAM, PLAYER_INI_MAX_PARAM_STRLEN - 1 );
-               strncpy( ini->gst_param[3], DEFAULT_GST_PARAM, PLAYER_INI_MAX_PARAM_STRLEN - 1 );
-               strncpy( ini->gst_param[4], DEFAULT_GST_PARAM, PLAYER_INI_MAX_PARAM_STRLEN - 1 );
+               strncpy(ini->gst_param[0], DEFAULT_GST_PARAM, PLAYER_INI_MAX_PARAM_STRLEN - 1);
+               strncpy(ini->gst_param[1], DEFAULT_GST_PARAM, PLAYER_INI_MAX_PARAM_STRLEN - 1);
+               strncpy(ini->gst_param[2], DEFAULT_GST_PARAM, PLAYER_INI_MAX_PARAM_STRLEN - 1);
+               strncpy(ini->gst_param[3], DEFAULT_GST_PARAM, PLAYER_INI_MAX_PARAM_STRLEN - 1);
+               strncpy(ini->gst_param[4], DEFAULT_GST_PARAM, PLAYER_INI_MAX_PARAM_STRLEN - 1);
 
                /* http streaming */
-               strncpy( ini->httpsrc_element, DEFAULT_HTTPSRC, PLAYER_INI_MAX_STRLEN - 1 );
+               strncpy(ini->httpsrc_element, DEFAULT_HTTPSRC, PLAYER_INI_MAX_STRLEN - 1);
                ini->http_buffering_limit = DEFAULT_HTTP_BUFFERING_LIMIT;
                ini->http_use_file_buffer = DEFAULT_HTTP_USE_FILE_BUFFER;
                ini->http_ring_buffer_size = DEFAULT_HTTP_RING_BUFFER_SIZE;
@@ -263,7 +233,7 @@ mm_player_ini_load(mm_player_ini_t* ini)
        }
 
        /* free dict as we got our own structure */
-       iniparser_freedict (dict);
+       iniparser_freedict(dict);
 
        /* dump structure */
        LOGD("player settings -----------------------------------\n");
@@ -295,15 +265,11 @@ mm_player_ini_load(mm_player_ini_t* ini)
        LOGD("gst param4 : %s\n", ini->gst_param[3]);
        LOGD("gst param5 : %s\n", ini->gst_param[4]);
 
-       for ( idx = 0; ini->exclude_element_keyword[idx][0] != '\0'; idx++ )
-       {
+       for (idx = 0; ini->exclude_element_keyword[idx][0] != '\0'; idx++)
                LOGD("exclude_element_keyword [%d] : %s\n", idx, ini->exclude_element_keyword[idx]);
-       }
 
-       for ( idx = 0; ini->dump_element_keyword[idx][0] != '\0'; idx++ )
-       {
+       for (idx = 0; ini->dump_element_keyword[idx][0] != '\0'; idx++)
                LOGD("dump_element_keyword [%d] : %s\n", idx, ini->dump_element_keyword[idx]);
-       }
 
        /* http streaming */
        LOGD("httpsrc element : %s\n", ini->httpsrc_element);
@@ -323,64 +289,55 @@ mm_player_audio_effect_ini_load(mm_player_ini_t* ini)
        dictionary * dict_audioeffect = NULL;
 
        dict_audioeffect = iniparser_load(MM_PLAYER_INI_DEFAULT_AUDIOEFFECT_PATH);
-       if ( !dict_audioeffect )
-       {
+       if (!dict_audioeffect) {
                LOGE("No audio effect ini file found. \n");
                return MM_ERROR_FILE_NOT_FOUND;
        }
 
        /* audio effect element name */
-       MMPLAYER_INI_GET_STRING( dict_audioeffect, ini->audioeffect_element, "audio effect:audio effect element", DEFAULT_AUDIO_EFFECT_ELEMENT );
-       if (!ini->audioeffect_element[0])
-       {
+       MMPLAYER_INI_GET_STRING(dict_audioeffect, ini->audioeffect_element, "audio effect:audio effect element", DEFAULT_AUDIO_EFFECT_ELEMENT);
+       if (!ini->audioeffect_element[0]) {
                LOGW("could not parse name of audio effect. \n");
-               iniparser_freedict (dict_audioeffect);
+               iniparser_freedict(dict_audioeffect);
                /* NOTE : in this case, we are not going to create audio filter element */
                return MM_ERROR_NONE;
        }
 
        /* audio effect (Preset)*/
        ini->use_audio_effect_preset = iniparser_getboolean(dict_audioeffect, "audio effect:audio effect preset", DEFAULT_USE_AUDIO_EFFECT_PRESET);
-       if (ini->use_audio_effect_preset)
-       {
-               MMPLAYER_INI_GET_BOOLEAN_FROM_LIST( dict_audioeffect, ini->audio_effect_preset_list, MM_AUDIO_EFFECT_PRESET_NUM,
-                               "audio effect:audio effect preset list", DEFAULT_AUDIO_EFFECT_PRESET_LIST );
-               MMPLAYER_INI_GET_BOOLEAN_FROM_LIST( dict_audioeffect, ini->audio_effect_preset_earphone_only_list, MM_AUDIO_EFFECT_PRESET_NUM,
-                               "audio effect:audio effect preset earphone only", DEFAULT_AUDIO_EFFECT_PRESET_LIST_EARPHONE_ONLY );
+       if (ini->use_audio_effect_preset) {
+               MMPLAYER_INI_GET_BOOLEAN_FROM_LIST(dict_audioeffect, ini->audio_effect_preset_list, MM_AUDIO_EFFECT_PRESET_NUM,
+                               "audio effect:audio effect preset list", DEFAULT_AUDIO_EFFECT_PRESET_LIST);
+               MMPLAYER_INI_GET_BOOLEAN_FROM_LIST(dict_audioeffect, ini->audio_effect_preset_earphone_only_list, MM_AUDIO_EFFECT_PRESET_NUM,
+                               "audio effect:audio effect preset earphone only", DEFAULT_AUDIO_EFFECT_PRESET_LIST_EARPHONE_ONLY);
        }
 
        /* audio effect user (EQ / Extension effects) */
        ini->use_audio_effect_custom = iniparser_getboolean(dict_audioeffect, "audio effect:audio effect custom", DEFAULT_USE_AUDIO_EFFECT_CUSTOM);
-       if (ini->use_audio_effect_custom)
-       {
-               MMPLAYER_INI_GET_BOOLEAN_FROM_LIST( dict_audioeffect, ini->audio_effect_custom_list, MM_AUDIO_EFFECT_CUSTOM_NUM,
-                               "audio effect:audio effect custom list", DEFAULT_AUDIO_EFFECT_CUSTOM_LIST );
-               MMPLAYER_INI_GET_BOOLEAN_FROM_LIST( dict_audioeffect, ini->audio_effect_custom_earphone_only_list, MM_AUDIO_EFFECT_CUSTOM_NUM,
-                               "audio effect:audio effect custom earphone only", DEFAULT_AUDIO_EFFECT_CUSTOM_LIST_EARPHONE_ONLY );
+       if (ini->use_audio_effect_custom) {
+               MMPLAYER_INI_GET_BOOLEAN_FROM_LIST(dict_audioeffect, ini->audio_effect_custom_list, MM_AUDIO_EFFECT_CUSTOM_NUM,
+                               "audio effect:audio effect custom list", DEFAULT_AUDIO_EFFECT_CUSTOM_LIST);
+               MMPLAYER_INI_GET_BOOLEAN_FROM_LIST(dict_audioeffect, ini->audio_effect_custom_earphone_only_list, MM_AUDIO_EFFECT_CUSTOM_NUM,
+                               "audio effect:audio effect custom earphone only", DEFAULT_AUDIO_EFFECT_CUSTOM_LIST_EARPHONE_ONLY);
 
                /* audio effect custom : EQ */
-               if (ini->audio_effect_custom_list[MM_AUDIO_EFFECT_CUSTOM_EQ])
-               {
+               if (ini->audio_effect_custom_list[MM_AUDIO_EFFECT_CUSTOM_EQ]) {
                        ini->audio_effect_custom_eq_band_num = iniparser_getint(dict_audioeffect, "audio effect:audio effect custom eq band num",
                                        DEFAULT_AUDIO_EFFECT_CUSTOM_EQ_BAND_NUM);
                        if (ini->audio_effect_custom_eq_band_num < DEFAULT_AUDIO_EFFECT_CUSTOM_EQ_BAND_NUM ||
-                                       ini->audio_effect_custom_eq_band_num > MM_AUDIO_EFFECT_EQ_BAND_NUM_MAX)
-                       {
+                                       ini->audio_effect_custom_eq_band_num > MM_AUDIO_EFFECT_EQ_BAND_NUM_MAX) {
                                LOGE("audio_effect_custom_eq_band_num(%d) is not valid range(%d - %d), set the value %d",
                                        ini->audio_effect_custom_eq_band_num, DEFAULT_AUDIO_EFFECT_CUSTOM_EQ_BAND_NUM, MM_AUDIO_EFFECT_EQ_BAND_NUM_MAX, DEFAULT_AUDIO_EFFECT_CUSTOM_EQ_BAND_NUM);
                                ini->audio_effect_custom_eq_band_num = DEFAULT_AUDIO_EFFECT_CUSTOM_EQ_BAND_NUM;
 
-                               iniparser_freedict (dict_audioeffect);
+                               iniparser_freedict(dict_audioeffect);
                                return MM_ERROR_PLAYER_INTERNAL;
-                       }
-                       else
-                       {
-                               if (ini->audio_effect_custom_eq_band_num)
-                               {
-                                       MMPLAYER_INI_GET_INT_FROM_LIST( dict_audioeffect, ini->audio_effect_custom_eq_band_width, MM_AUDIO_EFFECT_EQ_BAND_NUM_MAX,
-                                                       "audio effect:audio effect custom eq band width", DEFAULT_AUDIO_EFFECT_CUSTOM_EQ_BAND_WIDTH );
-                                       MMPLAYER_INI_GET_INT_FROM_LIST( dict_audioeffect, ini->audio_effect_custom_eq_band_freq, MM_AUDIO_EFFECT_EQ_BAND_NUM_MAX,
-                                                       "audio effect:audio effect custom eq band freq", DEFAULT_AUDIO_EFFECT_CUSTOM_EQ_BAND_FREQ );
+                       } else {
+                               if (ini->audio_effect_custom_eq_band_num) {
+                                       MMPLAYER_INI_GET_INT_FROM_LIST(dict_audioeffect, ini->audio_effect_custom_eq_band_width, MM_AUDIO_EFFECT_EQ_BAND_NUM_MAX,
+                                                       "audio effect:audio effect custom eq band width", DEFAULT_AUDIO_EFFECT_CUSTOM_EQ_BAND_WIDTH);
+                                       MMPLAYER_INI_GET_INT_FROM_LIST(dict_audioeffect, ini->audio_effect_custom_eq_band_freq, MM_AUDIO_EFFECT_EQ_BAND_NUM_MAX,
+                                                       "audio effect:audio effect custom eq band freq", DEFAULT_AUDIO_EFFECT_CUSTOM_EQ_BAND_FREQ);
                                }
                        }
                }
@@ -390,26 +347,20 @@ mm_player_audio_effect_ini_load(mm_player_ini_t* ini)
                                DEFAULT_AUDIO_EFFECT_CUSTOM_EXT_NUM);
 
                /* Min/Max value list of EQ / Extension effects */
-               if (ini->audio_effect_custom_eq_band_num || ini->audio_effect_custom_ext_num)
-               {
-
-                       MMPLAYER_INI_GET_INT_FROM_LIST( dict_audioeffect, ini->audio_effect_custom_min_level_list, MM_AUDIO_EFFECT_CUSTOM_NUM,
-                                       "audio effect:audio effect custom min list", DEFAULT_AUDIO_EFFECT_CUSTOM_LIST );
-                       MMPLAYER_INI_GET_INT_FROM_LIST( dict_audioeffect, ini->audio_effect_custom_max_level_list, MM_AUDIO_EFFECT_CUSTOM_NUM,
-                                       "audio effect:audio effect custom max list", DEFAULT_AUDIO_EFFECT_CUSTOM_LIST );
+               if (ini->audio_effect_custom_eq_band_num || ini->audio_effect_custom_ext_num) {
+                       MMPLAYER_INI_GET_INT_FROM_LIST(dict_audioeffect, ini->audio_effect_custom_min_level_list, MM_AUDIO_EFFECT_CUSTOM_NUM,
+                                       "audio effect:audio effect custom min list", DEFAULT_AUDIO_EFFECT_CUSTOM_LIST);
+                       MMPLAYER_INI_GET_INT_FROM_LIST(dict_audioeffect, ini->audio_effect_custom_max_level_list, MM_AUDIO_EFFECT_CUSTOM_NUM,
+                                       "audio effect:audio effect custom max list", DEFAULT_AUDIO_EFFECT_CUSTOM_LIST);
                }
        }
 
        /* audio effect element name */
-       MMPLAYER_INI_GET_STRING(dict_audioeffect, ini->audioeffect_element_custom, "audio effect:audio effect element custom", DEFAULT_AUDIO_EFFECT_ELEMENT );
+       MMPLAYER_INI_GET_STRING(dict_audioeffect, ini->audioeffect_element_custom, "audio effect:audio effect element custom", DEFAULT_AUDIO_EFFECT_ELEMENT);
        if (!ini->audioeffect_element_custom[0])
-       {
                LOGW("no secondary audio effect \n");
-       }
        else
-       {
                LOGD("audioeffect element custom : %s\n", ini->audioeffect_element_custom);
-       }
 
        /* dump structure */
        LOGD("audioeffect element : %s\n", ini->audioeffect_element);
@@ -417,26 +368,19 @@ mm_player_audio_effect_ini_load(mm_player_ini_t* ini)
        LOGD("audio effect custom mode : %d\n", ini->use_audio_effect_custom);
 #if 0 // debug
        int i;
-       for (i=0; i<MM_AUDIO_EFFECT_PRESET_NUM; i++)
-       {
+       for (i = 0; i < MM_AUDIO_EFFECT_PRESET_NUM; i++)
                LOGD("audio_effect_preset_list: %d (is it for earphone only?(%d))\n", ini->audio_effect_preset_list[i], ini->audio_effect_preset_earphone_only_list[i]);
-       }
-       for (i=0; i<MM_AUDIO_EFFECT_CUSTOM_NUM; i++)
-       {
+
+       for (i = 0; i < MM_AUDIO_EFFECT_CUSTOM_NUM; i++)
                LOGD("audio_effect_custom_list : %d (is it for earphone only?(%d))\n", ini->audio_effect_custom_list[i], ini->audio_effect_custom_earphone_only_list[i]);
-       }
-       LOGD("audio_effect_custom : eq_band_num(%d), ext_num(%d)\n", ini->audio_effect_custom_eq_band_num, ini->audio_effect_custom_ext_num );
+       LOGD("audio_effect_custom : eq_band_num(%d), ext_num(%d)\n", ini->audio_effect_custom_eq_band_num, ini->audio_effect_custom_ext_num);
        LOGD("audio_effect_custom_EQ : width(Hz) / central frequency(Hz)");
-       for (i=0; i<ini->audio_effect_custom_eq_band_num; i++)
-       {
+       for (i = 0; i < ini->audio_effect_custom_eq_band_num; i++)
                LOGD("     EQ band index(%d) :  %8d / %8d", i, ini->audio_effect_custom_eq_band_width[i], ini->audio_effect_custom_eq_band_freq[i]);
-       }
-       for (i=0; i<MM_AUDIO_EFFECT_CUSTOM_NUM; i++)
-       {
+       for (i = 0; i < MM_AUDIO_EFFECT_CUSTOM_NUM; i++)
                LOGD("audio_effect_custom_level_min_max(idx:%d) : Min(%d), Max(%d)\n", i, ini->audio_effect_custom_min_level_list[i], ini->audio_effect_custom_max_level_list[i]);
-       }
 #endif
-       iniparser_freedict (dict_audioeffect);
+       iniparser_freedict(dict_audioeffect);
 
        return MM_ERROR_NONE;
 
@@ -447,20 +391,14 @@ void __mm_player_ini_check_ini_status(void)
 {
        struct stat ini_buff;
 
-       if ( g_stat(MM_PLAYER_INI_DEFAULT_PATH, &ini_buff) < 0 )
-       {
+       if (g_stat(MM_PLAYER_INI_DEFAULT_PATH, &ini_buff) < 0) {
                LOGW("failed to get player ini status\n");
-       }
-       else
-       {
-               if ( ini_buff.st_size < 5 )
-               {
-                       LOGW("player.ini file size=%d, Corrupted! So, Removed\n", (int)ini_buff.st_size);
+       } else {
+               if (ini_buff.st_size < 5) {
+                       LOGW("player.ini file size=%d, Corrupted!So, Removed\n", (int)ini_buff.st_size);
 
-                       if ( g_remove( MM_PLAYER_INI_DEFAULT_PATH ) == -1)
-                       {
+                       if (g_remove(MM_PLAYER_INI_DEFAULT_PATH) == -1)
                                LOGE("failed to delete corrupted ini");
-                       }
                }
        }
 }
@@ -476,14 +414,11 @@ gboolean __generate_default_ini(void)
        /* create new file */
        fp = fopen(MM_PLAYER_INI_DEFAULT_PATH, "wt");
 
-       if ( !fp )
-       {
+       if (!fp)
                return FALSE;
-       }
 
        /* writing default ini file */
-       if ( strlen(default_ini) != fwrite(default_ini, 1, strlen(default_ini), fp) )
-       {
+       if (strlen(default_ini) != fwrite(default_ini, 1, strlen(default_ini), fp)) {
                fclose(fp);
                return FALSE;
        }
@@ -494,30 +429,29 @@ gboolean __generate_default_ini(void)
 #endif
 
 static
-void   __get_element_list(mm_player_ini_t* ini, gchar* str, int keyword_type)
+void __get_element_list(mm_player_ini_t* ini, gchar* str, int keyword_type)
 {
        gchar** list = NULL;
        gchar** walk = NULL;
        gint i = 0;
        gchar* strtmp = NULL;
 
-       if ( ! str )
+       if (!str)
                return;
 
-       if ( strlen( str ) < 1 )
+       if (strlen(str) < 1)
                return;
 
-       strtmp = g_strdup (str);
+       strtmp = g_strdup(str);
 
        /* trimming. it works inplace */
-       g_strstrip( strtmp );
+       g_strstrip(strtmp);
 
 
        /* split */
-       list = g_strsplit( strtmp, ",", 10 );
+       list = g_strsplit(strtmp, ",", 10);
 
-       if ( !list )
-       {
+       if (!list) {
                if (strtmp)
                        g_free(strtmp);
 
@@ -525,49 +459,46 @@ void      __get_element_list(mm_player_ini_t* ini, gchar* str, int keyword_type)
        }
 
        /* copy list */
-       switch (keyword_type)
+       switch (keyword_type) {
+       case KEYWORD_EXCLUDE:
        {
-               case KEYWORD_EXCLUDE:
-               {
-                       for( walk = list; *walk; walk++ )
-                       {
-                               strncpy( ini->exclude_element_keyword[i], *walk, (PLAYER_INI_MAX_STRLEN - 1) );
+               for (walk = list; *walk; walk++) {
+                       strncpy(ini->exclude_element_keyword[i], *walk, (PLAYER_INI_MAX_STRLEN - 1));
 
-                               g_strstrip( ini->exclude_element_keyword[i] );
+                       g_strstrip(ini->exclude_element_keyword[i]);
 
-                               ini->exclude_element_keyword[i][PLAYER_INI_MAX_STRLEN -1]= '\0';
+                       ini->exclude_element_keyword[i][PLAYER_INI_MAX_STRLEN -1] = '\0';
 
-                               i++;
-                       }
-                       /* mark last item to NULL */
-                       ini->exclude_element_keyword[i][0] = '\0';
-
-                       break;
+                       i++;
                }
-               case KEYWORD_DUMP:
-               {
-                       for( walk = list; *walk; walk++ )
-                       {
-                               strncpy( ini->dump_element_keyword[i], *walk, (PLAYER_INI_MAX_STRLEN - 1) );
+               /* mark last item to NULL */
+               ini->exclude_element_keyword[i][0] = '\0';
 
-                               g_strstrip( ini->dump_element_keyword[i] );
+               break;
+       }
+       case KEYWORD_DUMP:
+       {
+               for (walk = list; *walk; walk++) {
+                       strncpy(ini->dump_element_keyword[i], *walk, (PLAYER_INI_MAX_STRLEN - 1));
 
-                               ini->dump_element_keyword[i][PLAYER_INI_MAX_STRLEN -1]= '\0';
+                       g_strstrip(ini->dump_element_keyword[i]);
 
-                               i++;
-                       }
-                       /* mark last item to NULL */
-                       ini->dump_element_keyword[i][0] = '\0';
+                       ini->dump_element_keyword[i][PLAYER_INI_MAX_STRLEN -1] = '\0';
 
-                       break;
+                       i++;
                }
-               default:
-                       break;
+               /* mark last item to NULL */
+               ini->dump_element_keyword[i][0] = '\0';
+
+               break;
+       }
+       default:
+               break;
        }
 
-       g_strfreev( list );
+       g_strfreev(list);
        if (strtmp)
-               g_free (strtmp);
+               g_free(strtmp);
 }
 
 #endif
index cf2cdc4..f198daf 100644 (file)
 
 #define TO_THE_END 0
 
-typedef struct{
+typedef struct {
        gint byte_in_rate;              // byte
        gint byte_out_rate;             // byte
        gdouble time_rate;              // second
        guint buffer_criteria;  // byte
-}streaming_bitrate_info_t;
+} streaming_bitrate_info_t;
 
-typedef struct{
+typedef struct {
        gint64 position;        // ns
        gint64 duration;        // ns
        guint64 content_size;   // bytes
-}streaming_content_info_t;
+} streaming_content_info_t;
 
-typedef struct{
+typedef struct {
        guint buffering_bytes;          // bytes
        gdouble buffering_time;         // second
        gdouble percent_byte;
        gdouble percent_time;
-}streaming_buffer_info_t;
+} streaming_buffer_info_t;
 
 static void streaming_check_buffer_percent(gdouble in_low, gdouble in_high, gdouble *out_low, gdouble *out_high);
 static void streaming_set_buffer_percent(mm_player_streaming_t* streamer, BufferType type, gdouble low_percent, gdouble high_percent_byte, gdouble high_percent_time);
-static void streaming_set_queue2_queue_type (mm_player_streaming_t* streamer, muxed_buffer_type_e type, gchar * file_path, guint64 content_size);
+static void streaming_set_queue2_queue_type(mm_player_streaming_t* streamer, muxed_buffer_type_e type, gchar * file_path, guint64 content_size);
 static void streaming_set_buffer_size(mm_player_streaming_t* streamer, BufferType type, guint buffering_bytes, gdouble buffering_time);
 static void streaming_update_buffering_status(mm_player_streaming_t* streamer, GstMessage *buffering_msg, gint64 position);
-static void streaming_get_current_bitrate_info(        mm_player_streaming_t* streamer,
+static void streaming_get_current_bitrate_info(mm_player_streaming_t* streamer,
                                                                                                GstMessage *buffering_msg,
                                                                                                streaming_content_info_t content_info,
                                                                                                streaming_bitrate_info_t* bitrate_info);
 static void
-streaming_handle_fixed_buffering_mode( mm_player_streaming_t* streamer,
+streaming_handle_fixed_buffering_mode(mm_player_streaming_t* streamer,
                                                                                gint byte_out_rate,
                                                                                gdouble fixed_buffering_time,
                                                                                streaming_buffer_info_t* buffer_info);
 static void
-streaming_handle_adaptive_buffering_mode(      mm_player_streaming_t* streamer,
+streaming_handle_adaptive_buffering_mode(mm_player_streaming_t* streamer,
                                                                                        streaming_content_info_t content_info,
                                                                                        streaming_bitrate_info_t bitrate_info,
                                                                                        streaming_buffer_info_t* buffer_info,
                                                                                        gint expected_play_time);
 static void
-streaming_update_buffer_setting        (       mm_player_streaming_t* streamer,
+streaming_update_buffer_setting(mm_player_streaming_t* streamer,
                                                                        GstMessage *buffering_msg,
                                                                        guint64 content_size,
                                                                        gint64 position,
                                                                        gint64 duration);
 
 mm_player_streaming_t *
-__mm_player_streaming_create (void)
+__mm_player_streaming_create(void)
 {
        mm_player_streaming_t *streamer = NULL;
 
        MMPLAYER_FENTER();
 
-       streamer = (mm_player_streaming_t *) malloc (sizeof (mm_player_streaming_t));
-       if (!streamer)
-       {
-               LOGE ("fail to create streaming player handle..\n");
+       streamer = (mm_player_streaming_t *) malloc(sizeof(mm_player_streaming_t));
+       if (!streamer) {
+               LOGE("fail to create streaming player handle..\n");
                return NULL;
        }
 
@@ -96,7 +95,7 @@ __mm_player_streaming_create (void)
 }
 
 static void
-streaming_buffer_initialize (streaming_buffer_t* buffer_handle, gboolean buffer_init)
+streaming_buffer_initialize(streaming_buffer_t* buffer_handle, gboolean buffer_init)
 {
        if (buffer_init)
                buffer_handle->buffer = NULL;
@@ -109,7 +108,7 @@ streaming_buffer_initialize (streaming_buffer_t* buffer_handle, gboolean buffer_
 
 }
 
-void __mm_player_streaming_initialize (mm_player_streaming_t* streamer)
+void __mm_player_streaming_initialize(mm_player_streaming_t* streamer)
 {
        MMPLAYER_FENTER();
 
@@ -141,7 +140,7 @@ void __mm_player_streaming_initialize (mm_player_streaming_t* streamer)
        return;
 }
 
-void __mm_player_streaming_deinitialize (mm_player_streaming_t* streamer)
+void __mm_player_streaming_deinitialize(mm_player_streaming_t* streamer)
 {
        MMPLAYER_FENTER();
        MMPLAYER_RETURN_IF_FAIL(streamer);
@@ -175,13 +174,12 @@ void __mm_player_streaming_deinitialize (mm_player_streaming_t* streamer)
        return;
 }
 
-void __mm_player_streaming_destroy (mm_player_streaming_t* streamer)
+void __mm_player_streaming_destroy(mm_player_streaming_t* streamer)
 {
        MMPLAYER_FENTER();
 
-       if(streamer)
-       {
-               g_free (streamer);
+       if (streamer) {
+               g_free(streamer);
                streamer = NULL;
        }
 
@@ -201,16 +199,12 @@ void __mm_player_streaming_set_content_bitrate(mm_player_streaming_t* streamer,
        *      2. average bitrage * 3 is next.
        *      3. if there are no updated bitrate, use default buffering limit.
        */
-       if (max_bitrate > 0 && streamer->buffer_max_bitrate != max_bitrate)
-       {
+       if (max_bitrate > 0 && streamer->buffer_max_bitrate != max_bitrate) {
                LOGD("set maximum bitrate(%dbps).\n", max_bitrate);
                streamer->buffer_max_bitrate = max_bitrate;
-               if (streamer->buffering_req.is_pre_buffering == FALSE)
-               {
+               if (streamer->buffering_req.is_pre_buffering == FALSE) {
                        streamer->need_update = TRUE;
-               }
-               else
-               {
+               } else {
                        LOGD("pre-buffering...\n");
 
                        if (IS_MUXED_BUFFERING_MODE(streamer))
@@ -218,17 +212,13 @@ void __mm_player_streaming_set_content_bitrate(mm_player_streaming_t* streamer,
                }
        }
 
-       if (avg_bitrate > 0 && streamer->buffer_avg_bitrate != avg_bitrate)
-       {
+       if (avg_bitrate > 0 && streamer->buffer_avg_bitrate != avg_bitrate) {
                LOGD("set averate bitrate(%dbps).\n", avg_bitrate);
                streamer->buffer_avg_bitrate = avg_bitrate;
 
-               if (streamer->buffering_req.is_pre_buffering == FALSE)
-               {
+               if (streamer->buffering_req.is_pre_buffering == FALSE) {
                        streamer->need_update = TRUE;
-               }
-               else
-               {
+               } else {
                        LOGD("pre-buffering...\n");
 
                        if (IS_MUXED_BUFFERING_MODE(streamer))
@@ -251,34 +241,26 @@ streaming_check_buffer_percent(gdouble in_low, gdouble in_high, gdouble *out_low
        MMPLAYER_RETURN_IF_FAIL(out_low && out_high);
 
        if (in_low <= MIN_BUFFER_PERCENT || in_low >= MAX_BUFFER_PERCENT)
-       {
                LOGW("buffer low percent is out of range. use defaut value.");
-       }
        else
-       {
                buffer_low_percent = in_low;
-       }
 
        if (in_high  <=  MIN_BUFFER_PERCENT || in_high  >=  MAX_BUFFER_PERCENT)
-       {
                LOGW("buffer high percent is out of range. use defaut value.");
-       }
        else
-       {
                buffer_high_percent = in_high;
-       }
 
        if (buffer_high_percent <= buffer_low_percent)
                buffer_high_percent =  buffer_low_percent + 1.0;
 
-       LOGD("set buffer percent to %2.3f ~ %2.3f.",  buffer_low_percent, buffer_high_percent);
+       LOGD("set buffer percent to %2.3f ~ %2.3f.", buffer_low_percent, buffer_high_percent);
 
        *out_low = buffer_low_percent;
        *out_high = buffer_high_percent;
 }
 
 static void
-streaming_set_buffer_percent(  mm_player_streaming_t* streamer,
+streaming_set_buffer_percent(mm_player_streaming_t* streamer,
                                                                BufferType type,
                                                                gdouble low_percent,
                                                                gdouble high_percent_byte,
@@ -296,16 +278,14 @@ streaming_set_buffer_percent(     mm_player_streaming_t* streamer,
        MMPLAYER_RETURN_IF_FAIL(type < BUFFER_TYPE_MAX);
 
        buffer_handle = &(streamer->buffer_handle[type]);
-       if (!(buffer_handle && buffer_handle->buffer))
-       {
+       if (!(buffer_handle && buffer_handle->buffer)) {
                LOGE("buffer_handle->buffer is NULL!");
                return;
        }
 
        factory_name = GST_OBJECT_NAME(gst_element_get_factory(buffer_handle->buffer));
 
-       if (!factory_name)
-       {
+       if (!factory_name) {
                LOGE("Fail to get factory name!");
                return;
        }
@@ -323,15 +303,11 @@ streaming_set_buffer_percent(     mm_player_streaming_t* streamer,
 
        if ((confirmed_low == DEFAULT_BUFFER_LOW_PERCENT) ||
                (buffer_handle->buffer_low_percent != confirmed_low))
-       {
-               g_object_set (G_OBJECT(buffer_handle->buffer), "low-percent", (gint)confirmed_low, NULL);
-       }
+               g_object_set(G_OBJECT(buffer_handle->buffer), "low-percent", (gint)confirmed_low, NULL);
 
        if ((confirmed_high == DEFAULT_BUFFER_HIGH_PERCENT) ||
                (buffer_handle->buffer_high_percent != confirmed_high))
-       {
-               g_object_set (G_OBJECT(buffer_handle->buffer), "high-percent", (gint)confirmed_high, NULL);
-       }
+               g_object_set(G_OBJECT(buffer_handle->buffer), "high-percent", (gint)confirmed_high, NULL);
 
        buffer_handle->buffer_low_percent = confirmed_low;
        buffer_handle->buffer_high_percent = confirmed_high;
@@ -341,7 +317,7 @@ streaming_set_buffer_percent(       mm_player_streaming_t* streamer,
 }
 
 static void
-streaming_set_queue2_queue_type (mm_player_streaming_t* streamer, muxed_buffer_type_e type, gchar * file_path, guint64 content_size)
+streaming_set_queue2_queue_type(mm_player_streaming_t* streamer, muxed_buffer_type_e type, gchar * file_path, guint64 content_size)
 {
        streaming_buffer_t* buffer_handle = NULL;
        guint64 storage_available_size = 0L; //bytes
@@ -356,30 +332,26 @@ streaming_set_queue2_queue_type (mm_player_streaming_t* streamer, muxed_buffer_t
 
        buffer_handle = &(streamer->buffer_handle[BUFFER_TYPE_MUXED]);
 
-       if (!(buffer_handle && buffer_handle->buffer))
-       {
+       if (!(buffer_handle && buffer_handle->buffer)) {
                LOGE("buffer_handle->buffer is NULL!");
                return;
        }
 
        factory_name = GST_OBJECT_NAME(gst_element_get_factory(buffer_handle->buffer));
 
-       if (!factory_name)
-       {
+       if (!factory_name) {
                LOGE("Fail to get factory name!");
                return;
        }
 
        LOGD("target buffer elem : %s", GST_ELEMENT_NAME(buffer_handle->buffer));
 
-       if (!g_strrstr(factory_name, "queue2"))
-       {
+       if (!g_strrstr(factory_name, "queue2")) {
                LOGD("only queue2 can use file buffer. not decodebin2 or multiQ\n");
                return;
        }
 
-       if ((type == MUXED_BUFFER_TYPE_MEM_QUEUE) || (!g_strrstr(factory_name, "queue2")))
-       {
+       if ((type == MUXED_BUFFER_TYPE_MEM_QUEUE) || (!g_strrstr(factory_name, "queue2"))) {
                LOGD("use memory queue for buffering. streaming is played on push-based. \n"
                                        "buffering position would not be updated.\n"
                                        "buffered data would be flushed after played.\n"
@@ -388,21 +360,18 @@ streaming_set_queue2_queue_type (mm_player_streaming_t* streamer, muxed_buffer_t
        }
 
        LOGD("[Queue2] buffering type : %d. streaming is played on pull-based. \n", type);
-       if (type == MUXED_BUFFER_TYPE_FILE && file_path && strlen(file_path)>0) {
-               if (statfs((const char *)file_path, &buf) < 0)
-               {
-                       LOGW ("[Queue2] fail to get available storage capacity. set mem ring buffer instead of file buffer.\n");
-                       buffer_size = (guint64)((streamer->ring_buffer_size>0)?(streamer->ring_buffer_size):DEFAULT_RING_BUFFER_SIZE);
-               }
-               else
-               {
+       if (type == MUXED_BUFFER_TYPE_FILE && file_path && strlen(file_path) > 0) {
+               if (statfs((const char *)file_path, &buf) < 0) {
+                       LOGW("[Queue2] fail to get available storage capacity. set mem ring buffer instead of file buffer.\n");
+                       buffer_size = (guint64)((streamer->ring_buffer_size > 0) ? (streamer->ring_buffer_size) : DEFAULT_RING_BUFFER_SIZE);
+               } else {
                        storage_available_size = (guint64)buf.f_bavail * (guint64)buf.f_bsize; //bytes
 
-                       LOGD ("[Queue2] the number of available blocks : %"G_GUINT64_FORMAT
+                       LOGD("[Queue2] the number of available blocks : %"G_GUINT64_FORMAT
                                                ", the block size is %"G_GUINT64_FORMAT".\n",
                                                (guint64)buf.f_bavail, (guint64)buf.f_bsize);
 
-                       LOGD ("[Queue2] calculated available storage size is %"
+                       LOGD("[Queue2] calculated available storage size is %"
                                                                G_GUINT64_FORMAT" Bytes.\n", storage_available_size);
 
                        if (content_size <= 0 || content_size >= storage_available_size)
@@ -413,14 +382,13 @@ streaming_set_queue2_queue_type (mm_player_streaming_t* streamer, muxed_buffer_t
                        g_snprintf(file_buffer_name, MM_MAX_URL_LEN, "%sXXXXXX", file_path);
                        SECURE_LOGD("[Queue2] the buffering file name is %s.\n", file_buffer_name);
 
-                       g_object_set (G_OBJECT(buffer_handle->buffer), "temp-template", file_buffer_name, NULL);
+                       g_object_set(G_OBJECT(buffer_handle->buffer), "temp-template", file_buffer_name, NULL);
                }
-       } else {
-               buffer_size = (guint64)((streamer->ring_buffer_size>0)?(streamer->ring_buffer_size):DEFAULT_RING_BUFFER_SIZE);
-       }
+       } else
+               buffer_size = (guint64)((streamer->ring_buffer_size > 0) ? (streamer->ring_buffer_size) : DEFAULT_RING_BUFFER_SIZE);
 
-       LOGW ("[Queue2] set ring buffer size: %lld\n", buffer_size);
-       g_object_set (G_OBJECT(buffer_handle->buffer), "ring-buffer-max-size", buffer_size, NULL);
+       LOGW("[Queue2] set ring buffer size: %lld\n", buffer_size);
+       g_object_set(G_OBJECT(buffer_handle->buffer), "ring-buffer-max-size", buffer_size, NULL);
 
        MMPLAYER_FLEAVE();
        return;
@@ -439,41 +407,34 @@ streaming_set_buffer_size(mm_player_streaming_t* streamer, BufferType type, guin
 
        buffer_handle = &(streamer->buffer_handle[type]);
 
-       if (buffer_handle && buffer_handle->buffer)
-       {
-               if (g_strrstr(GST_ELEMENT_NAME(buffer_handle->buffer), "multiqueue"))
-               {
+       if (buffer_handle && buffer_handle->buffer) {
+               if (g_strrstr(GST_ELEMENT_NAME(buffer_handle->buffer), "multiqueue")) {
                        if (buffering_time <= 0)
                                buffering_time = GET_CURRENT_BUFFERING_TIME(buffer_handle);
 
-                       g_object_set (G_OBJECT(buffer_handle->buffer),
-                                                       "max-size-bytes", GET_MAX_BUFFER_BYTES(streamer), /* mq size is fixed, control it with high/low percent value*/
+                       g_object_set(G_OBJECT(buffer_handle->buffer),
+                                                       "max-size-bytes", GET_MAX_BUFFER_BYTES(streamer),       /* mq size is fixed, control it with high/low percent value*/
                                                        "max-size-time", ((guint)ceil(buffering_time) * GST_SECOND),
-                                                       "max-size-buffers", 0, NULL);                                     /* disable */
+                                                       "max-size-buffers", 0, NULL);                                           /* disable */
 
                        buffer_handle->buffering_time = buffering_time;
                        buffer_handle->buffering_bytes = GET_MAX_BUFFER_BYTES(streamer);
 
                        LOGD("max-size-time : %f", buffering_time);
-               }
-               else    /* queue2 */
-               {
+               } else {
+                       /* queue2 */
                        if (buffer_handle->is_live)
-                       {
-                               g_object_set (G_OBJECT(buffer_handle->buffer),
+                               g_object_set(G_OBJECT(buffer_handle->buffer),
                                                                "max-size-bytes", buffering_bytes,
                                                                "max-size-time", (guint64)(buffering_time*GST_SECOND),
                                                                "max-size-buffers", 0,
                                                                "use-rate-estimate", TRUE, NULL);
-                       }
                        else
-                       {
-                               g_object_set (G_OBJECT(buffer_handle->buffer),
+                               g_object_set(G_OBJECT(buffer_handle->buffer),
                                                                "max-size-bytes", buffering_bytes,
                                                                "max-size-time", (guint64)0,
                                                                "max-size-buffers", 0,
                                                                "use-rate-estimate", FALSE, NULL);
-                       }
 
                        buffer_handle->buffering_bytes = buffering_bytes;
                        buffer_handle->buffering_time = buffering_time;
@@ -486,7 +447,7 @@ streaming_set_buffer_size(mm_player_streaming_t* streamer, BufferType type, guin
        return;
 }
 
-void __mm_player_streaming_set_queue2(         mm_player_streaming_t* streamer,
+void __mm_player_streaming_set_queue2(mm_player_streaming_t* streamer,
                                                                                GstElement* buffer,
                                                                                gboolean use_buffering,
                                                                                guint buffering_bytes,
@@ -500,25 +461,20 @@ void __mm_player_streaming_set_queue2(    mm_player_streaming_t* streamer,
        MMPLAYER_FENTER();
        MMPLAYER_RETURN_IF_FAIL(streamer);
 
-       if (buffer)
-       {
-               LOGD("USE-BUFFERING : %s", (use_buffering)?"OOO":"XXX");
+       if (buffer) {
+               LOGD("USE-BUFFERING : %s", (use_buffering) ? "OOO" : "XXX");
 
                streamer->buffer_handle[BUFFER_TYPE_MUXED].buffer = buffer;
 
-               if (use_buffering)
-               {
+               if (use_buffering) {
                        streamer->streaming_buffer_type = BUFFER_TYPE_MUXED;
 
-                       if (content_size > 0)
-                       {
+                       if (content_size > 0) {
                                if (streamer->buffering_req.initial_second > 0)
-                                       streamer->buffering_req.is_pre_buffering = TRUE;
+                                       streamer->buffering_req.is_pre_buffering = TRUE;
                                else
                                        streamer->buffering_req.initial_second = (gint)ceil(buffering_time);
-                       }
-                       else
-                       {
+                       } else {
                                LOGD("live streaming without mq");
 
                                streamer->buffer_handle[BUFFER_TYPE_MUXED].is_live = TRUE;
@@ -526,12 +482,12 @@ void __mm_player_streaming_set_queue2(    mm_player_streaming_t* streamer,
                        }
                }
 
-               g_object_set ( G_OBJECT (streamer->buffer_handle[BUFFER_TYPE_MUXED].buffer), "use-buffering", use_buffering, NULL );
+               g_object_set(G_OBJECT(streamer->buffer_handle[BUFFER_TYPE_MUXED].buffer), "use-buffering", use_buffering, NULL);
        }
 
-       streaming_set_buffer_size               (streamer, BUFFER_TYPE_MUXED, buffering_bytes, buffering_time);
-       streaming_set_buffer_percent    (streamer, BUFFER_TYPE_MUXED, low_percent, high_percent, 0);
-       streaming_set_queue2_queue_type (streamer, type, file_path, content_size);
+       streaming_set_buffer_size(streamer, BUFFER_TYPE_MUXED, buffering_bytes, buffering_time);
+       streaming_set_buffer_percent(streamer, BUFFER_TYPE_MUXED, low_percent, high_percent, 0);
+       streaming_set_queue2_queue_type(streamer, type, file_path, content_size);
 
        MMPLAYER_FLEAVE();
        return;
@@ -543,13 +499,12 @@ void __mm_player_streaming_sync_property(mm_player_streaming_t* streamer, GstEle
 
        MMPLAYER_FENTER();
 
-       MMPLAYER_RETURN_IF_FAIL ( streamer && decodebin );
+       MMPLAYER_RETURN_IF_FAIL(streamer && decodebin);
 
        buffer_handle = &(streamer->buffer_handle[BUFFER_TYPE_DEMUXED]);
 
-       if ((streamer->need_sync) && (streamer->streaming_buffer_type == BUFFER_TYPE_DEMUXED))
-       {
-               g_object_set (G_OBJECT(decodebin),
+       if ((streamer->need_sync) && (streamer->streaming_buffer_type == BUFFER_TYPE_DEMUXED)) {
+               g_object_set(G_OBJECT(decodebin),
                                        "max-size-bytes", buffer_handle->buffering_bytes,
                                        "max-size-time", (guint64)(ceil(buffer_handle->buffering_time) * GST_SECOND),
                                        "low-percent", (gint)buffer_handle->buffer_low_percent,
@@ -560,7 +515,7 @@ void __mm_player_streaming_sync_property(mm_player_streaming_t* streamer, GstEle
        streamer->need_sync = FALSE;
 }
 
-void __mm_player_streaming_set_multiqueue(     mm_player_streaming_t* streamer,
+void __mm_player_streaming_set_multiqueue(mm_player_streaming_t* streamer,
                                                                                GstElement* buffer,
                                                                                gboolean use_buffering,
                                                                                gdouble buffering_time,
@@ -576,12 +531,10 @@ void __mm_player_streaming_set_multiqueue(        mm_player_streaming_t* streamer,
        buffer_handle = &(streamer->buffer_handle[BUFFER_TYPE_DEMUXED]);
        pre_buffering_time = (gdouble)streamer->buffering_req.initial_second;
 
-       if (buffer)
-       {
+       if (buffer) {
                buffer_handle->buffer = buffer;
 
-               if (use_buffering)
-               {
+               if (use_buffering) {
                        streamer->streaming_buffer_type = BUFFER_TYPE_DEMUXED;
 
                        // during prebuffering by requirement, buffer setting should not be changed.
@@ -589,22 +542,21 @@ void __mm_player_streaming_set_multiqueue(        mm_player_streaming_t* streamer,
                                streamer->buffering_req.is_pre_buffering = TRUE;
                }
 
-               g_object_set ( G_OBJECT (buffer_handle->buffer), "use-buffering", use_buffering, NULL );
+               g_object_set(G_OBJECT(buffer_handle->buffer), "use-buffering", use_buffering, NULL);
        }
 
-       LOGD ("pre_buffering: %2.2f, during playing: %2.2f\n", pre_buffering_time, buffering_time);
+       LOGD("pre_buffering: %2.2f, during playing: %2.2f\n", pre_buffering_time, buffering_time);
 
-       if (pre_buffering_time <= 0.0)
-       {
+       if (pre_buffering_time <= 0.0) {
                pre_buffering_time = GET_DEFAULT_PLAYING_TIME(streamer);
                streamer->buffering_req.initial_second = (gint)ceil(buffering_time);
        }
 
        high_percent = (pre_buffering_time * 100) / GET_MAX_BUFFER_TIME(streamer);
-       LOGD ("high_percent %2.3f %%\n", high_percent);
+       LOGD("high_percent %2.3f %%\n", high_percent);
 
-       streaming_set_buffer_size (streamer, BUFFER_TYPE_DEMUXED, GET_MAX_BUFFER_BYTES(streamer), GET_MAX_BUFFER_TIME(streamer));
-       streaming_set_buffer_percent (streamer, BUFFER_TYPE_DEMUXED, low_percent, 0, high_percent);
+       streaming_set_buffer_size(streamer, BUFFER_TYPE_DEMUXED, GET_MAX_BUFFER_BYTES(streamer), GET_MAX_BUFFER_TIME(streamer));
+       streaming_set_buffer_percent(streamer, BUFFER_TYPE_DEMUXED, low_percent, 0, high_percent);
 
        streamer->need_sync = TRUE;
 
@@ -613,7 +565,7 @@ void __mm_player_streaming_set_multiqueue(  mm_player_streaming_t* streamer,
 }
 
 static void
-streaming_get_current_bitrate_info(    mm_player_streaming_t* streamer,
+streaming_get_current_bitrate_info(mm_player_streaming_t* streamer,
                                                                        GstMessage *buffering_msg,
                                                                        streaming_content_info_t content_info,
                                                                        streaming_bitrate_info_t* bitrate_info)
@@ -638,29 +590,21 @@ streaming_get_current_bitrate_info(       mm_player_streaming_t* streamer,
        if ((buffering_msg == NULL) ||
                ((streamer->buffer_handle[BUFFER_TYPE_DEMUXED].buffer != NULL) &&
                (streamer->buffer_handle[BUFFER_TYPE_MUXED].buffer != NULL) &&
-               (buffering_msg->src == (GstObject *)streamer->buffer_handle[BUFFER_TYPE_DEMUXED].buffer)))
-       {
-               query = gst_query_new_buffering (GST_FORMAT_PERCENT);
-
-               if (gst_element_query ((streamer->buffer_handle[BUFFER_TYPE_MUXED].buffer), query))
-               {
-                       gst_query_parse_buffering_stats (query, &mode, &in_rate, &out_rate, &buffering_left);
-               }
+               (buffering_msg->src == (GstObject *)streamer->buffer_handle[BUFFER_TYPE_DEMUXED].buffer))) {
+               query = gst_query_new_buffering(GST_FORMAT_PERCENT);
 
-               gst_query_unref (query);
-       }
-       else
-       {
-               gst_message_parse_buffering_stats (buffering_msg, &mode, &in_rate, &out_rate, &buffering_left);
-       }
+               if (gst_element_query((streamer->buffer_handle[BUFFER_TYPE_MUXED].buffer), query))
+                       gst_query_parse_buffering_stats(query, &mode, &in_rate, &out_rate, &buffering_left);
+               gst_query_unref(query);
+       } else
+               gst_message_parse_buffering_stats(buffering_msg, &mode, &in_rate, &out_rate, &buffering_left);
 
-       LOGD ("Streaming Info : in %d, out %d, left %lld\n", in_rate, out_rate, buffering_left);
+       LOGD("Streaming Info : in %d, out %d, left %lld\n", in_rate, out_rate, buffering_left);
 
        if ((content_info.content_size > 0) && (content_info.duration > 0) && ((content_info.duration/GST_SECOND) > 0))
                estimated_content_bitrate = GET_BIT_FROM_BYTE((guint)(content_info.content_size / (content_info.duration/GST_SECOND)));
 
-       if (streamer->buffer_max_bitrate > 0)
-       {
+       if (streamer->buffer_max_bitrate > 0) {
                streamer->buffer_max_bitrate = MAX(streamer->buffer_max_bitrate, streamer->buffer_avg_bitrate);
                streamer->buffer_max_bitrate = MAX(streamer->buffer_max_bitrate, estimated_content_bitrate);
 
@@ -673,19 +617,14 @@ streaming_get_current_bitrate_info(       mm_player_streaming_t* streamer,
                else
                        out_rate = GET_BYTE_FROM_BIT(streamer->buffer_max_bitrate/3);
 
-               LOGD ("(max)content_max_byte_rate %d, byte_out_rate %d\n", buffer_criteria, out_rate);
-       }
-       else if (streamer->buffer_avg_bitrate > 0)
-       {
+               LOGD("(max)content_max_byte_rate %d, byte_out_rate %d\n", buffer_criteria, out_rate);
+       } else if (streamer->buffer_avg_bitrate > 0) {
                buffer_criteria = GET_BYTE_FROM_BIT(streamer->buffer_avg_bitrate * 3);
-               out_rate = GET_BYTE_FROM_BIT(MAX(streamer->buffer_avg_bitrate,estimated_content_bitrate));
+               out_rate = GET_BYTE_FROM_BIT(MAX(streamer->buffer_avg_bitrate, estimated_content_bitrate));
 
-               LOGD ("(avg)content_max_byte_rate %d, byte_out_rate %d\n", buffer_criteria, out_rate);
-       }
-       else
-       {
-               LOGW ("There is no content bitrate information\n");
-       }
+               LOGD("(avg)content_max_byte_rate %d, byte_out_rate %d\n", buffer_criteria, out_rate);
+       } else
+               LOGW("There is no content bitrate information\n");
 
        if ((in_rate > 0) && (out_rate > 0))
                buffer_buffering_time =  (gdouble)out_rate / (gdouble)in_rate;
@@ -701,7 +640,7 @@ streaming_get_current_bitrate_info( mm_player_streaming_t* streamer,
 }
 
 static void
-streaming_handle_fixed_buffering_mode( mm_player_streaming_t* streamer,
+streaming_handle_fixed_buffering_mode(mm_player_streaming_t* streamer,
                                                                                gint byte_out_rate,
                                                                                gdouble fixed_buffering_time,
                                                                                streaming_buffer_info_t* buffer_info)
@@ -719,25 +658,22 @@ streaming_handle_fixed_buffering_mode(    mm_player_streaming_t* streamer,
        buffer_handle = &(streamer->buffer_handle[streamer->streaming_buffer_type]);
        buffering_time = fixed_buffering_time;
 
-       LOGD ("buffering time: %2.2f sec, out rate: %d\n", buffering_time, byte_out_rate);
+       LOGD("buffering time: %2.2f sec, out rate: %d\n", buffering_time, byte_out_rate);
 
-       if ((buffering_time > 0) && (byte_out_rate > 0))
-       {
+       if ((buffering_time > 0) && (byte_out_rate > 0)) {
                buffering_bytes = GET_NEW_BUFFERING_BYTE(byte_out_rate * buffering_time);
-       }
-       else
-       {
+       } else {
                if (buffering_time <= 0)
                        buffering_time = GET_CURRENT_BUFFERING_TIME(buffer_handle);
 
-               LOGW ("content bitrate is not updated yet.\n");
+               LOGW("content bitrate is not updated yet.\n");
                buffering_bytes = GET_CURRENT_BUFFERING_BYTE(buffer_handle);
        }
 
        GET_PERCENT(buffering_time, GET_CURRENT_BUFFERING_TIME(buffer_handle), buffer_handle->buffer_high_percent, per_time);
        GET_PERCENT(buffering_bytes, GET_CURRENT_BUFFERING_BYTE(buffer_handle), buffer_handle->buffer_high_percent, per_byte);
 
-       LOGD ("bytes %d, time %f, per_byte %f, per_time %f\n",
+       LOGD("bytes %d, time %f, per_byte %f, per_time %f\n",
                                                                                buffering_bytes, buffering_time, per_byte, per_time);
 
        (*buffer_info).buffering_bytes = buffering_bytes;
@@ -747,7 +683,7 @@ streaming_handle_fixed_buffering_mode(      mm_player_streaming_t* streamer,
 }
 
 static void
-streaming_handle_adaptive_buffering_mode(      mm_player_streaming_t* streamer,
+streaming_handle_adaptive_buffering_mode(mm_player_streaming_t* streamer,
                                                                                streaming_content_info_t content_info,
                                                                                streaming_bitrate_info_t bitrate_info,
                                                                                streaming_buffer_info_t* buffer_info,
@@ -766,29 +702,26 @@ streaming_handle_adaptive_buffering_mode( mm_player_streaming_t* streamer,
        MMPLAYER_RETURN_IF_FAIL(streamer);
        MMPLAYER_RETURN_IF_FAIL(buffer_info);
 
-       LOGD ("pos %lld, dur %lld, size %lld, in/out:%d/%d, buffer_criteria:%d, time_rate:%f, need:%d sec\n",
+       LOGD("pos %lld, dur %lld, size %lld, in/out:%d/%d, buffer_criteria:%d, time_rate:%f, need:%d sec\n",
                                                        content_info.position, content_info.duration, content_info.content_size,
                                                        bitrate_info.byte_in_rate, bitrate_info.byte_out_rate,
                                                        bitrate_info.buffer_criteria, bitrate_info.time_rate, expected_play_time);
 
        if (((expected_play_time == TO_THE_END) && (content_info.position <= 0)) ||
                (content_info.duration <= 0) ||
-               (content_info.content_size <= 0))
-       {
-               LOGW ("keep previous setting.\n");
+               (content_info.content_size <= 0)) {
+               LOGW("keep previous setting.\n");
                return;
        }
 
-       if ((bitrate_info.byte_out_rate <= 0) || (bitrate_info.buffer_criteria == 0))
-       {
-               LOGW ("keep previous setting.\n");
+       if ((bitrate_info.byte_out_rate <= 0) || (bitrate_info.buffer_criteria == 0)) {
+               LOGW("keep previous setting.\n");
                return;
        }
 
        buffer_handle = &(streamer->buffer_handle[streamer->streaming_buffer_type]);
 
-       if (bitrate_info.byte_in_rate < bitrate_info.byte_out_rate)
-       {
+       if (bitrate_info.byte_in_rate < bitrate_info.byte_out_rate) {
                if (expected_play_time != TO_THE_END)
                        portion = (double)(expected_play_time * GST_SECOND) / (double)content_info.duration;
                else
@@ -796,43 +729,34 @@ streaming_handle_adaptive_buffering_mode( mm_player_streaming_t* streamer,
 
                buffering_bytes = GET_NEW_BUFFERING_BYTE(((double)content_info.content_size * portion)  \
                                                                                                                        * (1 - (double)bitrate_info.byte_in_rate/(double)bitrate_info.byte_out_rate));
-       }
-       else
-       {
+       } else {
                /* buffering_bytes will be set as streamer->default_val.buffering_time *
                 * receiving rate is bigger than avg content bitrate
                 * so there is no reason to buffering. if the buffering msg is posted
                 * in-rate or contents bitrate has wrong value. */
-               LOGW ("don't need to do buffering.\n");
+               LOGW("don't need to do buffering.\n");
        }
 
        if (buffering_bytes > 0)
                buffer_buffering_time = (gdouble)buffering_bytes / (gdouble)bitrate_info.byte_out_rate;
 
-       if (content_info.position <= 0)
-       {
+       if (content_info.position <= 0) {
                /* if the buffer is filled under 50%, MSL use the original default buffering time.
                   if not, MSL use just 2 sec as a default buffering time. (to reduce initial buffering time) */
                default_buffering_time = streamer->default_val.buffering_time - ((gdouble)streamer->buffering_percent/50);
-       }
-       else
-       {
+       } else
                default_buffering_time = streamer->default_val.buffering_time;
-       }
 
-       if (buffer_buffering_time < default_buffering_time)
-       {
-               LOGD ("adjusted time: %2.2f -> %2.2f\n", buffer_buffering_time, default_buffering_time);
-               LOGD ("adjusted bytes : %d or %d or %d\n",
+       if (buffer_buffering_time < default_buffering_time) {
+               LOGD("adjusted time: %2.2f -> %2.2f\n", buffer_buffering_time, default_buffering_time);
+               LOGD("adjusted bytes : %d or %d or %d\n",
                        buffering_bytes,
                        (gint)(bitrate_info.byte_out_rate * buffer_buffering_time),
                        (gint)(bitrate_info.buffer_criteria * buffer_buffering_time));
 
+               /* start monitoring the abmormal state */
                if (content_info.position > 0)
-               {
-                       /* start monitoring the abmormal state */
                        streamer->default_val.buffering_monitor = TRUE;
-               }
 
                buffer_buffering_time = default_buffering_time;
                adj_buffering_bytes = GET_NEW_BUFFERING_BYTE(bitrate_info.byte_out_rate * (gint)ceil(buffer_buffering_time));
@@ -842,7 +766,7 @@ streaming_handle_adaptive_buffering_mode(   mm_player_streaming_t* streamer,
        GET_PERCENT(buffering_bytes, GET_CURRENT_BUFFERING_BYTE(buffer_handle), buffer_handle->buffer_high_percent, per_byte);
        GET_PERCENT(buffer_buffering_time, GET_CURRENT_BUFFERING_TIME(buffer_handle), buffer_handle->buffer_high_percent, per_time);
 
-       LOGD ("monitor %d, bytes %d, time %f, per_byte %f, per_time %f\n",
+       LOGD("monitor %d, bytes %d, time %f, per_byte %f, per_time %f\n",
                                                                                streamer->default_val.buffering_monitor,
                                                                                buffering_bytes, buffer_buffering_time, per_byte, per_time);
 
@@ -854,7 +778,7 @@ streaming_handle_adaptive_buffering_mode(   mm_player_streaming_t* streamer,
 }
 
 static void
-streaming_update_buffer_setting        (       mm_player_streaming_t* streamer,
+streaming_update_buffer_setting(mm_player_streaming_t* streamer,
                                                                        GstMessage *buffering_msg,      // can be null
                                                                        guint64 content_size,
                                                                        gint64 position,
@@ -871,7 +795,7 @@ streaming_update_buffer_setting     (       mm_player_streaming_t* streamer,
 
        MMPLAYER_FENTER();
 
-       MMPLAYER_RETURN_IF_FAIL ( streamer );
+       MMPLAYER_RETURN_IF_FAIL(streamer);
 
        memset(&buffer_info, 0x00, sizeof(streaming_buffer_info_t));
        memset(&content_info, 0x00, sizeof(streaming_content_info_t));
@@ -895,19 +819,17 @@ streaming_update_buffer_setting   (       mm_player_streaming_t* streamer,
 
        streaming_get_current_bitrate_info(streamer, buffering_msg, content_info, &bitrate_info);
 
-       LOGD ("buffering mode %d, new info in_r:%d, out_r:%d, cb:%d, bt:%f\n",
+       LOGD("buffering mode %d, new info in_r:%d, out_r:%d, cb:%d, bt:%f\n",
                                        buffering_mode, bitrate_info.byte_in_rate, bitrate_info.byte_out_rate,
                                        bitrate_info.buffer_criteria, bitrate_info.time_rate);
 
        /* calculate buffer low/high percent */
        low_percent = DEFAULT_BUFFER_LOW_PERCENT;
 
-       /********************
-        * (1) fixed mode   *
-        ********************/
-
-       if (buffering_mode == MM_PLAYER_BUFFERING_MODE_FIXED)
-       {
+       if (buffering_mode == MM_PLAYER_BUFFERING_MODE_FIXED) {
+               /********************
+                * (1) fixed mode   *
+                ********************/
                gdouble buffering_time = 0.0;
 
                if (streamer->buffering_req.is_pre_buffering == TRUE)
@@ -916,31 +838,21 @@ streaming_update_buffer_setting   (       mm_player_streaming_t* streamer,
                        buffering_time = (gdouble)streamer->buffering_req.runtime_second;
 
                streaming_handle_fixed_buffering_mode(streamer, bitrate_info.byte_out_rate, buffering_time, &buffer_info);
-       }
-
-       /***********************************
-        * (2) once mode for samsung link  *
-        ***********************************/
-       else if (buffering_mode == MM_PLAYER_BUFFERING_MODE_SLINK)
-       {
+       } else if (buffering_mode == MM_PLAYER_BUFFERING_MODE_SLINK) {
+               /***********************************
+                * (2) once mode for samsung link  *
+                ***********************************/
                streaming_handle_adaptive_buffering_mode(streamer, content_info, bitrate_info, &buffer_info, TO_THE_END);
-       }
-
-       /*********************************
-        * (3) adaptive mode (default)   *
-        *********************************/
-       else
-       {
+       } else {
+               /*********************************
+                * (3) adaptive mode (default)   *
+                *********************************/
                gint expected_play_time = DEFAULT_PLAYING_TIME;
 
                if (streamer->buffering_req.runtime_second > 0)
-               {
                        expected_play_time = streamer->buffering_req.runtime_second;
-               }
                else if ((position == 0) && (streamer->is_buffering))
-               {
                        expected_play_time = streamer->buffering_req.initial_second;
-               }
 
                if (expected_play_time <= 0)
                        expected_play_time = DEFAULT_PLAYING_TIME;
@@ -951,17 +863,15 @@ streaming_update_buffer_setting   (       mm_player_streaming_t* streamer,
                        buffer_handle->buffering_time = buffer_info.buffering_time;
        }
 
-       LOGD ("adj buffer(%d) %d->%d bytes/%2.2f->%2.2f sec\n",
+       LOGD("adj buffer(%d) %d->%d bytes/%2.2f->%2.2f sec\n",
                                        streamer->streaming_buffer_type,
                                        GET_CURRENT_BUFFERING_BYTE(buffer_handle), buffer_info.buffering_bytes,
                                        GET_CURRENT_BUFFERING_TIME(buffer_handle), buffer_info.buffering_time);
 
        /* queue2 : bytes, multiqueue : time */
        if (((GET_CURRENT_BUFFERING_BYTE(buffer_handle) < buffer_info.buffering_bytes) && IS_MUXED_BUFFERING_MODE(streamer)) ||
-               ((GET_CURRENT_BUFFERING_TIME(buffer_handle) < buffer_info.buffering_time) && IS_DEMUXED_BUFFERING_MODE(streamer)))
-       {
-               if (duration > 0 && position > 0)
-               {
+               ((GET_CURRENT_BUFFERING_TIME(buffer_handle) < buffer_info.buffering_time) && IS_DEMUXED_BUFFERING_MODE(streamer))) {
+               if (duration > 0 && position > 0) {
                        gdouble buffering_time_limit = (gdouble)(duration - position)/GST_SECOND;
 
                        if (buffer_info.buffering_time > buffering_time_limit)
@@ -993,13 +903,12 @@ streaming_adjust_min_threshold(mm_player_streaming_t* streamer, gint64 position)
 
        playing_time = (gint)((position - streamer->default_val.prev_pos) / GST_SECOND);
 
-       LOGD ("buffering monitor = %s\n", (streamer->default_val.buffering_monitor)?"ON":"OFF");
-       LOGD ("playing_time ( %d sec) = %lld - %lld \n", playing_time, position, streamer->default_val.prev_pos);
-       LOGD ("default time : %2.3f, prev buffering t : %2.3f\n",
+       LOGD("buffering monitor = %s\n", (streamer->default_val.buffering_monitor) ? "ON" : "OFF");
+       LOGD("playing_time (%d sec) = %lld - %lld \n", playing_time, position, streamer->default_val.prev_pos);
+       LOGD("default time : %2.3f, prev buffering t : %2.3f\n",
                                        streamer->default_val.buffering_time, streamer->buffer_handle[streamer->streaming_buffer_type].buffering_time);
 
-       if ((streamer->default_val.buffering_monitor) && (playing_time <= (gint)streamer->default_val.buffering_time))
-       {
+       if ((streamer->default_val.buffering_monitor) && (playing_time <= (gint)streamer->default_val.buffering_time)) {
                gint time_gap = 0;
                time_gap = (gint)(streamer->default_val.buffering_time - DEFAULT_BUFFERING_TIME);
                if (time_gap <= 0)
@@ -1007,13 +916,10 @@ streaming_adjust_min_threshold(mm_player_streaming_t* streamer, gint64 position)
 
                streamer->default_val.buffering_time += time_gap*2;
                streamer->default_val.buffering_time = MIN(streamer->default_val.buffering_time, MAX_BUFFERING_TIME);
-       }
-       else
-       {
+       } else
                streamer->default_val.buffering_time = DEFAULT_BUFFERING_TIME;
-       }
 
-       LOGD ("new default min value %2.3f \n", streamer->default_val.buffering_time);
+       LOGD("new default min value %2.3f \n", streamer->default_val.buffering_time);
 
        streamer->default_val.buffering_monitor = FALSE;
        streamer->default_val.prev_pos = position;
@@ -1031,87 +937,72 @@ streaming_update_buffering_status(mm_player_streaming_t* streamer, GstMessage *b
        MMPLAYER_RETURN_IF_FAIL(buffering_msg);
 
        /* update when buffering has started. */
-       if ( !streamer->is_buffering )
-       {
+       if (!streamer->is_buffering) {
                streamer->is_buffering = TRUE;
                streamer->is_buffering_done = FALSE;
                streamer->buffering_percent = -1;
 
-               if (!streamer->buffering_req.is_pre_buffering)
-               {
+               if (!streamer->buffering_req.is_pre_buffering) {
                        streamer->need_update = TRUE;
                        streaming_adjust_min_threshold(streamer, position);
                }
        }
 
        /* update buffer percent */
-       gst_message_parse_buffering (buffering_msg, &buffer_percent);
+       gst_message_parse_buffering(buffering_msg, &buffer_percent);
 
-       if (streamer->buffering_percent < buffer_percent)
-       {
-               LOGD ("[%s] buffering %d%%....\n",
+       if (streamer->buffering_percent < buffer_percent) {
+               LOGD("[%s] buffering %d%%....\n",
                        GST_OBJECT_NAME(GST_MESSAGE_SRC(buffering_msg)), buffer_percent);
                streamer->buffering_percent = buffer_percent;
-       }
-       else
-       {
+       } else
                increased_per = FALSE;
-       }
 
-       if ((streamer->buffering_percent == MAX_BUFFER_PERCENT) || (streamer->is_buffering_done == TRUE))
-       {
+       if ((streamer->buffering_percent == MAX_BUFFER_PERCENT) || (streamer->is_buffering_done == TRUE)) {
                streamer->is_buffering = FALSE;
                streamer->buffering_req.is_pre_buffering = FALSE;
                if (streamer->buffering_percent == MAX_BUFFER_PERCENT)
                        streamer->is_buffering_done = FALSE;
                else
                        streamer->buffering_percent = MAX_BUFFER_PERCENT;
-       }
-       else
-       {
+       } else {
                /* need to update periodically in case of slink mode */
                if ((increased_per == TRUE) &&
                        (buffer_percent%10 == 0) &&
                        (streamer->buffering_req.mode == MM_PLAYER_BUFFERING_MODE_SLINK) &&
-                       (streamer->buffering_req.is_pre_buffering == FALSE))
-               {
+                       (streamer->buffering_req.is_pre_buffering == FALSE)) {
                        /* Update buffer setting to reflect data receiving rate for slink mode */
                        streamer->need_update = TRUE;
                }
        }
 }
 
-void __mm_player_streaming_buffering( mm_player_streaming_t* streamer,
-                                                                         GstMessage *buffering_msg,
-                                                                         guint64 content_size,
-                                                                         gint64 position,
-                                                                         gint64 duration)
+void __mm_player_streaming_buffering(mm_player_streaming_t* streamer,
+                                                                               GstMessage *buffering_msg,
+                                                                               guint64 content_size,
+                                                                               gint64 position,
+                                                                               gint64 duration)
 {
        MMPLAYER_FENTER();
 
-       MMPLAYER_RETURN_IF_FAIL ( streamer );
-       MMPLAYER_RETURN_IF_FAIL ( buffering_msg );
-       MMPLAYER_RETURN_IF_FAIL ( GST_IS_MESSAGE ( buffering_msg ) );
-       MMPLAYER_RETURN_IF_FAIL ( (GST_MESSAGE_TYPE ( buffering_msg ) == GST_MESSAGE_BUFFERING) );
+       MMPLAYER_RETURN_IF_FAIL(streamer);
+       MMPLAYER_RETURN_IF_FAIL(buffering_msg);
+       MMPLAYER_RETURN_IF_FAIL(GST_IS_MESSAGE(buffering_msg));
+       MMPLAYER_RETURN_IF_FAIL((GST_MESSAGE_TYPE(buffering_msg) == GST_MESSAGE_BUFFERING));
 
-       if (buffering_msg)
-       {
+       if (buffering_msg) {
                if (position > (gint64)(streamer->buffering_req.initial_second * GST_SECOND))
                        streamer->buffering_req.is_pre_buffering = FALSE;
 
                streaming_update_buffering_status(streamer, buffering_msg, position);
 
                if (!streamer->need_update)
-               {
-                       //LOGD ("don't need to update buffering stats during buffering.\n");
                        return;
-               }
 
                streamer->need_update = FALSE;
        }
 
-       streaming_update_buffer_setting (streamer, buffering_msg, content_size, position, duration);
+       streaming_update_buffer_setting(streamer, buffering_msg, content_size, position, duration);
 
        return;
 }
-