return ret;
}
+GstDebugCategory *
+_gst_debug_get_category (const gchar * name)
+{
+ GstDebugCategory *ret = NULL;
+ GSList *node;
+
+ for (node = __categories; node; node = g_slist_next (node)) {
+ ret = (GstDebugCategory *) node->data;
+ if (!strcmp (name, ret->name)) {
+ return ret;
+ }
+ }
+ return NULL;
+}
+
/*** FUNCTION POINTERS ********************************************************/
static GHashTable *__gst_function_pointers; /* NULL */
* This macro expands to nothing if debugging is disabled.
*/
#define GST_DEBUG_CATEGORY_STATIC(cat) static GstDebugCategory *cat = NULL
-/* do not use this function, use the macros below */
+
+/* do not use this function, use the GST_DEBUG_CATEGORY_INIT macro below */
GstDebugCategory *_gst_debug_category_new (const gchar * name,
guint color,
const gchar * description);
GSList *
gst_debug_get_all_categories (void);
+/* do not use this function, use the GST_DEBUG_CATEGORY_GET macro below */
+GstDebugCategory *_gst_debug_get_category (const gchar *name);
+
+/**
+ * GST_DEBUG_CATEGORY_GET:
+ * @cat: the category to initialize.
+ * @name: log category name
+ *
+ * Lookup an exiting #GstDebugCategory by its @name and sets @cat. If category
+ * is not found, but %GST_CAT_DEFAULT is defined, that is assigned to @cat.
+ * Otherwise cat will be NULL.
+ *
+ * |[
+ * GST_DEBUG_CATEGORY_STATIC (gst_myplugin_debug);
+ * #define GST_CAT_DEFAULT gst_myplugin_debug
+ * GST_DEBUG_CATEGORY_STATIC (GST_CAT_PERFORMANCE);
+ * ...
+ * GST_DEBUG_CATEGORY_INIT (gst_myplugin_debug, "myplugin", 0, "nice element");
+ * GST_DEBUG_CATEGORY_GET (GST_CAT_PERFORMANCE, "performance);
+ * ]|
+ */
+#ifdef GST_CAT_DEFAULT
+#define GST_DEBUG_CATEGORY_GET(cat,name) G_STMT_START{\
+ cat = _gst_debug_get_category (name); \
+ if (!cat) { \
+ cat = GST_CAT_DEFAULT; \
+ } \
+}G_STMT_END
+#else
+#define GST_DEBUG_CATEGORY_GET(cat,name) G_STMT_START{\
+ cat = _gst_debug_get_category (name); \
+}G_STMT_END
+#endif
+
+
gchar * gst_debug_construct_term_color (guint colorinfo);
gint gst_debug_construct_win_color (guint colorinfo);
#define GST_DEBUG_CATEGORY_STATIC(var) /* NOP */
#endif
#define GST_DEBUG_CATEGORY_INIT(var,name,color,desc) /* NOP */
+#define GST_DEBUG_CATEGORY_GET(var,name) /* NOP */
#define gst_debug_category_free(category) /* NOP */
#define gst_debug_category_set_threshold(category,level) /* NOP */
#define gst_debug_category_reset_threshold(category) /* NOP */