dnl Check for a way to display the function name in debug output
AG_GST_CHECK_FUNCTION
-dnl test for register_printf_function
-AC_CHECK_FUNC(register_printf_function,
- [
- GST_PRINTF_EXTENSION_POINTER_FORMAT_DEFINE="#define GST_PTR_FORMAT \"P\""
- GST_PRINTF_EXTENSION_SEGMENT_FORMAT_DEFINE="#define GST_SEGMENT_FORMAT \"Q\""
- GST_USING_PRINTF_EXTENSION_DEFINE="#define GST_USING_PRINTF_EXTENSION"
- AC_DEFINE(HAVE_PRINTF_EXTENSION, 1,
- [Defined if we have register_printf_function ()])
- ], [
+dnl test for register_printf_specifier or register_printf_function
+AC_CHECK_FUNCS([register_printf_specifier register_printf_function],
+ [HAVE_PRINTF_EXTENSION=yes])
+
+if test "$HAVE_PRINTF_EXTENSION" = yes; then
+ GST_PRINTF_EXTENSION_POINTER_FORMAT_DEFINE="#define GST_PTR_FORMAT \"P\""
+ GST_PRINTF_EXTENSION_SEGMENT_FORMAT_DEFINE="#define GST_SEGMENT_FORMAT \"Q\""
+ GST_USING_PRINTF_EXTENSION_DEFINE="#define GST_USING_PRINTF_EXTENSION"
+ AC_DEFINE(HAVE_PRINTF_EXTENSION, 1,
+ [Defined if we have printf specifier extensions available])
+else
GST_PRINTF_EXTENSION_POINTER_FORMAT_DEFINE="#define GST_PTR_FORMAT \"p\""
GST_PRINTF_EXTENSION_SEGMENT_FORMAT_DEFINE="#define GST_SEGMENT_FORMAT \"p\""
GST_USING_PRINTF_EXTENSION_DEFINE="#undef GST_USING_PRINTF_EXTENSION"
- ]
-)
+fi
AC_SUBST(GST_PRINTF_EXTENSION_POINTER_FORMAT_DEFINE)
AC_SUBST(GST_PRINTF_EXTENSION_SEGMENT_FORMAT_DEFINE)
AC_SUBST(GST_USING_PRINTF_EXTENSION_DEFINE)
const struct printf_info *info, const void *const *args);
static int _gst_info_printf_extension_segment (FILE * stream,
const struct printf_info *info, const void *const *args);
+#if HAVE_REGISTER_PRINTF_SPECIFIER
+static int _gst_info_printf_extension_arginfo (const struct printf_info *info,
+ size_t n, int *argtypes, int *size);
+#else
static int _gst_info_printf_extension_arginfo (const struct printf_info *info,
size_t n, int *argtypes);
#endif
+#endif
struct _GstDebugMessage
{
_priv_gst_info_start_time = gst_util_get_timestamp ();
#ifdef HAVE_PRINTF_EXTENSION
+#if HAVE_REGISTER_PRINTF_SPECIFIER
+ register_printf_specifier (GST_PTR_FORMAT[0], _gst_info_printf_extension_ptr,
+ _gst_info_printf_extension_arginfo);
+ register_printf_specifier (GST_SEGMENT_FORMAT[0],
+ _gst_info_printf_extension_segment, _gst_info_printf_extension_arginfo);
+#else
register_printf_function (GST_PTR_FORMAT[0], _gst_info_printf_extension_ptr,
_gst_info_printf_extension_arginfo);
register_printf_function (GST_SEGMENT_FORMAT[0],
_gst_info_printf_extension_segment, _gst_info_printf_extension_arginfo);
#endif
+#endif
/* do NOT use a single debug function before this line has been run */
GST_CAT_DEFAULT = _gst_debug_category_new ("default",
return len;
}
+#if HAVE_REGISTER_PRINTF_SPECIFIER
+static int
+_gst_info_printf_extension_arginfo (const struct printf_info *info, size_t n,
+ int *argtypes, int *size)
+#else
static int
_gst_info_printf_extension_arginfo (const struct printf_info *info, size_t n,
int *argtypes)
+#endif
{
- if (n > 0)
+ if (n > 0) {
argtypes[0] = PA_POINTER;
+#if HAVE_REGISTER_PRINTF_SPECIFIER
+ *size = sizeof (gpointer);
+#endif
+ }
return 1;
}
#endif /* HAVE_PRINTF_EXTENSION */