#include "gst_private.h"
#include "gstinfo.h"
+#undef gst_debug_remove_log_function
+#undef gst_debug_add_log_function
+
#ifndef GST_DISABLE_GST_DEBUG
#ifdef HAVE_DLFCN_H
GstDebugCategory *GST_CAT_PLUGIN_INFO = NULL;
GstDebugCategory *GST_CAT_PROPERTIES = NULL;
GstDebugCategory *GST_CAT_TYPES = NULL;
-GstDebugCategory *GST_CAT_XML = NULL;
GstDebugCategory *GST_CAT_NEGOTIATION = NULL;
GstDebugCategory *GST_CAT_REFCOUNTING = NULL;
GstDebugCategory *GST_CAT_ERROR_SYSTEM = NULL;
static gboolean pretty_tags = PRETTY_TAGS_DEFAULT;
static volatile gint G_GNUC_MAY_ALIAS __default_level = GST_LEVEL_DEFAULT;
-static volatile gint G_GNUC_MAY_ALIAS __use_color;
+static volatile gint G_GNUC_MAY_ALIAS __use_color = 1;
static FILE *log_file;
g_assert (in_valgrind == GST_VG_NO_VALGRIND ||
in_valgrind == GST_VG_INSIDE);
}
- return (in_valgrind == GST_VG_INSIDE) ? TRUE : FALSE;
+ return (in_valgrind == GST_VG_INSIDE);
}
/**
GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_BLUE, NULL);
GST_CAT_TYPES = _gst_debug_category_new ("GST_TYPES",
GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_RED, NULL);
- GST_CAT_XML = _gst_debug_category_new ("GST_XML",
- GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_RED, NULL);
GST_CAT_NEGOTIATION = _gst_debug_category_new ("GST_NEGOTIATION",
GST_DEBUG_BOLD | GST_DEBUG_FG_BLUE, NULL);
GST_CAT_REFCOUNTING = _gst_debug_category_new ("GST_REFCOUNTING",
* @file: the file that emitted the message, usually the __FILE__ identifier
* @function: the function that emitted the message
* @line: the line from that the message was emitted, usually __LINE__
- * @object: the object this message relates to or NULL if none
+ * @object: (transfer none) (allow-none): the object this message relates to,
+ * or NULL if none
* @format: a printf style format string
* @...: optional arguments for the format
*
va_end (var_args);
}
+#ifdef _MSC_VER
+/* based on g_basename(), which we can't use because it was deprecated */
+static inline const gchar *
+gst_path_basename (const gchar * file_name)
+{
+ register const gchar *base;
+
+ base = strrchr (file_name, G_DIR_SEPARATOR);
+
+ {
+ const gchar *q = strrchr (file_name, '/');
+ if (base == NULL || (q != NULL && q > base))
+ base = q;
+ }
+
+ if (base)
+ return base + 1;
+
+ if (g_ascii_isalpha (file_name[0]) && file_name[1] == ':')
+ return file_name + 2;
+
+ return file_name;
+}
+#endif
+
/**
* gst_debug_log_valist:
* @category: category to log
* @file: the file that emitted the message, usually the __FILE__ identifier
* @function: the function that emitted the message
* @line: the line from that the message was emitted, usually __LINE__
- * @object: the object this message relates to or NULL if none
+ * @object: (transfer none) (allow-none): the object this message relates to,
+ * or NULL if none
* @format: a printf style format string
* @args: optional arguments for the format
*
LogFuncEntry *entry;
GSList *handler;
-#ifdef _MSC_VER
- gchar *file_basename;
-#endif
-
g_return_if_fail (category != NULL);
g_return_if_fail (file != NULL);
g_return_if_fail (function != NULL);
g_return_if_fail (format != NULL);
-#ifdef _MSC_VER
- /*
- * The predefined macro __FILE__ is always the exact path given to the
+ /* The predefined macro __FILE__ is always the exact path given to the
* compiler with MSVC, which may or may not be the basename. We work
- * around it at runtime to improve the readability.
- */
- file = file_basename = g_path_get_basename (file);
+ * around it at runtime to improve the readability. */
+#ifdef _MSC_VER
+ file = gst_path_basename (file);
#endif
message.message = NULL;
}
g_free (message.message);
va_end (message.arguments);
-
-#ifdef _MSC_VER
- g_free (file_basename);
-#endif
}
/**
}
static inline gchar *
-gst_info_structure_to_string (GstStructure * s)
+gst_info_structure_to_string (const GstStructure * s)
{
if (G_UNLIKELY (pretty_tags && s->name == GST_QUARK (TAGLIST)))
return structure_to_pretty_string (s);
return g_strdup ("(NULL)");
}
if (*(GType *) ptr == GST_TYPE_CAPS) {
- return gst_caps_to_string ((GstCaps *) ptr);
+ return gst_caps_to_string ((const GstCaps *) ptr);
}
if (*(GType *) ptr == GST_TYPE_STRUCTURE) {
- return gst_info_structure_to_string ((GstStructure *) ptr);
+ return gst_info_structure_to_string ((const GstStructure *) ptr);
}
#ifdef USE_POISONING
if (*(guint32 *) ptr == 0xffffffff) {
if (GST_IS_MESSAGE (object)) {
GstMessage *msg = GST_MESSAGE_CAST (object);
gchar *s, *ret;
+ const GstStructure *structure;
- if (msg->structure) {
- s = gst_info_structure_to_string (msg->structure);
+ structure = gst_message_get_structure (msg);
+
+ if (structure) {
+ s = gst_info_structure_to_string (structure);
} else {
s = g_strdup ("(NULL)");
}
}
if (GST_IS_QUERY (object)) {
GstQuery *query = GST_QUERY_CAST (object);
+ const GstStructure *structure;
+
+ structure = gst_query_get_structure (query);
- if (query->structure) {
- return gst_info_structure_to_string (query->structure);
+ if (structure) {
+ return gst_info_structure_to_string (structure);
} else {
const gchar *query_type_name;
if (GST_IS_EVENT (object)) {
GstEvent *event = GST_EVENT_CAST (object);
gchar *s, *ret;
+ GstStructure *structure;
- if (event->structure) {
- s = gst_info_structure_to_string (event->structure);
+ structure = (GstStructure *) gst_event_get_structure (event);
+ if (structure) {
+ s = gst_info_structure_to_string (structure);
} else {
s = g_strdup ("(NULL)");
}
- ret = g_strdup_printf ("%s event from '%s' at time %"
+ ret = g_strdup_printf ("%s event at time %"
GST_TIME_FORMAT ": %s",
- GST_EVENT_TYPE_NAME (event), (event->src != NULL) ?
- GST_OBJECT_NAME (event->src) : "(NULL)",
- GST_TIME_ARGS (event->timestamp), s);
+ GST_EVENT_TYPE_NAME (event), GST_TIME_ARGS (event->timestamp), s);
g_free (s);
return ret;
}
}
case GST_FORMAT_TIME:{
return g_strdup_printf ("time segment start=%" GST_TIME_FORMAT
- ", stop=%" GST_TIME_FORMAT ", last_stop=%" GST_TIME_FORMAT
- ", duration=%" GST_TIME_FORMAT ", rate=%f, applied_rate=%f"
- ", flags=0x%02x, time=%" GST_TIME_FORMAT ", accum=%" GST_TIME_FORMAT,
+ ", stop=%" GST_TIME_FORMAT ", rate=%f, applied_rate=%f"
+ ", flags=0x%02x, time=%" GST_TIME_FORMAT ", base=%" GST_TIME_FORMAT,
GST_TIME_ARGS (segment->start), GST_TIME_ARGS (segment->stop),
- GST_TIME_ARGS (segment->last_stop), GST_TIME_ARGS (segment->duration),
segment->rate, segment->applied_rate, (guint) segment->flags,
- GST_TIME_ARGS (segment->time), GST_TIME_ARGS (segment->accum));
+ GST_TIME_ARGS (segment->time), GST_TIME_ARGS (segment->base));
}
default:{
const gchar *format_name;
if (G_UNLIKELY (format_name == NULL))
format_name = "(UNKNOWN FORMAT)";
return g_strdup_printf ("%s segment start=%" G_GINT64_FORMAT
- ", stop=%" G_GINT64_FORMAT ", last_stop=%" G_GINT64_FORMAT
- ", duration=%" G_GINT64_FORMAT ", rate=%f, applied_rate=%f"
- ", flags=0x%02x, time=%" GST_TIME_FORMAT ", accum=%" GST_TIME_FORMAT,
- format_name, segment->start, segment->stop, segment->last_stop,
- segment->duration, segment->rate, segment->applied_rate,
- (guint) segment->flags, GST_TIME_ARGS (segment->time),
- GST_TIME_ARGS (segment->accum));
+ ", stop=%" G_GINT64_FORMAT ", rate=%f, applied_rate=%f"
+ ", flags=0x%02x, time=%" GST_TIME_FORMAT ", base=%" GST_TIME_FORMAT,
+ format_name, segment->start, segment->stop, segment->rate,
+ segment->applied_rate, (guint) segment->flags,
+ GST_TIME_ARGS (segment->time), GST_TIME_ARGS (segment->base));
}
}
}
* terminals.
* You need to free the string after use.
*
- * Returns: a string containing the color definition
+ * Returns: (transfer full) (type gchar*): a string containing the color
+ * definition
*/
gchar *
gst_debug_construct_term_color (guint colorinfo)
* @function: the function that emitted the message
* @line: the line from that the message was emitted, usually __LINE__
* @message: the actual message
- * @object: the object this message relates to or NULL if none
+ * @object: (transfer none) (allow-none): the object this message relates to,
+ * or NULL if none
* @unused: an unused variable, reserved for some user_data.
*
* The default logging handler used by GStreamer. Logging functions get called
/**
* gst_debug_add_log_function:
* @func: the function to use
- * @data: user data
+ * @data: (closure): user data
*
* Adds the logging function to the list of logging functions.
* Be sure to use #G_GNUC_NO_INSTRUMENT on that function, it is needed.
LogFuncEntry *entry;
GSList *list;
- g_return_if_fail (func != NULL);
+ if (func == NULL)
+ func = gst_debug_log_default;
entry = g_slice_new (LogFuncEntry);
entry->func = func;
{
guint removals;
- g_return_val_if_fail (func != NULL, 0);
+ if (func == NULL)
+ func = gst_debug_log_default;
removals =
gst_debug_remove_with_compare_func
void
gst_debug_set_colored (gboolean colored)
{
- g_atomic_int_set (&__use_color, colored ? 1 : 0);
+ g_atomic_int_set (&__use_color, (gint) colored);
}
/**
gboolean
gst_debug_is_colored (void)
{
- return g_atomic_int_get (&__use_color) == 0 ? FALSE : TRUE;
+ return (gboolean) g_atomic_int_get (&__use_color);
}
/**
* may change anytime.
* The caller has to free the list after use.
*
- * Returns: the list of categories
+ * Returns: (transfer container) (element-type Gst.DebugCategory): the list of
+ * debug categories
*/
GSList *
gst_debug_get_all_categories (void)
{
}
-G_CONST_RETURN gchar *
+const gchar *
gst_debug_level_get_name (GstDebugLevel level)
{
return "NONE";
return GST_LEVEL_NONE;
}
-G_CONST_RETURN gchar *
+const gchar *
gst_debug_category_get_name (GstDebugCategory * category)
{
return "";
return 0;
}
-G_CONST_RETURN gchar *
+const gchar *
gst_debug_category_get_description (GstDebugCategory * category)
{
return "";