~ubuntu-branches/ubuntu/trusty/gstreamer1.0/trusty-proposed

« back to all changes in this revision

Viewing changes to gst/gstinfo.c

  • Committer: Package Import Robot
  • Author(s): Sebastian Dröge
  • Date: 2012-08-08 18:12:33 UTC
  • mfrom: (1.1.3)
  • Revision ID: package-import@ubuntu.com-20120808181233-riejwxprfsxh1njl
Tags: 0.11.93-1
* New upstream release:
  + debian/libgstreamer.symbols:
    - Update symbols file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
120
120
#include "gstutils.h"
121
121
#include "gstquark.h"
122
122
#include "gstsegment.h"
 
123
#include "gstvalue.h"
 
124
 
123
125
#ifdef HAVE_VALGRIND_VALGRIND_H
124
126
#  include <valgrind/valgrind.h>
125
127
#endif
169
171
GstDebugCategory *GST_CAT_QOS = NULL;
170
172
GstDebugCategory *_priv_GST_CAT_POLL = NULL;
171
173
GstDebugCategory *GST_CAT_META = NULL;
 
174
GstDebugCategory *GST_CAT_LOCKING = NULL;
172
175
 
173
176
 
174
177
#endif /* !defined(GST_DISABLE_GST_DEBUG) || !defined(GST_REMOVE_DISABLED) */
256
259
{
257
260
  GstLogFunction func;
258
261
  gpointer user_data;
 
262
  GDestroyNotify notify;
259
263
}
260
264
LogFuncEntry;
261
265
static GMutex __log_func_mutex;
347
351
  _GST_CAT_DEBUG = _gst_debug_category_new ("GST_DEBUG",
348
352
      GST_DEBUG_BOLD | GST_DEBUG_FG_YELLOW, "debugging subsystem");
349
353
 
350
 
  gst_debug_add_log_function (gst_debug_log_default, NULL);
 
354
  gst_debug_add_log_function (gst_debug_log_default, NULL, NULL);
351
355
 
352
356
  /* FIXME: add descriptions here */
353
357
  GST_CAT_GST_INIT = _gst_debug_category_new ("GST_INIT",
406
410
  GST_CAT_QOS = _gst_debug_category_new ("GST_QOS", 0, "QoS");
407
411
  _priv_GST_CAT_POLL = _gst_debug_category_new ("GST_POLL", 0, "poll");
408
412
  GST_CAT_META = _gst_debug_category_new ("GST_META", 0, "meta");
 
413
  GST_CAT_LOCKING = _gst_debug_category_new ("GST_LOCKING", 0, "locking");
409
414
 
410
415
 
411
416
  /* print out the valgrind message if we're in valgrind */
620
625
  if (*(GType *) ptr == GST_TYPE_STRUCTURE) {
621
626
    return gst_info_structure_to_string ((const GstStructure *) ptr);
622
627
  }
 
628
  if (*(GType *) ptr == GST_TYPE_TAG_LIST) {
 
629
    /* FIXME: want pretty tag list with long byte dumps removed.. */
 
630
    return gst_tag_list_to_string ((GstTagList *) ptr);
 
631
  }
 
632
  if (*(GType *) ptr == GST_TYPE_DATE_TIME) {
 
633
    return __gst_date_time_serialize ((GstDateTime *) ptr, TRUE);
 
634
  }
623
635
  if (GST_IS_BUFFER (ptr)) {
624
636
    GstBuffer *buf = (GstBuffer *) ptr;
625
637
    gchar *ret;
800
812
 * This function returns 0 on non-windows machines.
801
813
 *
802
814
 * Returns: an integer containing the color definition
803
 
 *
804
 
 * Since: 0.10.23
805
815
 */
806
816
gint
807
817
gst_debug_construct_win_color (guint colorinfo)
1063
1073
/**
1064
1074
 * gst_debug_add_log_function:
1065
1075
 * @func: the function to use
1066
 
 * @data: (closure): user data
 
1076
 * @user_data: user data
 
1077
 * @notify: called when @user_data is not used anymore
1067
1078
 *
1068
1079
 * Adds the logging function to the list of logging functions.
1069
1080
 * Be sure to use #G_GNUC_NO_INSTRUMENT on that function, it is needed.
1070
1081
 */
1071
1082
void
1072
 
gst_debug_add_log_function (GstLogFunction func, gpointer data)
 
1083
gst_debug_add_log_function (GstLogFunction func, gpointer user_data,
 
1084
    GDestroyNotify notify)
1073
1085
{
1074
1086
  LogFuncEntry *entry;
1075
1087
  GSList *list;
1079
1091
 
1080
1092
  entry = g_slice_new (LogFuncEntry);
1081
1093
  entry->func = func;
1082
 
  entry->user_data = data;
 
1094
  entry->user_data = user_data;
 
1095
  entry->notify = notify;
1083
1096
  /* FIXME: we leak the old list here - other threads might access it right now
1084
1097
   * in gst_debug_logv. Another solution is to lock the mutex in gst_debug_logv,
1085
1098
   * but that is waaay costly.
1092
1105
  g_mutex_unlock (&__log_func_mutex);
1093
1106
 
1094
1107
  GST_DEBUG ("prepended log function %p (user data %p) to log functions",
1095
 
      func, data);
 
1108
      func, user_data);
1096
1109
}
1097
1110
 
1098
1111
static gint
1115
1128
gst_debug_remove_with_compare_func (GCompareFunc func, gpointer data)
1116
1129
{
1117
1130
  GSList *found;
1118
 
  GSList *new;
 
1131
  GSList *new, *cleanup = NULL;
1119
1132
  guint removals = 0;
1120
1133
 
1121
1134
  g_mutex_lock (&__log_func_mutex);
1122
1135
  new = __log_functions;
 
1136
  cleanup = NULL;
1123
1137
  while ((found = g_slist_find_custom (new, data, func))) {
1124
1138
    if (new == __log_functions) {
1125
1139
      /* make a copy when we have the first hit, so that we modify the copy and
1127
1141
      new = g_slist_copy (new);
1128
1142
      continue;
1129
1143
    }
1130
 
    g_slice_free (LogFuncEntry, found->data);
 
1144
    cleanup = g_slist_prepend (cleanup, found->data);
1131
1145
    new = g_slist_delete_link (new, found);
1132
1146
    removals++;
1133
1147
  }
1135
1149
  __log_functions = new;
1136
1150
  g_mutex_unlock (&__log_func_mutex);
1137
1151
 
 
1152
  while (cleanup) {
 
1153
    LogFuncEntry *entry = cleanup->data;
 
1154
 
 
1155
    if (entry->notify)
 
1156
      entry->notify (entry->user_data);
 
1157
 
 
1158
    g_slice_free (LogFuncEntry, entry);
 
1159
    cleanup = g_slist_delete_link (cleanup, cleanup);
 
1160
  }
1138
1161
  return removals;
1139
1162
}
1140
1163
 
1141
1164
/**
1142
1165
 * gst_debug_remove_log_function:
1143
 
 * @func: the log function to remove
 
1166
 * @func: (scope call): the log function to remove
1144
1167
 *
1145
1168
 * Removes all registered instances of the given logging functions.
1146
1169
 *
1803
1826
}
1804
1827
 
1805
1828
void
1806
 
gst_debug_add_log_function (GstLogFunction func, gpointer data)
 
1829
gst_debug_add_log_function (GstLogFunction func, gpointer user_data,
 
1830
    GDestroyNotify notify)
1807
1831
{
1808
1832
}
1809
1833