From 297611df6ba577edbcd3c0c75b9c38564373b845 Mon Sep 17 00:00:00 2001 From: Sangkyu Park Date: Fri, 5 Jun 2015 11:10:31 +0900 Subject: [PATCH] 1. Fix the warning code. 2. Fix the pad probe function. 3. Add log color. Change-Id: I66e6fcdaaa6931e50ed33039d4709b622c6fc4bb Signed-off-by: Sangkyu Park --- common/include/mm_wfd_sink_dlog.h | 33 +++++++++++++++++++++------------ packaging/libmm-wfd.spec | 2 +- sink/mm_wfd_sink.c | 4 +++- sink/mm_wfd_sink_priv.c | 3 --- sink/mm_wfd_sink_util.c | 10 +++++----- 5 files changed, 30 insertions(+), 22 deletions(-) diff --git a/common/include/mm_wfd_sink_dlog.h b/common/include/mm_wfd_sink_dlog.h index d9e2f99..54d7d01 100755 --- a/common/include/mm_wfd_sink_dlog.h +++ b/common/include/mm_wfd_sink_dlog.h @@ -28,57 +28,66 @@ extern "C" { #endif #define LOG_TAG "MM_WFD_SINK" +#define FONT_COLOR_RESET "\033[0m" +#define FONT_COLOR_RED "\033[31m" +#define FONT_COLOR_GREEN "\033[32m" +#define FONT_COLOR_YELLOW "\033[33m" +#define FONT_COLOR_BLUE "\033[34m" +#define FONT_COLOR_PURPLE "\033[35m" +#define FONT_COLOR_CYAN "\033[36m" +#define FONT_COLOR_GRAY "\033[37m" + #define wfd_sink_debug(fmt, arg...) do { \ - LOGD(""fmt"", ##arg); \ + LOGD(FONT_COLOR_RESET""fmt"", ##arg); \ } while (0) #define wfd_sink_info(fmt, arg...) do { \ - LOGI(""fmt"", ##arg); \ + LOGI(FONT_COLOR_GREEN""fmt""FONT_COLOR_RESET, ##arg); \ } while (0) #define wfd_sink_error(fmt, arg...) do { \ - LOGE(""fmt"", ##arg); \ + LOGE(FONT_COLOR_RED""fmt""FONT_COLOR_RESET, ##arg); \ } while (0) #define wfd_sink_warning(fmt, arg...) do { \ - LOGW(""fmt"", ##arg); \ + LOGW(FONT_COLOR_YELLOW""fmt""FONT_COLOR_RESET, ##arg); \ } while (0) #define wfd_sink_debug_fenter() do { \ - LOGD(""); \ + LOGD(FONT_COLOR_RESET""); \ } while (0) #define wfd_sink_debug_fleave() do { \ - LOGD(""); \ + LOGD(FONT_COLOR_RESET""); \ } while (0) #define wfd_sink_error_fenter() do { \ - LOGE("NO-ERROR : "); \ + LOGE(FONT_COLOR_RESET"NO-ERROR : "); \ } while (0) #define wfd_sink_error_fleave() do { \ - LOGE("NO-ERROR : "); \ + LOGE(FONT_COLOR_RESET"NO-ERROR : "); \ } while (0) #define wfd_sink_sucure_info(fmt, arg...) do { \ - SECURE_LOGI(""fmt"", ##arg); \ + SECURE_LOGI(FONT_COLOR_GREEN""fmt""FONT_COLOR_RESET, ##arg); \ } while (0) #define wfd_sink_return_if_fail(expr) \ if(!(expr)) { \ - wfd_sink_error("failed [%s]\n", #expr); \ + wfd_sink_error(FONT_COLOR_RED"failed [%s]\n"FONT_COLOR_RESET, #expr); \ return; \ } #define wfd_sink_return_val_if_fail(expr, val) \ if (!(expr)) { \ - wfd_sink_error("failed [%s]\n", #expr); \ + wfd_sink_error(FONT_COLOR_RED"failed [%s]\n"FONT_COLOR_RESET, #expr); \ return val; \ } #define wfd_sink_assert_not_reached() \ { \ - wfd_sink_error("assert_not_reached()"); \ + wfd_sink_error(FONT_COLOR_RED"assert_not_reached()"FONT_COLOR_RESET); \ assert(0); \ } diff --git a/packaging/libmm-wfd.spec b/packaging/libmm-wfd.spec index 400bd1f..63a2d9b 100644 --- a/packaging/libmm-wfd.spec +++ b/packaging/libmm-wfd.spec @@ -1,6 +1,6 @@ Name: libmm-wfd Summary: Multimedia Framework Wifi-Display Library -Version: 0.2.162 +Version: 0.2.165 Release: 0 Group: System/Libraries License: Apache License 2.0 diff --git a/sink/mm_wfd_sink.c b/sink/mm_wfd_sink.c index a01f35e..d9872c8 100755 --- a/sink/mm_wfd_sink.c +++ b/sink/mm_wfd_sink.c @@ -124,6 +124,7 @@ int mm_wfd_sink_unprepare(MMHandleType wfd_sink) int mm_wfd_sink_destroy(MMHandleType wfd_sink) { int result = MM_ERROR_NONE; + mm_wfd_sink_t * sink_handle = NULL; wfd_sink_return_val_if_fail(wfd_sink, MM_ERROR_WFD_NOT_INITIALIZED); @@ -133,7 +134,8 @@ int mm_wfd_sink_destroy(MMHandleType wfd_sink) g_mutex_clear(&(((mm_wfd_sink_t *)wfd_sink)->cmd_lock)); - MMWFDSINK_FREEIF(wfd_sink); + sink_handle = (mm_wfd_sink_t *)wfd_sink; + MMWFDSINK_FREEIF(sink_handle); return result; } diff --git a/sink/mm_wfd_sink_priv.c b/sink/mm_wfd_sink_priv.c index a7e7013..d925374 100755 --- a/sink/mm_wfd_sink_priv.c +++ b/sink/mm_wfd_sink_priv.c @@ -1265,7 +1265,6 @@ _mm_wfd_sink_check_running_time(GstPad * pad, GstPadProbeInfo * info, gpointer u GstClockTimeDiff diff = GST_CLOCK_TIME_NONE; GstBuffer * buffer = NULL; gint64 ts_offset = 0LL; - GstPadProbeReturn ret = GST_PAD_PROBE_OK; wfd_sink_return_val_if_fail (info, FALSE); wfd_sink_return_val_if_fail (wfd_sink && @@ -2320,7 +2319,6 @@ static int __mm_wfd_sink_create_audiobin(mm_wfd_sink_t *wfd_sink) GstPad *pad = NULL; GstPad *ghostpad = NULL; GstCaps *caps = NULL; - gint i; wfd_sink_debug_fenter(); @@ -2788,7 +2786,6 @@ static int __mm_wfd_sink_create_videobin(mm_wfd_sink_t *wfd_sink) GList* element_bucket = NULL; GstPad *pad = NULL; GstPad *ghostpad = NULL; - gint i = 0; wfd_sink_debug_fenter(); diff --git a/sink/mm_wfd_sink_util.c b/sink/mm_wfd_sink_util.c index fedb81e..d03dda5 100755 --- a/sink/mm_wfd_sink_util.c +++ b/sink/mm_wfd_sink_util.c @@ -78,7 +78,7 @@ _mm_wfd_sink_util_pad_probe_cb(GstPad * pad, GstPadProbeInfo * info, gpointer u_ return GST_PAD_PROBE_DROP; } - if (info->type == GST_PAD_PROBE_TYPE_BUFFER) + if (info->type & GST_PAD_PROBE_TYPE_BUFFER) { GstBuffer *buffer = gst_pad_probe_info_get_buffer (info); /* show name and timestamp */ @@ -88,10 +88,10 @@ _mm_wfd_sink_util_pad_probe_cb(GstPad * pad, GstPadProbeInfo * info, gpointer u_ GST_TIME_ARGS(GST_BUFFER_TIMESTAMP(buffer)), gst_buffer_get_size(buffer)); } - else if (info->type == GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM || - info->type == GST_PAD_PROBE_TYPE_EVENT_UPSTREAM || - info->type == GST_PAD_PROBE_TYPE_EVENT_FLUSH || - info->type == GST_PAD_PROBE_TYPE_EVENT_BOTH) + else if (info->type & GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM || + info->type & GST_PAD_PROBE_TYPE_EVENT_UPSTREAM || + info->type & GST_PAD_PROBE_TYPE_EVENT_FLUSH || + info->type & GST_PAD_PROBE_TYPE_EVENT_BOTH) { GstEvent *event = gst_pad_probe_info_get_event (info); -- 2.7.4