mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-26 10:10:32 +00:00
Cleaned up INFO system some more, added API to select categories, modified the printout function to print cleanly for...
Original commit message from CVS: Cleaned up INFO system some more, added API to select categories, modified the printout function to print cleanly for GST_INIT info (the default min) and spew function:line debug_string [element] for everything else. Eventually could make even that configurable easily enough, just check against another bitmap instead of checking for == GST_INIT.
This commit is contained in:
parent
527525a282
commit
e0aa5bae14
5 changed files with 65 additions and 98 deletions
|
@ -96,7 +96,7 @@ GstPlugin *plugin_init (GModule *module)
|
|||
i++;
|
||||
}
|
||||
|
||||
INFO (0,"gstelements: loaded %d standard elements", i);
|
||||
// INFO (GST_INFO_PLUGIN_LOAD,"gstelements: loaded %d standard elements", i);
|
||||
|
||||
return plugin;
|
||||
}
|
||||
|
|
22
gst/gstcpu.c
22
gst/gstcpu.c
|
@ -37,29 +37,39 @@ void gst_cpuid_i386(int,long *,long *,long *,long *);
|
|||
#define gst_cpuid(o,a,b,c,d) (void)(a);(void)(b);(void)(c);
|
||||
#endif
|
||||
|
||||
static gchar *stringcat (gchar *a,gchar *b) {
|
||||
gchar *c;
|
||||
if (a) {
|
||||
c = g_strconcat(a,b);
|
||||
g_free(a);
|
||||
} else
|
||||
c = g_strdup(b);
|
||||
return c;
|
||||
}
|
||||
|
||||
void
|
||||
_gst_cpu_initialize (void)
|
||||
{
|
||||
gchar *featurelist = NULL;
|
||||
|
||||
long eax=0, ebx=0, ecx=0, edx=0;
|
||||
|
||||
gst_cpuid(1, &eax, &ebx, &ecx, &edx);
|
||||
|
||||
g_print("CPU features : ");
|
||||
|
||||
if (edx & (1<<23)) {
|
||||
_gst_cpu_flags |= GST_CPU_FLAG_MMX;
|
||||
g_print("MMX ");
|
||||
featurelist = stringcat(featurelist,"MMX ");
|
||||
}
|
||||
if (edx & (1<<25)) {
|
||||
_gst_cpu_flags |= GST_CPU_FLAG_SSE;
|
||||
g_print("SSE ");
|
||||
featurelist = stringcat(featurelist,"SSE ");
|
||||
}
|
||||
|
||||
if (!_gst_cpu_flags) {
|
||||
g_print("NONE");
|
||||
featurelist = stringcat(featurelist,"NONE");
|
||||
}
|
||||
g_print("\n");
|
||||
|
||||
INFO(GST_INFO_GST_INIT, "CPU features: %s",featurelist);
|
||||
}
|
||||
|
||||
GstCPUFlags
|
||||
|
|
129
gst/gstinfo.c
129
gst/gstinfo.c
|
@ -34,7 +34,7 @@ GHashTable *__gst_function_pointers = NULL;
|
|||
/***** INFO system *****/
|
||||
GstInfoHandler _gst_info_handler = gst_default_info_handler;
|
||||
//guint32 _gst_info_categories = 0xffffffff;
|
||||
guint32 _gst_info_categories = 0x00000000;
|
||||
guint32 _gst_info_categories = 0x00000001;
|
||||
|
||||
static gchar *_gst_info_category_strings[] = {
|
||||
"GST_INIT",
|
||||
|
@ -67,102 +67,53 @@ gst_default_info_handler (gint category, gchar *file, gchar *function,
|
|||
gint line, gchar *debug_string,
|
||||
void *element, gchar *string)
|
||||
{
|
||||
if (element) {
|
||||
if (debug_string)
|
||||
fprintf(stderr,"INFO:%s:%d%s: [%s] %s\n",
|
||||
function,line,debug_string,gst_element_get_name(element),string);
|
||||
else
|
||||
fprintf(stderr,"INFO:%s:%d: [%s] %s\n",
|
||||
function,line,gst_element_get_name(element),string);
|
||||
} else {
|
||||
if (debug_string)
|
||||
fprintf(stderr,"INFO:%s:%d%s: %s\n",
|
||||
function,line,debug_string,string);
|
||||
else
|
||||
fprintf(stderr,"INFO:%s:%d: %s\n",
|
||||
function,line,string);
|
||||
}
|
||||
gchar *empty = "";
|
||||
gchar *elementname = empty,*location = empty;
|
||||
|
||||
if (debug_string == NULL) debug_string = "";
|
||||
if (category != GST_INFO_GST_INIT)
|
||||
location = g_strdup_printf("%s:%d%s:",function,line,debug_string);
|
||||
if (element && GST_IS_ELEMENT (element))
|
||||
elementname = g_strdup_printf (" [%s]",gst_element_get_name (element));
|
||||
|
||||
fprintf(stderr,"INFO:%s%s %s\n",location,elementname,string);
|
||||
|
||||
if (location != empty) g_free(location);
|
||||
if (elementname != empty) g_free(elementname);
|
||||
|
||||
g_free(string);
|
||||
}
|
||||
|
||||
void
|
||||
gst_info_set_categories (guint32 categories) {
|
||||
_gst_info_categories = categories;
|
||||
}
|
||||
|
||||
guint32
|
||||
gst_info_get_categories () {
|
||||
return _gst_info_categories;
|
||||
}
|
||||
|
||||
const gchar *
|
||||
gst_info_get_category_name (gint category) {
|
||||
return _gst_info_category_strings[category];
|
||||
}
|
||||
|
||||
void
|
||||
gst_info_enable_category (gint category) {
|
||||
_gst_info_categories |= (1 << category);
|
||||
}
|
||||
|
||||
void
|
||||
gst_info_disable_category (gint category) {
|
||||
_gst_info_categories &= ~ (1 << category);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***** ERROR system *****/
|
||||
GstErrorHandler _gst_error_handler = gst_default_error_handler;
|
||||
|
||||
/*
|
||||
gchar *gst_object_get_path_string(GstObject *object) {
|
||||
GSList *parentage = NULL;
|
||||
GSList *parents;
|
||||
void *parent;
|
||||
gchar *prevpath, *path = "";
|
||||
const char *component;
|
||||
gchar *separator = "";
|
||||
gboolean free_component;
|
||||
|
||||
parentage = g_slist_prepend (NULL, object);
|
||||
|
||||
// first walk the object hierarchy to build a list of the parents
|
||||
do {
|
||||
if (GST_IS_OBJECT(object)) {
|
||||
if (GST_IS_PAD(object)) {
|
||||
parent = GST_PAD(object)->parent;
|
||||
// } else if (GST_IS_ELEMENT(object)) {
|
||||
// parent = gst_element_get_parent(GST_ELEMENT(object));
|
||||
} else {
|
||||
parent = gst_object_get_parent (object);
|
||||
}
|
||||
} else {
|
||||
parentage = g_slist_prepend (parentage, NULL);
|
||||
parent = NULL;
|
||||
}
|
||||
|
||||
if (parent != NULL) {
|
||||
parentage = g_slist_prepend (parentage, parent);
|
||||
}
|
||||
|
||||
object = parent;
|
||||
} while (object != NULL);
|
||||
|
||||
// then walk the parent list and print them out
|
||||
parents = parentage;
|
||||
while (parents) {
|
||||
if (GST_IS_OBJECT(parents->data)) {
|
||||
if (GST_IS_PAD(parents->data)) {
|
||||
component = gst_pad_get_name(GST_PAD(parents->data));
|
||||
separator = ".";
|
||||
free_component = FALSE;
|
||||
} else if (GST_IS_ELEMENT(parents->data)) {
|
||||
component = gst_element_get_name(GST_ELEMENT(parents->data));
|
||||
separator = "/";
|
||||
free_component = FALSE;
|
||||
} else {
|
||||
// component = g_strdup_printf("a %s",gtk_type_name(gtk_identifier_get_type(parents->data)));
|
||||
component = g_strdup_printf("unknown%p",parents->data);
|
||||
separator = "/";
|
||||
free_component = TRUE;
|
||||
}
|
||||
} else {
|
||||
component = g_strdup_printf("%p",parents->data);
|
||||
separator = "/";
|
||||
free_component = TRUE;
|
||||
}
|
||||
|
||||
prevpath = path;
|
||||
path = g_strjoin(separator,prevpath,component,NULL);
|
||||
g_free(prevpath);
|
||||
if (free_component)
|
||||
g_free((gchar *)component);
|
||||
|
||||
parents = g_slist_next(parents);
|
||||
}
|
||||
|
||||
g_slist_free(parentage);
|
||||
|
||||
return path;
|
||||
}
|
||||
*/
|
||||
|
||||
void
|
||||
gst_default_error_handler (gchar *file, gchar *function,
|
||||
gint line, gchar *debug_string,
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
||||
* 2000 Wim Taymans <wtay@chello.be>
|
||||
*
|
||||
* gstdebug.h: Debugging helper macros
|
||||
* gstinfo.h:
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
|
@ -193,6 +193,12 @@ extern guint32 _gst_info_categories;
|
|||
}G_STMT_END
|
||||
|
||||
|
||||
void gst_info_set_categories (guint32 categories);
|
||||
guint32 gst_info_get_categories ();
|
||||
const gchar * gst_info_get_category_name (gint category);
|
||||
void gst_info_enable_category (gint category);
|
||||
void gst_info_disable_category (gint category);
|
||||
|
||||
enum {
|
||||
GST_INFO_GST_INIT = 0, // Library initialization
|
||||
GST_INFO_COTHREADS, // Cothread creation, etc.
|
||||
|
|
|
@ -96,7 +96,7 @@ GstPlugin *plugin_init (GModule *module)
|
|||
i++;
|
||||
}
|
||||
|
||||
INFO (0,"gstelements: loaded %d standard elements", i);
|
||||
// INFO (GST_INFO_PLUGIN_LOAD,"gstelements: loaded %d standard elements", i);
|
||||
|
||||
return plugin;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue