Converted the DEBUG system to look like the INFO system, with a function pointer that can be replaced. Not done with...

Original commit message from CVS:
Converted the DEBUG system to look like the INFO system, with a function
pointer that can be replaced.  Not done with everything, since it seems
that we need an ERROR system plus a FATAL error, or maybe just an ERROR
system with a severity, and depending on this the DEBUG system might again
be changed to have a single or at least fewer handlers.

Also did a bit of work fixing up the actual DEBUG and INFO commands
scattered throughout the code.  We still have over 500 of these in gst/*.c
alone...
This commit is contained in:
Erik Walthinsen 2001-05-02 19:20:24 +00:00
parent 611c3ae810
commit 4b2bb87b25
10 changed files with 341 additions and 315 deletions

View file

@ -232,17 +232,19 @@ gst_init_check (int *argc,
g_print ("--------------------------------------------------------\n");
for (i = 0; i<GST_CAT_MAX_CATEGORY; i++) {
if (gst_get_category_name(i)) {
#if GST_DEBUG_COLOR
g_print (" 0x%08x %s%s \033[%sm%s\033[00m\n", 1<<i,
(gst_info_get_categories() & (1<<i)?"(enabled)":" "),
(gst_debug_get_categories() & (1<<i)?"/(enabled)":"/ "),
_gst_category_colors[i], gst_get_category_name (i));
g_print (" 0x%08x %s%s \033[%sm%s\033[00m\n", 1<<i,
(gst_info_get_categories() & (1<<i)?"(enabled)":" "),
(gst_debug_get_categories() & (1<<i)?"/(enabled)":"/ "),
_gst_category_colors[i], gst_get_category_name (i));
#else
g_print (" 0x%08x %s%s %s\n", 1<<i,
(gst_info_get_categories() & (1<<i)?"(enabled)":" "),
(gst_debug_get_categories() & (1<<i)?"/(enabled)":"/ "),
gst_get_category_name (i));
g_print (" 0x%08x %s%s %s\n", 1<<i,
(gst_info_get_categories() & (1<<i)?"(enabled)":" "),
(gst_debug_get_categories() & (1<<i)?"/(enabled)":"/ "),
gst_get_category_name (i));
#endif
}
}
ret = FALSE;

View file

@ -471,12 +471,12 @@ gst_caps_get_by_name (GstCaps *caps, const gchar *name)
return NULL;
}
static gboolean
gst_caps_check_compatibility_func (GstCaps *fromcaps, GstCaps *tocaps)
{
if (fromcaps->id != tocaps->id) {
GST_DEBUG (0,"gstcaps: mime types differ (%s to %s)\n",
GST_DEBUG (GST_CAT_CAPS,"mime types differ (%s to %s)\n",
gst_type_find_by_id (fromcaps->id)->mime,
gst_type_find_by_id (tocaps->id)->mime);
return FALSE;
@ -487,13 +487,13 @@ gst_caps_check_compatibility_func (GstCaps *fromcaps, GstCaps *tocaps)
return gst_props_check_compatibility (fromcaps->properties, tocaps->properties);
}
else {
GST_DEBUG (0,"gstcaps: no source caps\n");
GST_DEBUG (GST_CAT_CAPS,"no source caps\n");
return FALSE;
}
}
else {
// assume it accepts everything
GST_DEBUG (0,"gstcaps: no caps\n");
GST_DEBUG (GST_CAT_CAPS,"no caps\n");
return TRUE;
}
}
@ -512,17 +512,17 @@ gst_caps_check_compatibility (GstCaps *fromcaps, GstCaps *tocaps)
{
if (fromcaps == NULL) {
if (tocaps == NULL) {
GST_DEBUG (0,"gstcaps: no caps\n");
GST_DEBUG (GST_CAT_CAPS,"no caps\n");
return TRUE;
}
else {
GST_DEBUG (0,"gstcaps: no src but destination caps\n");
GST_DEBUG (GST_CAT_CAPS,"gstcaps: no src but destination caps\n");
return FALSE;
}
}
else {
if (tocaps == NULL) {
GST_DEBUG (0,"gstcaps: src caps and no dest caps\n");
GST_DEBUG (GST_CAT_CAPS,"src caps and no dest caps\n");
return TRUE;
}
}

View file

@ -378,21 +378,18 @@ gst_element_get_pad (GstElement *element, const gchar *name)
if (!element->numpads)
return NULL;
GST_DEBUG(GST_CAT_ELEMENT_PADS,"searching for pad '%s' in element %s\n",
name, GST_ELEMENT_NAME (element));
// look through the list, matching by name
walk = element->pads;
while (walk) {
GstPad *pad = GST_PAD(walk->data);
if (!strcmp (GST_PAD_NAME(pad), name)) {
GST_DEBUG(GST_CAT_ELEMENT_PADS,"found pad '%s'\n",name);
GST_INFO(GST_CAT_ELEMENT_PADS,"found pad %s:%s\n",GST_DEBUG_PAD_NAME(pad));
return pad;
}
walk = g_list_next (walk);
}
GST_DEBUG(GST_CAT_ELEMENT_PADS,"no such pad '%s'\n",name);
GST_INFO(GST_CAT_ELEMENT_PADS,"no such pad '%s' in element \"%s\"\n",name,GST_ELEMENT_NAME(element));
return NULL;
}

View file

@ -68,8 +68,6 @@ gst_elementfactory_find (const gchar *name)
g_return_val_if_fail(name != NULL, NULL);
GST_DEBUG (GST_CAT_ELEMENTFACTORY,"gstelementfactory: find \"%s\"\n", name);
walk = _gst_elementfactories;
while (walk) {
factory = (GstElementFactory *)(walk->data);
@ -78,6 +76,8 @@ gst_elementfactory_find (const gchar *name)
walk = g_list_next(walk);
}
// this should be an ERROR
GST_DEBUG (GST_CAT_ELEMENTFACTORY,"no such elementfactoryfactory \"%s\"\n", name);
return NULL;
}
@ -148,7 +148,8 @@ gst_elementfactory_create (GstElementFactory *factory,
g_return_val_if_fail(factory != NULL, NULL);
g_return_val_if_fail(name != NULL, NULL);
GST_DEBUG (GST_CAT_ELEMENTFACTORY,"gstelementfactory: create \"%s\" \"%s\"\n", factory->name, name);
GST_DEBUG (GST_CAT_ELEMENTFACTORY,"creating element from factory \"%s\" with name \"%s\"\n",
factory->name, name);
// it's not loaded, try to load the plugin
if (factory->type == 0) {
@ -165,7 +166,7 @@ gst_elementfactory_create (GstElementFactory *factory,
// attempt to set the elemenfactory class pointer if necessary
oclass = GST_ELEMENT_CLASS(GTK_OBJECT(element)->klass);
if (oclass->elementfactory == NULL) {
GST_DEBUG (GST_CAT_ELEMENTFACTORY,"gstelementfactory: class %s\n", factory->name);
GST_DEBUG (GST_CAT_ELEMENTFACTORY,"class %s\n", factory->name);
oclass->elementfactory = factory;
}
@ -194,7 +195,7 @@ gst_elementfactory_make (const gchar *factoryname, const gchar *name)
g_return_val_if_fail(factoryname != NULL, NULL);
g_return_val_if_fail(name != NULL, NULL);
GST_DEBUG (GST_CAT_ELEMENTFACTORY,"gstelementfactory: make \"%s\" \"%s\"\n", factoryname, name);
// GST_DEBUG (GST_CAT_ELEMENTFACTORY,"gstelementfactory: make \"%s\" \"%s\"\n", factoryname, name);
//gst_plugin_load_elementfactory(factoryname);
factory = gst_elementfactory_find(factoryname);

View file

@ -28,19 +28,7 @@
extern gchar *_gst_progname;
/***** DEBUG system *****/
GHashTable *__gst_function_pointers = NULL;
/***** INFO system *****/
GstInfoHandler _gst_info_handler = gst_default_info_handler;
#ifdef GST_INFO_ENABLED_VERBOSE
guint32 _gst_info_categories = 0xffffffff;
#else
guint32 _gst_info_categories = 0x00000001;
#endif
/***** Categories and colorization *****/
static gchar *_gst_info_category_strings[] = {
"GST_INIT",
"COTHREADS",
@ -69,6 +57,21 @@ static gchar *_gst_info_category_strings[] = {
"NEGOTIATION",
};
/**
* gst_get_category_name:
* @category: the category to return the name of
*
* Returns: string containing the name of the category
*/
const gchar *
gst_get_category_name (gint category) {
if ((category >= 0) && (category < GST_CAT_MAX_CATEGORY))
return _gst_info_category_strings[category];
else
return NULL;
}
/*
* Attribute codes:
* 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
@ -77,11 +80,10 @@ static gchar *_gst_info_category_strings[] = {
* Background color codes:
* 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
*/
const gchar *_gst_category_colors[32] = {
[GST_CAT_GST_INIT] = "07;37",
[GST_CAT_COTHREADS] = "00;32",
[GST_CAT_COTHREAD_SWITCH] = "00;32",
[GST_CAT_COTHREADS] = "07;32",
[GST_CAT_COTHREAD_SWITCH] = "01;37;42",
[GST_CAT_AUTOPLUG] = "00;34",
[GST_CAT_AUTOPLUG_ATTEMPT] = "00;36;44",
[GST_CAT_PARENTAGE] = "01;37;41", // !!
@ -108,8 +110,7 @@ const gchar *_gst_category_colors[32] = {
[31] = "",
};
/* colorization hash */
/* colorization hash - DEPRACATED in favor of above */
inline gint _gst_debug_stringhash_color(gchar *file) {
int filecolor = 0;
while (file[0]) filecolor += *(char *)(file++);
@ -118,6 +119,125 @@ inline gint _gst_debug_stringhash_color(gchar *file) {
}
/***** DEBUG system *****/
GstDebugHandler _gst_debug_handler = gst_default_debug_handler;
guint32 _gst_debug_categories = 0x00000000;
/**
* gst_default_debug_handler:
* @category: category of the DEBUG message
* @file: the file the DEBUG occurs in
* @function: the function the DEBUG occurs in
* @line: the line number in the file
* @debug_string: the current debug_string in the function, if any
* @element: pointer to the #GstElement in question
* @string: the actual DEBUG string
*
* Prints out the DEBUG mesage in a variant of the following form:
*
* DEBUG(pid:cid):gst_function:542(args): [elementname] something neat happened
*/
void
gst_default_debug_handler (gint category, gboolean incore, gchar *file, gchar *function,
gint line, gchar *debug_string,
void *element, gchar *string)
{
gchar *empty = "";
gchar *elementname = empty,*location = empty;
int pthread_id = getpid();
int cothread_id = cothread_getcurrent();
#ifdef GST_DEBUG_COLOR
int pthread_color = pthread_id%6 + 31;
int cothread_color = (cothread_id < 0) ? 37 : (cothread_id%6 + 31);
#endif
if (debug_string == NULL) debug_string = "";
// if (category != GST_CAT_GST_INIT)
location = g_strdup_printf("%s:%d%s:",function,line,debug_string);
if (element && GST_IS_ELEMENT (element))
elementname = g_strdup_printf (" \033[04m[%s]\033[00m", GST_OBJECT_NAME (element));
#ifdef GST_DEBUG_COLOR
fprintf(stderr,"DEBUG(\033[00;%dm%5d\033[00m:\033[00;%dm%2d\033[00m)\033["
"%s;%sm%s%s\033[00m %s",
pthread_color,pthread_id,cothread_color,cothread_id,incore?"00":"01",
_gst_category_colors[category],location,elementname,string);
#else
fprintf(stderr,"DEBUG(%5d:%2d)%s%s %s",
pthread_id,cothread_id,location,elementname,string);
#endif /* GST_DEBUG_COLOR */
if (location != empty) g_free(location);
if (elementname != empty) g_free(elementname);
g_free(string);
}
/**
* gst_debug_set_categories:
* @categories: bitmask of DEBUG categories to enable
*
* Enable the output of DEBUG categories based on the given bitmask.
* The bit for any given category is (1 << GST_CAT_...).
*/
void
gst_debug_set_categories (guint32 categories) {
_gst_debug_categories = categories;
if (categories)
GST_INFO (0, "setting DEBUG categories to 0x%08X",categories);
}
/**
* gst_debug_get_categories:
*
* Returns: the current bitmask of enabled DEBUG categories
* The bit for any given category is (1 << GST_CAT_...).
*/
guint32
gst_debug_get_categories () {
return _gst_debug_categories;
}
/**
* gst_debug_enable_category:
* @category: the category to enable
*
* Enables the given GST_CAT_... DEBUG category.
*/
void
gst_debug_enable_category (gint category) {
_gst_debug_categories |= (1 << category);
if (_gst_debug_categories)
GST_INFO (0, "setting DEBUG categories to 0x%08X",_gst_debug_categories);
}
/**
* gst_debug_disable_category:
* @category: the category to disable
*
* Disables the given GST_CAT_... DEBUG category.
*/
void
gst_debug_disable_category (gint category) {
_gst_debug_categories &= ~ (1 << category);
if (_gst_debug_categories)
GST_INFO (0, "setting DEBUG categories to 0x%08X",_gst_debug_categories);
}
/***** INFO system *****/
GstInfoHandler _gst_info_handler = gst_default_info_handler;
#ifdef GST_INFO_ENABLED_VERBOSE
guint32 _gst_info_categories = 0xffffffff;
#else
guint32 _gst_info_categories = 0x00000001;
#endif
/**
* gst_default_info_handler:
* @category: category of the INFO message
@ -133,7 +253,7 @@ inline gint _gst_debug_stringhash_color(gchar *file) {
* INFO:gst_function:542(args): [elementname] something neat happened
*/
void
gst_default_info_handler (gint category, gchar *file, gchar *function,
gst_default_info_handler (gint category, gboolean incore,gchar *file, gchar *function,
gint line, gchar *debug_string,
void *element, gchar *string)
{
@ -160,7 +280,7 @@ gst_default_info_handler (gint category, gchar *file, gchar *function,
_gst_category_colors[category],location,elementname,string);
#else
fprintf(stderr,"INFO (%5d:%2d)%s%s %s\n",
getpid(),cothread_id,location,elementname,string);
pthread_id,cothread_id,location,elementname,string);
#endif /* GST_DEBUG_COLOR */
#else
#ifdef GST_DEBUG_COLOR
@ -231,77 +351,6 @@ gst_info_disable_category (gint category) {
/***** DEBUG system *****/
guint32 _gst_debug_categories = 0x00000000;
/**
* gst_debug_set_categories:
* @categories: bitmask of DEBUG categories to enable
*
* Enable the output of DEBUG categories based on the given bitmask.
* The bit for any given category is (1 << GST_CAT_...).
*/
void
gst_debug_set_categories (guint32 categories) {
_gst_debug_categories = categories;
if (categories)
GST_INFO (0, "setting DEBUG categories to 0x%08X",categories);
}
/**
* gst_debug_get_categories:
*
* Returns: the current bitmask of enabled DEBUG categories
* The bit for any given category is (1 << GST_CAT_...).
*/
guint32
gst_debug_get_categories () {
return _gst_debug_categories;
}
/**
* gst_debug_enable_category:
* @category: the category to enable
*
* Enables the given GST_CAT_... DEBUG category.
*/
void
gst_debug_enable_category (gint category) {
_gst_debug_categories |= (1 << category);
if (_gst_debug_categories)
GST_INFO (0, "setting DEBUG categories to 0x%08X",_gst_debug_categories);
}
/**
* gst_debug_disable_category:
* @category: the category to disable
*
* Disables the given GST_CAT_... DEBUG category.
*/
void
gst_debug_disable_category (gint category) {
_gst_debug_categories &= ~ (1 << category);
if (_gst_debug_categories)
GST_INFO (0, "setting DEBUG categories to 0x%08X",_gst_debug_categories);
}
/**
* gst_get_category_name:
* @category: the category to return the name of
*
* Returns: string containing the name of the category
*/
const gchar *
gst_get_category_name (gint category) {
if ((category >= 0) && (category < GST_CAT_MAX_CATEGORY))
return _gst_info_category_strings[category];
else
return NULL;
}
/***** ERROR system *****/
GstErrorHandler _gst_error_handler = gst_default_error_handler;
@ -389,6 +438,9 @@ gst_default_error_handler (gchar *file, gchar *function,
#warning __USE_GNU is defined
#endif
/***** DEBUG system *****/
GHashTable *__gst_function_pointers = NULL;
gchar *
_gst_debug_nameof_funcptr (void *ptr)
{

View file

@ -34,6 +34,14 @@
#include "cothreads.h"
/***** are we in the core or not? *****/
#ifdef __GST_PRIVATE_H__
#define _GST_DEBUG_INCORE TRUE
#else
#define _GST_DEBUG_INCORE FALSE
#endif
/* colorization stuff */
#ifdef GST_DEBUG_COLOR
#ifdef __GST_PRIVATE_H__ /* FIXME this should be some libgst.la -specific thing */
@ -47,13 +55,50 @@ gint _gst_debug_stringhash_color(gchar *file);
/**********************************************************************
* Categories
**********************************************************************/
const gchar * gst_get_category_name (gint category);
enum {
GST_CAT_GST_INIT = 0, // Library initialization
GST_CAT_COTHREADS, // Cothread creation, etc.
GST_CAT_COTHREAD_SWITCH, // Cothread switching
GST_CAT_AUTOPLUG, // Successful autoplug results
GST_CAT_AUTOPLUG_ATTEMPT, // Attempted autoplug operations
GST_CAT_PARENTAGE, // GstBin parentage issues
GST_CAT_STATES, // State changes and such
GST_CAT_PLANNING, // Plan generation
GST_CAT_SCHEDULING, // Schedule construction
GST_CAT_DATAFLOW, // Events during actual data movement
GST_CAT_BUFFER, // Buffer creation/destruction
GST_CAT_CAPS, // Capabilities matching
GST_CAT_CLOCK, // Clocking
GST_CAT_ELEMENT_PADS, // Element pad management
GST_CAT_ELEMENTFACTORY, // Elementfactory stuff
GST_CAT_PADS, // Pad creation/connection
GST_CAT_PIPELINE, // Pipeline stuff
GST_CAT_PLUGIN_LOADING, // Plugin loading
GST_CAT_PLUGIN_ERRORS, // Errors during plugin loading
GST_CAT_PLUGIN_INFO, // Plugin state information
GST_CAT_PROPERTIES, // Properties
GST_CAT_THREAD, // Thread creation/management
GST_CAT_TYPES, // Typing
GST_CAT_XML, // XML load/save of everything
GST_CAT_NEGOTIATION, // Caps Negotiation stuff
GST_CAT_MAX_CATEGORY = 31
};
extern const gchar *_gst_category_colors[32];
/**********************************************************************
* DEBUG system
**********************************************************************/
extern guint32 _gst_debug_categories;
/* for include files that make too much noise normally */
#ifdef GST_DEBUG_FORCE_DISABLE
#undef GST_DEBUG_ENABLED
@ -69,119 +114,59 @@ extern guint32 _gst_debug_categories;
//#define GST_DEBUG_ENABLE_CATEGORIES 0x00000000
//#endif
typedef void (*GstDebugHandler) (gint category,gboolean core,gchar *file,gchar *function,
gint line,gchar *debug_string,
void *element,gchar *string);
void gst_default_debug_handler (gint category,gboolean incore,gchar *file,gchar *function,
gint line,gchar *debug_string,
void *element,gchar *string);
extern guint32 _gst_debug_categories;
extern GstDebugHandler _gst_debug_handler;
/* fallback, this should probably be a 'weak' symbol or something */
G_GNUC_UNUSED static gchar *_debug_string = NULL;
#ifdef GST_DEBUG_COLOR
#ifdef _GST_COLOR_CODE
#warning have a coded debug
#define GST_DEBUG_PREFIX(cat,format,args...) \
"DEBUG(%5d:%2d)\033[" _GST_COLOR_CODE "m" __PRETTY_FUNCTION__ ":%d\033[00m" format , \
getpid() , cothread_getcurrent() , __LINE__ , ## args
#else
#define GST_DEBUG_PREFIX(cat,format,args...) \
"DEBUG(%5d:%2d)\033[" GST_DEBUG_CHAR_MODE ";%sm" __PRETTY_FUNCTION__ ":%d\033[00m" format , \
getpid() , cothread_getcurrent() , _gst_category_colors[cat] , __LINE__ , ## args
#endif /* _GST_COLOR_CODE */
#else
#define GST_DEBUG_PREFIX(cat,format,args...) \
"DEBUG(%5d:%2d)" __PRETTY_FUNCTION__ ":%d" format , getpid() ,cothread_getcurrent() , __LINE__ , ## args
#endif
#ifdef GST_DEBUG_ENABLED
#define GST_DEBUG(cat,format,args...) G_STMT_START{ \
if (((1<<cat) & GST_DEBUG_ENABLE_CATEGORIES) && \
((1<<cat) & _gst_debug_categories)) \
(_debug_string != NULL) ? \
fprintf(stderr,GST_DEBUG_PREFIX(cat,"%s: "format , _debug_string , ## args )) : \
fprintf(stderr,GST_DEBUG_PREFIX(cat,": "format , ## args )); \
if ((1<<cat) & _gst_debug_categories) \
_gst_debug_handler(cat,_GST_DEBUG_INCORE,__FILE__,__PRETTY_FUNCTION__,__LINE__,_debug_string, \
NULL,g_strdup_printf( format , ## args )); \
}G_STMT_END
#define GST_DEBUG_NOPREFIX(cat,format,args...) G_STMT_START{ \
if (((1<<cat) & GST_DEBUG_ENABLE_CATEGORIES) && \
((1<<cat) & _gst_debug_categories)) \
fprintf(stderr,format , ## args ); \
#define GST_DEBUG_ELEMENT(cat,element,format,args...) G_STMT_START{ \
if ((1<<cat) & _gst_debug_categories) \
_gst_debug_handler(cat,_GST_DEBUG_INCORE,__FILE__,__PRETTY_FUNCTION__,__LINE__,_debug_string, \
element,g_strdup_printf( format , ## args )); \
}G_STMT_END
#ifdef GST_DEBUG_COLOR
#define GST_DEBUG_ENTER(format, args...) G_STMT_START{ \
if (((1<<31) & GST_DEBUG_ENABLE_CATEGORIES) && \
((1<<31) & _gst_debug_categories)) \
fprintf(stderr,GST_DEBUG_PREFIX(31,format": \033[01;37mentering\033[00m\n" , ## args )); \
}G_STMT_END
#else
#define GST_DEBUG_ENTER(format, args...) G_STMT_START{ \
if (((1<<31) & GST_DEBUG_ENABLE_CATEGORIES) && \
((1<<31) & _gst_debug_categories)) \
fprintf(stderr,GST_DEBUG_PREFIX(31,format": entering\n" , ## args )); \
}G_STMT_END
#endif /* GST_DEBUG_COLOR */
// FIXME FIXME FIXME this leaks like crazy
#define GST_DEBUG_SET_STRING(format, args...) \
gchar *_debug_string = g_strdup_printf(format , ## args )
#define GST_DEBUG_ENTER_STRING GST_DEBUG_ENTER("%s",_debug_string)
#ifdef GST_DEBUG_COLOR
#define GST_DEBUG_LEAVE(format, args...) G_STMT_START{ \
if (((1<<31) & GST_DEBUG_ENABLE_CATEGORIES) && \
((1<<31) & _gst_debug_categories)) \
if (_debug_string != NULL) g_free(_debug_string),\
fprintf(stderr,GST_DEBUG_PREFIX(31,format": \033[01;37mleaving\033[00m\n" , ## args )); \
}G_STMT_END
#else
#define GST_DEBUG_LEAVE(format, args...) G_STMT_START{ \
if (((1<<31) & GST_DEBUG_ENABLE_CATEGORIES) && \
((1<<31) & _gst_debug_categories)) \
if (_debug_string != NULL) g_free(_debug_string),\
fprintf(stderr,GST_DEBUG_PREFIX(31,format": leaving\n" , ## args )); \
}G_STMT_END
#endif /* GST_DEBUG_COLOR */
#define GST_DEBUG_LEAVE_STRING GST_DEBUG_LEAVE("%s",_debug_string)
#else
#define GST_DEBUG(format, args...)
#define GST_DEBUG_NOPREFIX(format, args...)
#define GST_DEBUG_ENTER(format, args...)
#define GST_DEBUG_LEAVE(format, args...)
#define GST_DEBUG_SET_STRING(format, args...)
#define GST_DEBUG_ENTER_STRING
#define GST_DEBUG(cat,format,args...)
#define GST_DEBUG_ELEMENT(cat,element,format,args...)
#endif
/********** some convenience macros for debugging **********/
#define GST_DEBUG_PAD_NAME(pad) \
(GST_OBJECT_PARENT(pad) != NULL) ? \
GST_OBJECT_NAME (GST_OBJECT_PARENT(pad)) : \
"''", GST_OBJECT_NAME (pad)
/********** function pointer stuff **********/
extern GHashTable *__gst_function_pointers;
#ifdef GST_DEBUG_ENABLED_dontuse
#define GST_DEBUG_FUNCPTR(ptr) _gst_debug_register_funcptr((void *)(ptr), #ptr)
#define GST_DEBUG_FUNCPTR_NAME(ptr) _gst_debug_nameof_funcptr((void *)ptr)
#ifdef GST_DEBUG_COLOR
#define GST_DEBUG_ENTER(format, args...) GST_DEBUG( 31 , format ": \033[01;37mentering\033[00m\n", ## args )
#define GST_DEBUG_LEAVE(format, args...) GST_DEBUG( 31 , format ": \033[01;37mleaving\033[00m\n", ## args )
#else
#define GST_DEBUG_FUNCPTR(ptr) (ptr)
#define GST_DEBUG_FUNCPTR_NAME(ptr) ""
#define GST_DEBUG_ENTER(format, args...) GST_DEBUG( 31 , format ": entering\n", ## args )
#define GST_DEBUG_LEAVE(format, args...) GST_DEBUG( 31 , format ": leaving\n", ## args )
#endif
static inline void *
_gst_debug_register_funcptr (void *ptr, gchar *ptrname)
{
if (!__gst_function_pointers) __gst_function_pointers = g_hash_table_new(g_direct_hash,g_direct_equal);
if (!g_hash_table_lookup(__gst_function_pointers,ptr))
g_hash_table_insert(__gst_function_pointers,ptr,ptrname);
return ptr;
}
gchar *_gst_debug_nameof_funcptr (void *ptr);
/**********************************************************************
@ -237,11 +222,11 @@ G_GNUC_UNUSED static GModule *_debug_self_module = NULL;
* INFO system
**********************************************************************/
typedef void (*GstInfoHandler) (gint category,gchar *file,gchar *function,
typedef void (*GstInfoHandler) (gint category,gboolean incore,gchar *file,gchar *function,
gint line,gchar *debug_string,
void *element,gchar *string);
void gst_default_info_handler (gint category,gchar *file,gchar *function,
void gst_default_info_handler (gint category,gboolean incore,gchar *file,gchar *function,
gint line,gchar *debug_string,
void *element,gchar *string);
@ -260,13 +245,13 @@ extern guint32 _gst_info_categories;
#ifdef GST_INFO_ENABLED
#define GST_INFO(cat,format,args...) G_STMT_START{ \
if ((1<<cat) & _gst_info_categories) \
_gst_info_handler(cat,__FILE__,__PRETTY_FUNCTION__,__LINE__,_debug_string, \
_gst_info_handler(cat,_GST_DEBUG_INCORE,__FILE__,__PRETTY_FUNCTION__,__LINE__,_debug_string, \
NULL,g_strdup_printf( format , ## args )); \
}G_STMT_END
#define GST_INFO_ELEMENT(cat,element,format,args...) G_STMT_START{ \
if ((1<<cat) & _gst_info_categories) \
_gst_info_handler(cat,__FILE__,__PRETTY_FUNCTION__,__LINE__,_debug_string, \
_gst_info_handler(cat,_GST_DEBUG_INCORE,__FILE__,__PRETTY_FUNCTION__,__LINE__,_debug_string, \
element,g_strdup_printf( format , ## args )); \
}G_STMT_END
@ -286,42 +271,6 @@ guint32 gst_debug_get_categories (void);
void gst_debug_enable_category (gint category);
void gst_debug_disable_category (gint category);
const gchar * gst_get_category_name (gint category);
enum {
GST_CAT_GST_INIT = 0, // Library initialization
GST_CAT_COTHREADS, // Cothread creation, etc.
GST_CAT_COTHREAD_SWITCH, // Cothread switching
GST_CAT_AUTOPLUG, // Successful autoplug results
GST_CAT_AUTOPLUG_ATTEMPT, // Attempted autoplug operations
GST_CAT_PARENTAGE, // GstBin parentage issues
GST_CAT_STATES, // State changes and such
GST_CAT_PLANNING, // Plan generation
GST_CAT_SCHEDULING, // Schedule construction
GST_CAT_DATAFLOW, // Events during actual data movement
GST_CAT_BUFFER, // Buffer creation/destruction
GST_CAT_CAPS, // Capabilities matching
GST_CAT_CLOCK, // Clocking
GST_CAT_ELEMENT_PADS, // Element pad management
GST_CAT_ELEMENTFACTORY, // Elementfactory stuff
GST_CAT_PADS, // Pad creation/connection
GST_CAT_PIPELINE, // Pipeline stuff
GST_CAT_PLUGIN_LOADING, // Plugin loading
GST_CAT_PLUGIN_ERRORS, // Errors during plugin loading
GST_CAT_PLUGIN_INFO, // Plugin state information
GST_CAT_PROPERTIES, // Properties
GST_CAT_THREAD, // Thread creation/management
GST_CAT_TYPES, // Typing
GST_CAT_XML, // XML load/save of everything
GST_CAT_NEGOTIATION, // Caps Negotiation stuff
GST_CAT_MAX_CATEGORY,
};
extern const gchar *_gst_category_colors[32];
@ -349,4 +298,29 @@ extern GstErrorHandler _gst_error_handler;
/********** function pointer stuff **********/
extern GHashTable *__gst_function_pointers;
#define GST_DEBUG_FUNCPTR(ptr) (ptr)
#define GST_DEBUG_FUNCPTR_NAME(ptr) _gst_debug_nameof_funcptr((void *)ptr)
#if 0
#define GST_DEBUG_FUNCPTR(ptr) _gst_debug_register_funcptr((void *)(ptr), #ptr)
#define GST_DEBUG_FUNCPTR_NAME(ptr) ""
#endif
static inline void *
_gst_debug_register_funcptr (void *ptr, gchar *ptrname)
{
if (!__gst_function_pointers) __gst_function_pointers = g_hash_table_new(g_direct_hash,g_direct_equal);
if (!g_hash_table_lookup(__gst_function_pointers,ptr))
g_hash_table_insert(__gst_function_pointers,ptr,ptrname);
return ptr;
}
gchar *_gst_debug_nameof_funcptr (void *ptr);
#endif /* __GSTINFO_H__ */

View file

@ -343,7 +343,8 @@ void gst_pad_set_chain_function (GstPad *pad,
g_return_if_fail (GST_IS_REAL_PAD (pad));
GST_RPAD_CHAINFUNC(pad) = chain;
GST_DEBUG (GST_CAT_PADS,"chainfunc for %s:%s is set to %p\n",GST_DEBUG_PAD_NAME(pad),chain);
GST_DEBUG (GST_CAT_PADS,"chainfunc for %s:%s set to %s\n",
GST_DEBUG_PAD_NAME(pad),GST_DEBUG_FUNCPTR_NAME(chain));
}
/**
@ -361,8 +362,8 @@ gst_pad_set_get_function (GstPad *pad,
g_return_if_fail (GST_IS_REAL_PAD (pad));
GST_RPAD_GETFUNC(pad) = get;
GST_DEBUG (GST_CAT_PADS,"getfunc for %s:%s(@%p) at %p is set to %p\n",
GST_DEBUG_PAD_NAME(pad),pad,&GST_RPAD_GETFUNC(pad),get);
GST_DEBUG (GST_CAT_PADS,"getfunc for %s:%s set to %s\n",
GST_DEBUG_PAD_NAME(pad),GST_DEBUG_FUNCPTR_NAME(get));
}
/**
@ -380,8 +381,8 @@ gst_pad_set_getregion_function (GstPad *pad,
g_return_if_fail (GST_IS_REAL_PAD (pad));
GST_RPAD_GETREGIONFUNC(pad) = getregion;
GST_DEBUG (GST_CAT_PADS,"getregionfunc for %s:%s(@%p) at %p is set to %p\n",
GST_DEBUG_PAD_NAME(pad),pad,&GST_RPAD_GETREGIONFUNC(pad),getregion);
GST_DEBUG (GST_CAT_PADS,"getregionfunc for %s:%s set to %s\n",
GST_DEBUG_PAD_NAME(pad),GST_DEBUG_FUNCPTR_NAME(getregion));
}
/**
@ -399,8 +400,8 @@ gst_pad_set_qos_function (GstPad *pad,
g_return_if_fail (GST_IS_REAL_PAD (pad));
GST_RPAD_QOSFUNC(pad) = qos;
GST_DEBUG (GST_CAT_PADS,"qosfunc for %s:%s(@%p) at %p is set to %p\n",
GST_DEBUG_PAD_NAME(pad),pad,&GST_RPAD_QOSFUNC(pad),qos);
GST_DEBUG (GST_CAT_PADS,"qosfunc for %s:%s set to %s\n",
GST_DEBUG_PAD_NAME(pad),GST_DEBUG_FUNCPTR_NAME(qos));
}
/**
@ -418,8 +419,8 @@ gst_pad_set_eos_function (GstPad *pad,
g_return_if_fail (GST_IS_REAL_PAD (pad));
GST_RPAD_EOSFUNC(pad) = eos;
GST_DEBUG (GST_CAT_PADS,"eosfunc for %s:%s(@%p) at %p is set to %p\n",
GST_DEBUG_PAD_NAME(pad),pad,&GST_RPAD_EOSFUNC(pad),eos);
GST_DEBUG (GST_CAT_PADS,"eosfunc for %s:%s set to %s\n",
GST_DEBUG_PAD_NAME(pad),GST_DEBUG_FUNCPTR_NAME(eos));
}
/**
@ -437,8 +438,8 @@ gst_pad_set_negotiate_function (GstPad *pad,
g_return_if_fail (GST_IS_REAL_PAD (pad));
GST_RPAD_NEGOTIATEFUNC(pad) = nego;
GST_DEBUG (GST_CAT_PADS,"negotiatefunc for %s:%s(@%p) at %p is set to %p\n",
GST_DEBUG_PAD_NAME(pad),pad,&GST_RPAD_NEGOTIATEFUNC(pad),nego);
GST_DEBUG (GST_CAT_PADS,"negotiatefunc for %s:%s set to %s\n",
GST_DEBUG_PAD_NAME(pad),GST_DEBUG_FUNCPTR_NAME(nego));
}
@ -457,8 +458,8 @@ gst_pad_set_newcaps_function (GstPad *pad,
g_return_if_fail (GST_IS_REAL_PAD (pad));
GST_RPAD_NEWCAPSFUNC (pad) = newcaps;
GST_DEBUG (GST_CAT_PADS,"newcapsfunc for %s:%s(@%p) at %p is set to %p\n",
GST_DEBUG_PAD_NAME(pad),pad,&GST_RPAD_NEWCAPSFUNC(pad),newcaps);
GST_DEBUG (GST_CAT_PADS,"newcapsfunc for %s:%s set to %s\n",
GST_DEBUG_PAD_NAME(pad),GST_DEBUG_FUNCPTR_NAME(newcaps));
}
/**
@ -476,15 +477,15 @@ gst_pad_set_bufferpool_function (GstPad *pad,
g_return_if_fail (GST_IS_REAL_PAD (pad));
GST_RPAD_BUFFERPOOLFUNC (pad) = bufpool;
GST_DEBUG (GST_CAT_PADS,"bufferpoolfunc for %s:%s(@%p) at %p is set to %p\n",
GST_DEBUG_PAD_NAME (pad), pad, &GST_RPAD_BUFFERPOOLFUNC (pad), bufpool);
GST_DEBUG (GST_CAT_PADS,"bufferpoolfunc for %s:%s set to %s\n",
GST_DEBUG_PAD_NAME (pad), GST_DEBUG_FUNCPTR_NAME(bufpool));
}
static void
gst_pad_push_func(GstPad *pad, GstBuffer *buf)
{
if (GST_RPAD_CHAINFUNC(GST_RPAD_PEER(pad)) != NULL) {
GST_DEBUG (GST_CAT_DATAFLOW,"calling chain function\n");
GST_DEBUG (GST_CAT_DATAFLOW,"calling chain function %s\n");
(GST_RPAD_CHAINFUNC(GST_RPAD_PEER(pad)))(pad,buf);
} else {
GST_DEBUG (GST_CAT_DATAFLOW,"got a problem here: default pad_push handler in place, no chain function\n");
@ -595,9 +596,6 @@ gst_pad_connect (GstPad *srcpad,
g_return_val_if_fail(sinkpad != NULL, FALSE);
g_return_val_if_fail(GST_IS_PAD(sinkpad), FALSE);
GST_INFO (GST_CAT_ELEMENT_PADS, "about to connect %s:%s and %s:%s",
GST_DEBUG_PAD_NAME(srcpad), GST_DEBUG_PAD_NAME(sinkpad));
// now we need to deal with the real/ghost stuff
realsrc = GST_PAD_REALIZE(srcpad);
realsink = GST_PAD_REALIZE(sinkpad);
@ -613,7 +611,7 @@ gst_pad_connect (GstPad *srcpad,
realsink = temppad;
}
g_return_val_if_fail((GST_RPAD_DIRECTION(realsrc) == GST_PAD_SRC) &&
(GST_RPAD_DIRECTION(realsink) == GST_PAD_SINK), FALSE);
(GST_RPAD_DIRECTION(realsink) == GST_PAD_SINK), FALSE);
/* first set peers */
@ -632,9 +630,6 @@ gst_pad_connect (GstPad *srcpad,
else if (realsink->sched)
GST_SCHEDULE_PAD_CONNECT (realsink->sched, realsrc, realsink);
GST_INFO (GST_CAT_ELEMENT_PADS, "connected %s:%s and %s:%s",
GST_DEBUG_PAD_NAME(srcpad), GST_DEBUG_PAD_NAME(sinkpad));
if (GST_PAD_CAPS (srcpad)) {
negotiated = gst_pad_renegotiate (srcpad);
}
@ -645,9 +640,14 @@ gst_pad_connect (GstPad *srcpad,
negotiated = TRUE;
if (!negotiated) {
GST_INFO(GST_CAT_ELEMENT_PADS, "pads %s:%s and %s:%s failed to negotiate, disconnecting",
GST_DEBUG_PAD_NAME(srcpad), GST_DEBUG_PAD_NAME(sinkpad));
gst_pad_disconnect (GST_PAD (realsrc), GST_PAD (realsink));
return FALSE;
}
GST_INFO (GST_CAT_ELEMENT_PADS, "connected %s:%s and %s:%s",
GST_DEBUG_PAD_NAME(srcpad), GST_DEBUG_PAD_NAME(sinkpad));
return TRUE;
}

View file

@ -745,7 +745,7 @@ gst_props_check_compatibility (GstProps *fromprops, GstProps *toprops)
if (!gst_props_entry_check_compatibility (entry1, entry2)) {
compatible = FALSE;
GST_DEBUG (GST_CAT_PROPERTIES, "%s are not compatible\n:",
GST_DEBUG (GST_CAT_PROPERTIES, "%s are not compatible: ",
g_quark_to_string (entry1->propid));
gst_props_debug_entry (entry1);
gst_props_debug_entry (entry2);

View file

@ -23,7 +23,7 @@
//#define DEBUG_ENABLED
//#define STATUS_ENABLED
#ifdef STATUS_ENABLED
#define STATUS(A) GST_DEBUG(0,A, GST_ELEMENT_NAME(queue))
#define STATUS(A) GST_DEBUG(GST_CAT_DATAFLOW, A, GST_ELEMENT_NAME(queue))
#else
#define STATUS(A)
#endif
@ -208,10 +208,10 @@ gst_queue_handle_eos (GstPad *pad)
queue = GST_QUEUE (GST_OBJECT_PARENT (pad));
GST_DEBUG (0,"queue: %s received eos\n", GST_ELEMENT_NAME (queue));
GST_DEBUG (GST_CAT_DATAFLOW,"%s received eos\n", GST_ELEMENT_NAME (queue));
GST_LOCK (queue);
GST_DEBUG (0,"queue: %s has %d buffers left\n", GST_ELEMENT_NAME (queue),
GST_DEBUG (GST_CAT_DATAFLOW,"%s has %d buffers left\n", GST_ELEMENT_NAME (queue),
queue->level_buffers);
GST_FLAG_SET (pad, GST_PAD_EOS);
@ -226,7 +226,7 @@ gst_queue_handle_eos (GstPad *pad)
static void
gst_queue_cleanup_buffers (gpointer data, const gpointer user_data)
{
GST_DEBUG (0,"queue: %s cleaning buffer %p\n", (gchar *)user_data, data);
GST_DEBUG (GST_CAT_DATAFLOW,"%s cleaning buffer %p\n", (gchar *)user_data, data);
gst_buffer_unref (GST_BUFFER (data));
}
@ -259,16 +259,16 @@ gst_queue_chain (GstPad *pad, GstBuffer *buf)
/* we have to lock the queue since we span threads */
GST_DEBUG (0,"queue: try have queue lock\n");
GST_DEBUG (GST_CAT_DATAFLOW,"try have queue lock\n");
GST_LOCK (queue);
GST_DEBUG (0,"queue: %s adding buffer %p %ld\n", name, buf, pthread_self ());
GST_DEBUG (0,"queue: have queue lock\n");
GST_DEBUG (GST_CAT_DATAFLOW,"%s adding buffer %p %ld\n", name, buf, pthread_self ());
GST_DEBUG (GST_CAT_DATAFLOW,"have queue lock\n");
if (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLUSH)) {
gst_queue_flush (queue);
}
GST_DEBUG (0,"queue: %s: chain %d %p\n", name, queue->level_buffers, buf);
GST_DEBUG (GST_CAT_DATAFLOW,"%s: chain %d %p\n", name, queue->level_buffers, buf);
while (queue->level_buffers >= queue->max_buffers) {
// if there's a pending state change for this queue or its manager, switch
@ -280,28 +280,28 @@ gst_queue_chain (GstPad *pad, GstBuffer *buf)
cothread_switch(cothread_current_main());
}
GST_DEBUG (0,"queue: %s waiting %d\n", name, queue->level_buffers);
STATUS("%s: O\n");
GST_DEBUG (GST_CAT_DATAFLOW, "%s waiting %d\n", name, queue->level_buffers);
GST_DEBUG (GST_CAT_DATAFLOW, "%s: O\n", name);
g_cond_signal (queue->emptycond);
g_cond_wait (queue->fullcond, GST_OBJECT(queue)->lock);
STATUS("%s: O+\n");
GST_DEBUG (0,"queue: %s waiting done %d\n", name, queue->level_buffers);
GST_DEBUG (GST_CAT_DATAFLOW, "%s waiting done %d\n", name, queue->level_buffers);
}
/* put the buffer on the tail of the list */
queue->queue = g_slist_append (queue->queue, buf);
GST_DEBUG (0,"(%s:%s)+ ",GST_DEBUG_PAD_NAME(pad));
GST_DEBUG (GST_CAT_DATAFLOW,"(%s:%s)+ ",GST_DEBUG_PAD_NAME(pad));
/* if we were empty, but aren't any more, signal a condition */
queue->level_buffers++;
// if (queue->level_buffers >= 0)
if (queue->level_buffers == 1)
{
GST_DEBUG (0,"queue: %s signalling emptycond\n", name);
GST_DEBUG (GST_CAT_DATAFLOW,"%s signalling emptycond\n", name);
g_cond_signal (queue->emptycond);
}
GST_DEBUG (0,"queue: %s chain %d end signal(%d,%p)\n", name, queue->level_buffers, tosignal, queue->emptycond);
GST_DEBUG (GST_CAT_DATAFLOW,"%s chain %d end signal(%d,%p)\n", name, queue->level_buffers, tosignal, queue->emptycond);
GST_UNLOCK (queue);
}
@ -323,10 +323,10 @@ gst_queue_get (GstPad *pad)
name = GST_ELEMENT_NAME (queue);
/* have to lock for thread-safety */
GST_DEBUG (0,"queue: %s try have queue lock\n", name);
GST_DEBUG (GST_CAT_DATAFLOW,"%s try have queue lock\n", name);
GST_LOCK (queue);
GST_DEBUG (0,"queue: %s push %d %ld %p\n", name, queue->level_buffers, pthread_self (), queue->emptycond);
GST_DEBUG (0,"queue: %s have queue lock\n", name);
GST_DEBUG (GST_CAT_DATAFLOW,"%s push %d %ld %p\n", name, queue->level_buffers, pthread_self (), queue->emptycond);
GST_DEBUG (GST_CAT_DATAFLOW,"%s have queue lock\n", name);
// we bail if there's nothing there
// g_assert(queue->block);
@ -337,7 +337,7 @@ gst_queue_get (GstPad *pad)
while (!queue->level_buffers) {
if (GST_FLAG_IS_SET (queue->sinkpad, GST_PAD_EOS)) {
STATUS("queue: %s U released lock\n");
GST_DEBUG (GST_CAT_DATAFLOW, "%s U released lock\n", name);
GST_UNLOCK(queue);
gst_pad_set_eos (queue->srcpad);
// this return NULL shouldn't hurt anything...
@ -359,19 +359,19 @@ gst_queue_get (GstPad *pad)
front = queue->queue;
buf = (GstBuffer *)(front->data);
GST_DEBUG (0,"retrieved buffer %p from queue\n",buf);
GST_DEBUG (GST_CAT_DATAFLOW,"retrieved buffer %p from queue\n",buf);
queue->queue = g_slist_remove_link (queue->queue, front);
g_slist_free (front);
// if (queue->level_buffers < queue->max_buffers)
if (queue->level_buffers == queue->max_buffers)
{
GST_DEBUG (0,"queue: %s signalling fullcond\n", name);
GST_DEBUG (GST_CAT_DATAFLOW,"%s signalling fullcond\n", name);
g_cond_signal (queue->fullcond);
}
queue->level_buffers--;
GST_DEBUG (0,"(%s:%s)- ",GST_DEBUG_PAD_NAME(pad));
GST_DEBUG (GST_CAT_DATAFLOW,"(%s:%s)- ",GST_DEBUG_PAD_NAME(pad));
GST_UNLOCK(queue);
@ -391,7 +391,7 @@ gst_queue_change_state (GstElement *element)
// can't call this queue's _get (or whatever)
GST_LOCK (queue);
GST_DEBUG (GST_CAT_STATES,"gstqueue: state pending %d\n", GST_STATE_PENDING (element));
GST_DEBUG (GST_CAT_STATES,"state pending %d\n", GST_STATE_PENDING (element));
/* if going down into NULL state, clear out buffers*/
if (GST_STATE_PENDING (element) == GST_STATE_READY) {

View file

@ -23,7 +23,7 @@
//#define DEBUG_ENABLED
//#define STATUS_ENABLED
#ifdef STATUS_ENABLED
#define STATUS(A) GST_DEBUG(0,A, GST_ELEMENT_NAME(queue))
#define STATUS(A) GST_DEBUG(GST_CAT_DATAFLOW, A, GST_ELEMENT_NAME(queue))
#else
#define STATUS(A)
#endif
@ -208,10 +208,10 @@ gst_queue_handle_eos (GstPad *pad)
queue = GST_QUEUE (GST_OBJECT_PARENT (pad));
GST_DEBUG (0,"queue: %s received eos\n", GST_ELEMENT_NAME (queue));
GST_DEBUG (GST_CAT_DATAFLOW,"%s received eos\n", GST_ELEMENT_NAME (queue));
GST_LOCK (queue);
GST_DEBUG (0,"queue: %s has %d buffers left\n", GST_ELEMENT_NAME (queue),
GST_DEBUG (GST_CAT_DATAFLOW,"%s has %d buffers left\n", GST_ELEMENT_NAME (queue),
queue->level_buffers);
GST_FLAG_SET (pad, GST_PAD_EOS);
@ -226,7 +226,7 @@ gst_queue_handle_eos (GstPad *pad)
static void
gst_queue_cleanup_buffers (gpointer data, const gpointer user_data)
{
GST_DEBUG (0,"queue: %s cleaning buffer %p\n", (gchar *)user_data, data);
GST_DEBUG (GST_CAT_DATAFLOW,"%s cleaning buffer %p\n", (gchar *)user_data, data);
gst_buffer_unref (GST_BUFFER (data));
}
@ -259,16 +259,16 @@ gst_queue_chain (GstPad *pad, GstBuffer *buf)
/* we have to lock the queue since we span threads */
GST_DEBUG (0,"queue: try have queue lock\n");
GST_DEBUG (GST_CAT_DATAFLOW,"try have queue lock\n");
GST_LOCK (queue);
GST_DEBUG (0,"queue: %s adding buffer %p %ld\n", name, buf, pthread_self ());
GST_DEBUG (0,"queue: have queue lock\n");
GST_DEBUG (GST_CAT_DATAFLOW,"%s adding buffer %p %ld\n", name, buf, pthread_self ());
GST_DEBUG (GST_CAT_DATAFLOW,"have queue lock\n");
if (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLUSH)) {
gst_queue_flush (queue);
}
GST_DEBUG (0,"queue: %s: chain %d %p\n", name, queue->level_buffers, buf);
GST_DEBUG (GST_CAT_DATAFLOW,"%s: chain %d %p\n", name, queue->level_buffers, buf);
while (queue->level_buffers >= queue->max_buffers) {
// if there's a pending state change for this queue or its manager, switch
@ -280,28 +280,28 @@ gst_queue_chain (GstPad *pad, GstBuffer *buf)
cothread_switch(cothread_current_main());
}
GST_DEBUG (0,"queue: %s waiting %d\n", name, queue->level_buffers);
STATUS("%s: O\n");
GST_DEBUG (GST_CAT_DATAFLOW, "%s waiting %d\n", name, queue->level_buffers);
GST_DEBUG (GST_CAT_DATAFLOW, "%s: O\n", name);
g_cond_signal (queue->emptycond);
g_cond_wait (queue->fullcond, GST_OBJECT(queue)->lock);
STATUS("%s: O+\n");
GST_DEBUG (0,"queue: %s waiting done %d\n", name, queue->level_buffers);
GST_DEBUG (GST_CAT_DATAFLOW, "%s waiting done %d\n", name, queue->level_buffers);
}
/* put the buffer on the tail of the list */
queue->queue = g_slist_append (queue->queue, buf);
GST_DEBUG (0,"(%s:%s)+ ",GST_DEBUG_PAD_NAME(pad));
GST_DEBUG (GST_CAT_DATAFLOW,"(%s:%s)+ ",GST_DEBUG_PAD_NAME(pad));
/* if we were empty, but aren't any more, signal a condition */
queue->level_buffers++;
// if (queue->level_buffers >= 0)
if (queue->level_buffers == 1)
{
GST_DEBUG (0,"queue: %s signalling emptycond\n", name);
GST_DEBUG (GST_CAT_DATAFLOW,"%s signalling emptycond\n", name);
g_cond_signal (queue->emptycond);
}
GST_DEBUG (0,"queue: %s chain %d end signal(%d,%p)\n", name, queue->level_buffers, tosignal, queue->emptycond);
GST_DEBUG (GST_CAT_DATAFLOW,"%s chain %d end signal(%d,%p)\n", name, queue->level_buffers, tosignal, queue->emptycond);
GST_UNLOCK (queue);
}
@ -323,10 +323,10 @@ gst_queue_get (GstPad *pad)
name = GST_ELEMENT_NAME (queue);
/* have to lock for thread-safety */
GST_DEBUG (0,"queue: %s try have queue lock\n", name);
GST_DEBUG (GST_CAT_DATAFLOW,"%s try have queue lock\n", name);
GST_LOCK (queue);
GST_DEBUG (0,"queue: %s push %d %ld %p\n", name, queue->level_buffers, pthread_self (), queue->emptycond);
GST_DEBUG (0,"queue: %s have queue lock\n", name);
GST_DEBUG (GST_CAT_DATAFLOW,"%s push %d %ld %p\n", name, queue->level_buffers, pthread_self (), queue->emptycond);
GST_DEBUG (GST_CAT_DATAFLOW,"%s have queue lock\n", name);
// we bail if there's nothing there
// g_assert(queue->block);
@ -337,7 +337,7 @@ gst_queue_get (GstPad *pad)
while (!queue->level_buffers) {
if (GST_FLAG_IS_SET (queue->sinkpad, GST_PAD_EOS)) {
STATUS("queue: %s U released lock\n");
GST_DEBUG (GST_CAT_DATAFLOW, "%s U released lock\n", name);
GST_UNLOCK(queue);
gst_pad_set_eos (queue->srcpad);
// this return NULL shouldn't hurt anything...
@ -359,19 +359,19 @@ gst_queue_get (GstPad *pad)
front = queue->queue;
buf = (GstBuffer *)(front->data);
GST_DEBUG (0,"retrieved buffer %p from queue\n",buf);
GST_DEBUG (GST_CAT_DATAFLOW,"retrieved buffer %p from queue\n",buf);
queue->queue = g_slist_remove_link (queue->queue, front);
g_slist_free (front);
// if (queue->level_buffers < queue->max_buffers)
if (queue->level_buffers == queue->max_buffers)
{
GST_DEBUG (0,"queue: %s signalling fullcond\n", name);
GST_DEBUG (GST_CAT_DATAFLOW,"%s signalling fullcond\n", name);
g_cond_signal (queue->fullcond);
}
queue->level_buffers--;
GST_DEBUG (0,"(%s:%s)- ",GST_DEBUG_PAD_NAME(pad));
GST_DEBUG (GST_CAT_DATAFLOW,"(%s:%s)- ",GST_DEBUG_PAD_NAME(pad));
GST_UNLOCK(queue);
@ -391,7 +391,7 @@ gst_queue_change_state (GstElement *element)
// can't call this queue's _get (or whatever)
GST_LOCK (queue);
GST_DEBUG (GST_CAT_STATES,"gstqueue: state pending %d\n", GST_STATE_PENDING (element));
GST_DEBUG (GST_CAT_STATES,"state pending %d\n", GST_STATE_PENDING (element));
/* if going down into NULL state, clear out buffers*/
if (GST_STATE_PENDING (element) == GST_STATE_READY) {