[0.6.55] modify macro to make it regular statement 17/133417/1
authorEunhae Choi <eunhae1.choi@samsung.com>
Mon, 12 Jun 2017 06:50:07 +0000 (15:50 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Mon, 12 Jun 2017 06:50:07 +0000 (15:50 +0900)
Change-Id: Icfdc4f392d5b3e4cc1668f3ae559f3bd4d8e1da7

packaging/libmm-player.spec
src/include/mm_player_streaming.h
src/include/mm_player_utils.h
src/mm_player_priv.c

index cc6bb2a..4e04055 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-player
 Summary:    Multimedia Framework Player Library
-Version:    0.6.54
+Version:    0.6.55
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index 105d889..46659ca 100644 (file)
@@ -65,7 +65,7 @@ do { \
                LOGW("set default per info\n"); \
                d = c; \
        } \
-} while (0);
+} while (0)
 
 
 #define PLAYER_BUFFER_CAST(handle)     ((streaming_buffer_t *)(handle))
index ad33ffc..cf4d2ac 100644 (file)
 #define MMPLAYER_MAX_INT (2147483647)
 
 #define MMPLAYER_FREEIF(x) \
-if (x) \
-       g_free(x); \
-x = NULL;
+do {   \
+       if (x) \
+               g_free(x); \
+       x = NULL;       \
+} while (0)
 
 #define MMPLAYER_GET_ATTRS(x_player) ((mm_player_t*)x_player)->attrs
 
@@ -146,7 +148,7 @@ do { \
        gchar* caps_type = NULL; \
        caps_type = gst_caps_to_string(x_caps); \
        LOGD("caps: %s\n", caps_type); \
-       MMPLAYER_FREEIF(caps_type) \
+       MMPLAYER_FREEIF(caps_type); \
 } while (0)
 
 /* message posting */
@@ -164,28 +166,32 @@ do { \
 } while (0)
 
 #define MMPLAYER_CHECK_STATE(x_player, x_command) \
-LOGD("checking player state before doing %s\n", #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; \
-}
+do {   \
+       LOGD("checking player state before doing %s\n", #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) \
-LOGD("setting state [%s:%d] to [%s]\n", #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\n", #x_state, GST_ELEMENT_NAME(x_element)); \
-       goto STATE_CHANGE_FAILED; \
-}
+do {   \
+       LOGD("setting state [%s:%d] to [%s]\n", #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\n", #x_state, GST_ELEMENT_NAME(x_element)); \
+               goto STATE_CHANGE_FAILED; \
+       }       \
+} while (0)
 
 #define MMPLAYER_CHECK_NULL(x_var) \
 if (!x_var) { \
@@ -222,7 +228,7 @@ do { \
                else \
                        LOGE("wrong signal type [%d]\n", x_type); \
        } \
-} while (0);
+} while (0)
 
 /* release element resource */
 #define MMPLAYER_RELEASE_ELEMENT(x_player, x_bin, x_id) \
index 3e8fad3..ebb1da9 100644 (file)
@@ -1774,29 +1774,31 @@ if (gst_tag_list_get_string(tag_list, gsttag, &string)) {\
 }
 
 #define MMPLAYER_UPDATE_TAG_IMAGE(gsttag, attribute, playertag) \
-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");\
-               return FALSE;\
-       } \
-       SECURE_LOGD("update album cover data : %p, size : %d\n", info.data, info.size);\
-       MMPLAYER_FREEIF(player->album_art);\
-       player->album_art = (gchar *)g_malloc(info.size);\
-       if (player->album_art) {\
-               memcpy(player->album_art, info.data, info.size);\
-               mm_attrs_set_data_by_name(attribute, playertag, (void *)player->album_art, info.size);\
-               if (MMPLAYER_IS_HTTP_LIVE_STREAMING(player)) {\
-                       msg_param.data = (void *)player->album_art;\
-                       msg_param.size = info.size;\
-                       MMPLAYER_POST_MSG(player, MM_MESSAGE_IMAGE_BUFFER, &msg_param);\
-                       SECURE_LOGD("post message image buffer data : %p, size : %d\n", info.data, info.size);\
+do {   \
+       GstSample *sample = NULL;\
+       if (gst_tag_list_get_sample_index(tag_list, gsttag, index, &sample)) {\
+               GstMapInfo info = GST_MAP_INFO_INIT;\
+               buffer = gst_sample_get_buffer(sample);\
+               if (!gst_buffer_map(buffer, &info, GST_MAP_READ)) {\
+                       LOGD("failed to get image data from tag");\
+                       return FALSE;\
                } \
-       } \
-       gst_buffer_unmap(buffer, &info);\
-}
+               SECURE_LOGD("update album cover data : %p, size : %d\n", info.data, info.size);\
+               MMPLAYER_FREEIF(player->album_art);\
+               player->album_art = (gchar *)g_malloc(info.size);\
+               if (player->album_art) {\
+                       memcpy(player->album_art, info.data, info.size);\
+                       mm_attrs_set_data_by_name(attribute, playertag, (void *)player->album_art, info.size);\
+                       if (MMPLAYER_IS_HTTP_LIVE_STREAMING(player)) {\
+                               msg_param.data = (void *)player->album_art;\
+                               msg_param.size = info.size;\
+                               MMPLAYER_POST_MSG(player, MM_MESSAGE_IMAGE_BUFFER, &msg_param);\
+                               SECURE_LOGD("post message image buffer data : %p, size : %d\n", info.data, info.size);\
+                       } \
+               } \
+               gst_buffer_unmap(buffer, &info);\
+       }       \
+} while (0)
 
 #define MMPLAYER_UPDATE_TAG_UINT(gsttag, attribute, playertag) \
 if (gst_tag_list_get_uint(tag_list, gsttag, &v_uint)) {\
@@ -3412,7 +3414,7 @@ __mmplayer_gst_decode_no_more_pads(GstElement *elem, gpointer data)
                        __mmplayer_del_sink(player, player->pipeline->audiobin[MMPLAYER_A_SINK].gst);
 
                        MMPLAYER_RELEASE_ELEMENT(player, player->pipeline->audiobin, MMPLAYER_A_BIN);
-                       MMPLAYER_FREEIF(player->pipeline->audiobin)
+                       MMPLAYER_FREEIF(player->pipeline->audiobin);
                }
 
                if (player->num_dynamic_pad == 0)
@@ -4205,31 +4207,6 @@ ERROR:
  * @remark
  * @see                __mmplayer_gst_create_midi_pipeline, __mmplayer_gst_create_video_pipeline
  */
-#define MMPLAYER_CREATEONLY_ELEMENT(x_bin, x_id, x_factory, x_name) \
-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;\
-} \
-
-#define MMPLAYER_CREATE_ELEMENT_ADD_BIN(x_bin, x_id, x_factory, x_name, y_bin, x_player) \
-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 (!gst_bin_add(GST_BIN(y_bin), GST_ELEMENT(x_bin[x_id].gst))) { \
-       LOGD("__mmplayer_gst_element_link_bucket : Adding element [%s]  to bin [%s] failed\n",\
-               GST_ELEMENT_NAME(GST_ELEMENT(x_bin[x_id].gst)),\
-               GST_ELEMENT_NAME(GST_ELEMENT(y_bin)));\
-       goto 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 {\
@@ -8633,7 +8610,6 @@ __mmplayer_init_gstreamer(mm_player_t* player) // @
                LOGD("argv[%d] : %s\n", 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");