[0.6.164] Apply tizen coding rule 58/196058/3 accepted/tizen/unified/20190108.124859 submit/tizen/20190107.101656
authorGilbok Lee <gilbok.lee@samsung.com>
Fri, 21 Dec 2018 05:34:17 +0000 (14:34 +0900)
committerGilbok Lee <gilbok.lee@samsung.com>
Wed, 26 Dec 2018 00:43:24 +0000 (09:43 +0900)
- modify space and brace
- Change FALSE to false, TRUE to true, if variable type is bool
- Remove '\n' in LOG

Change-Id: Ie97ee6c64b026293b298aa0144ccb462f5388ac8

26 files changed:
packaging/libmm-player.spec
src/include/mm_player.h
src/include/mm_player_audioeffect.h
src/include/mm_player_capture.h [changed mode: 0755->0644]
src/include/mm_player_es.h
src/include/mm_player_gst.h
src/include/mm_player_ini.h
src/include/mm_player_internal.h
src/include/mm_player_priv.h
src/include/mm_player_streaming.h
src/include/mm_player_tracks.h
src/include/mm_player_utils.h
src/mm_player.c
src/mm_player_360.c [changed mode: 0755->0644]
src/mm_player_attrs.c
src/mm_player_audioeffect.c
src/mm_player_capture.c
src/mm_player_es.c
src/mm_player_gst.c
src/mm_player_ini.c
src/mm_player_priv.c
src/mm_player_streaming.c
src/mm_player_tracks.c
src/mm_player_utils.c
unittest/gtest_mm_player_priv.cpp
unittest/unittest.cpp

index e279330..74ec0ba 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-player
 Summary:    Multimedia Framework Player Library
-Version:    0.6.163
+Version:    0.6.164
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index 2780433..ceca5b8 100644 (file)
@@ -405,16 +405,16 @@ typedef struct {
                * Validity structure for double array.
                */
                struct {
-                       double   * array;  /**< a pointer of array */
-                       int    count;   /**< size of array */
+                       double *array;  /**< a pointer of array */
+                       int count;   /**< size of array */
                        double d_val;
                } double_array;
                /**
                * Validity structure for double range.
                */
                struct {
-                       double   min;   /**< minimum range */
-                       double   max;   /**< maximum range */
+                       double min;   /**< minimum range */
+                       double max;   /**< maximum range */
                        double d_val;
                } double_range;
        };
@@ -426,7 +426,7 @@ typedef struct {
  * @see                mm_player_set_volume, mm_player_get_volume
  */
 typedef struct {
-       float   level[MM_VOLUME_CHANNEL_NUM];   /**< Relative volume factor for each channels */
+       float level[MM_VOLUME_CHANNEL_NUM];     /**< Relative volume factor for each channels */
 } MMPlayerVolumeType;
 
 /**
@@ -483,7 +483,7 @@ typedef struct _SubtitleStreamInfo {
  *
  * @return     This callback function have to return MM_ERROR_NONE.
  */
-typedef bool           (*mm_player_track_selected_subtitle_language_callback)(int track_num, void *user_param);
+typedef bool (*mm_player_track_selected_subtitle_language_callback)(int track_num, void *user_param);
 
 /**
  * Buffer underrun / overflow data callback function type.
@@ -494,7 +494,7 @@ typedef bool                (*mm_player_track_selected_subtitle_language_callback)(int track_n
  *
  * @return     This callback function have to return MM_ERROR_NONE.
  */
-typedef bool   (*mm_player_media_stream_buffer_status_callback) (MMPlayerStreamType type, MMPlayerMediaStreamBufferStatus status, unsigned long long bytes, void *user_param);
+typedef bool (*mm_player_media_stream_buffer_status_callback)(MMPlayerStreamType type, MMPlayerMediaStreamBufferStatus status, unsigned long long bytes, void *user_param);
 
 /**
  * Buffer seek data callback function type.
@@ -505,7 +505,7 @@ typedef bool        (*mm_player_media_stream_buffer_status_callback) (MMPlayerStreamTyp
  *
  * @return     This callback function have to return MM_ERROR_NONE.
  */
-typedef bool   (*mm_player_media_stream_seek_data_callback) (MMPlayerStreamType type, unsigned long long offset, void *user_param);
+typedef bool (*mm_player_media_stream_seek_data_callback)(MMPlayerStreamType type, unsigned long long offset, void *user_param);
 
 /**
  * Called to notify the stream changed.
@@ -514,7 +514,7 @@ typedef bool        (*mm_player_media_stream_seek_data_callback) (MMPlayerStreamType ty
  *
  * @return     This callback function have to return MM_ERROR_NONE.
  */
-typedef bool   (*mm_player_stream_changed_callback) (void *user_param);
+typedef bool (*mm_player_stream_changed_callback)(void *user_param);
 
 
 /*===========================================================================================
@@ -551,13 +551,13 @@ if (mm_player_create(&g_player) != MM_ERROR_NONE) {
 if (mm_player_set_attribute(g_player,
                                                &g_err_attr_name,
                                                "profile_uri", filename, strlen(filename),
-                                               "display_overlay", (void*)&g_win.xid, sizeof(g_win.xid),
+                                               "display_overlay", (void *)&g_win.xid, sizeof(g_win.xid),
                                                NULL) != MM_ERROR_NONE) {
        LOGE("failed to set %s attribute\n", g_err_attr_name);
        free(g_err_attr_name);
 }
 
-mm_player_set_message_callback(g_player, msg_callback, (void*)g_player);
+mm_player_set_message_callback(g_player, msg_callback, (void *)g_player);
  * @endcode
  */
 int mm_player_create(MMHandleType *player);
@@ -889,7 +889,7 @@ int msg_callback(int message, MMMessageParamType *param, void *user_param)
        return TRUE;
 }
 
-mm_player_set_message_callback(g_player, msg_callback, (void*)g_player);
+mm_player_set_message_callback(g_player, msg_callback, (void *)g_player);
  * @endcode
  */
 int mm_player_set_message_callback(MMHandleType player, MMMessageCallback callback, void *user_param);
@@ -1162,7 +1162,7 @@ int mm_player_get_current_track(MMHandleType hplayer, MMPlayerTrackType type, in
  *
  * @return      This function returns zero on success, or negative value with error code.
  */
-int mm_player_set_external_subtitle_path(MMHandleType player, const charpath);
+int mm_player_set_external_subtitle_path(MMHandleType player, const char *path);
 
 /**
  * This function is to set uri.
@@ -1245,7 +1245,7 @@ int mm_player_set_subtitle_info(MMHandleType player, MMPlayerSubtitleStreamInfo
  * @return  This function returns zero on success, or negative value with error
  *          code.
  */
-int mm_player_set_media_stream_buffer_status_callback(MMHandleType player, MMPlayerStreamType type, mm_player_media_stream_buffer_status_callback callback, void * user_param);
+int mm_player_set_media_stream_buffer_status_callback(MMHandleType player, MMPlayerStreamType type, mm_player_media_stream_buffer_status_callback callback, void *user_param);
 
 /**
  * This function set callback function for receiving seek data message from player.
@@ -1258,7 +1258,7 @@ int mm_player_set_media_stream_buffer_status_callback(MMHandleType player, MMPla
  * @return      This function returns zero on success, or negative value with error
  *                      code.
  */
-int mm_player_set_media_stream_seek_data_callback(MMHandleType player, MMPlayerStreamType type, mm_player_media_stream_seek_data_callback callback, void * user_param);
+int mm_player_set_media_stream_seek_data_callback(MMHandleType player, MMPlayerStreamType type, mm_player_media_stream_seek_data_callback callback, void *user_param);
 
 /**
  * This function is to set max size of buffer(appsrc).
@@ -1388,7 +1388,7 @@ int mm_player_set_media_stream_dynamic_resolution(MMHandleType player, bool drc)
  *                     code.
  * @since 3.0
  */
-int mm_player_release_video_stream_bo(MMHandleType player, voidbo);
+int mm_player_release_video_stream_bo(MMHandleType player, void *bo);
 
 /**
  * This function is to set http file buffering path
index ec47722..145a1f7 100644 (file)
@@ -135,7 +135,7 @@ typedef struct {
  * @return     True to continue with the next iteration of the loop, False to break out of the loop.
  * @see                mm_player_get_foreach_present_supported_effect_type()
  */
-typedef bool (*mmplayer_supported_audio_effect_cb) (int effect_type, int type, void *user_data);
+typedef bool (*mmplayer_supported_audio_effect_cb)(int effect_type, int type, void *user_data);
 
 /**
  * This function is to get supported effect type.
old mode 100755 (executable)
new mode 100644 (file)
index bf0de1f..eab5370
@@ -34,7 +34,7 @@
 #endif
 
 #define MAX_BUFFER_PLANE       3
-#define MM_ALIGN(x, a)      (((x) +(a) - 1) & ~((a) - 1))
+#define MM_ALIGN(x, a)      (((x) + (a) - 1) & ~((a) - 1))
 
 /*=======================================================================================
 | GLOBAL FUNCTION PROTOTYPES                                                           |
@@ -48,7 +48,8 @@
  * @see
  *
  */
-int _mmplayer_initialize_video_capture(mm_player_t* player);
+int _mmplayer_initialize_video_capture(mm_player_t *player);
+
 /**
  * This function is to release video capture
  *
@@ -58,7 +59,8 @@ int _mmplayer_initialize_video_capture(mm_player_t* player);
  * @see
  *
  */
-int _mmplayer_release_video_capture(mm_player_t* player);
+int _mmplayer_release_video_capture(mm_player_t *player);
+
 /**
  * This function is to get video snapshot during playback.
  *
@@ -75,4 +77,3 @@ int _mmplayer_do_video_capture(MMHandleType hplayer);
 #endif
 
 #endif
-
index 94730aa..a41cd55 100644 (file)
@@ -41,19 +41,19 @@ int _mmplayer_set_video_info(MMHandleType player, media_format_h format);
 
 int _mmplayer_set_audio_info(MMHandleType player, media_format_h format);
 
-int _mmplayer_set_subtitle_info(MMHandleType player, MMPlayerSubtitleStreamInfo * info);
+int _mmplayer_set_subtitle_info(MMHandleType player, MMPlayerSubtitleStreamInfo *info);
 
 int _mmplayer_submit_packet(MMHandleType player, media_packet_h packet);
 
 int _mmplayer_set_media_stream_buffer_status_cb(MMHandleType player,
                                                                                        MMPlayerStreamType type,
                                                                                        mm_player_media_stream_buffer_status_callback callback,
-                                                                                       void * user_param);
+                                                                                       void *user_param);
 
 int _mmplayer_set_media_stream_seek_data_cb(MMHandleType player,
                                                                                        MMPlayerStreamType type,
                                                                                        mm_player_media_stream_seek_data_callback callback,
-                                                                                       void * user_param);
+                                                                                       void *user_param);
 
 int _mmplayer_set_media_stream_max_size(MMHandleType hplayer,
                                                                                        MMPlayerStreamType type,
index 7fd0d8a..7dba132 100644 (file)
@@ -36,48 +36,48 @@ extern "C"
 
 /* get caps info */
 #define MMPLAYER_GST_GET_CAPS_INFO(x_pad, x_caps, x_str, x_name, x_ret) \
-do { \
-       if (!x_caps) \
-               x_caps = gst_pad_query_caps(x_pad, NULL); \
-       if (x_caps) { \
-               x_str = gst_caps_get_structure(x_caps, 0); \
-               if (x_str) { \
-                       x_name = gst_structure_get_name(x_str); \
+       do { \
+               if (!x_caps) \
+                       x_caps = gst_pad_query_caps(x_pad, NULL); \
+               if (x_caps) { \
+                       x_str = gst_caps_get_structure(x_caps, 0); \
+                       if (x_str) { \
+                               x_name = gst_structure_get_name(x_str); \
+                       } \
                } \
-       } \
-       if (!x_caps || !x_str || !x_name) { \
-               LOGE("failed to get caps info"); \
-               x_ret = FALSE; \
-       } \
-} while (0)
+               if (!x_caps || !x_str || !x_name) { \
+                       LOGE("failed to get caps info"); \
+                       x_ret = FALSE; \
+               } \
+       } while (0)
 
 /*=======================================================================================
 | GLOBAL FUNCTION PROTOTYPES                                                           |
 ========================================================================================*/
 
-gint __mmplayer_gst_handle_core_error(mm_player_tplayer, int code);
-gint __mmplayer_gst_handle_library_error(mm_player_tplayer, int code);
-gint __mmplayer_gst_handle_resource_error(mm_player_t* player, int code, GstMessage * message);
-gint __mmplayer_gst_handle_stream_error(mm_player_t* player, GError* error, GstMessage * message);
+gint __mmplayer_gst_handle_core_error(mm_player_t *player, int code);
+gint __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);
+gint __mmplayer_gst_handle_stream_error(mm_player_t *player, GError *error, GstMessage *message);
 
-gboolean __mmplayer_handle_gst_error(mm_player_t* player, GstMessage * message, GError* error);
-int __mmplayer_gst_set_state(mm_player_t* player, GstElement * element,  GstState state, gboolean async, gint timeout);
+gboolean __mmplayer_handle_gst_error(mm_player_t *player, GstMessage *message, GError *error);
+int __mmplayer_gst_set_state(mm_player_t *player, GstElement *element,  GstState state, gboolean async, gint timeout);
 
-int __mmplayer_gst_start(mm_player_tplayer);
-int __mmplayer_gst_stop(mm_player_tplayer);
-int __mmplayer_gst_pause(mm_player_tplayer, gboolean async);
-int __mmplayer_gst_resume(mm_player_tplayer, gboolean async);
-gboolean __mmplayer_gst_send_event_to_sink(mm_player_t* player, GstEvent* event);
-gboolean __mmplayer_gst_seek(mm_player_t* player, GstElement * element, gdouble rate,
+int __mmplayer_gst_start(mm_player_t *player);
+int __mmplayer_gst_stop(mm_player_t *player);
+int __mmplayer_gst_pause(mm_player_t *player, gboolean async);
+int __mmplayer_gst_resume(mm_player_t *player, gboolean async);
+gboolean __mmplayer_gst_send_event_to_sink(mm_player_t *player, GstEvent *event);
+gboolean __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);
-int __mmplayer_gst_set_position(mm_player_tplayer, gint64 position, gboolean internal_called);
-int __mmplayer_gst_get_position(mm_player_t* player, gint64* position);
+int __mmplayer_gst_set_position(mm_player_t *player, gint64 position, gboolean internal_called);
+int __mmplayer_gst_get_position(mm_player_t *player, gint64 *position);
 int __mmplayer_gst_get_buffer_position(mm_player_t *player, int *start_pos, int *end_pos);
-GstElement* __mmplayer_gst_create_source(mm_player_t* player);
-int __mmplayer_gst_build_es_pipeline(mm_player_tplayer);
-int __mmplayer_gst_build_pipeline(mm_player_tplayer);
-int __mmplayer_gst_add_bus_watch(mm_player_tplayer);
+GstElement *__mmplayer_gst_create_source(mm_player_t *player);
+int __mmplayer_gst_build_es_pipeline(mm_player_t *player);
+int __mmplayer_gst_build_pipeline(mm_player_t *player);
+int __mmplayer_gst_add_bus_watch(mm_player_t *player);
 
 #ifdef __cplusplus
 }
index 7ce00b8..efb092c 100644 (file)
@@ -252,10 +252,10 @@ http timeout = -1 ; infinite retry \n\
 "
 
 int
-mm_player_ini_load(mm_player_ini_tini);
+mm_player_ini_load(mm_player_ini_t *ini);
 
 int
-mm_player_audio_effect_ini_load(mm_player_ini_tini);
+mm_player_audio_effect_ini_load(mm_player_ini_t *ini);
 
 #ifdef __cplusplus
        }
index 2fe959a..00a085f 100644 (file)
@@ -72,7 +72,7 @@ typedef struct {
  *
  * @return     This callback function have to return MM_ERROR_NONE.
  */
-typedef bool   (*mm_player_video_stream_callback) (void *stream, void *user_param);
+typedef bool (*mm_player_video_stream_callback)(void *stream, void *user_param);
 
 /**
  * Audio stream callback function type.
@@ -84,7 +84,7 @@ typedef bool  (*mm_player_video_stream_callback) (void *stream, void *user_param)
  *
  * @return     This callback function have to return MM_ERROR_NONE.
  */
-typedef bool   (*mm_player_video_capture_callback) (void *stream, int stream_size, void *user_param);
+typedef bool (*mm_player_video_capture_callback)(void *stream, int stream_size, void *user_param);
 
 /**
  * Video frame render error callback function type.
@@ -95,7 +95,7 @@ typedef bool  (*mm_player_video_capture_callback) (void *stream, int stream_size,
  *
  * @return     This callback function have to return MM_ERROR_NONE.
  */
-typedef bool   (*mm_player_video_frame_render_error_callback) (void *error_id, void *user_param);
+typedef bool (*mm_player_video_frame_render_error_callback)(void *error_id, void *user_param);
 
 /**
  * Audio stream callback function type.
@@ -106,7 +106,7 @@ typedef bool        (*mm_player_video_frame_render_error_callback) (void *error_id, voi
  *
  * @return     This callback function have to return MM_ERROR_NONE.
  */
-typedef bool   (*mm_player_audio_stream_callback) (MMPlayerAudioStreamDataType *stream, void *user_param);
+typedef bool (*mm_player_audio_stream_callback)(MMPlayerAudioStreamDataType *stream, void *user_param);
 /**
  * This function is to set play speed for playback.
  *
index 9a1895b..a739efd 100644 (file)
@@ -594,11 +594,11 @@ typedef struct {
 
        /* video stream changed callback */
        mm_player_stream_changed_callback video_stream_changed_cb;
-       voidvideo_stream_changed_cb_user_param;
+       void *video_stream_changed_cb_user_param;
 
        /* audio stream changed callback */
        mm_player_stream_changed_callback audio_stream_changed_cb;
-       voidaudio_stream_changed_cb_user_param;
+       void *audio_stream_changed_cb_user_param;
 
        /* video stream callback */
        mm_player_video_stream_callback video_stream_cb;
@@ -867,7 +867,7 @@ int _mmplayer_set_file_buffering_path(MMHandleType hplayer, const char *file_pat
 int _mmplayer_set_uri(MMHandleType hplayer, const char *uri);
 int _mmplayer_set_next_uri(MMHandleType hplayer, const char *uri, bool is_first_path);
 int _mmplayer_get_next_uri(MMHandleType hplayer, char **uri);
-int _mmplayer_has_closed_caption(MMHandleType hplayer, boolexist);
+int _mmplayer_has_closed_caption(MMHandleType hplayer, bool *exist);
 void _mm_player_video_stream_internal_buffer_unref(void *buffer);
 int _mmplayer_get_timeout(MMHandleType hplayer, int *timeout);
 int _mmplayer_get_num_of_video_out_buffers(MMHandleType hplayer, int *num, int *extra_num);
@@ -902,7 +902,7 @@ void __mmplayer_gst_decode_pad_added(GstElement *elem, GstPad *pad, gpointer dat
 gint __mmplayer_gst_decode_autoplug_select(GstElement *bin,  GstPad *pad, GstCaps *caps, GstElementFactory *factory, gpointer data);
 gboolean __mmplayer_gst_create_decoder(mm_player_t *player, GstPad *srcpad, const GstCaps *caps);
 void __mmplayer_gst_element_added(GstElement *bin, GstElement *element, gpointer data);
-GstElement__mmplayer_gst_make_decodebin(mm_player_t *player);
+GstElement *__mmplayer_gst_make_decodebin(mm_player_t *player);
 int __mmplayer_gst_element_add_bucket_to_bin(GstBin *bin, GList *element_bucket);
 int __mmplayer_gst_element_link_bucket(GList *element_bucket);
 void __mmplayer_typefind_have_type(GstElement *tf, guint probability, GstCaps *caps, gpointer data);
index 2947345..077b6ba 100644 (file)
 #define MIN_BUFFER_PERCENT 0.0
 #define MAX_BUFFER_PERCENT 100.0
 #define MIN_BUFFERING_TIME 3.0
-#define MAX_BUFFERING_TIME (10*1000) /* ms */
+#define MAX_BUFFERING_TIME (10 * 1000) /* ms */
 
 #define MAX_DECODEBIN_BUFFER_BYTES     (32 * 1024 * 1024) /* byte */
-#define MAX_DECODEBIN_BUFFER_TIME      (15*1000) /* ms */
+#define MAX_DECODEBIN_BUFFER_TIME      (15 * 1000) /* ms */
 #define MAX_DECODEBIN_ADAPTIVE_BUFFER_BYTES    (2 * 1024 * 1024) /* byte */
-#define MAX_DECODEBIN_ADAPTIVE_BUFFER_TIME     (5*1000) /* ms */
+#define MAX_DECODEBIN_ADAPTIVE_BUFFER_TIME     (5 * 1000) /* ms */
 
 #define DEFAULT_BUFFER_SIZE_BYTES 4194304   /* 4 MBytes */
-#define DEFAULT_PLAYING_TIME (10*1000) /* ms */
-#define DEFAULT_ADAPTIVE_PLAYING_TIME (3*1000) /* ms */
+#define DEFAULT_PLAYING_TIME (10 * 1000) /* ms */
+#define DEFAULT_ADAPTIVE_PLAYING_TIME (3 * 1000) /* ms */
 
-#define DEFAULT_BUFFERING_TIME (3*1000) /* ms */
+#define DEFAULT_BUFFERING_TIME (3 * 1000) /* ms */
 #define DEFAULT_BUFFER_HIGH_PERCENT 99.0
-#define DEFAULT_RING_BUFFER_SIZE (20*1024*1024) /* 20MBytes */
+#define DEFAULT_RING_BUFFER_SIZE (20 * 1024 * 1024) /* 20MBytes */
 
 #define STREAMING_USE_FILE_BUFFER
 #define STREAMING_USE_MEMORY_BUFFER
 
-#define GET_BYTE_FROM_BIT(bit) (bit/8)
-#define GET_BIT_FROM_BYTE(byte) (byte*8)
+#define GET_BYTE_FROM_BIT(bit) (bit / 8)
+#define GET_BIT_FROM_BYTE(byte) (byte * 8)
 #define CALC_PERCENT(a, b) ((gdouble)(a) * 100 / (gdouble)(b))
 #define GET_PERCENT(a, b, c, d) \
-do { \
-       if (((a) > 0) && ((b) > 0)) { \
-               d = CALC_PERCENT(a, b); \
-       } else { \
-               LOGW("set default per info\n"); \
-               d = c; \
-       } \
-} while (0)
+       do { \
+               if (((a) > 0) && ((b) > 0)) { \
+                       d = CALC_PERCENT(a, b); \
+               } else { \
+                       LOGW("set default per info"); \
+                       d = c; \
+               } \
+       } while (0)
 
 
 #define PLAYER_BUFFER_CAST(handle)     ((streaming_buffer_t *)(handle))
@@ -110,7 +110,7 @@ typedef struct {
 } streaming_requirement_t;
 
 typedef struct {
-       GstElementbuffer;                     /* buffering element of playback pipeline */
+       GstElement *buffer;                     /* buffering element of playback pipeline */
 
        guint buffering_bytes;
        gint buffering_time;            // mq : max buffering time value till now
@@ -146,26 +146,26 @@ typedef struct {
 
 
 mm_player_streaming_t *__mm_player_streaming_create(void);
-void __mm_player_streaming_initialize(mm_player_streaming_tstreaming_player);
-void __mm_player_streaming_deinitialize(mm_player_streaming_tstreaming_player);
-void __mm_player_streaming_destroy(mm_player_streaming_tstreaming_player);
-void __mm_player_streaming_set_queue2(mm_player_streaming_tstreamer,
-                                                                               GstElementbuffer,
+void __mm_player_streaming_initialize(mm_player_streaming_t *streaming_player);
+void __mm_player_streaming_deinitialize(mm_player_streaming_t *streaming_player);
+void __mm_player_streaming_destroy(mm_player_streaming_t *streaming_player);
+void __mm_player_streaming_set_queue2(mm_player_streaming_t *streamer,
+                                                                               GstElement *buffer,
                                                                                gboolean use_buffering,
                                                                                guint buffering_bytes,
                                                                                gint buffering_time,
                                                                                MuxedBufferType type,
-                                                                               gcharfile_path,
+                                                                               gchar *file_path,
                                                                                guint64 content_size);
-void __mm_player_streaming_set_multiqueue(mm_player_streaming_tstreamer,
-                                                                               GstElementbuffer,
+void __mm_player_streaming_set_multiqueue(mm_player_streaming_t *streamer,
+                                                                               GstElement *buffer,
                                                                                gint buffering_time);
-void __mm_player_streaming_sync_property(mm_player_streaming_t* streamer, GstElement* decodebin);
-void __mm_player_streaming_buffering(mm_player_streaming_tstreamer,
+void __mm_player_streaming_sync_property(mm_player_streaming_t *streamer, GstElement *decodebin);
+void __mm_player_streaming_buffering(mm_player_streaming_t *streamer,
                                                                          GstMessage *buffering_msg,
                                                                          guint64 content_size,
                                                                          gint64 position,
                                                                          gint64 duration);
-void __mm_player_streaming_set_content_bitrate(mm_player_streaming_tstreaming_player, guint max_bitrate, guint avg_bitrate);
+void __mm_player_streaming_set_content_bitrate(mm_player_streaming_t *streaming_player, guint max_bitrate, guint avg_bitrate);
 
 #endif
index d622df8..cef29e1 100644 (file)
@@ -37,7 +37,7 @@ void __mmplayer_track_destroy(mm_player_t *player);
 
 void __mmplayer_track_update_selector_info(mm_player_t *player, MMPlayerTrackType type, GstPad *sinkpad);
 
-void __mmplayer_track_update_text_attr_info(mm_player_tplayer, GstMessage *msg);
+void __mmplayer_track_update_text_attr_info(mm_player_t *player, GstMessage *msg);
 
 int _mmplayer_get_track_count(MMHandleType hplayer,  MMPlayerTrackType type, int *count);
 
index 0dcc58e..61e82a3 100644 (file)
 #define MMPLAYER_MAX_INT (INT_MAX)
 
 #define MMPLAYER_FREEIF(x) \
-do {   \
-       if (x) \
-               g_free(x); \
-       x = NULL;       \
-} while (0)
+       do {    \
+               if (x) { \
+                       g_free(x); \
+                       x = NULL;       \
+               } \
+       } while (0)
 
-#define MMPLAYER_GET_ATTRS(x_player) ((mm_player_t*)x_player)->attrs
+#define MMPLAYER_GET_ATTRS(x_player) ((mm_player_t *)x_player)->attrs
 
 /* command */
 #define MMPLAYER_CMD_LOCK(x_player)                          g_mutex_lock(&((mm_player_t *)x_player)->cmd_lock)
 #define MMPLAYER_CMD_TRYLOCK(x_player)                       g_mutex_trylock(&((mm_player_t *)x_player)->cmd_lock)
-#define MMPLAYER_CMD_UNLOCK(x_player)                        g_mutex_unlock(&((mm_player_t*)x_player)->cmd_lock)
+#define MMPLAYER_CMD_UNLOCK(x_player)                        g_mutex_unlock(&((mm_player_t *)x_player)->cmd_lock)
 
 /* playback */
 #define MMPLAYER_PLAYBACK_LOCK(x_player)                     g_mutex_lock(&((mm_player_t *)x_player)->playback_lock)
-#define MMPLAYER_PLAYBACK_UNLOCK(x_player)                   g_mutex_unlock(&((mm_player_t*)x_player)->playback_lock)
+#define MMPLAYER_PLAYBACK_UNLOCK(x_player)                   g_mutex_unlock(&((mm_player_t *)x_player)->playback_lock)
 
 /* capture thread */
 #define MMPLAYER_CAPTURE_THREAD_LOCK(x_player)               g_mutex_lock(&((mm_player_t *)x_player)->capture_thread_mutex)
@@ -121,133 +122,139 @@ do {    \
 #endif
 
 #define MMPLAYER_RETURN_IF_FAIL(expr) \
-do { \
-       if (!(expr)) { \
-               LOGW("failed [%s]", #expr); \
-               return; \
-       } \
-} while (0)
+       do { \
+               if (!(expr)) { \
+                       LOGW("failed [%s]", #expr); \
+                       return; \
+               } \
+       } while (0)
 
 #define MMPLAYER_RETURN_VAL_IF_FAIL(expr, var) \
-do { \
-       if (!(expr)) { \
-               LOGW("failed [%s]", #expr); \
-               return (var); \
-       } \
-} while (0)
+       do { \
+               if (!(expr)) { \
+                       LOGW("failed [%s]", #expr); \
+                       return (var); \
+               } \
+       } while (0)
 
 /* debug caps string */
 #define MMPLAYER_LOG_GST_CAPS_TYPE(x_caps) \
-do { \
-       gchar *caps_type = NULL; \
-       if (x_caps) { \
-               caps_type = gst_caps_to_string(x_caps); \
-               LOGD("caps: %s", caps_type); \
-               MMPLAYER_FREEIF(caps_type); \
-       } else {\
-               LOGW("caps is null"); \
-       } \
-} while (0)
+       do { \
+               gchar *caps_type = NULL; \
+               if (x_caps) { \
+                       caps_type = gst_caps_to_string(x_caps); \
+                       LOGD("caps: %s", caps_type); \
+                       MMPLAYER_FREEIF(caps_type); \
+               } else {\
+                       LOGW("caps is null"); \
+               } \
+       } while (0)
 
 /* message posting */
 #define MMPLAYER_POST_MSG(x_player, x_msgtype, x_msg_param) \
-do { \
-       LOGD("[handle: %p] posting %s to application", x_player, #x_msgtype); \
-       __mmplayer_post_message(x_player, x_msgtype, x_msg_param); \
-} while (0)
+       do { \
+               LOGD("[handle: %p] posting %s to application", x_player, #x_msgtype); \
+               __mmplayer_post_message(x_player, x_msgtype, x_msg_param); \
+       } while (0)
 
 /* setting player state */
 #define MMPLAYER_SET_STATE(x_player, x_state) \
-do { \
-       LOGD("[handle: %p] update state machine to %d", x_player, x_state); \
-       __mmplayer_set_state(x_player, x_state); \
-} while (0)
+       do { \
+               LOGD("[handle: %p] update state machine to %d", x_player, x_state); \
+               __mmplayer_set_state(x_player, x_state); \
+       } while (0)
 
 #define MMPLAYER_CHECK_STATE(x_player, x_command) \
-do {   \
-       LOGD("[handle: %p] checking player state before doing %s", x_player, #x_command); \
-       switch (__mmplayer_check_state(x_player, x_command)) { \
-       case MM_ERROR_PLAYER_INVALID_STATE: \
-               return MM_ERROR_PLAYER_INVALID_STATE; \
-               break; \
-               /* NOTE : for robustness of player. we won't treat it as an error */ \
-       case MM_ERROR_PLAYER_NO_OP: \
-               return MM_ERROR_NONE; \
-               break; \
-       case MM_ERROR_PLAYER_DOING_SEEK: \
-               return MM_ERROR_PLAYER_DOING_SEEK; \
-       default: \
-               break; \
-       }       \
-} while (0)
+       do {    \
+               LOGD("[handle: %p] checking player state before doing %s", x_player, #x_command); \
+               switch (__mmplayer_check_state(x_player, x_command)) { \
+               case MM_ERROR_PLAYER_INVALID_STATE: \
+                       return MM_ERROR_PLAYER_INVALID_STATE; \
+                       break; \
+                       /* NOTE : for robustness of player. we won't treat it as an error */ \
+               case MM_ERROR_PLAYER_NO_OP: \
+                       return MM_ERROR_NONE; \
+                       break; \
+               case MM_ERROR_PLAYER_DOING_SEEK: \
+                       return MM_ERROR_PLAYER_DOING_SEEK; \
+               default: \
+                       break; \
+               }       \
+       } while (0)
 
 /* setting element state */
 #define MMPLAYER_ELEMENT_SET_STATE(x_element, x_state) \
-do {   \
-       LOGD("setting state [%s:%d] to [%s]", #x_state, x_state, GST_ELEMENT_NAME(x_element)); \
-       if (GST_STATE_CHANGE_FAILURE == gst_element_set_state(x_element, x_state)) { \
-               LOGE("failed to set state %s to %s", #x_state, GST_ELEMENT_NAME(x_element)); \
-               goto STATE_CHANGE_FAILED; \
-       }       \
-} while (0)
+       do {    \
+               LOGD("setting state [%s:%d] to [%s]", #x_state, x_state, GST_ELEMENT_NAME(x_element)); \
+               if (GST_STATE_CHANGE_FAILURE == gst_element_set_state(x_element, x_state)) { \
+                       LOGE("failed to set state %s to %s", #x_state, GST_ELEMENT_NAME(x_element)); \
+                       goto STATE_CHANGE_FAILED; \
+               }       \
+       } while (0)
 
 #define MMPLAYER_CHECK_NULL(x_var) \
-if (!x_var) { \
-       LOGE("[%s] is NULL", #x_var); \
-       goto ERROR; \
-}
+       do { \
+               if (!x_var) { \
+                       LOGE("[%s] is NULL", #x_var); \
+                       goto ERROR; \
+               } \
+       } while (0)
 
 /* generating dot */
 #define MMPLAYER_GENERATE_DOT_IF_ENABLED(x_player, x_name) \
-if (x_player->ini.generate_dot) { \
-       GST_DEBUG_BIN_TO_DOT_FILE(GST_BIN(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst), \
-       GST_DEBUG_GRAPH_SHOW_ALL, x_name); \
-}
+       do { \
+               if (x_player->ini.generate_dot) { \
+                       GST_DEBUG_BIN_TO_DOT_FILE(GST_BIN(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst), \
+                       GST_DEBUG_GRAPH_SHOW_ALL, x_name); \
+               } \
+       } while (0)
 
 /* signal manipulation */
 #define MMPLAYER_SIGNAL_CONNECT(x_player, x_object, x_type, x_signal, x_callback, x_arg) \
-do { \
-       MMPlayerSignalItem *item = NULL; \
-       item = (MMPlayerSignalItem*) g_malloc(sizeof(MMPlayerSignalItem)); \
-       if (!item) { \
-               LOGE("cannot connect signal [%s]", x_signal); \
-       } else { \
-               item->obj = G_OBJECT(x_object); \
-               item->sig = g_signal_connect(G_OBJECT(x_object), x_signal, \
-                                       x_callback, x_arg); \
-               if ((x_type >= MM_PLAYER_SIGNAL_TYPE_AUTOPLUG) && (x_type < MM_PLAYER_SIGNAL_TYPE_MAX)) \
-                       x_player->signals[x_type] = g_list_append(x_player->signals[x_type], item); \
-               else \
-                       LOGE("wrong signal type [%d]", x_type); \
-       } \
-} while (0)
+       do { \
+               MMPlayerSignalItem *item = NULL; \
+               item = (MMPlayerSignalItem *)g_malloc(sizeof(MMPlayerSignalItem)); \
+               if (!item) { \
+                       LOGE("cannot connect signal [%s]", x_signal); \
+               } else { \
+                       item->obj = G_OBJECT(x_object); \
+                       item->sig = g_signal_connect(G_OBJECT(x_object), x_signal, \
+                                               x_callback, x_arg); \
+                       if ((x_type >= MM_PLAYER_SIGNAL_TYPE_AUTOPLUG) && (x_type < MM_PLAYER_SIGNAL_TYPE_MAX)) \
+                               x_player->signals[x_type] = g_list_append(x_player->signals[x_type], item); \
+                       else \
+                               LOGE("wrong signal type [%d]", x_type); \
+               } \
+       } while (0)
 
 /* release element resource */
 #define MMPLAYER_RELEASE_ELEMENT(x_player, x_bin, x_id) \
-do { \
-       if (x_bin[x_id].gst) { \
-               gst_element_set_state(x_bin[x_id].gst, GST_STATE_NULL); \
-               gst_bin_remove(GST_BIN(x_player->pipeline->mainbin[MMPLAYER_M_PIPE].gst), x_bin[x_id].gst); \
-               x_bin[x_id].gst = NULL; \
-               LOGD("release done [element %d]", x_id); \
-       } \
-} while (0)
+       do { \
+               if (x_bin[x_id].gst) { \
+                       gst_element_set_state(x_bin[x_id].gst, GST_STATE_NULL); \
+                       gst_bin_remove(GST_BIN(x_player->pipeline->mainbin[MMPLAYER_M_PIPE].gst), x_bin[x_id].gst); \
+                       x_bin[x_id].gst = NULL; \
+                       LOGD("release done [element %d]", x_id); \
+               } \
+       } while (0)
 
 /* state */
-#define        MMPLAYER_PREV_STATE(x_player) ((mm_player_t*)x_player)->prev_state
-#define        MMPLAYER_CURRENT_STATE(x_player) ((mm_player_t*)x_player)->state
-#define MMPLAYER_PENDING_STATE(x_player) ((mm_player_t*)x_player)->pending_state
-#define MMPLAYER_TARGET_STATE(x_player) ((mm_player_t*)x_player)->target_state
+#define MMPLAYER_PREV_STATE(x_player) ((mm_player_t *)x_player)->prev_state
+#define MMPLAYER_CURRENT_STATE(x_player) ((mm_player_t *)x_player)->state
+#define MMPLAYER_PENDING_STATE(x_player) ((mm_player_t *)x_player)->pending_state
+#define MMPLAYER_TARGET_STATE(x_player) ((mm_player_t *)x_player)->target_state
 #define MMPLAYER_STATE_GET_NAME(state) __get_state_name(state)
 
 #define MMPLAYER_PRINT_STATE(x_player) \
-LOGD("-- prev %s, current %s, pending %s, target %s --", \
-       MMPLAYER_STATE_GET_NAME(MMPLAYER_PREV_STATE(x_player)), \
-       MMPLAYER_STATE_GET_NAME(MMPLAYER_CURRENT_STATE(x_player)), \
-       MMPLAYER_STATE_GET_NAME(MMPLAYER_PENDING_STATE(x_player)), \
-       MMPLAYER_STATE_GET_NAME(MMPLAYER_TARGET_STATE(x_player)));
+       do { \
+               LOGD("-- prev %s, current %s, pending %s, target %s --", \
+                       MMPLAYER_STATE_GET_NAME(MMPLAYER_PREV_STATE(x_player)), \
+                       MMPLAYER_STATE_GET_NAME(MMPLAYER_CURRENT_STATE(x_player)), \
+                       MMPLAYER_STATE_GET_NAME(MMPLAYER_PENDING_STATE(x_player)), \
+                       MMPLAYER_STATE_GET_NAME(MMPLAYER_TARGET_STATE(x_player))); \
+       } while (0)
 
-#define MMPLAYER_STATE_CHANGE_TIMEOUT(x_player)         ((mm_player_t*)x_player)->state_change_timeout
+#define MMPLAYER_STATE_CHANGE_TIMEOUT(x_player) ((mm_player_t *)x_player)->state_change_timeout
 
 /* streaming */
 #define MMPLAYER_IS_STREAMING(x_player) __is_streaming(x_player)
@@ -270,26 +277,26 @@ LOGD("-- prev %s, current %s, pending %s, target %s --", \
 |                                                                                                                                                                                      |
 ========================================================================================== */
 
-const gchar__get_state_name(int state);
-const gchar__get_stream_type_name(int type);
+const gchar *__get_state_name(int state);
+const gchar *__get_stream_type_name(int type);
 
-gboolean __is_streaming(mm_player_tplayer);
-gboolean __is_rtsp_streaming(mm_player_tplayer);
-gboolean __is_live_streaming(mm_player_tplayer);
-gboolean __is_http_streaming(mm_player_tplayer);
-gboolean __is_http_live_streaming(mm_player_tplayer);
-gboolean __is_dash_streaming(mm_player_tplayer);
-gboolean __is_smooth_streaming(mm_player_tplayer);
-gboolean __is_ms_buff_src(mm_player_tplayer);
-gboolean __has_suffix(mm_player_t* player, const gchar* suffix);
+gboolean __is_streaming(mm_player_t *player);
+gboolean __is_rtsp_streaming(mm_player_t *player);
+gboolean __is_live_streaming(mm_player_t *player);
+gboolean __is_http_streaming(mm_player_t *player);
+gboolean __is_http_live_streaming(mm_player_t *player);
+gboolean __is_dash_streaming(mm_player_t *player);
+gboolean __is_smooth_streaming(mm_player_t *player);
+gboolean __is_ms_buff_src(mm_player_t *player);
+gboolean __has_suffix(mm_player_t *player, const gchar *suffix);
 
-gboolean __mmplayer_post_message(mm_player_t* player, enum MMMessageType msgtype, MMMessageParamType* param);
-gboolean __mmplayer_dump_pipeline_state(mm_player_tplayer);
+gboolean __mmplayer_post_message(mm_player_t *player, enum MMMessageType msgtype, MMMessageParamType *param);
+gboolean __mmplayer_dump_pipeline_state(mm_player_t *player);
 
 bool util_is_sdp_file(const char *path);
 int util_exist_file_path(const char *file_path);
-char** util_get_cookie_list(const char *cookies);
-const charutil_get_charset(const char *file_path);
+char **util_get_cookie_list(const char *cookies);
+const char *util_get_charset(const char *file_path);
 int util_get_pixtype(unsigned int fourcc);
 bool util_get_storage_info(const char *path, MMPlayerStorageInfo *storage_info);
 
@@ -298,4 +305,3 @@ bool util_get_storage_info(const char *path, MMPlayerStorageInfo *storage_info);
 #endif
 
 #endif /* __MM_PLAYER_UTILS_H__ */
-
index 94a2e91..b950948 100644 (file)
@@ -96,7 +96,7 @@ ERROR:
        return result; /* MM_ERROR_PLAYER_INTERNAL or MM_ERROR_PLAYER_RESOURCE_LIMIT */
 }
 
-int  mm_player_destroy(MMHandleType player)
+int mm_player_destroy(MMHandleType player)
 {
        int result = MM_ERROR_NONE;
 
@@ -300,7 +300,7 @@ int mm_player_get_state(MMHandleType player, MMPlayerStateType *state)
 
        *state = MM_PLAYER_STATE_NULL;
 
-       result = _mmplayer_get_state(player, (int*)state);
+       result = _mmplayer_get_state(player, (int *)state);
 
        return result;
 }
@@ -481,7 +481,7 @@ int mm_player_adjust_subtitle_position(MMHandleType player, MMPlayerPosFormatTyp
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
 
        if (format >= MM_PLAYER_POS_FORMAT_NUM) {
-               LOGE("wrong format(%d) \n", format);
+               LOGE("wrong format(%d)", format);
                return MM_ERROR_INVALID_ARGUMENT;
        }
 
@@ -509,7 +509,7 @@ int mm_player_set_subtitle_silent(MMHandleType player, int silent)
        return result;
 }
 
-int mm_player_get_subtitle_silent(MMHandleType player, intsilent)
+int mm_player_get_subtitle_silent(MMHandleType player, int *silent)
 {
        int result = MM_ERROR_NONE;
 
@@ -840,7 +840,7 @@ int mm_player_get_media_stream_buffer_min_percent(MMHandleType player, MMPlayerS
        return result;
 }
 
-int mm_player_set_media_stream_buffer_status_callback(MMHandleType player, MMPlayerStreamType type, mm_player_media_stream_buffer_status_callback callback, void * user_param)
+int mm_player_set_media_stream_buffer_status_callback(MMHandleType player, MMPlayerStreamType type, mm_player_media_stream_buffer_status_callback callback, void *user_param)
 {
        int result = MM_ERROR_NONE;
 
@@ -857,7 +857,7 @@ int mm_player_set_media_stream_buffer_status_callback(MMHandleType player, MMPla
        return result;
 }
 
-int mm_player_set_media_stream_seek_data_callback(MMHandleType player, MMPlayerStreamType type, mm_player_media_stream_seek_data_callback callback, void * user_param)
+int mm_player_set_media_stream_seek_data_callback(MMHandleType player, MMPlayerStreamType type, mm_player_media_stream_seek_data_callback callback, void *user_param)
 {
        int result = MM_ERROR_NONE;
 
@@ -951,7 +951,7 @@ int mm_player_set_media_stream_dynamic_resolution(MMHandleType player, bool drc)
        return result;
 }
 
-int mm_player_release_video_stream_bo(MMHandleType player, voidbo)
+int mm_player_release_video_stream_bo(MMHandleType player, void *bo)
 {
        int result = MM_ERROR_NONE;
 
old mode 100755 (executable)
new mode 100644 (file)
index 50f4ff7..a8c732c
@@ -27,7 +27,7 @@
 #include <glib.h>
 
 static bool
-__mmplayer_check_video_360_used(mm_player_tplayer)
+__mmplayer_check_video_360_used(mm_player_t *player)
 {
        /* check video 360 plugin is created */
        MMPLAYER_RETURN_VAL_IF_FAIL(player &&
@@ -41,7 +41,7 @@ __mmplayer_check_video_360_used(mm_player_t* player)
 }
 
 static bool
-__mmplayer_check_audio_sink(mm_player_tplayer)
+__mmplayer_check_audio_sink(mm_player_t *player)
 {
        /* check audio sink is created */
        MMPLAYER_RETURN_VAL_IF_FAIL(player &&
@@ -54,9 +54,10 @@ __mmplayer_check_audio_sink(mm_player_t* player)
        return true;
 }
 
-int _mmplayer_360_is_content_spherical(MMHandleType hplayer, bool *is_spherical)
+int
+_mmplayer_360_is_content_spherical(MMHandleType hplayer, bool *is_spherical)
 {
-       mm_player_t* player = (mm_player_t*) hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
 
        MMPLAYER_FENTER();
        MMPLAYER_RETURN_VAL_IF_FAIL(player && player->pipeline, MM_ERROR_PLAYER_NOT_INITIALIZED);
@@ -76,9 +77,10 @@ int _mmplayer_360_is_content_spherical(MMHandleType hplayer, bool *is_spherical)
        return MM_ERROR_NONE;
 }
 
-int _mmplayer_360_set_enabled(MMHandleType hplayer, bool enabled)
+int
+_mmplayer_360_set_enabled(MMHandleType hplayer, bool enabled)
 {
-       mm_player_t* player = (mm_player_t*) hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
 
        MMPLAYER_FENTER();
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
@@ -99,9 +101,10 @@ int _mmplayer_360_set_enabled(MMHandleType hplayer, bool enabled)
        return MM_ERROR_NONE;
 }
 
-int _mmplayer_360_is_enabled(MMHandleType hplayer, bool *enabled)
+int
+_mmplayer_360_is_enabled(MMHandleType hplayer, bool *enabled)
 {
-       mm_player_t* player = (mm_player_t*) hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
        gboolean is_enabled;
 
        MMPLAYER_FENTER();
@@ -125,9 +128,10 @@ int _mmplayer_360_is_enabled(MMHandleType hplayer, bool *enabled)
        return MM_ERROR_NONE;
 }
 
-int _mmplayer_360_set_direction_of_view(MMHandleType hplayer, float yaw, float pitch)
+int
+_mmplayer_360_set_direction_of_view(MMHandleType hplayer, float yaw, float pitch)
 {
-       mm_player_t* player = (mm_player_t*) hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
 
        MMPLAYER_FENTER();
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
@@ -148,13 +152,13 @@ int _mmplayer_360_set_direction_of_view(MMHandleType hplayer, float yaw, float p
                if (__mmplayer_check_video_360_used(player)) {
                        LOGD("set yaw %f, pitch %f for video", yaw, pitch);
                        g_object_set(G_OBJECT(player->pipeline->videobin[MMPLAYER_V_360].gst),
-                                       "pose-yaw", (int) (yaw * 180.0f / M_PI),
-                                       "pose-pitch", (int) (pitch * 180.0f / M_PI), NULL);
+                                       "pose-yaw", (int)(yaw * 180.0f / M_PI),
+                                       "pose-pitch", (int)(pitch * 180.0f / M_PI), NULL);
                }
                if (player->is_openal_plugin_used && __mmplayer_check_audio_sink(player)) {
                        g_object_set(G_OBJECT(player->pipeline->audiobin[MMPLAYER_A_SINK].gst),
-                                       "source-orientation-y", (int) (yaw * 180.0f / M_PI),
-                                       "source-orientation-x", (int) (pitch * 180.0f / M_PI), NULL);
+                                       "source-orientation-y", (int)(yaw * 180.0f / M_PI),
+                                       "source-orientation-x", (int)(pitch * 180.0f / M_PI), NULL);
                }
        }
 
@@ -162,9 +166,10 @@ int _mmplayer_360_set_direction_of_view(MMHandleType hplayer, float yaw, float p
        return MM_ERROR_NONE;
 }
 
-int _mmplayer_360_get_direction_of_view(MMHandleType hplayer, float *yaw, float *pitch)
+int
+_mmplayer_360_get_direction_of_view(MMHandleType hplayer, float *yaw, float *pitch)
 {
-       mm_player_t* player = (mm_player_t*) hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
        int yaw_degrees = 0;
        int pitch_degrees = 0;
 
@@ -192,9 +197,10 @@ int _mmplayer_360_get_direction_of_view(MMHandleType hplayer, float *yaw, float
        return MM_ERROR_NONE;
 }
 
-int _mmplayer_360_set_zoom(MMHandleType hplayer, float level)
+int
+_mmplayer_360_set_zoom(MMHandleType hplayer, float level)
 {
-       mm_player_t* player = (mm_player_t*) hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
 
        MMPLAYER_FENTER();
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
@@ -221,9 +227,10 @@ int _mmplayer_360_set_zoom(MMHandleType hplayer, float level)
        return MM_ERROR_NONE;
 }
 
-int _mmplayer_360_get_zoom(MMHandleType hplayer, float *level)
+int
+_mmplayer_360_get_zoom(MMHandleType hplayer, float *level)
 {
-       mm_player_t* player = (mm_player_t*) hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
        float current_zoom = 0.0;
 
        MMPLAYER_FENTER();
@@ -248,9 +255,10 @@ int _mmplayer_360_get_zoom(MMHandleType hplayer, float *level)
        return MM_ERROR_NONE;
 }
 
-int _mmplayer_360_set_field_of_view(MMHandleType hplayer, int horizontal_degrees, int vertical_degrees)
+int
+_mmplayer_360_set_field_of_view(MMHandleType hplayer, int horizontal_degrees, int vertical_degrees)
 {
-       mm_player_t* player = (mm_player_t*) hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
 
        MMPLAYER_FENTER();
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
@@ -277,9 +285,10 @@ int _mmplayer_360_set_field_of_view(MMHandleType hplayer, int horizontal_degrees
        return MM_ERROR_NONE;
 }
 
-int _mmplayer_360_get_field_of_view(MMHandleType hplayer, int *horizontal_degrees, int *vertical_degrees)
+int
+_mmplayer_360_get_field_of_view(MMHandleType hplayer, int *horizontal_degrees, int *vertical_degrees)
 {
-       mm_player_t* player = (mm_player_t*) hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
 
        MMPLAYER_FENTER();
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
index 64e9a72..14d340f 100644 (file)
@@ -65,7 +65,7 @@ _mmplayer_get_attribute(MMHandleType handle,  char **err_attr_name, const char *
        result = mm_attrs_get_valist(attrs, err_attr_name, attribute_name, args_list);
 
        if (result != MM_ERROR_NONE)
-               LOGE("failed to get %s attribute\n", attribute_name);
+               LOGE("failed to get %s attribute", attribute_name);
 
        return result;
 }
@@ -87,13 +87,13 @@ _mmplayer_set_attribute(MMHandleType handle,  char **err_attr_name, const char *
        result = mm_attrs_set_valist(attrs, err_attr_name, attribute_name, args_list);
 
        if (result != MM_ERROR_NONE) {
-               LOGE("failed to set %s attribute\n", attribute_name);
+               LOGE("failed to set %s attribute", attribute_name);
                return result;
        }
 
        result = __mmplayer_apply_attribute(handle, attribute_name);
        if (result != MM_ERROR_NONE) {
-               LOGE("failed to apply attributes\n");
+               LOGE("failed to apply attributes");
                return result;
        }
 
@@ -116,7 +116,7 @@ _mmplayer_get_attributes_info(MMHandleType handle,  const char *attribute_name,
        result = mm_attrs_get_info_by_name(attrs, attribute_name, &src_info);
 
        if (result != MM_ERROR_NONE) {
-               LOGE("failed to get attribute info\n");
+               LOGE("failed to get attribute info");
                return result;
        }
 
@@ -161,7 +161,7 @@ _mmplayer_get_attributes_info(MMHandleType handle,  const char *attribute_name,
 int
 __mmplayer_apply_attribute(MMHandleType handle, const char *attribute_name)
 {
-       mm_player_tplayer = 0;
+       mm_player_t *player = 0;
 
        MMPLAYER_RETURN_VAL_IF_FAIL(handle, MM_ERROR_COMMON_INVALID_ARGUMENT);
        MMPLAYER_RETURN_VAL_IF_FAIL(attribute_name, MM_ERROR_COMMON_INVALID_ARGUMENT);
@@ -193,18 +193,17 @@ __mmplayer_apply_attribute(MMHandleType handle, const char *attribute_name)
                param_name[str_len] = '\0';
                LOGD(" param_name: %s", param_name);
                if (MM_ERROR_NONE != _mmplayer_update_video_param(player, param_name)) {
-                       g_free(param_name);
+                       MMPLAYER_FREEIF(param_name);
                        LOGE("failed to update video param");
                        return MM_ERROR_PLAYER_INTERNAL;
                }
-               g_free(param_name);
+               MMPLAYER_FREEIF(param_name);
        }
 
        if (g_strrstr(attribute_name, MM_PLAYER_GAPLESS_MODE)) {
                int gapless = 0;
 
                mm_attrs_get_int_by_name(player->attrs, "gapless_mode", &gapless);
-
                if (gapless > 0) {
                        LOGD("disable last-sample at videosink");
                        g_object_set(player->pipeline->videobin[MMPLAYER_V_SINK].gst, "enable-last-sample", FALSE, NULL);
@@ -240,7 +239,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "profile_uri",                                  // name
                        MM_ATTRS_TYPE_STRING,           // type
                        MM_ATTRS_FLAG_RW,                       // flag
-                       (void *) NULL,                          // default value
+                       (void *)NULL,                           // default value
                        MM_ATTRS_VALID_TYPE_NONE,       // validity type
                        0,                                                      // validity min value
                        0                                                       // validity max value
@@ -249,7 +248,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "profile_user_param",
                        MM_ATTRS_TYPE_DATA,
                        MM_ATTRS_FLAG_RW,
-                       (void *) NULL,
+                       (void *)NULL,
                        MM_ATTRS_VALID_TYPE_NONE,
                        0,
                        0
@@ -258,7 +257,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "profile_play_count",
                        MM_ATTRS_TYPE_INT,
                        MM_ATTRS_FLAG_RW,
-                       (void *) 1,                     /* -1 : repeat continually */
+                       (void *)1,                      /* -1 : repeat continually */
                        MM_ATTRS_VALID_TYPE_INT_RANGE,
                        -1,
                        1
@@ -267,7 +266,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "profile_prepare_async",
                        MM_ATTRS_TYPE_INT,
                        MM_ATTRS_FLAG_RW,
-                       (void *) 0,
+                       (void *)0,
                        MM_ATTRS_VALID_TYPE_INT_RANGE,
                        0,
                        1
@@ -276,7 +275,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "streaming_user_agent",
                        MM_ATTRS_TYPE_STRING,
                        MM_ATTRS_FLAG_RW,
-                       (void *) NULL,
+                       (void *)NULL,
                        MM_ATTRS_VALID_TYPE_NONE,
                        0,
                        0
@@ -285,7 +284,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "streaming_cookie",
                        MM_ATTRS_TYPE_STRING,
                        MM_ATTRS_FLAG_RW,
-                       (void *) NULL,
+                       (void *)NULL,
                        MM_ATTRS_VALID_TYPE_NONE,
                        0,
                        0
@@ -294,7 +293,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "subtitle_uri",
                        MM_ATTRS_TYPE_STRING,
                        MM_ATTRS_FLAG_RW,
-                       (void *) NULL,
+                       (void *)NULL,
                        MM_ATTRS_VALID_TYPE_NONE,
                        0,
                        0
@@ -303,7 +302,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "content_bitrate",
                        MM_ATTRS_TYPE_INT,
                        MM_ATTRS_FLAG_RW,
-                       (void *) 0,
+                       (void *)0,
                        MM_ATTRS_VALID_TYPE_INT_RANGE,
                        0,
                        MMPLAYER_MAX_INT
@@ -312,7 +311,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "content_max_bitrate",
                        MM_ATTRS_TYPE_INT,
                        MM_ATTRS_FLAG_RW,
-                       (void *) 0,
+                       (void *)0,
                        MM_ATTRS_VALID_TYPE_INT_RANGE,
                        0,
                        MMPLAYER_MAX_INT
@@ -321,7 +320,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "content_video_found",
                        MM_ATTRS_TYPE_INT,
                        MM_ATTRS_FLAG_RW,
-                       (void *) 0,
+                       (void *)0,
                        MM_ATTRS_VALID_TYPE_INT_RANGE,
                        0,
                        1
@@ -330,7 +329,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "content_video_codec",
                        MM_ATTRS_TYPE_STRING,
                        MM_ATTRS_FLAG_RW,
-                       (void *) NULL,
+                       (void *)NULL,
                        MM_ATTRS_VALID_TYPE_NONE,
                        0,
                        0
@@ -339,7 +338,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "content_video_bitrate",
                        MM_ATTRS_TYPE_INT,
                        MM_ATTRS_FLAG_RW,
-                       (void *) 0,
+                       (void *)0,
                        MM_ATTRS_VALID_TYPE_INT_RANGE,
                        0,
                        MMPLAYER_MAX_INT
@@ -348,7 +347,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "content_video_fps",
                        MM_ATTRS_TYPE_INT,
                        MM_ATTRS_FLAG_RW,
-                       (void *) 0,
+                       (void *)0,
                        MM_ATTRS_VALID_TYPE_INT_RANGE,
                        0,
                        MMPLAYER_MAX_INT
@@ -357,7 +356,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "content_video_width",
                        MM_ATTRS_TYPE_INT,
                        MM_ATTRS_FLAG_RW,
-                       (void *) 0,
+                       (void *)0,
                        MM_ATTRS_VALID_TYPE_INT_RANGE,
                        0,
                        MMPLAYER_MAX_INT
@@ -366,7 +365,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "content_video_height",
                        MM_ATTRS_TYPE_INT,
                        MM_ATTRS_FLAG_RW,
-                       (void *) 0,
+                       (void *)0,
                        MM_ATTRS_VALID_TYPE_INT_RANGE,
                        0,
                        MMPLAYER_MAX_INT
@@ -375,7 +374,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "content_audio_codec",
                        MM_ATTRS_TYPE_STRING,
                        MM_ATTRS_FLAG_RW,
-                       (void *) NULL,
+                       (void *)NULL,
                        MM_ATTRS_VALID_TYPE_NONE,
                        0,
                        0
@@ -384,7 +383,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "content_audio_bitrate",
                        MM_ATTRS_TYPE_INT,
                        MM_ATTRS_FLAG_RW,
-                       (void *) 0,
+                       (void *)0,
                        MM_ATTRS_VALID_TYPE_INT_RANGE,
                        0,
                        MMPLAYER_MAX_INT
@@ -393,7 +392,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "content_audio_channels",
                        MM_ATTRS_TYPE_INT,
                        MM_ATTRS_FLAG_RW,
-                       (void *) 0,
+                       (void *)0,
                        MM_ATTRS_VALID_TYPE_INT_RANGE,
                        0,
                        MMPLAYER_MAX_INT
@@ -402,7 +401,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "content_audio_samplerate",
                        MM_ATTRS_TYPE_INT,
                        MM_ATTRS_FLAG_RW,
-                       (void *) 0,
+                       (void *)0,
                        MM_ATTRS_VALID_TYPE_INT_RANGE,
                        0,
                        MMPLAYER_MAX_INT
@@ -411,7 +410,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "content_text_track_num",
                        MM_ATTRS_TYPE_INT,
                        MM_ATTRS_FLAG_RW,
-                       (void *) 0,
+                       (void *)0,
                        MM_ATTRS_VALID_TYPE_INT_RANGE,
                        0,
                        MMPLAYER_MAX_INT
@@ -420,7 +419,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "current_text_track_index",
                        MM_ATTRS_TYPE_INT,
                        MM_ATTRS_FLAG_RW,
-                       (void *) -1,
+                       (void *)-1,
                        MM_ATTRS_VALID_TYPE_INT_RANGE,
                        -1,
                        MMPLAYER_MAX_INT
@@ -429,7 +428,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "tag_artist",
                        MM_ATTRS_TYPE_STRING,
                        MM_ATTRS_FLAG_RW,
-                       (void *) NULL,
+                       (void *)NULL,
                        MM_ATTRS_VALID_TYPE_NONE,
                        0,
                        0
@@ -438,7 +437,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "tag_title",
                        MM_ATTRS_TYPE_STRING,
                        MM_ATTRS_FLAG_RW,
-                       (void *) NULL,
+                       (void *)NULL,
                        MM_ATTRS_VALID_TYPE_NONE,
                        0,
                        0
@@ -447,13 +446,13 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "tag_album",
                        MM_ATTRS_TYPE_STRING,
                        MM_ATTRS_FLAG_RW,
-                       (void *) NULL
+                       (void *)NULL
                },
                {
                        "tag_genre",
                        MM_ATTRS_TYPE_STRING,
                        MM_ATTRS_FLAG_RW,
-                       (void *) NULL,
+                       (void *)NULL,
                        MM_ATTRS_VALID_TYPE_NONE,
                        0,
                        0
@@ -462,7 +461,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "tag_author",
                        MM_ATTRS_TYPE_STRING,
                        MM_ATTRS_FLAG_RW,
-                       (void *) NULL,
+                       (void *)NULL,
                        MM_ATTRS_VALID_TYPE_NONE,
                        0,
                        0
@@ -471,7 +470,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "tag_copyright",
                        MM_ATTRS_TYPE_STRING,
                        MM_ATTRS_FLAG_RW,
-                       (void *) NULL,
+                       (void *)NULL,
                        MM_ATTRS_VALID_TYPE_NONE,
                        0,
                        0
@@ -480,7 +479,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "tag_date",
                        MM_ATTRS_TYPE_STRING,
                        MM_ATTRS_FLAG_RW,
-                       (void *) NULL,
+                       (void *)NULL,
                        MM_ATTRS_VALID_TYPE_NONE,
                        0,
                        0
@@ -489,7 +488,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "tag_description",
                        MM_ATTRS_TYPE_STRING,
                        MM_ATTRS_FLAG_RW,
-                       (void *) NULL,
+                       (void *)NULL,
                        MM_ATTRS_VALID_TYPE_NONE,
                        0,
                        0
@@ -498,7 +497,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "tag_track_num",
                        MM_ATTRS_TYPE_INT,
                        MM_ATTRS_FLAG_RW,
-                       (void *) 0,
+                       (void *)0,
                        MM_ATTRS_VALID_TYPE_INT_RANGE,
                        0,
                        MMPLAYER_MAX_INT
@@ -507,7 +506,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "tag_album_cover",
                        MM_ATTRS_TYPE_DATA,
                        MM_ATTRS_FLAG_RW,
-                       (void *) NULL,
+                       (void *)NULL,
                        MM_ATTRS_VALID_TYPE_NONE,
                        0,
                        0
@@ -516,7 +515,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "display_rotation",
                        MM_ATTRS_TYPE_INT,
                        MM_ATTRS_FLAG_RW,
-                       (void *) MM_DISPLAY_ROTATION_NONE,
+                       (void *)MM_DISPLAY_ROTATION_NONE,
                        MM_ATTRS_VALID_TYPE_INT_RANGE,
                        MM_DISPLAY_ROTATION_NONE,
                        MM_DISPLAY_ROTATION_270
@@ -525,7 +524,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "display_visible",
                        MM_ATTRS_TYPE_INT,
                        MM_ATTRS_FLAG_RW,
-                       (void *) FALSE,
+                       (void *)FALSE,
                        MM_ATTRS_VALID_TYPE_INT_RANGE,
                        0,
                        1
@@ -534,7 +533,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "display_method",
                        MM_ATTRS_TYPE_INT,
                        MM_ATTRS_FLAG_RW,
-                       (void *) MM_DISPLAY_METHOD_LETTER_BOX,
+                       (void *)MM_DISPLAY_METHOD_LETTER_BOX,
                        MM_ATTRS_VALID_TYPE_INT_RANGE,
                        MM_DISPLAY_METHOD_LETTER_BOX,
                        MM_DISPLAY_METHOD_CUSTOM_ROI
@@ -543,7 +542,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "display_overlay",
                        MM_ATTRS_TYPE_DATA,
                        MM_ATTRS_FLAG_RW,
-                       (void *) NULL,
+                       (void *)NULL,
                        MM_ATTRS_VALID_TYPE_NONE,
                        0,
                        0
@@ -552,7 +551,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "display_win_roi_x",
                        MM_ATTRS_TYPE_INT,
                        MM_ATTRS_FLAG_RW,
-                       (void *) 0,
+                       (void *)0,
                        MM_ATTRS_VALID_TYPE_INT_RANGE,
                        MMPLAYER_MIN_INT,
                        MMPLAYER_MAX_INT
@@ -561,7 +560,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "display_win_roi_y",
                        MM_ATTRS_TYPE_INT,
                        MM_ATTRS_FLAG_RW,
-                       (void *) 0,
+                       (void *)0,
                        MM_ATTRS_VALID_TYPE_INT_RANGE,
                        MMPLAYER_MIN_INT,
                        MMPLAYER_MAX_INT
@@ -570,7 +569,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "display_win_roi_width",
                        MM_ATTRS_TYPE_INT,
                        MM_ATTRS_FLAG_RW,
-                       (void *) 0,
+                       (void *)0,
                        MM_ATTRS_VALID_TYPE_INT_RANGE,
                        0,
                        MMPLAYER_MAX_INT
@@ -579,7 +578,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "display_win_roi_height",
                        MM_ATTRS_TYPE_INT,
                        MM_ATTRS_FLAG_RW,
-                       (void *) 0,
+                       (void *)0,
                        MM_ATTRS_VALID_TYPE_INT_RANGE,
                        0,
                        MMPLAYER_MAX_INT
@@ -588,7 +587,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "display_surface_type",
                        MM_ATTRS_TYPE_INT,
                        MM_ATTRS_FLAG_RW,
-                       (void *) MM_DISPLAY_SURFACE_NULL,
+                       (void *)MM_DISPLAY_SURFACE_NULL,
                        MM_ATTRS_VALID_TYPE_INT_RANGE,
                        MM_DISPLAY_SURFACE_OVERLAY,
                        MM_DISPLAY_SURFACE_NUM - 1
@@ -597,7 +596,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "sound_stream_type",
                        MM_ATTRS_TYPE_STRING,
                        MM_ATTRS_FLAG_RW,
-                       (void *) NULL,
+                       (void *)NULL,
                        MM_ATTRS_VALID_TYPE_NONE,
                        0,
                        0
@@ -615,7 +614,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "sound_latency_mode",
                        MM_ATTRS_TYPE_INT,
                        MM_ATTRS_FLAG_RW,
-                       (void *) 1,                     // 0: low latency, 1: middle latency 2: high latency
+                       (void *)1,                      // 0: low latency, 1: middle latency 2: high latency
                        MM_ATTRS_VALID_TYPE_INT_RANGE,
                        0,
                        2
@@ -624,7 +623,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "pcm_extraction_samplerate",    // set samplerate for pcm extraction
                        MM_ATTRS_TYPE_INT,
                        MM_ATTRS_FLAG_RW,
-                       (void *) 44100,                         // hz
+                       (void *)44100,                          // hz
                        MM_ATTRS_VALID_TYPE_INT_RANGE,
                        0,
                        MMPLAYER_MAX_INT
@@ -633,7 +632,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "pcm_extraction_channels",      // set channels for pcm extraction
                        MM_ATTRS_TYPE_INT,
                        MM_ATTRS_FLAG_RW,
-                       (void *) 1,
+                       (void *)1,
                        MM_ATTRS_VALID_TYPE_INT_RANGE,
                        0,
                        MMPLAYER_MAX_INT
@@ -642,7 +641,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "accurate_seek",
                        MM_ATTRS_TYPE_INT,
                        MM_ATTRS_FLAG_RW,
-                       (void *) 0,
+                       (void *)0,
                        MM_ATTRS_VALID_TYPE_INT_RANGE,
                        0,
                        1
@@ -651,7 +650,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "content_video_orientation",    // orientation of video content
                        MM_ATTRS_TYPE_STRING,
                        MM_ATTRS_FLAG_RW,
-                       (void *) NULL,
+                       (void *)NULL,
                        MM_ATTRS_VALID_TYPE_NONE,
                        0,
                        0
@@ -660,7 +659,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "pcm_audioformat",
                        MM_ATTRS_TYPE_STRING,
                        MM_ATTRS_FLAG_RW,
-                       (void *) NULL,
+                       (void *)NULL,
                        MM_ATTRS_VALID_TYPE_NONE,
                        0,
                        0
@@ -669,7 +668,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "drc_mode",
                        MM_ATTRS_TYPE_INT,
                        MM_ATTRS_FLAG_RW,
-                       (void *) FALSE,
+                       (void *)FALSE,
                        MM_ATTRS_VALID_TYPE_INT_RANGE,
                        FALSE,
                        TRUE
@@ -678,7 +677,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "gapless_mode",
                        MM_ATTRS_TYPE_INT,
                        MM_ATTRS_FLAG_RW,
-                       (void *) FALSE,
+                       (void *)FALSE,
                        MM_ATTRS_VALID_TYPE_INT_RANGE,
                        FALSE,
                        TRUE
@@ -687,7 +686,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "enable_video_decoded_cb",
                        MM_ATTRS_TYPE_INT,
                        MM_ATTRS_FLAG_RW,
-                       (void *) FALSE,
+                       (void *)FALSE,
                        MM_ATTRS_VALID_TYPE_INT_RANGE,
                        FALSE,
                        TRUE
@@ -696,7 +695,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "content_video_is_spherical",
                        MM_ATTRS_TYPE_INT,
                        MM_ATTRS_FLAG_RW,
-                       (void *) -1,
+                       (void *)-1,
                        MM_ATTRS_VALID_TYPE_INT_RANGE,
                        -1,
                        MMPLAYER_MAX_INT
@@ -705,7 +704,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "video_codec_type",
                        MM_ATTRS_TYPE_INT,
                        MM_ATTRS_FLAG_RW,
-                       (void *) MM_PLAYER_CODEC_TYPE_DEFAULT,
+                       (void *)MM_PLAYER_CODEC_TYPE_DEFAULT,
                        MM_ATTRS_VALID_TYPE_INT_RANGE,
                        MM_PLAYER_CODEC_TYPE_DEFAULT,
                        MM_PLAYER_CODEC_TYPE_SW
@@ -714,7 +713,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
                        "audio_codec_type",
                        MM_ATTRS_TYPE_INT,
                        MM_ATTRS_FLAG_RW,
-                       (void *) MM_PLAYER_CODEC_TYPE_DEFAULT,
+                       (void *)MM_PLAYER_CODEC_TYPE_DEFAULT,
                        MM_ATTRS_VALID_TYPE_INT_RANGE,
                        MM_PLAYER_CODEC_TYPE_DEFAULT,
                        MM_PLAYER_CODEC_TYPE_SW
@@ -771,7 +770,7 @@ _mmplayer_construct_attribute(MMHandleType handle)
 
        /* commit */
        if (mm_attrs_commit_all(attrs)) {
-               LOGE("failed to update attributes\n");
+               LOGE("failed to update attributes");
                mm_attrs_free(attrs);
                return 0;
        }
index 2f22888..0968c6f 100644 (file)
@@ -139,7 +139,7 @@ __mmplayer_set_harmony_effect(mm_player_t *player, GstElement *audio_effect_elem
                LOGD("pass custom extension level list to audio effect plugin");
                ext_effect_level_list = player->audio_effect_info.custom_ext_level_for_plugin;
                if (!ext_effect_level_list) {
-                       ext_effect_level_list = (gint*) malloc(sizeof(gint)*player->ini.audio_effect_custom_ext_num);
+                       ext_effect_level_list = (gint *)malloc(sizeof(gint) * player->ini.audio_effect_custom_ext_num);
                        if (!ext_effect_level_list) {
                                LOGE("memory allocation for extension effect list failed");
                                return MM_ERROR_OUT_OF_MEMORY;
@@ -153,7 +153,7 @@ __mmplayer_set_harmony_effect(mm_player_t *player, GstElement *audio_effect_elem
 
                while (count < MM_AUDIO_EFFECT_CUSTOM_NUM) {
                        if (player->ini.audio_effect_custom_list[count]) {
-                               ext_effect_level_list[ext_level_index] = player->audio_effect_info.custom_ext_level[count-1];
+                               ext_effect_level_list[ext_level_index] = player->audio_effect_info.custom_ext_level[count - 1];
                                ext_level_index++;
                                if (ext_level_index == player->ini.audio_effect_custom_ext_num)
                                        break;
@@ -163,8 +163,9 @@ __mmplayer_set_harmony_effect(mm_player_t *player, GstElement *audio_effect_elem
 
                /* set custom-extension effects level list */
                g_object_set(audio_effect_element, "custom-ext", ext_effect_level_list, NULL);
-       } else
+       } else {
                LOGW("no custom extension effect");
+       }
 
        /* order action to audio effect plugin */
        g_object_set(audio_effect_element, "filter-action", MM_AUDIO_EFFECT_TYPE_CUSTOM, NULL);
@@ -198,14 +199,15 @@ __mmplayer_is_earphone_only_effect_type(mm_player_t *player, MMAudioEffectType e
                        /* it starts from 1(except testing for EQ) */
                        if (player->ini.audio_effect_custom_earphone_only_list[i]) {
                                /* check if the earphone only custom effect was set */
-                               if (player->audio_effect_info.custom_ext_level[i-1]) {
+                               if (player->audio_effect_info.custom_ext_level[i - 1]) {
                                        LOGI("this custom effect(%d) is only available with earphone", i);
                                        result = TRUE;
                                }
                        }
                }
-       } else
+       } else {
                LOGE("invalid effect type(%d)", effect_type);
+       }
 
        MMPLAYER_FLEAVE();
 
@@ -287,7 +289,7 @@ EXIT:
 }
 
 gboolean
-_mmplayer_is_supported_effect_type(mm_player_tplayer, MMAudioEffectType effect_type, int effect)
+_mmplayer_is_supported_effect_type(mm_player_t *player, MMAudioEffectType effect_type, int effect)
 {
        gboolean result = TRUE;
        mm_sound_device_flags_e flags = MM_SOUND_DEVICE_ALL_FLAG;
@@ -348,9 +350,8 @@ _mmplayer_is_supported_effect_type(mm_player_t* player, MMAudioEffectType effect
                                result = FALSE;
                        } else {
                                if (device_type == MM_SOUND_DEVICE_TYPE_BUILTIN_SPEAKER &&
-                                               player->ini.audio_effect_custom_earphone_only_list[effect]) {
+                                               player->ini.audio_effect_custom_earphone_only_list[effect])
                                        result = FALSE;
-                               }
                        }
                }
        } else if (effect_type == MM_AUDIO_EFFECT_TYPE_SQUARE) {
@@ -393,7 +394,6 @@ _mmplayer_audio_effect_custom_apply(mm_player_t *player)
 
                /* get status if speaker is activated */
                result = __mmplayer_audio_set_output_type(player, MM_AUDIO_EFFECT_TYPE_CUSTOM, 0);
-
                if (result != MM_ERROR_NONE) {
                        LOGE("failed to set output mode");
                        MMPLAYER_FLEAVE();
@@ -407,7 +407,7 @@ _mmplayer_audio_effect_custom_apply(mm_player_t *player)
                        return result;
                }
        }
-       player->set_mode.rich_audio = TRUE;
+       player->set_mode.rich_audio = true;
 
        MMPLAYER_FLEAVE();
 
@@ -440,20 +440,18 @@ _mmplayer_audio_effect_custom_update_level(mm_player_t *player)
                LOGD("updated custom-eq [%d] = %d", i, player->audio_effect_info.custom_eq_level[i]);
 
        /* get custom ext effect */
-
        g_object_get(audio_effect_element, "custom-ext", &custom_ext_effect_level_list, NULL);
 
        while (count < MM_AUDIO_EFFECT_CUSTOM_NUM) {
                if (player->ini.audio_effect_custom_list[count]) {
-                       player->audio_effect_info.custom_ext_level[count-1]
+                       player->audio_effect_info.custom_ext_level[count - 1]
                                = custom_ext_effect_level_list[ext_level_index];
-                       LOGD("updated custom-ext [%d] = %d", count, player->audio_effect_info.custom_ext_level[count-1]);
+                       LOGD("updated custom-ext [%d] = %d", count, player->audio_effect_info.custom_ext_level[count - 1]);
                        ext_level_index++;
                }
                count++;
        }
 
-
        MMPLAYER_FLEAVE();
        return result;
 }
@@ -463,14 +461,14 @@ int
 mm_player_audio_effect_custom_clear_eq_all(MMHandleType hplayer)
 {
        int result = MM_ERROR_NONE;
-       mm_player_t* player = (mm_player_t*)hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
 
        MMPLAYER_FENTER();
 
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
 
        /* clear EQ custom effect */
-       memset(player->audio_effect_info.custom_eq_level, MM_AUDIO_EFFECT_CUSTOM_LEVEL_INIT, sizeof(int)*MM_AUDIO_EFFECT_EQ_BAND_NUM_MAX);
+       memset(player->audio_effect_info.custom_eq_level, MM_AUDIO_EFFECT_CUSTOM_LEVEL_INIT, sizeof(int) * MM_AUDIO_EFFECT_EQ_BAND_NUM_MAX);
 
        LOGI("All the EQ bands clearing success");
 
@@ -485,7 +483,7 @@ mm_player_audio_effect_custom_clear_ext_all(MMHandleType hplayer)
 {
        int i;
        int result = MM_ERROR_NONE;
-       mm_player_t* player = (mm_player_t*)hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
 
        MMPLAYER_FENTER();
 
@@ -506,7 +504,7 @@ mm_player_audio_effect_custom_clear_ext_all(MMHandleType hplayer)
 int
 mm_player_is_supported_preset_effect_type(MMHandleType hplayer, MMAudioEffectPresetType effect)
 {
-       mm_player_t* player = (mm_player_t*)hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
        int result = MM_ERROR_NONE;
 
        MMPLAYER_FENTER();
@@ -525,7 +523,7 @@ mm_player_is_supported_preset_effect_type(MMHandleType hplayer, MMAudioEffectPre
 int
 mm_player_is_supported_custom_effect_type(MMHandleType hplayer, MMAudioEffectCustomType effect)
 {
-       mm_player_t* player = (mm_player_t*)hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
        int result = MM_ERROR_NONE;
 
        MMPLAYER_FENTER();
@@ -543,7 +541,7 @@ mm_player_is_supported_custom_effect_type(MMHandleType hplayer, MMAudioEffectCus
 int
 mm_player_audio_effect_custom_apply(MMHandleType hplayer)
 {
-       mm_player_t* player = (mm_player_t*)hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
        int result = MM_ERROR_NONE;
 
        MMPLAYER_FENTER();
@@ -567,7 +565,7 @@ mm_player_audio_effect_custom_apply(MMHandleType hplayer)
 int
 mm_player_audio_effect_bypass(MMHandleType hplayer)
 {
-       mm_player_t* player = (mm_player_t*)hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
        int result = MM_ERROR_NONE;
        GstElement *audio_effect_element = NULL;
 
@@ -636,7 +634,7 @@ _mmplayer_audio_effect_custom_set_level_ext(mm_player_t *player, MMAudioEffectCu
                LOGE("out of range, level(%d)", level);
                result = MM_ERROR_INVALID_ARGUMENT;
        } else {
-               player->audio_effect_info.custom_ext_level[custom_effect_type-1] = level;
+               player->audio_effect_info.custom_ext_level[custom_effect_type - 1] = level;
                LOGI("set ext[%d] = %d", custom_effect_type-1, level);
        }
 
@@ -690,7 +688,7 @@ _mmplayer_audio_effect_custom_set_level_eq(mm_player_t *player, int index, int l
 int
 mm_player_audio_effect_custom_set_level(MMHandleType hplayer, MMAudioEffectCustomType effect_custom_type, int eq_index, int level)
 {
-       mm_player_t* player = (mm_player_t*)hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
        int result = MM_ERROR_NONE;
 
        MMPLAYER_FENTER();
@@ -720,7 +718,7 @@ mm_player_audio_effect_custom_set_level(MMHandleType hplayer, MMAudioEffectCusto
 int
 mm_player_audio_effect_custom_get_eq_bands_number(MMHandleType hplayer, int *bands)
 {
-       mm_player_t* player = (mm_player_t*)hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
        int result = MM_ERROR_NONE;
 
        MMPLAYER_FENTER();
@@ -745,7 +743,7 @@ mm_player_audio_effect_custom_get_eq_bands_number(MMHandleType hplayer, int *ban
 int
 mm_player_audio_effect_custom_get_eq_bands_width(MMHandleType hplayer, int band_idx, int *width)
 {
-       mm_player_t* player = (mm_player_t*)hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
        int result = MM_ERROR_NONE;
        unsigned int eq_num = 0;
 
@@ -760,7 +758,7 @@ mm_player_audio_effect_custom_get_eq_bands_width(MMHandleType hplayer, int band_
        }
 
        eq_num = player->ini.audio_effect_custom_eq_band_num;
-       if (band_idx < 0 || band_idx > eq_num-1) {
+       if (band_idx < 0 || band_idx > eq_num - 1) {
                LOGE("out of range, invalid band_idx(%d)", band_idx);
                result = MM_ERROR_INVALID_ARGUMENT;
        } else {
@@ -778,7 +776,7 @@ mm_player_audio_effect_custom_get_eq_bands_width(MMHandleType hplayer, int band_
 int
 mm_player_audio_effect_custom_get_eq_bands_freq(MMHandleType hplayer, int band_idx, int *freq)
 {
-       mm_player_t* player = (mm_player_t*)hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
        int result = MM_ERROR_NONE;
        unsigned int eq_num = 0;
 
@@ -793,7 +791,7 @@ mm_player_audio_effect_custom_get_eq_bands_freq(MMHandleType hplayer, int band_i
        }
 
        eq_num = player->ini.audio_effect_custom_eq_band_num;
-       if (band_idx < 0 || band_idx > eq_num-1) {
+       if (band_idx < 0 || band_idx > eq_num - 1) {
                LOGE("out of range, invalid band_idx(%d)", band_idx);
                result = MM_ERROR_INVALID_ARGUMENT;
        } else {
@@ -811,7 +809,7 @@ mm_player_audio_effect_custom_get_eq_bands_freq(MMHandleType hplayer, int band_i
 int
 mm_player_audio_effect_custom_get_level(MMHandleType hplayer, MMAudioEffectCustomType type, int eq_index, int *level)
 {
-       mm_player_t* player = (mm_player_t*)hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
        int result = MM_ERROR_NONE;
 
        MMPLAYER_FENTER();
@@ -834,7 +832,7 @@ mm_player_audio_effect_custom_get_level(MMHandleType hplayer, MMAudioEffectCusto
                        LOGD("EQ index = %d, level = %d", eq_index, *level);
                }
        } else if (type > MM_AUDIO_EFFECT_CUSTOM_EQ && type < MM_AUDIO_EFFECT_CUSTOM_NUM) {
-               *level = player->audio_effect_info.custom_ext_level[type-1];
+               *level = player->audio_effect_info.custom_ext_level[type - 1];
                LOGD("extension effect index = %d, level = %d", type, *level);
        } else {
                LOGE("out of range, type(%d)", type);
@@ -850,7 +848,7 @@ mm_player_audio_effect_custom_get_level(MMHandleType hplayer, MMAudioEffectCusto
 int
 mm_player_audio_effect_custom_get_level_range(MMHandleType hplayer, MMAudioEffectCustomType type, int *min, int *max)
 {
-       mm_player_t* player = (mm_player_t*)hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
        int result = MM_ERROR_NONE;
        int count = 1;                  /* start from 1, because of excepting eq index */
        int ext_level_index = 1;        /* start from 1, because of excepting eq index */
@@ -899,7 +897,7 @@ mm_player_audio_effect_custom_get_level_range(MMHandleType hplayer, MMAudioEffec
 int
 mm_player_audio_effect_custom_set_level_eq_from_list(MMHandleType hplayer, int *level_list, int size)
 {
-       mm_player_t *player = (mm_player_t*)hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
        gint i = 0;
        gint eq_level_min = 0;
        gint eq_level_max = 0;
index 6ed0a0a..64fae89 100644 (file)
 |    LOCAL FUNCTION PROTOTYPES:                                                                                                |
 ---------------------------------------------------------------------------*/
 static GstPadProbeReturn __mmplayer_video_capture_probe(GstPad *pad, GstPadProbeInfo *info, gpointer u_data);
-static int  __mmplayer_get_video_frame_from_buffer(mm_player_tplayer, GstPad *pad, GstBuffer *buffer);
+static int  __mmplayer_get_video_frame_from_buffer(mm_player_t *player, GstPad *pad, GstBuffer *buffer);
 static gpointer __mmplayer_capture_thread(gpointer data);
 static void __csc_tiled_to_linear_crop(unsigned char *yuv420_dest, unsigned char *nv12t_src, int yuv420_width, int yuv420_height, int left, int top, int right, int buttom);
 static int __tile_4x2_read(int x_size, int y_size, int x_pos, int y_pos);
-static int __mm_player_convert_colorspace(mm_player_t* player, unsigned char* src_data, mm_util_color_format_e src_fmt, unsigned int src_w, unsigned int src_h, mm_util_color_format_e dst_fmt);
+static int __mm_player_convert_colorspace(mm_player_t *player, unsigned char *src_data, mm_util_color_format_e src_fmt, unsigned int src_w, unsigned int src_h, mm_util_color_format_e dst_fmt);
 static int __mm_player_convert_NV12_tiled(mm_player_t *player);
 static int __mm_player_convert_NV12(mm_player_t *player);
 static int __mm_player_convert_I420(mm_player_t *player);
 static int __mm_player_convert_BGRx(mm_player_t *player);
 #ifdef CAPTURE_OUTPUT_DUMP
-static void capture_output_dump(mm_player_tplayer);
+static void capture_output_dump(mm_player_t *player);
 #endif
 
 /*===========================================================================================
@@ -61,7 +61,7 @@ static void capture_output_dump(mm_player_t* player);
 |                                                                                                                                                                                      |
 ========================================================================================== */
 int
-_mmplayer_initialize_video_capture(mm_player_tplayer)
+_mmplayer_initialize_video_capture(mm_player_t *player)
 {
        int ret = MM_ERROR_NONE;
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
@@ -71,7 +71,6 @@ _mmplayer_initialize_video_capture(mm_player_t* player)
        /* create capture cond */
        g_cond_init(&player->capture_thread_cond);
 
-
        player->capture_thread_exit = FALSE;
 
        /* create video capture thread */
@@ -88,14 +87,12 @@ _mmplayer_initialize_video_capture(mm_player_t* player)
 ERROR:
        /* capture thread */
        g_mutex_clear(&player->capture_thread_mutex);
-
        g_cond_clear(&player->capture_thread_cond);
-
        return ret;
 }
 
 int
-_mmplayer_release_video_capture(mm_player_tplayer)
+_mmplayer_release_video_capture(mm_player_t *player)
 {
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
        /* release capture thread */
@@ -116,7 +113,7 @@ _mmplayer_release_video_capture(mm_player_t* player)
 int
 _mmplayer_do_video_capture(MMHandleType hplayer)
 {
-       mm_player_t* player = (mm_player_t*) hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
        int ret = MM_ERROR_NONE;
        GstPad *pad = NULL;
 
@@ -182,7 +179,7 @@ _mmplayer_do_video_capture(MMHandleType hplayer)
 }
 
 int
-__mmplayer_handle_orientation(mm_player_tplayer, int orientation, int format)
+__mmplayer_handle_orientation(mm_player_t *player, int orientation, int format)
 {
        unsigned char *src_buffer = NULL;
        int ret = MM_ERROR_NONE;
@@ -206,8 +203,9 @@ __mmplayer_handle_orientation(mm_player_t* player, int orientation, int format)
                player->capture.width = player->captured.width[0];
                player->capture.height = player->captured.height[0];
                return MM_ERROR_NONE;
-       } else
+       } else {
                LOGE("wrong orientation value...");
+       }
 
        /* height & width will be interchanged for 90 and 270 orientation */
        LOGD("before rotation : dst_width = %d and dst_height = %d", dst_width, dst_height);
@@ -256,11 +254,10 @@ __mmplayer_handle_orientation(mm_player_t* player, int orientation, int format)
        return ret;
 }
 
-
 static gpointer
 __mmplayer_capture_thread(gpointer data)
 {
-       mm_player_t *player = (mm_player_t *) data;
+       mm_player_t *player = (mm_player_t *)data;
        MMMessageParamType msg = {0, };
        int orientation = 0;
        int display_angle = 0;
@@ -360,7 +357,7 @@ EXIT:
   * The output is fixed as RGB888
   */
 static int
-__mmplayer_get_video_frame_from_buffer(mm_player_tplayer, GstPad *pad, GstBuffer *buffer)
+__mmplayer_get_video_frame_from_buffer(mm_player_t *player, GstPad *pad, GstBuffer *buffer)
 {
        gint i = 0;
        guint plane_size = 0;
@@ -388,7 +385,7 @@ __mmplayer_get_video_frame_from_buffer(mm_player_t* player, GstPad *pad, GstBuff
 
        gst_caps_unref(caps);
 
-       LOGI("captured format is %s\n", gst_video_format_to_string(GST_VIDEO_INFO_FORMAT(&vinfo)));
+       LOGI("captured format is %s", gst_video_format_to_string(GST_VIDEO_INFO_FORMAT(&vinfo)));
 
        player->captured.width[0] = GST_VIDEO_INFO_WIDTH(&vinfo);
        player->captured.height[0] = GST_VIDEO_INFO_HEIGHT(&vinfo);
@@ -398,18 +395,18 @@ __mmplayer_get_video_frame_from_buffer(mm_player_t* player, GstPad *pad, GstBuff
        case GST_VIDEO_FORMAT_SN12:
                player->video_cs = MM_PLAYER_COLORSPACE_NV12;
                player->captured.width[1] = player->captured.width[0];
-               player->captured.height[1] = player->captured.height[0]>>1;
+               player->captured.height[1] = player->captured.height[0] >> 1;
                break;
        case GST_VIDEO_FORMAT_I420:
        case GST_VIDEO_FORMAT_S420:
                player->video_cs = MM_PLAYER_COLORSPACE_I420;
-               player->captured.width[1] = player->captured.width[2] = player->captured.width[0]>>1;
-               player->captured.height[1] = player->captured.height[2] = player->captured.height[0]>>1;
+               player->captured.width[1] = player->captured.width[2] = player->captured.width[0] >> 1;
+               player->captured.height[1] = player->captured.height[2] = player->captured.height[0] >> 1;
                break;
        case GST_VIDEO_FORMAT_ST12:
                player->video_cs = MM_PLAYER_COLORSPACE_NV12_TILED;
                player->captured.width[1] = player->captured.width[0];
-               player->captured.height[1] = player->captured.height[0]>>1;
+               player->captured.height[1] = player->captured.height[0] >> 1;
                break;
        case GST_VIDEO_FORMAT_BGRx:
                player->video_cs = MM_PLAYER_COLORSPACE_BGRx;
@@ -421,7 +418,7 @@ __mmplayer_get_video_frame_from_buffer(mm_player_t* player, GstPad *pad, GstBuff
        }
 
        if (ret != MM_ERROR_NONE) {
-               LOGE("unknown format to capture\n");
+               LOGE("unknown format to capture");
                return ret;
        }
 
@@ -430,7 +427,6 @@ __mmplayer_get_video_frame_from_buffer(mm_player_t* player, GstPad *pad, GstBuff
                        player->captured.stride_width[i] = GST_VIDEO_FRAME_PLANE_STRIDE(&vframe, i);
                        player->captured.stride_height[i] = player->captured.height[i];
                        plane_size = player->captured.stride_width[i] * player->captured.stride_height[i];
-
                        if (!plane_size) {
                                LOGE("invalid plane size");
                                return MM_ERROR_PLAYER_INTERNAL;
@@ -451,7 +447,7 @@ __mmplayer_get_video_frame_from_buffer(mm_player_t* player, GstPad *pad, GstBuff
 static GstPadProbeReturn
 __mmplayer_video_capture_probe(GstPad *pad, GstPadProbeInfo *info, gpointer u_data)
 {
-       mm_player_t* player = (mm_player_t*) u_data;
+       mm_player_t *player = (mm_player_t *)u_data;
        GstBuffer *buffer = NULL;
        int ret = MM_ERROR_NONE;
 
@@ -460,7 +456,6 @@ __mmplayer_video_capture_probe(GstPad *pad, GstPadProbeInfo *info, gpointer u_da
 
        buffer = gst_pad_probe_info_get_buffer(info);
        ret = __mmplayer_get_video_frame_from_buffer(player, pad, buffer);
-
        if (ret != MM_ERROR_NONE) {
                LOGE("failed to get video frame");
                return GST_PAD_PROBE_REMOVE;
@@ -478,7 +473,7 @@ __mmplayer_video_capture_probe(GstPad *pad, GstPadProbeInfo *info, gpointer u_da
 }
 
 static int
-__mm_player_convert_colorspace(mm_player_t* player, unsigned char* src_data, mm_util_color_format_e src_fmt, unsigned int src_w, unsigned int src_h, mm_util_color_format_e dst_fmt)
+__mm_player_convert_colorspace(mm_player_t *player, unsigned char *src_data, mm_util_color_format_e src_fmt, unsigned int src_w, unsigned int src_h, mm_util_color_format_e dst_fmt)
 {
        unsigned char *dst_data = NULL;
        unsigned int dst_width = 0;
@@ -487,15 +482,15 @@ __mm_player_convert_colorspace(mm_player_t* player, unsigned char* src_data, mm_
        int ret = MM_ERROR_NONE;
 
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_INTERNAL);
-       SECURE_LOGD("src size info. width: %d, height: %d \n", src_w, src_h);
+       SECURE_LOGD("src size info. width: %d, height: %d", src_w, src_h);
 
        ret = mm_util_convert_colorspace(src_data, src_w, src_h, src_fmt, dst_fmt, &dst_data, &dst_width, &dst_height, &dst_size);
        if (ret != MM_ERROR_NONE || !dst_data) {
-               LOGE("failed to convert for capture, %d\n", ret);
+               LOGE("failed to convert for capture, %d", ret);
                free(dst_data);
                return MM_ERROR_PLAYER_INTERNAL;
        }
-       SECURE_LOGD("dst size info. width: %d, height: %d, size: %zu\n", dst_width, dst_height, dst_size);
+       SECURE_LOGD("dst size info. width: %d, height: %d, size: %zu", dst_width, dst_height, dst_size);
 
        player->capture.size = (int)dst_size;
        player->capture.data = dst_data;
@@ -540,7 +535,7 @@ __tile_4x2_read(int x_size, int y_size, int x_pos, int y_pos)
        if ((y_size <= y_pos+32) && (y_pos < y_size) &&
                (((pixel_y_m1 >> 5) & 0x1) == 0) && (((y_pos >> 5) & 0x1) == 0)) {
                linear_addr0 = (((y_pos & 0x1f) <<4) | (x_addr & 0xf));
-               linear_addr1 = (((y_pos >> 6) & 0xff) * roundup_x +((x_addr >> 6) & 0x3f));
+               linear_addr1 = (((y_pos >> 6) & 0xff) * roundup_x + ((x_addr >> 6) & 0x3f));
 
                if (((x_addr >> 5) & 0x1) == ((y_pos >> 5) & 0x1))
                        bank_addr = ((x_addr >> 4) & 0x1);
@@ -548,7 +543,7 @@ __tile_4x2_read(int x_size, int y_size, int x_pos, int y_pos)
                        bank_addr = 0x2 | ((x_addr >> 4) & 0x1);
        } else {
                linear_addr0 = (((y_pos & 0x1f) << 4) | (x_addr & 0xf));
-               linear_addr1 = (((y_pos >> 6) & 0xff) * roundup_x +((x_addr >> 5) & 0x7f));
+               linear_addr1 = (((y_pos >> 6) & 0xff) * roundup_x + ((x_addr >> 5) & 0x7f));
 
                if (((x_addr >> 5) & 0x1) == ((y_pos >> 5) & 0x1))
                        bank_addr = ((x_addr >> 4) & 0x1);
@@ -608,149 +603,151 @@ __csc_tiled_to_linear_crop(unsigned char *yuv420_dest, unsigned char *nv12t_src,
        if (temp1 >= 256) {
                for (i = top; i < yuv420_height-buttom; i = i+1) {
                        j = left;
-                       temp3 = (j>>8)<<8;
-                       temp3 = temp3>>6;
-                       temp4 = i>>5;
+                       temp3 = (j >> 8) << 8;
+                       temp3 = temp3 >> 6;
+                       temp4 = i >> 5;
                        if (temp4 & 0x1) {
-                               /* odd fomula: 2+x+(x>>2)<<2+x_block_num*(y-1) */
-                               tiled_offset = temp4-1;
-                               temp1 = ((yuv420_width+127)>>7)<<7;
-                               tiled_offset = tiled_offset*(temp1>>6);
-                               tiled_offset = tiled_offset+temp3;
-                               tiled_offset = tiled_offset+2;
-                               temp1 = (temp3>>2)<<2;
-                               tiled_offset = tiled_offset+temp1;
-                               tiled_offset = tiled_offset<<11;
-                               tiled_offset1 = tiled_offset+2048*2;
+                               /* odd fomula: 2 + x + (x >> 2) << 2 + x_block_num * (y - 1) */
+                               tiled_offset = temp4 - 1;
+                               temp1 = ((yuv420_width + 127) >> 7) << 7;
+                               tiled_offset = tiled_offset * (temp1 >> 6);
+                               tiled_offset = tiled_offset + temp3;
+                               tiled_offset = tiled_offset + 2;
+                               temp1 = (temp3 >> 2) << 2;
+                               tiled_offset = tiled_offset + temp1;
+                               tiled_offset = tiled_offset << 11;
+                               tiled_offset1 = tiled_offset + 2048 * 2;
                                temp4 = 8;
                        } else {
-                               temp2 = ((yuv420_height+31)>>5)<<5;
-                               if ((i+32) < temp2) {
-                                       /* even1 fomula: x+((x+2)>>2)<<2+x_block_num*y */
-                                       temp1 = temp3+2;
-                                       temp1 = (temp1>>2)<<2;
-                                       tiled_offset = temp3+temp1;
-                                       temp1 = ((yuv420_width+127)>>7)<<7;
-                                       tiled_offset = tiled_offset+temp4*(temp1>>6);
-                                       tiled_offset = tiled_offset<<11;
-                                       tiled_offset1 = tiled_offset+2048*6;
+                               temp2 = ((yuv420_height+31) >> 5) << 5;
+                               if ((i + 32) < temp2) {
+                                       /* even1 fomula: x + ((x + 2) >> 2) << 2 + x_block_num * y */
+                                       temp1 = temp3 + 2;
+                                       temp1 = (temp1 >> 2) << 2;
+                                       tiled_offset = temp3 + temp1;
+                                       temp1 = ((yuv420_width + 127) >> 7) << 7;
+                                       tiled_offset = tiled_offset + temp4 * (temp1 >> 6);
+                                       tiled_offset = tiled_offset << 11;
+                                       tiled_offset1 = tiled_offset + 2048 * 6;
                                        temp4 = 8;
                                } else {
-                                       /* even2 fomula: x+x_block_num*y */
-                                       temp1 = ((yuv420_width+127)>>7)<<7;
-                                       tiled_offset = temp4*(temp1>>6);
-                                       tiled_offset = tiled_offset+temp3;
-                                       tiled_offset = tiled_offset<<11;
-                                       tiled_offset1 = tiled_offset+2048*2;
+                                       /* even2 fomula: x + x_block_num * y */
+                                       temp1 = ((yuv420_width + 127) >> 7) << 7;
+                                       tiled_offset = temp4 * (temp1 >> 6);
+                                       tiled_offset = tiled_offset + temp3;
+                                       tiled_offset = tiled_offset << 11;
+                                       tiled_offset1 = tiled_offset + 2048 * 2;
                                        temp4 = 4;
                                }
                        }
 
-                       temp1 = i&0x1F;
-                       tiled_offset = tiled_offset+64*(temp1);
-                       tiled_offset1 = tiled_offset1+64*(temp1);
-                       temp2 = yuv420_width-left-right;
-                       linear_offset = temp2*(i-top);
-                       temp3 = ((j+256)>>8)<<8;
-                       temp3 = temp3-j;
-                       temp1 = left&0x3F;
+                       temp1 = i & 0x1F;
+                       tiled_offset = tiled_offset + 64 * temp1;
+                       tiled_offset1 = tiled_offset1 + 64 * temp1;
+                       temp2 = yuv420_width - left - right;
+                       linear_offset = temp2 * (i - top);
+                       temp3 = ((j + 256) >> 8) << 8;
+                       temp3 = temp3 - j;
+                       temp1 = left & 0x3F;
                        if (temp3 > 192) {
-                               memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset+temp1, 64-temp1);
-                               memcpy(yuv420_dest+linear_offset+64-temp1, nv12t_src+tiled_offset+2048, 64);
-                               memcpy(yuv420_dest+linear_offset+128-temp1, nv12t_src+tiled_offset1, 64);
-                               memcpy(yuv420_dest+linear_offset+192-temp1, nv12t_src+tiled_offset1+2048, 64);
-                               linear_offset = linear_offset+256-temp1;
+                               memcpy(yuv420_dest + linear_offset, nv12t_src + tiled_offset + temp1, 64 - temp1);
+                               memcpy(yuv420_dest + linear_offset + 64 - temp1, nv12t_src + tiled_offset + 2048, 64);
+                               memcpy(yuv420_dest + linear_offset + 128 - temp1, nv12t_src + tiled_offset1, 64);
+                               memcpy(yuv420_dest + linear_offset + 192 - temp1, nv12t_src + tiled_offset1 + 2048, 64);
+                               linear_offset = linear_offset + 256 - temp1;
                        } else if (temp3 > 128) {
-                               memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset+2048+temp1, 64-temp1);
-                               memcpy(yuv420_dest+linear_offset+64-temp1, nv12t_src+tiled_offset1, 64);
-                               memcpy(yuv420_dest+linear_offset+128-temp1, nv12t_src+tiled_offset1+2048, 64);
-                               linear_offset = linear_offset+192-temp1;
+                               memcpy(yuv420_dest + linear_offset, nv12t_src + tiled_offset + 2048 + temp1, 64 - temp1);
+                               memcpy(yuv420_dest + linear_offset + 64 - temp1, nv12t_src + tiled_offset1, 64);
+                               memcpy(yuv420_dest + linear_offset + 128 - temp1, nv12t_src + tiled_offset1 + 2048, 64);
+                               linear_offset = linear_offset + 192 - temp1;
                        } else if (temp3 > 64) {
-                               memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset1+temp1, 64-temp1);
-                               memcpy(yuv420_dest+linear_offset+64-temp1, nv12t_src+tiled_offset1+2048, 64);
-                               linear_offset = linear_offset+128-temp1;
+                               memcpy(yuv420_dest + linear_offset, nv12t_src + tiled_offset1 + temp1, 64 - temp1);
+                               memcpy(yuv420_dest + linear_offset + 64 - temp1, nv12t_src + tiled_offset1 + 2048, 64);
+                               linear_offset = linear_offset + 128 - temp1;
                        } else if (temp3 > 0) {
-                               memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset1+2048+temp1, 64-temp1);
-                               linear_offset = linear_offset+64-temp1;
+                               memcpy(yuv420_dest + linear_offset, nv12t_src + tiled_offset1 + 2048 + temp1, 64 - temp1);
+                               linear_offset = linear_offset + 64 - temp1;
                        }
 
-                       tiled_offset = tiled_offset+temp4*2048;
-                       j = (left>>8)<<8;
+                       tiled_offset = tiled_offset + temp4 * 2048;
+                       j = (left >> 8) << 8;
                        j = j + 256;
-                       temp2 = yuv420_width-right-256;
-                       for (; j <= temp2; j = j+256) {
-                               memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset, 64);
-                               tiled_offset1 = tiled_offset1+temp4*2048;
-                               memcpy(yuv420_dest+linear_offset+64, nv12t_src+tiled_offset+2048, 64);
-                               memcpy(yuv420_dest+linear_offset+128, nv12t_src+tiled_offset1, 64);
-                               tiled_offset = tiled_offset+temp4*2048;
-                               memcpy(yuv420_dest+linear_offset+192, nv12t_src+tiled_offset1+2048, 64);
-                               linear_offset = linear_offset+256;
+                       temp2 = yuv420_width - right - 256;
+                       for (; j <= temp2; j = j + 256) {
+                               memcpy(yuv420_dest + linear_offset, nv12t_src + tiled_offset, 64);
+                               tiled_offset1 = tiled_offset1 + temp4 * 2048;
+                               memcpy(yuv420_dest + linear_offset + 64, nv12t_src + tiled_offset + 2048, 64);
+                               memcpy(yuv420_dest + linear_offset + 128, nv12t_src + tiled_offset1, 64);
+                               tiled_offset = tiled_offset + temp4 * 2048;
+                               memcpy(yuv420_dest + linear_offset + 192, nv12t_src + tiled_offset1 + 2048, 64);
+                               linear_offset = linear_offset + 256;
                        }
 
-                       tiled_offset1 = tiled_offset1+temp4*2048;
-                       temp2 = yuv420_width-right-j;
+                       tiled_offset1 = tiled_offset1 + temp4 * 2048;
+                       temp2 = yuv420_width - right - j;
                        if (temp2 > 192) {
-                               memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset, 64);
-                               memcpy(yuv420_dest+linear_offset+64, nv12t_src+tiled_offset+2048, 64);
-                               memcpy(yuv420_dest+linear_offset+128, nv12t_src+tiled_offset1, 64);
-                               memcpy(yuv420_dest+linear_offset+192, nv12t_src+tiled_offset1+2048, temp2-192);
+                               memcpy(yuv420_dest + linear_offset, nv12t_src + tiled_offset, 64);
+                               memcpy(yuv420_dest + linear_offset + 64, nv12t_src + tiled_offset + 2048, 64);
+                               memcpy(yuv420_dest + linear_offset + 128, nv12t_src + tiled_offset1, 64);
+                               memcpy(yuv420_dest + linear_offset + 192, nv12t_src + tiled_offset1 + 2048, temp2 - 192);
                        } else if (temp2 > 128) {
-                               memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset, 64);
-                               memcpy(yuv420_dest+linear_offset+64, nv12t_src+tiled_offset+2048, 64);
-                               memcpy(yuv420_dest+linear_offset+128, nv12t_src+tiled_offset1, temp2-128);
+                               memcpy(yuv420_dest + linear_offset, nv12t_src + tiled_offset, 64);
+                               memcpy(yuv420_dest + linear_offset + 64, nv12t_src + tiled_offset + 2048, 64);
+                               memcpy(yuv420_dest + linear_offset + 128, nv12t_src + tiled_offset1, temp2 - 128);
                        } else if (temp2 > 64) {
-                               memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset, 64);
-                               memcpy(yuv420_dest+linear_offset+64, nv12t_src+tiled_offset+2048, temp2-64);
-                       } else
-                               memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset, temp2);
+                               memcpy(yuv420_dest + linear_offset, nv12t_src + tiled_offset, 64);
+                               memcpy(yuv420_dest + linear_offset + 64, nv12t_src + tiled_offset + 2048, temp2 - 64);
+                       } else {
+                               memcpy(yuv420_dest + linear_offset, nv12t_src + tiled_offset, temp2);
+                       }
                }
        } else if (temp1 >= 64) {
-               for (i = top; i < (yuv420_height-buttom); i = i+1) {
+               for (i = top; i < (yuv420_height - buttom); i++) {
                        j = left;
                        tiled_offset = __tile_4x2_read(yuv420_width, yuv420_height, j, i);
-                       temp2 = ((j+64)>>6)<<6;
-                       temp2 = temp2-j;
-                       linear_offset = temp1*(i-top);
-                       temp4 = j&0x3;
-                       tiled_offset = tiled_offset+temp4;
-                       memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset, temp2);
-                       linear_offset = linear_offset+temp2;
-                       j = j+temp2;
-                       if ((j+64) <= temp3) {
+                       temp2 = ((j + 64) >> 6) << 6;
+                       temp2 = temp2 - j;
+                       linear_offset = temp1 * (i - top);
+                       temp4 = j & 0x3;
+                       tiled_offset = tiled_offset + temp4;
+                       memcpy(yuv420_dest + linear_offset, nv12t_src + tiled_offset, temp2);
+                       linear_offset = linear_offset + temp2;
+                       j = j + temp2;
+                       if ((j + 64) <= temp3) {
                                tiled_offset = __tile_4x2_read(yuv420_width, yuv420_height, j, i);
-                               memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset, 64);
-                               linear_offset = linear_offset+64;
-                               j = j+64;
+                               memcpy(yuv420_dest + linear_offset, nv12t_src + tiled_offset, 64);
+                               linear_offset = linear_offset + 64;
+                               j += 64;
                        }
-                       if ((j+64) <= temp3) {
+                       if ((j + 64) <= temp3) {
                                tiled_offset = __tile_4x2_read(yuv420_width, yuv420_height, j, i);
-                               memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset, 64);
-                               linear_offset = linear_offset+64;
-                               j = j+64;
+                               memcpy(yuv420_dest+linear_offset, nv12t_src + tiled_offset, 64);
+                               linear_offset = linear_offset + 64;
+                               j += 64;
                        }
                        if (j < temp3) {
                                tiled_offset = __tile_4x2_read(yuv420_width, yuv420_height, j, i);
-                               temp2 = temp3-j;
-                               memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset, temp2);
+                               temp2 = temp3 - j;
+                               memcpy(yuv420_dest + linear_offset, nv12t_src + tiled_offset, temp2);
                        }
                }
        } else {
-               for (i = top; i < (yuv420_height-buttom); i = i+1) {
-                       linear_offset = temp1*(i-top);
-                       for (j = left; j < (yuv420_width-right); j = j+2) {
+               for (i = top; i < (yuv420_height - buttom); i++) {
+                       linear_offset = temp1 * (i - top);
+                       for (j = left; j < (yuv420_width - right); j += 2) {
                                tiled_offset = __tile_4x2_read(yuv420_width, yuv420_height, j, i);
-                               temp4 = j&0x3;
-                               tiled_offset = tiled_offset+temp4;
-                               memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset, 2);
-                               linear_offset = linear_offset+2;
+                               temp4 = j & 0x3;
+                               tiled_offset = tiled_offset + temp4;
+                               memcpy(yuv420_dest + linear_offset, nv12t_src + tiled_offset, 2);
+                               linear_offset = linear_offset + 2;
                        }
                }
        }
 }
 
 #ifdef CAPTURE_OUTPUT_DUMP /* for capture output dump */
-static void capture_output_dump(mm_player_t* player)
+static void
+capture_output_dump(mm_player_t *player)
 {
        unsigned char *temp = NULL;
        char file[100] = { 0, };
@@ -796,7 +793,7 @@ __mm_player_convert_NV12_tiled(mm_player_t *player)
        guint width = player->captured.width[0];
        guint height = player->captured.height[0];
 
-       linear_y_plane_size = (width * height);
+       linear_y_plane_size = width * height;
        linear_uv_plane_size = linear_y_plane_size / 2;
 
        if (!linear_y_plane_size || !linear_uv_plane_size) {
index b8d878a..ccd7462 100644 (file)
 #define DEFAULT_FRAMERATE_DEN 1
 #define DEFAULT_VIDEO_FRAME_DURATION 33 /* ms */
 #define PLAYER_DATA_PUSH_WAIT_COUNT 10
-#define PLAYER_STATE_CHECK_INTERVAL (100*1000)
+#define PLAYER_STATE_CHECK_INTERVAL (100 * 1000)
 
 /*---------------------------------------------------------------------------
 |    LOCAL FUNCTION PROTOTYPES:                                             |
 ---------------------------------------------------------------------------*/
-static int __parse_media_format(MMPlayerVideoStreamInfo * video, MMPlayerAudioStreamInfo * audio, media_format_h format);
-static int __convert_media_format_video_mime_to_str(MMPlayerVideoStreamInfo * video, media_format_mimetype_e mime);
-static int __convert_media_format_audio_mime_to_str(MMPlayerAudioStreamInfo * audio, media_format_mimetype_e mime);
+static int __parse_media_format(MMPlayerVideoStreamInfo *video, MMPlayerAudioStreamInfo *audio, media_format_h format);
+static int __convert_media_format_video_mime_to_str(MMPlayerVideoStreamInfo *video, media_format_mimetype_e mime);
+static int __convert_media_format_audio_mime_to_str(MMPlayerAudioStreamInfo *audio, media_format_mimetype_e mime);
 
 /*===========================================================================================
 |                                                                                                                                                                                      |
@@ -55,7 +55,7 @@ static int __convert_media_format_audio_mime_to_str(MMPlayerAudioStreamInfo * au
 ========================================================================================== */
 
 static int
-__convert_media_format_video_mime_to_str(MMPlayerVideoStreamInfo * video,
+__convert_media_format_video_mime_to_str(MMPlayerVideoStreamInfo *video,
        media_format_mimetype_e mime)
 {
        MMPLAYER_RETURN_VAL_IF_FAIL(video, MM_ERROR_INVALID_ARGUMENT);
@@ -79,7 +79,7 @@ __convert_media_format_video_mime_to_str(MMPlayerVideoStreamInfo * video,
 }
 
 static int
-__convert_media_format_audio_mime_to_str(MMPlayerAudioStreamInfo * audio,
+__convert_media_format_audio_mime_to_str(MMPlayerAudioStreamInfo *audio,
        media_format_mimetype_e mime)
 {
        MMPLAYER_RETURN_VAL_IF_FAIL(audio, MM_ERROR_INVALID_ARGUMENT);
@@ -98,8 +98,8 @@ __convert_media_format_audio_mime_to_str(MMPlayerAudioStreamInfo * audio,
 }
 
 static int
-__parse_media_format(MMPlayerVideoStreamInfo * video,
-       MMPlayerAudioStreamInfo * audio, media_format_h format)
+__parse_media_format(MMPlayerVideoStreamInfo *video,
+       MMPlayerAudioStreamInfo *audio, media_format_h format)
 {
        if (audio) {
                media_format_mimetype_e mime;
@@ -141,7 +141,7 @@ __parse_media_format(MMPlayerVideoStreamInfo * video,
 
                video->width = width;
                video->height = height;
-               video->framerate_num = (frame_rate > 0) ? (frame_rate) : (DEFAULT_FRAMERATE_NUM);
+               video->framerate_num = (frame_rate > 0) ? frame_rate : DEFAULT_FRAMERATE_NUM;
                video->framerate_den = DEFAULT_FRAMERATE_DEN;
        }
 
@@ -151,7 +151,7 @@ __parse_media_format(MMPlayerVideoStreamInfo * video,
 static gboolean
 __mmplayer_update_video_info(MMHandleType hplayer, media_format_h fmt)
 {
-       mm_player_t *player = (mm_player_t *) hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
        gboolean ret = FALSE;
        GstStructure *str = NULL;
        media_format_mimetype_e mimetype = 0;
@@ -193,14 +193,13 @@ __mmplayer_update_video_info(MMHandleType hplayer, media_format_h fmt)
        return ret;
 }
 
-
 int
 _mmplayer_set_media_stream_buffer_status_cb(MMHandleType hplayer,
                                                                                        MMPlayerStreamType type,
                                                                                        mm_player_media_stream_buffer_status_callback callback,
                                                                                        void *user_param)
 {
-       mm_player_t *player = (mm_player_t *) hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
 
        MMPLAYER_FENTER();
 
@@ -233,7 +232,7 @@ _mmplayer_set_media_stream_seek_data_cb(MMHandleType hplayer,
                                                                                mm_player_media_stream_seek_data_callback callback,
                                                                                void *user_param)
 {
-       mm_player_t *player = (mm_player_t *) hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
 
        MMPLAYER_FENTER();
 
@@ -260,7 +259,7 @@ _mmplayer_set_media_stream_seek_data_cb(MMHandleType hplayer,
        return MM_ERROR_NONE;
 }
 
-static GstElement*
+static GstElement *
 __mmplayer_get_source_element(mm_player_t *player, MMPlayerStreamType type)
 {
        enum MainElementID elemId = MMPLAYER_M_NUM;
@@ -288,7 +287,7 @@ __mmplayer_get_source_element(mm_player_t *player, MMPlayerStreamType type)
 int
 _mmplayer_set_media_stream_max_size(MMHandleType hplayer, MMPlayerStreamType type, guint64 max_size)
 {
-       mm_player_t *player = (mm_player_t *) hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
        GstElement *element = NULL;
 
        MMPLAYER_FENTER();
@@ -317,7 +316,7 @@ _mmplayer_set_media_stream_max_size(MMHandleType hplayer, MMPlayerStreamType typ
 int
 _mmplayer_get_media_stream_max_size(MMHandleType hplayer, MMPlayerStreamType type, guint64 *max_size)
 {
-       mm_player_t *player = (mm_player_t *) hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
 
        MMPLAYER_FENTER();
 
@@ -334,7 +333,7 @@ _mmplayer_get_media_stream_max_size(MMHandleType hplayer, MMPlayerStreamType typ
 int
 _mmplayer_set_media_stream_min_percent(MMHandleType hplayer, MMPlayerStreamType type, guint min_percent)
 {
-       mm_player_t *player = (mm_player_t *) hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
        GstElement *element = NULL;
 
        MMPLAYER_FENTER();
@@ -362,7 +361,7 @@ _mmplayer_set_media_stream_min_percent(MMHandleType hplayer, MMPlayerStreamType
 int
 _mmplayer_get_media_stream_min_percent(MMHandleType hplayer, MMPlayerStreamType type, guint *min_percent)
 {
-       mm_player_t *player = (mm_player_t *) hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
 
        MMPLAYER_FENTER();
 
@@ -377,7 +376,7 @@ _mmplayer_get_media_stream_min_percent(MMHandleType hplayer, MMPlayerStreamType
 }
 
 static int
-__mmplayer_check_buffer_level(mm_player_t *player, GstElementelement, MMPlayerStreamType type)
+__mmplayer_check_buffer_level(mm_player_t *player, GstElement *element, MMPlayerStreamType type)
 {
        guint64 current_level_bytes = 0;
        guint64 max_bytes = 0;
@@ -411,7 +410,7 @@ __mmplayer_check_buffer_level(mm_player_t *player, GstElement* element, MMPlayer
                        return MM_ERROR_NONE;
                }
 
-               current_level_per = (guint)(gst_util_guint64_to_gdouble(current_level_bytes)/gst_util_guint64_to_gdouble(max_bytes)*100);
+               current_level_per = (guint)(gst_util_guint64_to_gdouble(current_level_bytes) / gst_util_guint64_to_gdouble(max_bytes) * 100);
 
                LOGD("type: %s, min_per %u, curr_per %u max %"G_GUINT64_FORMAT" cur %"G_GUINT64_FORMAT,
                                        MMPLAYER_STREAM_TYPE_GET_NAME(type), player->media_stream_buffer_min_percent[type],
@@ -434,10 +433,10 @@ _mmplayer_submit_packet(MMHandleType hplayer, media_packet_h packet)
 {
        int ret = MM_ERROR_NONE;
        GstBuffer *_buffer = NULL;
-       mm_player_t *player = (mm_player_t *) hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
        guint8 *buf = NULL;
        uint64_t size = 0;
-       GstElementelement = NULL;
+       GstElement *element = NULL;
        MMPlayerStreamType streamtype = MM_PLAYER_STREAM_TYPE_AUDIO;
        media_format_h fmt = NULL;
        bool flag = FALSE;
@@ -475,7 +474,7 @@ _mmplayer_submit_packet(MMHandleType hplayer, media_packet_h packet)
                return ret;
 
        /* get data */
-       if (media_packet_get_buffer_data_ptr(packet, (void **) &buf) != MEDIA_PACKET_ERROR_NONE) {
+       if (media_packet_get_buffer_data_ptr(packet, (void **)&buf) != MEDIA_PACKET_ERROR_NONE) {
                LOGE("failed to get buffer data ptr");
                ret = MM_ERROR_PLAYER_INTERNAL;
                goto ERROR;
@@ -497,7 +496,7 @@ _mmplayer_submit_packet(MMHandleType hplayer, media_packet_h packet)
                _buffer = gst_buffer_new_and_alloc(size);
 
                if (!_buffer) {
-                       LOGE("failed to allocate memory for push buffer\n");
+                       LOGE("failed to allocate memory for push buffer");
                        ret = MM_ERROR_PLAYER_NO_FREE_SPACE;
                        goto ERROR;
                }
@@ -584,7 +583,7 @@ ERROR:
 }
 
 static int
-__mmplayer_video_caps_new(MMHandleType hplayer, MMPlayerVideoStreamInfo * video,
+__mmplayer_video_caps_new(MMHandleType hplayer, MMPlayerVideoStreamInfo *video,
        const char *fieldname, ...)
 {
        int cap_size;
@@ -598,7 +597,7 @@ __mmplayer_video_caps_new(MMHandleType hplayer, MMPlayerVideoStreamInfo * video,
        MMPLAYER_RETURN_VAL_IF_FAIL(video, MM_ERROR_PLAYER_NOT_INITIALIZED);
 
        LOGD("width=%d height=%d framerate num=%d, den=%d",
-       video->width, video->height, video->framerate_num, video->framerate_den);
+               video->width, video->height, video->framerate_num, video->framerate_den);
 
        caps = gst_caps_new_simple(video->mime,
                "width", G_TYPE_INT, video->width,
@@ -714,7 +713,7 @@ _mmplayer_set_video_info(MMHandleType hplayer, media_format_h format)
        } else
                __mmplayer_video_caps_new(hplayer, &info, NULL);
 #endif
-       g_free((char *) video.mime);
+       g_free((char *)video.mime);
 
        MMPLAYER_FLEAVE();
 
@@ -767,7 +766,7 @@ _mmplayer_set_audio_info(MMHandleType hplayer, media_format_h format)
                                        "mpegversion", G_TYPE_INT, audio.version,
                                        "stream-format", G_TYPE_STRING, stream_format, NULL);
 
-                       g_free(stream_format);
+                       MMPLAYER_FREEIF(stream_format);
                        stream_format = NULL;
                }
        }
@@ -800,10 +799,10 @@ _mmplayer_set_audio_info(MMHandleType hplayer, media_format_h format)
 
                gst_caps_set_simple(caps, "codec_data", GST_TYPE_BUFFER, buf, NULL);
                gst_buffer_unref(buf);
-               g_free((char *) audio.codec_extradata);
+               g_free((char *)audio.codec_extradata);
        }
 
-       g_free((char *) audio.mime);
+       g_free((char *)audio.mime);
 
        player->a_stream_caps = gst_caps_copy(caps);
        gst_caps_unref(caps);
@@ -815,7 +814,7 @@ _mmplayer_set_audio_info(MMHandleType hplayer, media_format_h format)
 
 int
 _mmplayer_set_subtitle_info(MMHandleType hplayer,
-       MMPlayerSubtitleStreamInfo * subtitle)
+       MMPlayerSubtitleStreamInfo *subtitle)
 {
 #if 0                           //todo
        mm_player_t *player = MM_PLAYER_CAST(hplayer);
index e3067df..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,134 +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 = 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); \
+       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); \
+                       } \
                } \
-               MMPLAYER_FREEIF(string); \
-       } \
-}
+       } 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 : %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);\
+       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; \
-                       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;\
                } \
-       } \
-} 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;
 
@@ -931,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;
                                }
                        }
@@ -944,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;
                                }
                        }
@@ -952,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);
 
@@ -961,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;
 
@@ -997,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;
                }
 
@@ -1007,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;
                }
 
@@ -1028,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;
 
@@ -1038,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)) {
@@ -1058,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;
@@ -1067,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;
        }
@@ -1095,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;
                                }
                        }
@@ -1132,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;
                                }
                        }
@@ -1148,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 {
@@ -1161,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);
                                        }
                                }
@@ -1180,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;
                }
        }
@@ -1204,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;
 
@@ -1219,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 */
@@ -1234,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);
@@ -1260,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)
@@ -1280,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);
@@ -1290,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;
@@ -1305,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;
        }
 
@@ -1313,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();
 
@@ -1333,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;
 
@@ -1358,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();
@@ -1372,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);
@@ -1380,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);
@@ -1393,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;
@@ -1416,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);
 
@@ -1453,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();
 
@@ -1492,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;
@@ -1520,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);
@@ -1581,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;
@@ -1610,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;
@@ -1659,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;
                }
        }
 
@@ -1742,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;
@@ -1824,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;
@@ -1846,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);
@@ -1871,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;
 
@@ -1918,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);
                                }
 
@@ -1937,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:
@@ -1958,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);
 
@@ -1975,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;
 
@@ -1995,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;
@@ -2003,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);
                                }
@@ -2014,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;
 
@@ -2024,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:
@@ -2039,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:
@@ -2065,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;
@@ -2090,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);
@@ -2173,19 +2181,19 @@ __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;
        }
@@ -2203,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;
        }
@@ -2233,20 +2241,20 @@ __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;
        }
@@ -2262,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;
@@ -2368,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;
 
@@ -2518,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();
 
@@ -2539,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;
        }
 
@@ -2571,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;
                }
 
@@ -2630,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]))
@@ -2665,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;
 
@@ -2707,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;
@@ -2750,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);
        }
@@ -2768,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);
@@ -2788,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);
@@ -2815,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;
 
@@ -2858,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;
 
@@ -2877,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);
@@ -2900,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;
@@ -2927,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;
@@ -2943,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);
@@ -2959,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));
@@ -2982,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;
@@ -2998,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);
@@ -3021,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");
 
@@ -3037,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;
@@ -3056,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;
        }
 
@@ -3067,10 +3072,9 @@ 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) {
+       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);
@@ -3082,7 +3086,7 @@ int __mmplayer_gst_stop(mm_player_t* player)
 
        /* return if set_state has failed */
        if (ret != MM_ERROR_NONE) {
-               LOGE("failed to set state.\n");
+               LOGE("failed to set state.");
                return ret;
        }
 
@@ -3091,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;
                }
        }
@@ -3107,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);
        }
@@ -3120,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;
 
@@ -3137,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);
+                               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);
 
-                       return ret;
+               return ret;
+       }
 
-               } else if ((!MMPLAYER_IS_RTSP_STREAMING(player)) && (!player->video_stream_cb) &&
-                                  (!player->pipeline->videobin) && (!player->pipeline->audiobin)) {
+       if ((!MMPLAYER_IS_RTSP_STREAMING(player)) && (!player->video_stream_cb) &&
+               (!player->pipeline->videobin) && (!player->pipeline->audiobin))
+               return MM_ERROR_PLAYER_CODEC_NOT_FOUND;
 
-                       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");
 
@@ -3219,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;
@@ -3244,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");
@@ -3260,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();
@@ -3291,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);
                                                }
@@ -3314,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));
                }
 
@@ -3322,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);
 
@@ -3350,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();
@@ -3375,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;
@@ -3386,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))
@@ -3452,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. */
@@ -3470,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")",
@@ -3486,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
 
@@ -3536,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 *start_pos, int *end_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
@@ -3582,7 +3589,7 @@ int __mmplayer_gst_get_buffer_position(mm_player_t *player, int *start_pos, int
                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;
@@ -3623,8 +3630,9 @@ int __mmplayer_gst_get_buffer_position(mm_player_t *player, int *start_pos, int
 
                                        buffered_total += (stop_byte - start_byte);
                                }
-                       } else
+                       } else {
                                end_per = BUFFERING_MAX_PER;
+                       }
                }
                gst_query_unref(query);
        }
@@ -3632,7 +3640,7 @@ int __mmplayer_gst_get_buffer_position(mm_player_t *player, int *start_pos, int
        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) {
@@ -3644,14 +3652,14 @@ int __mmplayer_gst_get_buffer_position(mm_player_t *player, int *start_pos, int
                        }
 
                        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)
-                               end_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);
                }
        }
 
@@ -3664,9 +3672,10 @@ int __mmplayer_gst_get_buffer_position(mm_player_t *player, int *start_pos, int
        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 &&
@@ -3695,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;
 
@@ -3729,12 +3739,13 @@ int __mmplayer_gst_build_es_pipeline(mm_player_t* player)
        return MM_ERROR_NONE;
 }
 
-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;
 
@@ -3839,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) {
@@ -3908,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;
index 0317681..3c7e73d 100644 (file)
 #include "iniparser.h"
 #include <mm_player_ini.h>
 #include <mm_error.h>
+#include <mm_player_utils.h>
 #include <glib/gstdio.h>
 
 /* internal functions, macros here */
 #ifdef MM_PLAYER_DEFAULT_INI
 static gboolean        __generate_default_ini(void);
 #endif
-static void    __get_element_list(mm_player_ini_t* ini, gchar* str, int keyword_type);
+static void    __get_element_list(mm_player_ini_t *ini, gchar *str, int keyword_type);
 
 static void __mm_player_ini_check_ini_status(void);
 
 /* macro */
 #define MMPLAYER_INI_GET_STRING(x_dict, x_item, x_ini, x_default) \
-do { \
-       gchar* str = iniparser_getstring(x_dict, x_ini, x_default); \
-       if (str &&  \
-               (strlen(str) > 0) && \
-               (strlen(str) < PLAYER_INI_MAX_STRLEN)) \
-               strncpy(x_item, str, PLAYER_INI_MAX_STRLEN-1); \
-       else \
-               strncpy(x_item, x_default, PLAYER_INI_MAX_STRLEN-1); \
-} while (0)
+       do { \
+               gchar *str = iniparser_getstring(x_dict, x_ini, x_default); \
+               if (str &&  \
+                       (strlen(str) > 0) && \
+                       (strlen(str) < PLAYER_INI_MAX_STRLEN)) \
+                       strncpy(x_item, str, PLAYER_INI_MAX_STRLEN-1); \
+               else \
+                       strncpy(x_item, x_default, PLAYER_INI_MAX_STRLEN-1); \
+       } while (0)
 
 #define MMPLAYER_INI_GET_COLOR(x_dict, x_item, x_ini, x_default) \
-do { \
-       gchar* str = iniparser_getstring(x_dict, x_ini, x_default); \
-       if (str &&  \
-               (strlen(str) > 0) && \
-               (strlen(str) < PLAYER_INI_MAX_STRLEN)) \
-               x_item = (guint) strtoul(str, NULL, 16); \
-       else \
-               x_item = (guint) strtoul(x_default, NULL, 16); \
-} while (0)
+       do { \
+               gchar *str = iniparser_getstring(x_dict, x_ini, x_default); \
+               if (str &&  \
+                       (strlen(str) > 0) && \
+                       (strlen(str) < PLAYER_INI_MAX_STRLEN)) \
+                       x_item = (guint) strtoul(str, NULL, 16); \
+               else \
+                       x_item = (guint) strtoul(x_default, NULL, 16); \
+       } while (0)
 
 /* x_ini is the list of index to set TRUE at x_list[index] */
 #define MMPLAYER_INI_GET_BOOLEAN_FROM_LIST(x_dict, x_list, x_list_max, x_ini, x_default) \
-do { \
-               int index = 0; \
-               const char *delimiters = " ,"; \
-               char *usr_ptr = NULL; \
-               char *token = NULL; \
-               gchar temp_arr[PLAYER_INI_MAX_STRLEN] = {0}; \
-               MMPLAYER_INI_GET_STRING(x_dict, temp_arr, x_ini, x_default); \
-               token = strtok_r(temp_arr, delimiters, &usr_ptr); \
-               while (token) { \
-                       index = atoi(token); \
-                       if (index < 0 || index > x_list_max -1) \
-                               LOGW("%d is not valid index\n", index); \
-                       else \
-                               x_list[index] = TRUE; \
-                       token = strtok_r(NULL, delimiters, &usr_ptr); \
-               } \
-} while (0)
+       do { \
+                       int index = 0; \
+                       const char *delimiters = " ,"; \
+                       char *usr_ptr = NULL; \
+                       char *token = NULL; \
+                       gchar temp_arr[PLAYER_INI_MAX_STRLEN] = {0}; \
+                       MMPLAYER_INI_GET_STRING(x_dict, temp_arr, x_ini, x_default); \
+                       token = strtok_r(temp_arr, delimiters, &usr_ptr); \
+                       while (token) { \
+                               index = atoi(token); \
+                               if (index < 0 || index > x_list_max -1) \
+                                       LOGW("%d is not valid index", index); \
+                               else \
+                                       x_list[index] = TRUE; \
+                               token = strtok_r(NULL, delimiters, &usr_ptr); \
+                       } \
+       } while (0)
 
 /* x_ini is the list of value to be set at x_list[index] */
 #define MMPLAYER_INI_GET_INT_FROM_LIST(x_dict, x_list, x_list_max, x_ini, x_default) \
-do { \
-               int index = 0; \
-               int value = 0; \
-               const char *delimiters = " ,"; \
-               char *usr_ptr = NULL; \
-               char *token = NULL; \
-               gchar temp_arr[PLAYER_INI_MAX_STRLEN] = {0}; \
-               MMPLAYER_INI_GET_STRING(x_dict, temp_arr, x_ini, x_default); \
-               token = strtok_r(temp_arr, delimiters, &usr_ptr); \
-               while (token) { \
-                       if (index > x_list_max -1) { \
-                               LOGE("%d is not valid index\n", index); \
-                               break; \
-                       } else { \
-                               value = atoi(token); \
-                               x_list[index] = value; \
-                               index++; \
+       do { \
+                       int index = 0; \
+                       int value = 0; \
+                       const char *delimiters = " ,"; \
+                       char *usr_ptr = NULL; \
+                       char *token = NULL; \
+                       gchar temp_arr[PLAYER_INI_MAX_STRLEN] = {0, }; \
+                       MMPLAYER_INI_GET_STRING(x_dict, temp_arr, x_ini, x_default); \
+                       token = strtok_r(temp_arr, delimiters, &usr_ptr); \
+                       while (token) { \
+                               if (index > x_list_max -1) { \
+                                       LOGE("%d is not valid index", index); \
+                                       break; \
+                               } else { \
+                                       value = atoi(token); \
+                                       x_list[index] = value; \
+                                       index++; \
+                               } \
+                               token = strtok_r(NULL, delimiters, &usr_ptr); \
                        } \
-                       token = strtok_r(NULL, delimiters, &usr_ptr); \
-               } \
-} while (0)
+       } while (0)
 
 int
-mm_player_ini_load(mm_player_ini_tini)
+mm_player_ini_load(mm_player_ini_t *ini)
 {
-       dictionary * dict = NULL;
+       dictionary *dict = NULL;
        gint idx = 0;
 
        __mm_player_ini_check_ini_status();
@@ -121,13 +122,13 @@ mm_player_ini_load(mm_player_ini_t* ini)
        /* if no file exists. create one with set of default values */
        if (!dict) {
 #ifdef MM_PLAYER_DEFAULT_INI
-               LOGD("No inifile found. player will create default inifile.\n");
-               if (FALSE == __generate_default_ini())
-                       LOGW("Creating default inifile failed. Player will use default values.\n");
+               LOGD("No inifile found. player will create default inifile.");
+               if (__generate_default_ini() == FALSE)
+                       LOGW("Creating default inifile failed. Player will use default values.");
                else
                        dict = iniparser_load(MM_PLAYER_INI_DEFAULT_PATH);      /* load default ini */
 #else
-               LOGD("No ini file found. \n");
+               LOGD("No ini file found. ");
                return MM_ERROR_FILE_NOT_FOUND;
 #endif
        }
@@ -194,7 +195,7 @@ mm_player_ini_load(mm_player_ini_t* ini)
                MMPLAYER_INI_GET_STRING(dict, ini->dump_element_path, "general:dump element path", DEFAULT_DUMP_ELEMENT_PATH);
        } else {
                /* if dict is not available just fill the structure with default value */
-               LOGW("failed to load ini. using hardcoded default\n");
+               LOGW("failed to load ini. using hardcoded default");
 
                /* general */
                ini->disable_segtrap = DEFAULT_DISABLE_SEGTRAP;
@@ -213,11 +214,11 @@ mm_player_ini_load(mm_player_ini_t* ini)
                ini->num_of_video_bo = DEFAULT_NUM_OF_VIDEO_BO;
                ini->video_bo_timeout = DEFAULT_TIMEOUT_OF_VIDEO_BO;
 
-               strncpy(ini->audioresampler_element, DEFAULT_AUDIORESAMPLER, PLAYER_INI_MAX_STRLEN -1);
-               strncpy(ini->audiosink_element, DEFAULT_AUDIOSINK, PLAYER_INI_MAX_STRLEN -1);
+               strncpy(ini->audioresampler_element, DEFAULT_AUDIORESAMPLER, PLAYER_INI_MAX_STRLEN - 1);
+               strncpy(ini->audiosink_element, DEFAULT_AUDIOSINK, PLAYER_INI_MAX_STRLEN - 1);
                strncpy(ini->audiocodec_element_hw, DEFAULT_CODEC_HW, PLAYER_INI_MAX_STRLEN - 1);
                strncpy(ini->videocodec_element_hw, DEFAULT_CODEC_HW, PLAYER_INI_MAX_STRLEN - 1);
-               strncpy(ini->videoconverter_element, DEFAULT_VIDEO_CONVERTER, PLAYER_INI_MAX_STRLEN -1);
+               strncpy(ini->videoconverter_element, DEFAULT_VIDEO_CONVERTER, PLAYER_INI_MAX_STRLEN - 1);
 
                __get_element_list(ini, DEFAULT_CODEC_SW, KEYWORD_A_SW_CODEC);
                __get_element_list(ini, DEFAULT_CODEC_SW, KEYWORD_V_SW_CODEC);
@@ -235,7 +236,7 @@ mm_player_ini_load(mm_player_ini_t* ini)
                ini->http_use_file_buffer = DEFAULT_HTTP_USE_FILE_BUFFER;
                ini->http_ring_buffer_size = DEFAULT_HTTP_RING_BUFFER_SIZE;
                ini->http_max_size_bytes = DEFAULT_HTTP_MAX_SIZE_BYTES;
-               ini->http_buffering_time = (gint)(DEFAULT_HTTP_BUFFERING_TIME*1000);
+               ini->http_buffering_time = (gint)(DEFAULT_HTTP_BUFFERING_TIME * 1000);
                ini->http_timeout = DEFAULT_HTTP_TIMEOUT;
 
                /* dump buffer for debug */
@@ -247,74 +248,74 @@ mm_player_ini_load(mm_player_ini_t* ini)
        iniparser_freedict(dict);
 
        /* dump structure */
-       LOGD("player settings -----------------------------------\n");
+       LOGD("player settings -----------------------------------");
 
        /* general */
-       LOGD("disable segtrap : %d\n", ini->disable_segtrap);
-       LOGD("skip rescan : %d\n", ini->skip_rescan);
-       LOGD("videosink element overlay: %s\n", ini->videosink_element_overlay);
-       LOGD("videosink element fake: %s\n", ini->videosink_element_fake);
-       LOGD("video converter element : %s\n", ini->videoconverter_element);
-       LOGD("video codec element(hw) : %s\n", ini->videocodec_element_hw);
+       LOGD("disable segtrap : %d", ini->disable_segtrap);
+       LOGD("skip rescan : %d", ini->skip_rescan);
+       LOGD("videosink element overlay: %s", ini->videosink_element_overlay);
+       LOGD("videosink element fake: %s", ini->videosink_element_fake);
+       LOGD("video converter element : %s", ini->videoconverter_element);
+       LOGD("video codec element(hw) : %s", ini->videocodec_element_hw);
        for (idx = 0; ini->videocodec_element_sw[idx][0] != '\0'; idx++)
-               LOGD("video codec element(sw%d) %s\n", idx, ini->videocodec_element_sw[idx]);
-       LOGD("audio codec element(hw) : %s\n", ini->audiocodec_element_hw);
+               LOGD("video codec element(sw%d) %s", idx, ini->videocodec_element_sw[idx]);
+       LOGD("audio codec element(hw) : %s", ini->audiocodec_element_hw);
        for (idx = 0; ini->audiocodec_element_sw[idx][0] != '\0'; idx++)
-               LOGD("audio codec element(sw%d) %s\n", idx, ini->audiocodec_element_sw[idx]);
-       LOGD("audio resampler element : %s\n", ini->audioresampler_element);
-       LOGD("audiosink element : %s\n", ini->audiosink_element);
-       LOGD("generate dot : %d\n", ini->generate_dot);
-       LOGD("use system clock(video only) : %d\n", ini->use_system_clock);
-       LOGD("live state change timeout(sec) : %d\n", ini->live_state_change_timeout);
-       LOGD("localplayback state change timeout(sec) : %d\n", ini->localplayback_state_change_timeout);
-       LOGD("eos_delay(msec) : %d\n", ini->eos_delay);
-       LOGD("delay before repeat(msec) : %d\n", ini->delay_before_repeat);
-       LOGD("async_start : %d\n", ini->async_start);
-       LOGD("video_playback_supported : %d\n", ini->video_playback_supported);
-       LOGD("pcm buffer size(bytes) : %d\n", ini->pcm_buffer_size);
-       LOGD("num of video bo : %d\n", ini->num_of_video_bo);
-       LOGD("video bo timeout : %d\n", ini->video_bo_timeout);
-       LOGD("gst param1 : %s\n", ini->gst_param[0]);
-       LOGD("gst param2 : %s\n", ini->gst_param[1]);
-       LOGD("gst param3 : %s\n", ini->gst_param[2]);
-       LOGD("gst param4 : %s\n", ini->gst_param[3]);
-       LOGD("gst param5 : %s\n", ini->gst_param[4]);
+               LOGD("audio codec element(sw%d) %s", idx, ini->audiocodec_element_sw[idx]);
+       LOGD("audio resampler element : %s", ini->audioresampler_element);
+       LOGD("audiosink element : %s", ini->audiosink_element);
+       LOGD("generate dot : %d", ini->generate_dot);
+       LOGD("use system clock(video only) : %d", ini->use_system_clock);
+       LOGD("live state change timeout(sec) : %d", ini->live_state_change_timeout);
+       LOGD("localplayback state change timeout(sec) : %d", ini->localplayback_state_change_timeout);
+       LOGD("eos_delay(msec) : %d", ini->eos_delay);
+       LOGD("delay before repeat(msec) : %d", ini->delay_before_repeat);
+       LOGD("async_start : %d", ini->async_start);
+       LOGD("video_playback_supported : %d", ini->video_playback_supported);
+       LOGD("pcm buffer size(bytes) : %d", ini->pcm_buffer_size);
+       LOGD("num of video bo : %d", ini->num_of_video_bo);
+       LOGD("video bo timeout : %d", ini->video_bo_timeout);
+       LOGD("gst param1 : %s", ini->gst_param[0]);
+       LOGD("gst param2 : %s", ini->gst_param[1]);
+       LOGD("gst param3 : %s", ini->gst_param[2]);
+       LOGD("gst param4 : %s", ini->gst_param[3]);
+       LOGD("gst param5 : %s", ini->gst_param[4]);
 
        for (idx = 0; ini->exclude_element_keyword[idx][0] != '\0'; idx++)
-               LOGD("exclude_element_keyword [%d] : %s\n", idx, ini->exclude_element_keyword[idx]);
+               LOGD("exclude_element_keyword [%d] : %s", idx, ini->exclude_element_keyword[idx]);
 
        for (idx = 0; ini->dump_element_keyword[idx][0] != '\0'; idx++)
-               LOGD("dump_element_keyword [%d] : %s\n", idx, ini->dump_element_keyword[idx]);
+               LOGD("dump_element_keyword [%d] : %s", idx, ini->dump_element_keyword[idx]);
 
        for (idx = 0; ini->unsupported_codec_keyword[idx][0] != '\0'; idx++)
-               LOGD("unsupported_codec_keyword [%d] : %s\n", idx, ini->dump_element_keyword[idx]);
+               LOGD("unsupported_codec_keyword [%d] : %s", idx, ini->dump_element_keyword[idx]);
 
        /* http streaming */
-       LOGD("httpsrc element : %s\n", ini->httpsrc_element);
-       LOGD("http use file buffer : %d \n", ini->http_use_file_buffer);
-       LOGD("http ring buffer size : %d \n", ini->http_ring_buffer_size);
-       LOGD("http max_size bytes : %d \n", ini->http_max_size_bytes);
-       LOGD("http buffering time : %d \n", ini->http_buffering_time);
-       LOGD("http timeout : %d \n", ini->http_timeout);
+       LOGD("httpsrc element : %s", ini->httpsrc_element);
+       LOGD("http use file buffer : %d", ini->http_use_file_buffer);
+       LOGD("http ring buffer size : %d", ini->http_ring_buffer_size);
+       LOGD("http max_size bytes : %d", ini->http_max_size_bytes);
+       LOGD("http buffering time : %d", ini->http_buffering_time);
+       LOGD("http timeout : %d", ini->http_timeout);
 
        return MM_ERROR_NONE;
 }
 
 int
-mm_player_audio_effect_ini_load(mm_player_ini_tini)
+mm_player_audio_effect_ini_load(mm_player_ini_t *ini)
 {
-       dictionary * dict_audioeffect = NULL;
+       dictionary *dict_audioeffect = NULL;
 
        dict_audioeffect = iniparser_load(MM_PLAYER_INI_DEFAULT_AUDIOEFFECT_PATH);
        if (!dict_audioeffect) {
-               LOGE("No audio effect ini file found. \n");
+               LOGE("No audio effect ini file found.");
                return MM_ERROR_FILE_NOT_FOUND;
        }
 
        /* audio effect element name */
        MMPLAYER_INI_GET_STRING(dict_audioeffect, ini->audioeffect_element, "audio effect:audio effect element", DEFAULT_AUDIO_EFFECT_ELEMENT);
        if (!ini->audioeffect_element[0]) {
-               LOGW("could not parse name of audio effect. \n");
+               LOGW("could not parse name of audio effect.");
                iniparser_freedict(dict_audioeffect);
                /* NOTE : in this case, we are not going to create audio filter element */
                return MM_ERROR_NONE;
@@ -375,27 +376,27 @@ mm_player_audio_effect_ini_load(mm_player_ini_t* ini)
        /* audio effect element name */
        MMPLAYER_INI_GET_STRING(dict_audioeffect, ini->audioeffect_element_custom, "audio effect:audio effect element custom", DEFAULT_AUDIO_EFFECT_ELEMENT);
        if (!ini->audioeffect_element_custom[0])
-               LOGW("no secondary audio effect \n");
+               LOGW("no secondary audio effect");
        else
-               LOGD("audioeffect element custom : %s\n", ini->audioeffect_element_custom);
+               LOGD("audioeffect element custom : %s", ini->audioeffect_element_custom);
 
        /* dump structure */
-       LOGD("audioeffect element : %s\n", ini->audioeffect_element);
-       LOGD("audio effect preset mode : %d\n", ini->use_audio_effect_preset);
-       LOGD("audio effect custom mode : %d\n", ini->use_audio_effect_custom);
+       LOGD("audioeffect element : %s", ini->audioeffect_element);
+       LOGD("audio effect preset mode : %d", ini->use_audio_effect_preset);
+       LOGD("audio effect custom mode : %d", ini->use_audio_effect_custom);
 #if 0 // debug
        int i;
        for (i = 0; i < MM_AUDIO_EFFECT_PRESET_NUM; i++)
-               LOGD("audio_effect_preset_list: %d (is it for earphone only?(%d))\n", ini->audio_effect_preset_list[i], ini->audio_effect_preset_earphone_only_list[i]);
+               LOGD("audio_effect_preset_list: %d (is it for earphone only?(%d))", ini->audio_effect_preset_list[i], ini->audio_effect_preset_earphone_only_list[i]);
 
        for (i = 0; i < MM_AUDIO_EFFECT_CUSTOM_NUM; i++)
-               LOGD("audio_effect_custom_list : %d (is it for earphone only?(%d))\n", ini->audio_effect_custom_list[i], ini->audio_effect_custom_earphone_only_list[i]);
-       LOGD("audio_effect_custom : eq_band_num(%d), ext_num(%d)\n", ini->audio_effect_custom_eq_band_num, ini->audio_effect_custom_ext_num);
+               LOGD("audio_effect_custom_list : %d (is it for earphone only?(%d))", ini->audio_effect_custom_list[i], ini->audio_effect_custom_earphone_only_list[i]);
+       LOGD("audio_effect_custom : eq_band_num(%d), ext_num(%d)", ini->audio_effect_custom_eq_band_num, ini->audio_effect_custom_ext_num);
        LOGD("audio_effect_custom_EQ : width(Hz) / central frequency(Hz)");
        for (i = 0; i < ini->audio_effect_custom_eq_band_num; i++)
                LOGD("     EQ band index(%d) :  %8d / %8d", i, ini->audio_effect_custom_eq_band_width[i], ini->audio_effect_custom_eq_band_freq[i]);
        for (i = 0; i < MM_AUDIO_EFFECT_CUSTOM_NUM; i++)
-               LOGD("audio_effect_custom_level_min_max(idx:%d) : Min(%d), Max(%d)\n", i, ini->audio_effect_custom_min_level_list[i], ini->audio_effect_custom_max_level_list[i]);
+               LOGD("audio_effect_custom_level_min_max(idx:%d) : Min(%d), Max(%d)", i, ini->audio_effect_custom_min_level_list[i], ini->audio_effect_custom_max_level_list[i]);
 #endif
        iniparser_freedict(dict_audioeffect);
 
@@ -403,16 +404,16 @@ mm_player_audio_effect_ini_load(mm_player_ini_t* ini)
 
 }
 
-static
-void __mm_player_ini_check_ini_status(void)
+static void
+__mm_player_ini_check_ini_status(void)
 {
        struct stat ini_buff;
 
        if (g_stat(MM_PLAYER_INI_DEFAULT_PATH, &ini_buff) < 0) {
-               LOGW("failed to get player ini status\n");
+               LOGW("failed to get player ini status");
        } else {
                if (ini_buff.st_size < 5) {
-                       LOGW("player.ini file size=%d, Corrupted!So, Removed\n", (int)ini_buff.st_size);
+                       LOGW("player.ini file size=%d, Corrupted!So, Removed", (int)ini_buff.st_size);
 
                        if (g_remove(MM_PLAYER_INI_DEFAULT_PATH) == -1)
                                LOGE("failed to delete corrupted ini");
@@ -421,16 +422,15 @@ void __mm_player_ini_check_ini_status(void)
 }
 
 #ifdef MM_PLAYER_DEFAULT_INI
-static
-gboolean __generate_default_ini(void)
+static gboolean
+__generate_default_ini(void)
 {
-       FILEfp = NULL;
-       gchardefault_ini = MM_PLAYER_DEFAULT_INI;
+       FILE *fp = NULL;
+       gchar *default_ini = MM_PLAYER_DEFAULT_INI;
 
 
        /* create new file */
        fp = fopen(MM_PLAYER_INI_DEFAULT_PATH, "wt");
-
        if (!fp)
                return FALSE;
 
@@ -445,13 +445,13 @@ gboolean __generate_default_ini(void)
 }
 #endif
 
-static
-void __get_element_list(mm_player_ini_t* ini, gchar* str, int keyword_type)
+static void
+__get_element_list(mm_player_ini_t *ini, gchar *str, int keyword_type)
 {
-       gchar** list = NULL;
-       gchar** walk = NULL;
+       gchar **list = NULL;
+       gchar **walk = NULL;
        gint i = 0;
-       gcharstrtmp = NULL;
+       gchar *strtmp = NULL;
 
        if (!str)
                return;
@@ -469,10 +469,8 @@ void __get_element_list(mm_player_ini_t* ini, gchar* str, int keyword_type)
        list = g_strsplit(strtmp, ",", 10);
 
        if (!list) {
-               if (strtmp)
-                       g_free(strtmp);
-
-               return;
+               MMPLAYER_FREEIF(strtmp);
+       return;
        }
 
        /* copy list */
@@ -481,11 +479,8 @@ void __get_element_list(mm_player_ini_t* ini, gchar* str, int keyword_type)
        {
                for (walk = list; *walk; walk++) {
                        strncpy(ini->exclude_element_keyword[i], *walk, (PLAYER_INI_MAX_STRLEN - 1));
-
                        g_strstrip(ini->exclude_element_keyword[i]);
-
                        ini->exclude_element_keyword[i][PLAYER_INI_MAX_STRLEN -1] = '\0';
-
                        i++;
                }
                /* mark last item to NULL */
@@ -497,11 +492,8 @@ void __get_element_list(mm_player_ini_t* ini, gchar* str, int keyword_type)
        {
                for (walk = list; *walk; walk++) {
                        strncpy(ini->dump_element_keyword[i], *walk, (PLAYER_INI_MAX_STRLEN - 1));
-
                        g_strstrip(ini->dump_element_keyword[i]);
-
                        ini->dump_element_keyword[i][PLAYER_INI_MAX_STRLEN -1] = '\0';
-
                        i++;
                }
                /* mark last item to NULL */
@@ -513,11 +505,8 @@ void __get_element_list(mm_player_ini_t* ini, gchar* str, int keyword_type)
        {
                for (walk = list; *walk; walk++) {
                        strncpy(ini->unsupported_codec_keyword[i], *walk, (PLAYER_INI_MAX_STRLEN - 1));
-
                        g_strstrip(ini->unsupported_codec_keyword[i]);
-
                        ini->unsupported_codec_keyword[i][PLAYER_INI_MAX_STRLEN -1] = '\0';
-
                        i++;
                }
                /* mark last item to NULL */
@@ -528,11 +517,8 @@ void __get_element_list(mm_player_ini_t* ini, gchar* str, int keyword_type)
        {
                for (walk = list; *walk; walk++) {
                        strncpy(ini->videocodec_element_sw[i], *walk, (PLAYER_INI_MAX_STRLEN - 1));
-
                        g_strstrip(ini->videocodec_element_sw[i]);
-
                        ini->videocodec_element_sw[i][PLAYER_INI_MAX_STRLEN -1] = '\0';
-
                        i++;
                }
                /* mark last item to NULL */
@@ -543,11 +529,8 @@ void __get_element_list(mm_player_ini_t* ini, gchar* str, int keyword_type)
        {
                for (walk = list; *walk; walk++) {
                        strncpy(ini->audiocodec_element_sw[i], *walk, (PLAYER_INI_MAX_STRLEN - 1));
-
                        g_strstrip(ini->audiocodec_element_sw[i]);
-
                        ini->audiocodec_element_sw[i][PLAYER_INI_MAX_STRLEN -1] = '\0';
-
                        i++;
                }
                /* mark last item to NULL */
@@ -560,8 +543,7 @@ void __get_element_list(mm_player_ini_t* ini, gchar* str, int keyword_type)
        }
 
        g_strfreev(list);
-       if (strtmp)
-               g_free(strtmp);
+       MMPLAYER_FREEIF(strtmp);
 }
 
 #endif
index 86c8c29..ee65161 100644 (file)
@@ -129,71 +129,71 @@ static sound_stream_info_h stream_info;
 /*---------------------------------------------------------------------------
 |    LOCAL FUNCTION PROTOTYPES:                                                                                                |
 ---------------------------------------------------------------------------*/
-static int             __mmplayer_gst_create_pipeline(mm_player_tplayer);
-static int             __mmplayer_gst_destroy_pipeline(mm_player_tplayer);
-static int             __mmplayer_gst_create_text_pipeline(mm_player_tplayer);
-static int             __mmplayer_gst_create_video_sink_bin(mm_player_tplayer, GstCaps *caps, MMDisplaySurfaceType surface_type);
-static int             __mmplayer_gst_create_audio_sink_bin(mm_player_tplayer);
-static int             __mmplayer_gst_create_text_sink_bin(mm_player_tplayer);
-
-static GstPadProbeReturn       __mmplayer_gst_selector_blocked(GstPadpad, GstPadProbeInfo *info, gpointer data);
-static void            __mmplayer_gst_decode_no_more_pads(GstElementelem, gpointer data);
+static int             __mmplayer_gst_create_pipeline(mm_player_t *player);
+static int             __mmplayer_gst_destroy_pipeline(mm_player_t *player);
+static int             __mmplayer_gst_create_text_pipeline(mm_player_t *player);
+static int             __mmplayer_gst_create_video_sink_bin(mm_player_t *player, GstCaps *caps, MMDisplaySurfaceType surface_type);
+static int             __mmplayer_gst_create_audio_sink_bin(mm_player_t *player);
+static int             __mmplayer_gst_create_text_sink_bin(mm_player_t *player);
+
+static GstPadProbeReturn       __mmplayer_gst_selector_blocked(GstPad *pad, GstPadProbeInfo *info, gpointer data);
+static void            __mmplayer_gst_decode_no_more_pads(GstElement *elem, gpointer data);
 static void            __mmplayer_gst_create_sinkbin(GstElement *decodebin, GstPad *pad, gpointer data);
-static void            __mmplayer_gst_decode_unknown_type(GstElement *elem,  GstPadpad, GstCaps *caps, gpointer data);
-static gboolean __mmplayer_gst_decode_autoplug_continue(GstElement *bin,  GstPad* pad, GstCaps * caps,  gpointer data);
-static void __mmplayer_gst_decode_pad_removed(GstElement *elem,  GstPadnew_pad, gpointer data);
+static void            __mmplayer_gst_decode_unknown_type(GstElement *elem,  GstPad *pad, GstCaps *caps, gpointer data);
+static gboolean __mmplayer_gst_decode_autoplug_continue(GstElement *bin,  GstPad *pad, GstCaps *caps,  gpointer data);
+static void __mmplayer_gst_decode_pad_removed(GstElement *elem,  GstPad *new_pad, gpointer data);
 static void __mmplayer_gst_decode_drained(GstElement *bin, gpointer data);
 static void    __mmplayer_pipeline_complete(GstElement *decodebin,  gpointer data);
-static gboolean __mmplayer_is_midi_type(gcharstr_caps);
+static gboolean __mmplayer_is_midi_type(gchar *str_caps);
 static gboolean __mmplayer_is_only_mp3_type(gchar *str_caps);
-static void    __mmplayer_set_audio_attrs(mm_player_t* player, GstCaps* caps);
-
-static gboolean        __mmplayer_update_subtitle(GstElementobject, GstBuffer *buffer, GstPad *pad, gpointer data);
-static void            __mmplayer_release_misc(mm_player_tplayer);
-static void            __mmplayer_release_misc_post(mm_player_tplayer);
-static gboolean        __mmplayer_init_gstreamer(mm_player_tplayer);
-static void __mmplayer_video_stream_decoded_preroll_cb(GstElementobject, GstBuffer *buffer, GstPad *pad, gpointer data);
-static void __mmplayer_video_stream_decoded_render_cb(GstElementobject, GstBuffer *buffer, GstPad *pad, gpointer data);
+static void    __mmplayer_set_audio_attrs(mm_player_t *player, GstCaps *caps);
+
+static gboolean        __mmplayer_update_subtitle(GstElement *object, GstBuffer *buffer, GstPad *pad, gpointer data);
+static void            __mmplayer_release_misc(mm_player_t *player);
+static void            __mmplayer_release_misc_post(mm_player_t *player);
+static gboolean        __mmplayer_init_gstreamer(mm_player_t *player);
+static void __mmplayer_video_stream_decoded_preroll_cb(GstElement *object, GstBuffer *buffer, GstPad *pad, gpointer data);
+static void __mmplayer_video_stream_decoded_render_cb(GstElement *object, GstBuffer *buffer, GstPad *pad, gpointer data);
 static GstPadProbeReturn __mmplayer_subtitle_adjust_position_probe(GstPad *pad, GstPadProbeInfo *info, gpointer u_data);
-static int __mmplayer_change_selector_pad(mm_player_tplayer, MMPlayerTrackType type, int index);
-
-static gboolean __mmplayer_check_subtitle(mm_player_tplayer);
-static int             __mmplayer_handle_missed_plugin(mm_player_tplayer);
-static int             __mmplayer_check_not_supported_codec(mm_player_t* player, const gchar* factory_class, const gchar* mime);
-static void            __mmplayer_add_sink(mm_player_t* player, GstElement* sink);
-static void            __mmplayer_del_sink(mm_player_t* player, GstElement* sink);
-static void            __mmplayer_release_signal_connection(mm_player_tplayer, MMPlayerSignalType type);
+static int __mmplayer_change_selector_pad(mm_player_t *player, MMPlayerTrackType type, int index);
+
+static gboolean __mmplayer_check_subtitle(mm_player_t *player);
+static int             __mmplayer_handle_missed_plugin(mm_player_t *player);
+static int             __mmplayer_check_not_supported_codec(mm_player_t *player, const gchar *factory_class, const gchar *mime);
+static void            __mmplayer_add_sink(mm_player_t *player, GstElement *sink);
+static void            __mmplayer_del_sink(mm_player_t *player, GstElement *sink);
+static void            __mmplayer_release_signal_connection(mm_player_t *player, MMPlayerSignalType type);
 static gpointer __mmplayer_gapless_play_thread(gpointer data);
 static gboolean __mmplayer_add_dump_buffer_probe(mm_player_t *player, GstElement *element);
 static GstPadProbeReturn __mmplayer_dump_buffer_probe_cb(GstPad *pad,  GstPadProbeInfo *info, gpointer u_data);
 static void __mmplayer_release_dump_list(GList *dump_list);
-static int             __mmplayer_gst_realize(mm_player_tplayer);
-static int             __mmplayer_gst_unrealize(mm_player_tplayer);
-static int             __mmplayer_gst_adjust_subtitle_position(mm_player_tplayer, int format, int position);
-static int             __mmplayer_gst_set_message_callback(mm_player_tplayer, MMMessageCallback callback, gpointer user_param);
+static int             __mmplayer_gst_realize(mm_player_t *player);
+static int             __mmplayer_gst_unrealize(mm_player_t *player);
+static int             __mmplayer_gst_adjust_subtitle_position(mm_player_t *player, int format, int position);
+static int             __mmplayer_gst_set_message_callback(mm_player_t *player, MMMessageCallback callback, gpointer user_param);
 
 /* util */
 static gboolean __mmplayer_verify_gapless_play_path(mm_player_t *player);
 static void __mmplayer_activate_next_source(mm_player_t *player, GstState target);
-static void __mmplayer_check_pipeline(mm_player_tplayer);
+static void __mmplayer_check_pipeline(mm_player_t *player);
 static gboolean __mmplayer_deactivate_selector(mm_player_t *player, MMPlayerTrackType type);
 static void __mmplayer_deactivate_old_path(mm_player_t *player);
-static int __mmplayer_gst_create_plain_text_elements(mm_player_tplayer);
-static guint32 _mmplayer_convert_fourcc_string_to_value(const gcharformat_name);
-static void            __mmplayer_gst_caps_notify_cb(GstPad * pad, GParamSpec * unused, gpointer data);
-static void            __mmplayer_audio_stream_send_data(mm_player_tplayer, mm_player_audio_stream_buff_t *a_buffer);
-static void            __mmplayer_initialize_storage_info(mm_player_tplayer, MMPlayerPathType path_type);
+static int __mmplayer_gst_create_plain_text_elements(mm_player_t *player);
+static guint32 _mmplayer_convert_fourcc_string_to_value(const gchar *format_name);
+static void            __mmplayer_gst_caps_notify_cb(GstPad *pad, GParamSpec *unused, gpointer data);
+static void            __mmplayer_audio_stream_send_data(mm_player_t *player, mm_player_audio_stream_buff_t *a_buffer);
+static void            __mmplayer_initialize_storage_info(mm_player_t *player, MMPlayerPathType path_type);
 static int             __resource_release_cb(mm_resource_manager_h rm, mm_resource_manager_res_h res, void *user_data);
 static gboolean __mmplayer_update_duration_attrs(mm_player_t *player, MMHandleType attrs);
 static gboolean __mmplayer_update_audio_attrs(mm_player_t *player, MMHandleType attrs);
 static gboolean __mmplayer_update_video_attrs(mm_player_t *player, MMHandleType attrs);
 static gboolean __mmplayer_update_bitrate_attrs(mm_player_t *player, MMHandleType attrs);
 
-static void __mmplayer_copy_uri_and_set_type(MMPlayerParseProfiledata, const char *uri, int uri_type);
-static int __mmplayer_set_mem_uri(MMPlayerParseProfiledata, char *path, void *param);
-static int __mmplayer_set_file_uri(MMPlayerParseProfiledata, const char *uri);
+static void __mmplayer_copy_uri_and_set_type(MMPlayerParseProfile *data, const char *uri, int uri_type);
+static int __mmplayer_set_mem_uri(MMPlayerParseProfile *data, char *path, void *param);
+static int __mmplayer_set_file_uri(MMPlayerParseProfile *data, const char *uri);
 
-static MMPlayerVideoStreamDataType__mmplayer_create_stream_from_pad(GstPad *pad);
+static MMPlayerVideoStreamDataType *__mmplayer_create_stream_from_pad(GstPad *pad);
 static void __mmplayer_zerocopy_set_stride_elevation_bo(MMPlayerVideoStreamDataType *stream, GstMemory *mem);
 static gboolean __mmplayer_swcodec_set_stride_elevation(MMPlayerVideoStreamDataType *stream);
 static gboolean __mmplayer_swcodec_set_bo(mm_player_t *player, MMPlayerVideoStreamDataType *stream, GstMemory *mem);
@@ -208,7 +208,7 @@ static void __mmplayer_set_playing_state(mm_player_t *player);
 
 #if 0 //debug
 static void
-print_tag(const GstTagList * list, const gchar * tag, gpointer unused)
+print_tag(const GstTagList *list, const gchar *tag, gpointer unused)
 {
        gint i, count;
 
@@ -222,13 +222,14 @@ print_tag(const GstTagList * list, const gchar * tag, gpointer unused)
                if (gst_tag_get_type(tag) == G_TYPE_STRING) {
                        if (!gst_tag_list_get_string_index(list, tag, i, &str))
                                g_assert_not_reached();
-               } else
+               } else {
                        str = g_strdup_value_contents(gst_tag_list_get_value_index(list, tag, i));
+               }
 
                if (i == 0)
-                       g_print("  %15s: %s\n", gst_tag_get_nick(tag), str);
+                       g_print("  %15s: %s", gst_tag_get_nick(tag), str);
                else
-                       g_print("                 : %s\n", str);
+                       g_print("                 : %s", str);
 
                g_free(str);
        }
@@ -238,7 +239,7 @@ print_tag(const GstTagList * list, const gchar * tag, gpointer unused)
 /* This function should be called after the pipeline goes PAUSED or higher
 state. */
 gboolean
-__mmplayer_update_content_attrs(mm_player_tplayer, enum content_attr_flag flag)
+__mmplayer_update_content_attrs(mm_player_t *player, enum content_attr_flag flag)
 {
        static gboolean has_duration = FALSE;
        static gboolean has_video_attrs = FALSE;
@@ -302,7 +303,7 @@ __mmplayer_update_content_attrs(mm_player_t* player, enum content_attr_flag flag
 
        /* validate all */
        if (mm_attrs_commit_all(attrs)) {
-               LOGE("failed to update attributes\n");
+               LOGE("failed to update attributes");
                return FALSE;
        }
 
@@ -311,7 +312,8 @@ __mmplayer_update_content_attrs(mm_player_t* player, enum content_attr_flag flag
        return TRUE;
 }
 
-MMStreamingType __mmplayer_get_stream_service_type(mm_player_t* player)
+MMStreamingType
+__mmplayer_get_stream_service_type(mm_player_t *player)
 {
        MMStreamingType streaming_type = STREAMING_SERVICE_NONE;
 
@@ -347,7 +349,6 @@ MMStreamingType __mmplayer_get_stream_service_type(mm_player_t* player)
        return streaming_type;
 }
 
-
 /* this function sets the player state and also report
  * it to applicaton by calling callback function
  */
@@ -359,7 +360,7 @@ __mmplayer_set_state(mm_player_t *player, int state)
        MMPLAYER_RETURN_IF_FAIL(player);
 
        if (MMPLAYER_CURRENT_STATE(player) == state) {
-               LOGW("already same state(%s)\n", MMPLAYER_STATE_GET_NAME(state));
+               LOGW("already same state(%s)", MMPLAYER_STATE_GET_NAME(state));
                MMPLAYER_PENDING_STATE(player) = MM_PLAYER_STATE_NONE;
                return;
        }
@@ -386,7 +387,7 @@ __mmplayer_set_state(mm_player_t *player, int state)
                break;
        case MM_PLAYER_STATE_NONE:
        default:
-               LOGW("invalid target state, there is nothing to do.\n");
+               LOGW("invalid target state, there is nothing to do.");
                break;
        }
 
@@ -401,13 +402,13 @@ __mmplayer_set_state(mm_player_t *player, int state)
                LOGD("player reach the target state (%s)", MMPLAYER_STATE_GET_NAME(MMPLAYER_TARGET_STATE(player)));
 
                /* state changed by resource callback */
-               if (player->interrupted_by_resource) {
+               if (player->interrupted_by_resource)
                        MMPLAYER_POST_MSG(player, MM_MESSAGE_STATE_INTERRUPTED, &msg);
-               } else { /* state changed by usecase */
+               else /* state changed by usecase */
                        MMPLAYER_POST_MSG(player, MM_MESSAGE_STATE_CHANGED, &msg);
-               }
+
        } else {
-               LOGD("intermediate state, do nothing.\n");
+               LOGD("intermediate state, do nothing.");
                MMPLAYER_PRINT_STATE(player);
                return;
        }
@@ -422,14 +423,14 @@ __mmplayer_set_state(mm_player_t *player, int state)
 }
 
 int
-__mmplayer_check_state(mm_player_tplayer, enum PlayerCommandState command)
+__mmplayer_check_state(mm_player_t *player, enum PlayerCommandState command)
 {
        MMPlayerStateType current_state = MM_PLAYER_STATE_NUM;
        MMPlayerStateType pending_state = MM_PLAYER_STATE_NUM;
 
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
 
-       //LOGD("incomming command : %d \n", command);
+       //LOGD("incomming command : %d ", command);
 
        current_state = MMPLAYER_CURRENT_STATE(player);
        pending_state = MMPLAYER_PENDING_STATE(player);
@@ -497,8 +498,9 @@ __mmplayer_check_state(mm_player_t* player, enum PlayerCommandState command)
                        goto ALREADY_GOING;
                } else if (pending_state == MM_PLAYER_STATE_PAUSED) {
                        LOGD("player is going to paused state, just change the pending state as playing");
-               } else
+               } else {
                        goto INVALID_STATE;
+               }
        }
        break;
 
@@ -558,8 +560,9 @@ __mmplayer_check_state(mm_player_t* player, enum PlayerCommandState command)
                        goto ALREADY_GOING;
                } else if (pending_state == MM_PLAYER_STATE_PAUSED) {
                        LOGD("player is going to paused state, just change the pending state as playing");
-               } else
+               } else {
                        goto INVALID_STATE;
+               }
        }
                break;
 
@@ -588,26 +591,27 @@ ALREADY_GOING:
        return MM_ERROR_PLAYER_NO_OP;
 }
 
-static gpointer __mmplayer_gapless_play_thread(gpointer data)
+static gpointer
+__mmplayer_gapless_play_thread(gpointer data)
 {
-       mm_player_t* player = (mm_player_t*) data;
+       mm_player_t *player = (mm_player_t *)data;
        MMPlayerGstElement *mainbin = NULL;
 
        MMPLAYER_RETURN_VAL_IF_FAIL(player, NULL);
 
        MMPLAYER_GAPLESS_PLAY_THREAD_LOCK(player);
        while (!player->gapless_play_thread_exit) {
-               LOGD("gapless play thread started. waiting for signal.\n");
+               LOGD("gapless play thread started. waiting for signal.");
                MMPLAYER_GAPLESS_PLAY_THREAD_WAIT(player);
 
-               LOGD("reconfigure pipeline for gapless play.\n");
+               LOGD("reconfigure pipeline for gapless play.");
 
                if (player->gapless_play_thread_exit) {
                        if (player->gapless.reconfigure) {
                                player->gapless.reconfigure = false;
                                MMPLAYER_PLAYBACK_UNLOCK(player);
                        }
-                       LOGD("exiting gapless play thread\n");
+                       LOGD("exiting gapless play thread");
                        break;
                }
 
@@ -634,7 +638,6 @@ __mmplayer_remove_g_source_from_context(GMainContext *context, guint source_id)
        MMPLAYER_FENTER();
 
        source = g_main_context_find_source_by_id(context, source_id);
-
        if (source != NULL) {
                LOGW("context: %p, source id: %d, source: %p", context, source_id, source);
                g_source_destroy(source);
@@ -643,9 +646,10 @@ __mmplayer_remove_g_source_from_context(GMainContext *context, guint source_id)
        MMPLAYER_FLEAVE();
 }
 
-void __mmplayer_bus_msg_thread_destroy(MMHandleType hplayer)
+void
+__mmplayer_bus_msg_thread_destroy(MMHandleType hplayer)
 {
-       mm_player_t* player = (mm_player_t*)hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
        GstMessage *msg = NULL;
        GQueue *queue = NULL;
 
@@ -689,9 +693,9 @@ void __mmplayer_bus_msg_thread_destroy(MMHandleType hplayer)
 }
 
 gboolean
-__mmplayer_gst_remove_fakesink(mm_player_t* player, MMPlayerGstElement* fakesink)
+__mmplayer_gst_remove_fakesink(mm_player_t *player, MMPlayerGstElement *fakesink)
 {
-       GstElementparent = NULL;
+       GstElement *parent = NULL;
 
        MMPLAYER_RETURN_VAL_IF_FAIL(player && player->pipeline, FALSE);
 
@@ -706,9 +710,9 @@ __mmplayer_gst_remove_fakesink(mm_player_t* player, MMPlayerGstElement* fakesink
                goto ERROR;
 
        /* get parent of fakesink */
-       parent = (GstElement*)gst_object_get_parent((GstObject*)fakesink->gst);
+       parent = (GstElement *)gst_object_get_parent((GstObject *)fakesink->gst);
        if (!parent) {
-               LOGD("fakesink already removed\n");
+               LOGD("fakesink already removed");
                goto ERROR;
        }
 
@@ -718,13 +722,13 @@ __mmplayer_gst_remove_fakesink(mm_player_t* player, MMPlayerGstElement* fakesink
         * so no need to wait for completion of state transiton
         */
        if (GST_STATE_CHANGE_FAILURE == gst_element_set_state(fakesink->gst, GST_STATE_NULL))
-               LOGE("fakesink state change failure!\n");
+               LOGE("fakesink state change failure!");
                /* FIXIT : should I return here? or try to proceed to next? */
                /* return FALSE; */
 
        /* remove fakesink from it's parent */
        if (!gst_bin_remove(GST_BIN(parent), fakesink->gst)) {
-               LOGE("failed to remove fakesink\n");
+               LOGE("failed to remove fakesink");
 
                gst_object_unref(parent);
 
@@ -733,7 +737,7 @@ __mmplayer_gst_remove_fakesink(mm_player_t* player, MMPlayerGstElement* fakesink
 
        gst_object_unref(parent);
 
-       LOGD("state-holder removed\n");
+       LOGD("state-holder removed");
 
        gst_element_set_locked_state(fakesink->gst, FALSE);
 
@@ -749,14 +753,14 @@ ERROR:
 }
 
 static GstPadProbeReturn
-__mmplayer_gst_selector_blocked(GstPadpad, GstPadProbeInfo *info, gpointer data)
+__mmplayer_gst_selector_blocked(GstPad *pad, GstPadProbeInfo *info, gpointer data)
 {
        LOGD("pad(%s:%s) is blocked", GST_DEBUG_PAD_NAME(pad));
        return GST_PAD_PROBE_OK;
 }
 
 static void
-__mmplayer_gst_selector_update_start_time(mm_player_tplayer, MMPlayerTrackType stream_type)
+__mmplayer_gst_selector_update_start_time(mm_player_t *player, MMPlayerTrackType stream_type)
 {
        gint64 stop_running_time = 0;
        gint64 position_running_time = 0;
@@ -820,7 +824,7 @@ __mmplayer_gst_selector_event_probe(GstPad *pad, GstPadProbeInfo *info, gpointer
 {
        GstPadProbeReturn ret = GST_PAD_PROBE_OK;
        GstEvent *event = GST_PAD_PROBE_INFO_DATA(info);
-       mm_player_t *player = (mm_player_t*)data;
+       mm_player_t *player = (mm_player_t *)data;
        GstCaps *caps = NULL;
        GstStructure *str = NULL;
        const gchar *name = NULL;
@@ -1019,7 +1023,7 @@ EXIT:
        return;
 }
 
-static GstElement*
+static GstElement *
 __mmplayer_gst_make_selector(mm_player_t *player, enum MainElementID elem_idx, MMPlayerTrackType stream_type)
 {
        GstElement *pipeline = NULL;
@@ -1061,7 +1065,7 @@ __mmplayer_gst_make_selector(mm_player_t *player, enum MainElementID elem_idx, M
 void
 __mmplayer_gst_decode_pad_added(GstElement *elem, GstPad *pad, gpointer data)
 {
-       mm_player_t *player = NULL;
+       mm_player_t *player = (mm_player_t *)data;
        GstElement *selector = NULL;
        GstCaps *caps = NULL;
        GstStructure *str = NULL;
@@ -1073,9 +1077,6 @@ __mmplayer_gst_decode_pad_added(GstElement *elem, GstPad *pad, gpointer data)
        enum MainElementID elem_idx = MMPLAYER_M_NUM;
        MMPlayerTrackType stream_type = MM_PLAYER_TRACK_TYPE_AUDIO;
 
-       /* check handles */
-       player = (mm_player_t*)data;
-
        MMPLAYER_FENTER();
        MMPLAYER_RETURN_IF_FAIL(elem && pad);
        MMPLAYER_RETURN_IF_FAIL(player && player->pipeline && player->pipeline->mainbin);
@@ -1097,7 +1098,7 @@ __mmplayer_gst_decode_pad_added(GstElement *elem, GstPad *pad, gpointer data)
                caps_str = gst_caps_to_string(caps);
                if (caps_str && (strstr(caps_str, "ST12") || strstr(caps_str, "SN12") ||
                        strstr(caps_str, "SN21") || strstr(caps_str, "S420") || strstr(caps_str, "SR32")))
-                       player->set_mode.video_zc = TRUE;
+                       player->set_mode.video_zc = true;
 
                MMPLAYER_FREEIF(caps_str);
 
@@ -1193,9 +1194,10 @@ ERROR:
        return;
 }
 
-static gboolean __mmplayer_create_sink_path(mm_player_t* player, GstElement* selector, MMPlayerTrackType type)
+static gboolean
+__mmplayer_create_sink_path(mm_player_t *player, GstElement *selector, MMPlayerTrackType type)
 {
-       GstPadsrcpad = NULL;
+       GstPad *srcpad = NULL;
 
        MMPLAYER_FENTER();
        MMPLAYER_RETURN_VAL_IF_FAIL(player && player->pipeline, FALSE);
@@ -1232,7 +1234,8 @@ static gboolean __mmplayer_create_sink_path(mm_player_t* player, GstElement* sel
        return TRUE;
 }
 
-static void __mmplayer_set_decode_track_info(mm_player_t* player, MMPlayerTrackType type)
+static void
+__mmplayer_set_decode_track_info(mm_player_t *player, MMPlayerTrackType type)
 {
        MMHandleType attrs = 0;
        gint active_index = 0;
@@ -1268,7 +1271,8 @@ static void __mmplayer_set_decode_track_info(mm_player_t* player, MMPlayerTrackT
        return;
 }
 
-static gboolean __mmplayer_create_audio_sink_path(mm_player_t* player, GstElement* audio_selector)
+static gboolean
+__mmplayer_create_audio_sink_path(mm_player_t *player, GstElement *audio_selector)
 {
        MMPLAYER_FENTER();
        MMPLAYER_RETURN_VAL_IF_FAIL(player && player->pipeline, FALSE);
@@ -1306,7 +1310,8 @@ static gboolean __mmplayer_create_audio_sink_path(mm_player_t* player, GstElemen
        return TRUE;
 }
 
-static gboolean __mmplayer_create_text_sink_path(mm_player_t* player, GstElement* text_selector)
+static gboolean
+__mmplayer_create_text_sink_path(mm_player_t *player, GstElement *text_selector)
 {
        MMPLAYER_FENTER();
        MMPLAYER_RETURN_VAL_IF_FAIL(player && text_selector, FALSE);
@@ -1337,7 +1342,7 @@ static gboolean __mmplayer_create_text_sink_path(mm_player_t* player, GstElement
 static gboolean
 __mmplayer_gst_set_queue2_buffering(mm_player_t *player)
 {
-#define ESTIMATED_BUFFER_UNIT (1*1024*1024)
+#define ESTIMATED_BUFFER_UNIT (1 * 1024 * 1024)
 
        gint init_buffering_time = 0;
        guint buffer_bytes = 0;
@@ -1348,12 +1353,12 @@ __mmplayer_gst_set_queue2_buffering(mm_player_t *player)
                player->pipeline->mainbin && player->streamer, FALSE);
 
        init_buffering_time = player->streamer->buffering_req.prebuffer_time;
-       buffer_bytes = (guint)(init_buffering_time/1000) * ESTIMATED_BUFFER_UNIT;
+       buffer_bytes = (guint)(init_buffering_time / 1000) * ESTIMATED_BUFFER_UNIT;
 
        buffer_bytes = MAX(buffer_bytes, player->streamer->buffer_handle[BUFFER_TYPE_MUXED].buffering_bytes);
        LOGD("pre buffer time: %d ms, buffer size : %d", init_buffering_time, buffer_bytes);
 
-       init_buffering_time = (init_buffering_time != 0) ? (init_buffering_time) : (player->ini.http_buffering_time);
+       init_buffering_time = (init_buffering_time != 0) ? init_buffering_time : player->ini.http_buffering_time;
 
        if (!gst_element_query_duration(player->pipeline->mainbin[MMPLAYER_M_SRC].gst, GST_FORMAT_BYTES, &dur_bytes))
                LOGE("fail to get duration.");
@@ -1382,7 +1387,7 @@ __mmplayer_gst_decode_no_more_pads(GstElement *elem, gpointer data)
        GstElement *text_selector = NULL;
 
        MMPLAYER_FENTER();
-       player = (mm_player_t*) data;
+       player = (mm_player_t *)data;
 
        LOGD("no-more-pad signal handling");
 
@@ -1492,6 +1497,7 @@ EXIT:
        MMPLAYER_FLEAVE();
        return ret;
 }
+
 static void
 __mmplayer_gst_create_sinkbin(GstElement *elem, GstPad *pad, gpointer data)
 {
@@ -1507,7 +1513,7 @@ __mmplayer_gst_create_sinkbin(GstElement *elem, GstPad *pad, gpointer data)
        gchar *sink_pad_name = "sink";
 
        /* check handles */
-       player = (mm_player_t*) data;
+       player = (mm_player_t *)data;
 
        MMPLAYER_FENTER();
        MMPLAYER_RETURN_IF_FAIL(elem && pad);
@@ -1637,7 +1643,7 @@ ERROR:
 }
 
 static gboolean
-__mmplayer_get_property_value_for_rotation(mm_player_tplayer, int display_angle, int orientation, int *value)
+__mmplayer_get_property_value_for_rotation(mm_player_t *player, int display_angle, int orientation, int *value)
 {
        int required_angle = 0; /* Angle required for straight view */
        int rotation_angle = 0;
@@ -1692,7 +1698,7 @@ __mmplayer_get_property_value_for_rotation(mm_player_t* player, int display_angl
 }
 
 int
-__mmplayer_video_param_check_video_sink_bin(mm_player_tplayer)
+__mmplayer_video_param_check_video_sink_bin(mm_player_t *player)
 {
        /* check video sinkbin is created */
        MMPLAYER_RETURN_VAL_IF_FAIL(player &&
@@ -1706,7 +1712,7 @@ __mmplayer_video_param_check_video_sink_bin(mm_player_t* player)
 }
 
 int
-__mmplayer_get_video_angle(mm_player_tplayer, int *display_angle, int *orientation)
+__mmplayer_get_video_angle(mm_player_t *player, int *display_angle, int *orientation)
 {
        int display_rotation = 0;
        gchar *org_orient = NULL;
@@ -1766,7 +1772,7 @@ __mmplayer_get_video_angle(mm_player_t* player, int *display_angle, int *orienta
 }
 
 void
-__mmplayer_video_param_set_display_rotation(mm_player_tplayer)
+__mmplayer_video_param_set_display_rotation(mm_player_t *player)
 {
        int rotation_value = 0;
        int orientations = 0; // current supported angle values are 0, 90, 180, 270
@@ -1786,7 +1792,7 @@ __mmplayer_video_param_set_display_rotation(mm_player_t* player)
 }
 
 void
-__mmplayer_video_param_set_display_visible(mm_player_tplayer)
+__mmplayer_video_param_set_display_visible(mm_player_t *player)
 {
        MMHandleType attrs = 0;
        int visible = 0;
@@ -1805,7 +1811,7 @@ __mmplayer_video_param_set_display_visible(mm_player_t* player)
 }
 
 void
-__mmplayer_video_param_set_display_method(mm_player_tplayer)
+__mmplayer_video_param_set_display_method(mm_player_t *player)
 {
        MMHandleType attrs = 0;
        int display_method = 0;
@@ -1822,8 +1828,9 @@ __mmplayer_video_param_set_display_method(mm_player_t* player)
        g_object_set(player->pipeline->videobin[MMPLAYER_V_SINK].gst, "display-geometry-method", display_method, NULL);
        LOGD("set video param : method %d", display_method);
 }
+
 void
-__mmplayer_video_param_set_video_roi_area(mm_player_tplayer)
+__mmplayer_video_param_set_video_roi_area(mm_player_t *player)
 {
        MMHandleType attrs = 0;
        void *handle = NULL;
@@ -1848,7 +1855,7 @@ __mmplayer_video_param_set_video_roi_area(mm_player_t* player)
 }
 
 void
-__mmplayer_video_param_set_roi_area(mm_player_tplayer)
+__mmplayer_video_param_set_roi_area(mm_player_t *player)
 {
        MMHandleType attrs = 0;
        void *handle = NULL;
@@ -1885,8 +1892,9 @@ __mmplayer_video_param_set_roi_area(mm_player_t* player)
                        win_roi_x, win_roi_y, win_roi_width, win_roi_height);
        }
 }
+
 void
-__mmplayer_video_param_set_display_overlay(mm_player_tplayer)
+__mmplayer_video_param_set_display_overlay(mm_player_t *player)
 {
        MMHandleType attrs = 0;
        void *handle = NULL;
@@ -1904,21 +1912,21 @@ __mmplayer_video_param_set_display_overlay(mm_player_t* player)
        if (handle) {
                /* default is using wl_surface_id */
                unsigned int wl_surface_id      = 0;
-               wl_surface_id = *(int*)handle;
+               wl_surface_id = *(int *)handle;
                LOGD("set video param : wl_surface_id %d", wl_surface_id);
                gst_video_overlay_set_wl_window_wl_surface_id(
                                GST_VIDEO_OVERLAY(player->pipeline->videobin[MMPLAYER_V_SINK].gst),
-                               *(int*)handle);
-       } else
+                               *(int *)handle);
+       } else {
                /* FIXIT : is it error case? */
                LOGW("still we don't have a window handle on player attribute. create it's own surface.");
+       }
 }
 
-
 int
-__mmplayer_update_wayland_videosink_video_param(mm_player_tplayer, char *param_name)
+__mmplayer_update_wayland_videosink_video_param(mm_player_t *player, char *param_name)
 {
-       bool update_all_param = FALSE;
+       gboolean update_all_param = FALSE;
        MMPLAYER_FENTER();
 
        /* check video sinkbin is created */
@@ -1951,7 +1959,7 @@ __mmplayer_update_wayland_videosink_video_param(mm_player_t* player, char *param
 }
 
 int
-_mmplayer_update_video_param(mm_player_tplayer, char *param_name)
+_mmplayer_update_video_param(mm_player_t *player, char *param_name)
 {
        MMHandleType attrs = 0;
        int surface_type = 0;
@@ -1994,7 +2002,7 @@ int
 _mmplayer_set_audio_only(MMHandleType hplayer, bool audio_only)
 {
        gboolean disable_overlay = FALSE;
-       mm_player_t* player = (mm_player_t*) hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
        int ret = MM_ERROR_NONE;
 
        MMPLAYER_FENTER();
@@ -2024,7 +2032,7 @@ _mmplayer_set_audio_only(MMHandleType hplayer, bool audio_only)
                        ret = mm_resource_manager_mark_for_release(player->resource_manager,
                                        player->video_overlay_resource);
                        if (ret != MM_RESOURCE_MANAGER_ERROR_NONE) {
-                               LOGE("failed to mark overlay resource for release, ret(0x%x)\n", ret);
+                               LOGE("failed to mark overlay resource for release, ret(0x%x)", ret);
                                goto ERROR;
                        }
                        player->video_overlay_resource = NULL;
@@ -2032,7 +2040,7 @@ _mmplayer_set_audio_only(MMHandleType hplayer, bool audio_only)
 
                ret = mm_resource_manager_commit(player->resource_manager);
                if (ret != MM_RESOURCE_MANAGER_ERROR_NONE) {
-                       LOGE("failed to commit acquiring of overlay resource, ret(0x%x)\n", ret);
+                       LOGE("failed to commit acquiring of overlay resource, ret(0x%x)", ret);
                        goto ERROR;
                }
        } else {
@@ -2043,7 +2051,7 @@ _mmplayer_set_audio_only(MMHandleType hplayer, bool audio_only)
                                        MM_RESOURCE_MANAGER_RES_VOLUME_FULL,
                                        &player->video_overlay_resource);
                        if (ret != MM_RESOURCE_MANAGER_ERROR_NONE) {
-                               LOGE("could not prepare for video_overlay resource\n");
+                               LOGE("could not prepare for video_overlay resource");
                                goto ERROR;
                        }
                }
@@ -2052,7 +2060,7 @@ _mmplayer_set_audio_only(MMHandleType hplayer, bool audio_only)
                /* acquire resources for video overlay */
                ret = mm_resource_manager_commit(player->resource_manager);
                if (ret != MM_RESOURCE_MANAGER_ERROR_NONE) {
-                       LOGE("could not acquire resources for video playing\n");
+                       LOGE("could not acquire resources for video playing");
                        goto ERROR;
                }
 
@@ -2069,7 +2077,7 @@ ERROR:
 int
 _mmplayer_get_audio_only(MMHandleType hplayer, bool *paudio_only)
 {
-       mm_player_t* player = (mm_player_t*) hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
        gboolean disable_overlay = FALSE;
 
        MMPLAYER_FENTER();
@@ -2087,7 +2095,7 @@ _mmplayer_get_audio_only(MMHandleType hplayer, bool *paudio_only)
 
        g_object_get(player->pipeline->videobin[MMPLAYER_V_SINK].gst, "disable-overlay", &disable_overlay, NULL);
 
-       *paudio_only = (bool)(disable_overlay);
+       *paudio_only = (bool)disable_overlay;
 
        LOGD("audio_only : %d", *paudio_only);
 
@@ -2097,32 +2105,32 @@ _mmplayer_get_audio_only(MMHandleType hplayer, bool *paudio_only)
 }
 
 int
-__mmplayer_gst_element_link_bucket(GListelement_bucket)
+__mmplayer_gst_element_link_bucket(GList *element_bucket)
 {
-       GListbucket = element_bucket;
-       MMPlayerGstElementelement = NULL;
-       MMPlayerGstElementprv_element = NULL;
+       GList *bucket = element_bucket;
+       MMPlayerGstElement *element = NULL;
+       MMPlayerGstElement *prv_element = NULL;
        gint successful_link_count = 0;
 
        MMPLAYER_FENTER();
 
        MMPLAYER_RETURN_VAL_IF_FAIL(element_bucket, -1);
 
-       prv_element = (MMPlayerGstElement*)bucket->data;
+       prv_element = (MMPlayerGstElement *)bucket->data;
        bucket = bucket->next;
 
        for (; bucket; bucket = bucket->next) {
-               element = (MMPlayerGstElement*)bucket->data;
+               element = (MMPlayerGstElement *)bucket->data;
 
                if (element && element->gst) {
                        if (prv_element && prv_element->gst) {
                                if (gst_element_link(GST_ELEMENT(prv_element->gst), GST_ELEMENT(element->gst))) {
-                                       LOGD("linking [%s] to [%s] success\n",
+                                       LOGD("linking [%s] to [%s] success",
                                                GST_ELEMENT_NAME(GST_ELEMENT(prv_element->gst)),
                                                GST_ELEMENT_NAME(GST_ELEMENT(element->gst)));
                                        successful_link_count++;
                                } else {
-                                       LOGD("linking [%s] to [%s] failed\n",
+                                       LOGD("linking [%s] to [%s] failed",
                                                GST_ELEMENT_NAME(GST_ELEMENT(prv_element->gst)),
                                                GST_ELEMENT_NAME(GST_ELEMENT(element->gst)));
                                        return -1;
@@ -2139,10 +2147,10 @@ __mmplayer_gst_element_link_bucket(GList* element_bucket)
 }
 
 int
-__mmplayer_gst_element_add_bucket_to_bin(GstBin* bin, GList* element_bucket)
+__mmplayer_gst_element_add_bucket_to_bin(GstBin *bin, GList *element_bucket)
 {
-       GListbucket = element_bucket;
-       MMPlayerGstElementelement = NULL;
+       GList *bucket = element_bucket;
+       MMPlayerGstElement *element = NULL;
        int successful_add_count = 0;
 
        MMPLAYER_FENTER();
@@ -2151,11 +2159,11 @@ __mmplayer_gst_element_add_bucket_to_bin(GstBin* bin, GList* element_bucket)
        MMPLAYER_RETURN_VAL_IF_FAIL(bin, 0);
 
        for (; bucket; bucket = bucket->next) {
-               element = (MMPlayerGstElement*)bucket->data;
+               element = (MMPlayerGstElement *)bucket->data;
 
                if (element && element->gst) {
                        if (!gst_bin_add(bin, GST_ELEMENT(element->gst))) {
-                               LOGD("__mmplayer_gst_element_link_bucket : Adding element [%s]  to bin [%s] failed\n",
+                               LOGD("__mmplayer_gst_element_link_bucket : Adding element [%s]  to bin [%s] failed",
                                        GST_ELEMENT_NAME(GST_ELEMENT(element->gst)),
                                        GST_ELEMENT_NAME(GST_ELEMENT(bin)));
                                return 0;
@@ -2169,9 +2177,10 @@ __mmplayer_gst_element_add_bucket_to_bin(GstBin* bin, GList* element_bucket)
        return successful_add_count;
 }
 
-static void __mmplayer_gst_caps_notify_cb(GstPad *pad, GParamSpec *unused, gpointer data)
+static void
+__mmplayer_gst_caps_notify_cb(GstPad *pad, GParamSpec *unused, gpointer data)
 {
-       mm_player_t *player = (mm_player_t*) data;
+       mm_player_t *player = (mm_player_t *)data;
        GstCaps *caps = NULL;
        GstStructure *str = NULL;
        const char *name;
@@ -2223,8 +2232,6 @@ ERROR:
        return;
 }
 
-
-
 /**
  * This function is to create audio pipeline for playing.
  *
@@ -2236,22 +2243,22 @@ ERROR:
  */
 /* macro for code readability. just for sinkbin-creation functions */
 #define MMPLAYER_CREATE_ELEMENT(x_bin, x_id, x_factory, x_name, x_add_bucket, x_player) \
-do {\
-       x_bin[x_id].id = x_id;\
-       x_bin[x_id].gst = gst_element_factory_make(x_factory, x_name);\
-       if (!x_bin[x_id].gst) {\
-               LOGE("failed to create %s \n", x_factory);\
-               goto ERROR;\
-       } else {\
-               if (x_player->ini.set_dump_element_flag)\
-                       __mmplayer_add_dump_buffer_probe(x_player, x_bin[x_id].gst);\
-       } \
-       if (x_add_bucket)\
-               element_bucket = g_list_append(element_bucket, &x_bin[x_id]);\
-} while (0);
+       do {\
+               x_bin[x_id].id = x_id;\
+               x_bin[x_id].gst = gst_element_factory_make(x_factory, x_name);\
+               if (!x_bin[x_id].gst) {\
+                       LOGE("failed to create %s", x_factory);\
+                       goto ERROR;\
+               } else {\
+                       if (x_player->ini.set_dump_element_flag)\
+                               __mmplayer_add_dump_buffer_probe(x_player, x_bin[x_id].gst);\
+               } \
+               if (x_add_bucket)\
+                       element_bucket = g_list_append(element_bucket, &x_bin[x_id]);\
+       } while (0);
 
 void
-__mmplayer_audio_stream_clear_buffer(mm_player_tplayer, gboolean send_all)
+__mmplayer_audio_stream_clear_buffer(mm_player_t *player, gboolean send_all)
 {
        GList *l = NULL;
 
@@ -2266,9 +2273,8 @@ __mmplayer_audio_stream_clear_buffer(mm_player_t* player, gboolean send_all)
                                        LOGD("[%"G_GUINT64_FORMAT"] send remained data.", tmp->channel_mask);
                                        __mmplayer_audio_stream_send_data(player, tmp);
                                }
-                               if (tmp->pcm_data)
-                                       g_free(tmp->pcm_data);
-                               g_free(tmp);
+                               MMPLAYER_FREEIF(tmp->pcm_data);
+                               MMPLAYER_FREEIF(tmp);
                        }
                }
                g_list_free(player->audio_stream_buff_list);
@@ -2279,7 +2285,7 @@ __mmplayer_audio_stream_clear_buffer(mm_player_t* player, gboolean send_all)
 }
 
 static void
-__mmplayer_audio_stream_send_data(mm_player_tplayer, mm_player_audio_stream_buff_t *a_buffer)
+__mmplayer_audio_stream_send_data(mm_player_t *player, mm_player_audio_stream_buff_t *a_buffer)
 {
        MMPlayerAudioStreamDataType audio_stream = { 0, };
 
@@ -2301,10 +2307,9 @@ __mmplayer_audio_stream_send_data(mm_player_t* player, mm_player_audio_stream_bu
 }
 
 static void
-__mmplayer_audio_stream_decoded_render_cb(GstElementobject, GstBuffer *buffer, GstPad *pad, gpointer data)
+__mmplayer_audio_stream_decoded_render_cb(GstElement *object, GstBuffer *buffer, GstPad *pad, gpointer data)
 {
-       mm_player_t* player = (mm_player_t*) data;
-
+       mm_player_t *player = (mm_player_t *)data;
        gint channel = 0;
        gint rate = 0;
        gint depth = 0;
@@ -2372,7 +2377,7 @@ __mmplayer_audio_stream_decoded_render_cb(GstElement* object, GstBuffer *buffer,
        }
 
        /* create new audio stream data */
-       a_buffer = (mm_player_audio_stream_buff_t*)g_malloc0(sizeof(mm_player_audio_stream_buff_t));
+       a_buffer = (mm_player_audio_stream_buff_t *)g_try_malloc0(sizeof(mm_player_audio_stream_buff_t));
        if (a_buffer == NULL) {
                LOGE("failed to alloc data.");
                goto DONE;
@@ -2380,17 +2385,17 @@ __mmplayer_audio_stream_decoded_render_cb(GstElement* object, GstBuffer *buffer,
        a_buffer->bitrate = rate;
        a_buffer->channel = channel;
        a_buffer->depth = depth;
-       a_buffer->is_little_endian = (endianness == 1234 ? 1 : 0);
+       a_buffer->is_little_endian = (endianness == 1234 ? true : false);
        a_buffer->channel_mask = channel_mask;
        a_buffer->data_size = a_size;
 
        if (!player->audio_stream_sink_sync) {
                /* If sync is FALSE, use buffer list to reduce the IPC. */
                a_buffer->buff_size = (a_size > player->ini.pcm_buffer_size) ? (a_size) : (player->ini.pcm_buffer_size);
-               a_buffer->pcm_data = g_malloc(a_buffer->buff_size);
+               a_buffer->pcm_data = g_try_malloc(a_buffer->buff_size);
                if (a_buffer->pcm_data == NULL) {
                        LOGE("failed to alloc data.");
-                       g_free(a_buffer);
+                       MMPLAYER_FREEIF(a_buffer);
                        goto DONE;
                }
                memcpy(a_buffer->pcm_data, a_data, a_size);
@@ -2400,7 +2405,7 @@ __mmplayer_audio_stream_decoded_render_cb(GstElement* object, GstBuffer *buffer,
                /* If sync is TRUE, send data directly. */
                a_buffer->pcm_data = a_data;
                __mmplayer_audio_stream_send_data(player, a_buffer);
-               g_free(a_buffer);
+               MMPLAYER_FREEIF(a_buffer);
        }
 
 DONE:
@@ -2411,9 +2416,9 @@ DONE:
 static void
 __mmplayer_gst_audio_deinterleave_pad_added(GstElement *elem, GstPad *pad, gpointer data)
 {
-       mm_player_t* player = (mm_player_t*)data;
-       MMPlayerGstElementaudiobin = player->pipeline->audiobin;
-       GstPadsinkpad = NULL;
+       mm_player_t *player = (mm_player_t *)data;
+       MMPlayerGstElement *audiobin = player->pipeline->audiobin;
+       GstPad *sinkpad = NULL;
        GstElement *queue = NULL, *sink = NULL;
 
        MMPLAYER_FENTER();
@@ -2421,31 +2426,31 @@ __mmplayer_gst_audio_deinterleave_pad_added(GstElement *elem, GstPad *pad, gpoin
 
        queue = gst_element_factory_make("queue", NULL);
        if (queue == NULL) {
-               LOGD("fail make queue\n");
+               LOGD("fail make queue");
                goto ERROR;
        }
 
        sink = gst_element_factory_make("fakesink", NULL);
        if (sink == NULL) {
-               LOGD("fail make fakesink\n");
+               LOGD("fail make fakesink");
                goto ERROR;
        }
 
        gst_bin_add_many(GST_BIN(audiobin[MMPLAYER_A_BIN].gst), queue, sink, NULL);
 
        if (!gst_element_link_pads_full(queue, "src", sink, "sink", GST_PAD_LINK_CHECK_NOTHING)) {
-               LOGW("failed to link queue & sink\n");
+               LOGW("failed to link queue & sink");
                goto ERROR;
        }
 
        sinkpad = gst_element_get_static_pad(queue, "sink");
 
        if (GST_PAD_LINK_OK != gst_pad_link(pad, sinkpad)) {
-               LOGW("failed to link [%s:%s] to queue\n", GST_DEBUG_PAD_NAME(pad));
+               LOGW("failed to link [%s:%s] to queue", GST_DEBUG_PAD_NAME(pad));
                goto ERROR;
        }
 
-       LOGE("player->audio_stream_sink_sync: %d\n", player->audio_stream_sink_sync);
+       LOGE("player->audio_stream_sink_sync: %d", player->audio_stream_sink_sync);
 
        gst_object_unref(sinkpad);
        g_object_set(sink, "sync", player->audio_stream_sink_sync, NULL);
@@ -2465,7 +2470,7 @@ __mmplayer_gst_audio_deinterleave_pad_added(GstElement *elem, GstPad *pad, gpoin
        return;
 
 ERROR:
-       LOGE("__mmplayer_gst_audio_deinterleave_pad_added ERROR\n");
+       LOGE("__mmplayer_gst_audio_deinterleave_pad_added ERROR");
        if (queue) {
                gst_object_unref(GST_OBJECT(queue));
                queue = NULL;
@@ -2482,7 +2487,8 @@ ERROR:
        return;
 }
 
-void __mmplayer_gst_set_pulsesink_property(mm_player_t* player, MMHandleType attrs)
+void
+__mmplayer_gst_set_pulsesink_property(mm_player_t *player, MMHandleType attrs)
 {
        #define MAX_PROPS_LEN 128
        gint latency_mode = 0;
@@ -2506,10 +2512,10 @@ void __mmplayer_gst_set_pulsesink_property(mm_player_t* player, MMHandleType att
                LOGE("stream_type is null.");
        } else {
                if (player->sound.focus_id)
-                       snprintf(stream_props, sizeof(stream_props)-1, "props,media.role=%s, media.parent_id=%d, media.focus_id=%d",
+                       snprintf(stream_props, sizeof(stream_props) - 1, "props,media.role=%s, media.parent_id=%d, media.focus_id=%d",
                                        stream_type, stream_id, player->sound.focus_id);
                else
-                       snprintf(stream_props, sizeof(stream_props)-1, "props,media.role=%s, media.parent_id=%d",
+                       snprintf(stream_props, sizeof(stream_props) - 1, "props,media.role=%s, media.parent_id=%d",
                                        stream_type, stream_id);
                props = gst_structure_from_string(stream_props, NULL);
                g_object_set(player->pipeline->audiobin[MMPLAYER_A_SINK].gst, "stream-properties", props, NULL);
@@ -2538,12 +2544,13 @@ void __mmplayer_gst_set_pulsesink_property(mm_player_t* player, MMHandleType att
 
        LOGD("audiosink property - latency=%s", latency);
 
-       g_free(latency);
+       MMPLAYER_FREEIF(latency);
 
        MMPLAYER_FLEAVE();
 }
 
-void __mmplayer_gst_set_openalsink_property(mm_player_t* player)
+void
+__mmplayer_gst_set_openalsink_property(mm_player_t *player)
 {
        MMPlayerGstElement *audiobin = NULL;
 
@@ -2561,8 +2568,8 @@ void __mmplayer_gst_set_openalsink_property(mm_player_t* player)
                        player->video360_pitch_radians <= M_PI_2 &&
                        player->video360_pitch_radians >= -M_PI_2) {
                g_object_set(G_OBJECT(audiobin[MMPLAYER_A_SINK].gst),
-                               "source-orientation-y", (int) (player->video360_yaw_radians * 180.0 / M_PI),
-                               "source-orientation-x", (int) (player->video360_pitch_radians * 180.0 / M_PI), NULL);
+                               "source-orientation-y", (int)(player->video360_yaw_radians * 180.0 / M_PI),
+                               "source-orientation-x", (int)(player->video360_pitch_radians * 180.0 / M_PI), NULL);
        } else if (player->video360_metadata.init_view_heading || player->video360_metadata.init_view_pitch) {
                g_object_set(G_OBJECT(audiobin[MMPLAYER_A_SINK].gst),
                                "source-orientation-y", player->video360_metadata.init_view_heading,
@@ -2748,7 +2755,7 @@ ERROR:
 }
 
 static int
-__mmplayer_gst_create_audio_sink_bin(mm_player_tplayer)
+__mmplayer_gst_create_audio_sink_bin(mm_player_t *player)
 {
        MMPlayerGstElement *first_element = NULL;
        MMPlayerGstElement *audiobin = NULL;
@@ -2761,7 +2768,7 @@ __mmplayer_gst_create_audio_sink_bin(mm_player_t* player)
        MMPLAYER_RETURN_VAL_IF_FAIL(player && player->pipeline, MM_ERROR_PLAYER_NOT_INITIALIZED);
 
        /* alloc handles */
-       audiobin = (MMPlayerGstElement*)g_malloc0(sizeof(MMPlayerGstElement) * MMPLAYER_A_NUM);
+       audiobin = (MMPlayerGstElement *)g_try_malloc0(sizeof(MMPlayerGstElement) * MMPLAYER_A_NUM);
        if (!audiobin) {
                LOGE("failed to allocate memory for audiobin");
                return MM_ERROR_PLAYER_NO_FREE_SPACE;
@@ -2839,7 +2846,7 @@ ERROR:
        for (i = 1; i < MMPLAYER_A_NUM; i++) {
                /* NOTE : skip bin */
                if (audiobin[i].gst) {
-                       GstObjectparent = NULL;
+                       GstObject *parent = NULL;
                        parent = gst_element_get_parent(audiobin[i].gst);
 
                        if (!parent) {
@@ -2861,12 +2868,14 @@ ERROR:
        return MM_ERROR_PLAYER_INTERNAL;
 }
 
-static guint32 _mmplayer_convert_fourcc_string_to_value(const gchar* format_name)
+static guint32
+_mmplayer_convert_fourcc_string_to_value(const gchar *format_name)
 {
        return format_name[0] | (format_name[1] << 8) | (format_name[2] << 16) | (format_name[3] << 24);
 }
 
-int _mmplayer_video_stream_release_bo(mm_player_t* player, void* bo)
+int
+_mmplayer_video_stream_release_bo(mm_player_t *player, void *bo)
 {
        int ret = MM_ERROR_NONE;
        GList *l = NULL;
@@ -2877,7 +2886,7 @@ int _mmplayer_video_stream_release_bo(mm_player_t* player, void* bo)
 
        if (player->video_bo_list) {
                for (l = g_list_first(player->video_bo_list); l; l = g_list_next(l)) {
-                       mm_player_video_bo_info_ttmp = (mm_player_video_bo_info_t *)l->data;
+                       mm_player_video_bo_info_t *tmp = (mm_player_video_bo_info_t *)l->data;
                        if (tmp && tmp->bo == bo) {
                                tmp->used = FALSE;
                                LOGD("release bo %p", bo);
@@ -2898,7 +2907,7 @@ int _mmplayer_video_stream_release_bo(mm_player_t* player, void* bo)
 }
 
 static void
-__mmplayer_video_stream_destroy_bo_list(mm_player_tplayer)
+__mmplayer_video_stream_destroy_bo_list(mm_player_t *player)
 {
        GList *l = NULL;
 
@@ -2909,7 +2918,7 @@ __mmplayer_video_stream_destroy_bo_list(mm_player_t* player)
        if (player->video_bo_list) {
                LOGD("destroy video_bo_list : %d", g_list_length(player->video_bo_list));
                for (l = g_list_first(player->video_bo_list); l; l = g_list_next(l)) {
-                       mm_player_video_bo_info_ttmp = (mm_player_video_bo_info_t *)l->data;
+                       mm_player_video_bo_info_t *tmp = (mm_player_video_bo_info_t *)l->data;
                        if (tmp) {
                                if (tmp->bo)
                                        tbm_bo_unref(tmp->bo);
@@ -2926,8 +2935,8 @@ __mmplayer_video_stream_destroy_bo_list(mm_player_t* player)
        return;
 }
 
-static void*
-__mmplayer_video_stream_get_bo(mm_player_tplayer, int size)
+static void *
+__mmplayer_video_stream_get_bo(mm_player_t *player, int size)
 {
        GList *l = NULL;
        MMPLAYER_RETURN_VAL_IF_FAIL(player, NULL);
@@ -2956,7 +2965,7 @@ __mmplayer_video_stream_get_bo(mm_player_t* player, int size)
                }
 
                for (; idx < player->ini.num_of_video_bo; idx++) {
-                       mm_player_video_bo_info_tbo_info = g_new(mm_player_video_bo_info_t, 1);
+                       mm_player_video_bo_info_t *bo_info = g_new(mm_player_video_bo_info_t, 1);
                        if (!bo_info) {
                                LOGE("Fail to alloc bo_info.");
                                break;
@@ -2964,7 +2973,7 @@ __mmplayer_video_stream_get_bo(mm_player_t* player, int size)
                        bo_info->bo = tbm_bo_alloc(player->bufmgr, size, TBM_BO_DEFAULT);
                        if (!bo_info->bo) {
                                LOGE("Fail to tbm_bo_alloc.");
-                               g_free(bo_info);
+                               MMPLAYER_FREEIF(bo_info);
                                break;
                        }
                        bo_info->used = FALSE;
@@ -2987,7 +2996,7 @@ __mmplayer_video_stream_get_bo(mm_player_t* player, int size)
        while (TRUE) {
                /* get bo from list*/
                for (l = g_list_first(player->video_bo_list); l; l = g_list_next(l)) {
-                       mm_player_video_bo_info_ttmp = (mm_player_video_bo_info_t *)l->data;
+                       mm_player_video_bo_info_t *tmp = (mm_player_video_bo_info_t *)l->data;
                        if (tmp && (tmp->used == FALSE)) {
                                LOGD("found bo %p to use", tmp->bo);
                                tmp->used = TRUE;
@@ -3004,7 +3013,7 @@ __mmplayer_video_stream_get_bo(mm_player_t* player, int size)
                if (player->ini.video_bo_timeout <= 0) {
                        MMPLAYER_VIDEO_BO_WAIT(player);
                } else {
-                       gint64 timeout = g_get_monotonic_time() + player->ini.video_bo_timeout*G_TIME_SPAN_SECOND;
+                       gint64 timeout = g_get_monotonic_time() + player->ini.video_bo_timeout * G_TIME_SPAN_SECOND;
                        ret = MMPLAYER_VIDEO_BO_WAIT_UNTIL(player, timeout);
                }
                continue;
@@ -3012,25 +3021,25 @@ __mmplayer_video_stream_get_bo(mm_player_t* player, int size)
 }
 
 static void
-__mmplayer_video_stream_decoded_preroll_cb(GstElementobject, GstBuffer *buffer, GstPad *pad, gpointer data)
+__mmplayer_video_stream_decoded_preroll_cb(GstElement *object, GstBuffer *buffer, GstPad *pad, gpointer data)
 {
-       mm_player_t* player = (mm_player_t*)data;
+       mm_player_t *player = (mm_player_t *)data;
        MMPLAYER_FENTER();
        MMPLAYER_RETURN_IF_FAIL(player && player->video_stream_cb);
 
        /* send prerolled pkt */
-       player->video_stream_prerolled = FALSE;
+       player->video_stream_prerolled = false;
 
        __mmplayer_video_stream_decoded_render_cb(object, buffer, pad, data);
 
        /* not to send prerolled pkt again */
-       player->video_stream_prerolled = TRUE;
+       player->video_stream_prerolled = true;
 }
 
 static void
-__mmplayer_video_stream_decoded_render_cb(GstElementobject, GstBuffer *buffer, GstPad *pad, gpointer data)
+__mmplayer_video_stream_decoded_render_cb(GstElement *object, GstBuffer *buffer, GstPad *pad, gpointer data)
 {
-       mm_player_t* player = (mm_player_t*)data;
+       mm_player_t *player = (mm_player_t *)data;
        MMPlayerVideoStreamDataType *stream = NULL;
        GstMemory *mem = NULL;
 
@@ -3039,7 +3048,7 @@ __mmplayer_video_stream_decoded_render_cb(GstElement* object, GstBuffer *buffer,
        MMPLAYER_RETURN_IF_FAIL(player->video_stream_cb);
 
        if (player->video_stream_prerolled) {
-               player->video_stream_prerolled = FALSE;
+               player->video_stream_prerolled = false;
                LOGD("skip the prerolled pkt not to send it again");
                return;
        }
@@ -3095,7 +3104,7 @@ ERROR:
                if (stream->bo[0])
                        _mmplayer_video_stream_release_bo(player, stream->bo[0]);
        }
-       g_free(stream);
+       MMPLAYER_FREEIF(stream);
        return;
 }
 
@@ -3147,8 +3156,8 @@ __mmplayer_gst_set_video360_property(mm_player_t *player)
                        player->video360_pitch_radians <= M_PI_2 &&
                        player->video360_pitch_radians >= -M_PI_2) {
                g_object_set(G_OBJECT(videobin[MMPLAYER_V_360].gst),
-                               "pose-yaw", (int) (player->video360_yaw_radians * 180.0 / M_PI),
-                               "pose-pitch", (int) (player->video360_pitch_radians * 180.0 / M_PI), NULL);
+                               "pose-yaw", (int)(player->video360_yaw_radians * 180.0 / M_PI),
+                               "pose-pitch", (int)(player->video360_pitch_radians * 180.0 / M_PI), NULL);
        } else if (player->video360_metadata.init_view_heading || player->video360_metadata.init_view_pitch) {
                g_object_set(G_OBJECT(videobin[MMPLAYER_V_360].gst),
                                "pose-yaw", player->video360_metadata.init_view_heading,
@@ -3205,7 +3214,7 @@ ERROR: /* refer MMPLAYER_CREATE_ELEMENT */
        return MM_ERROR_PLAYER_INTERNAL;
 }
 
-static gchar*
+static gchar *
 __mmplayer_get_videosink_factory_name(mm_player_t *player, MMDisplaySurfaceType surface_type)
 {
        gchar *factory_name = NULL;
@@ -3314,7 +3323,7 @@ __mmplayer_gst_set_videosink_property(mm_player_t *player, MMDisplaySurfaceType
  * - video overlay surface(arm/x86) : tizenwlsink
  */
 static int
-__mmplayer_gst_create_video_sink_bin(mm_player_t* player, GstCaps* caps, MMDisplaySurfaceType surface_type)
+__mmplayer_gst_create_video_sink_bin(mm_player_t *player, GstCaps *caps, MMDisplaySurfaceType surface_type)
 {
        GstPad *pad = NULL;
        GList *element_bucket = NULL;
@@ -3326,7 +3335,7 @@ __mmplayer_gst_create_video_sink_bin(mm_player_t* player, GstCaps* caps, MMDispl
        MMPLAYER_RETURN_VAL_IF_FAIL(player && player->pipeline, MM_ERROR_PLAYER_NOT_INITIALIZED);
 
        /* alloc handles */
-       videobin = (MMPlayerGstElement*)g_malloc0(sizeof(MMPlayerGstElement) * MMPLAYER_V_NUM);
+       videobin = (MMPlayerGstElement *)g_try_malloc0(sizeof(MMPlayerGstElement) * MMPLAYER_V_NUM);
        if (!videobin)
                return MM_ERROR_PLAYER_NO_FREE_SPACE;
 
@@ -3412,7 +3421,8 @@ ERROR:
        return MM_ERROR_PLAYER_INTERNAL;
 }
 
-static int __mmplayer_gst_create_plain_text_elements(mm_player_t* player)
+static int
+__mmplayer_gst_create_plain_text_elements(mm_player_t *player)
 {
        GList *element_bucket = NULL;
        MMPlayerGstElement *textbin = player->pipeline->textbin;
@@ -3435,14 +3445,14 @@ static int __mmplayer_gst_create_plain_text_elements(mm_player_t* player)
                                                "signal-handoffs", TRUE, "max-lateness", FAKE_SINK_MAX_LATENESS, NULL);
 
        if (!player->play_subtitle) {
-               LOGD("add textbin sink as sink element of whole pipeline.\n");
+               LOGD("add textbin sink as sink element of whole pipeline.");
                __mmplayer_add_sink(player, GST_ELEMENT(textbin[MMPLAYER_T_FAKE_SINK].gst));
        }
 
        /* adding created elements to bin */
-       LOGD("adding created elements to bin\n");
+       LOGD("adding created elements to bin");
        if (!__mmplayer_gst_element_add_bucket_to_bin(GST_BIN(textbin[MMPLAYER_T_BIN].gst), element_bucket)) {
-               LOGE("failed to add elements\n");
+               LOGE("failed to add elements");
                goto ERROR;
        }
 
@@ -3451,9 +3461,9 @@ static int __mmplayer_gst_create_plain_text_elements(mm_player_t* player)
        GST_OBJECT_FLAG_UNSET(textbin[MMPLAYER_T_FAKE_SINK].gst, GST_ELEMENT_FLAG_SINK);
 
        /* linking elements in the bucket by added order. */
-       LOGD("Linking elements in the bucket by added order.\n");
+       LOGD("Linking elements in the bucket by added order.");
        if (__mmplayer_gst_element_link_bucket(element_bucket) == -1) {
-               LOGE("failed to link elements\n");
+               LOGE("failed to link elements");
                goto ERROR;
        }
 
@@ -3474,12 +3484,12 @@ static int __mmplayer_gst_create_plain_text_elements(mm_player_t* player)
                gst_object_unref(pad);
 
                if (!ghostpad) {
-                       LOGE("failed to create ghostpad of textbin\n");
+                       LOGE("failed to create ghostpad of textbin");
                        goto ERROR;
                }
 
                if (!gst_element_add_pad(textbin[MMPLAYER_T_BIN].gst, ghostpad)) {
-                       LOGE("failed to add ghostpad to textbin\n");
+                       LOGE("failed to add ghostpad to textbin");
                        gst_object_unref(ghostpad);
                        goto ERROR;
                }
@@ -3499,7 +3509,8 @@ ERROR:
        return MM_ERROR_PLAYER_INTERNAL;
 }
 
-static int __mmplayer_gst_create_text_sink_bin(mm_player_t* player)
+static int
+__mmplayer_gst_create_text_sink_bin(mm_player_t *player)
 {
        MMPlayerGstElement *textbin = NULL;
        GList *element_bucket = NULL;
@@ -3511,9 +3522,9 @@ static int __mmplayer_gst_create_text_sink_bin(mm_player_t* player)
        MMPLAYER_RETURN_VAL_IF_FAIL(player && player->pipeline, MM_ERROR_PLAYER_NOT_INITIALIZED);
 
        /* alloc handles */
-       textbin = (MMPlayerGstElement*)g_malloc0(sizeof(MMPlayerGstElement) * MMPLAYER_T_NUM);
+       textbin = (MMPlayerGstElement *)g_try_malloc0(sizeof(MMPlayerGstElement) * MMPLAYER_T_NUM);
        if (!textbin) {
-               LOGE("failed to allocate memory for textbin\n");
+               LOGE("failed to allocate memory for textbin");
                return MM_ERROR_PLAYER_NO_FREE_SPACE;
        }
 
@@ -3521,7 +3532,7 @@ static int __mmplayer_gst_create_text_sink_bin(mm_player_t* player)
        textbin[MMPLAYER_T_BIN].id = MMPLAYER_T_BIN;
        textbin[MMPLAYER_T_BIN].gst = gst_bin_new("textbin");
        if (!textbin[MMPLAYER_T_BIN].gst) {
-               LOGE("failed to create textbin\n");
+               LOGE("failed to create textbin");
                goto ERROR;
        }
 
@@ -3536,7 +3547,7 @@ static int __mmplayer_gst_create_text_sink_bin(mm_player_t* player)
        case MM_DISPLAY_SURFACE_NULL:
        case MM_DISPLAY_SURFACE_REMOTE:
                if (__mmplayer_gst_create_plain_text_elements(player) != MM_ERROR_NONE) {
-                       LOGE("failed to make plain text elements\n");
+                       LOGE("failed to make plain text elements");
                        goto ERROR;
                }
                break;
@@ -3551,7 +3562,7 @@ static int __mmplayer_gst_create_text_sink_bin(mm_player_t* player)
 
 ERROR:
 
-       LOGD("ERROR : releasing textbin\n");
+       LOGD("ERROR : releasing textbin");
 
        g_list_free(element_bucket);
 
@@ -3562,7 +3573,7 @@ ERROR:
        for (i = 1; i < MMPLAYER_T_NUM; i++) {
                /* NOTE : skip bin */
                if (textbin[i].gst) {
-                       GstObjectparent = NULL;
+                       GstObject *parent = NULL;
                        parent = gst_element_get_parent(textbin[i].gst);
 
                        if (!parent) {
@@ -3585,12 +3596,11 @@ ERROR:
        return MM_ERROR_PLAYER_INTERNAL;
 }
 
-
 static int
-__mmplayer_gst_create_text_pipeline(mm_player_tplayer)
+__mmplayer_gst_create_text_pipeline(mm_player_t *player)
 {
-       MMPlayerGstElementmainbin = NULL;
-       MMPlayerGstElementtextbin = NULL;
+       MMPlayerGstElement *mainbin = NULL;
+       MMPlayerGstElement *textbin = NULL;
        MMHandleType attrs = 0;
        GstElement *subsrc = NULL;
        GstElement *subparse = NULL;
@@ -3609,13 +3619,13 @@ __mmplayer_gst_create_text_pipeline(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;
        }
 
        mm_attrs_get_string_by_name(attrs, "subtitle_uri", &subtitle_uri);
        if (!subtitle_uri || strlen(subtitle_uri) < 1) {
-               LOGE("subtitle uri is not proper filepath.\n");
+               LOGE("subtitle uri is not proper filepath.");
                return MM_ERROR_PLAYER_INVALID_URI;
        }
 
@@ -3624,7 +3634,7 @@ __mmplayer_gst_create_text_pipeline(mm_player_t* player)
                return MM_ERROR_PLAYER_INVALID_URI;
        }
 
-       SECURE_LOGD("subtitle file path is [%s].\n", subtitle_uri);
+       SECURE_LOGD("subtitle file path is [%s].", subtitle_uri);
 
        MMPLAYER_SUBTITLE_INFO_LOCK(player);
        player->subtitle_language_list = NULL;
@@ -3633,7 +3643,7 @@ __mmplayer_gst_create_text_pipeline(mm_player_t* player)
        /* create the subtitle source */
        subsrc = gst_element_factory_make("filesrc", "subtitle_source");
        if (!subsrc) {
-               LOGE("failed to create filesrc element\n");
+               LOGE("failed to create filesrc element");
                goto ERROR;
        }
        g_object_set(G_OBJECT(subsrc), "location", subtitle_uri, NULL);
@@ -3642,7 +3652,7 @@ __mmplayer_gst_create_text_pipeline(mm_player_t* player)
        mainbin[MMPLAYER_M_SUBSRC].gst = subsrc;
 
        if (!gst_bin_add(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), subsrc)) {
-               LOGW("failed to add queue\n");
+               LOGW("failed to add queue");
                gst_object_unref(mainbin[MMPLAYER_M_SUBSRC].gst);
                mainbin[MMPLAYER_M_SUBSRC].gst = NULL;
                mainbin[MMPLAYER_M_SUBSRC].id = MMPLAYER_M_NUM;
@@ -3652,13 +3662,13 @@ __mmplayer_gst_create_text_pipeline(mm_player_t* player)
        /* subparse */
        subparse = gst_element_factory_make("subparse", "subtitle_parser");
        if (!subparse) {
-               LOGE("failed to create subparse element\n");
+               LOGE("failed to create subparse element");
                goto ERROR;
        }
 
        charset = util_get_charset(subtitle_uri);
        if (charset) {
-               LOGD("detected charset is %s\n", charset);
+               LOGD("detected charset is %s", charset);
                g_object_set(G_OBJECT(subparse), "subtitle-encoding", charset, NULL);
        }
 
@@ -3666,7 +3676,7 @@ __mmplayer_gst_create_text_pipeline(mm_player_t* player)
        mainbin[MMPLAYER_M_SUBPARSE].gst = subparse;
 
        if (!gst_bin_add(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), subparse)) {
-               LOGW("failed to add subparse\n");
+               LOGW("failed to add subparse");
                gst_object_unref(mainbin[MMPLAYER_M_SUBPARSE].gst);
                mainbin[MMPLAYER_M_SUBPARSE].gst = NULL;
                mainbin[MMPLAYER_M_SUBPARSE].id = MMPLAYER_M_NUM;
@@ -3674,25 +3684,25 @@ __mmplayer_gst_create_text_pipeline(mm_player_t* player)
        }
 
        if (!gst_element_link_pads(subsrc, "src", subparse, "sink")) {
-               LOGW("failed to link subsrc and subparse\n");
+               LOGW("failed to link subsrc and subparse");
                goto ERROR;
        }
 
        player->play_subtitle = TRUE;
        player->adjust_subtitle_pos = 0;
 
-       LOGD("play subtitle using subtitle file\n");
+       LOGD("play subtitle using subtitle file");
 
        if (player->pipeline->textbin == NULL) {
                if (MM_ERROR_NONE != __mmplayer_gst_create_text_sink_bin(player)) {
-                       LOGE("failed to create text sink bin. continuing without text\n");
+                       LOGE("failed to create text sink bin. continuing without text");
                        goto ERROR;
                }
 
                textbin = player->pipeline->textbin;
 
                if (!gst_bin_add(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), GST_ELEMENT(textbin[MMPLAYER_T_BIN].gst))) {
-                       LOGW("failed to add textbin\n");
+                       LOGW("failed to add textbin");
 
                        /* release signal */
                        __mmplayer_release_signal_connection(player, MM_PLAYER_SIGNAL_TYPE_TEXTBIN);
@@ -3716,7 +3726,7 @@ __mmplayer_gst_create_text_pipeline(mm_player_t* player)
        }
 
        if (!gst_element_link_pads(subparse, "src", textbin[MMPLAYER_T_BIN].gst, "text_sink")) {
-               LOGW("failed to link subparse and textbin\n");
+               LOGW("failed to link subparse and textbin");
                goto ERROR;
        }
 
@@ -3763,9 +3773,9 @@ ERROR:
 }
 
 gboolean
-__mmplayer_update_subtitle(GstElementobject, GstBuffer *buffer, GstPad *pad, gpointer data)
+__mmplayer_update_subtitle(GstElement *object, GstBuffer *buffer, GstPad *pad, gpointer data)
 {
-       mm_player_t* player = (mm_player_t*) data;
+       mm_player_t *player = (mm_player_t *)data;
        MMMessageParamType msg = {0, };
        GstClockTime duration = 0;
        gpointer text = NULL;
@@ -3789,19 +3799,19 @@ __mmplayer_update_subtitle(GstElement* object, GstBuffer *buffer, GstPad *pad, g
        duration = GST_BUFFER_DURATION(buffer);
 
        if (player->set_mode.subtitle_off) {
-               LOGD("subtitle is OFF.\n");
+               LOGD("subtitle is OFF.");
                return TRUE;
        }
 
        if (!text || (text_size == 0)) {
-               LOGD("There is no subtitle to be displayed.\n");
+               LOGD("There is no subtitle to be displayed.");
                return TRUE;
        }
 
-       msg.data = (void *) text;
+       msg.data = (void *)text;
        msg.subtitle.duration = GST_TIME_AS_MSECONDS(duration);
 
-       LOGD("update subtitle : [%ld msec] %s\n'", msg.subtitle.duration, (char*)msg.data);
+       LOGD("update subtitle : [%ld msec] %s", msg.subtitle.duration, (char *)msg.data);
 
        MMPLAYER_POST_MSG(player, MM_MESSAGE_UPDATE_SUBTITLE, &msg);
        gst_buffer_unmap(buffer, &mapinfo);
@@ -3814,7 +3824,7 @@ __mmplayer_update_subtitle(GstElement* object, GstBuffer *buffer, GstPad *pad, g
 static GstPadProbeReturn
 __mmplayer_subtitle_adjust_position_probe(GstPad *pad, GstPadProbeInfo *info, gpointer u_data)
 {
-       mm_player_t *player = (mm_player_t *) u_data;
+       mm_player_t *player = (mm_player_t *)u_data;
        GstClockTime cur_timestamp = 0;
        gint64 adjusted_timestamp = 0;
        GstBuffer *buffer = gst_pad_probe_info_get_buffer(info);
@@ -3822,7 +3832,7 @@ __mmplayer_subtitle_adjust_position_probe(GstPad *pad, GstPadProbeInfo *info, gp
        MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
 
        if (player->set_mode.subtitle_off) {
-               LOGD("subtitle is OFF.\n");
+               LOGD("subtitle is OFF.");
                return TRUE;
        }
 
@@ -3832,7 +3842,7 @@ __mmplayer_subtitle_adjust_position_probe(GstPad *pad, GstPadProbeInfo *info, gp
        }
 
        cur_timestamp = GST_BUFFER_TIMESTAMP(buffer);
-       adjusted_timestamp = (gint64) cur_timestamp +((gint64) player->adjust_subtitle_pos * G_GINT64_CONSTANT(1000000));
+       adjusted_timestamp = (gint64)cur_timestamp + ((gint64)player->adjust_subtitle_pos * G_GINT64_CONSTANT(1000000));
 
        if (adjusted_timestamp < 0) {
                LOGD("adjusted_timestamp under zero");
@@ -3847,7 +3857,9 @@ __mmplayer_subtitle_adjust_position_probe(GstPad *pad, GstPadProbeInfo *info, gp
 
        return GST_PAD_PROBE_OK;
 }
-static int __mmplayer_gst_adjust_subtitle_position(mm_player_t* player, int format, int position)
+
+static int
+__mmplayer_gst_adjust_subtitle_position(mm_player_t *player, int format, int position)
 {
        MMPLAYER_FENTER();
 
@@ -3856,7 +3868,7 @@ static int __mmplayer_gst_adjust_subtitle_position(mm_player_t* player, int form
        MMPLAYER_RETURN_VAL_IF_FAIL(player->play_subtitle, MM_ERROR_NOT_SUPPORT_API);
 
        if (position == 0) {
-               LOGD("nothing to do\n");
+               LOGD("nothing to do");
                MMPLAYER_FLEAVE();
                return MM_ERROR_NONE;
        }
@@ -3873,7 +3885,7 @@ static int __mmplayer_gst_adjust_subtitle_position(mm_player_t* player, int form
 
        default:
                {
-                       LOGW("invalid format.\n");
+                       LOGW("invalid format.");
                        MMPLAYER_FLEAVE();
                        return MM_ERROR_INVALID_ARGUMENT;
                }
@@ -3894,7 +3906,7 @@ static int __mmplayer_gst_adjust_subtitle_position(mm_player_t* player, int form
  * @see
  */
 static int
-__mmplayer_gst_create_pipeline(mm_player_tplayer)
+__mmplayer_gst_create_pipeline(mm_player_t *player)
 {
        int ret = MM_ERROR_NONE;
        MMPlayerGstElement *mainbin = NULL;
@@ -3916,12 +3928,12 @@ __mmplayer_gst_create_pipeline(mm_player_t* player)
                goto INIT_ERROR;
        }
 
-       player->pipeline = (MMPlayerGstPipelineInfo*) g_malloc0(sizeof(MMPlayerGstPipelineInfo));
+       player->pipeline = (MMPlayerGstPipelineInfo *)g_malloc0(sizeof(MMPlayerGstPipelineInfo));
        if (player->pipeline == NULL)
                goto INIT_ERROR;
 
        /* create mainbin */
-       mainbin = (MMPlayerGstElement*) g_malloc0(sizeof(MMPlayerGstElement) * MMPLAYER_M_NUM);
+       mainbin = (MMPlayerGstElement *)g_try_malloc0(sizeof(MMPlayerGstElement) * MMPLAYER_M_NUM);
        if (mainbin == NULL)
                goto INIT_ERROR;
 
@@ -3948,10 +3960,9 @@ __mmplayer_gst_create_pipeline(mm_player_t* player)
        }
 
        /* Note : check whether subtitle atrribute uri is set. If uri is set, then try to play subtitle file */
-       if (__mmplayer_check_subtitle(player)) {
-               if (__mmplayer_gst_create_text_pipeline(player) != MM_ERROR_NONE)
-                       LOGE("failed to create text pipeline");
-       }
+       if (__mmplayer_check_subtitle(player)
+               && (__mmplayer_gst_create_text_pipeline(player) != MM_ERROR_NONE))
+               LOGE("failed to create text pipeline");
 
        /* add bus watch */
        ret = __mmplayer_gst_add_bus_watch(player);
@@ -3969,7 +3980,7 @@ INIT_ERROR:
 }
 
 static void
-__mmplayer_reset_gapless_state(mm_player_tplayer)
+__mmplayer_reset_gapless_state(mm_player_t *player)
 {
        MMPLAYER_FENTER();
        MMPLAYER_RETURN_IF_FAIL(player
@@ -3984,7 +3995,7 @@ __mmplayer_reset_gapless_state(mm_player_t* player)
 }
 
 static int
-__mmplayer_gst_destroy_pipeline(mm_player_tplayer)
+__mmplayer_gst_destroy_pipeline(mm_player_t *player)
 {
        gint timeout = 0;
        int ret = MM_ERROR_NONE;
@@ -4021,16 +4032,16 @@ __mmplayer_gst_destroy_pipeline(mm_player_t* player)
 
        /* cleanup gst stuffs */
        if (player->pipeline) {
-               MMPlayerGstElementmainbin = player->pipeline->mainbin;
-               GstTagListtag_list = player->pipeline->tag_list;
+               MMPlayerGstElement *mainbin = player->pipeline->mainbin;
+               GstTagList *tag_list = player->pipeline->tag_list;
 
                /* first we need to disconnect all signal hander */
                __mmplayer_release_signal_connection(player, MM_PLAYER_SIGNAL_TYPE_ALL);
 
                if (mainbin) {
-                       MMPlayerGstElementaudiobin = player->pipeline->audiobin;
-                       MMPlayerGstElementvideobin = player->pipeline->videobin;
-                       MMPlayerGstElementtextbin = player->pipeline->textbin;
+                       MMPlayerGstElement *audiobin = player->pipeline->audiobin;
+                       MMPlayerGstElement *videobin = player->pipeline->videobin;
+                       MMPlayerGstElement *textbin = player->pipeline->textbin;
                        GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(mainbin[MMPLAYER_M_PIPE].gst));
                        gst_bus_set_sync_handler(bus, NULL, NULL, NULL);
                        gst_object_unref(bus);
@@ -4038,11 +4049,11 @@ __mmplayer_gst_destroy_pipeline(mm_player_t* player)
                        timeout = MMPLAYER_STATE_CHANGE_TIMEOUT(player);
                        ret = __mmplayer_gst_set_state(player, mainbin[MMPLAYER_M_PIPE].gst, GST_STATE_NULL, FALSE, timeout);
                        if (ret != MM_ERROR_NONE) {
-                               LOGE("fail to change state to NULL\n");
+                               LOGE("fail to change state to NULL");
                                return MM_ERROR_PLAYER_INTERNAL;
                        }
 
-                       LOGW("succeeded in changing state to NULL\n");
+                       LOGW("succeeded in changing state to NULL");
 
                        gst_object_unref(GST_OBJECT(mainbin[MMPLAYER_M_PIPE].gst));
 
@@ -4071,6 +4082,7 @@ __mmplayer_gst_destroy_pipeline(mm_player_t* player)
                gst_caps_unref(player->v_stream_caps);
                player->v_stream_caps = NULL;
        }
+
        if (player->a_stream_caps) {
                gst_caps_unref(player->a_stream_caps);
                player->a_stream_caps = NULL;
@@ -4091,14 +4103,15 @@ __mmplayer_gst_destroy_pipeline(mm_player_t* player)
                player->bufmgr = NULL;
        }
 
-       LOGW("finished destroy pipeline\n");
+       LOGW("finished destroy pipeline");
 
        MMPLAYER_FLEAVE();
 
        return ret;
 }
 
-static int __mmplayer_gst_realize(mm_player_t* player)
+static int
+__mmplayer_gst_realize(mm_player_t *player)
 {
        gint timeout = 0;
        int ret = MM_ERROR_NONE;
@@ -4111,7 +4124,7 @@ static int __mmplayer_gst_realize(mm_player_t* player)
 
        ret = __mmplayer_gst_create_pipeline(player);
        if (ret) {
-               LOGE("failed to create pipeline\n");
+               LOGE("failed to create pipeline");
                return ret;
        }
 
@@ -4137,7 +4150,8 @@ static int __mmplayer_gst_realize(mm_player_t* player)
        return ret;
 }
 
-static int __mmplayer_gst_unrealize(mm_player_t* player)
+static int
+__mmplayer_gst_unrealize(mm_player_t *player)
 {
        int ret = MM_ERROR_NONE;
 
@@ -4154,7 +4168,7 @@ static int __mmplayer_gst_unrealize(mm_player_t* player)
        /* destroy pipeline */
        ret = __mmplayer_gst_destroy_pipeline(player);
        if (ret != MM_ERROR_NONE) {
-               LOGE("failed to destory pipeline\n");
+               LOGE("failed to destory pipeline");
                return ret;
        }
 
@@ -4170,26 +4184,27 @@ static int __mmplayer_gst_unrealize(mm_player_t* player)
 }
 
 static int
-__mmplayer_gst_set_message_callback(mm_player_tplayer, MMMessageCallback callback, gpointer user_param)
+__mmplayer_gst_set_message_callback(mm_player_t *player, MMMessageCallback callback, gpointer user_param)
 {
        MMPLAYER_FENTER();
 
        if (!player) {
-               LOGW("set_message_callback is called with invalid player handle\n");
+               LOGW("set_message_callback is called with invalid player handle");
                return MM_ERROR_PLAYER_NOT_INITIALIZED;
        }
 
        player->msg_cb = callback;
        player->msg_cb_param = user_param;
 
-       LOGD("msg_cb : %p     msg_cb_param : %p\n", callback, user_param);
+       LOGD("msg_cb : %p     msg_cb_param : %p", callback, user_param);
 
        MMPLAYER_FLEAVE();
 
        return MM_ERROR_NONE;
 }
 
-int __mmplayer_parse_profile(const char *uri, void *param, MMPlayerParseProfile* data)
+int
+__mmplayer_parse_profile(const char *uri, void *param, MMPlayerParseProfile *data)
 {
        int ret = MM_ERROR_NONE;
        char *path = NULL;
@@ -4228,8 +4243,8 @@ int __mmplayer_parse_profile(const char *uri, void *param, MMPlayerParseProfile*
                ret = MM_ERROR_PLAYER_PERMISSION_DENIED;
 
        /* dump parse result */
-       SECURE_LOGW("incoming uri : %s\n", uri);
-       LOGD("uri_type : %d, mem : %p, mem_size : %d, urgent : %s\n",
+       SECURE_LOGW("incoming uri : %s", uri);
+       LOGD("uri_type : %d, mem : %p, mem_size : %d, urgent : %s",
                data->uri_type, data->input_mem.buf, data->input_mem.len, data->urgent);
 
        MMPLAYER_FLEAVE();
@@ -4295,7 +4310,7 @@ __resource_release_cb(mm_resource_manager_h rm, mm_resource_manager_res_h res,
        MMPLAYER_FENTER();
 
        if (user_data == NULL) {
-               LOGE("- user_data is null\n");
+               LOGE("- user_data is null");
                return FALSE;
        }
        player = (mm_player_t *)user_data;
@@ -4351,7 +4366,7 @@ _mmplayer_create_player(MMHandleType handle)
        int ret = MM_ERROR_PLAYER_INTERNAL;
        bool enabled = false;
 
-       mm_player_tplayer = MM_PLAYER_CAST(handle);
+       mm_player_t *player = MM_PLAYER_CAST(handle);
 
        MMPLAYER_FENTER();
 
@@ -4370,13 +4385,13 @@ _mmplayer_create_player(MMHandleType handle)
        player->attrs = _mmplayer_construct_attribute(handle);
 
        if (!player->attrs) {
-               LOGE("Failed to construct attributes\n");
+               LOGE("Failed to construct attributes");
                return ret;
        }
 
        /* initialize gstreamer with configured parameter */
        if (!__mmplayer_init_gstreamer(player)) {
-               LOGE("Initializing gstreamer failed\n");
+               LOGE("Initializing gstreamer failed");
                _mmplayer_deconstruct_attribute(handle);
                return ret;
        }
@@ -4413,7 +4428,7 @@ _mmplayer_create_player(MMHandleType handle)
 
        ret = _mmplayer_initialize_video_capture(player);
        if (ret != MM_ERROR_NONE) {
-               LOGE("failed to initialize video capture\n");
+               LOGE("failed to initialize video capture");
                goto ERROR;
        }
 
@@ -4493,12 +4508,9 @@ _mmplayer_create_player(MMHandleType handle)
 ERROR:
        /* free lock */
        g_mutex_clear(&player->fsink_lock);
-
        /* free update tag lock */
        g_mutex_clear(&player->update_tag_lock);
-
        g_queue_free(player->bus_msg_q);
-
        /* free gapless play thread */
        if (player->gapless_play_thread) {
                MMPLAYER_GAPLESS_PLAY_THREAD_LOCK(player);
@@ -4522,32 +4534,32 @@ ERROR:
 }
 
 static gboolean
-__mmplayer_init_gstreamer(mm_player_tplayer)
+__mmplayer_init_gstreamer(mm_player_t *player)
 {
        static gboolean initialized = FALSE;
        static const int max_argc = 50;
-       gintargc = NULL;
-       gchar** argv = NULL;
-       gchar** argv2 = NULL;
+       gint *argc = NULL;
+       gchar **argv = NULL;
+       gchar **argv2 = NULL;
        GError *err = NULL;
        int i = 0;
        int arg_count = 0;
 
        if (initialized) {
-               LOGD("gstreamer already initialized.\n");
+               LOGD("gstreamer already initialized.");
                return TRUE;
        }
 
        /* alloc */
        argc = malloc(sizeof(int));
-       argv = malloc(sizeof(gchar*) * max_argc);
-       argv2 = malloc(sizeof(gchar*) * max_argc);
+       argv = malloc(sizeof(gchar *) * max_argc);
+       argv2 = malloc(sizeof(gchar *) * max_argc);
 
        if (!argc || !argv || !argv2)
                goto ERROR;
 
-       memset(argv, 0, sizeof(gchar*) * max_argc);
-       memset(argv2, 0, sizeof(gchar*) * max_argc);
+       memset(argv, 0, sizeof(gchar *) * max_argc);
+       memset(argv2, 0, sizeof(gchar *) * max_argc);
 
        /* add initial */
        *argc = 1;
@@ -4578,18 +4590,18 @@ __mmplayer_init_gstreamer(mm_player_t* player)
                (*argc)++;
        }
 
-       LOGD("initializing gstreamer with following parameter\n");
-       LOGD("argc : %d\n", *argc);
+       LOGD("initializing gstreamer with following parameter");
+       LOGD("argc : %d", *argc);
        arg_count = *argc;
 
        for (i = 0; i < arg_count; i++) {
                argv2[i] = argv[i];
-               LOGD("argv[%d] : %s\n", i, argv2[i]);
+               LOGD("argv[%d] : %s", i, argv2[i]);
        }
 
        /* initializing gstreamer */
        if (!gst_init_check(argc, &argv, &err)) {
-               LOGE("Could not initialize GStreamer: %s\n", err ? err->message : "unknown error occurred");
+               LOGE("Could not initialize GStreamer: %s", err ? err->message : "unknown error occurred");
                if (err)
                        g_error_free(err);
 
@@ -4597,7 +4609,7 @@ __mmplayer_init_gstreamer(mm_player_t* player)
        }
        /* release */
        for (i = 0; i < arg_count; i++) {
-               //LOGD("release - argv[%d] : %s\n", i, argv2[i]);
+               //LOGD("release - argv[%d] : %s", i, argv2[i]);
                MMPLAYER_FREEIF(argv2[i]);
        }
 
@@ -4614,7 +4626,7 @@ ERROR:
 
        /* release */
        for (i = 0; i < arg_count; i++) {
-               LOGD("free[%d] : %s\n", i, argv2[i]);
+               LOGD("free[%d] : %s", i, argv2[i]);
                MMPLAYER_FREEIF(argv2[i]);
        }
 
@@ -4626,12 +4638,12 @@ ERROR:
 }
 
 static void
-__mmplayer_check_async_state_transition(mm_player_tplayer)
+__mmplayer_check_async_state_transition(mm_player_t *player)
 {
        GstState element_state = GST_STATE_VOID_PENDING;
        GstState element_pending_state = GST_STATE_VOID_PENDING;
        GstStateChangeReturn ret = GST_STATE_CHANGE_FAILURE;
-       GstElement * element = NULL;
+       GstElement *element = NULL;
        gboolean async = FALSE;
 
        /* check player handle */
@@ -4652,10 +4664,10 @@ __mmplayer_check_async_state_transition(mm_player_t* player)
 
        /* wait for state transition */
        element = player->pipeline->mainbin[MMPLAYER_M_PIPE].gst;
-       ret = gst_element_get_state(element, &element_state, &element_pending_state, 1*GST_SECOND);
+       ret = gst_element_get_state(element, &element_state, &element_pending_state, 1 * GST_SECOND);
 
        if (ret == GST_STATE_CHANGE_FAILURE) {
-               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));
@@ -4666,14 +4678,14 @@ __mmplayer_check_async_state_transition(mm_player_t* player)
                return;
        }
 
-       LOGD("[%s] element state has changed\n", GST_ELEMENT_NAME(element));
+       LOGD("[%s] element state has changed", GST_ELEMENT_NAME(element));
        return;
 }
 
 int
 _mmplayer_destroy(MMHandleType handle)
 {
-       mm_player_tplayer = MM_PLAYER_CAST(handle);
+       mm_player_t *player = MM_PLAYER_CAST(handle);
 
        MMPLAYER_FENTER();
 
@@ -4693,11 +4705,11 @@ _mmplayer_destroy(MMHandleType handle)
                MMPLAYER_GAPLESS_PLAY_THREAD_SIGNAL(player);
                MMPLAYER_GAPLESS_PLAY_THREAD_UNLOCK(player);
 
-               LOGD("waitting for gapless play thread exit\n");
+               LOGD("waitting for gapless play thread exit");
                g_thread_join(player->gapless_play_thread);
                g_mutex_clear(&player->gapless_play_thread_mutex);
                g_cond_clear(&player->gapless_play_thread_cond);
-               LOGD("gapless play thread released\n");
+               LOGD("gapless play thread released");
        }
 
        _mmplayer_release_video_capture(player);
@@ -4705,11 +4717,11 @@ _mmplayer_destroy(MMHandleType handle)
        /* de-initialize resource manager */
        if (MM_RESOURCE_MANAGER_ERROR_NONE != mm_resource_manager_destroy(
                        player->resource_manager))
-               LOGE("failed to deinitialize resource manager\n");
+               LOGE("failed to deinitialize resource manager");
 
        /* release pipeline */
        if (MM_ERROR_NONE != __mmplayer_gst_destroy_pipeline(player)) {
-               LOGE("failed to destory pipeline\n");
+               LOGE("failed to destory pipeline");
                return MM_ERROR_PLAYER_INTERNAL;
        }
 
@@ -4752,7 +4764,7 @@ _mmplayer_destroy(MMHandleType handle)
 int
 _mmplayer_realize(MMHandleType hplayer)
 {
-       mm_player_t* player = (mm_player_t*)hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
        char *uri = NULL;
        void *param = NULL;
        MMHandleType attrs = 0;
@@ -4768,14 +4780,14 @@ _mmplayer_realize(MMHandleType hplayer)
 
        attrs = MMPLAYER_GET_ATTRS(player);
        if (!attrs) {
-               LOGE("fail to get attributes.\n");
+               LOGE("fail to get attributes.");
                return MM_ERROR_PLAYER_INTERNAL;
        }
        mm_attrs_get_string_by_name(attrs, "profile_uri", &uri);
        mm_attrs_get_data_by_name(attrs, "profile_user_param", &param);
 
        if (player->profile.uri_type == MM_PLAYER_URI_TYPE_NONE) {
-               ret = __mmplayer_parse_profile((const char*)uri, param, &player->profile);
+               ret = __mmplayer_parse_profile((const char *)uri, param, &player->profile);
 
                if (ret != MM_ERROR_NONE) {
                        LOGE("failed to parse profile");
@@ -4791,7 +4803,7 @@ _mmplayer_realize(MMHandleType hplayer)
        }
 
        if (player->profile.uri_type == MM_PLAYER_URI_TYPE_URL_MMS) {
-               LOGW("mms protocol is not supported format.\n");
+               LOGW("mms protocol is not supported format.");
                return MM_ERROR_PLAYER_NOT_SUPPORTED_FORMAT;
        }
 
@@ -4825,7 +4837,7 @@ _mmplayer_realize(MMHandleType hplayer)
        /* realize pipeline */
        ret = __mmplayer_gst_realize(player);
        if (ret != MM_ERROR_NONE)
-               LOGE("fail to realize the player.\n");
+               LOGE("fail to realize the player.");
 
        MMPLAYER_BUS_MSG_THREAD_SIGNAL(player);
 
@@ -4837,7 +4849,7 @@ _mmplayer_realize(MMHandleType hplayer)
 int
 _mmplayer_unrealize(MMHandleType hplayer)
 {
-       mm_player_t* player = (mm_player_t*)hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
        int ret = MM_ERROR_NONE;
 
        MMPLAYER_FENTER();
@@ -4866,7 +4878,7 @@ _mmplayer_unrealize(MMHandleType hplayer)
                                ret = mm_resource_manager_mark_for_release(player->resource_manager,
                                                player->video_decoder_resource);
                                if (ret != MM_RESOURCE_MANAGER_ERROR_NONE)
-                                       LOGE("failed to mark decoder resource for release, ret(0x%x)\n", ret);
+                                       LOGE("failed to mark decoder resource for release, ret(0x%x)", ret);
                                else
                                        player->video_decoder_resource = NULL;
                        }
@@ -4875,14 +4887,14 @@ _mmplayer_unrealize(MMHandleType hplayer)
                                ret = mm_resource_manager_mark_for_release(player->resource_manager,
                                                player->video_overlay_resource);
                                if (ret != MM_RESOURCE_MANAGER_ERROR_NONE)
-                                       LOGE("failed to mark overlay resource for release, ret(0x%x)\n", ret);
+                                       LOGE("failed to mark overlay resource for release, ret(0x%x)", ret);
                                else
                                        player->video_overlay_resource = NULL;
                        }
 
                        ret = mm_resource_manager_commit(player->resource_manager);
                        if (ret != MM_RESOURCE_MANAGER_ERROR_NONE)
-                               LOGE("failed to commit resource releases, ret(0x%x)\n", ret);
+                               LOGE("failed to commit resource releases, ret(0x%x)", ret);
                }
        } else
                LOGE("failed and don't change asm state to stop");
@@ -4895,7 +4907,7 @@ _mmplayer_unrealize(MMHandleType hplayer)
 int
 _mmplayer_set_message_callback(MMHandleType hplayer, MMMessageCallback callback, gpointer user_param)
 {
-       mm_player_t* player = (mm_player_t*)hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
 
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
 
@@ -4903,9 +4915,9 @@ _mmplayer_set_message_callback(MMHandleType hplayer, MMMessageCallback callback,
 }
 
 int
-_mmplayer_get_state(MMHandleType hplayer, intstate)
+_mmplayer_get_state(MMHandleType hplayer, int *state)
 {
-       mm_player_t *player = (mm_player_t*)hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
 
        MMPLAYER_RETURN_VAL_IF_FAIL(state, MM_ERROR_INVALID_ARGUMENT);
 
@@ -4918,21 +4930,21 @@ _mmplayer_get_state(MMHandleType hplayer, int* state)
 int
 _mmplayer_set_volume(MMHandleType hplayer, MMPlayerVolumeType volume)
 {
-       mm_player_t* player = (mm_player_t*) hplayer;
-       GstElementvol_element = NULL;
+       mm_player_t *player = (mm_player_t *)hplayer;
+       GstElement *vol_element = NULL;
        int i = 0;
 
        MMPLAYER_FENTER();
 
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
 
-       LOGD("volume [L]=%f:[R]=%f\n",
+       LOGD("volume [L]=%f:[R]=%f",
                volume.level[MM_VOLUME_CHANNEL_LEFT], volume.level[MM_VOLUME_CHANNEL_RIGHT]);
 
        /* invalid factor range or not */
        for (i = 0; i < MM_VOLUME_CHANNEL_NUM; i++) {
                if (volume.level[i] < MM_VOLUME_FACTOR_MIN || volume.level[i] > MM_VOLUME_FACTOR_MAX) {
-                       LOGE("Invalid factor!(valid factor:0~1.0)\n");
+                       LOGE("Invalid factor!(valid factor:0~1.0)");
                        return MM_ERROR_INVALID_ARGUMENT;
                }
        }
@@ -4946,8 +4958,8 @@ _mmplayer_set_volume(MMHandleType hplayer, MMPlayerVolumeType volume)
 
        /* check pipeline handle */
        if (!player->pipeline || !player->pipeline->audiobin) {
-               LOGD("audiobin is not created yet\n");
-               LOGD("but, current stored volume will be set when it's created.\n");
+               LOGD("audiobin is not created yet");
+               LOGD("but, current stored volume will be set when it's created.");
 
                /* NOTE : stored volume will be used in create_audiobin
                 * returning MM_ERROR_NONE here makes application to able to
@@ -4960,7 +4972,7 @@ _mmplayer_set_volume(MMHandleType hplayer, MMPlayerVolumeType volume)
        vol_element = player->pipeline->audiobin[MMPLAYER_A_VOL].gst;
 
        if (vol_element) {
-               LOGD("volume is set [%f]\n", player->sound.volume);
+               LOGD("volume is set [%f]", player->sound.volume);
                g_object_set(vol_element, "volume", player->sound.volume, NULL);
        }
 
@@ -4969,11 +4981,10 @@ _mmplayer_set_volume(MMHandleType hplayer, MMPlayerVolumeType volume)
        return MM_ERROR_NONE;
 }
 
-
 int
-_mmplayer_get_volume(MMHandleType hplayer, MMPlayerVolumeTypevolume)
+_mmplayer_get_volume(MMHandleType hplayer, MMPlayerVolumeType *volume)
 {
-       mm_player_t* player = (mm_player_t*) hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
        int i = 0;
 
        MMPLAYER_FENTER();
@@ -4993,8 +5004,8 @@ _mmplayer_get_volume(MMHandleType hplayer, MMPlayerVolumeType* volume)
 int
 _mmplayer_set_mute(MMHandleType hplayer, int mute)
 {
-       mm_player_t* player = (mm_player_t*) hplayer;
-       GstElementvol_element = NULL;
+       mm_player_t *player = (mm_player_t *)hplayer;
+       GstElement *vol_element = NULL;
 
        MMPLAYER_FENTER();
 
@@ -5002,7 +5013,7 @@ _mmplayer_set_mute(MMHandleType hplayer, int mute)
 
        /* mute value shoud 0 or 1 */
        if (mute != 0 && mute != 1) {
-               LOGE("bad mute value\n");
+               LOGE("bad mute value");
 
                /* FIXIT : definitly, we need _BAD_PARAM error code */
                return MM_ERROR_INVALID_ARGUMENT;
@@ -5012,7 +5023,7 @@ _mmplayer_set_mute(MMHandleType hplayer, int mute)
 
        /* just hold mute value if pipeline is not ready */
        if (!player->pipeline || !player->pipeline->audiobin) {
-               LOGD("pipeline is not ready. holding mute value\n");
+               LOGD("pipeline is not ready. holding mute value");
                return MM_ERROR_NONE;
        }
 
@@ -5020,10 +5031,10 @@ _mmplayer_set_mute(MMHandleType hplayer, int mute)
 
        /* NOTE : volume will only created when the bt is enabled */
        if (vol_element) {
-               LOGD("mute : %d\n", mute);
+               LOGD("mute : %d", mute);
                g_object_set(vol_element, "mute", mute, NULL);
        } else
-               LOGD("volume elemnet is not created. using volume in audiosink\n");
+               LOGD("volume elemnet is not created. using volume in audiosink");
 
        MMPLAYER_FLEAVE();
 
@@ -5031,9 +5042,9 @@ _mmplayer_set_mute(MMHandleType hplayer, int mute)
 }
 
 int
-_mmplayer_get_mute(MMHandleType hplayer, intpmute)
+_mmplayer_get_mute(MMHandleType hplayer, int *pmute)
 {
-       mm_player_t* player = (mm_player_t*) hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
 
        MMPLAYER_FENTER();
 
@@ -5042,7 +5053,7 @@ _mmplayer_get_mute(MMHandleType hplayer, int* pmute)
 
        /* just hold mute value if pipeline is not ready */
        if (!player->pipeline || !player->pipeline->audiobin) {
-               LOGD("pipeline is not ready. returning stored value\n");
+               LOGD("pipeline is not ready. returning stored value");
                *pmute = player->sound.mute;
                return MM_ERROR_NONE;
        }
@@ -5057,7 +5068,7 @@ _mmplayer_get_mute(MMHandleType hplayer, int* pmute)
 int
 _mmplayer_set_videostream_changed_cb(MMHandleType hplayer, mm_player_stream_changed_callback callback, void *user_param)
 {
-       mm_player_t* player = (mm_player_t*) hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
 
        MMPLAYER_FENTER();
 
@@ -5065,7 +5076,7 @@ _mmplayer_set_videostream_changed_cb(MMHandleType hplayer, mm_player_stream_chan
 
        player->video_stream_changed_cb = callback;
        player->video_stream_changed_cb_user_param = user_param;
-       LOGD("Handle value is %p : %p\n", player, player->video_stream_changed_cb);
+       LOGD("Handle value is %p : %p", player, player->video_stream_changed_cb);
 
        MMPLAYER_FLEAVE();
 
@@ -5075,7 +5086,7 @@ _mmplayer_set_videostream_changed_cb(MMHandleType hplayer, mm_player_stream_chan
 int
 _mmplayer_set_audiostream_changed_cb(MMHandleType hplayer, mm_player_stream_changed_callback callback, void *user_param)
 {
-       mm_player_t* player = (mm_player_t*) hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
 
        MMPLAYER_FENTER();
 
@@ -5083,7 +5094,7 @@ _mmplayer_set_audiostream_changed_cb(MMHandleType hplayer, mm_player_stream_chan
 
        player->audio_stream_changed_cb = callback;
        player->audio_stream_changed_cb_user_param = user_param;
-       LOGD("Handle value is %p : %p\n", player, player->audio_stream_changed_cb);
+       LOGD("Handle value is %p : %p", player, player->audio_stream_changed_cb);
 
        MMPLAYER_FLEAVE();
 
@@ -5093,7 +5104,7 @@ _mmplayer_set_audiostream_changed_cb(MMHandleType hplayer, mm_player_stream_chan
 int
 _mmplayer_set_audiostream_cb(MMHandleType hplayer, bool sync, mm_player_audio_stream_callback callback, void *user_param)
 {
-       mm_player_t *player = (mm_player_t*) hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
 
        MMPLAYER_FENTER();
 
@@ -5112,7 +5123,7 @@ _mmplayer_set_audiostream_cb(MMHandleType hplayer, bool sync, mm_player_audio_st
 int
 _mmplayer_set_videostream_cb(MMHandleType hplayer, mm_player_video_stream_callback callback, void *user_param)
 {
-       mm_player_t* player = (mm_player_t*) hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
 
        MMPLAYER_FENTER();
 
@@ -5125,7 +5136,7 @@ _mmplayer_set_videostream_cb(MMHandleType hplayer, mm_player_video_stream_callba
        player->video_stream_cb = callback;
        player->video_stream_cb_user_param = user_param;
 
-       LOGD("Stream cb Handle value is %p : %p, enable:%d\n", player, player->video_stream_cb, player->set_mode.media_packet_video_stream);
+       LOGD("Stream cb Handle value is %p : %p, enable:%d", player, player->video_stream_cb, player->set_mode.media_packet_video_stream);
 
        MMPLAYER_FLEAVE();
 
@@ -5135,7 +5146,7 @@ _mmplayer_set_videostream_cb(MMHandleType hplayer, mm_player_video_stream_callba
 int
 _mmplayer_start(MMHandleType hplayer)
 {
-       mm_player_t* player = (mm_player_t*) hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
        gint ret = MM_ERROR_NONE;
 
        MMPLAYER_FENTER();
@@ -5148,7 +5159,7 @@ _mmplayer_start(MMHandleType hplayer)
        /* start pipeline */
        ret = __mmplayer_gst_start(player);
        if (ret != MM_ERROR_NONE)
-               LOGE("failed to start player.\n");
+               LOGE("failed to start player.");
 
        if ((player->streamer) && (player->streamer->buffering_state & MM_PLAYER_BUFFERING_IN_PROGRESS)) {
                LOGD("force playing start even during buffering");
@@ -5167,7 +5178,7 @@ _mmplayer_start(MMHandleType hplayer)
  * Because GST_ERROR_MESSAGE is posted by other plugin internally.
  */
 int
-__mmplayer_handle_missed_plugin(mm_player_tplayer)
+__mmplayer_handle_missed_plugin(mm_player_t *player)
 {
        MMMessageParamType msg_param;
        memset(&msg_param, 0, sizeof(MMMessageParamType));
@@ -5177,7 +5188,7 @@ __mmplayer_handle_missed_plugin(mm_player_t* player)
 
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
 
-       LOGD("not_supported_codec = 0x%02x, can_support_codec = 0x%02x\n",
+       LOGD("not_supported_codec = 0x%02x, can_support_codec = 0x%02x",
                        player->not_supported_codec, player->can_support_codec);
 
        if (player->not_found_demuxer) {
@@ -5204,12 +5215,12 @@ __mmplayer_handle_missed_plugin(mm_player_t* player)
                        memset(&msg_param, 0, sizeof(MMMessageParamType));
 
                        if (player->not_supported_codec ==  MISSING_PLUGIN_AUDIO) {
-                               LOGW("not found AUDIO codec, posting error code to application.\n");
+                               LOGW("not found AUDIO codec, posting error code to application.");
 
                                msg_param.code = MM_ERROR_PLAYER_AUDIO_CODEC_NOT_FOUND;
                                msg_param.data = g_strdup_printf("%s", player->unlinked_audio_mime);
                        } else if (player->not_supported_codec ==  MISSING_PLUGIN_VIDEO) {
-                               LOGW("not found VIDEO codec, posting error code to application.\n");
+                               LOGW("not found VIDEO codec, posting error code to application.");
 
                                msg_param.code = MM_ERROR_PLAYER_VIDEO_CODEC_NOT_FOUND;
                                msg_param.data = g_strdup_printf("%s", player->unlinked_video_mime);
@@ -5222,7 +5233,7 @@ __mmplayer_handle_missed_plugin(mm_player_t* player)
                        return MM_ERROR_NONE;
                } else {
                        // no any supported codec case
-                       LOGW("not found any codec, posting error code to application.\n");
+                       LOGW("not found any codec, posting error code to application.");
 
                        if (player->not_supported_codec ==  MISSING_PLUGIN_AUDIO) {
                                msg_param.code = MM_ERROR_PLAYER_AUDIO_CODEC_NOT_FOUND;
@@ -5243,34 +5254,35 @@ __mmplayer_handle_missed_plugin(mm_player_t* player)
        return MM_ERROR_NONE;
 }
 
-static void __mmplayer_check_pipeline(mm_player_t* player)
+static void
+__mmplayer_check_pipeline(mm_player_t *player)
 {
        GstState element_state = GST_STATE_VOID_PENDING;
        GstState element_pending_state = GST_STATE_VOID_PENDING;
        gint timeout = 0;
        int ret = MM_ERROR_NONE;
 
-       if (player->gapless.reconfigure) {
-               LOGW("pipeline is under construction.\n");
+       if (!player->gapless.reconfigure)
+               return;
 
-               MMPLAYER_PLAYBACK_LOCK(player);
-               MMPLAYER_PLAYBACK_UNLOCK(player);
+       LOGW("pipeline is under construction.");
 
-               timeout = MMPLAYER_STATE_CHANGE_TIMEOUT(player);
+       MMPLAYER_PLAYBACK_LOCK(player);
+       MMPLAYER_PLAYBACK_UNLOCK(player);
 
-               /* wait for state transition */
-               ret = gst_element_get_state(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, &element_state, &element_pending_state, timeout * GST_SECOND);
+       timeout = MMPLAYER_STATE_CHANGE_TIMEOUT(player);
 
-               if (ret == GST_STATE_CHANGE_FAILURE)
-                       LOGE("failed to change pipeline state within %d sec\n", timeout);
-       }
+       /* wait for state transition */
+       ret = gst_element_get_state(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, &element_state, &element_pending_state, timeout * GST_SECOND);
+       if (ret == GST_STATE_CHANGE_FAILURE)
+               LOGE("failed to change pipeline state within %d sec", timeout);
 }
 
 /* NOTE : it should be able to call 'stop' anytime*/
 int
 _mmplayer_stop(MMHandleType hplayer)
 {
-       mm_player_t* player = (mm_player_t*)hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
        int ret = MM_ERROR_NONE;
 
        MMPLAYER_FENTER();
@@ -5294,7 +5306,7 @@ _mmplayer_stop(MMHandleType hplayer)
        ret = __mmplayer_gst_stop(player);
 
        if (ret != MM_ERROR_NONE)
-               LOGE("failed to stop player.\n");
+               LOGE("failed to stop player.");
 
        MMPLAYER_FLEAVE();
 
@@ -5304,7 +5316,7 @@ _mmplayer_stop(MMHandleType hplayer)
 int
 _mmplayer_pause(MMHandleType hplayer)
 {
-       mm_player_t* player = (mm_player_t*)hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
        gint64 pos_nsec = 0;
        gboolean async = FALSE;
        gint ret = MM_ERROR_NONE;
@@ -5343,7 +5355,7 @@ _mmplayer_pause(MMHandleType hplayer)
                        * elements
                        */
                        if (!gst_element_query_position(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &pos_nsec))
-                               LOGW("getting current position failed in paused\n");
+                               LOGW("getting current position failed in paused");
 
                        player->last_position = pos_nsec;
 
@@ -5368,7 +5380,7 @@ _mmplayer_pause(MMHandleType hplayer)
        ret = __mmplayer_gst_pause(player, async);
 
        if (ret != MM_ERROR_NONE)
-               LOGE("failed to pause player. ret : 0x%x\n", ret);
+               LOGE("failed to pause player. ret : 0x%x", ret);
 
        if (MMPLAYER_PREV_STATE(player) == MM_PLAYER_STATE_READY && MMPLAYER_CURRENT_STATE(player) == MM_PLAYER_STATE_PAUSED) {
                if (MM_ERROR_NONE != _mmplayer_update_video_param(player, "display_rotation"))
@@ -5384,7 +5396,7 @@ _mmplayer_pause(MMHandleType hplayer)
 int
 _mmplayer_abort_pause(MMHandleType hplayer)
 {
-       mm_player_t* player = (mm_player_t*)hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
        int ret = MM_ERROR_NONE;
 
        MMPLAYER_FENTER();
@@ -5408,11 +5420,10 @@ _mmplayer_abort_pause(MMHandleType hplayer)
        return ret;
 }
 
-
 int
 _mmplayer_resume(MMHandleType hplayer)
 {
-       mm_player_t* player = (mm_player_t*)hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
        int ret = MM_ERROR_NONE;
        gboolean async = FALSE;
 
@@ -5436,7 +5447,7 @@ _mmplayer_resume(MMHandleType hplayer)
 
        ret = __mmplayer_gst_resume(player, async);
        if (ret != MM_ERROR_NONE)
-               LOGE("failed to resume player.\n");
+               LOGE("failed to resume player.");
 
        if ((player->streamer) && (player->streamer->buffering_state & MM_PLAYER_BUFFERING_IN_PROGRESS)) {
                LOGD("force resume even during buffering");
@@ -5451,7 +5462,7 @@ _mmplayer_resume(MMHandleType hplayer)
 int
 _mmplayer_set_playspeed(MMHandleType hplayer, float rate, bool streaming)
 {
-       mm_player_t* player = (mm_player_t*)hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
        gint64 pos_nsec = 0;
        int ret = MM_ERROR_NONE;
        int mute = FALSE;
@@ -5474,7 +5485,7 @@ _mmplayer_set_playspeed(MMHandleType hplayer, float rate, bool streaming)
 
        /* If the position is reached at start potion during fast backward, EOS is posted.
         * So, This EOS have to be classified with it which is posted at reaching the end of stream.
-        * */
+        */
        player->playback_rate = rate;
 
        current_state = MMPLAYER_CURRENT_STATE(player);
@@ -5504,11 +5515,11 @@ _mmplayer_set_playspeed(MMHandleType hplayer, float rate, bool streaming)
                                (GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE),
                                GST_SEEK_TYPE_SET, start,
                                GST_SEEK_TYPE_SET, stop)) {
-               LOGE("failed to set speed playback\n");
+               LOGE("failed to set speed playback");
                return MM_ERROR_PLAYER_SEEK;
        }
 
-       LOGD("succeeded to set speed playback as %0.1f\n", rate);
+       LOGD("succeeded to set speed playback as %0.1f", rate);
 
        MMPLAYER_FLEAVE();
 
@@ -5518,7 +5529,7 @@ _mmplayer_set_playspeed(MMHandleType hplayer, float rate, bool streaming)
 int
 _mmplayer_set_position(MMHandleType hplayer, gint64 position)
 {
-       mm_player_t* player = (mm_player_t*)hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
        int ret = MM_ERROR_NONE;
 
        MMPLAYER_FENTER();
@@ -5538,7 +5549,7 @@ _mmplayer_set_position(MMHandleType hplayer, gint64 position)
 int
 _mmplayer_get_position(MMHandleType hplayer, gint64 *position)
 {
-       mm_player_t* player = (mm_player_t*)hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
        int ret = MM_ERROR_NONE;
 
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
@@ -5551,7 +5562,7 @@ _mmplayer_get_position(MMHandleType hplayer, gint64 *position)
 int
 _mmplayer_get_duration(MMHandleType hplayer, gint64 *duration)
 {
-       mm_player_t* player = (mm_player_t*)hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
        int ret = MM_ERROR_NONE;
 
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
@@ -5564,7 +5575,7 @@ _mmplayer_get_duration(MMHandleType hplayer, gint64 *duration)
 int
 _mmplayer_get_buffer_position(MMHandleType hplayer, int *start_pos, int *end_pos)
 {
-       mm_player_t *player = (mm_player_t*)hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
        int ret = MM_ERROR_NONE;
 
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
@@ -5577,7 +5588,7 @@ _mmplayer_get_buffer_position(MMHandleType hplayer, int *start_pos, int *end_pos
 int
 _mmplayer_adjust_subtitle_postion(MMHandleType hplayer, int format, int position)
 {
-       mm_player_t* player = (mm_player_t*)hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
        int ret = MM_ERROR_NONE;
 
        MMPLAYER_FENTER();
@@ -5592,7 +5603,7 @@ _mmplayer_adjust_subtitle_postion(MMHandleType hplayer, int format, int position
 }
 
 static gboolean
-__mmplayer_is_midi_type(gcharstr_caps)
+__mmplayer_is_midi_type(gchar *str_caps)
 {
        if ((g_strrstr(str_caps, "audio/midi")) ||
                (g_strrstr(str_caps, "application/x-gst_ff-mmf")) ||
@@ -5601,7 +5612,7 @@ __mmplayer_is_midi_type(gchar* str_caps)
                (g_strrstr(str_caps, "audio/mobile-xmf")) ||
                (g_strrstr(str_caps, "audio/xmf")) ||
                (g_strrstr(str_caps, "audio/mxmf"))) {
-               LOGD("midi\n");
+               LOGD("midi");
                return TRUE;
        }
 
@@ -5618,9 +5629,9 @@ __mmplayer_is_only_mp3_type(gchar *str_caps)
 }
 
 static void
-__mmplayer_set_audio_attrs(mm_player_t* player, GstCaps* caps)
+__mmplayer_set_audio_attrs(mm_player_t *player, GstCaps *caps)
 {
-       GstStructurecaps_structure = NULL;
+       GstStructure *caps_structure = NULL;
        gint samplerate = 0;
        gint channels = 0;
 
@@ -5636,11 +5647,11 @@ __mmplayer_set_audio_attrs(mm_player_t* player, GstCaps* caps)
        gst_structure_get_int(caps_structure, "channels", &channels);
        mm_attrs_set_int_by_name(player->attrs, "content_audio_channels", channels);
 
-       LOGD("audio samplerate : %d     channels : %d\n", samplerate, channels);
+       LOGD("audio samplerate : %d     channels : %d", samplerate, channels);
 }
 
 static void
-__mmplayer_update_content_type_info(mm_player_tplayer)
+__mmplayer_update_content_type_info(mm_player_t *player)
 {
        MMPLAYER_FENTER();
        MMPLAYER_RETURN_IF_FAIL(player && player->type);
@@ -5671,10 +5682,10 @@ __mmplayer_update_content_type_info(mm_player_t* player)
 
 void
 __mmplayer_typefind_have_type(GstElement *tf, guint probability,
-GstCaps *caps, gpointer data)
+       GstCaps *caps, gpointer data)
 {
-       mm_player_t* player = (mm_player_t*)data;
-       GstPadpad = NULL;
+       mm_player_t *player = (mm_player_t *)data;
+       GstPad *pad = NULL;
 
        MMPLAYER_FENTER();
 
@@ -5683,14 +5694,13 @@ GstCaps *caps, gpointer data)
        /* store type string */
        MMPLAYER_FREEIF(player->type);
        player->type = gst_caps_to_string(caps);
-       if (player->type) {
-               LOGD("[handle: %p] media type %s found, probability %d%% / %d\n",
+       if (player->type)
+               LOGD("[handle: %p] media type %s found, probability %d%% / %d",
                                player, player->type, probability, gst_caps_get_size(caps));
-       }
 
        if ((!MMPLAYER_IS_RTSP_STREAMING(player)) &&
                (g_strrstr(player->type, "audio/x-raw-int"))) {
-               LOGE("not support media format\n");
+               LOGE("not support media format");
 
                if (player->msg_posted == FALSE) {
                        MMMessageParamType msg_param;
@@ -5709,13 +5719,13 @@ GstCaps *caps, gpointer data)
 
        pad = gst_element_get_static_pad(tf, "src");
        if (!pad) {
-               LOGE("fail to get typefind src pad.\n");
+               LOGE("fail to get typefind src pad.");
                return;
        }
 
        if (!__mmplayer_gst_create_decoder(player, pad, caps)) {
                gboolean async = FALSE;
-               LOGE("failed to autoplug %s\n", player->type);
+               LOGE("failed to autoplug %s", player->type);
 
                mm_attrs_get_int_by_name(player->attrs, "profile_prepare_async", &async);
 
@@ -5734,7 +5744,7 @@ DONE:
 }
 
 GstElement *
-__mmplayer_gst_make_decodebin(mm_player_tplayer)
+__mmplayer_gst_make_decodebin(mm_player_t *player)
 {
        GstElement *decodebin = NULL;
 
@@ -5744,7 +5754,7 @@ __mmplayer_gst_make_decodebin(mm_player_t* player)
        decodebin = gst_element_factory_make("decodebin", NULL);
 
        if (!decodebin) {
-               LOGE("fail to create decodebin\n");
+               LOGE("fail to create decodebin");
                goto ERROR;
        }
 
@@ -5786,10 +5796,10 @@ ERROR:
        return decodebin;
 }
 
-static GstElement*
+static GstElement *
 __mmplayer_gst_make_queue2(mm_player_t *player)
 {
-       GstElementqueue2 = NULL;
+       GstElement *queue2 = NULL;
        gint64 dur_bytes = 0L;
        guint max_buffer_size_bytes = 0;
        MMPlayerGstElement *mainbin = NULL;
@@ -5825,7 +5835,7 @@ __mmplayer_gst_make_queue2(mm_player_t *player)
        /* NOTE : in case of ts streaming, player cannot get the correct duration info *
         *                skip the pull mode(file or ring buffering) setting. */
        if (!g_strrstr(player->type, "video/mpegts")) {
-               max_buffer_size_bytes = (type == MUXED_BUFFER_TYPE_FILE) ? (player->ini.http_max_size_bytes) : (5*1024*1024);
+               max_buffer_size_bytes = (type == MUXED_BUFFER_TYPE_FILE) ? (player->ini.http_max_size_bytes) : (5 * 1024 * 1024);
                LOGD("max_buffer_size_bytes = %d", max_buffer_size_bytes);
 
                __mm_player_streaming_set_queue2(player->streamer,
@@ -5842,13 +5852,13 @@ __mmplayer_gst_make_queue2(mm_player_t *player)
 }
 
 gboolean
-__mmplayer_gst_create_decoder(mm_player_tplayer, GstPad *srcpad, const GstCaps *caps)
+__mmplayer_gst_create_decoder(mm_player_t *player, GstPad *srcpad, const GstCaps *caps)
 {
-       MMPlayerGstElementmainbin = NULL;
-       GstElementdecodebin = NULL;
-       GstElementqueue2 = NULL;
-       GstPadsinkpad = NULL;
-       GstPadqsrcpad = NULL;
+       MMPlayerGstElement *mainbin = NULL;
+       GstElement *decodebin = NULL;
+       GstElement *queue2 = NULL;
+       GstPad *sinkpad = NULL;
+       GstPad *qsrcpad = NULL;
        gint init_buffering_time = player->streamer->buffering_req.prebuffer_time;
 
        MMPLAYER_FENTER();
@@ -5904,7 +5914,7 @@ __mmplayer_gst_create_decoder(mm_player_t* player, GstPad *srcpad, const GstCaps
        }
 
        if (!gst_bin_add(GST_BIN(mainbin[MMPLAYER_M_PIPE].gst), decodebin)) {
-               LOGE("failed to add decodebin\n");
+               LOGE("failed to add decodebin");
                goto ERROR;
        }
 
@@ -5933,7 +5943,7 @@ __mmplayer_gst_create_decoder(mm_player_t* player, GstPad *srcpad, const GstCaps
        if (MMPLAYER_IS_HTTP_STREAMING(player) || MMPLAYER_IS_HTTP_LIVE_STREAMING(player) || MMPLAYER_IS_DASH_STREAMING(player)) {
            gdouble high_percent = 0.0;
 
-               init_buffering_time = (init_buffering_time != 0) ? (init_buffering_time) : (player->ini.http_buffering_time);
+               init_buffering_time = (init_buffering_time != 0) ? init_buffering_time : player->ini.http_buffering_time;
                high_percent = (gdouble)(init_buffering_time * 100) / GET_MAX_BUFFER_TIME(player->streamer);
 
                LOGD("decodebin setting - bytes: %d, time: %d ms, per: 1~%d",
@@ -5947,7 +5957,7 @@ __mmplayer_gst_create_decoder(mm_player_t* player, GstPad *srcpad, const GstCaps
        }
 
        if (GST_STATE_CHANGE_FAILURE == gst_element_sync_state_with_parent(decodebin)) {
-               LOGE("failed to sync decodebin state with parent\n");
+               LOGE("failed to sync decodebin state with parent");
                goto ERROR;
        }
 
@@ -5995,14 +6005,14 @@ ERROR:
 }
 
 static int
-__mmplayer_check_not_supported_codec(mm_player_t* player, const gchar* factory_class, const gchar* mime)
+__mmplayer_check_not_supported_codec(mm_player_t *player, const gchar *factory_class, const gchar *mime)
 {
        MMPLAYER_FENTER();
 
        MMPLAYER_RETURN_VAL_IF_FAIL(player && player->pipeline, MM_ERROR_PLAYER_NOT_INITIALIZED);
        MMPLAYER_RETURN_VAL_IF_FAIL(mime, MM_ERROR_INVALID_ARGUMENT);
 
-       LOGD("class : %s, mime : %s \n", factory_class, mime);
+       LOGD("class : %s, mime : %s", factory_class, mime);
 
        /* add missing plugin */
        /* NOTE : msl should check missing plugin for image mime type.
@@ -6011,7 +6021,7 @@ __mmplayer_check_not_supported_codec(mm_player_t* player, const gchar* factory_c
         */
        if (!(player->pipeline->mainbin[MMPLAYER_M_DEMUX].gst)) {
                if (!(player->can_support_codec | player->videodec_linked | player->audiodec_linked)) {
-                       LOGD("not found demuxer\n");
+                       LOGD("not found demuxer");
                        player->not_found_demuxer = TRUE;
                        player->unlinked_demuxer_mime = g_strdup_printf("%s", mime);
 
@@ -6021,22 +6031,22 @@ __mmplayer_check_not_supported_codec(mm_player_t* player, const gchar* factory_c
 
        if (!g_strrstr(factory_class, "Demuxer")) {
                if ((g_str_has_prefix(mime, "video")) || (g_str_has_prefix(mime, "image"))) {
-                       LOGD("can support codec=0x%X, vdec_linked=%d, adec_linked=%d\n",
+                       LOGD("can support codec=0x%X, vdec_linked=%d, adec_linked=%d",
                                player->can_support_codec, player->videodec_linked, player->audiodec_linked);
 
                        /* check that clip have multi tracks or not */
                        if ((player->can_support_codec & FOUND_PLUGIN_VIDEO) && (player->videodec_linked)) {
-                               LOGD("video plugin is already linked\n");
+                               LOGD("video plugin is already linked");
                        } else {
-                               LOGW("add VIDEO to missing plugin\n");
+                               LOGW("add VIDEO to missing plugin");
                                player->not_supported_codec |= MISSING_PLUGIN_VIDEO;
                                player->unlinked_video_mime = g_strdup_printf("%s", mime);
                        }
                } else if (g_str_has_prefix(mime, "audio")) {
                        if ((player->can_support_codec & FOUND_PLUGIN_AUDIO) && (player->audiodec_linked)) {
-                               LOGD("audio plugin is already linked\n");
+                               LOGD("audio plugin is already linked");
                        } else {
-                               LOGW("add AUDIO to missing plugin\n");
+                               LOGW("add AUDIO to missing plugin");
                                player->not_supported_codec |= MISSING_PLUGIN_AUDIO;
                                player->unlinked_audio_mime = g_strdup_printf("%s", mime);
                        }
@@ -6049,11 +6059,10 @@ DONE:
        return MM_ERROR_NONE;
 }
 
-
 static void
 __mmplayer_pipeline_complete(GstElement *decodebin,  gpointer data)
 {
-       mm_player_t* player = (mm_player_t*)data;
+       mm_player_t *player = (mm_player_t *)data;
 
        MMPLAYER_FENTER();
 
@@ -6118,12 +6127,12 @@ __mmplayer_get_next_uri(mm_player_t *player)
        LOGD("num of uri list = %d, current uri idx %d", num_of_list, uri_idx);
        for (uri_idx++; uri_idx < num_of_list; uri_idx++) {
                uri = g_list_nth_data(player->uri_info.uri_list, uri_idx);
-               if (uri == NULL) {
+               if (!uri) {
                        LOGW("next uri does not exist");
                        continue;
                }
 
-               if (__mmplayer_parse_profile((const char*)uri, NULL, &profile) != MM_ERROR_NONE) {
+               if (__mmplayer_parse_profile((const char *)uri, NULL, &profile) != MM_ERROR_NONE) {
                        LOGE("failed to parse profile");
                        continue;
                }
@@ -6173,13 +6182,13 @@ __mmplayer_verify_gapless_play_path(mm_player_t *player)
        LOGD("checking for gapless play option");
 
        if (player->pipeline->textbin) {
-               LOGE("subtitle path is enabled. gapless play is not supported.\n");
+               LOGE("subtitle path is enabled. gapless play is not supported.");
                goto ERROR;
        }
 
        attrs = MMPLAYER_GET_ATTRS(player);
        if (!attrs) {
-               LOGE("fail to get attributes.\n");
+               LOGE("fail to get attributes.");
                goto ERROR;
        }
 
@@ -6215,17 +6224,15 @@ __mmplayer_verify_gapless_play_path(mm_player_t *player)
                        /* decrease play count */
                        /* we succeeded to rewind. update play count and then wait for next EOS */
                        count--;
-
                        mm_attrs_set_int_by_name(attrs, "profile_play_count", count);
-
                        /* commit attribute */
                        if (mm_attrs_commit_all(attrs))
                                LOGE("failed to commit attribute");
+
                } else if (count != REPEAT_COUNT_INFINITELY) {
                        LOGD("there is no next uri and no repeat");
                        goto ERROR;
                }
-
                LOGD("looping cnt %d", count);
        } else {
                /* gapless playback path */
@@ -6234,7 +6241,6 @@ __mmplayer_verify_gapless_play_path(mm_player_t *player)
                        goto ERROR;
                }
        }
-
        return TRUE;
 
 ERROR:
@@ -6257,7 +6263,7 @@ __mmplayer_initialize_gapless_play(mm_player_t *player)
        player->is_external_subtitle_added_now = FALSE;
        player->not_supported_codec = MISSING_PLUGIN_NONE;
        player->can_support_codec = FOUND_PLUGIN_NONE;
-       player->pending_seek.is_pending = FALSE;
+       player->pending_seek.is_pending = false;
        player->pending_seek.pos = 0;
        player->msg_posted = FALSE;
        player->has_many_types = FALSE;
@@ -6342,7 +6348,7 @@ __mmplayer_activate_next_source(mm_player_t *player, GstState target)
 
        mm_attrs_get_string_by_name(attrs, "profile_uri", &uri);
 
-       if (__mmplayer_parse_profile((const char*)uri, NULL, &player->profile) != MM_ERROR_NONE) {
+       if (__mmplayer_parse_profile((const char *)uri, NULL, &player->profile) != MM_ERROR_NONE) {
                LOGE("failed to parse profile");
                msg_param.code = MM_ERROR_PLAYER_INVALID_URI;
                goto ERROR;
@@ -6577,46 +6583,49 @@ ERROR:
        return;
 }
 
-int _mmplayer_set_file_buffering_path(MMHandleType hplayer, const char* file_path)
+int
+_mmplayer_set_file_buffering_path(MMHandleType hplayer, const char *file_path)
 {
        int result = MM_ERROR_NONE;
-       mm_player_t* player = (mm_player_t*) hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
        MMPLAYER_FENTER();
 
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
 
        if (file_path) {
-               player->http_file_buffering_path = (gchar*)file_path;
-               LOGD("temp file path: %s\n", player->http_file_buffering_path);
+               player->http_file_buffering_path = (gchar *)file_path;
+               LOGD("temp file path: %s", player->http_file_buffering_path);
        }
        MMPLAYER_FLEAVE();
        return result;
 }
 
-int _mmplayer_set_uri(MMHandleType hplayer, const char* uri)
+int
+_mmplayer_set_uri(MMHandleType hplayer, const char *uri)
 {
        int result = MM_ERROR_NONE;
-       mm_player_t* player = (mm_player_t*) hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
        MMPLAYER_FENTER();
 
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
 
        mm_attrs_set_string_by_name(player->attrs, "profile_uri", uri);
        if (mm_attrs_commit_all(player->attrs)) {
-               LOGE("failed to commit the original uri.\n");
+               LOGE("failed to commit the original uri.");
                result = MM_ERROR_PLAYER_INTERNAL;
        } else {
                if (_mmplayer_set_next_uri(hplayer, uri, TRUE) != MM_ERROR_NONE)
-                       LOGE("failed to add the original uri in the uri list.\n");
+                       LOGE("failed to add the original uri in the uri list.");
        }
 
        MMPLAYER_FLEAVE();
        return result;
 }
 
-int _mmplayer_set_next_uri(MMHandleType hplayer, const char* uri, bool is_first_path)
+int
+_mmplayer_set_next_uri(MMHandleType hplayer, const char *uri, bool is_first_path)
 {
-       mm_player_t* player = (mm_player_t*) hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
        guint num_of_list = 0;
 
        MMPLAYER_FENTER();
@@ -6625,13 +6634,13 @@ int _mmplayer_set_next_uri(MMHandleType hplayer, const char* uri, bool is_first_
        MMPLAYER_RETURN_VAL_IF_FAIL(uri, MM_ERROR_INVALID_ARGUMENT);
 
        if (player->pipeline && player->pipeline->textbin) {
-               LOGE("subtitle path is enabled.\n");
+               LOGE("subtitle path is enabled.");
                return MM_ERROR_PLAYER_INVALID_STATE;
        }
 
        num_of_list = g_list_length(player->uri_info.uri_list);
 
-       if (is_first_path == TRUE) {
+       if (is_first_path) {
                if (num_of_list == 0) {
                        player->uri_info.uri_list = g_list_append(player->uri_info.uri_list, g_strdup(uri));
                        LOGD("add original path : %s", uri);
@@ -6671,9 +6680,10 @@ int _mmplayer_set_next_uri(MMHandleType hplayer, const char* uri, bool is_first_
        return MM_ERROR_NONE;
 }
 
-int _mmplayer_get_next_uri(MMHandleType hplayer, char** uri)
+int
+_mmplayer_get_next_uri(MMHandleType hplayer, char **uri)
 {
-       mm_player_t* player = (mm_player_t*) hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
        char *next_uri = NULL;
        guint num_of_list = 0;
 
@@ -6691,7 +6701,7 @@ int _mmplayer_get_next_uri(MMHandleType hplayer, char** uri)
                        uri_idx = 0;
 
                next_uri = g_list_nth_data(player->uri_info.uri_list, uri_idx);
-               LOGE("next uri idx : %d, uri = %s\n", uri_idx, next_uri);
+               LOGE("next uri idx : %d, uri = %s", uri_idx, next_uri);
 
                *uri = g_strdup(next_uri);
        }
@@ -6701,13 +6711,13 @@ int _mmplayer_get_next_uri(MMHandleType hplayer, char** uri)
 }
 
 static void
-__mmplayer_gst_decode_unknown_type(GstElement *elem,  GstPadpad,
-GstCaps *caps, gpointer data)
+__mmplayer_gst_decode_unknown_type(GstElement *elem,  GstPad *pad,
+       GstCaps *caps, gpointer data)
 {
-       mm_player_t* player = (mm_player_t*)data;
-       const gcharklass = NULL;
-       const gcharmime = NULL;
-       gcharcaps_str = NULL;
+       mm_player_t *player = (mm_player_t *)data;
+       const gchar *klass = NULL;
+       const gchar *mime = NULL;
+       gchar *caps_str = NULL;
 
        klass = gst_element_factory_get_metadata(gst_element_get_factory(elem), GST_ELEMENT_METADATA_KLASS);
        mime = gst_structure_get_name(gst_caps_get_structure(caps, 0));
@@ -6723,18 +6733,18 @@ GstCaps *caps, gpointer data)
 }
 
 static gboolean
-__mmplayer_gst_decode_autoplug_continue(GstElement *bin,  GstPadpad,
-GstCaps * caps,  gpointer data)
+__mmplayer_gst_decode_autoplug_continue(GstElement *bin,  GstPad *pad,
+       GstCaps *caps,  gpointer data)
 {
-       mm_player_t* player = (mm_player_t*)data;
-       const charmime = NULL;
+       mm_player_t *player = (mm_player_t *)data;
+       const char *mime = NULL;
        gboolean ret = TRUE;
 
        MMPLAYER_LOG_GST_CAPS_TYPE(caps);
        mime = gst_structure_get_name(gst_caps_get_structure(caps, 0));
 
        if (g_str_has_prefix(mime, "audio")) {
-               GstStructurecaps_structure = NULL;
+               GstStructure *caps_structure = NULL;
                gint samplerate = 0;
                gint channels = 0;
                gchar *caps_str = NULL;
@@ -6771,7 +6781,7 @@ GstCaps * caps,  gpointer data)
 }
 
 static int
-__mmplayer_check_codec_info(mm_player_t* player, const char* klass, GstCaps* caps, char* factory_name)
+__mmplayer_check_codec_info(mm_player_t *player, const char *klass, GstCaps *caps, char *factory_name)
 {
        int ret = MM_ERROR_NONE;
        int idx = 0;
@@ -6856,7 +6866,7 @@ __mmplayer_check_codec_info(mm_player_t* player, const char* klass, GstCaps* cap
                        /* acquire resources for video playing */
                        if (mm_resource_manager_commit(player->resource_manager)
                                        != MM_RESOURCE_MANAGER_ERROR_NONE) {
-                               LOGE("could not acquire resources for video decoding\n");
+                               LOGE("could not acquire resources for video decoding");
                                ret = MM_ERROR_PLAYER_INTERNAL;
                                goto DONE;
                        }
@@ -6873,8 +6883,8 @@ DONE:
 }
 
 gint
-__mmplayer_gst_decode_autoplug_select(GstElement *bin,  GstPadpad,
-GstCaps* caps, GstElementFactory* factory, gpointer data)
+__mmplayer_gst_decode_autoplug_select(GstElement *bin,  GstPad *pad,
+       GstCaps *caps, GstElementFactory *factory, gpointer data)
 {
        /* NOTE : GstAutoplugSelectResult is defined in gstplay-enum.h but not exposed
         We are defining our own and will be removed when it actually exposed */
@@ -6885,11 +6895,11 @@ GstCaps* caps, GstElementFactory* factory, gpointer data)
        } GstAutoplugSelectResult;
 
        GstAutoplugSelectResult result = GST_AUTOPLUG_SELECT_TRY;
-       mm_player_t* player = (mm_player_t*)data;
+       mm_player_t *player = (mm_player_t *)data;
 
-       gcharfactory_name = NULL;
-       gcharcaps_str = NULL;
-       const gcharklass = NULL;
+       gchar *factory_name = NULL;
+       gchar *caps_str = NULL;
+       const gchar *klass = NULL;
        gint idx = 0;
 
        factory_name = GST_OBJECT_NAME(factory);
@@ -6942,7 +6952,7 @@ GstCaps* caps, GstElementFactory* factory, gpointer data)
         * So, those plugins should be skipped for error handling.
         */
        if (g_strrstr(klass, "Codec/Decoder/Image")) {
-               LOGD("skipping [%s] by not required\n", factory_name);
+               LOGD("skipping [%s] by not required", factory_name);
                result = GST_AUTOPLUG_SELECT_SKIP;
                goto DONE;
        }
@@ -6950,13 +6960,13 @@ GstCaps* caps, GstElementFactory* factory, gpointer data)
        if ((MMPLAYER_IS_MS_BUFF_SRC(player)) &&
                (g_strrstr(klass, "Codec/Demuxer") || (g_strrstr(klass, "Codec/Parser")))) {
                // TO CHECK : subtitle if needed, add subparse exception.
-               LOGD("skipping parser/demuxer [%s] in es player by not required\n", factory_name);
+               LOGD("skipping parser/demuxer [%s] in es player by not required", factory_name);
                result = GST_AUTOPLUG_SELECT_SKIP;
                goto DONE;
        }
 
        if (g_strrstr(factory_name, "mpegpsdemux")) {
-               LOGD("skipping PS container - not support\n");
+               LOGD("skipping PS container - not support");
                result = GST_AUTOPLUG_SELECT_SKIP;
                goto DONE;
        }
@@ -7011,30 +7021,33 @@ DONE:
 }
 
 static void
-__mmplayer_gst_decode_pad_removed(GstElement *elem,  GstPadnew_pad,
-gpointer data)
+__mmplayer_gst_decode_pad_removed(GstElement *elem,  GstPad *new_pad,
+       gpointer data)
 {
-       //mm_player_t* player = (mm_player_t*)data;
-       GstCapscaps = NULL;
+       //mm_player_t *player = (mm_player_t *)data;
+       GstCaps *caps = NULL;
 
-       LOGD("[Decodebin2] pad-removed signal\n");
+       LOGD("[Decodebin2] pad-removed signal");
 
        caps = gst_pad_query_caps(new_pad, NULL);
-       if (caps) {
-               gchar* caps_str = NULL;
-               caps_str = gst_caps_to_string(caps);
+       if (!caps) {
+               LOGW("query caps is NULL");
+               return;
+       }
 
-               LOGD("pad removed caps : %s from %s", caps_str, GST_ELEMENT_NAME(elem));
+       gchar *caps_str = NULL;
+       caps_str = gst_caps_to_string(caps);
 
-               MMPLAYER_FREEIF(caps_str);
-               gst_caps_unref(caps);
-       }
+       LOGD("pad removed caps : %s from %s", caps_str, GST_ELEMENT_NAME(elem));
+
+       MMPLAYER_FREEIF(caps_str);
+       gst_caps_unref(caps);
 }
 
 static void
 __mmplayer_gst_decode_drained(GstElement *bin, gpointer data)
 {
-       mm_player_t* player = (mm_player_t*)data;
+       mm_player_t *player = (mm_player_t *)data;
        GstIterator *iter = NULL;
        GValue item = { 0, };
        GstPad *pad = NULL;
@@ -7108,28 +7121,28 @@ __mmplayer_gst_decode_drained(GstElement *bin, gpointer data)
 void
 __mmplayer_gst_element_added(GstElement *bin, GstElement *element, gpointer data)
 {
-       mm_player_t* player = (mm_player_t*)data;
-       const gcharklass = NULL;
-       gcharfactory_name = NULL;
+       mm_player_t *player = (mm_player_t *)data;
+       const gchar *klass = NULL;
+       gchar *factory_name = NULL;
 
        klass = gst_element_factory_get_metadata(gst_element_get_factory(element), GST_ELEMENT_METADATA_KLASS);
        factory_name = GST_OBJECT_NAME(gst_element_get_factory(element));
 
-       LOGD("new elem klass: %s, factory_name: %s, new elem name : %s\n", klass, factory_name, GST_ELEMENT_NAME(element));
+       LOGD("new elem klass: %s, factory_name: %s, new elem name : %s", klass, factory_name, GST_ELEMENT_NAME(element));
 
        if (__mmplayer_add_dump_buffer_probe(player, element))
                LOGD("add buffer probe");
 
        //<-
        if (g_strrstr(klass, "Codec/Decoder/Audio")) {
-               gcharselected = NULL;
+               gchar *selected = NULL;
                selected = g_strdup(GST_ELEMENT_NAME(element));
                player->audio_decoders = g_list_append(player->audio_decoders, selected);
        }
        //-> temp code
 
        if (g_strrstr(klass, "Parser")) {
-               gcharselected = NULL;
+               gchar *selected = NULL;
 
                selected = g_strdup(factory_name);
                player->parsers = g_list_append(player->parsers, selected);
@@ -7161,10 +7174,10 @@ __mmplayer_gst_element_added(GstElement *bin, GstElement *element, gpointer data
 
        // to support trust-zone only
        if (g_strrstr(factory_name, "asfdemux")) {
-               LOGD("set file-location %s\n", player->profile.uri);
+               LOGD("set file-location %s", player->profile.uri);
                g_object_set(G_OBJECT(element), "file-location", player->profile.uri, NULL);
        } else if (g_strrstr(factory_name, "legacyh264parse")) {
-               LOGD("[%s] output-format to legacyh264parse\n", "mssdemux");
+               LOGD("[%s] output-format to legacyh264parse", "mssdemux");
                g_object_set(G_OBJECT(element), "output-format", 1, NULL); /* NALU/Byte Stream format */
        } else if (g_strrstr(factory_name, "mpegaudioparse")) {
                if ((MMPLAYER_IS_HTTP_STREAMING(player)) &&
@@ -7197,7 +7210,7 @@ __mmplayer_gst_element_added(GstElement *bin, GstElement *element, gpointer data
 }
 
 static void
-__mmplayer_release_misc(mm_player_tplayer)
+__mmplayer_release_misc(mm_player_t *player)
 {
        int i;
        bool cur_mode = player->set_mode.rich_audio;
@@ -7207,7 +7220,7 @@ __mmplayer_release_misc(mm_player_t* player)
 
        player->video_stream_cb = NULL;
        player->video_stream_cb_user_param = NULL;
-       player->video_stream_prerolled = FALSE;
+       player->video_stream_prerolled = false;
 
        player->audio_stream_render_cb = NULL;
        player->audio_stream_cb_user_param = NULL;
@@ -7234,7 +7247,7 @@ __mmplayer_release_misc(mm_player_t* player)
        player->http_content_size = 0;
        player->not_supported_codec = MISSING_PLUGIN_NONE;
        player->can_support_codec = FOUND_PLUGIN_NONE;
-       player->pending_seek.is_pending = FALSE;
+       player->pending_seek.is_pending = false;
        player->pending_seek.pos = 0;
        player->msg_posted = FALSE;
        player->has_many_types = FALSE;
@@ -7300,7 +7313,7 @@ __mmplayer_release_misc(mm_player_t* player)
 }
 
 static void
-__mmplayer_release_misc_post(mm_player_tplayer)
+__mmplayer_release_misc_post(mm_player_t *player)
 {
        char *original_uri = NULL;
        MMPLAYER_FENTER();
@@ -7339,10 +7352,10 @@ __mmplayer_release_misc_post(mm_player_t* player)
 
                if (player->attrs) {
                        mm_attrs_set_string_by_name(player->attrs, "profile_uri", original_uri);
-                       LOGD("restore original uri = %s\n", original_uri);
+                       LOGD("restore original uri = %s", original_uri);
 
                        if (mm_attrs_commit_all(player->attrs))
-                               LOGE("failed to commit the original uri.\n");
+                               LOGE("failed to commit the original uri.");
                }
 
                GList *uri_list = player->uri_info.uri_list;
@@ -7373,7 +7386,7 @@ __mmplayer_release_misc_post(mm_player_t* player)
 }
 
 gboolean
-__mmplayer_check_subtitle(mm_player_tplayer)
+__mmplayer_check_subtitle(mm_player_t *player)
 {
        MMHandleType attrs = 0;
        char *subtitle_uri = NULL;
@@ -7400,7 +7413,7 @@ __mmplayer_check_subtitle(mm_player_t* player)
 }
 
 void
-__mmplayer_cancel_eos_timer(mm_player_tplayer)
+__mmplayer_cancel_eos_timer(mm_player_t *player)
 {
        MMPLAYER_RETURN_IF_FAIL(player);
 
@@ -7414,38 +7427,36 @@ __mmplayer_cancel_eos_timer(mm_player_t* player)
 }
 
 static void
-__mmplayer_add_sink(mm_player_t* player, GstElement* sink)
+__mmplayer_add_sink(mm_player_t *player, GstElement *sink)
 {
        MMPLAYER_FENTER();
 
        MMPLAYER_RETURN_IF_FAIL(player);
        MMPLAYER_RETURN_IF_FAIL(sink);
 
-       player->sink_elements =
-               g_list_append(player->sink_elements, sink);
+       player->sink_elements = g_list_append(player->sink_elements, sink);
 
        MMPLAYER_FLEAVE();
 }
 
 static void
-__mmplayer_del_sink(mm_player_t* player, GstElement* sink)
+__mmplayer_del_sink(mm_player_t *player, GstElement *sink)
 {
        MMPLAYER_FENTER();
 
        MMPLAYER_RETURN_IF_FAIL(player);
        MMPLAYER_RETURN_IF_FAIL(sink);
 
-       player->sink_elements =
-                       g_list_remove(player->sink_elements, sink);
+       player->sink_elements = g_list_remove(player->sink_elements, sink);
 
        MMPLAYER_FLEAVE();
 }
 
 void
-__mmplayer_add_signal_connection(mm_player_t* player, GObject* object,
-                       MMPlayerSignalType type, const gchar* signal, GCallback cb_funct, gpointer u_data)
+__mmplayer_add_signal_connection(mm_player_t *player, GObject *object,
+       MMPlayerSignalType type, const gchar *signal, GCallback cb_funct, gpointer u_data)
 {
-       MMPlayerSignalItemitem = NULL;
+       MMPlayerSignalItem *item = NULL;
 
        MMPLAYER_FENTER();
        MMPLAYER_RETURN_IF_FAIL(player);
@@ -7455,7 +7466,7 @@ __mmplayer_add_signal_connection(mm_player_t* player, GObject* object,
                return;
        }
 
-       item = (MMPlayerSignalItem*)g_malloc(sizeof(MMPlayerSignalItem));
+       item = (MMPlayerSignalItem *)g_try_malloc(sizeof(MMPlayerSignalItem));
        if (!item) {
                LOGE("cannot connect signal [%s]", signal);
                return;
@@ -7487,10 +7498,10 @@ __mmplayer_add_signal_connection(mm_player_t* player, GObject* object,
  *    g_signal_handler_disconnect(instance, id);
  */
 static void
-__mmplayer_release_signal_connection(mm_player_tplayer, MMPlayerSignalType type)
+__mmplayer_release_signal_connection(mm_player_t *player, MMPlayerSignalType type)
 {
-       GListsig_list = NULL;
-       MMPlayerSignalItemitem = NULL;
+       GList *sig_list = NULL;
+       MMPlayerSignalItem *item = NULL;
 
        MMPLAYER_FENTER();
 
@@ -7528,9 +7539,10 @@ __mmplayer_release_signal_connection(mm_player_t* player, MMPlayerSignalType typ
        return;
 }
 
-int _mmplayer_change_videosink(MMHandleType handle, MMDisplaySurfaceType surface_type, void *display_overlay)
+int
+_mmplayer_change_videosink(MMHandleType handle, MMDisplaySurfaceType surface_type, void *display_overlay)
 {
-       mm_player_tplayer = 0;
+       mm_player_t *player = 0;
        int prev_display_surface_type = 0;
        void *prev_display_overlay = NULL;
 
@@ -7586,9 +7598,10 @@ int _mmplayer_change_videosink(MMHandleType handle, MMDisplaySurfaceType surface
 }
 
 /* Note : if silent is true, then subtitle would not be displayed. :*/
-int _mmplayer_set_subtitle_silent(MMHandleType hplayer, int silent)
+int
+_mmplayer_set_subtitle_silent(MMHandleType hplayer, int silent)
 {
-       mm_player_t* player = (mm_player_t*) hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
 
        MMPLAYER_FENTER();
 
@@ -7597,17 +7610,18 @@ int _mmplayer_set_subtitle_silent(MMHandleType hplayer, int silent)
 
        player->set_mode.subtitle_off = silent;
 
-       LOGD("subtitle is %s.\n", player->set_mode.subtitle_off ? "ON" : "OFF");
+       LOGD("subtitle is %s.", player->set_mode.subtitle_off ? "ON" : "OFF");
 
        MMPLAYER_FLEAVE();
 
        return MM_ERROR_NONE;
 }
 
-int _mmplayer_sync_subtitle_pipeline(mm_player_t* player)
+int
+_mmplayer_sync_subtitle_pipeline(mm_player_t *player)
 {
-       MMPlayerGstElementmainbin = NULL;
-       MMPlayerGstElementtextbin = NULL;
+       MMPlayerGstElement *mainbin = NULL;
+       MMPlayerGstElement *textbin = NULL;
        GstStateChangeReturn ret = GST_STATE_CHANGE_FAILURE;
        GstState current_state = GST_STATE_VOID_PENDING;
        GstState element_state = GST_STATE_VOID_PENDING;
@@ -7651,7 +7665,7 @@ int _mmplayer_sync_subtitle_pipeline(mm_player_t* player)
 
                ret = gst_element_get_state(mainbin[MMPLAYER_M_SUBSRC].gst, &element_state, &element_pending_state, 5 * GST_SECOND);
                if (GST_STATE_CHANGE_FAILURE == ret) {
-                       LOGE("fail to state change.\n");
+                       LOGE("fail to state change.");
                        result = MM_ERROR_PLAYER_INTERNAL;
                        goto ERROR;
                }
@@ -7667,7 +7681,7 @@ int _mmplayer_sync_subtitle_pipeline(mm_player_t* player)
        // seek to current position
        if (!gst_element_query_position(mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &time)) {
                result = MM_ERROR_PLAYER_INVALID_STATE;
-               LOGE("gst_element_query_position failed, invalid state\n");
+               LOGE("gst_element_query_position failed, invalid state");
                goto ERROR;
        }
 
@@ -7708,16 +7722,16 @@ ERROR:
 }
 
 static int
-__mmplayer_change_external_subtitle_language(mm_player_t* player, const char* filepath)
+__mmplayer_change_external_subtitle_language(mm_player_t *player, const char *filepath)
 {
        GstStateChangeReturn ret = GST_STATE_CHANGE_FAILURE;
        GstState current_state = GST_STATE_VOID_PENDING;
 
        MMHandleType attrs = 0;
-       MMPlayerGstElementmainbin = NULL;
-       MMPlayerGstElementtextbin = NULL;
+       MMPlayerGstElement *mainbin = NULL;
+       MMPlayerGstElement *textbin = NULL;
 
-       gcharsubtitle_uri = NULL;
+       gchar *subtitle_uri = NULL;
        int result = MM_ERROR_NONE;
        const gchar *charset = NULL;
 
@@ -7736,20 +7750,20 @@ __mmplayer_change_external_subtitle_language(mm_player_t* player, const char* fi
        current_state = GST_STATE(mainbin[MMPLAYER_M_PIPE].gst);
        if (current_state < GST_STATE_READY) {
                result = MM_ERROR_PLAYER_INVALID_STATE;
-               LOGE("Pipeline is not in proper state\n");
+               LOGE("Pipeline is not in proper state");
                goto EXIT;
        }
 
        attrs = MMPLAYER_GET_ATTRS(player);
        if (!attrs) {
-               LOGE("cannot get content attribute\n");
+               LOGE("cannot get content attribute");
                result = MM_ERROR_PLAYER_INTERNAL;
                goto EXIT;
        }
 
        mm_attrs_get_string_by_name(attrs, "subtitle_uri", &subtitle_uri);
        if (!subtitle_uri || strlen(subtitle_uri) < 1) {
-               LOGE("subtitle uri is not proper filepath\n");
+               LOGE("subtitle uri is not proper filepath");
                result = MM_ERROR_PLAYER_INVALID_URI;
                goto EXIT;
        }
@@ -7760,16 +7774,16 @@ __mmplayer_change_external_subtitle_language(mm_player_t* player, const char* fi
                goto EXIT;
        }
 
-       LOGD("old subtitle file path is [%s]\n", subtitle_uri);
-       LOGD("new subtitle file path is [%s]\n", filepath);
+       LOGD("old subtitle file path is [%s]", subtitle_uri);
+       LOGD("new subtitle file path is [%s]", filepath);
 
        if (!strcmp(filepath, subtitle_uri)) {
-               LOGD("No need to swtich subtitle, as input filepath is same as current filepath\n");
+               LOGD("No need to swtich subtitle, as input filepath is same as current filepath");
                goto EXIT;
        } else {
                mm_attrs_set_string_by_name(player->attrs, "subtitle_uri", filepath);
                if (mm_attrs_commit_all(player->attrs)) {
-                       LOGE("failed to commit.\n");
+                       LOGE("failed to commit.");
                        goto EXIT;
                }
        }
@@ -7806,7 +7820,7 @@ __mmplayer_change_external_subtitle_language(mm_player_t* player, const char* fi
 
        charset = util_get_charset(filepath);
        if (charset) {
-               LOGD("detected charset is %s\n", charset);
+               LOGD("detected charset is %s", charset);
                g_object_set(G_OBJECT(mainbin[MMPLAYER_M_SUBPARSE].gst), "subtitle-encoding", charset, NULL);
        }
 
@@ -7818,10 +7832,11 @@ EXIT:
 }
 
 /* API to switch between external subtitles */
-int _mmplayer_set_external_subtitle_path(MMHandleType hplayer, const char* filepath)
+int
+_mmplayer_set_external_subtitle_path(MMHandleType hplayer, const char *filepath)
 {
        int result = MM_ERROR_NONE;
-       mm_player_t* player = (mm_player_t*)hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
        char *path = NULL;
 
        MMPLAYER_FENTER();
@@ -7889,14 +7904,14 @@ int _mmplayer_set_external_subtitle_path(MMHandleType hplayer, const char* filep
 }
 
 static int
-__mmplayer_change_selector_pad(mm_player_tplayer, MMPlayerTrackType type, int index)
+__mmplayer_change_selector_pad(mm_player_t *player, MMPlayerTrackType type, int index)
 {
        int result = MM_ERROR_NONE;
-       gcharchange_pad_name = NULL;
-       GstPadsinkpad = NULL;
-       MMPlayerGstElementmainbin = NULL;
+       gchar *change_pad_name = NULL;
+       GstPad *sinkpad = NULL;
+       MMPlayerGstElement *mainbin = NULL;
        enum MainElementID elem_idx = MMPLAYER_M_NUM;
-       GstCapscaps = NULL;
+       GstCaps *caps = NULL;
        gint total_track_num = 0;
 
        MMPLAYER_FENTER();
@@ -7904,7 +7919,7 @@ __mmplayer_change_selector_pad(mm_player_t* player, MMPlayerTrackType type, int
        MMPLAYER_RETURN_VAL_IF_FAIL(player && player->pipeline && player->pipeline->mainbin,
                                                                                                        MM_ERROR_PLAYER_NOT_INITIALIZED);
 
-       LOGD("Change Track(%d) to %d\n", type, index);
+       LOGD("Change Track(%d) to %d", type, index);
 
        mainbin = player->pipeline->mainbin;
 
@@ -7914,26 +7929,26 @@ __mmplayer_change_selector_pad(mm_player_t* player, MMPlayerTrackType type, int
                elem_idx = MMPLAYER_M_T_INPUT_SELECTOR;
        } else {
                /* Changing Video Track is not supported. */
-               LOGE("Track Type Error\n");
+               LOGE("Track Type Error");
                goto EXIT;
        }
 
        if (mainbin[elem_idx].gst == NULL) {
                result = MM_ERROR_PLAYER_NO_OP;
-               LOGD("Req track doesn't exist\n");
+               LOGD("Req track doesn't exist");
                goto EXIT;
        }
 
        total_track_num = player->selector[type].total_track_num;
        if (total_track_num <= 0) {
                result = MM_ERROR_PLAYER_NO_OP;
-               LOGD("Language list is not available \n");
+               LOGD("Language list is not available");
                goto EXIT;
        }
 
        if ((index < 0) || (index >= total_track_num)) {
                result = MM_ERROR_INVALID_ARGUMENT;
-               LOGD("Not a proper index : %d \n", index);
+               LOGD("Not a proper index : %d", index);
                goto EXIT;
        }
 
@@ -7941,11 +7956,11 @@ __mmplayer_change_selector_pad(mm_player_t* player, MMPlayerTrackType type, int
        change_pad_name = g_strdup_printf("sink_%u", index);
        if (change_pad_name == NULL) {
                result = MM_ERROR_PLAYER_INTERNAL;
-               LOGD("Pad does not exists\n");
+               LOGD("Pad does not exists");
                goto EXIT;
        }
 
-       LOGD("new active pad name: %s\n", change_pad_name);
+       LOGD("new active pad name: %s", change_pad_name);
 
        sinkpad = gst_element_get_static_pad(mainbin[elem_idx].gst, change_pad_name);
        if (sinkpad == NULL) {
@@ -7954,7 +7969,7 @@ __mmplayer_change_selector_pad(mm_player_t* player, MMPlayerTrackType type, int
                goto EXIT;
        }
 
-       LOGD("Set Active Pad - %s:%s\n", GST_DEBUG_PAD_NAME(sinkpad));
+       LOGD("Set Active Pad - %s:%s", GST_DEBUG_PAD_NAME(sinkpad));
        g_object_set(mainbin[elem_idx].gst, "active-pad", sinkpad, NULL);
 
        caps = gst_pad_get_current_caps(sinkpad);
@@ -7967,30 +7982,30 @@ __mmplayer_change_selector_pad(mm_player_t* player, MMPlayerTrackType type, int
                __mmplayer_set_audio_attrs(player, caps);
 
 EXIT:
-
        MMPLAYER_FREEIF(change_pad_name);
        return result;
 }
 
-int _mmplayer_change_track_language(MMHandleType hplayer, MMPlayerTrackType type, int index)
+int
+ _mmplayer_change_track_language(MMHandleType hplayer, MMPlayerTrackType type, int index)
 {
        int result = MM_ERROR_NONE;
-       mm_player_tplayer = NULL;
-       MMPlayerGstElementmainbin = NULL;
+       mm_player_t *player = NULL;
+       MMPlayerGstElement *mainbin = NULL;
 
        gint current_active_index = 0;
 
        GstState current_state = GST_STATE_VOID_PENDING;
-       GstEventevent = NULL;
+       GstEvent *event = NULL;
        gint64 time = 0;
 
        MMPLAYER_FENTER();
 
-       player = (mm_player_t*)hplayer;
+       player = (mm_player_t *)hplayer;
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
 
        if (!player->pipeline) {
-               LOGE("Track %d pre setting -> %d\n", type, index);
+               LOGE("Track %d pre setting -> %d", type, index);
 
                player->selector[type].active_pad_index = index;
                goto EXIT;
@@ -8012,20 +8027,22 @@ int _mmplayer_change_track_language(MMHandleType hplayer, MMPlayerTrackType type
        current_state = GST_STATE(mainbin[MMPLAYER_M_PIPE].gst);
        if (current_state < GST_STATE_PAUSED) {
                result = MM_ERROR_PLAYER_INVALID_STATE;
-               LOGW("Pipeline not in porper state\n");
+               LOGW("Pipeline not in porper state");
                goto EXIT;
        }
 
        result = __mmplayer_change_selector_pad(player, type, index);
        if (result != MM_ERROR_NONE) {
-               LOGE("change selector pad error\n");
+               LOGE("change selector pad error");
                goto EXIT;
        }
 
        player->selector[type].active_pad_index = index;
 
        if (current_state == GST_STATE_PLAYING) {
-               event = gst_event_new_seek(player->playback_rate, GST_FORMAT_TIME, (GstSeekFlags)(GST_SEEK_FLAG_SEGMENT | GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_SKIP), GST_SEEK_TYPE_SET, time, GST_SEEK_TYPE_NONE, -1);
+               event = gst_event_new_seek(player->playback_rate, GST_FORMAT_TIME,
+                       (GstSeekFlags)(GST_SEEK_FLAG_SEGMENT | GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_SKIP),
+                       GST_SEEK_TYPE_SET, time, GST_SEEK_TYPE_NONE, -1);
                if (event) {
                        __mmplayer_gst_send_event_to_sink(player, event);
                } else {
@@ -8038,9 +8055,10 @@ EXIT:
        return result;
 }
 
-int _mmplayer_get_subtitle_silent(MMHandleType hplayer, int* silent)
+int
+_mmplayer_get_subtitle_silent(MMHandleType hplayer, int *silent)
 {
-       mm_player_t* player = (mm_player_t*) hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
 
        MMPLAYER_FENTER();
 
@@ -8049,7 +8067,7 @@ int _mmplayer_get_subtitle_silent(MMHandleType hplayer, int* silent)
 
        *silent = player->set_mode.subtitle_off;
 
-       LOGD("subtitle is %s.\n", silent ? "ON" : "OFF");
+       LOGD("subtitle is %s.", silent ? "ON" : "OFF");
 
        MMPLAYER_FLEAVE();
 
@@ -8071,8 +8089,7 @@ __mmplayer_add_dump_buffer_probe(mm_player_t *player, GstElement *element)
                if (g_strrstr(factory_name, player->ini.dump_element_keyword[idx])) {
                        LOGD("dump [%s] sink pad", player->ini.dump_element_keyword[idx]);
                        mm_player_dump_t *dump_s;
-                       dump_s = g_malloc(sizeof(mm_player_dump_t));
-
+                       dump_s = g_try_malloc(sizeof(mm_player_dump_t));
                        if (dump_s == NULL) {
                                LOGE("malloc fail");
                                return FALSE;
@@ -8083,8 +8100,8 @@ __mmplayer_add_dump_buffer_probe(mm_player_t *player, GstElement *element)
                        dump_s->dump_pad = gst_element_get_static_pad(element, "sink");
 
                        if (dump_s->dump_pad) {
-                               memset(dump_file_name, 0x00, PLAYER_INI_MAX_STRLEN*2);
-                               snprintf(dump_file_name, PLAYER_INI_MAX_STRLEN*2, "%s/%s_sink_pad.dump", player->ini.dump_element_path, player->ini.dump_element_keyword[idx]);
+                               memset(dump_file_name, 0x00, PLAYER_INI_MAX_STRLEN * 2);
+                               snprintf(dump_file_name, PLAYER_INI_MAX_STRLEN * 2, "%s/%s_sink_pad.dump", player->ini.dump_element_path, player->ini.dump_element_keyword[idx]);
                                dump_s->dump_element_file = fopen(dump_file_name, "w+");
                                dump_s->probe_handle_id = gst_pad_add_probe(dump_s->dump_pad, GST_PAD_PROBE_TYPE_BUFFER, __mmplayer_dump_buffer_probe_cb, dump_s->dump_element_file, NULL);
                                /* add list for removed buffer probe and close FILE */
@@ -8092,8 +8109,7 @@ __mmplayer_add_dump_buffer_probe(mm_player_t *player, GstElement *element)
                                LOGD("%s sink pad added buffer probe for dump", factory_name);
                                return TRUE;
                        } else {
-                               g_free(dump_s);
-                               dump_s = NULL;
+                               MMPLAYER_FREEIF(dump_s);
                                LOGE("failed to get %s sink pad added", factory_name);
                        }
                }
@@ -8104,12 +8120,12 @@ __mmplayer_add_dump_buffer_probe(mm_player_t *player, GstElement *element)
 static GstPadProbeReturn
 __mmplayer_dump_buffer_probe_cb(GstPad *pad,  GstPadProbeInfo *info, gpointer u_data)
 {
-       FILE *dump_data = (FILE *) u_data;
+       FILE *dump_data = (FILE *)u_data;
 //     int written = 0;
        GstBuffer *buffer = gst_pad_probe_info_get_buffer(info);
        GstMapInfo probe_info = GST_MAP_INFO_INIT;
 
-       MMPLAYER_RETURN_VAL_IF_FAIL(dump_data, FALSE);
+       MMPLAYER_RETURN_VAL_IF_FAIL(dump_data, GST_PAD_PROBE_PASS);
 
        gst_buffer_map(buffer, &probe_info, GST_MAP_READ);
 
@@ -8123,43 +8139,46 @@ __mmplayer_dump_buffer_probe_cb(GstPad *pad,  GstPadProbeInfo *info, gpointer u_
 static void
 __mmplayer_release_dump_list(GList *dump_list)
 {
-       if (dump_list) {
-               GList *d_list = dump_list;
-               for (; d_list; d_list = g_list_next(d_list)) {
-                       mm_player_dump_t *dump_s = d_list->data;
-                       if (dump_s->dump_pad) {
-                               if (dump_s->probe_handle_id)
-                                       gst_pad_remove_probe(dump_s->dump_pad, dump_s->probe_handle_id);
-                       }
-                       if (dump_s->dump_element_file) {
-                               fclose(dump_s->dump_element_file);
-                               dump_s->dump_element_file = NULL;
-                       }
-                       MMPLAYER_FREEIF(dump_s);
+       GList *d_list = dump_list;
+
+       if (!d_list)
+               return;
+
+       for (; d_list; d_list = g_list_next(d_list)) {
+               mm_player_dump_t *dump_s = d_list->data;
+               if (dump_s->dump_pad) {
+                       if (dump_s->probe_handle_id)
+                               gst_pad_remove_probe(dump_s->dump_pad, dump_s->probe_handle_id);
+               }
+               if (dump_s->dump_element_file) {
+                       fclose(dump_s->dump_element_file);
+                       dump_s->dump_element_file = NULL;
                }
-               g_list_free(dump_list);
-               dump_list = NULL;
+               MMPLAYER_FREEIF(dump_s);
        }
+       g_list_free(dump_list);
+       dump_list = NULL;
 }
 
 int
-_mmplayer_has_closed_caption(MMHandleType hplayer, boolexist)
+_mmplayer_has_closed_caption(MMHandleType hplayer, bool *exist)
 {
-       mm_player_t* player = (mm_player_t*) hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
 
        MMPLAYER_FENTER();
 
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
        MMPLAYER_RETURN_VAL_IF_FAIL(exist, MM_ERROR_INVALID_ARGUMENT);
 
-       *exist = player->has_closed_caption;
+       *exist = (bool)player->has_closed_caption;
 
        MMPLAYER_FLEAVE();
 
        return MM_ERROR_NONE;
 }
 
-void _mm_player_video_stream_internal_buffer_unref(void *buffer)
+void
+_mm_player_video_stream_internal_buffer_unref(void *buffer)
 {
        MMPLAYER_FENTER();
        if (buffer) {
@@ -8170,9 +8189,10 @@ void _mm_player_video_stream_internal_buffer_unref(void *buffer)
        MMPLAYER_FLEAVE();
 }
 
-int _mmplayer_get_timeout(MMHandleType hplayer, int *timeout)
+int
+_mmplayer_get_timeout(MMHandleType hplayer, int *timeout)
 {
-       mm_player_t *player = (mm_player_t *) hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
 
        MMPLAYER_FENTER();
 
@@ -8180,9 +8200,9 @@ int _mmplayer_get_timeout(MMHandleType hplayer, int *timeout)
        MMPLAYER_RETURN_VAL_IF_FAIL(timeout, MM_ERROR_COMMON_INVALID_ARGUMENT);
 
        if (MMPLAYER_IS_STREAMING(player))
-               *timeout = player->ini.live_state_change_timeout;
+               *timeout = (int)player->ini.live_state_change_timeout;
        else
-               *timeout = player->ini.localplayback_state_change_timeout;
+               *timeout = (int)player->ini.localplayback_state_change_timeout;
 
        LOGD("timeout = %d", *timeout);
 
@@ -8190,9 +8210,10 @@ int _mmplayer_get_timeout(MMHandleType hplayer, int *timeout)
        return MM_ERROR_NONE;
 }
 
-int _mmplayer_get_num_of_video_out_buffers(MMHandleType hplayer, int *num, int *extra_num)
+int
+_mmplayer_get_num_of_video_out_buffers(MMHandleType hplayer, int *num, int *extra_num)
 {
-       mm_player_t* player = (mm_player_t*) hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
 
        MMPLAYER_FENTER();
 
@@ -8202,14 +8223,14 @@ int _mmplayer_get_num_of_video_out_buffers(MMHandleType hplayer, int *num, int *
        *num = player->video_num_buffers;
        *extra_num = player->video_extra_num_buffers;
 
-       LOGD("state %d, num %d(%d)\n", MMPLAYER_CURRENT_STATE(player), *num, *extra_num);
+       LOGD("state %d, num %d(%d)", MMPLAYER_CURRENT_STATE(player), *num, *extra_num);
 
        MMPLAYER_FLEAVE();
        return MM_ERROR_NONE;
 }
 
 static void
-__mmplayer_initialize_storage_info(mm_player_tplayer, MMPlayerPathType path_type)
+__mmplayer_initialize_storage_info(mm_player_t *player, MMPlayerPathType path_type)
 {
        int i = 0;
        MMPLAYER_FENTER();
@@ -8231,10 +8252,11 @@ __mmplayer_initialize_storage_info(mm_player_t* player, MMPlayerPathType path_ty
        MMPLAYER_FLEAVE();
 }
 
-int _mmplayer_manage_external_storage_state(MMHandleType hplayer, int id, int state)
+int
+_mmplayer_manage_external_storage_state(MMHandleType hplayer, int id, int state)
 {
        int ret = MM_ERROR_NONE;
-       mm_player_t* player = (mm_player_t*)hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
        MMMessageParamType msg_param = {0, };
 
        MMPLAYER_FENTER();
@@ -8246,8 +8268,10 @@ int _mmplayer_manage_external_storage_state(MMHandleType hplayer, int id, int st
                return MM_ERROR_NONE;
 
        /* FIXME: text path should be handled seperately. */
-       if (((player->storage_info[MMPLAYER_PATH_VOD].type == STORAGE_TYPE_EXTERNAL) && (player->storage_info[MMPLAYER_PATH_VOD].id == id)) ||
-               ((player->storage_info[MMPLAYER_PATH_TEXT].type == STORAGE_TYPE_EXTERNAL) && (player->storage_info[MMPLAYER_PATH_TEXT].id == id))) {
+       if (((player->storage_info[MMPLAYER_PATH_VOD].type == STORAGE_TYPE_EXTERNAL)
+               && (player->storage_info[MMPLAYER_PATH_VOD].id == id)) ||
+               ((player->storage_info[MMPLAYER_PATH_TEXT].type == STORAGE_TYPE_EXTERNAL)
+               && (player->storage_info[MMPLAYER_PATH_TEXT].id == id))) {
                LOGW("external storage is removed");
 
                if (player->msg_posted == FALSE) {
@@ -8267,10 +8291,11 @@ int _mmplayer_manage_external_storage_state(MMHandleType hplayer, int id, int st
        return ret;
 }
 
-int _mmplayer_get_adaptive_variant_info(MMHandleType hplayer, int *num, char **var_info)
+int
+_mmplayer_get_adaptive_variant_info(MMHandleType hplayer, int *num, char **var_info)
 {
        int ret = MM_ERROR_NONE;
-       mm_player_t* player = (mm_player_t*) hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
        int idx = 0, total = 0;
        gchar *result = NULL, *tmp = NULL;
 
@@ -8309,10 +8334,11 @@ int _mmplayer_get_adaptive_variant_info(MMHandleType hplayer, int *num, char **v
        return ret;
 }
 
-int _mmplayer_set_max_adaptive_variant_limit(MMHandleType hplayer, int bandwidth, int width, int height)
+int
+_mmplayer_set_max_adaptive_variant_limit(MMHandleType hplayer, int bandwidth, int width, int height)
 {
        int ret = MM_ERROR_NONE;
-       mm_player_t* player = (mm_player_t*) hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
 
        MMPLAYER_FENTER();
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
@@ -8336,10 +8362,11 @@ int _mmplayer_set_max_adaptive_variant_limit(MMHandleType hplayer, int bandwidth
 
 }
 
-int _mmplayer_get_max_adaptive_variant_limit(MMHandleType hplayer, int *bandwidth, int *width, int *height)
+int
+_mmplayer_get_max_adaptive_variant_limit(MMHandleType hplayer, int *bandwidth, int *width, int *height)
 {
        int ret = MM_ERROR_NONE;
-       mm_player_t* player = (mm_player_t*) hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
 
        MMPLAYER_FENTER();
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
@@ -8355,10 +8382,11 @@ int _mmplayer_get_max_adaptive_variant_limit(MMHandleType hplayer, int *bandwidt
        return ret;
 }
 
-int _mmplayer_set_streaming_buffering_time(MMHandleType hplayer, int buffer_ms, int rebuffer_ms)
+int
+_mmplayer_set_streaming_buffering_time(MMHandleType hplayer, int buffer_ms, int rebuffer_ms)
 {
        int ret = MM_ERROR_NONE;
-       mm_player_t* player = (mm_player_t*) hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
 
        MMPLAYER_FENTER();
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
@@ -8384,10 +8412,11 @@ int _mmplayer_set_streaming_buffering_time(MMHandleType hplayer, int buffer_ms,
 
 }
 
-int _mmplayer_get_streaming_buffering_time(MMHandleType hplayer, int *buffer_ms, int *rebuffer_ms)
+int
+_mmplayer_get_streaming_buffering_time(MMHandleType hplayer, int *buffer_ms, int *rebuffer_ms)
 {
        int ret = MM_ERROR_NONE;
-       mm_player_t* player = (mm_player_t*) hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
 
        MMPLAYER_FENTER();
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
@@ -8407,11 +8436,12 @@ int _mmplayer_get_streaming_buffering_time(MMHandleType hplayer, int *buffer_ms,
        return ret;
 }
 
-int _mmplayer_set_codec_type(MMHandleType hplayer, MMPlayerStreamType stream_type, MMPlayerVideoCodecType codec_type)
+int
+_mmplayer_set_codec_type(MMHandleType hplayer, MMPlayerStreamType stream_type, MMPlayerVideoCodecType codec_type)
 {
 #define IDX_FIRST_SW_CODEC 0
-       mm_player_t* player = (mm_player_t*) hplayer;
-       const charattr_name = (stream_type == MM_PLAYER_STREAM_TYPE_AUDIO) ? (MM_PLAYER_AUDIO_CODEC_TYPE) : (MM_PLAYER_VIDEO_CODEC_TYPE);
+       mm_player_t *player = (mm_player_t *)hplayer;
+       const char *attr_name = (stream_type == MM_PLAYER_STREAM_TYPE_AUDIO) ? (MM_PLAYER_AUDIO_CODEC_TYPE) : (MM_PLAYER_VIDEO_CODEC_TYPE);
        MMHandleType attrs = 0;
 
        MMPLAYER_FENTER();
@@ -8469,8 +8499,8 @@ int _mmplayer_set_codec_type(MMHandleType hplayer, MMPlayerStreamType stream_typ
 int
 _mmplayer_set_replaygain_enabled(MMHandleType hplayer, bool enabled)
 {
-       mm_player_t* player = (mm_player_t*) hplayer;
-       GstElementrg_vol_element = NULL;
+       mm_player_t *player = (mm_player_t *)hplayer;
+       GstElement *rg_vol_element = NULL;
 
        MMPLAYER_FENTER();
 
@@ -8480,7 +8510,7 @@ _mmplayer_set_replaygain_enabled(MMHandleType hplayer, bool enabled)
 
        /* just hold rgvolume enable value if pipeline is not ready */
        if (!player->pipeline || !player->pipeline->audiobin) {
-               LOGD("pipeline is not ready. holding rgvolume enable value\n");
+               LOGD("pipeline is not ready. holding rgvolume enable value");
                return MM_ERROR_NONE;
        }
 
@@ -8504,8 +8534,8 @@ _mmplayer_set_replaygain_enabled(MMHandleType hplayer, bool enabled)
 int
 _mmplayer_is_replaygain_enabled(MMHandleType hplayer, bool *enabled)
 {
-       mm_player_t* player = (mm_player_t*) hplayer;
-       GstElementrg_vol_element = NULL;
+       mm_player_t *player = (mm_player_t *)hplayer;
+       GstElement *rg_vol_element = NULL;
        gboolean enable = FALSE;
 
        MMPLAYER_FENTER();
@@ -8515,7 +8545,7 @@ _mmplayer_is_replaygain_enabled(MMHandleType hplayer, bool *enabled)
 
        /* just hold enable_rg value if pipeline is not ready */
        if (!player->pipeline || !player->pipeline->audiobin) {
-               LOGD("pipeline is not ready. holding rgvolume value (%d)\n", player->sound.rg_enable);
+               LOGD("pipeline is not ready. holding rgvolume value (%d)", player->sound.rg_enable);
                *enabled = player->sound.rg_enable;
                return MM_ERROR_NONE;
        }
@@ -8528,7 +8558,7 @@ _mmplayer_is_replaygain_enabled(MMHandleType hplayer, bool *enabled)
        }
 
        g_object_get(rg_vol_element, "enable-rgvolume", &enable, NULL);
-       *enabled = enable;
+       *enabled = (bool)enable;
 
        MMPLAYER_FLEAVE();
 
@@ -8538,7 +8568,7 @@ _mmplayer_is_replaygain_enabled(MMHandleType hplayer, bool *enabled)
 int
 _mmplayer_set_video_roi_area(MMHandleType hplayer, double scale_x, double scale_y, double scale_width, double scale_height)
 {
-       mm_player_t* player = (mm_player_t*) hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
        MMHandleType attrs = 0;
        void *handle = NULL;
        int ret = MM_ERROR_NONE;
@@ -8581,7 +8611,7 @@ _mmplayer_set_video_roi_area(MMHandleType hplayer, double scale_x, double scale_
 int
 _mmplayer_get_video_roi_area(MMHandleType hplayer, double *scale_x, double *scale_y, double *scale_width, double *scale_height)
 {
-       mm_player_t* player = (mm_player_t*) hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
        int ret = MM_ERROR_NONE;
 
        MMPLAYER_FENTER();
@@ -8622,10 +8652,9 @@ __mmplayer_update_duration_attrs(mm_player_t *player, MMHandleType attrs)
        player->streaming_type =  __mmplayer_get_stream_service_type(player);
 
        /* check duration is OK */
-       if (dur_nsec == 0 && !MMPLAYER_IS_LIVE_STREAMING(player)) {
+       if (dur_nsec == 0 && !MMPLAYER_IS_LIVE_STREAMING(player))
                /* FIXIT : find another way to get duration here. */
                LOGW("finally it's failed to get duration from pipeline. progressbar will not work correctely!");
-       }
 
        return ret;
 }
@@ -8638,9 +8667,9 @@ __mmplayer_update_audio_attrs(mm_player_t *player, MMHandleType attrs)
        decoder. Below code only valid when we are not using 'resampler' just before
        'audioconverter'. */
        GstCaps *caps_a = NULL;
-       GstPadpad = NULL;
+       GstPad *pad = NULL;
        gint samplerate = 0, channels = 0;
-       GstStructurep = NULL;
+       GstStructure *p = NULL;
 
        LOGD("try to update audio attrs");
 
@@ -8656,7 +8685,6 @@ __mmplayer_update_audio_attrs(mm_player_t *player, MMHandleType attrs)
        }
 
        caps_a = gst_pad_get_current_caps(pad);
-
        if (!caps_a) {
                LOGW("not ready to get audio caps");
                gst_object_unref(pad);
@@ -8687,10 +8715,10 @@ __mmplayer_update_video_attrs(mm_player_t *player, MMHandleType attrs)
        LOGD("try to update video attrs");
 
        GstCaps *caps_v = NULL;
-       GstPadpad = NULL;
+       GstPad *pad = NULL;
        gint tmpNu, tmpDe;
        gint width, height;
-       GstStructurep = NULL;
+       GstStructure *p = NULL;
 
        MMPLAYER_RETURN_VAL_IF_FAIL(player->pipeline->videobin, FALSE);
        MMPLAYER_RETURN_VAL_IF_FAIL(player->pipeline->videobin[MMPLAYER_V_SINK].gst, FALSE);
@@ -8784,14 +8812,16 @@ __mmplayer_update_bitrate_attrs(mm_player_t *player, MMHandleType attrs)
 
        return ret;
 }
+
 static void
-__mmplayer_copy_uri_and_set_type(MMPlayerParseProfiledata, const char *uri, int uri_type)
+__mmplayer_copy_uri_and_set_type(MMPlayerParseProfile *data, const char *uri, int uri_type)
 {
        strncpy(data->uri, uri, MM_MAX_URL_LEN - 1);
        data->uri_type = uri_type;
 }
+
 static int
-__mmplayer_set_mem_uri(MMPlayerParseProfiledata, char *path, void *param)
+__mmplayer_set_mem_uri(MMPlayerParseProfile *data, char *path, void *param)
 {
        int ret = MM_ERROR_PLAYER_INVALID_URI;
        int mem_size = 0;
@@ -8831,7 +8861,7 @@ __mmplayer_set_mem_uri(MMPlayerParseProfile* data, char *path, void *param)
                }
        }
 
-       LOGD("ext: %s, mem_size: %d, mmap(param): %p\n", ext, mem_size, param);
+       LOGD("ext: %s, mem_size: %d, mmap(param): %p", ext, mem_size, param);
 
        if (mem_size && param) {
                if (data->input_mem.buf)
@@ -8855,7 +8885,7 @@ __mmplayer_set_mem_uri(MMPlayerParseProfile* data, char *path, void *param)
 }
 
 static int
-__mmplayer_set_file_uri(MMPlayerParseProfiledata, const char *uri)
+__mmplayer_set_file_uri(MMPlayerParseProfile *data, const char *uri)
 {
        gchar *location = NULL;
        GError *err = NULL;
@@ -8869,8 +8899,8 @@ __mmplayer_set_file_uri(MMPlayerParseProfile* data, const char *uri)
                                (err != NULL) ? err->message : "unknown error");
                        if (err)
                                g_error_free(err);
-                       if (location)
-                               g_free(location);
+
+                       MMPLAYER_FREEIF(location);
 
                        data->uri_type = MM_PLAYER_URI_TYPE_NONE;
                        return MM_ERROR_PLAYER_INVALID_URI;
@@ -8887,7 +8917,7 @@ __mmplayer_set_file_uri(MMPlayerParseProfile* data, const char *uri)
        if (ret == MM_ERROR_NONE) {
                g_snprintf(data->uri,  MM_MAX_URL_LEN, "file://%s", path);
                if (util_is_sdp_file(path)) {
-                       LOGD("uri is actually a file but it's sdp file. giving it to rtspsrc\n");
+                       LOGD("uri is actually a file but it's sdp file. giving it to rtspsrc");
                        data->uri_type = MM_PLAYER_URI_TYPE_URL_RTSP;
                } else {
                        data->uri_type = MM_PLAYER_URI_TYPE_FILE;
@@ -8895,17 +8925,16 @@ __mmplayer_set_file_uri(MMPlayerParseProfile* data, const char *uri)
        } else if (ret == MM_ERROR_PLAYER_PERMISSION_DENIED) {
                data->uri_type = MM_PLAYER_URI_TYPE_NO_PERMISSION;
        } else {
-               LOGE("invalid uri, could not play..\n");
+               LOGE("invalid uri, could not play..");
                data->uri_type = MM_PLAYER_URI_TYPE_NONE;
        }
 
-       if (location)
-               g_free(location);
+       MMPLAYER_FREEIF(location);
 
        return ret;
 }
 
-static MMPlayerVideoStreamDataType*
+static MMPlayerVideoStreamDataType *
 __mmplayer_create_stream_from_pad(GstPad *pad)
 {
        GstCaps *caps = NULL;
@@ -8938,7 +8967,7 @@ __mmplayer_create_stream_from_pad(GstPad *pad)
                return NULL;
        }
 
-       stream = (MMPlayerVideoStreamDataType *)g_malloc0(sizeof(MMPlayerVideoStreamDataType));
+       stream = (MMPlayerVideoStreamDataType *)g_try_malloc0(sizeof(MMPlayerVideoStreamDataType));
        if (!stream) {
                LOGE("failed to alloc mem for video data");
                return NULL;
@@ -9149,9 +9178,9 @@ __mmplayer_set_playing_state(mm_player_t *player)
                mm_attrs_set_string_by_name(player->attrs, "content_audio_codec", audio_codec);
 
                if (mm_attrs_commit_all(player->attrs))
-                       LOGE("failed to update attributes\n");
+                       LOGE("failed to update attributes");
 
-               LOGD("set audio codec type with caps\n");
+               LOGD("set audio codec type with caps");
        }
 
        return;
index 1da6f4d..c0aa81d 100644 (file)
@@ -45,31 +45,31 @@ typedef struct {
        gdouble percent_time;
 } streaming_buffer_info_t;
 
-static void streaming_set_buffer_percent(mm_player_streaming_tstreamer, BufferType type, gdouble high_percent_byte, gdouble high_percent_time);
-static void streaming_set_queue2_queue_type(mm_player_streaming_t* streamer, MuxedBufferType type, gchar * file_path, guint64 content_size);
-static void streaming_set_buffer_size(mm_player_streaming_tstreamer, BufferType type, guint buffering_bytes, gint buffering_time);
-static void streaming_update_buffering_status(mm_player_streaming_tstreamer, GstMessage *buffering_msg, gint64 position);
-static void streaming_get_current_bitrate_info(mm_player_streaming_tstreamer,
+static void streaming_set_buffer_percent(mm_player_streaming_t *streamer, BufferType type, gdouble high_percent_byte, gdouble high_percent_time);
+static void streaming_set_queue2_queue_type(mm_player_streaming_t *streamer, MuxedBufferType type, gchar *file_path, guint64 content_size);
+static void streaming_set_buffer_size(mm_player_streaming_t *streamer, BufferType type, guint buffering_bytes, gint buffering_time);
+static void streaming_update_buffering_status(mm_player_streaming_t *streamer, GstMessage *buffering_msg, gint64 position);
+static void streaming_get_current_bitrate_info(mm_player_streaming_t *streamer,
                                                                                                GstMessage *buffering_msg,
                                                                                                streaming_content_info_t content_info,
-                                                                                               streaming_bitrate_info_tbitrate_info);
+                                                                                               streaming_bitrate_info_t *bitrate_info);
 static void
-streaming_handle_fixed_buffering_mode(mm_player_streaming_tstreamer,
+streaming_handle_fixed_buffering_mode(mm_player_streaming_t *streamer,
                                                                                gint byte_out_rate,
                                                                                gint fixed_buffering_time,
-                                                                               streaming_buffer_info_tbuffer_info);
+                                                                               streaming_buffer_info_t *buffer_info);
 static void
-streaming_handle_adaptive_buffering_mode(mm_player_streaming_tstreamer,
-                                                                                       streaming_content_info_t content_info,
-                                                                                       streaming_bitrate_info_t bitrate_info,
-                                                                                       streaming_buffer_info_t* buffer_info,
-                                                                                       gint expected_play_time);
+streaming_handle_adaptive_buffering_mode(mm_player_streaming_t *streamer,
+                                                                               streaming_content_info_t content_info,
+                                                                               streaming_bitrate_info_t bitrate_info,
+                                                                               streaming_buffer_info_t *buffer_info,
+                                                                               gint expected_play_time);
 static void
-streaming_update_buffer_setting(mm_player_streaming_tstreamer,
-                                                                       GstMessage *buffering_msg,
-                                                                       guint64 content_size,
-                                                                       gint64 position,
-                                                                       gint64 duration);
+streaming_update_buffer_setting(mm_player_streaming_t *streamer,
+                                                               GstMessage *buffering_msg,
+                                                               guint64 content_size,
+                                                               gint64 position,
+                                                               gint64 duration);
 
 mm_player_streaming_t *
 __mm_player_streaming_create(void)
@@ -78,9 +78,9 @@ __mm_player_streaming_create(void)
 
        MMPLAYER_FENTER();
 
-       streamer = (mm_player_streaming_t *) g_malloc0(sizeof(mm_player_streaming_t));
+       streamer = (mm_player_streaming_t *)g_try_malloc0(sizeof(mm_player_streaming_t));
        if (!streamer) {
-               LOGE("fail to create streaming player handle..\n");
+               LOGE("fail to create streaming player handle..");
                return NULL;
        }
 
@@ -90,7 +90,7 @@ __mm_player_streaming_create(void)
 }
 
 static void
-streaming_buffer_initialize(streaming_buffer_tbuffer_handle, gboolean buffer_init)
+streaming_buffer_initialize(streaming_buffer_t *buffer_handle, gboolean buffer_init)
 {
        if (buffer_init)
                buffer_handle->buffer = NULL;
@@ -102,7 +102,8 @@ streaming_buffer_initialize(streaming_buffer_t* buffer_handle, gboolean buffer_i
 
 }
 
-void __mm_player_streaming_initialize(mm_player_streaming_t* streamer)
+void
+__mm_player_streaming_initialize(mm_player_streaming_t *streamer)
 {
        MMPLAYER_FENTER();
 
@@ -134,7 +135,8 @@ void __mm_player_streaming_initialize(mm_player_streaming_t* streamer)
        return;
 }
 
-void __mm_player_streaming_deinitialize(mm_player_streaming_t* streamer)
+void
+__mm_player_streaming_deinitialize(mm_player_streaming_t *streamer)
 {
        MMPLAYER_FENTER();
        MMPLAYER_RETURN_IF_FAIL(streamer);
@@ -167,35 +169,37 @@ void __mm_player_streaming_deinitialize(mm_player_streaming_t* streamer)
        return;
 }
 
-void __mm_player_streaming_destroy(mm_player_streaming_t* streamer)
+void
+__mm_player_streaming_destroy(mm_player_streaming_t *streamer)
 {
        MMPLAYER_FENTER();
 
-       g_free(streamer);
+       MMPLAYER_FREEIF(streamer);
 
        MMPLAYER_FLEAVE();
 
        return;
 }
 
-void __mm_player_streaming_set_content_bitrate(mm_player_streaming_t* streamer, guint max_bitrate, guint avg_bitrate)
+void
+__mm_player_streaming_set_content_bitrate(mm_player_streaming_t *streamer, guint max_bitrate, guint avg_bitrate)
 {
        MMPLAYER_FENTER();
 
        MMPLAYER_RETURN_IF_FAIL(streamer);
 
        /* Note : Update buffering criterion bytes
-       *      1. maximum bitrate is considered first.
-       *      2. average bitrage * 3 is next.
-       *      3. if there are no updated bitrate, use default buffering limit.
-       */
+        *      1. maximum bitrate is considered first.
+        *      2. average bitrage * 3 is next.
+        *      3. if there are no updated bitrate, use default buffering limit.
+        */
        if (max_bitrate > 0 && streamer->buffer_max_bitrate != max_bitrate) {
-               LOGD("set maximum bitrate(%dbps).\n", max_bitrate);
+               LOGD("set maximum bitrate(%dbps).", max_bitrate);
                streamer->buffer_max_bitrate = max_bitrate;
                if (streamer->buffering_req.is_pre_buffering == FALSE) {
                        streamer->need_update = TRUE;
                } else {
-                       LOGD("pre-buffering...\n");
+                       LOGD("pre-buffering...");
 
                        if (IS_MUXED_BUFFERING_MODE(streamer))
                                streaming_update_buffer_setting(streamer, NULL, 0, 0, 0);
@@ -203,13 +207,13 @@ void __mm_player_streaming_set_content_bitrate(mm_player_streaming_t* streamer,
        }
 
        if (avg_bitrate > 0 && streamer->buffer_avg_bitrate != avg_bitrate) {
-               LOGD("set averate bitrate(%dbps).\n", avg_bitrate);
+               LOGD("set averate bitrate(%dbps).", avg_bitrate);
                streamer->buffer_avg_bitrate = avg_bitrate;
 
                if (streamer->buffering_req.is_pre_buffering == FALSE) {
                        streamer->need_update = TRUE;
                } else {
-                       LOGD("pre-buffering...\n");
+                       LOGD("pre-buffering...");
 
                        if (IS_MUXED_BUFFERING_MODE(streamer))
                                streaming_update_buffer_setting(streamer, NULL, 0, 0, 0);
@@ -221,15 +225,15 @@ void __mm_player_streaming_set_content_bitrate(mm_player_streaming_t* streamer,
 }
 
 static void
-streaming_set_buffer_percent(mm_player_streaming_tstreamer,
-                                                               BufferType type,
-                                                               gdouble high_percent_byte,
-                                                               gdouble high_percent_time)
+streaming_set_buffer_percent(mm_player_streaming_t *streamer,
+                                                       BufferType type,
+                                                       gdouble high_percent_byte,
+                                                       gdouble high_percent_time)
 {
        gdouble high_percent = 0.0;
 
-       streaming_buffer_tbuffer_handle = NULL;
-       gcharfactory_name = NULL;
+       streaming_buffer_t *buffer_handle = NULL;
+       gchar *factory_name = NULL;
 
        MMPLAYER_FENTER();
        MMPLAYER_RETURN_IF_FAIL(streamer);
@@ -271,14 +275,14 @@ streaming_set_buffer_percent(mm_player_streaming_t* streamer,
 }
 
 static void
-streaming_set_queue2_queue_type(mm_player_streaming_t* streamer, MuxedBufferType type, gchar * file_path, guint64 content_size)
+streaming_set_queue2_queue_type(mm_player_streaming_t *streamer, MuxedBufferType type, gchar *file_path, guint64 content_size)
 {
-       streaming_buffer_tbuffer_handle = NULL;
+       streaming_buffer_t *buffer_handle = NULL;
        guint64 storage_available_size = 0; /* bytes */
        guint64 buffer_size = 0;  /* bytes */
        gchar file_buffer_name[MM_MAX_URL_LEN] = {0};
        struct statfs buf = {0};
-       gcharfactory_name = NULL;
+       gchar *factory_name = NULL;
 
        MMPLAYER_FENTER();
        MMPLAYER_RETURN_IF_FAIL(streamer);
@@ -292,7 +296,6 @@ streaming_set_queue2_queue_type(mm_player_streaming_t* streamer, MuxedBufferType
        }
 
        factory_name = GST_OBJECT_NAME(gst_element_get_factory(buffer_handle->buffer));
-
        if (!factory_name) {
                LOGE("Fail to get factory name!");
                return;
@@ -301,7 +304,7 @@ streaming_set_queue2_queue_type(mm_player_streaming_t* streamer, MuxedBufferType
        LOGD("target buffer elem : %s", GST_ELEMENT_NAME(buffer_handle->buffer));
 
        if (!g_strrstr(factory_name, "queue2")) {
-               LOGD("only queue2 can use file buffer. not decodebin2 or multiQ\n");
+               LOGD("only queue2 can use file buffer. not decodebin2 or multiQ");
                return;
        }
 
@@ -313,20 +316,20 @@ streaming_set_queue2_queue_type(mm_player_streaming_t* streamer, MuxedBufferType
                return;
        }
 
-       LOGD("[Queue2] buffering type : %d. streaming is played on pull-based. \n", type);
+       LOGD("[Queue2] buffering type : %d. streaming is played on pull-based.", type);
        if (type == MUXED_BUFFER_TYPE_FILE && file_path && strlen(file_path) > 0) {
                if (statfs((const char *)file_path, &buf) < 0) {
-                       LOGW("[Queue2] fail to get available storage capacity. set mem ring buffer instead of file buffer.\n");
+                       LOGW("[Queue2] fail to get available storage capacity. set mem ring buffer instead of file buffer.");
                        buffer_size = (guint64)((streamer->ring_buffer_size > 0) ? (streamer->ring_buffer_size) : DEFAULT_RING_BUFFER_SIZE);
                } else {
                        storage_available_size = (guint64)buf.f_bavail * (guint64)buf.f_bsize; //bytes
 
                        LOGD("[Queue2] the number of available blocks : %"G_GUINT64_FORMAT
-                                               ", the block size is %"G_GUINT64_FORMAT".\n",
+                                               ", the block size is %"G_GUINT64_FORMAT".",
                                                (guint64)buf.f_bavail, (guint64)buf.f_bsize);
 
                        LOGD("[Queue2] calculated available storage size is %"
-                                                               G_GUINT64_FORMAT" Bytes.\n", storage_available_size);
+                                                               G_GUINT64_FORMAT" Bytes.", storage_available_size);
 
                        if (content_size <= 0 || content_size >= storage_available_size)
                                buffer_size = storage_available_size;
@@ -334,7 +337,7 @@ streaming_set_queue2_queue_type(mm_player_streaming_t* streamer, MuxedBufferType
                                buffer_size = 0L;
 
                        g_snprintf(file_buffer_name, MM_MAX_URL_LEN, "%sXXXXXX", file_path);
-                       SECURE_LOGD("[Queue2] the buffering file name is %s.\n", file_buffer_name);
+                       SECURE_LOGD("[Queue2] the buffering file name is %s.", file_buffer_name);
 
                        g_object_set(G_OBJECT(buffer_handle->buffer), "temp-template", file_buffer_name, NULL);
                }
@@ -350,9 +353,9 @@ streaming_set_queue2_queue_type(mm_player_streaming_t* streamer, MuxedBufferType
 }
 
 static void
-streaming_set_buffer_size(mm_player_streaming_tstreamer, BufferType type, guint buffering_bytes, gint buffering_time)
+streaming_set_buffer_size(mm_player_streaming_t *streamer, BufferType type, guint buffering_bytes, gint buffering_time)
 {
-       streaming_buffer_tbuffer_handle = NULL;
+       streaming_buffer_t *buffer_handle = NULL;
 
        MMPLAYER_FENTER();
 
@@ -381,7 +384,7 @@ streaming_set_buffer_size(mm_player_streaming_t* streamer, BufferType type, guin
                        if (buffer_handle->is_live)
                                g_object_set(G_OBJECT(buffer_handle->buffer),
                                                                "max-size-bytes", buffering_bytes,
-                                                               "max-size-time", (guint64)(buffering_time*GST_MSECOND),
+                                                               "max-size-time", (guint64)(buffering_time * GST_MSECOND),
                                                                "max-size-buffers", 0,
                                                                "use-rate-estimate", TRUE, NULL);
                        else
@@ -402,14 +405,15 @@ streaming_set_buffer_size(mm_player_streaming_t* streamer, BufferType type, guin
        return;
 }
 
-void __mm_player_streaming_set_queue2(mm_player_streaming_t* streamer,
-                                                                               GstElement* buffer,
-                                                                               gboolean use_buffering,
-                                                                               guint buffering_bytes,
-                                                                               gint buffering_time,
-                                                                               MuxedBufferType type,
-                                                                               gchar* file_path,
-                                                                               guint64 content_size)
+void
+__mm_player_streaming_set_queue2(mm_player_streaming_t *streamer,
+                                                                       GstElement *buffer,
+                                                                       gboolean use_buffering,
+                                                                       guint buffering_bytes,
+                                                                       gint buffering_time,
+                                                                       MuxedBufferType type,
+                                                                       gchar *file_path,
+                                                                       guint64 content_size)
 {
        MMPLAYER_FENTER();
        MMPLAYER_RETURN_IF_FAIL(streamer);
@@ -448,9 +452,10 @@ void __mm_player_streaming_set_queue2(mm_player_streaming_t* streamer,
        return;
 }
 
-void __mm_player_streaming_sync_property(mm_player_streaming_t* streamer, GstElement* decodebin)
+void
+__mm_player_streaming_sync_property(mm_player_streaming_t *streamer, GstElement *decodebin)
 {
-       streaming_buffer_tbuffer_handle = NULL;
+       streaming_buffer_t *buffer_handle = NULL;
 
        MMPLAYER_FENTER();
 
@@ -468,11 +473,12 @@ void __mm_player_streaming_sync_property(mm_player_streaming_t* streamer, GstEle
        streamer->need_sync = FALSE;
 }
 
-void __mm_player_streaming_set_multiqueue(mm_player_streaming_t* streamer,
-                                                                               GstElement* buffer,
+void
+__mm_player_streaming_set_multiqueue(mm_player_streaming_t *streamer,
+                                                                               GstElement *buffer,
                                                                                gint buffering_time)
 {
-       streaming_buffer_tbuffer_handle = NULL;
+       streaming_buffer_t *buffer_handle = NULL;
        gdouble high_percent = 0.0;
 
        MMPLAYER_FENTER();
@@ -486,7 +492,7 @@ void __mm_player_streaming_set_multiqueue(mm_player_streaming_t* streamer,
        g_object_set(G_OBJECT(buffer_handle->buffer), "use-buffering", TRUE, NULL);
 
 
-       LOGD("pre_buffering: %d ms, during playing: %d ms\n", streamer->buffering_req.prebuffer_time, buffering_time);
+       LOGD("pre_buffering: %d ms, during playing: %d ms", streamer->buffering_req.prebuffer_time, buffering_time);
 
        if (streamer->buffering_req.prebuffer_time > 0)
                streamer->buffering_req.is_pre_buffering = TRUE;
@@ -494,7 +500,7 @@ void __mm_player_streaming_set_multiqueue(mm_player_streaming_t* streamer,
                streamer->buffering_req.prebuffer_time = GET_DEFAULT_PLAYING_TIME(streamer);
 
        high_percent = (gdouble)(streamer->buffering_req.prebuffer_time * 100) / GET_MAX_BUFFER_TIME(streamer);
-       LOGD("high_percent %2.3f %%\n", high_percent);
+       LOGD("high_percent %2.3f %%", high_percent);
 
        /* initial setting */
        streaming_set_buffer_size(streamer, BUFFER_TYPE_DEMUXED, GET_MAX_BUFFER_BYTES(streamer), GET_MAX_BUFFER_TIME(streamer));
@@ -507,10 +513,10 @@ void __mm_player_streaming_set_multiqueue(mm_player_streaming_t* streamer,
 }
 
 static void
-streaming_get_current_bitrate_info(mm_player_streaming_tstreamer,
+streaming_get_current_bitrate_info(mm_player_streaming_t *streamer,
                                                                        GstMessage *buffering_msg,
                                                                        streaming_content_info_t content_info,
-                                                                       streaming_bitrate_info_tbitrate_info)
+                                                                       streaming_bitrate_info_t *bitrate_info)
 {
 
        GstQuery *query = NULL;
@@ -544,8 +550,8 @@ streaming_get_current_bitrate_info(mm_player_streaming_t* streamer,
 
        LOGD("Streaming Info : in %d, out %d, left %"G_GINT64_FORMAT, in_rate, out_rate, buffering_left);
 
-       if ((content_info.content_size > 0) && (content_info.duration > 0) && ((content_info.duration/GST_SECOND) > 0))
-               estimated_content_bitrate = GET_BIT_FROM_BYTE((guint)(content_info.content_size / (content_info.duration/GST_SECOND)));
+       if ((content_info.content_size > 0) && (content_info.duration > 0) && ((content_info.duration / GST_SECOND) > 0))
+               estimated_content_bitrate = GET_BIT_FROM_BYTE((guint)(content_info.content_size / (content_info.duration / GST_SECOND)));
 
        if (streamer->buffer_max_bitrate > 0) {
                streamer->buffer_max_bitrate = MAX(streamer->buffer_max_bitrate, streamer->buffer_avg_bitrate);
@@ -560,18 +566,18 @@ streaming_get_current_bitrate_info(mm_player_streaming_t* streamer,
                else
                        out_rate = GET_BYTE_FROM_BIT(streamer->buffer_max_bitrate/3);
 
-               LOGD("(max)content_max_byte_rate %d, byte_out_rate %d\n", buffer_criteria, out_rate);
+               LOGD("(max)content_max_byte_rate %d, byte_out_rate %d", buffer_criteria, out_rate);
        } else if (streamer->buffer_avg_bitrate > 0) {
                buffer_criteria = GET_BYTE_FROM_BIT(streamer->buffer_avg_bitrate * 3);
                out_rate = GET_BYTE_FROM_BIT(MAX(streamer->buffer_avg_bitrate, estimated_content_bitrate));
 
-               LOGD("(avg)content_max_byte_rate %d, byte_out_rate %d\n", buffer_criteria, out_rate);
+               LOGD("(avg)content_max_byte_rate %d, byte_out_rate %d", buffer_criteria, out_rate);
        } else {
-               LOGW("There is no content bitrate information\n");
+               LOGW("There is no content bitrate information");
        }
 
        if ((in_rate > 0) && (out_rate > 0))
-               buffer_buffering_time =  (gint)(out_rate / in_rate)*1000;
+               buffer_buffering_time =  (gint)(out_rate / in_rate) * 1000;
        else if ((in_rate <= 0) && (out_rate > 0))
                buffer_buffering_time = MAX_BUFFERING_TIME;
        else
@@ -584,12 +590,12 @@ streaming_get_current_bitrate_info(mm_player_streaming_t* streamer,
 }
 
 static void
-streaming_handle_fixed_buffering_mode(mm_player_streaming_tstreamer,
+streaming_handle_fixed_buffering_mode(mm_player_streaming_t *streamer,
                                                                                gint byte_out_rate,
                                                                                gint fixed_buffering_time,
-                                                                               streaming_buffer_info_tbuffer_info)
+                                                                               streaming_buffer_info_t *buffer_info)
 {
-       streaming_buffer_tbuffer_handle = NULL;
+       streaming_buffer_t *buffer_handle = NULL;
 
        guint buffering_bytes = 0;
        gint buffering_time = 0;
@@ -602,22 +608,22 @@ streaming_handle_fixed_buffering_mode(mm_player_streaming_t* streamer,
        buffer_handle = &(streamer->buffer_handle[streamer->streaming_buffer_type]);
        buffering_time = fixed_buffering_time;
 
-       LOGD("buffering time: %d ms, out rate: %d\n", buffering_time, byte_out_rate);
+       LOGD("buffering time: %d ms, out rate: %d", buffering_time, byte_out_rate);
 
        if ((buffering_time > 0) && (byte_out_rate > 0)) {
-               buffering_bytes = (guint)GET_NEW_BUFFERING_BYTE((gdouble)(byte_out_rate * buffering_time)/1000);
+               buffering_bytes = (guint)GET_NEW_BUFFERING_BYTE((gdouble)(byte_out_rate * buffering_time) / 1000);
        } else {
                if (buffering_time <= 0)
                        buffering_time = GET_CURRENT_BUFFERING_TIME(buffer_handle);
 
-               LOGW("content bitrate is not updated yet.\n");
+               LOGW("content bitrate is not updated yet.");
                buffering_bytes = GET_CURRENT_BUFFERING_BYTE(buffer_handle);
        }
 
        GET_PERCENT(buffering_time, GET_CURRENT_BUFFERING_TIME(buffer_handle), buffer_handle->buffer_high_percent, per_time);
        GET_PERCENT(buffering_bytes, GET_CURRENT_BUFFERING_BYTE(buffer_handle), buffer_handle->buffer_high_percent, per_byte);
 
-       LOGD("bytes %d, time %d, per_byte %f, per_time %f\n", buffering_bytes, buffering_time, per_byte, per_time);
+       LOGD("bytes %d, time %d, per_byte %f, per_time %f", buffering_bytes, buffering_time, per_byte, per_time);
 
        (*buffer_info).buffering_bytes = buffering_bytes;
        (*buffer_info).buffering_time = buffering_time;
@@ -626,13 +632,13 @@ streaming_handle_fixed_buffering_mode(mm_player_streaming_t* streamer,
 }
 
 static void
-streaming_handle_adaptive_buffering_mode(mm_player_streaming_tstreamer,
+streaming_handle_adaptive_buffering_mode(mm_player_streaming_t *streamer,
                                                                                streaming_content_info_t content_info,
                                                                                streaming_bitrate_info_t bitrate_info,
-                                                                               streaming_buffer_info_tbuffer_info,
+                                                                               streaming_buffer_info_t *buffer_info,
                                                                                gint expected_play_time)
 {
-       streaming_buffer_tbuffer_handle = NULL;
+       streaming_buffer_t *buffer_handle = NULL;
 
        gint buffering_bytes = 0;
        gint adj_buffering_bytes = 0;
@@ -645,19 +651,19 @@ streaming_handle_adaptive_buffering_mode(mm_player_streaming_t* streamer,
        MMPLAYER_RETURN_IF_FAIL(streamer);
        MMPLAYER_RETURN_IF_FAIL(buffer_info);
 
-       LOGD("pos %"G_GINT64_FORMAT", dur %"G_GINT64_FORMAT", size %"G_GUINT64_FORMAT", in/out:%d/%d, buffer_criteria:%d, time_rate:%d, need:%d ms\n",
+       LOGD("pos %"G_GINT64_FORMAT", dur %"G_GINT64_FORMAT", size %"G_GUINT64_FORMAT", in/out:%d/%d, buffer_criteria:%d, time_rate:%d, need:%d ms",
                                                        content_info.position, content_info.duration, content_info.content_size,
                                                        bitrate_info.byte_in_rate, bitrate_info.byte_out_rate,
                                                        bitrate_info.buffer_criteria, bitrate_info.time_rate, expected_play_time);
 
        if ((content_info.duration <= 0) ||
                (content_info.content_size <= 0)) {
-               LOGW("keep previous setting.\n");
+               LOGW("keep previous setting.");
                return;
        }
 
        if ((bitrate_info.byte_out_rate <= 0) || (bitrate_info.buffer_criteria == 0)) {
-               LOGW("keep previous setting.\n");
+               LOGW("keep previous setting.");
                return;
        }
 
@@ -666,46 +672,46 @@ streaming_handle_adaptive_buffering_mode(mm_player_streaming_t* streamer,
        if (bitrate_info.byte_in_rate < bitrate_info.byte_out_rate) {
                portion = (double)(expected_play_time * GST_MSECOND) / (double)content_info.duration;
                buffering_bytes = GET_NEW_BUFFERING_BYTE(((double)content_info.content_size * portion)  \
-                                                                                                                       * (1 - (double)bitrate_info.byte_in_rate/(double)bitrate_info.byte_out_rate));
+                                                                                                                       * (1 - (double)bitrate_info.byte_in_rate / (double)bitrate_info.byte_out_rate));
        } else {
                /* buffering_bytes will be set as streamer->default_val.buffering_time *
                 * receiving rate is bigger than avg content bitrate
                 * so there is no reason to buffering. if the buffering msg is posted
                 * in-rate or contents bitrate has wrong value. */
-               LOGW("don't need to do buffering.\n");
+               LOGW("don't need to do buffering.");
        }
 
        if (buffering_bytes > 0)
-               buffer_buffering_time = (gint)(buffering_bytes / bitrate_info.byte_out_rate)*1000;
+               buffer_buffering_time = (gint)(buffering_bytes / bitrate_info.byte_out_rate) * 1000;
 
        if (content_info.position <= 0) {
                /* if the buffer is filled under 50%, MSL use the original default buffering time.
                   if not, MSL use just 2 sec as a default buffering time. (to reduce initial buffering time) */
-               default_buffering_time = streamer->default_val.buffering_time - ((gdouble)streamer->buffering_percent/50)*1000;
+               default_buffering_time = streamer->default_val.buffering_time - ((gdouble)streamer->buffering_percent / 50) * 1000;
        } else {
                default_buffering_time = streamer->default_val.buffering_time;
        }
 
        if (buffer_buffering_time < default_buffering_time) {
-               LOGD("adjusted time: %d -> %d ms\n", buffer_buffering_time, default_buffering_time);
-               LOGD("adjusted bytes : %d or %d or %d\n",
+               LOGD("adjusted time: %d -> %d ms", buffer_buffering_time, default_buffering_time);
+               LOGD("adjusted bytes : %d or %d or %d",
                        buffering_bytes,
-                       (gint)(bitrate_info.byte_out_rate * buffer_buffering_time/1000),
-                       (gint)(bitrate_info.buffer_criteria * buffer_buffering_time/1000));
+                       (gint)(bitrate_info.byte_out_rate * buffer_buffering_time / 1000),
+                       (gint)(bitrate_info.buffer_criteria * buffer_buffering_time / 1000));
 
                /* start monitoring the abmormal state */
                if (content_info.position > 0)
                        streamer->default_val.buffering_monitor = TRUE;
 
                buffer_buffering_time = default_buffering_time;
-               adj_buffering_bytes = GET_NEW_BUFFERING_BYTE(bitrate_info.byte_out_rate * (gint)ceil((gdouble)buffer_buffering_time/1000));
+               adj_buffering_bytes = GET_NEW_BUFFERING_BYTE(bitrate_info.byte_out_rate * (gint)ceil((gdouble)buffer_buffering_time / 1000));
                buffering_bytes = MAX(buffering_bytes, adj_buffering_bytes);
        }
 
        GET_PERCENT(buffering_bytes, GET_CURRENT_BUFFERING_BYTE(buffer_handle), buffer_handle->buffer_high_percent, per_byte);
        GET_PERCENT(buffer_buffering_time, GET_CURRENT_BUFFERING_TIME(buffer_handle), buffer_handle->buffer_high_percent, per_time);
 
-       LOGD("monitor %d, bytes %d, time %d, per_byte %f, per_time %f\n",
+       LOGD("monitor %d, bytes %d, time %d, per_byte %f, per_time %f",
                                                                                streamer->default_val.buffering_monitor,
                                                                                buffering_bytes, buffer_buffering_time, per_byte, per_time);
 
@@ -717,13 +723,13 @@ streaming_handle_adaptive_buffering_mode(mm_player_streaming_t* streamer,
 }
 
 static void
-streaming_update_buffer_setting(mm_player_streaming_tstreamer,
-                                                                       GstMessage *buffering_msg,      /* can be null */
-                                                                       guint64 content_size,
-                                                                       gint64 position,
-                                                                       gint64 duration)
+streaming_update_buffer_setting(mm_player_streaming_t *streamer,
+                                                               GstMessage *buffering_msg,      /* can be null */
+                                                               guint64 content_size,
+                                                               gint64 position,
+                                                               gint64 duration)
 {
-       streaming_buffer_tbuffer_handle = NULL;
+       streaming_buffer_t *buffer_handle = NULL;
        MMPlayerBufferingMode buffering_mode = MM_PLAYER_BUFFERING_MODE_ADAPTIVE;
 
        streaming_buffer_info_t buffer_info;
@@ -756,7 +762,7 @@ streaming_update_buffer_setting(mm_player_streaming_t* streamer,
 
        streaming_get_current_bitrate_info(streamer, buffering_msg, content_info, &bitrate_info);
 
-       LOGD("buffering mode %d, new info in_r:%d, out_r:%d, cb:%d, bt:%d\n",
+       LOGD("buffering mode %d, new info in_r:%d, out_r:%d, cb:%d, bt:%d",
                                        buffering_mode, bitrate_info.byte_in_rate, bitrate_info.byte_out_rate,
                                        bitrate_info.buffer_criteria, bitrate_info.time_rate);
 
@@ -792,16 +798,16 @@ streaming_update_buffer_setting(mm_player_streaming_t* streamer,
                        buffer_handle->buffering_time = buffer_info.buffering_time;
        }
 
-       LOGD("adj buffer(%d) %d->%d bytes/%d->%d ms\n",
-                                       streamer->streaming_buffer_type,
-                                       GET_CURRENT_BUFFERING_BYTE(buffer_handle), buffer_info.buffering_bytes,
-                                       GET_CURRENT_BUFFERING_TIME(buffer_handle), buffer_info.buffering_time);
+       LOGD("adj buffer(%d) %d->%d bytes/%d->%d ms",
+               streamer->streaming_buffer_type,
+               GET_CURRENT_BUFFERING_BYTE(buffer_handle), buffer_info.buffering_bytes,
+               GET_CURRENT_BUFFERING_TIME(buffer_handle), buffer_info.buffering_time);
 
        /* queue2 : bytes, multiqueue : time */
        if (((GET_CURRENT_BUFFERING_BYTE(buffer_handle) < buffer_info.buffering_bytes) && IS_MUXED_BUFFERING_MODE(streamer)) ||
                ((GET_CURRENT_BUFFERING_TIME(buffer_handle) < buffer_info.buffering_time) && IS_DEMUXED_BUFFERING_MODE(streamer))) {
                if (duration > 0 && position > 0) {
-                       gint buffering_time_limit = (gint)(duration - position)/GST_MSECOND;
+                       gint buffering_time_limit = (gint)(duration - position) / GST_MSECOND;
 
                        if (buffer_info.buffering_time > buffering_time_limit)
                                buffer_info.buffering_time = buffering_time_limit;
@@ -812,16 +818,16 @@ streaming_update_buffer_setting(mm_player_streaming_t* streamer,
 
        streaming_set_buffer_percent(streamer, streamer->streaming_buffer_type, buffer_info.percent_byte, buffer_info.percent_time);
 
-       LOGD("buffer setting: size %d, time %d, per %f\n",
-                                                       GET_CURRENT_BUFFERING_BYTE(buffer_handle),
-                                                       GET_CURRENT_BUFFERING_TIME(buffer_handle),
-                                                       buffer_handle->buffer_high_percent);
+       LOGD("buffer setting: size %d, time %d, per %f",
+               GET_CURRENT_BUFFERING_BYTE(buffer_handle),
+               GET_CURRENT_BUFFERING_TIME(buffer_handle),
+               buffer_handle->buffer_high_percent);
 
        streamer->need_sync = TRUE;
 }
 
 static void
-streaming_adjust_min_threshold(mm_player_streaming_tstreamer, gint64 position)
+streaming_adjust_min_threshold(mm_player_streaming_t *streamer, gint64 position)
 {
 #define DEFAULT_TIME_PAD 1000  /* ms */
        gint playing_time = 0;
@@ -835,7 +841,7 @@ streaming_adjust_min_threshold(mm_player_streaming_t* streamer, gint64 position)
        LOGD("buffering monitor = %s", (streamer->default_val.buffering_monitor) ? "ON" : "OFF");
        LOGD("playing_time (%d ms) = %"G_GINT64_FORMAT" - %"G_GINT64_FORMAT, playing_time, position, streamer->default_val.prev_pos);
        LOGD("default time : %d, prev buffering t : %d",
-                                       streamer->default_val.buffering_time, streamer->buffer_handle[streamer->streaming_buffer_type].buffering_time);
+               streamer->default_val.buffering_time, streamer->buffer_handle[streamer->streaming_buffer_type].buffering_time);
 
        if ((streamer->default_val.buffering_monitor) && (playing_time <= streamer->default_val.buffering_time)) {
                gint time_gap = 0;
@@ -843,20 +849,20 @@ streaming_adjust_min_threshold(mm_player_streaming_t* streamer, gint64 position)
                if (time_gap <= 0)
                        time_gap = DEFAULT_TIME_PAD;
 
-               streamer->default_val.buffering_time += time_gap*2;
+               streamer->default_val.buffering_time += time_gap * 2;
                streamer->default_val.buffering_time = MIN(streamer->default_val.buffering_time, MAX_BUFFERING_TIME);
        } else {
                streamer->default_val.buffering_time = DEFAULT_BUFFERING_TIME;
        }
 
-       LOGD("new default min value %d \n", streamer->default_val.buffering_time);
+       LOGD("new default min value %d", streamer->default_val.buffering_time);
 
        streamer->default_val.buffering_monitor = FALSE;
        streamer->default_val.prev_pos = position;
 }
 
 static void
-streaming_update_buffering_status(mm_player_streaming_tstreamer, GstMessage *buffering_msg, gint64 position)
+streaming_update_buffering_status(mm_player_streaming_t *streamer, GstMessage *buffering_msg, gint64 position)
 {
        gint buffer_percent = 0;
 
@@ -898,11 +904,12 @@ streaming_update_buffering_status(mm_player_streaming_t* streamer, GstMessage *b
        }
 }
 
-void __mm_player_streaming_buffering(mm_player_streaming_t* streamer,
-                                                                               GstMessage *buffering_msg,
-                                                                               guint64 content_size,
-                                                                               gint64 position,
-                                                                               gint64 duration)
+void
+__mm_player_streaming_buffering(mm_player_streaming_t *streamer,
+                                                               GstMessage *buffering_msg,
+                                                               guint64 content_size,
+                                                               gint64 position,
+                                                               gint64 duration)
 {
        MMPLAYER_FENTER();
 
index 9664b04..4720051 100644 (file)
@@ -25,7 +25,7 @@
 #include "mm_player_tracks.h"
 
 #define INVALID_TRACK_INDEX -1
-#define LANGUAGE_CODE_SIZE (3+1) /* Size of ISO-639-1, and considering the nul-terminator */
+#define LANGUAGE_CODE_SIZE (3 + 1) /* Size of ISO-639-1, and considering the nul-terminator */
 
 /*---------------------------------------------------------------------------------------
 |    LOCAL FUNCTION PROTOTYPES:                                                                                      |
@@ -36,10 +36,11 @@ static int __mmplayer_track_get_language(mm_player_t *player, MMPlayerTrackType
 /*=======================================================================================
 |  FUNCTION DEFINITIONS                                                                                             |
 =======================================================================================*/
-int _mmplayer_get_track_count(MMHandleType hplayer,  MMPlayerTrackType type, int *count)
+int
+_mmplayer_get_track_count(MMHandleType hplayer,  MMPlayerTrackType type, int *count)
 {
        int ret = MM_ERROR_NONE;
-       mm_player_t *player = (mm_player_t*) hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
        MMHandleType attrs = 0;
 
        MMPLAYER_FENTER();
@@ -79,10 +80,11 @@ int _mmplayer_get_track_count(MMHandleType hplayer,  MMPlayerTrackType type, int
        return ret;
 }
 
-int _mmplayer_select_track(MMHandleType hplayer, MMPlayerTrackType type, int index)
+int
+_mmplayer_select_track(MMHandleType hplayer, MMPlayerTrackType type, int index)
 {
        int ret = MM_ERROR_NONE;
-       mm_player_t *player = (mm_player_t*) hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
 
        MMPLAYER_FENTER();
        MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
@@ -153,10 +155,11 @@ EXIT:
        return ret;
 }
 
-int _mmplayer_get_current_track(MMHandleType hplayer, MMPlayerTrackType type, int *index)
+int
+_mmplayer_get_current_track(MMHandleType hplayer, MMPlayerTrackType type, int *index)
 {
        int ret = MM_ERROR_NONE;
-       mm_player_t *player = (mm_player_t*) hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
        MMHandleType attrs = 0;
        gint count = 0;
 
@@ -213,10 +216,11 @@ EXIT:
        return ret;
 }
 
-int _mmplayer_get_track_language_code(MMHandleType hplayer, MMPlayerTrackType type, int index, char **code)
+int
+_mmplayer_get_track_language_code(MMHandleType hplayer, MMPlayerTrackType type, int index, char **code)
 {
        int ret = MM_ERROR_NONE;
-       mm_player_t *player = (mm_player_t*) hplayer;
+       mm_player_t *player = (mm_player_t *)hplayer;
        gchar *lang_code = NULL;
 
        MMPLAYER_FENTER();
@@ -228,7 +232,7 @@ int _mmplayer_get_track_language_code(MMHandleType hplayer, MMPlayerTrackType ty
        if (type == MM_PLAYER_TRACK_TYPE_TEXT && player->subtitle_language_list) { /* external subtitle */
                MMPlayerLangStruct *language_list = NULL;
 
-               lang_code = (gchar*)g_malloc0(LANGUAGE_CODE_SIZE * sizeof(char));
+               lang_code = (gchar *)g_malloc0(LANGUAGE_CODE_SIZE * sizeof(char));
 
                language_list = g_list_nth_data(player->subtitle_language_list, index);
                if (language_list == NULL) {
@@ -257,13 +261,14 @@ EXIT:
                else
                        *code = strndup("und", 3);
        }
-       g_free(lang_code);
+       MMPLAYER_FREEIF(lang_code);
 
        MMPLAYER_FLEAVE();
        return ret;
 }
 
-void __mmplayer_track_initialize(mm_player_t *player)
+void
+__mmplayer_track_initialize(mm_player_t *player)
 {
        MMPlayerTrackType type = MM_PLAYER_TRACK_TYPE_AUDIO;
 
@@ -278,7 +283,8 @@ void __mmplayer_track_initialize(mm_player_t *player)
        }
 }
 
-void __mmplayer_track_destroy(mm_player_t *player)
+void
+__mmplayer_track_destroy(mm_player_t *player)
 {
        MMPlayerTrackType type = MM_PLAYER_TRACK_TYPE_AUDIO;
        MMHandleType attrs = 0;
@@ -303,7 +309,8 @@ void __mmplayer_track_destroy(mm_player_t *player)
        }
 }
 
-void __mmplayer_track_update_selector_info(mm_player_t *player, MMPlayerTrackType type, GstPad *sinkpad)
+void
+__mmplayer_track_update_selector_info(mm_player_t *player, MMPlayerTrackType type, GstPad *sinkpad)
 {
        MMPLAYER_FENTER();
 
@@ -313,7 +320,8 @@ void __mmplayer_track_update_selector_info(mm_player_t *player, MMPlayerTrackTyp
        LOGD("type: %d, track cnt: %d", type, player->selector[type].total_track_num);
 }
 
-void __mmplayer_track_update_text_attr_info(mm_player_t *player, GstMessage *msg)
+void
+__mmplayer_track_update_text_attr_info(mm_player_t *player, GstMessage *msg)
 {
         MMHandleType attrs = 0;
         const GValue *lang_list = NULL;
@@ -386,7 +394,8 @@ EXIT:
        MMPLAYER_FLEAVE();
 }
 
-static int __mmplayer_track_get_language(mm_player_t *player, MMPlayerTrackType type, gint stream_index, gchar **code)
+static int
+__mmplayer_track_get_language(mm_player_t *player, MMPlayerTrackType type, gint stream_index, gchar **code)
 {
        GstTagList *tag_list = NULL;
        gchar *tag = NULL;
@@ -410,7 +419,7 @@ static int __mmplayer_track_get_language(mm_player_t *player, MMPlayerTrackType
        if (tag) {
                LOGD("language code: %s, len: %zu", tag, strlen(tag));
                g_strlcpy(*code, tag, LANGUAGE_CODE_SIZE);
-               g_free(tag);
+               MMPLAYER_FREEIF(tag);
        } else {
                LOGD("no language code info - und");
                g_strlcpy(*code, "und", LANGUAGE_CODE_SIZE);
index c59d9a5..1f03baf 100644 (file)
@@ -73,7 +73,7 @@ __get_state_name(int state)
 }
 
 gboolean
-__is_rtsp_streaming(mm_player_tplayer)
+__is_rtsp_streaming(mm_player_t *player)
 {
        MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
 
@@ -81,7 +81,7 @@ __is_rtsp_streaming(mm_player_t* player)
 }
 
 gboolean
-__is_http_streaming(mm_player_tplayer)
+__is_http_streaming(mm_player_t *player)
 {
        MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
 
@@ -89,7 +89,7 @@ __is_http_streaming(mm_player_t* player)
 }
 
 gboolean
-__is_streaming(mm_player_tplayer)
+__is_streaming(mm_player_t *player)
 {
        MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
 
@@ -98,7 +98,7 @@ __is_streaming(mm_player_t* player)
 }
 
 gboolean
-__is_live_streaming(mm_player_tplayer)
+__is_live_streaming(mm_player_t *player)
 {
        MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
 
@@ -106,7 +106,7 @@ __is_live_streaming(mm_player_t* player)
 }
 
 gboolean
-__is_http_live_streaming(mm_player_tplayer)
+__is_http_live_streaming(mm_player_t *player)
 {
        MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
 
@@ -114,7 +114,7 @@ __is_http_live_streaming(mm_player_t* player)
 }
 
 gboolean
-__is_dash_streaming(mm_player_tplayer)
+__is_dash_streaming(mm_player_t *player)
 {
        MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
 
@@ -122,7 +122,7 @@ __is_dash_streaming(mm_player_t* player)
 }
 
 gboolean
-__is_smooth_streaming(mm_player_tplayer)
+__is_smooth_streaming(mm_player_t *player)
 {
        MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
 
@@ -130,7 +130,7 @@ __is_smooth_streaming(mm_player_t* player)
 }
 
 gboolean
-__is_ms_buff_src(mm_player_tplayer)
+__is_ms_buff_src(mm_player_t *player)
 {
        MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
 
@@ -138,14 +138,14 @@ __is_ms_buff_src(mm_player_t* player)
 }
 
 gboolean
-__has_suffix(mm_player_t* player, const gchar* suffix)
+__has_suffix(mm_player_t *player, const gchar *suffix)
 {
        MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
        MMPLAYER_RETURN_VAL_IF_FAIL(suffix, FALSE);
 
        gboolean ret = FALSE;
-       gchart_url = g_ascii_strdown(player->profile.uri, -1);
-       gchart_suffix = g_ascii_strdown(suffix, -1);
+       gchar *t_url = g_ascii_strdown(player->profile.uri, -1);
+       gchar *t_suffix = g_ascii_strdown(suffix, -1);
 
        if (g_str_has_suffix(player->profile.uri, suffix))
                ret = TRUE;
@@ -157,14 +157,14 @@ __has_suffix(mm_player_t* player, const gchar* suffix)
 }
 
 gboolean
-__mmplayer_post_message(mm_player_t* player, enum MMMessageType msgtype, MMMessageParamType* param)
+__mmplayer_post_message(mm_player_t *player, enum MMMessageType msgtype, MMMessageParamType *param)
 {
        MMPLAYER_RETURN_VAL_IF_FAIL(player, FALSE);
 
        if (!player->msg_cb)
                return FALSE;
 
-       //LOGD("Message (type : %d)  will be posted using msg-cb(%p). \n", msgtype, player->msg_cb);
+       //LOGD("Message (type : %d)  will be posted using msg-cb(%p).", msgtype, player->msg_cb);
 
        player->msg_cb(msgtype, param, player->msg_cb_param);
 
@@ -172,9 +172,9 @@ __mmplayer_post_message(mm_player_t* player, enum MMMessageType msgtype, MMMessa
 }
 
 gboolean
-__mmplayer_dump_pipeline_state(mm_player_tplayer)
+__mmplayer_dump_pipeline_state(mm_player_t *player)
 {
-       GstIterator*iter = NULL;
+       GstIterator *iter = NULL;
        gboolean done = FALSE;
 
        GValue item = {0, };
@@ -183,7 +183,7 @@ __mmplayer_dump_pipeline_state(mm_player_t* player)
 
        GstState state = GST_STATE_VOID_PENDING;
        GstState pending = GST_STATE_VOID_PENDING;
-       GstClockTime time = 200*GST_MSECOND;
+       GstClockTime time = 200 * GST_MSECOND;
 
        MMPLAYER_FENTER();
 
@@ -203,7 +203,7 @@ __mmplayer_dump_pipeline_state(mm_player_t* player)
 
                                factory = gst_element_get_factory(element) ;
                                if (factory)
-                                       LOGE("%s:%s : From:%s To:%s   refcount : %d\n", GST_OBJECT_NAME(factory) , GST_ELEMENT_NAME(element) ,
+                                       LOGE("%s:%s : From:%s To:%s   refcount : %d", GST_OBJECT_NAME(factory) , GST_ELEMENT_NAME(element) ,
                                                gst_element_state_get_name(state), gst_element_state_get_name(pending) , GST_OBJECT_REFCOUNT_VALUE(element));
                                g_value_reset(&item);
                                break;
@@ -227,7 +227,7 @@ __mmplayer_dump_pipeline_state(mm_player_t* player)
        factory = gst_element_get_factory(element) ;
 
        if (factory) {
-               LOGE("%s:%s : From:%s To:%s  refcount : %d\n",
+               LOGE("%s:%s : From:%s To:%s  refcount : %d",
                        GST_OBJECT_NAME(factory),
                        GST_ELEMENT_NAME(element),
                        gst_element_state_get_name(state),
@@ -245,7 +245,8 @@ __mmplayer_dump_pipeline_state(mm_player_t* player)
        return FALSE;
 }
 
-int util_exist_file_path(const char *file_path)
+int
+util_exist_file_path(const char *file_path)
 {
        int fd = 0;
        struct stat stat_results = {0, };
@@ -280,7 +281,7 @@ int util_exist_file_path(const char *file_path)
        return MM_ERROR_NONE;
 }
 
-char**
+char **
 util_get_cookie_list(const char *cookies)
 {
        char **cookie_list = NULL;
@@ -290,7 +291,7 @@ util_get_cookie_list(const char *cookies)
        if (!cookies || !strlen(cookies))
                return NULL;
 
-       SECURE_LOGD("cookies : %zu[bytes] - %s \n", strlen(cookies), cookies);
+       SECURE_LOGD("cookies : %zu[bytes] - %s", strlen(cookies), cookies);
 
        temp = g_strdup(cookies);
 
@@ -309,7 +310,7 @@ util_get_cookie_list(const char *cookies)
                if (cookie_list[i]) {
                        if (strlen(cookie_list[i])) {
                                g_strstrip(cookie_list[i]);
-                               SECURE_LOGD("cookie_list[%d] : %zu[bytes] - %s \n", i, strlen(cookie_list[i]), cookie_list[i]);
+                               SECURE_LOGD("cookie_list[%d] : %zu[bytes] - %s", i, strlen(cookie_list[i]), cookie_list[i]);
                        } else {
                                cookie_list[i][0] = '\0';
                        }
@@ -317,9 +318,7 @@ util_get_cookie_list(const char *cookies)
        }
 
 EXIT:
-       if (temp)
-               g_free(temp);
-       temp = NULL;
+       MMPLAYER_FREEIF(temp);
 
        return cookie_list;
 }
@@ -329,7 +328,7 @@ bool
 util_is_sdp_file(const char *path)
 {
        gboolean ret = FALSE;
-       gcharuri = NULL;
+       gchar *uri = NULL;
 
        MMPLAYER_FENTER();
 
@@ -345,8 +344,8 @@ util_is_sdp_file(const char *path)
 
        /* strlen(".sdp") == 4 */
        if (strlen(uri) <= 4) {
-               LOGW("path is too short.\n");
-               g_free(uri);
+               LOGW("path is too short.");
+               MMPLAYER_FREEIF(uri);
                return ret;
        }
 
@@ -358,41 +357,40 @@ util_is_sdp_file(const char *path)
                /* FIXIT : do it soon */
                LOGD("no suffix");
 
-       g_free(uri);
-       uri = NULL;
+       MMPLAYER_FREEIF(uri);
 
        return ret;
 }
 
-const char*
+const char *
 util_get_charset(const char *file_path)
 {
-       UCharsetDetectorucsd;
-       const UCharsetMatchucm;
+       UCharsetDetector *ucsd;
+       const UCharsetMatch *ucm;
        UErrorCode status = U_ZERO_ERROR;
 
-       const charcharset = NULL;
+       const char *charset = NULL;
        char *buf = NULL;
-       FILEfin = 0;
+       FILE *fin = 0;
        size_t n_size = 0;
 
        fin = fopen(file_path, "r");
        if (!fin) {
-               SECURE_LOGE("fail to open file %s\n", file_path);
+               SECURE_LOGE("fail to open file %s", file_path);
                return NULL;
        }
 
        ucsd = ucsdet_open(&status);
        if (U_FAILURE(status)) {
-               LOGE("fail to ucsdet_open\n");
+               LOGE("fail to ucsdet_open");
                goto done;
        }
 
        ucsdet_enableInputFilter(ucsd, TRUE);
 
-       buf = g_malloc(1024*1024);
+       buf = g_try_malloc(1024 * 1024);
        if (!buf) {
-               LOGE("fail to alloc\n");
+               LOGE("fail to alloc");
                goto done;
        }
 
@@ -403,19 +401,19 @@ util_get_charset(const char *file_path)
 
        ucsdet_setText(ucsd, buf, strlen(buf), &status);
        if (U_FAILURE(status)) {
-               LOGE("fail to ucsdet_setText\n");
+               LOGE("fail to ucsdet_setText");
                goto done;
        }
 
        ucm = ucsdet_detect(ucsd, &status);
        if (U_FAILURE(status)) {
-               LOGE("fail to ucsdet_detect\n");
+               LOGE("fail to ucsdet_detect");
                goto done;
        }
 
        charset = ucsdet_getName(ucm, &status);
        if (U_FAILURE(status)) {
-               LOGE("fail to ucsdet_getName\n");
+               LOGE("fail to ucsdet_getName");
                goto done;
        }
 
@@ -430,18 +428,18 @@ done:
        if (ucsd)
                ucsdet_close(ucsd);
 
-       if (buf)
-               g_free(buf);
+       MMPLAYER_FREEIF(buf);
 
        return charset;
 }
 
-int util_get_pixtype(unsigned int fourcc)
+int
+util_get_pixtype(unsigned int fourcc)
 {
        int pixtype = MM_PIXEL_FORMAT_INVALID;
 
     /*
-       char *pfourcc = (char*)&fourcc;
+       char *pfourcc = (char *)&fourcc;
 
        LOGD("fourcc(%c%c%c%c)",
                pfourcc[0], pfourcc[1], pfourcc[2], pfourcc[3]);
@@ -510,7 +508,8 @@ int util_get_pixtype(unsigned int fourcc)
        return pixtype;
 }
 
-static int _util_storage_supported_cb(int storage_id, storage_type_e type,
+static int
+_util_storage_supported_cb(int storage_id, storage_type_e type,
        storage_state_e state, const char *path, void *user_data)
 {
        MMPlayerStorageInfo *storage_info = (MMPlayerStorageInfo *)user_data;
@@ -526,7 +525,8 @@ static int _util_storage_supported_cb(int storage_id, storage_type_e type,
        return TRUE;
 }
 
-bool util_get_storage_info(const char *path, MMPlayerStorageInfo *storage_info)
+bool
+util_get_storage_info(const char *path, MMPlayerStorageInfo *storage_info)
 {
        int ret = 0;
        const char *file_path = path;
@@ -534,7 +534,7 @@ bool util_get_storage_info(const char *path, MMPlayerStorageInfo *storage_info)
        MMPLAYER_RETURN_VAL_IF_FAIL(file_path && storage_info, false);
 
        if (strncmp(file_path, "file://", strlen("file://")) == 0)
-               file_path = path+7; /* remove file prefix */
+               file_path = path + 7; /* remove file prefix */
 
        if (strncmp(file_path, MEDIA_PATH_EXTERNAL, strlen(MEDIA_PATH_EXTERNAL)) == 0) {
                storage_info->type = STORAGE_TYPE_EXTERNAL;
index f0f86e0..30c43a6 100644 (file)
@@ -82,13 +82,13 @@ int MMPlayerPriv::Destroy(void)
 
        MMPLAYER_CMD_UNLOCK(priv_player);
 
-       g_mutex_clear(&((mm_player_t*)priv_player)->cmd_lock);
-       g_mutex_clear(&((mm_player_t*)priv_player)->playback_lock);
+       g_mutex_clear(&((mm_player_t *)priv_player)->cmd_lock);
+       g_mutex_clear(&((mm_player_t *)priv_player)->playback_lock);
 
-       memset((mm_player_t*)priv_player, 0x00, sizeof(mm_player_t));
+       memset((mm_player_t *)priv_player, 0x00, sizeof(mm_player_t));
 
        /* free player */
-       g_free((void*)priv_player);
+       g_free((void *)priv_player);
        priv_player = NULL;
 
        return ret;
@@ -132,7 +132,7 @@ int MMPlayerPriv::GetCurrentState(MMPlayerStateType *state)
        int ret = MM_ERROR_NONE;
 
        *state = MM_PLAYER_STATE_NULL;
-       ret = _mmplayer_get_state(priv_player, (int*)state);
+       ret = _mmplayer_get_state(priv_player, (int *)state);
 
        return ret;
 }
@@ -142,7 +142,7 @@ int MMPlayerPriv::ParseProfile(const gchar *uri, int *uri_type)
        int ret = MM_ERROR_NONE;
        MMPlayerParseProfile profile;
 
-       memset((void*)&profile, 0, sizeof(MMPlayerParseProfile));
+       memset((void *)&profile, 0, sizeof(MMPlayerParseProfile));
 
        ret = __mmplayer_parse_profile(uri, NULL, &profile);
        if (uri_type)
index 28b7aa2..e47eb5b 100644 (file)
@@ -107,7 +107,7 @@ void MMPlayerPrivTest::TearDown()
 TEST_F(MMPlayerPrivTest, Realize_P)
 {
        int ret = MM_ERROR_NONE;
-       const gcharuri = "http://test-url.mp4";
+       const gchar *uri = "http://test-url.mp4";
 
        ret = priv_player.SetUri(uri);
        EXPECT_EQ(ret, MM_ERROR_NONE);
@@ -126,7 +126,7 @@ TEST_F(MMPlayerPrivTest, Realize_N)
 TEST_F(MMPlayerPrivTest, ParseProfile_p)
 {
        int ret = MM_ERROR_NONE;
-       const gcharuri = "http://test-url";
+       const gchar *uri = "http://test-url";
        int uri_type = MM_PLAYER_URI_TYPE_NONE;
 
        ret = priv_player.ParseProfile(uri, &uri_type);
@@ -138,7 +138,7 @@ TEST_F(MMPlayerPrivTest, ParseProfile_p)
 TEST_F(MMPlayerPrivTest, ParseProfile_n)
 {
        int ret = MM_ERROR_NONE;
-       const gcharuri = "file://non-existing-file.mp4";
+       const gchar *uri = "file://non-existing-file.mp4";
 
        ret = priv_player.ParseProfile(uri, NULL);