[0.2.222] Add concat element for gapless playback
[platform/core/multimedia/libmm-player.git] / src / include / mm_player_gst.h
index 298cfab..4a8bc90 100644 (file)
@@ -35,23 +35,31 @@ extern "C"
 #endif
 
 /* get caps info */
-#define MMPLAYER_GST_GET_CAPS_INFO(x_pad, x_caps, x_str, x_name, x_ret) \
+#define MMPLAYER_GST_GET_CAPS_INFO(x_caps, x_str, x_name, x_ret) \
        do { \
-               x_caps = gst_pad_get_current_caps(x_pad); \
-               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); \
-                       } \
+               x_ret = TRUE; \
+               if (!(x_caps)) { \
+                       LOGE("input caps is NULL"); \
+                       x_ret = FALSE; \
+                       break; \
                } \
-               if (!x_caps || !x_str || !x_name) { \
+               x_str = gst_caps_get_structure(x_caps, 0); \
+               if (x_str) \
+                       x_name = gst_structure_get_name(x_str); \
+               if (!(x_str) || !(x_name)) { \
                        LOGE("failed to get caps info"); \
                        x_ret = FALSE; \
                } \
        } while (0)
 
+#define MMPLAYER_GST_GET_CAPS_INFO_FROM_PAD(x_pad, x_caps, x_str, x_name, x_ret) \
+       do { \
+               x_caps = gst_pad_get_current_caps(x_pad); \
+               if (!(x_caps)) \
+                       x_caps = gst_pad_query_caps(x_pad, NULL); \
+               MMPLAYER_GST_GET_CAPS_INFO(x_caps, x_str, x_name, x_ret); \
+       } while (0)
+
 /*=======================================================================================
 | GLOBAL FUNCTION PROTOTYPES                                                           |
 ========================================================================================*/