diff --git a/gst/gstinfo.c b/gst/gstinfo.c
index 83ab86b7673b74b6f825ca0a76fe93c4b5ab681f..226876822adb5d8601a14464eb80d105801fcb00 100644 (file)
--- a/gst/gstinfo.c
+++ b/gst/gstinfo.c
/* we can't do this further above, because we initialize the GST_CAT_DEFAULT struct */
#define GST_CAT_DEFAULT _GST_CAT_DEBUG
+
+/**
+ * gst_debug_log2:
+ * @category: category to log
+ * @level: level of the message is in
+ * @location: the file, function name, and line number of the location that
+ * emitted the message
+ * @object: the object this message relates to or NULL if none
+ * @format: a printf style format string
+ * @...: optional arguments for the format
+ *
+ * Logs the given message using the currently registered debugging handlers.
+ */
+void
+gst_debug_log2 (GstDebugCategory * category, GstDebugLevel level,
+ const GstDebugTraceLocation * location,
+ GObject * object, const gchar * format, ...)
+{
+ va_list var_args;
+
+ va_start (var_args, format);
+ gst_debug_log_valist2 (category, level, location, object, format, var_args);
+ va_end (var_args);
+}
+
+
/**
* gst_debug_log:
* @category: category to log
gst_debug_log_valist (GstDebugCategory * category, GstDebugLevel level,
const gchar * file, const gchar * function, gint line,
GObject * object, const gchar * format, va_list args)
+{
+ GstDebugTraceLocation location = {
+ .file = file,
+ .function = function,
+ .line = line
+ };
+ gst_debug_log_valist2 (category, level, &location, object, format, args);
+}
+
+
+/**
+ * gst_debug_log_valist2:
+ * @category: category to log
+ * @level: level of the message is in
+ * @location: the file, function name, and line number of the location that
+ * emitted the message
+ * @object: the object this message relates to or NULL if none
+ * @format: a printf style format string
+ * @args: optional arguments for the format
+ *
+ * Logs the given message using the currently registered debugging handlers.
+ */
+void
+gst_debug_log_valist2 (GstDebugCategory * category, GstDebugLevel level,
+ const GstDebugTraceLocation * location,
+ GObject * object, const gchar * format, va_list args)
{
GstDebugMessage message;
LogFuncEntry *entry;
GSList *handler;
g_return_if_fail (category != NULL);
- g_return_if_fail (file != NULL);
- g_return_if_fail (function != NULL);
+ g_return_if_fail (location != NULL);
+ g_return_if_fail (location->file != NULL);
+ g_return_if_fail (location->function != NULL);
g_return_if_fail (format != NULL);
/* The predefined macro __FILE__ is always the exact path given to the
while (handler) {
entry = handler->data;
handler = g_slist_next (handler);
- entry->func (category, level, file, function, line, object, &message,
- entry->user_data);
+ // TODO: change GstLogFunction and pass GstDebugTraceLocation ptr instead..
+ entry->func (category, level, location->file, location->function,
+ location->line, object, &message, entry->user_data);
}
g_free (message.message);
va_end (message.arguments);
return gst_structure_to_string (s);
}
-static gchar *
+gchar *
gst_debug_print_object (gpointer ptr)
{
GObject *object = (GObject *) ptr;
if (*(GType *) ptr == GST_TYPE_STRUCTURE) {
return gst_info_structure_to_string ((GstStructure *) ptr);
}
+ if (GST_IS_BUFFER (ptr)) {
+ GstBuffer *buf = (GstBuffer *) ptr;
+ gchar *caps, *ret;
+
+ caps = gst_caps_to_string (GST_BUFFER_CAPS (buf));
+ ret =
+ g_strdup_printf ("%p, data %p, malloc %p, ts %" GST_TIME_FORMAT
+ ", dur %" GST_TIME_FORMAT ", size %u, offset %" G_GUINT64_FORMAT
+ ", offset_end %" G_GUINT64_FORMAT ", caps: %s", buf,
+ GST_BUFFER_DATA (buf), GST_BUFFER_MALLOCDATA (buf),
+ GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)),
+ GST_TIME_ARGS (GST_BUFFER_DURATION (buf)), GST_BUFFER_SIZE (buf),
+ GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET_END (buf), caps);
+
+ g_free (caps);
+ return ret;
+ }
#ifdef USE_POISONING
if (*(guint32 *) ptr == 0xffffffff) {
return g_strdup_printf ("<poisoned@%p>", ptr);
#ifdef HAVE_PRINTF_EXTENSION
-static gchar *
+gchar *
gst_debug_print_segment (gpointer ptr)
{
GstSegment *segment = (GstSegment *) ptr;