From: Hyunil Park Date: Thu, 16 Jul 2015 06:07:38 +0000 (+0900) Subject: Add USE_DLOG for using DLOG or fprintf X-Git-Tag: submit/tizen/20150716.062302^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F05%2F44005%2F1;p=platform%2Fupstream%2Fgstreamer.git Add USE_DLOG for using DLOG or fprintf Change-Id: I75ed73a091abec600ee45e3c16af42e838bffad4 Signed-off-by: Hyunil Park --- diff --git a/configure.ac b/configure.ac index f3fa7e25f8..deb2d49ab5 100644 --- a/configure.ac +++ b/configure.ac @@ -635,6 +635,23 @@ AC_ARG_ENABLE(Bsymbolic, enable_Bsymbolic=no]) LDFLAGS="${SAVED_LDFLAGS}"]) +dnl Check for dlog +AC_ARG_ENABLE(dlog, AC_HELP_STRING([--enable-dlog], [using dlog]), +[ + case "${enableval}" in + yes) USE_DLOG=yes ;; + no) USE_DLOG=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-dlog) ;; + esac +],[USE_DLOG=no]) + +if test "x$USE_DLOG" = "xyes"; then + PKG_CHECK_MODULES(DLOG, dlog) + AC_SUBST(DLOG_CFLAGS) + AC_SUBST(DLOG_LIBS) +fi +AM_CONDITIONAL(USE_DLOG, test "x$USE_DLOG" = "xyes") +dnl end dnl *** set variables based on configure arguments diff --git a/gst/Makefile.am b/gst/Makefile.am index 2e2a79cc52..a669f6ddc2 100644 --- a/gst/Makefile.am +++ b/gst/Makefile.am @@ -148,6 +148,12 @@ libgstreamer_@GST_API_VERSION@_la_LIBADD = \ $(GST_ALL_LIBS) \ $(WIN32_LIBS) \ $(LIBM) +if USE_DLOG +libgstreamer_@GST_API_VERSION@_la_CFLAGS += $(DLOG_CFLAGS) +libgstreamer_@GST_API_VERSION@_la_LIBADD += $(DLOG_LIBS) +libgstreamer_@GST_API_VERSION@_la_CFLAGS += -DUSE_DLOG +endif + libgstreamer_@GST_API_VERSION@_la_LDFLAGS = \ $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS) diff --git a/gst/gstinfo.c b/gst/gstinfo.c index 3f566866aa..12d8e56e43 100644 --- a/gst/gstinfo.c +++ b/gst/gstinfo.c @@ -220,6 +220,10 @@ dladdr (void *address, Dl_info * dl) #endif /* __sgi__ */ #endif +#if defined(USE_DLOG) +#include +#endif + static void gst_debug_reset_threshold (gpointer category, gpointer unused); static void gst_debug_reset_all_thresholds (void); @@ -1020,12 +1024,23 @@ gst_debug_log_default (GstDebugCategory * category, GstDebugLevel level, levelcolor = levelcolormap[level]; #define PRINT_FMT " %s"PID_FMT"%s "PTR_FMT" %s%s%s %s"CAT_FMT"%s %s\n" - fprintf (log_file, "%" GST_TIME_FORMAT PRINT_FMT, GST_TIME_ARGS (elapsed), - pidcolor, pid, clear, g_thread_self (), levelcolor, - gst_debug_level_get_name (level), clear, color, - gst_debug_category_get_name (category), file, line, function, obj, - clear, gst_debug_message_get (message)); - fflush (log_file); + +#if defined(USE_DLOG) + SLOG(LOG_WARN, "GST_LOG", + "%" GST_TIME_FORMAT PRINT_FMT, GST_TIME_ARGS (elapsed), + pidcolor, pid, clear, g_thread_self (), levelcolor, + gst_debug_level_get_name (level), clear, color, + gst_debug_category_get_name (category), file, line, function, obj, + clear, gst_debug_message_get (message)); +#else + fprintf (log_file, "%" GST_TIME_FORMAT PRINT_FMT, GST_TIME_ARGS (elapsed), + pidcolor, pid, clear, g_thread_self (), levelcolor, + gst_debug_level_get_name (level), clear, color, + gst_debug_category_get_name (category), file, line, function, obj, + clear, gst_debug_message_get (message)); + fflush (log_file); +#endif + #undef PRINT_FMT g_free (color); #ifdef G_OS_WIN32 @@ -1067,11 +1082,22 @@ gst_debug_log_default (GstDebugCategory * category, GstDebugLevel level, } else { /* no color, all platforms */ #define PRINT_FMT " "PID_FMT" "PTR_FMT" %s "CAT_FMT" %s\n" + + /* Tizen doesn't care about Win32 */ +#if defined(USG_DLOG) && !defined(G_OS_WIN32) + SLOG(LOG_WARN, "GST_LOG", + "%" GST_TIME_FORMAT PRINT_FMT, GST_TIME_ARGS (elapsed), + pid, g_thread_self (), gst_debug_level_get_name (level), + gst_debug_category_get_name (category), file, line, function, obj, + gst_debug_message_get (message)); +#else fprintf (log_file, "%" GST_TIME_FORMAT PRINT_FMT, GST_TIME_ARGS (elapsed), pid, g_thread_self (), gst_debug_level_get_name (level), gst_debug_category_get_name (category), file, line, function, obj, gst_debug_message_get (message)); fflush (log_file); +#endif + #undef PRINT_FMT } diff --git a/packaging/gstreamer.spec b/packaging/gstreamer.spec index 301125c424..7b492ba94f 100644 --- a/packaging/gstreamer.spec +++ b/packaging/gstreamer.spec @@ -2,7 +2,7 @@ Name: gstreamer Version: 1.4.1 -Release: 1 +Release: 2 Summary: Streaming-Media Framework Runtime License: LGPL-2.1+ Group: Multimedia/Framework @@ -18,6 +18,7 @@ BuildRequires: glib2-devel >= 2.32.0 BuildRequires: libtool BuildRequires: libxml2-devel BuildRequires: gobject-introspection-devel >= 1.31.1 +BuildRequires: pkgconfig(dlog) %description GStreamer is a streaming-media framework, based on graphs of filters @@ -74,7 +75,8 @@ export CFLAGS="%{optflags} -fno-strict-aliasing" %if %{with introspection} --enable-introspection\ %endif - --disable-static + --disable-static\ + --enable-dlog make %{?_smp_mflags}