[0.6.164] Apply tizen coding rule
[platform/core/multimedia/libmm-player.git] / src / mm_player_gst.c
index 11749a6..9948122 100644 (file)
@@ -138,7 +138,7 @@ __mmplayer_gst_transform_error_decode(mm_player_t *player, const char *klass)
                        if (player->pipeline->audiobin) { // PCM
                                return MM_ERROR_PLAYER_VIDEO_CODEC_NOT_FOUND;
                        } else {
-                               LOGD("not found any available codec. Player should be destroyed.\n");
+                               LOGD("not found any available codec. Player should be destroyed.");
                                return MM_ERROR_PLAYER_CODEC_NOT_FOUND;
                        }
                }
@@ -166,17 +166,17 @@ __mmplayer_gst_transform_error_failed(mm_player_t *player, const char *klass, GE
 
        if (strncasecmp(klass, "audio", 5)) {
                if ((player->can_support_codec & FOUND_PLUGIN_VIDEO)) {
-                       LOGD("Video can keep playing.\n");
+                       LOGD("Video can keep playing.");
                        return MM_ERROR_PLAYER_AUDIO_CODEC_NOT_FOUND;
                }
        } else if (strncasecmp(klass, "video", 5)) {
                if ((player->can_support_codec & FOUND_PLUGIN_AUDIO)) {
-                       LOGD("Audio can keep playing.\n");
+                       LOGD("Audio can keep playing.");
                        return MM_ERROR_PLAYER_VIDEO_CODEC_NOT_FOUND;
                }
        }
 
-       LOGD("not found any available codec. Player should be destroyed.\n");
+       LOGD("not found any available codec. Player should be destroyed.");
        return MM_ERROR_PLAYER_CODEC_NOT_FOUND;
 }
 
@@ -194,6 +194,7 @@ __mmplayer_gst_transform_error_decrypt(mm_player_t *player, GError *error)
 
        return MM_ERROR_PLAYER_DRM_NOT_AUTHORIZED;
 }
+
 /* NOTE : decide gstreamer state whether there is some playable track or not. */
 static gint
 __mmplayer_gst_transform_gsterror(mm_player_t *player, GstMessage *message, GError *error)
@@ -228,7 +229,7 @@ __mmplayer_gst_transform_gsterror(mm_player_t *player, GstMessage *message, GErr
        if (!klass)
                return MM_ERROR_PLAYER_INTERNAL;
 
-       LOGD("error code=%d, msg=%s, src element=%s, class=%s\n",
+       LOGD("error code=%d, msg=%s, src element=%s, class=%s",
                        error->code, error->message, src_element_name, klass);
 
        if (!__mmplayer_check_error_posted_from_activated_track(player, src_element_name))
@@ -245,7 +246,7 @@ __mmplayer_gst_transform_gsterror(mm_player_t *player, GstMessage *message, GErr
                return __mmplayer_gst_transform_error_failed(player, klass, error);
        case GST_STREAM_ERROR_DECRYPT:
        case GST_STREAM_ERROR_DECRYPT_NOKEY:
-               LOGE("decryption error, [%s] failed, reason : [%s]\n", src_element_name, error->message);
+               LOGE("decryption error, [%s] failed, reason : [%s]", src_element_name, error->message);
                return __mmplayer_gst_transform_error_decrypt(player, error);
        default:
                break;
@@ -257,7 +258,7 @@ __mmplayer_gst_transform_gsterror(mm_player_t *player, GstMessage *message, GErr
 }
 
 gint
-__mmplayer_gst_handle_core_error(mm_player_tplayer, int code)
+__mmplayer_gst_handle_core_error(mm_player_t *player, int code)
 {
        gint trans_err = MM_ERROR_NONE;
 
@@ -292,7 +293,7 @@ __mmplayer_gst_handle_core_error(mm_player_t* player, int code)
 }
 
 gint
-__mmplayer_gst_handle_library_error(mm_player_tplayer, int code)
+__mmplayer_gst_handle_library_error(mm_player_t *player, int code)
 {
        gint trans_err = MM_ERROR_NONE;
 
@@ -318,7 +319,7 @@ __mmplayer_gst_handle_library_error(mm_player_t* player, int code)
 }
 
 gint
-__mmplayer_gst_handle_resource_error(mm_player_t* player, int code, GstMessage * message)
+__mmplayer_gst_handle_resource_error(mm_player_t *player, int code, GstMessage *message)
 {
        gint trans_err = MM_ERROR_NONE;
 
@@ -379,7 +380,7 @@ __mmplayer_gst_handle_resource_error(mm_player_t* player, int code, GstMessage *
 }
 
 gint
-__mmplayer_gst_handle_stream_error(mm_player_t* player, GError* error, GstMessage * message)
+__mmplayer_gst_handle_stream_error(mm_player_t *player, GError *error, GstMessage *message)
 {
        gint trans_err = MM_ERROR_NONE;
 
@@ -417,7 +418,7 @@ __mmplayer_gst_handle_stream_error(mm_player_t* player, GError* error, GstMessag
 }
 
 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;
@@ -440,7 +441,7 @@ __mmplayer_handle_gst_error(mm_player_t* player, GstMessage * message, GError* e
        } else if (error->domain == GST_STREAM_ERROR) {
                msg_param.code = __mmplayer_gst_handle_stream_error(player, error, message);
        } else {
-               LOGW("This error domain is not defined.\n");
+               LOGW("This error domain is not defined.");
 
                /* we treat system error as an internal error */
                msg_param.code = MM_ERROR_PLAYER_INVALID_STREAM;
@@ -449,9 +450,9 @@ __mmplayer_handle_gst_error(mm_player_t* player, GstMessage * message, GError* e
        if (message->src) {
                msg_src_element = GST_ELEMENT_NAME(GST_ELEMENT_CAST(message->src));
 
-               msg_param.data = (void *) error->message;
+               msg_param.data = (void *)error->message;
 
-               LOGE("-Msg src : [%s]   Domain : [%s]   Error : [%s]  Code : [%d] is tranlated to error code : [0x%x]\n",
+               LOGE("-Msg src : [%s]   Domain : [%s]   Error : [%s]  Code : [%d] is tranlated to error code : [0x%x]",
                        msg_src_element, g_quark_to_string(error->domain), error->message, error->code, msg_param.code);
        }
 
@@ -477,8 +478,9 @@ __mmplayer_handle_gst_error(mm_player_t* player, GstMessage * message, GError* e
                MMPLAYER_POST_MSG(player, MM_MESSAGE_ERROR, &msg_param);
                /* don't post more if one was sent already */
                player->msg_posted = TRUE;
-       } else
-               LOGD("skip error post because it's sent already.\n");
+       } else {
+               LOGD("skip error post because it's sent already.");
+       }
 
        MMPLAYER_FLEAVE();
 
@@ -486,7 +488,7 @@ __mmplayer_handle_gst_error(mm_player_t* player, GstMessage * message, GError* e
 }
 
 static gboolean
-__mmplayer_handle_streaming_error(mm_player_t* player, GstMessage * message)
+__mmplayer_handle_streaming_error(mm_player_t *player, GstMessage *message)
 {
        LOGD("\n");
        MMMessageParamType msg_param;
@@ -651,13 +653,13 @@ __mmplayer_handle_streaming_error(mm_player_t* player, GstMessage * message)
 
        error_string = g_strdup(gst_structure_get_string(s, "error_string"));
        if (error_string)
-               msg_param.data = (void *) error_string;
+               msg_param.data = (void *)error_string;
 
        if (message->src) {
                msg_src_element = GST_ELEMENT_NAME(GST_ELEMENT_CAST(message->src));
 
-               LOGE("-Msg src : [%s] Code : [%x] Error : [%s]  \n",
-                       msg_src_element, msg_param.code, (char*)msg_param.data);
+               LOGE("-Msg src : [%s] Code : [%x] Error : [%s]",
+                       msg_src_element, msg_param.code, (char *)msg_param.data);
        }
 
        /* post error to application */
@@ -666,11 +668,12 @@ __mmplayer_handle_streaming_error(mm_player_t* player, GstMessage * message)
 
                /* don't post more if one was sent already */
                player->msg_posted = TRUE;
-       } else
-               LOGD("skip error post because it's sent already.\n");
+       } else {
+               LOGD("skip error post because it's sent already.");
+       }
 
        gst_structure_free(s);
-       g_free(error_string);
+       MMPLAYER_FREEIF(error_string);
 
        MMPLAYER_FLEAVE();
        return TRUE;
@@ -710,138 +713,144 @@ __mmplayer_get_metadata_360_from_tags(GstTagList *tags, mm_player_spherical_meta
 }
 
 static gboolean
-__mmplayer_gst_extract_tag_from_msg(mm_player_t* player, GstMessage* msg)
+__mmplayer_gst_extract_tag_from_msg(mm_player_t *player, GstMessage *msg)
 {
 
 /* macro for better code readability */
 #define MMPLAYER_UPDATE_TAG_STRING(gsttag, attribute, playertag) \
-if (gst_tag_list_get_string(tag_list, gsttag, &string)) {\
-       if (string != NULL) { \
-               SECURE_LOGD("update tag string : %s\n", string); \
-               if (strlen(string) > MM_MAX_STRING_LENGTH) { \
-                       char *new_string = malloc(MM_MAX_STRING_LENGTH); \
-                       strncpy(new_string, string, MM_MAX_STRING_LENGTH-1); \
-                       new_string[MM_MAX_STRING_LENGTH-1] = '\0'; \
-                       mm_attrs_set_string_by_name(attribute, playertag, new_string); \
-                       g_free(new_string); \
-                       new_string = NULL; \
-               } else { \
-                       mm_attrs_set_string_by_name(attribute, playertag, string); \
+       do { \
+               if (gst_tag_list_get_string(tag_list, gsttag, &string)) {\
+                       if (string != NULL) { \
+                               SECURE_LOGD("update tag string : %s", string); \
+                               if (strlen(string) > MM_MAX_STRING_LENGTH) { \
+                                       char *new_string = g_malloc(MM_MAX_STRING_LENGTH); \
+                                       strncpy(new_string, string, MM_MAX_STRING_LENGTH - 1); \
+                                       new_string[MM_MAX_STRING_LENGTH - 1] = '\0'; \
+                                       mm_attrs_set_string_by_name(attribute, playertag, new_string); \
+                                       MMPLAYER_FREEIF(new_string); \
+                               } else { \
+                                       mm_attrs_set_string_by_name(attribute, playertag, string); \
+                               } \
+                               MMPLAYER_FREEIF(string); \
+                       } \
                } \
-               g_free(string); \
-               string = NULL; \
-       } \
-}
+       } while (0)
 
 #define MMPLAYER_UPDATE_TAG_IMAGE(gsttag, attribute, playertag) \
-do {   \
-       GstSample *sample = NULL;\
-       if (gst_tag_list_get_sample_index(tag_list, gsttag, index, &sample)) {\
-               GstMapInfo info = GST_MAP_INFO_INIT;\
-               buffer = gst_sample_get_buffer(sample);\
-               if (!gst_buffer_map(buffer, &info, GST_MAP_READ)) {\
-                       LOGD("failed to get image data from tag");\
-                       gst_sample_unref(sample);\
-                       return FALSE;\
-               } \
-               SECURE_LOGD("update album cover data : %p, size : %d\n", info.data, info.size);\
-               MMPLAYER_FREEIF(player->album_art);\
-               player->album_art = (gchar *)g_malloc(info.size);\
-               if (player->album_art) {\
-                       memcpy(player->album_art, info.data, info.size);\
-                       mm_attrs_set_data_by_name(attribute, playertag, (void *)player->album_art, info.size);\
-                       if (MMPLAYER_IS_HTTP_LIVE_STREAMING(player)) {\
-                               msg_param.data = (void *)player->album_art;\
-                               msg_param.size = info.size;\
-                               MMPLAYER_POST_MSG(player, MM_MESSAGE_IMAGE_BUFFER, &msg_param);\
-                               SECURE_LOGD("post message image buffer data : %p, size : %d\n", info.data, info.size);\
+       do {    \
+               GstSample *sample = NULL;\
+               if (gst_tag_list_get_sample_index(tag_list, gsttag, index, &sample)) {\
+                       GstMapInfo info = GST_MAP_INFO_INIT;\
+                       buffer = gst_sample_get_buffer(sample);\
+                       if (!gst_buffer_map(buffer, &info, GST_MAP_READ)) {\
+                               LOGD("failed to get image data from tag");\
+                               gst_sample_unref(sample);\
+                               return FALSE;\
                        } \
-               } \
-               gst_buffer_unmap(buffer, &info);\
-               gst_sample_unref(sample);\
-       }       \
-} while (0)
+                       SECURE_LOGD("update album cover data : %p, size : %zu", info.data, info.size);\
+                       MMPLAYER_FREEIF(player->album_art);\
+                       player->album_art = (gchar *)g_malloc(info.size);\
+                       if (player->album_art) {\
+                               memcpy(player->album_art, info.data, info.size);\
+                               mm_attrs_set_data_by_name(attribute, playertag, (void *)player->album_art, info.size);\
+                               if (MMPLAYER_IS_HTTP_LIVE_STREAMING(player)) {\
+                                       msg_param.data = (void *)player->album_art;\
+                                       msg_param.size = info.size;\
+                                       MMPLAYER_POST_MSG(player, MM_MESSAGE_IMAGE_BUFFER, &msg_param);\
+                                       SECURE_LOGD("post message image buffer data : %p, size : %zu", info.data, info.size);\
+                               } \
+                       } \
+                       gst_buffer_unmap(buffer, &info);\
+                       gst_sample_unref(sample);\
+               }       \
+       } while (0)
 
 #define MMPLAYER_UPDATE_TAG_UINT(gsttag, attribute, playertag) \
-do {   \
-       if (gst_tag_list_get_uint(tag_list, gsttag, &v_uint)) { \
-               if (v_uint) { \
-                       int i = 0; \
-                       gchar *tag_list_str = NULL; \
-                       MMPlayerTrackType track_type = MM_PLAYER_TRACK_TYPE_AUDIO; \
-                       if (strstr(GST_OBJECT_NAME(msg->src), "audio")) \
-                               track_type = MM_PLAYER_TRACK_TYPE_AUDIO; \
-                       else if (strstr(GST_OBJECT_NAME(msg->src), "video")) \
-                               track_type = MM_PLAYER_TRACK_TYPE_VIDEO; \
-                       else \
-                               track_type = MM_PLAYER_TRACK_TYPE_TEXT; \
-                       if (!strncmp(gsttag, GST_TAG_BITRATE, strlen(GST_TAG_BITRATE))) { \
-                               if (track_type == MM_PLAYER_TRACK_TYPE_AUDIO) \
-                                       mm_attrs_set_int_by_name(attribute, "content_audio_bitrate", v_uint); \
-                               player->bitrate[track_type] = v_uint; \
-                               player->total_bitrate = 0; \
-                               for (i = 0; i < MM_PLAYER_STREAM_COUNT_MAX; i++) \
-                                       player->total_bitrate += player->bitrate[i]; \
-                               mm_attrs_set_int_by_name(attribute, playertag, player->total_bitrate); \
-                               SECURE_LOGD("update bitrate %d[bps] of stream #%d.\n", v_uint, (int)track_type); \
-                       } else if (!strncmp(gsttag, GST_TAG_MAXIMUM_BITRATE, strlen(GST_TAG_MAXIMUM_BITRATE))) { \
-                               player->maximum_bitrate[track_type] = v_uint; \
-                               player->total_maximum_bitrate = 0; \
-                               for (i = 0; i < MM_PLAYER_STREAM_COUNT_MAX; i++) \
-                                       player->total_maximum_bitrate += player->maximum_bitrate[i]; \
-                               mm_attrs_set_int_by_name(attribute, playertag, player->total_maximum_bitrate);\
-                               SECURE_LOGD("update maximum bitrate %d[bps] of stream #%d\n", v_uint, (int)track_type);\
-                       } else { \
-                               mm_attrs_set_int_by_name(attribute, playertag, v_uint); \
+       do {    \
+               if (gst_tag_list_get_uint(tag_list, gsttag, &v_uint)) { \
+                       if (v_uint) { \
+                               int i = 0; \
+                               MMPlayerTrackType track_type = MM_PLAYER_TRACK_TYPE_AUDIO; \
+                               if (strstr(GST_OBJECT_NAME(msg->src), "audio")) \
+                                       track_type = MM_PLAYER_TRACK_TYPE_AUDIO; \
+                               else if (strstr(GST_OBJECT_NAME(msg->src), "video")) \
+                                       track_type = MM_PLAYER_TRACK_TYPE_VIDEO; \
+                               else \
+                                       track_type = MM_PLAYER_TRACK_TYPE_TEXT; \
+                               if (!strncmp(gsttag, GST_TAG_BITRATE, strlen(GST_TAG_BITRATE))) { \
+                                       if (track_type == MM_PLAYER_TRACK_TYPE_AUDIO) \
+                                               mm_attrs_set_int_by_name(attribute, "content_audio_bitrate", v_uint); \
+                                       player->bitrate[track_type] = v_uint; \
+                                       player->total_bitrate = 0; \
+                                       for (i = 0; i < MM_PLAYER_STREAM_COUNT_MAX; i++) \
+                                               player->total_bitrate += player->bitrate[i]; \
+                                       mm_attrs_set_int_by_name(attribute, playertag, player->total_bitrate); \
+                                       SECURE_LOGD("update bitrate %d[bps] of stream #%d.", v_uint, (int)track_type); \
+                               } else if (!strncmp(gsttag, GST_TAG_MAXIMUM_BITRATE, strlen(GST_TAG_MAXIMUM_BITRATE))) { \
+                                       player->maximum_bitrate[track_type] = v_uint; \
+                                       player->total_maximum_bitrate = 0; \
+                                       for (i = 0; i < MM_PLAYER_STREAM_COUNT_MAX; i++) \
+                                               player->total_maximum_bitrate += player->maximum_bitrate[i]; \
+                                       mm_attrs_set_int_by_name(attribute, playertag, player->total_maximum_bitrate);\
+                                       SECURE_LOGD("update maximum bitrate %d[bps] of stream #%d", v_uint, (int)track_type);\
+                               } else { \
+                                       mm_attrs_set_int_by_name(attribute, playertag, v_uint); \
+                               } \
+                               v_uint = 0;\
                        } \
-                       v_uint = 0;\
-                       g_free(tag_list_str); \
                } \
-       } \
-} while (0)
+       } while (0)
 
 #define MMPLAYER_UPDATE_TAG_DATE(gsttag, attribute, playertag) \
-if (gst_tag_list_get_date(tag_list, gsttag, &date)) {\
-       if (date != NULL) {\
-               string = g_strdup_printf("%d", g_date_get_year(date));\
-               mm_attrs_set_string_by_name(attribute, playertag, string);\
-               SECURE_LOGD("metainfo year : %s\n", string);\
-               MMPLAYER_FREEIF(string);\
-               g_date_free(date);\
-       } \
-}
+       do { \
+               if (gst_tag_list_get_date(tag_list, gsttag, &date)) {\
+                       if (date != NULL) {\
+                               string = g_strdup_printf("%d", g_date_get_year(date));\
+                               mm_attrs_set_string_by_name(attribute, playertag, string);\
+                               SECURE_LOGD("metainfo year : %s", string);\
+                               MMPLAYER_FREEIF(string);\
+                               g_date_free(date);\
+                       } \
+               } \
+       } while (0)
 
 #define MMPLAYER_UPDATE_TAG_DATE_TIME(gsttag, attribute, playertag) \
-if (gst_tag_list_get_date_time(tag_list, gsttag, &datetime)) {\
-       if (datetime != NULL) {\
-               string = g_strdup_printf("%d", gst_date_time_get_year(datetime));\
-               mm_attrs_set_string_by_name(attribute, playertag, string);\
-               SECURE_LOGD("metainfo year : %s\n", string);\
-               MMPLAYER_FREEIF(string);\
-               gst_date_time_unref(datetime);\
-       } \
-}
+       do { \
+               if (gst_tag_list_get_date_time(tag_list, gsttag, &datetime)) {\
+                       if (datetime != NULL) {\
+                               string = g_strdup_printf("%d", gst_date_time_get_year(datetime));\
+                               mm_attrs_set_string_by_name(attribute, playertag, string);\
+                               SECURE_LOGD("metainfo year : %s", string);\
+                               MMPLAYER_FREEIF(string);\
+                               gst_date_time_unref(datetime);\
+                       } \
+               } \
+       } while(0)
 
 #define MMPLAYER_UPDATE_TAG_UINT64(gsttag, attribute, playertag) \
-if (gst_tag_list_get_uint64(tag_list, gsttag, &v_uint64)) {\
-       if (v_uint64) {\
-               /* FIXIT : don't know how to store date */\
-               g_assert(1);\
-               v_uint64 = 0;\
-       } \
-}
+       do { \
+               if (gst_tag_list_get_uint64(tag_list, gsttag, &v_uint64)) {\
+                       if (v_uint64) {\
+                               /* FIXIT : don't know how to store date */\
+                               g_assert(1);\
+                               v_uint64 = 0;\
+                       } \
+               } \
+       } while (0)
 
 #define MMPLAYER_UPDATE_TAG_DOUBLE(gsttag, attribute, playertag) \
-if (gst_tag_list_get_double(tag_list, gsttag, &v_double)) {\
-       if (v_double) {\
-               /* FIXIT : don't know how to store date */\
-               g_assert(1);\
-               v_double = 0;\
-       } \
-}
+       do { \
+               if (gst_tag_list_get_double(tag_list, gsttag, &v_double)) {\
+                       if (v_double) {\
+                               /* FIXIT : don't know how to store date */\
+                               g_assert(1);\
+                               v_double = 0;\
+                       } \
+               } \
+       } while (0)
 
        /* function start */
-       GstTagListtag_list = NULL;
+       GstTagList *tag_list = NULL;
 
        MMHandleType attrs = 0;
 
@@ -935,7 +944,7 @@ if (gst_tag_list_get_double(tag_list, gsttag, &v_double)) {\
                                if (!strcmp(player->video360_metadata.projection_type_string, "equirectangular")) {
                                        player->video360_metadata.projection_type = VIDEO360_PROJECTION_TYPE_EQUIRECTANGULAR;
                                } else {
-                                       LOGE("Projection %s: code not implemented.\n", player->video360_metadata.projection_type_string);
+                                       LOGE("Projection %s: code not implemented.", player->video360_metadata.projection_type_string);
                                        player->is_content_spherical = player->is_video360_enabled = FALSE;
                                }
                        }
@@ -948,7 +957,7 @@ if (gst_tag_list_get_double(tag_list, gsttag, &v_double)) {\
                                } else if (!strcmp(player->video360_metadata.stereo_mode_string, "top-bottom")) {
                                        player->video360_metadata.stereo_mode = VIDEO360_MODE_STEREOSCOPIC_TOP_BOTTOM;
                                } else {
-                                       LOGE("Stereo mode %s: code not implemented.\n", player->video360_metadata.stereo_mode_string);
+                                       LOGE("Stereo mode %s: code not implemented.", player->video360_metadata.stereo_mode_string);
                                        player->is_content_spherical = player->is_video360_enabled = FALSE;
                                }
                        }
@@ -956,7 +965,7 @@ if (gst_tag_list_get_double(tag_list, gsttag, &v_double)) {\
        }
 
        if (mm_attrs_commit_all(attrs))
-               LOGE("failed to commit.\n");
+               LOGE("failed to commit.");
 
        gst_tag_list_unref(tag_list);
 
@@ -965,7 +974,7 @@ if (gst_tag_list_get_double(tag_list, gsttag, &v_double)) {\
 
 /* if retval is FALSE, it will be dropped for perfomance. */
 static gboolean
-__mmplayer_gst_check_useful_message(mm_player_t *player, GstMessage * message)
+__mmplayer_gst_check_useful_message(mm_player_t *player, GstMessage *message)
 {
        gboolean retval = FALSE;
 
@@ -1001,7 +1010,7 @@ __mmplayer_gst_check_useful_message(mm_player_t *player, GstMessage * message)
                retval = TRUE;
                gst_message_parse_buffering(message, &buffer_percent);
                if (buffer_percent != MAX_BUFFER_PERCENT) {
-                       LOGD("[%s] buffering msg %d%%!!\n", GST_OBJECT_NAME(GST_MESSAGE_SRC(message)), buffer_percent);
+                       LOGD("[%s] buffering msg %d%%!!", GST_OBJECT_NAME(GST_MESSAGE_SRC(message)), buffer_percent);
                        break;
                }
 
@@ -1011,7 +1020,7 @@ __mmplayer_gst_check_useful_message(mm_player_t *player, GstMessage * message)
                }
 
                if ((player->streamer) && (player->streamer->buffering_state & MM_PLAYER_BUFFERING_IN_PROGRESS)) {
-                       LOGD("[%s] Buffering DONE is detected !!\n", GST_OBJECT_NAME(GST_MESSAGE_SRC(message)));
+                       LOGD("[%s] Buffering DONE is detected !", GST_OBJECT_NAME(GST_MESSAGE_SRC(message)));
                        player->streamer->buffering_state |= MM_PLAYER_BUFFERING_COMPLETE;
                }
 
@@ -1032,7 +1041,7 @@ __mmplayer_update_buffer_setting(mm_player_t *player, GstMessage *buffering_msg)
 {
        MMHandleType attrs = 0;
        guint64 data_size = 0;
-       gcharpath = NULL;
+       gchar *path = NULL;
        gint64 pos_nsec = 0;
        struct stat sb;
 
@@ -1042,13 +1051,12 @@ __mmplayer_update_buffer_setting(mm_player_t *player, GstMessage *buffering_msg)
 
        attrs = MMPLAYER_GET_ATTRS(player);
        if (!attrs) {
-               LOGE("fail to get attributes.\n");
+               LOGE("fail to get attributes.");
                return;
        }
 
        if (!MMPLAYER_IS_STREAMING(player) && (player->can_support_codec & FOUND_PLUGIN_VIDEO)) {
                mm_attrs_get_string_by_name(attrs, "profile_uri", &path);
-
                if (stat(path, &sb) == 0)
                        data_size = (guint64)sb.st_size;
        } else if (MMPLAYER_IS_HTTP_STREAMING(player)) {
@@ -1062,7 +1070,7 @@ __mmplayer_update_buffer_setting(mm_player_t *player, GstMessage *buffering_msg)
 }
 
 static int
-__mmplayer_handle_buffering_playback(mm_player_tplayer)
+__mmplayer_handle_buffering_playback(mm_player_t *player)
 {
        int ret = MM_ERROR_NONE;
        MMPlayerStateType prev_state = MM_PLAYER_STATE_NONE;
@@ -1071,7 +1079,7 @@ __mmplayer_handle_buffering_playback(mm_player_t* player)
        MMPlayerStateType pending_state = MM_PLAYER_STATE_NONE;
 
        if (!player || !player->streamer || (MMPLAYER_IS_LIVE_STREAMING(player) && MMPLAYER_IS_RTSP_STREAMING(player))) {
-               LOGW("do nothing for buffering msg\n");
+               LOGW("do nothing for buffering msg");
                ret = MM_ERROR_PLAYER_INVALID_STATE;
                goto exit;
        }
@@ -1099,14 +1107,14 @@ __mmplayer_handle_buffering_playback(mm_player_t* player)
                                        break;
 
                                case MM_PLAYER_STATE_PAUSED:
-                                       LOGD("player is already going to paused state, there is nothing to do.\n");
+                                       LOGD("player is already going to paused state, there is nothing to do.");
                                        break;
 
                                case MM_PLAYER_STATE_NONE:
                                case MM_PLAYER_STATE_NULL:
                                case MM_PLAYER_STATE_READY:
                                default:
-                                       LOGW("invalid pending state [%s].\n", MMPLAYER_STATE_GET_NAME(pending_state));
+                                       LOGW("invalid pending state [%s].", MMPLAYER_STATE_GET_NAME(pending_state));
                                        break;
                                }
                        }
@@ -1136,13 +1144,13 @@ __mmplayer_handle_buffering_playback(mm_player_t* player)
                                        break;
 
                                case MM_PLAYER_STATE_PLAYING:
-                                       LOGD("player is already going to playing state, there is nothing to do.\n");
+                                       LOGD("player is already going to playing state, there is nothing to do.");
                                        break;
 
                                case MM_PLAYER_STATE_NULL:
                                case MM_PLAYER_STATE_READY:
                                default:
-                                       LOGW("invalid pending state [%s].\n", MMPLAYER_STATE_GET_NAME(pending_state));
+                                       LOGW("invalid pending state [%s].", MMPLAYER_STATE_GET_NAME(pending_state));
                                        break;
                                }
                        }
@@ -1152,7 +1160,7 @@ __mmplayer_handle_buffering_playback(mm_player_t* player)
                case MM_PLAYER_STATE_READY:
                case MM_PLAYER_STATE_NONE:
                default:
-                       LOGW("invalid target state [%s].\n", MMPLAYER_STATE_GET_NAME(target_state));
+                       LOGW("invalid target state [%s].", MMPLAYER_STATE_GET_NAME(target_state));
                        break;
                }
        } else {
@@ -1165,7 +1173,7 @@ __mmplayer_handle_buffering_playback(mm_player_t* player)
                                if (current_state != MM_PLAYER_STATE_PAUSED) {
                                        /* rtsp streaming pause makes rtsp server stop sending data. */
                                        if (!MMPLAYER_IS_RTSP_STREAMING(player)) {
-                                               LOGD("set pause state during buffering\n");
+                                               LOGD("set pause state during buffering");
                                                __mmplayer_gst_pause(player, TRUE);
                                        }
                                }
@@ -1184,7 +1192,7 @@ __mmplayer_handle_buffering_playback(mm_player_t* player)
                case MM_PLAYER_STATE_NULL:
                case MM_PLAYER_STATE_READY:
                default:
-                       LOGW("invalid pending state [%s].\n", MMPLAYER_STATE_GET_NAME(pending_state));
+                       LOGW("invalid pending state [%s].", MMPLAYER_STATE_GET_NAME(pending_state));
                        break;
                }
        }
@@ -1208,7 +1216,7 @@ __mmplayer_adaptive_var_info(const VariantData *self, gpointer user_data)
 }
 
 static gboolean
-__mmplayer_gst_handle_duration(mm_player_t* player, GstMessage* msg)
+__mmplayer_gst_handle_duration(mm_player_t *player, GstMessage *msg)
 {
        gint64 bytes = 0;
 
@@ -1223,7 +1231,7 @@ __mmplayer_gst_handle_duration(mm_player_t* player, GstMessage* msg)
 
                if (gst_element_query_duration(GST_ELEMENT_CAST(msg->src), GST_FORMAT_BYTES, &bytes)) {
                        LOGD("data total size of http content: %"G_GINT64_FORMAT, bytes);
-                       player->http_content_size = (bytes > 0) ? (bytes) : (0);
+                       player->http_content_size = (bytes > 0) ? bytes : 0;
                }
        } else {
                /* handling audio clip which has vbr. means duration is keep changing */
@@ -1238,13 +1246,13 @@ __mmplayer_gst_handle_duration(mm_player_t* player, GstMessage* msg)
 static gboolean
 __mmplayer_eos_timer_cb(gpointer u_data)
 {
-       mm_player_tplayer = NULL;
+       mm_player_t *player = NULL;
        MMHandleType attrs = 0;
        int count = 0;
 
        MMPLAYER_RETURN_VAL_IF_FAIL(u_data, FALSE);
 
-       player = (mm_player_t*) u_data;
+       player = (mm_player_t *)u_data;
        attrs = MMPLAYER_GET_ATTRS(player);
 
        mm_attrs_get_int_by_name(attrs, "profile_play_count", &count);
@@ -1264,13 +1272,13 @@ __mmplayer_eos_timer_cb(gpointer u_data)
 }
 
 static void
-__mmplayer_handle_eos_delay(mm_player_tplayer, int delay_in_ms)
+__mmplayer_handle_eos_delay(mm_player_t *player, int delay_in_ms)
 {
        MMPLAYER_RETURN_IF_FAIL(player);
 
        /* post now if delay is zero */
        if (delay_in_ms == 0 || player->audio_stream_render_cb) {
-               LOGD("eos delay is zero. posting EOS now\n");
+               LOGD("eos delay is zero. posting EOS now");
                MMPLAYER_POST_MSG(player, MM_MESSAGE_END_OF_STREAM, NULL);
 
                if (player->audio_stream_render_cb)
@@ -1284,7 +1292,7 @@ __mmplayer_handle_eos_delay(mm_player_t* player, int delay_in_ms)
 
        /* init new timeout */
        /* NOTE : consider give high priority to this timer */
-       LOGD("posting EOS message after [%d] msec\n", delay_in_ms);
+       LOGD("posting EOS message after [%d] msec", delay_in_ms);
 
        player->eos_timer = g_timeout_add(delay_in_ms,
                __mmplayer_eos_timer_cb, player);
@@ -1294,12 +1302,13 @@ __mmplayer_handle_eos_delay(mm_player_t* player, int delay_in_ms)
 
        /* check timer is valid. if not, send EOS now */
        if (player->eos_timer == 0) {
-               LOGW("creating timer for delayed EOS has failed. sending EOS now\n");
+               LOGW("creating timer for delayed EOS has failed. sending EOS now");
                MMPLAYER_POST_MSG(player, MM_MESSAGE_END_OF_STREAM, NULL);
        }
 }
 
-static int __mmplayer_gst_pending_seek(mm_player_t* player)
+static int
+__mmplayer_gst_pending_seek(mm_player_t *player)
 {
        MMPlayerStateType current_state = MM_PLAYER_STATE_NONE;
        int ret = MM_ERROR_NONE;
@@ -1309,7 +1318,7 @@ static int __mmplayer_gst_pending_seek(mm_player_t* player)
        MMPLAYER_RETURN_VAL_IF_FAIL(player && player->pipeline, MM_ERROR_PLAYER_NOT_INITIALIZED);
 
        if (!player->pending_seek.is_pending) {
-               LOGD("pending seek is not reserved. nothing to do.\n");
+               LOGD("pending seek is not reserved. nothing to do.");
                return ret;
        }
 
@@ -1317,19 +1326,18 @@ static int __mmplayer_gst_pending_seek(mm_player_t* player)
        current_state = MMPLAYER_CURRENT_STATE(player);
 
        if (current_state != MM_PLAYER_STATE_PAUSED && current_state != MM_PLAYER_STATE_PLAYING) {
-               LOGW("try to pending seek in %s state, try next time. \n",
+               LOGW("try to pending seek in %s state, try next time. ",
                        MMPLAYER_STATE_GET_NAME(current_state));
                return ret;
        }
 
-       LOGD("trying to play from(%"G_GINT64_FORMAT") pending position\n", player->pending_seek.pos);
+       LOGD("trying to play from(%"G_GINT64_FORMAT") pending position", player->pending_seek.pos);
 
        ret = __mmplayer_gst_set_position(player, player->pending_seek.pos, FALSE);
+       if (ret != MM_ERROR_NONE)
+               LOGE("failed to seek pending postion. just keep staying current position.");
 
-       if (MM_ERROR_NONE != ret)
-               LOGE("failed to seek pending postion. just keep staying current position.\n");
-
-       player->pending_seek.is_pending = FALSE;
+       player->pending_seek.is_pending = false;
 
        MMPLAYER_FLEAVE();
 
@@ -1337,7 +1345,7 @@ static int __mmplayer_gst_pending_seek(mm_player_t* player)
 }
 
 static void
-__mmplayer_gst_set_async(mm_player_tplayer, gboolean async, enum MMPlayerSinkType type)
+__mmplayer_gst_set_async(mm_player_t *player, gboolean async, enum MMPlayerSinkType type)
 {
        MMPlayerGstElement *videobin = NULL, *audiobin = NULL, *textbin = NULL;
 
@@ -1362,7 +1370,7 @@ __mmplayer_gst_set_async(mm_player_t* player, gboolean async, enum MMPlayerSinkT
 }
 
 static void
-__mmplayer_drop_subtitle(mm_player_tplayer, gboolean is_drop)
+__mmplayer_drop_subtitle(mm_player_t *player, gboolean is_drop)
 {
        MMPlayerGstElement *textbin;
        MMPLAYER_FENTER();
@@ -1376,7 +1384,7 @@ __mmplayer_drop_subtitle(mm_player_t* player, gboolean is_drop)
        textbin = player->pipeline->textbin;
 
        if (is_drop) {
-               LOGD("Drop subtitle text after getting EOS\n");
+               LOGD("Drop subtitle text after getting EOS");
 
                __mmplayer_gst_set_async(player, FALSE, MMPLAYER_TEXT_SINK);
                g_object_set(textbin[MMPLAYER_T_IDENTITY].gst, "drop-probability", (gfloat)1.0, NULL);
@@ -1384,7 +1392,7 @@ __mmplayer_drop_subtitle(mm_player_t* player, gboolean is_drop)
                player->is_subtitle_force_drop = TRUE;
        } else {
                if (player->is_subtitle_force_drop == TRUE) {
-                       LOGD("Enable subtitle data path without drop\n");
+                       LOGD("Enable subtitle data path without drop");
 
                        g_object_set(textbin[MMPLAYER_T_IDENTITY].gst, "drop-probability", (gfloat)0.0, NULL);
                        __mmplayer_gst_set_async(player, TRUE, MMPLAYER_TEXT_SINK);
@@ -1397,7 +1405,7 @@ __mmplayer_drop_subtitle(mm_player_t* player, gboolean is_drop)
 }
 
 static void
-__mmplayer_gst_handle_eos_message(mm_player_tplayer, GstMessage *msg)
+__mmplayer_gst_handle_eos_message(mm_player_t *player, GstMessage *msg)
 {
        MMHandleType attrs = 0;
        gint count = 0;
@@ -1420,7 +1428,6 @@ __mmplayer_gst_handle_eos_message(mm_player_t* player, GstMessage *msg)
        /* rewind if repeat count is greater then zero */
        /* get play count */
        attrs = MMPLAYER_GET_ATTRS(player);
-
        if (attrs) {
                mm_attrs_get_int_by_name(attrs, "profile_play_count", &count);
 
@@ -1457,10 +1464,10 @@ __mmplayer_gst_handle_eos_message(mm_player_t* player, GstMessage *msg)
 }
 
 static void
-__mmplayer_gst_handle_error_message(mm_player_tplayer, GstMessage *msg)
+__mmplayer_gst_handle_error_message(mm_player_t *player, GstMessage *msg)
 {
        GError *error = NULL;
-       gchardebug = NULL;
+       gchar *debug = NULL;
 
        MMPLAYER_FENTER();
 
@@ -1488,9 +1495,6 @@ __mmplayer_gst_handle_error_message(mm_player_t* player, GstMessage *msg)
                        LOGE("error debug : %s", debug);
        }
 
-       if (MMPLAYER_IS_HTTP_PD(player))
-               _mmplayer_unrealize_pd_downloader((MMHandleType)player);
-
        MMPLAYER_FREEIF(debug);
        g_error_free(error);
 
@@ -1499,7 +1503,7 @@ __mmplayer_gst_handle_error_message(mm_player_t* player, GstMessage *msg)
 }
 
 static void
-__mmplayer_gst_handle_buffering_message(mm_player_tplayer, GstMessage *msg)
+__mmplayer_gst_handle_buffering_message(mm_player_t *player, GstMessage *msg)
 {
        MMMessageParamType msg_param = {0, };
        int bRet = MM_ERROR_NONE;
@@ -1512,23 +1516,7 @@ __mmplayer_gst_handle_buffering_message(mm_player_t* player, GstMessage *msg)
                return;
        }
 
-       if (player->pd_mode == MM_PLAYER_PD_MODE_URI) {
-               if (!MMPLAYER_CMD_TRYLOCK(player)) {
-                       /* skip the playback control by buffering msg while user request is handled. */
-                       gint per = 0;
-
-                       LOGW("[PD mode] can't get cmd lock, only post buffering msg");
-
-                       gst_message_parse_buffering(msg, &per);
-                       LOGD("[PD mode][%s] buffering %d %%....", GST_OBJECT_NAME(GST_MESSAGE_SRC(msg)), per);
-
-                       msg_param.connection.buffering = per;
-                       MMPLAYER_POST_MSG(player, MM_MESSAGE_BUFFERING, &msg_param);
-                       return;
-               }
-       } else {
-               MMPLAYER_CMD_LOCK(player);
-       }
+       MMPLAYER_CMD_LOCK(player);
 
        if (!player->streamer) {
                LOGW("Pipeline is shutting down");
@@ -1543,7 +1531,7 @@ __mmplayer_gst_handle_buffering_message(mm_player_t* player, GstMessage *msg)
                gst_message_parse_buffering(msg, &buffer_percent);
 
                if (buffer_percent == MAX_BUFFER_PERCENT) {
-                       LOGD("Ignored all the previous buffering msg!(got %d%%)\n", buffer_percent);
+                       LOGD("Ignored all the previous buffering msg!(got %d%%)", buffer_percent);
                        player->streamer->buffering_state = MM_PLAYER_BUFFERING_DEFAULT;
                }
                MMPLAYER_CMD_UNLOCK(player);
@@ -1604,21 +1592,21 @@ __mmplayer_gst_handle_buffering_message(mm_player_t* player, GstMessage *msg)
                }
        } else if (bRet == MM_ERROR_PLAYER_INVALID_STATE) {
                if (!player->streamer) {
-                       LOGW("player->streamer is NULL, so discarding the buffering percent update\n");
+                       LOGW("player->streamer is NULL, so discarding the buffering percent update");
                        MMPLAYER_CMD_UNLOCK(player);
                        return;
                }
 
                if ((MMPLAYER_IS_LIVE_STREAMING(player)) && (MMPLAYER_IS_RTSP_STREAMING(player))) {
 
-                       LOGD("player->last_position=%"G_GINT64_FORMAT" , player->streamer->buffering_percent=%d \n",
+                       LOGD("player->last_position=%"G_GINT64_FORMAT" , player->streamer->buffering_percent=%d",
                                        GST_TIME_AS_SECONDS(player->last_position), player->streamer->buffering_percent);
 
                        if ((GST_TIME_AS_SECONDS(player->last_position) <= 0) && (MMPLAYER_CURRENT_STATE(player) == MM_PLAYER_STATE_PAUSED)) {
                                msg_param.connection.buffering = player->streamer->buffering_percent;
                                MMPLAYER_POST_MSG(player, MM_MESSAGE_BUFFERING, &msg_param);
                        } else {
-                               LOGD("Not updating Buffering Message for Live RTSP case !!!\n");
+                               LOGD("Not updating Buffering Message for Live RTSP case !!!");
                        }
                } else {
                        msg_param.connection.buffering = player->streamer->buffering_percent;
@@ -1633,7 +1621,7 @@ __mmplayer_gst_handle_buffering_message(mm_player_t* player, GstMessage *msg)
 }
 
 static void
-__mmplayer_gst_handle_state_message(mm_player_tplayer, GstMessage *msg)
+__mmplayer_gst_handle_state_message(mm_player_t *player, GstMessage *msg)
 {
        MMPlayerGstElement *mainbin;
        const GValue *voldstate, *vnewstate, *vpending;
@@ -1682,7 +1670,7 @@ __mmplayer_gst_handle_state_message(mm_player_t* player, GstMessage *msg)
                        if (MM_ERROR_NONE != retVal)
                                LOGE("failed to seek pending postion. just keep staying current position.");
 
-                       player->pending_seek.is_pending = FALSE;
+                       player->pending_seek.is_pending = false;
                }
        }
 
@@ -1765,7 +1753,7 @@ __mmplayer_gst_handle_state_message(mm_player_t* player, GstMessage *msg)
 }
 
 static void
-__mmplayer_gst_handle_element_message(mm_player_tplayer, GstMessage *msg)
+__mmplayer_gst_handle_element_message(mm_player_t *player, GstMessage *msg)
 {
        const gchar *structure_name;
        gint count = 0, idx = 0;
@@ -1847,7 +1835,6 @@ __mmplayer_gst_handle_element_message(mm_player_t* player, GstMessage *msg)
                sdp which has contents info is received when rtsp connection is opened.
                extract duration ,codec info , resolution from sdp and get it by GstMessage */
        if (!strcmp(structure_name, "rtspsrc_properties")) {
-
                gchar *audio_codec = NULL;
                gchar *video_codec = NULL;
                gchar *video_frame_size = NULL;
@@ -1869,10 +1856,8 @@ __mmplayer_gst_handle_element_message(mm_player_t* player, GstMessage *msg)
                gst_structure_get(gst_message_get_structure(msg), "rtsp_video_frame_size", G_TYPE_STRING, &video_frame_size, NULL);
                LOGD("rtsp_video_frame_size : %s", video_frame_size);
                if (video_frame_size) {
-
                        char *seperator = strchr(video_frame_size, '-');
                        if (seperator) {
-
                                char video_width[10] = {0,};
                                int frame_size_len = strlen(video_frame_size);
                                int separtor_len = strlen(seperator);
@@ -1894,7 +1879,7 @@ __mmplayer_gst_handle_element_message(mm_player_t* player, GstMessage *msg)
 }
 
 static void
-__mmplayer_gst_handle_async_done_message(mm_player_tplayer, GstMessage *msg)
+__mmplayer_gst_handle_async_done_message(mm_player_t *player, GstMessage *msg)
 {
        MMPlayerGstElement *mainbin;
 
@@ -1941,7 +1926,7 @@ __mmplayer_gst_handle_async_done_message(mm_player_t* player, GstMessage *msg)
                                                gst_query_parse_buffering_percent(query, &busy, &percent);
                                        gst_query_unref(query);
 
-                                       LOGD("buffered percent(%s): %d\n",
+                                       LOGD("buffered percent(%s): %d",
                                                GST_ELEMENT_NAME(player->streamer->buffer_handle[BUFFER_TYPE_MUXED].buffer), percent);
                                }
 
@@ -1960,14 +1945,14 @@ __mmplayer_gst_handle_async_done_message(mm_player_t* player, GstMessage *msg)
 static void
 __mmplayer_gst_bus_msg_callback(GstMessage *msg, gpointer data)
 {
-       mm_player_t* player = (mm_player_t*)(data);
+       mm_player_t *player = (mm_player_t *)(data);
 
        MMPLAYER_RETURN_IF_FAIL(player);
        MMPLAYER_RETURN_IF_FAIL(msg && GST_IS_MESSAGE(msg));
 
        switch (GST_MESSAGE_TYPE(msg)) {
        case GST_MESSAGE_UNKNOWN:
-               LOGD("unknown message received\n");
+               LOGD("unknown message received");
                break;
 
        case GST_MESSAGE_EOS:
@@ -1981,13 +1966,13 @@ __mmplayer_gst_bus_msg_callback(GstMessage *msg, gpointer data)
 
        case GST_MESSAGE_WARNING:
                {
-                       chardebug = NULL;
-                       GErrorerror = NULL;
+                       char *debug = NULL;
+                       GError *error = NULL;
 
                        gst_message_parse_warning(msg, &error, &debug);
 
-                       LOGD("warning : %s\n", error->message);
-                       LOGD("debug : %s\n", debug);
+                       LOGD("warning : %s", error->message);
+                       LOGD("debug : %s", debug);
 
                        MMPLAYER_POST_MSG(player, MM_MESSAGE_WARNING, NULL);
 
@@ -1998,9 +1983,9 @@ __mmplayer_gst_bus_msg_callback(GstMessage *msg, gpointer data)
 
        case GST_MESSAGE_TAG:
                {
-                       LOGD("GST_MESSAGE_TAG\n");
+                       LOGD("GST_MESSAGE_TAG");
                        if (!__mmplayer_gst_extract_tag_from_msg(player, msg))
-                               LOGW("failed to extract tags from gstmessage\n");
+                               LOGW("failed to extract tags from gstmessage");
                }
                break;
 
@@ -2018,7 +2003,7 @@ __mmplayer_gst_bus_msg_callback(GstMessage *msg, gpointer data)
                                gboolean need_new_clock = FALSE;
 
                                gst_message_parse_clock_lost(msg, &clock);
-                               LOGD("GST_MESSAGE_CLOCK_LOST : %s\n", (clock ? GST_OBJECT_NAME(clock) : "NULL"));
+                               LOGD("GST_MESSAGE_CLOCK_LOST : %s", (clock ? GST_OBJECT_NAME(clock) : "NULL"));
 
                                if (!player->videodec_linked)
                                        need_new_clock = TRUE;
@@ -2026,7 +2011,7 @@ __mmplayer_gst_bus_msg_callback(GstMessage *msg, gpointer data)
                                        need_new_clock = TRUE;
 
                                if (need_new_clock) {
-                                       LOGD("Provide clock is TRUE, do pause->resume\n");
+                                       LOGD("Provide clock is TRUE, do pause->resume");
                                        __mmplayer_gst_pause(player, FALSE);
                                        __mmplayer_gst_resume(player, FALSE);
                                }
@@ -2037,7 +2022,7 @@ __mmplayer_gst_bus_msg_callback(GstMessage *msg, gpointer data)
                        {
                                GstClock *clock = NULL;
                                gst_message_parse_new_clock(msg, &clock);
-                               LOGD("GST_MESSAGE_NEW_CLOCK : %s\n", (clock ? GST_OBJECT_NAME(clock) : "NULL"));
+                               LOGD("GST_MESSAGE_NEW_CLOCK : %s", (clock ? GST_OBJECT_NAME(clock) : "NULL"));
                        }
                        break;
 
@@ -2047,14 +2032,14 @@ __mmplayer_gst_bus_msg_callback(GstMessage *msg, gpointer data)
 
        case GST_MESSAGE_DURATION_CHANGED:
                {
-                       LOGD("GST_MESSAGE_DURATION_CHANGED\n");
+                       LOGD("GST_MESSAGE_DURATION_CHANGED");
                        if (!__mmplayer_gst_handle_duration(player, msg))
                                LOGW("failed to update duration");
                }
                break;
 
        case GST_MESSAGE_ASYNC_START:
-                       LOGD("GST_MESSAGE_ASYNC_START : %s\n", GST_ELEMENT_NAME(GST_MESSAGE_SRC(msg)));
+                       LOGD("GST_MESSAGE_ASYNC_START : %s", GST_ELEMENT_NAME(GST_MESSAGE_SRC(msg)));
                break;
 
        case GST_MESSAGE_ASYNC_DONE:
@@ -2062,21 +2047,21 @@ __mmplayer_gst_bus_msg_callback(GstMessage *msg, gpointer data)
                break;
 
        #if 0 /* delete unnecessary logs */
-       case GST_MESSAGE_REQUEST_STATE:         LOGD("GST_MESSAGE_REQUEST_STATE\n"); break;
-       case GST_MESSAGE_STEP_START:            LOGD("GST_MESSAGE_STEP_START\n"); break;
-       case GST_MESSAGE_QOS:                           LOGD("GST_MESSAGE_QOS\n"); break;
-       case GST_MESSAGE_PROGRESS:                      LOGD("GST_MESSAGE_PROGRESS\n"); break;
-       case GST_MESSAGE_ANY:                           LOGD("GST_MESSAGE_ANY\n"); break;
-       case GST_MESSAGE_INFO:                          LOGD("GST_MESSAGE_STATE_DIRTY\n"); break;
-       case GST_MESSAGE_STATE_DIRTY:           LOGD("GST_MESSAGE_STATE_DIRTY\n"); break;
-       case GST_MESSAGE_STEP_DONE:                     LOGD("GST_MESSAGE_STEP_DONE\n"); break;
-       case GST_MESSAGE_CLOCK_PROVIDE:         LOGD("GST_MESSAGE_CLOCK_PROVIDE\n"); break;
-       case GST_MESSAGE_STRUCTURE_CHANGE:      LOGD("GST_MESSAGE_STRUCTURE_CHANGE\n"); break;
-       case GST_MESSAGE_STREAM_STATUS:         LOGD("GST_MESSAGE_STREAM_STATUS\n"); break;
-       case GST_MESSAGE_APPLICATION:           LOGD("GST_MESSAGE_APPLICATION\n"); break;
-       case GST_MESSAGE_SEGMENT_START:         LOGD("GST_MESSAGE_SEGMENT_START\n"); break;
-       case GST_MESSAGE_SEGMENT_DONE:          LOGD("GST_MESSAGE_SEGMENT_DONE\n"); break;
-       case GST_MESSAGE_LATENCY:                               LOGD("GST_MESSAGE_LATENCY\n"); break;
+       case GST_MESSAGE_REQUEST_STATE:         LOGD("GST_MESSAGE_REQUEST_STATE"); break;
+       case GST_MESSAGE_STEP_START:            LOGD("GST_MESSAGE_STEP_START"); break;
+       case GST_MESSAGE_QOS:                           LOGD("GST_MESSAGE_QOS"); break;
+       case GST_MESSAGE_PROGRESS:                      LOGD("GST_MESSAGE_PROGRESS"); break;
+       case GST_MESSAGE_ANY:                           LOGD("GST_MESSAGE_ANY"); break;
+       case GST_MESSAGE_INFO:                          LOGD("GST_MESSAGE_STATE_DIRTY"); break;
+       case GST_MESSAGE_STATE_DIRTY:           LOGD("GST_MESSAGE_STATE_DIRTY"); break;
+       case GST_MESSAGE_STEP_DONE:                     LOGD("GST_MESSAGE_STEP_DONE"); break;
+       case GST_MESSAGE_CLOCK_PROVIDE:         LOGD("GST_MESSAGE_CLOCK_PROVIDE"); break;
+       case GST_MESSAGE_STRUCTURE_CHANGE:      LOGD("GST_MESSAGE_STRUCTURE_CHANGE"); break;
+       case GST_MESSAGE_STREAM_STATUS:         LOGD("GST_MESSAGE_STREAM_STATUS"); break;
+       case GST_MESSAGE_APPLICATION:           LOGD("GST_MESSAGE_APPLICATION"); break;
+       case GST_MESSAGE_SEGMENT_START:         LOGD("GST_MESSAGE_SEGMENT_START"); break;
+       case GST_MESSAGE_SEGMENT_DONE:          LOGD("GST_MESSAGE_SEGMENT_DONE"); break;
+       case GST_MESSAGE_LATENCY:                       LOGD("GST_MESSAGE_LATENCY"); break;
        #endif
 
        default:
@@ -2088,7 +2073,7 @@ __mmplayer_gst_bus_msg_callback(GstMessage *msg, gpointer data)
 }
 
 static GstBusSyncReply
-__mmplayer_gst_bus_sync_callback(GstBus * bus, GstMessage * message, gpointer data)
+__mmplayer_gst_bus_sync_callback(GstBus *bus, GstMessage *message, gpointer data)
 {
        mm_player_t *player = (mm_player_t *)data;
        GstBusSyncReply reply = GST_BUS_DROP;
@@ -2113,7 +2098,7 @@ __mmplayer_gst_bus_sync_callback(GstBus * bus, GstMessage * message, gpointer da
 
                        gst_message_parse_tag(message, &tags);
                        if (tags) {
-                               LOGE("TAGS received from element \"%s\".\n",
+                               LOGE("TAGS received from element \"%s\".",
                                GST_STR_NULL(GST_ELEMENT_NAME(GST_MESSAGE_SRC(message))));
 
                                gst_tag_list_foreach(tags, print_tag, NULL);
@@ -2196,26 +2181,26 @@ __mmplayer_gst_appsrc_seek_data_mem(GstElement *element, guint64 size, gpointer
 void
 __mmplayer_gst_appsrc_feed_data(GstElement *element, guint size, gpointer user_data)
 {
-       mm_player_t *player  = (mm_player_t*)user_data;
+       mm_player_t *player  = (mm_player_t *)user_data;
        MMPlayerStreamType type = MM_PLAYER_STREAM_TYPE_DEFAULT;
        guint64 current_level_bytes = 0;
 
        MMPLAYER_RETURN_IF_FAIL(player);
 
-       if (g_strrstr(GST_ELEMENT_NAME(element), "audio"))
+       if (g_strrstr(GST_ELEMENT_NAME(element), "audio")) {
                type = MM_PLAYER_STREAM_TYPE_AUDIO;
-       else if (g_strrstr(GST_ELEMENT_NAME(element), "video"))
+       } else if (g_strrstr(GST_ELEMENT_NAME(element), "video")) {
                type = MM_PLAYER_STREAM_TYPE_VIDEO;
-       else if (g_strrstr(GST_ELEMENT_NAME(element), "subtitle"))
+       } else if (g_strrstr(GST_ELEMENT_NAME(element), "subtitle")) {
                type = MM_PLAYER_STREAM_TYPE_TEXT;
-       else {
+       else {
                LOGE("can not enter here");
                return;
        }
 
        g_object_get(G_OBJECT(element), "current-level-bytes", &current_level_bytes, NULL);
 
-       LOGI("type: %d, level: %llu", type, current_level_bytes);
+       LOGI("type: %d, level: %"G_GUINT64_FORMAT, type, current_level_bytes);
 
        MMPLAYER_MEDIA_STREAM_CALLBACK_LOCK(player);
        if (player->media_stream_buffer_status_cb[type])
@@ -2226,19 +2211,19 @@ __mmplayer_gst_appsrc_feed_data(GstElement *element, guint size, gpointer user_d
 void
 __mmplayer_gst_appsrc_enough_data(GstElement *element, gpointer user_data)
 {
-       mm_player_t *player  = (mm_player_t*)user_data;
+       mm_player_t *player  = (mm_player_t *)user_data;
        MMPlayerStreamType type = MM_PLAYER_STREAM_TYPE_DEFAULT;
        guint64 current_level_bytes = 0;
 
        MMPLAYER_RETURN_IF_FAIL(player);
 
-       if (g_strrstr(GST_ELEMENT_NAME(element), "audio"))
+       if (g_strrstr(GST_ELEMENT_NAME(element), "audio")) {
                type = MM_PLAYER_STREAM_TYPE_AUDIO;
-       else if (g_strrstr(GST_ELEMENT_NAME(element), "video"))
+       } else if (g_strrstr(GST_ELEMENT_NAME(element), "video")) {
                type = MM_PLAYER_STREAM_TYPE_VIDEO;
-       else if (g_strrstr(GST_ELEMENT_NAME(element), "subtitle"))
+       } else if (g_strrstr(GST_ELEMENT_NAME(element), "subtitle")) {
                type = MM_PLAYER_STREAM_TYPE_TEXT;
-       else {
+       else {
                LOGE("can not enter here");
                return;
        }
@@ -2256,25 +2241,25 @@ __mmplayer_gst_appsrc_enough_data(GstElement *element, gpointer user_data)
 }
 
 gboolean
-__mmplayer_gst_appsrc_seek_data(GstElement * element, guint64 position, gpointer user_data)
+__mmplayer_gst_appsrc_seek_data(GstElement *element, guint64 position, gpointer user_data)
 {
-       mm_player_t *player  = (mm_player_t*)user_data;
+       mm_player_t *player  = (mm_player_t *)user_data;
        MMPlayerStreamType type = MM_PLAYER_STREAM_TYPE_DEFAULT;
 
        MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
 
-       if (g_strrstr(GST_ELEMENT_NAME(element), "audio"))
+       if (g_strrstr(GST_ELEMENT_NAME(element), "audio")) {
                type = MM_PLAYER_STREAM_TYPE_AUDIO;
-       else if (g_strrstr(GST_ELEMENT_NAME(element), "video"))
+       } else if (g_strrstr(GST_ELEMENT_NAME(element), "video")) {
                type = MM_PLAYER_STREAM_TYPE_VIDEO;
-       else if (g_strrstr(GST_ELEMENT_NAME(element), "subtitle"))
+       } else if (g_strrstr(GST_ELEMENT_NAME(element), "subtitle")) {
                type = MM_PLAYER_STREAM_TYPE_TEXT;
-       else {
+       else {
                LOGE("can not enter here");
                return TRUE;
        }
 
-       LOGD("type: %d, pos: %llu", type, position);
+       LOGD("type: %d, pos: %"G_GUINT64_FORMAT, type, position);
        MMPLAYER_MEDIA_STREAM_CALLBACK_LOCK(player);
 
        if (player->media_stream_seek_data_cb[type])
@@ -2285,14 +2270,14 @@ __mmplayer_gst_appsrc_seek_data(GstElement * element, guint64 position, gpointer
 }
 
 static gboolean
-__mmplayer_gst_create_es_decoder(mm_player_t *player, MMPlayerStreamType type, GstPadsrcpad)
+__mmplayer_gst_create_es_decoder(mm_player_t *player, MMPlayerStreamType type, GstPad *srcpad)
 {
 #define MAX_LEN_NAME 20
 
        gboolean ret = FALSE;
        GstPad *sinkpad = NULL;
        gchar *prefix = NULL;
-       gchar dec_name[MAX_LEN_NAME] = {0};
+       gchar dec_name[MAX_LEN_NAME] = {0};
        enum MainElementID elem_id = MMPLAYER_M_NUM;
 
        MMPlayerGstElement *mainbin = NULL;
@@ -2391,14 +2376,14 @@ ERROR:
 }
 
 static gboolean
-__mmplayer_gst_create_es_path(mm_player_t* player, MMPlayerStreamType type, GstCaps* caps)
+__mmplayer_gst_create_es_path(mm_player_t *player, MMPlayerStreamType type, GstCaps *caps)
 {
 #define MAX_LEN_NAME 20
        MMPlayerGstElement *mainbin = NULL;
        gchar *prefix = NULL;
        enum MainElementID src_id = MMPLAYER_M_NUM, queue_id = MMPLAYER_M_NUM;
 
-       gchar src_name[MAX_LEN_NAME] = {0}, queue_name[MAX_LEN_NAME] = {0};
+       gchar src_name[MAX_LEN_NAME] = {0, }, queue_name[MAX_LEN_NAME] = {0, };
        GstElement *src = NULL, *queue = NULL;
        GstPad *srcpad = NULL;
 
@@ -2541,7 +2526,7 @@ __mmplayer_gst_rtp_dynamic_pad(GstElement *element, GstPad *pad, gpointer data)
        GstStructure *str = NULL;
        const gchar *name = NULL;
 
-       mm_player_t *player = (mm_player_t*) data;
+       mm_player_t *player = (mm_player_t *)data;
 
        MMPLAYER_FENTER();
 
@@ -2562,7 +2547,7 @@ __mmplayer_gst_rtp_dynamic_pad(GstElement *element, GstPad *pad, gpointer data)
        str = gst_caps_get_structure (caps, 0);
        name = gst_structure_get_string(str, "media");
        if (!name) {
-               LOGE("cannot get mimetype from structure.\n");
+               LOGE("cannot get mimetype from structure.");
                goto ERROR;
        }
 
@@ -2594,27 +2579,27 @@ NEW_ELEMENT:
 
        /* excute new_element if created*/
        if (new_element) {
-               LOGD("adding new element to pipeline\n");
+               LOGD("adding new element to pipeline");
 
                /* set state to READY before add to bin */
                MMPLAYER_ELEMENT_SET_STATE(new_element, GST_STATE_READY);
 
                /* add new element to the pipeline */
                if (FALSE == gst_bin_add(GST_BIN(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst), new_element)) {
-                       LOGE("failed to add autoplug element to bin\n");
+                       LOGE("failed to add autoplug element to bin");
                        goto ERROR;
                }
 
                /* get pad from element */
                sinkpad = gst_element_get_static_pad(GST_ELEMENT(new_element), "sink");
                if (!sinkpad) {
-                       LOGE("failed to get sinkpad from autoplug element\n");
+                       LOGE("failed to get sinkpad from autoplug element");
                        goto ERROR;
                }
 
                /* link it */
                if (GST_PAD_LINK_OK != gst_pad_link(pad, sinkpad)) {
-                       LOGE("failed to link autoplug element\n");
+                       LOGE("failed to link autoplug element");
                        goto ERROR;
                }
 
@@ -2653,22 +2638,22 @@ ERROR:
 static void
 __mmplayer_gst_rtp_no_more_pads(GstElement *element,  gpointer data)
 {
-       mm_player_t* player = (mm_player_t*) data;
+       mm_player_t *player = (mm_player_t *)data;
 
        MMPLAYER_FENTER();
 
        /* NOTE : we can remove fakesink here if there's no rtp_dynamic_pad. because whenever
-         * we connect autoplugging element to the pad which is just added to rtspsrc, we increase
-         * num_dynamic_pad. and this is no-more-pad situation which means no more pad will be added.
-         * So we can say this. if num_dynamic_pad is zero, it must be one of followings
-
-         * [1] audio and video will be dumped with filesink.
-         * [2] autoplugging is done by just using pad caps.
-         * [3] typefinding has happend in audio but audiosink is created already before no-more-pad signal
-         * and the video will be dumped via filesink.
-         */
+        * we connect autoplugging element to the pad which is just added to rtspsrc, we increase
+        * num_dynamic_pad. and this is no-more-pad situation which means no more pad will be added.
+        * So we can say this. if num_dynamic_pad is zero, it must be one of followings
+
+        * [1] audio and video will be dumped with filesink.
+        * [2] autoplugging is done by just using pad caps.
+        * [3] typefinding has happend in audio but audiosink is created already before no-more-pad signal
+        * and the video will be dumped via filesink.
+        */
        if (player->num_dynamic_pad == 0) {
-               LOGD("it seems pad caps is directely used for autoplugging. removing fakesink now\n");
+               LOGD("it seems pad caps is directely used for autoplugging. removing fakesink now");
 
                if (!__mmplayer_gst_remove_fakesink(player,
                        &player->pipeline->mainbin[MMPLAYER_M_SRC_FAKESINK]))
@@ -2688,10 +2673,10 @@ __mmplayer_gst_rtp_no_more_pads(GstElement *element,  gpointer data)
        MMPLAYER_FLEAVE();
 }
 
-static GstElement*
-__mmplayer_gst_make_rtsp_src(mm_player_tplayer)
+static GstElement *
+__mmplayer_gst_make_rtsp_src(mm_player_t *player)
 {
-       GstElementelement = NULL;
+       GstElement *element = NULL;
        gchar *user_agent = NULL;
        MMHandleType attrs = 0;
 
@@ -2730,10 +2715,10 @@ __mmplayer_gst_make_rtsp_src(mm_player_t* player)
        return element;
 }
 
-static GstElement*
-__mmplayer_gst_make_http_src(mm_player_tplayer)
+static GstElement *
+__mmplayer_gst_make_http_src(mm_player_t *player)
 {
-       GstElementelement = NULL;
+       GstElement *element = NULL;
        MMHandleType attrs = 0;
        gchar *user_agent, *cookies, **cookie_list;
        gint http_timeout = DEFAULT_HTTP_TIMEOUT;
@@ -2773,10 +2758,10 @@ __mmplayer_gst_make_http_src(mm_player_t* player)
 
        /* setting property to streaming source */
        g_object_set(G_OBJECT(element), "location", player->profile.uri,
-                               "timeout", http_timeout, "blocksize", (unsigned long)(64*1024), NULL);
+                               "timeout", http_timeout, "blocksize", (unsigned long)(64 * 1024), NULL);
 
        /* parsing cookies */
-       if ((cookie_list = util_get_cookie_list((const char*)cookies))) {
+       if ((cookie_list = util_get_cookie_list((const char *)cookies))) {
                g_object_set(G_OBJECT(element), "cookies", cookie_list, NULL);
                g_strfreev(cookie_list);
        }
@@ -2791,10 +2776,10 @@ __mmplayer_gst_make_http_src(mm_player_t* player)
        return element;
 }
 
-static GstElement*
-__mmplayer_gst_make_file_src(mm_player_tplayer)
+static GstElement *
+__mmplayer_gst_make_file_src(mm_player_t *player)
 {
-       GstElementelement = NULL;
+       GstElement *element = NULL;
 
        MMPLAYER_FENTER();
        MMPLAYER_RETURN_VAL_IF_FAIL(player, NULL);
@@ -2811,15 +2796,16 @@ __mmplayer_gst_make_file_src(mm_player_t* player)
                return NULL;
        }
 
-       g_object_set(G_OBJECT(element), "location", (player->profile.uri)+7, NULL); /* uri+7 -> remove "file:// */
+       g_object_set(G_OBJECT(element), "location", (player->profile.uri) + 7, NULL); /* uri+7 -> remove "file:// */
 
        MMPLAYER_FLEAVE();
        return element;
 }
 
-static gboolean __mmplayer_gst_msg_push(GstBus *bus, GstMessage *msg, gpointer data)
+static gboolean
+__mmplayer_gst_msg_push(GstBus *bus, GstMessage *msg, gpointer data)
 {
-       mm_player_t *player = (mm_player_t *) data;
+       mm_player_t *player = (mm_player_t *)data;
 
        g_return_val_if_fail(player, FALSE);
        g_return_val_if_fail(msg && GST_IS_MESSAGE(msg), FALSE);
@@ -2838,7 +2824,7 @@ static gboolean __mmplayer_gst_msg_push(GstBus *bus, GstMessage *msg, gpointer d
 
 static gpointer __mmplayer_gst_bus_msg_thread(gpointer data)
 {
-       mm_player_t *player = (mm_player_t*)(data);
+       mm_player_t *player = (mm_player_t *)(data);
        GstMessage *msg = NULL;
        GstBus *bus = NULL;
 
@@ -2881,7 +2867,7 @@ static gpointer __mmplayer_gst_bus_msg_thread(gpointer data)
 }
 
 static int
-__mmplayer_gst_check_duration(mm_player_tplayer, gint64 position)
+__mmplayer_gst_check_duration(mm_player_t *player, gint64 position)
 {
        gint64 dur_nsec = 0;
 
@@ -2900,7 +2886,7 @@ __mmplayer_gst_check_duration(mm_player_t* player, gint64 position)
                         * Added a patch to postpone the actual seek when state changes to PLAY. Sending a fake SEEK_COMPLETED event to finish the current request. */
                        if ((MMPLAYER_IS_RTSP_STREAMING(player)) &&
                                (__mmplayer_get_stream_service_type(player) == STREAMING_SERVICE_VOD)) {
-                               player->pending_seek.is_pending = TRUE;
+                               player->pending_seek.is_pending = true;
                                player->pending_seek.pos = position;
                                player->seek_state = MMPLAYER_SEEK_NONE;
                                MMPLAYER_POST_MSG(player, MM_MESSAGE_SEEK_COMPLETED, NULL);
@@ -2923,7 +2909,7 @@ __mmplayer_gst_check_duration(mm_player_t* player, gint64 position)
 }
 
 static gboolean
-__mmplayer_gst_check_seekable(mm_player_tplayer)
+__mmplayer_gst_check_seekable(mm_player_t *player)
 {
        GstQuery *query = NULL;
        gboolean seekable = FALSE;
@@ -2950,12 +2936,8 @@ __mmplayer_gst_check_seekable(mm_player_t* player)
        return TRUE;
 }
 
-
-#if 0
-#endif
-
 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;
@@ -2966,13 +2948,12 @@ __mmplayer_gst_set_state(mm_player_t* player, GstElement * element,  GstState st
        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));
+       LOGD("setting [%s] element state to : %s", 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) {
-               LOGE("failed to set [%s] state\n", GST_ELEMENT_NAME(element));
+               LOGE("failed to set [%s] state", GST_ELEMENT_NAME(element));
 
                /* dump state of all element */
                __mmplayer_dump_pipeline_state(player);
@@ -2982,19 +2963,18 @@ __mmplayer_gst_set_state(mm_player_t* player, GstElement * element,  GstState st
 
        /* return here so state transition to be done in async mode */
        if (async) {
-               LOGD("async state transition. not waiting for state complete.\n");
+               LOGD("async state transition. not waiting for state complete.");
                return MM_ERROR_NONE;
        }
 
        /* wait for state transition */
        ret = gst_element_get_state(element, &element_state, &element_pending_state, timeout * GST_SECOND);
-
        if (ret == GST_STATE_CHANGE_FAILURE || (state != element_state)) {
-               LOGE("failed to change [%s] element state to [%s] within %d sec\n",
+               LOGE("failed to change [%s] element state to [%s] within %d sec",
                        GST_ELEMENT_NAME(element),
                        gst_element_state_get_name(state), timeout);
 
-               LOGE(" [%s] state : %s   pending : %s \n",
+               LOGE(" [%s] state : %s   pending : %s",
                        GST_ELEMENT_NAME(element),
                        gst_element_state_get_name(element_state),
                        gst_element_state_get_name(element_pending_state));
@@ -3005,14 +2985,15 @@ __mmplayer_gst_set_state(mm_player_t* player, GstElement * element,  GstState st
                return MM_ERROR_PLAYER_INTERNAL;
        }
 
-       LOGD("[%s] element state has changed\n", GST_ELEMENT_NAME(element));
+       LOGD("[%s] element state has changed", GST_ELEMENT_NAME(element));
 
        MMPLAYER_FLEAVE();
 
        return MM_ERROR_NONE;
 }
 
-int __mmplayer_gst_start(mm_player_t* player)
+int
+__mmplayer_gst_start(mm_player_t *player)
 {
        int ret = MM_ERROR_NONE;
        gboolean async = FALSE;
@@ -3021,9 +3002,10 @@ int __mmplayer_gst_start(mm_player_t* player)
 
        MMPLAYER_RETURN_VAL_IF_FAIL(player && player->pipeline, MM_ERROR_PLAYER_NOT_INITIALIZED);
 
-       /* NOTE : if SetPosition was called before Start. do it now */
-       /* streaming doesn't support it. so it should be always sync */
-       /* !!create one more api to check if there is pending seek rather than checking variables */
+       /* NOTE : if SetPosition was called before Start. do it now
+        * streaming doesn't support it. so it should be always sync
+        * !!create one more api to check if there is pending seek rather than checking variables
+        */
        if (player->pending_seek.is_pending && !MMPLAYER_IS_STREAMING(player)) {
                MMPLAYER_TARGET_STATE(player) = MM_PLAYER_STATE_PAUSED;
                ret = __mmplayer_gst_pause(player, FALSE);
@@ -3044,14 +3026,13 @@ int __mmplayer_gst_start(mm_player_t* player)
        /* set pipeline state to PLAYING  */
        ret = __mmplayer_gst_set_state(player,
                player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_STATE_PLAYING, async, MMPLAYER_STATE_CHANGE_TIMEOUT(player));
-
-       if (ret == MM_ERROR_NONE) {
-               MMPLAYER_SET_STATE(player, MM_PLAYER_STATE_PLAYING);
-       } else {
+       if (ret != MM_ERROR_NONE) {
                LOGE("failed to set state to PLAYING");
                return ret;
        }
 
+       MMPLAYER_SET_STATE(player, MM_PLAYER_STATE_PLAYING);
+
        /* generating debug info before returning error */
        MMPLAYER_GENERATE_DOT_IF_ENABLED(player, "pipeline-status-start");
 
@@ -3060,7 +3041,8 @@ int __mmplayer_gst_start(mm_player_t* player)
        return ret;
 }
 
-int __mmplayer_gst_stop(mm_player_t* player)
+int
+__mmplayer_gst_stop(mm_player_t *player)
 {
        GstStateChangeReturn change_ret = GST_STATE_CHANGE_SUCCESS;
        MMHandleType attrs = 0;
@@ -3079,7 +3061,7 @@ int __mmplayer_gst_stop(mm_player_t* player)
 
        attrs = MMPLAYER_GET_ATTRS(player);
        if (!attrs) {
-               LOGE("cannot get content attribute\n");
+               LOGE("cannot get content attribute");
                return MM_ERROR_PLAYER_INTERNAL;
        }
 
@@ -3090,22 +3072,21 @@ int __mmplayer_gst_stop(mm_player_t* player)
                (player->streaming_type == STREAMING_SERVICE_VOD && player->videodec_linked))
                rewind = TRUE;
 
-       if (player->es_player_push_mode || MMPLAYER_IS_HTTP_PD(player)) {
+       if (player->es_player_push_mode)
                /* disable the async state transition because there could be no data in the pipeline */
                __mmplayer_gst_set_async(player, FALSE, MMPLAYER_SINK_ALL);
-       }
 
        /* set gst state */
        ret = __mmplayer_gst_set_state(player, player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_STATE_PAUSED, FALSE, timeout);
 
-       if (player->es_player_push_mode || MMPLAYER_IS_HTTP_PD(player)) {
+       if (player->es_player_push_mode) {
                /* enable the async state transition as default operation */
                __mmplayer_gst_set_async(player, TRUE, MMPLAYER_SINK_ALL);
        }
 
        /* return if set_state has failed */
        if (ret != MM_ERROR_NONE) {
-               LOGE("failed to set state.\n");
+               LOGE("failed to set state.");
                return ret;
        }
 
@@ -3114,7 +3095,7 @@ int __mmplayer_gst_stop(mm_player_t* player)
                if (!__mmplayer_gst_seek(player, player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, player->playback_rate,
                                GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH, GST_SEEK_TYPE_SET, 0,
                                GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE)) {
-                       LOGW("failed to rewind\n");
+                       LOGW("failed to rewind");
                        ret = MM_ERROR_PLAYER_SEEK;
                }
        }
@@ -3130,7 +3111,7 @@ int __mmplayer_gst_stop(mm_player_t* player)
        if (change_ret == GST_STATE_CHANGE_SUCCESS || change_ret == GST_STATE_CHANGE_NO_PREROLL) {
                MMPLAYER_SET_STATE(player, MM_PLAYER_STATE_READY);
        } else {
-               LOGE("fail to stop player.\n");
+               LOGE("fail to stop player.");
                ret = MM_ERROR_PLAYER_INTERNAL;
                __mmplayer_dump_pipeline_state(player);
        }
@@ -3143,7 +3124,8 @@ int __mmplayer_gst_stop(mm_player_t* player)
        return ret;
 }
 
-int __mmplayer_gst_pause(mm_player_t* player, gboolean async)
+int
+__mmplayer_gst_pause(mm_player_t *player, gboolean async)
 {
        int ret = MM_ERROR_NONE;
 
@@ -3160,80 +3142,80 @@ int __mmplayer_gst_pause(mm_player_t* player, gboolean async)
        ret = __mmplayer_gst_set_state(player,
                player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_STATE_PAUSED, async, MMPLAYER_STATE_CHANGE_TIMEOUT(player));
 
-       if (FALSE == async) {
-               if (ret != MM_ERROR_NONE) {
-                       GstMessage *msg = NULL;
-                       GTimer *timer = NULL;
-                       gdouble MAX_TIMEOUT_SEC = 3;
+       if (async)
+               goto EXIT;
 
-                       LOGE("failed to set state to PAUSED");
+       if (ret != MM_ERROR_NONE) {
+               GstMessage *msg = NULL;
+               GTimer *timer = NULL;
+               gdouble MAX_TIMEOUT_SEC = 3;
 
-                       if (!player->bus_watcher) {
-                               LOGE("there is no bus msg thread. pipeline is shutting down.");
-                               return ret;
-                       }
+               LOGE("failed to set state to PAUSED");
 
-                       if (player->msg_posted) {
-                               LOGE("error msg is already posted.");
-                               return ret;
-                       }
+               if (!player->bus_watcher) {
+                       LOGE("there is no bus msg thread. pipeline is shutting down.");
+                       return ret;
+               }
 
-                       timer = g_timer_new();
-                       g_timer_start(timer);
+               if (player->msg_posted) {
+                       LOGE("error msg is already posted.");
+                       return ret;
+               }
 
-                       GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst));
+               timer = g_timer_new();
+               g_timer_start(timer);
 
-                       do {
-                               msg = gst_bus_timed_pop(bus, 100 * GST_MSECOND);
-                               if (msg) {
-                                       if (GST_MESSAGE_TYPE(msg) == GST_MESSAGE_ERROR) {
-                                               GError *error = NULL;
+               GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst));
 
-                                               /* parse error code */
-                                               gst_message_parse_error(msg, &error, NULL);
+               do {
+                       msg = gst_bus_timed_pop(bus, 100 * GST_MSECOND);
+                       if (msg) {
+                               if (GST_MESSAGE_TYPE(msg) == GST_MESSAGE_ERROR) {
+                                       GError *error = NULL;
 
-                                               if (gst_structure_has_name(gst_message_get_structure(msg), "streaming_error")) {
-                                                       /* Note : the streaming error from the streaming source is handled
-                                                        *   using __mmplayer_handle_streaming_error.
-                                                        */
-                                                       __mmplayer_handle_streaming_error(player, msg);
+                                       /* parse error code */
+                                       gst_message_parse_error(msg, &error, NULL);
 
-                                               } else if (error) {
-                                                       LOGE("paring error posted from bus, domain : %s, code : %d", g_quark_to_string(error->domain), error->code);
+                                       if (gst_structure_has_name(gst_message_get_structure(msg), "streaming_error")) {
+                                               /* Note : the streaming error from the streaming source is handled
+                                                       *   using __mmplayer_handle_streaming_error.
+                                                       */
+                                               __mmplayer_handle_streaming_error(player, msg);
 
-                                                       if (error->domain == GST_STREAM_ERROR)
-                                                               ret = __mmplayer_gst_handle_stream_error(player, error, msg);
-                                                       else if (error->domain == GST_RESOURCE_ERROR)
-                                                               ret = __mmplayer_gst_handle_resource_error(player, error->code, NULL);
-                                                       else if (error->domain == GST_LIBRARY_ERROR)
-                                                               ret = __mmplayer_gst_handle_library_error(player, error->code);
-                                                       else if (error->domain == GST_CORE_ERROR)
-                                                               ret = __mmplayer_gst_handle_core_error(player, error->code);
+                                       } else if (error) {
+                                               LOGE("paring error posted from bus, domain : %s, code : %d", g_quark_to_string(error->domain), error->code);
 
-                                                       g_error_free(error);
-                                               }
-                                               player->msg_posted = TRUE;
+                                               if (error->domain == GST_STREAM_ERROR)
+                                                       ret = __mmplayer_gst_handle_stream_error(player, error, msg);
+                                               else if (error->domain == GST_RESOURCE_ERROR)
+                                                       ret = __mmplayer_gst_handle_resource_error(player, error->code, NULL);
+                                               else if (error->domain == GST_LIBRARY_ERROR)
+                                                       ret = __mmplayer_gst_handle_library_error(player, error->code);
+                                               else if (error->domain == GST_CORE_ERROR)
+                                                       ret = __mmplayer_gst_handle_core_error(player, error->code);
+
+                                               g_error_free(error);
                                        }
-                                       gst_message_unref(msg);
+                                       player->msg_posted = TRUE;
                                }
-                       } while (!player->msg_posted && (g_timer_elapsed(timer, NULL) < MAX_TIMEOUT_SEC));
-                       /* clean */
-                       gst_object_unref(bus);
-                       g_timer_stop(timer);
-                       g_timer_destroy(timer);
-
-                       return ret;
+                               gst_message_unref(msg);
+                       }
+               } while (!player->msg_posted && (g_timer_elapsed(timer, NULL) < MAX_TIMEOUT_SEC));
+               /* clean */
+               gst_object_unref(bus);
+               g_timer_stop(timer);
+               g_timer_destroy(timer);
 
-               } else if ((!MMPLAYER_IS_RTSP_STREAMING(player)) && (!player->video_stream_cb) &&
-                                  (!player->pipeline->videobin) && (!player->pipeline->audiobin)) {
+               return ret;
+       }
 
-                       return MM_ERROR_PLAYER_CODEC_NOT_FOUND;
+       if ((!MMPLAYER_IS_RTSP_STREAMING(player)) && (!player->video_stream_cb) &&
+               (!player->pipeline->videobin) && (!player->pipeline->audiobin))
+               return MM_ERROR_PLAYER_CODEC_NOT_FOUND;
 
-               } else {
-                       MMPLAYER_SET_STATE(player, MM_PLAYER_STATE_PAUSED);
-               }
-       }
+       MMPLAYER_SET_STATE(player, MM_PLAYER_STATE_PAUSED);
 
+EXIT:
        /* generate dot file before returning error */
        MMPLAYER_GENERATE_DOT_IF_ENABLED(player, "pipeline-status-pause");
 
@@ -3242,7 +3224,8 @@ int __mmplayer_gst_pause(mm_player_t* player, gboolean async)
        return ret;
 }
 
-int __mmplayer_gst_resume(mm_player_t* player, gboolean async)
+int
+__mmplayer_gst_resume(mm_player_t *player, gboolean async)
 {
        int ret = MM_ERROR_NONE;
        gint timeout = 0;
@@ -3267,11 +3250,11 @@ int __mmplayer_gst_resume(mm_player_t* player, gboolean async)
        if (ret != MM_ERROR_NONE) {
                LOGE("failed to set state to PLAYING");
                goto EXIT;
-       } else {
-               if (async == FALSE)
-                       MMPLAYER_SET_STATE(player, MM_PLAYER_STATE_PLAYING);
        }
 
+       if (!async)
+               MMPLAYER_SET_STATE(player, MM_PLAYER_STATE_PLAYING);
+
 EXIT:
        /* generate dot file */
        MMPLAYER_GENERATE_DOT_IF_ENABLED(player, "pipeline-status-resume");
@@ -3283,9 +3266,9 @@ EXIT:
 
 /* sending event to one of sinkelements */
 gboolean
-__mmplayer_gst_send_event_to_sink(mm_player_t* player, GstEvent* event)
+__mmplayer_gst_send_event_to_sink(mm_player_t *player, GstEvent *event)
 {
-       GstEvent * event2 = NULL;
+       GstEvent *event2 = NULL;
        GList *sinks = NULL;
        gboolean res = FALSE;
        MMPLAYER_FENTER();
@@ -3314,14 +3297,14 @@ __mmplayer_gst_send_event_to_sink(mm_player_t* player, GstEvent* event)
                        gst_event_ref(event);
 
                        if ((res = gst_element_send_event(sink, event))) {
-                               LOGD("sending event[%s] to sink element [%s] success!\n",
+                               LOGD("sending event[%s] to sink element [%s] success!",
                                        GST_EVENT_TYPE_NAME(event), GST_ELEMENT_NAME(sink));
 
                                /* rtsp case, asyn_done is not called after seek during pause state */
                                if (MMPLAYER_IS_RTSP_STREAMING(player)) {
                                        if (GST_EVENT_TYPE(event) == GST_EVENT_SEEK) {
                                                if (MMPLAYER_TARGET_STATE(player) == MM_PLAYER_STATE_PAUSED) {
-                                                       LOGD("RTSP seek completed, after pause state..\n");
+                                                       LOGD("RTSP seek completed, after pause state..");
                                                        player->seek_state = MMPLAYER_SEEK_NONE;
                                                        MMPLAYER_POST_MSG(player, MM_MESSAGE_SEEK_COMPLETED, NULL);
                                                }
@@ -3337,7 +3320,7 @@ __mmplayer_gst_send_event_to_sink(mm_player_t* player, GstEvent* event)
                                }
                        }
 
-                       LOGD("sending event[%s] to sink element [%s] failed. try with next one.\n",
+                       LOGD("sending event[%s] to sink element [%s] failed. try with next one.",
                                GST_EVENT_TYPE_NAME(event), GST_ELEMENT_NAME(sink));
                }
 
@@ -3345,8 +3328,8 @@ __mmplayer_gst_send_event_to_sink(mm_player_t* player, GstEvent* event)
        }
 
        /* Note : Textbin is not linked to the video or audio bin.
-       * It needs to send the event to the text sink seperatelly.
-       */
+        * It needs to send the event to the text sink seperatelly.
+        */
        if (player->play_subtitle && player->pipeline) {
                GstElement *text_sink = GST_ELEMENT_CAST(player->pipeline->textbin[MMPLAYER_T_FAKE_SINK].gst);
 
@@ -3373,11 +3356,11 @@ __mmplayer_gst_send_event_to_sink(mm_player_t* player, GstEvent* event)
 }
 
 gboolean
-__mmplayer_gst_seek(mm_player_t* player, GstElement * element, gdouble rate,
+__mmplayer_gst_seek(mm_player_t *player, GstElement *element, gdouble rate,
                        GstFormat format, GstSeekFlags flags, GstSeekType cur_type,
                        gint64 cur, GstSeekType stop_type, gint64 stop)
 {
-       GstEventevent = NULL;
+       GstEvent *event = NULL;
        gboolean result = FALSE;
 
        MMPLAYER_FENTER();
@@ -3398,7 +3381,7 @@ __mmplayer_gst_seek(mm_player_t* player, GstElement * element, gdouble rate,
 }
 
 int
-__mmplayer_gst_set_position(mm_player_tplayer, gint64 position, gboolean internal_called)
+__mmplayer_gst_set_position(mm_player_t *player, gint64 position, gboolean internal_called)
 {
        int ret = MM_ERROR_NONE;
        gint64 pos_nsec = 0;
@@ -3409,14 +3392,14 @@ __mmplayer_gst_set_position(mm_player_t* player, gint64 position, gboolean inter
        MMPLAYER_RETURN_VAL_IF_FAIL(player && player->pipeline, MM_ERROR_PLAYER_NOT_INITIALIZED);
        MMPLAYER_RETURN_VAL_IF_FAIL(!MMPLAYER_IS_LIVE_STREAMING(player), MM_ERROR_PLAYER_NO_OP);
 
-       if (MMPLAYER_CURRENT_STATE(player) != MM_PLAYER_STATE_PLAYING
-               && MMPLAYER_CURRENT_STATE(player) != MM_PLAYER_STATE_PAUSED)
+       if ((MMPLAYER_CURRENT_STATE(player) != MM_PLAYER_STATE_PLAYING)
+               && (MMPLAYER_CURRENT_STATE(player) != MM_PLAYER_STATE_PAUSED))
                goto PENDING;
 
        ret = __mmplayer_gst_check_duration(player, position);
        if (ret != MM_ERROR_NONE) {
                LOGE("failed to check duration 0x%X", ret);
-               return (ret == MM_ERROR_PLAYER_NO_OP) ? (MM_ERROR_NONE) : (ret);
+               return (ret == MM_ERROR_PLAYER_NO_OP) ? MM_ERROR_NONE : ret;
        }
 
        if (!__mmplayer_gst_check_seekable(player))
@@ -3475,8 +3458,8 @@ __mmplayer_gst_set_position(mm_player_t* player, gint64 position, gboolean inter
        }
 
        /* NOTE : store last seeking point to overcome some bad operation
-         *     (returning zero when getting current position) of some elements
-         */
+        *     (returning zero when getting current position) of some elements
+        */
        player->last_position = position;
 
        /* MSL should guarante playback rate when seek is selected during trick play of fast forward. */
@@ -3493,7 +3476,7 @@ __mmplayer_gst_set_position(mm_player_t* player, gint64 position, gboolean inter
        return MM_ERROR_NONE;
 
 PENDING:
-       player->pending_seek.is_pending = TRUE;
+       player->pending_seek.is_pending = true;
        player->pending_seek.pos = position;
 
        LOGW("player current-state : %s, pending-state : %s, just preserve pending position(%"G_GINT64_FORMAT")",
@@ -3509,7 +3492,7 @@ SEEK_ERROR:
 }
 
 int
-__mmplayer_gst_get_position(mm_player_t* player, gint64* position)
+__mmplayer_gst_get_position(mm_player_t *player, gint64 *position)
 {
 #define TRICKPLAY_OFFSET GST_MSECOND
 
@@ -3559,7 +3542,8 @@ __mmplayer_gst_get_position(mm_player_t* player, gint64* position)
        return MM_ERROR_NONE;
 }
 
-int __mmplayer_gst_get_buffer_position(mm_player_t* player, int format, unsigned long* start_pos, unsigned long* stop_pos)
+int
+__mmplayer_gst_get_buffer_position(mm_player_t *player, int *start_pos, int *end_pos)
 {
 #define STREAMING_IS_FINISHED  0
 #define BUFFERING_MAX_PER      100
@@ -3567,7 +3551,7 @@ int __mmplayer_gst_get_buffer_position(mm_player_t* player, int format, unsigned
 #define CHECK_PERCENT_VALUE(a, min, max)(((a) > (min)) ? (((a) < (max)) ? (a) : (max)) : (min))
 
        MMPlayerGstElement *mainbin = NULL;
-       gint start_per = DEFAULT_PER_VALUE, stop_per = DEFAULT_PER_VALUE;
+       gint start_per = DEFAULT_PER_VALUE, end_per = DEFAULT_PER_VALUE;
        gint64 buffered_total = 0;
        gint64 position = 0;
        gint buffered_sec = -1;
@@ -3580,10 +3564,10 @@ int __mmplayer_gst_get_buffer_position(mm_player_t* player, int format, unsigned
                                                player->pipeline->mainbin,
                                                MM_ERROR_PLAYER_NOT_INITIALIZED);
 
-       MMPLAYER_RETURN_VAL_IF_FAIL(start_pos && stop_pos, MM_ERROR_INVALID_ARGUMENT);
+       MMPLAYER_RETURN_VAL_IF_FAIL(start_pos && end_pos, MM_ERROR_INVALID_ARGUMENT);
 
        *start_pos = 0;
-       *stop_pos = 0;
+       *end_pos = 0;
 
        if (!MMPLAYER_IS_HTTP_STREAMING(player)) {
                /* and rtsp is not ready yet. */
@@ -3591,11 +3575,6 @@ int __mmplayer_gst_get_buffer_position(mm_player_t* player, int format, unsigned
                return MM_ERROR_PLAYER_NO_OP;
        }
 
-       if (format != MM_PLAYER_POS_FORMAT_PERCENT) {
-               LOGW("Time format is not supported yet");
-               return MM_ERROR_INVALID_ARGUMENT;
-       }
-
        if (content_size_time <= 0 || content_size_bytes <= 0) {
                LOGW("there is no content size");
                return MM_ERROR_NONE;
@@ -3610,7 +3589,7 @@ int __mmplayer_gst_get_buffer_position(mm_player_t* player, int format, unsigned
                GST_TIME_AS_MSECONDS(position), (guint)GST_TIME_AS_SECONDS(content_size_time), content_size_bytes);
 
        mainbin = player->pipeline->mainbin;
-       start_per = (gint)(floor(100 *(gdouble)position / (gdouble)content_size_time));
+       start_per = (gint)(floor(100 * (gdouble)position / (gdouble)content_size_time));
 
        if (mainbin[MMPLAYER_M_MUXED_S_BUFFER].gst) {
                GstQuery *query = NULL;
@@ -3633,7 +3612,7 @@ int __mmplayer_gst_get_buffer_position(mm_player_t* player, int format, unsigned
                        if (gst_element_query_position(mainbin[MMPLAYER_M_SRC].gst,
                                GST_FORMAT_BYTES, &buffered_total)) {
                                LOGD("buffered_total %"G_GINT64_FORMAT, buffered_total);
-                               stop_per = 100 * buffered_total / content_size_bytes;
+                               end_per = 100 * buffered_total / content_size_bytes;
                        }
                } else {
                        /* GST_BUFFERING_TIMESHIFT or GST_BUFFERING_DOWNLOAD */
@@ -3651,16 +3630,17 @@ int __mmplayer_gst_get_buffer_position(mm_player_t* player, int format, unsigned
 
                                        buffered_total += (stop_byte - start_byte);
                                }
-                       } else
-                               stop_per = BUFFERING_MAX_PER;
+                       } else {
+                               end_per = BUFFERING_MAX_PER;
+                       }
                }
                gst_query_unref(query);
        }
 
-       if (stop_per == DEFAULT_PER_VALUE) {
+       if (end_per == DEFAULT_PER_VALUE) {
                guint dur_sec = (guint)(content_size_time/GST_SECOND);
                if (dur_sec > 0) {
-                       guint avg_byterate = (guint)(content_size_bytes/dur_sec);
+                       guint avg_byterate = (guint)(content_size_bytes / dur_sec);
 
                        /* buffered size info from multiqueue */
                        if (mainbin[MMPLAYER_M_DEMUXED_S_BUFFER].gst) {
@@ -3672,29 +3652,30 @@ int __mmplayer_gst_get_buffer_position(mm_player_t* player, int format, unsigned
                        }
 
                        if (avg_byterate > 0)
-                               buffered_sec = (gint)(ceil((gdouble)buffered_total/(gdouble)avg_byterate));
+                               buffered_sec = (gint)(ceil((gdouble)buffered_total / (gdouble)avg_byterate));
                        else if (player->total_maximum_bitrate > 0)
-                               buffered_sec = (gint)(ceil((gdouble)GET_BIT_FROM_BYTE(buffered_total)/(gdouble)player->total_maximum_bitrate));
+                               buffered_sec = (gint)(ceil((gdouble)GET_BIT_FROM_BYTE(buffered_total) / (gdouble)player->total_maximum_bitrate));
                        else if (player->total_bitrate > 0)
-                               buffered_sec = (gint)(ceil((gdouble)GET_BIT_FROM_BYTE(buffered_total)/(gdouble)player->total_bitrate));
+                               buffered_sec = (gint)(ceil((gdouble)GET_BIT_FROM_BYTE(buffered_total) / (gdouble)player->total_bitrate));
 
                        if (buffered_sec >= 0)
-                               stop_per = start_per +(gint)(ceil)(100*(gdouble)buffered_sec/(gdouble)dur_sec);
+                               end_per = start_per + (gint)(ceil)(100 * (gdouble)buffered_sec / (gdouble)dur_sec);
                }
        }
 
        *start_pos = CHECK_PERCENT_VALUE(start_per, 0, 100);
-       *stop_pos = CHECK_PERCENT_VALUE(stop_per, *start_pos, 100);
+       *end_pos = CHECK_PERCENT_VALUE(end_per, *start_pos, 100);
 
-       LOGD("buffered info: %"G_GINT64_FORMAT" bytes, %d sec, per %lu~%lu",
-               buffered_total, buffered_sec, *start_pos, *stop_pos);
+       LOGD("buffered info: %"G_GINT64_FORMAT" bytes, %d sec, per %d~%d",
+               buffered_total, buffered_sec, *start_pos, *end_pos);
 
        return MM_ERROR_NONE;
 }
 
-GstElement* __mmplayer_gst_create_source(mm_player_t* player)
+GstElement *
+__mmplayer_gst_create_source(mm_player_t *player)
 {
-       GstElementelement = NULL;
+       GstElement *element = NULL;
 
        MMPLAYER_FENTER();
        MMPLAYER_RETURN_VAL_IF_FAIL(player && player->pipeline &&
@@ -3723,7 +3704,8 @@ GstElement* __mmplayer_gst_create_source(mm_player_t* player)
        return element;
 }
 
-int __mmplayer_gst_build_es_pipeline(mm_player_t* player)
+int
+__mmplayer_gst_build_es_pipeline(mm_player_t *player)
 {
        MMHandleType attrs = 0;
 
@@ -3757,144 +3739,13 @@ int __mmplayer_gst_build_es_pipeline(mm_player_t* player)
        return MM_ERROR_NONE;
 }
 
-int __mmplayer_gst_build_pd_pipeline(mm_player_t* player)
-{
-       MMPlayerGstElement *mainbin = NULL;
-       GstElement *pd_src = NULL;
-       GstElement *pd_queue = NULL;
-       GstElement *pd_decodebin = NULL;
-       GList* element_bucket = NULL;
-       MMHandleType attrs = 0;
-       gchar *path = NULL;
-       gint pre_buffering_time = player->streamer->buffering_req.prebuffer_time;
-
-       MMPLAYER_FENTER();
-       MMPLAYER_RETURN_VAL_IF_FAIL(player && player->pipeline &&
-                               player->pipeline->mainbin, MM_ERROR_PLAYER_NOT_INITIALIZED);
-
-       /* get profile attribute */
-       attrs = MMPLAYER_GET_ATTRS(player);
-       if (!attrs) {
-               LOGE("failed to get content attribute");
-               return MM_ERROR_PLAYER_INTERNAL;
-       }
-
-       LOGD("http playback with progressive download : %d", player->pd_mode);
-
-       if (player->pd_mode == MM_PLAYER_PD_MODE_URI) {
-               mm_attrs_get_string_by_name(attrs, "pd_location", &path);
-               MMPLAYER_FREEIF(player->pd_file_save_path);
-
-               SECURE_LOGD("PD Location : %s", path);
-               if (!path) {
-                       LOGE("filed to find pd location");
-                       return MM_ERROR_PLAYER_INTERNAL;
-               }
-
-               if (!util_get_storage_info(path, &player->storage_info[MMPLAYER_PATH_VOD])) {
-                       LOGE("failed to get storage info");
-                       return MM_ERROR_PLAYER_INTERNAL;
-               }
-               player->pd_file_save_path = g_strdup(path);
-       }
-
-       pd_src = gst_element_factory_make("pdpushsrc", "PD pushsrc");
-       if (!pd_src) {
-               LOGE("failed to create PD push source");
-               return MM_ERROR_PLAYER_INTERNAL;
-       }
-
-       if (player->pd_mode == MM_PLAYER_PD_MODE_URI)
-               g_object_set(G_OBJECT(pd_src), "location", player->pd_file_save_path, NULL);
-       else
-               g_object_set(G_OBJECT(pd_src), "location", player->profile.uri, NULL);
-
-       mainbin = player->pipeline->mainbin;
-
-       /* take source element */
-       mainbin[MMPLAYER_M_SRC].id = MMPLAYER_M_SRC;
-       mainbin[MMPLAYER_M_SRC].gst = pd_src;
-       element_bucket = g_list_append(element_bucket, &mainbin[MMPLAYER_M_SRC]);
-
-       /* setting queue */
-       LOGD("Picked queue2 element(pre buffer : %d ms)", pre_buffering_time);
-       pd_queue = gst_element_factory_make("queue2", "queue2");
-       if (!pd_queue) {
-               LOGE("failed to create pd buffer element");
-               goto ERROR;
-       }
-
-       /* take queue2 */
-       mainbin[MMPLAYER_M_MUXED_S_BUFFER].id = MMPLAYER_M_MUXED_S_BUFFER;
-       mainbin[MMPLAYER_M_MUXED_S_BUFFER].gst = pd_queue;
-       element_bucket = g_list_append(element_bucket, &mainbin[MMPLAYER_M_MUXED_S_BUFFER]);
-
-       pre_buffering_time = (pre_buffering_time > 0) ? (pre_buffering_time) : (player->ini.http_buffering_time);
-
-       player->streamer->is_pd_mode = TRUE;
-
-       __mm_player_streaming_set_queue2(player->streamer, pd_queue, TRUE,
-                       player->ini.http_max_size_bytes, pre_buffering_time, 1.0,
-                       player->ini.http_buffering_limit, MUXED_BUFFER_TYPE_MEM_QUEUE, NULL, 0);
-
-       pd_decodebin = __mmplayer_gst_make_decodebin(player);
-       if (!pd_decodebin) {
-               LOGE("failed to create decodebin");
-               goto ERROR;
-       }
-
-       /* default size of mq in decodebin is 2M
-        * but it can cause blocking issue during seeking depends on content. */
-       g_object_set(G_OBJECT(pd_decodebin), "max-size-bytes", (5*1024*1024), NULL);
-
-       mainbin[MMPLAYER_M_AUTOPLUG].id = MMPLAYER_M_AUTOPLUG;
-       mainbin[MMPLAYER_M_AUTOPLUG].gst = pd_decodebin;
-
-       element_bucket = g_list_append(element_bucket, &mainbin[MMPLAYER_M_AUTOPLUG]);
-
-       /* add elements to pipeline */
-       if (!__mmplayer_gst_element_add_bucket_to_bin(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), element_bucket)) {
-               LOGE("failed to add elements to pipeline");
-               goto ERROR;
-       }
-
-       /* linking elements in the bucket by added order. */
-       if (__mmplayer_gst_element_link_bucket(element_bucket) == -1) {
-               LOGE("failed to link some elements");
-               goto ERROR;
-       }
-
-       g_list_free(element_bucket);
-
-       MMPLAYER_FLEAVE();
-       return MM_ERROR_NONE;
-
-ERROR:
-       MMPLAYER_FREEIF(player->pd_file_save_path);
-       g_list_free(element_bucket);
-
-       if (mainbin[MMPLAYER_M_SRC].gst)
-               gst_object_unref(GST_OBJECT(mainbin[MMPLAYER_M_SRC].gst));
-
-       if (mainbin[MMPLAYER_M_MUXED_S_BUFFER].gst)
-               gst_object_unref(GST_OBJECT(mainbin[MMPLAYER_M_MUXED_S_BUFFER].gst));
-
-       if (mainbin[MMPLAYER_M_AUTOPLUG].gst)
-               gst_object_unref(GST_OBJECT(mainbin[MMPLAYER_M_AUTOPLUG].gst));
-
-       mainbin[MMPLAYER_M_SRC].gst = NULL;
-       mainbin[MMPLAYER_M_MUXED_S_BUFFER].gst = NULL;
-       mainbin[MMPLAYER_M_AUTOPLUG].gst = NULL;
-
-       return MM_ERROR_PLAYER_INTERNAL;
-}
-
-int __mmplayer_gst_build_pipeline(mm_player_t* player)
+int
+__mmplayer_gst_build_pipeline(mm_player_t *player)
 {
        MMPlayerGstElement *mainbin = NULL;
-       GstElementsrc_elem = NULL;
+       GstElement *src_elem = NULL;
        GstElement *autoplug_elem = NULL;
-       GListelement_bucket = NULL;
+       GList *element_bucket = NULL;
        MMHandleType attrs = 0;
        enum MainElementID autoplug_elem_id = MMPLAYER_M_NUM;
 
@@ -3999,7 +3850,7 @@ int __mmplayer_gst_build_pipeline(mm_player_t* player)
 
                /* default size of mq in decodebin is 2M
                 * but it can cause blocking issue during seeking depends on content. */
-               g_object_set(G_OBJECT(autoplug_elem), "max-size-bytes", (5*1024*1024), NULL);
+               g_object_set(G_OBJECT(autoplug_elem), "max-size-bytes", (5 * 1024 * 1024), NULL);
        }
 
        if (autoplug_elem) {
@@ -4068,7 +3919,8 @@ ERROR:
        return MM_ERROR_PLAYER_INTERNAL;
 }
 
-int __mmplayer_gst_add_bus_watch(mm_player_t* player)
+int
+__mmplayer_gst_add_bus_watch(mm_player_t *player)
 {
        GstBus  *bus = NULL;
        MMPlayerGstElement *mainbin = NULL;