mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-25 19:21:06 +00:00
printf: don't build if debugging subsystem was disabled
This commit is contained in:
parent
5299a0cd65
commit
0e1dd050a5
4 changed files with 52 additions and 2 deletions
|
@ -26,10 +26,13 @@ else
|
|||
GST_PLUGIN_SRC = gstplugin.c
|
||||
endif
|
||||
|
||||
# FIXME: might not be needed if debug logging is disabled
|
||||
if !GST_DISABLE_GST_DEBUG
|
||||
SUBDIRS_PRINTF = printf
|
||||
GST_PRINTF_LA = printf/libgstprintf.la
|
||||
|
||||
else
|
||||
SUBDIRS_PRINTF =
|
||||
GST_PRINTF_LA =
|
||||
endif
|
||||
|
||||
SUBDIRS = $(SUBDIRS_PARSE) $(SUBDIRS_PRINTF)
|
||||
|
||||
|
|
|
@ -278,6 +278,11 @@ extern GstDebugCategory *_priv_GST_CAT_POLL;
|
|||
|
||||
#endif
|
||||
|
||||
#ifdef GST_DISABLE_GST_DEBUG
|
||||
/* for _gst_element_error_printf */
|
||||
#define __gst_vasprintf __gst_info_fallback_vasprintf
|
||||
int __gst_vasprintf (char **result, char const *format, va_list args);
|
||||
#endif
|
||||
|
||||
/**** objects made opaque until the private bits have been made private ****/
|
||||
|
||||
|
|
|
@ -97,7 +97,9 @@
|
|||
#include "gst-i18n-lib.h"
|
||||
#include "glib-compat-private.h"
|
||||
|
||||
#ifndef GST_DISABLE_GST_DEBUG
|
||||
#include "printf/printf.h"
|
||||
#endif
|
||||
|
||||
/* Element signals and args */
|
||||
enum
|
||||
|
|
|
@ -2047,6 +2047,46 @@ _gst_debug_dump_mem (GstDebugCategory * cat, const gchar * file,
|
|||
#endif /* GST_REMOVE_DISABLED */
|
||||
#endif /* GST_DISABLE_GST_DEBUG */
|
||||
|
||||
/* Need this for _gst_element_error_printf even if GST_REMOVE_DISABLED is set:
|
||||
* fallback function that cleans up the format string and replaces all pointer
|
||||
* extension formats with plain %p. */
|
||||
#ifdef GST_DISABLE_GST_DEBUG
|
||||
#include <glib/gprintf.h>
|
||||
int
|
||||
__gst_info_fallback_vasprintf (char **result, char const *format, va_list args)
|
||||
{
|
||||
gchar *clean_format, *c;
|
||||
gsize len;
|
||||
|
||||
if (format == NULL)
|
||||
return -1;
|
||||
|
||||
clean_format = g_strdup (format);
|
||||
c = clean_format;
|
||||
while ((c = strstr (c, "%p\a"))) {
|
||||
if (c[3] < 'A' || c[3] > 'Z') {
|
||||
c += 3;
|
||||
continue;
|
||||
}
|
||||
len = strlen (c + 4);
|
||||
g_memmove (c + 2, c + 4, len + 1);
|
||||
c += 2;
|
||||
}
|
||||
while ((c = strstr (clean_format, "%P"))) /* old GST_PTR_FORMAT */
|
||||
c[1] = 'p';
|
||||
while ((c = strstr (clean_format, "%Q"))) /* old GST_SEGMENT_FORMAT */
|
||||
c[1] = 'p';
|
||||
|
||||
len = g_vasprintf (result, clean_format, args);
|
||||
|
||||
g_free (clean_format);
|
||||
|
||||
if (*result == NULL)
|
||||
return -1;
|
||||
|
||||
return len;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef GST_ENABLE_FUNC_INSTRUMENTATION
|
||||
/* FIXME make this thread specific */
|
||||
|
|
Loading…
Reference in a new issue