2000-12-28 22:12:02 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
|
|
|
* 2000 Wim Taymans <wtay@chello.be>
|
|
|
|
*
|
2002-12-11 21:33:07 +00:00
|
|
|
* gstinfo.h:
|
Changes made to the DEBUG system. New header file gstdebug.h holds the stuff to keep it out of gst.h's hair. DEBUG ...
Original commit message from CVS:
Changes made to the DEBUG system. New header file gstdebug.h holds the
stuff to keep it out of gst.h's hair. DEBUG prints out the process id,
cothread id, source filename and line number. Two new macros DEBUG_ENTER
and DEBUG_LEAVE are used to show the entry and exit of a given function.
This eventually might be used to construct call trace graphs, even taking
cothreads into account. This would be quite useful in visualizing the
scheduling mechanism.
Minor changes to various debug messages.
Also sitting in gstdebug.h is a prototypical DEBUG_ENTER that's capable of
performing DEBUG_LEAVE automatically. It does this by utilizing a
little-known GCC extension that allows one to call a function with the
same parameters as the current function. The macro uses this to basically
call itself. A boolean is used to ensure that when it calls itself it
actually runs the body of the function. In the meantime it prints stuff
out before and after the real function, as well as constructing a
debugging string. This can be used eventually to provide call-wide data
on the DEBUG lines, instead of having to replicate data on each call to
DEBUG. More research is needed into how this would most cleanly be fit
into some other chunk of code, like GStreamer (I think of this DEBUG trick
as a separate project, sorta).
Unfortunately, the aforementioned DEBUG trick interacts quite poorly with
cothreads. Almost any time it's used in a function that has anything
remotely to do with a cothread context (as in, it runs in one), a segfault
results from the __builtin_apply call, which is the heart of the whole
thing. If someone who really knows assembly could analyze the resulting
code to see what's really going on, we might find a way to fix either the
macro or the cothreads (I'm thinking that there's something we missed in
constructing the cothreads themselves) so this works in all cases.
In the meantime, please insert both DEBUG_ENTER and DEBUG_LEAVE in your
functions. Be sure to put DEBUG_ENTER after your variable declarations
and before any functional code, not to put the function name in any DEBUG
strings (it's already there, trust me), and put a DEBUG_LEAVE if you care
enough.
Changes are going to happen in the way DEBUGs and other printouts occur,
so stay tuned.
2000-12-04 09:35:08 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
2000-12-29 10:02:17 +00:00
|
|
|
#ifndef __GSTINFO_H__
|
|
|
|
#define __GSTINFO_H__
|
Changes made to the DEBUG system. New header file gstdebug.h holds the stuff to keep it out of gst.h's hair. DEBUG ...
Original commit message from CVS:
Changes made to the DEBUG system. New header file gstdebug.h holds the
stuff to keep it out of gst.h's hair. DEBUG prints out the process id,
cothread id, source filename and line number. Two new macros DEBUG_ENTER
and DEBUG_LEAVE are used to show the entry and exit of a given function.
This eventually might be used to construct call trace graphs, even taking
cothreads into account. This would be quite useful in visualizing the
scheduling mechanism.
Minor changes to various debug messages.
Also sitting in gstdebug.h is a prototypical DEBUG_ENTER that's capable of
performing DEBUG_LEAVE automatically. It does this by utilizing a
little-known GCC extension that allows one to call a function with the
same parameters as the current function. The macro uses this to basically
call itself. A boolean is used to ensure that when it calls itself it
actually runs the body of the function. In the meantime it prints stuff
out before and after the real function, as well as constructing a
debugging string. This can be used eventually to provide call-wide data
on the DEBUG lines, instead of having to replicate data on each call to
DEBUG. More research is needed into how this would most cleanly be fit
into some other chunk of code, like GStreamer (I think of this DEBUG trick
as a separate project, sorta).
Unfortunately, the aforementioned DEBUG trick interacts quite poorly with
cothreads. Almost any time it's used in a function that has anything
remotely to do with a cothread context (as in, it runs in one), a segfault
results from the __builtin_apply call, which is the heart of the whole
thing. If someone who really knows assembly could analyze the resulting
code to see what's really going on, we might find a way to fix either the
macro or the cothreads (I'm thinking that there's something we missed in
constructing the cothreads themselves) so this works in all cases.
In the meantime, please insert both DEBUG_ENTER and DEBUG_LEAVE in your
functions. Be sure to put DEBUG_ENTER after your variable declarations
and before any functional code, not to put the function name in any DEBUG
strings (it's already there, trust me), and put a DEBUG_LEAVE if you care
enough.
Changes are going to happen in the way DEBUGs and other printouts occur,
so stay tuned.
2000-12-04 09:35:08 +00:00
|
|
|
|
2000-12-17 04:54:57 +00:00
|
|
|
#include <stdio.h>
|
2000-12-29 10:02:17 +00:00
|
|
|
#include <gmodule.h>
|
|
|
|
#include <unistd.h>
|
2002-12-11 21:33:07 +00:00
|
|
|
#include <glib/gmacros.h>
|
2000-12-17 04:54:57 +00:00
|
|
|
|
Changes made to the DEBUG system. New header file gstdebug.h holds the stuff to keep it out of gst.h's hair. DEBUG ...
Original commit message from CVS:
Changes made to the DEBUG system. New header file gstdebug.h holds the
stuff to keep it out of gst.h's hair. DEBUG prints out the process id,
cothread id, source filename and line number. Two new macros DEBUG_ENTER
and DEBUG_LEAVE are used to show the entry and exit of a given function.
This eventually might be used to construct call trace graphs, even taking
cothreads into account. This would be quite useful in visualizing the
scheduling mechanism.
Minor changes to various debug messages.
Also sitting in gstdebug.h is a prototypical DEBUG_ENTER that's capable of
performing DEBUG_LEAVE automatically. It does this by utilizing a
little-known GCC extension that allows one to call a function with the
same parameters as the current function. The macro uses this to basically
call itself. A boolean is used to ensure that when it calls itself it
actually runs the body of the function. In the meantime it prints stuff
out before and after the real function, as well as constructing a
debugging string. This can be used eventually to provide call-wide data
on the DEBUG lines, instead of having to replicate data on each call to
DEBUG. More research is needed into how this would most cleanly be fit
into some other chunk of code, like GStreamer (I think of this DEBUG trick
as a separate project, sorta).
Unfortunately, the aforementioned DEBUG trick interacts quite poorly with
cothreads. Almost any time it's used in a function that has anything
remotely to do with a cothread context (as in, it runs in one), a segfault
results from the __builtin_apply call, which is the heart of the whole
thing. If someone who really knows assembly could analyze the resulting
code to see what's really going on, we might find a way to fix either the
macro or the cothreads (I'm thinking that there's something we missed in
constructing the cothreads themselves) so this works in all cases.
In the meantime, please insert both DEBUG_ENTER and DEBUG_LEAVE in your
functions. Be sure to put DEBUG_ENTER after your variable declarations
and before any functional code, not to put the function name in any DEBUG
strings (it's already there, trust me), and put a DEBUG_LEAVE if you care
enough.
Changes are going to happen in the way DEBUGs and other printouts occur,
so stay tuned.
2000-12-04 09:35:08 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include <config.h>
|
|
|
|
#endif
|
|
|
|
|
2002-12-11 21:33:07 +00:00
|
|
|
/* FIXME: convert to using G_STRLOC all the way if we can ! */
|
|
|
|
|
|
|
|
#ifndef FUNCTION
|
|
|
|
#ifdef G_GNUC_PRETTY_FUNCTION
|
|
|
|
#define FUNCTION G_GNUC_PRETTY_FUNCTION
|
|
|
|
#elif HAVE_FUNC
|
|
|
|
#define FUNCTION __func__
|
|
|
|
#elif HAVE_PRETTY_FUNCTION
|
|
|
|
#define FUNCTION __PRETTY_FUNCTION__
|
|
|
|
#elif HAVE_FUNCTION
|
|
|
|
#define FUNCTION __FUNCTION__
|
|
|
|
#else
|
|
|
|
#define FUNCTION ""
|
|
|
|
#endif
|
|
|
|
#endif /* ifndef FUNCTION */
|
|
|
|
|
2001-05-25 21:00:07 +00:00
|
|
|
/***** are we in the core or not? *****/
|
|
|
|
#ifdef __GST_PRIVATE_H__
|
|
|
|
#define _GST_DEBUG_INCORE TRUE
|
|
|
|
#else
|
|
|
|
#define _GST_DEBUG_INCORE FALSE
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2001-04-27 20:31:22 +00:00
|
|
|
/* colorization stuff */
|
|
|
|
#ifdef GST_DEBUG_COLOR
|
|
|
|
#ifdef __GST_PRIVATE_H__ /* FIXME this should be some libgst.la -specific thing */
|
|
|
|
#define GST_DEBUG_CHAR_MODE "00"
|
|
|
|
#else
|
|
|
|
#define GST_DEBUG_CHAR_MODE "01"
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
gint _gst_debug_stringhash_color(gchar *file);
|
|
|
|
|
|
|
|
|
|
|
|
|
2001-05-25 21:00:07 +00:00
|
|
|
/**********************************************************************
|
|
|
|
* Categories
|
|
|
|
**********************************************************************/
|
|
|
|
|
|
|
|
const gchar * gst_get_category_name (gint category);
|
|
|
|
|
|
|
|
enum {
|
2001-12-15 18:15:13 +00:00
|
|
|
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 */
|
2002-04-11 20:35:18 +00:00
|
|
|
GST_CAT_ELEMENT_FACTORY, /* Elementfactory stuff */
|
2003-01-09 22:59:37 +00:00
|
|
|
GST_CAT_PADS, /* Pad creation/linking */
|
2001-12-15 18:15:13 +00:00
|
|
|
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_REFCOUNTING, /* Ref Counting stuff */
|
|
|
|
GST_CAT_EVENT, /* Event system */
|
|
|
|
GST_CAT_PARAMS, /* Dynamic parameters */
|
|
|
|
|
|
|
|
GST_CAT_CALL_TRACE = 30, /* Call tracing */
|
2001-09-10 19:46:01 +00:00
|
|
|
|
2001-05-25 21:00:07 +00:00
|
|
|
GST_CAT_MAX_CATEGORY = 31
|
|
|
|
};
|
|
|
|
|
|
|
|
extern const gchar *_gst_category_colors[32];
|
|
|
|
|
2002-12-11 22:22:35 +00:00
|
|
|
extern GStaticPrivate _gst_debug_cothread_index;
|
2001-05-25 21:00:07 +00:00
|
|
|
|
2001-04-27 20:31:22 +00:00
|
|
|
|
2000-12-29 10:02:17 +00:00
|
|
|
/**********************************************************************
|
|
|
|
* DEBUG system
|
|
|
|
**********************************************************************/
|
Changes made to the DEBUG system. New header file gstdebug.h holds the stuff to keep it out of gst.h's hair. DEBUG ...
Original commit message from CVS:
Changes made to the DEBUG system. New header file gstdebug.h holds the
stuff to keep it out of gst.h's hair. DEBUG prints out the process id,
cothread id, source filename and line number. Two new macros DEBUG_ENTER
and DEBUG_LEAVE are used to show the entry and exit of a given function.
This eventually might be used to construct call trace graphs, even taking
cothreads into account. This would be quite useful in visualizing the
scheduling mechanism.
Minor changes to various debug messages.
Also sitting in gstdebug.h is a prototypical DEBUG_ENTER that's capable of
performing DEBUG_LEAVE automatically. It does this by utilizing a
little-known GCC extension that allows one to call a function with the
same parameters as the current function. The macro uses this to basically
call itself. A boolean is used to ensure that when it calls itself it
actually runs the body of the function. In the meantime it prints stuff
out before and after the real function, as well as constructing a
debugging string. This can be used eventually to provide call-wide data
on the DEBUG lines, instead of having to replicate data on each call to
DEBUG. More research is needed into how this would most cleanly be fit
into some other chunk of code, like GStreamer (I think of this DEBUG trick
as a separate project, sorta).
Unfortunately, the aforementioned DEBUG trick interacts quite poorly with
cothreads. Almost any time it's used in a function that has anything
remotely to do with a cothread context (as in, it runs in one), a segfault
results from the __builtin_apply call, which is the heart of the whole
thing. If someone who really knows assembly could analyze the resulting
code to see what's really going on, we might find a way to fix either the
macro or the cothreads (I'm thinking that there's something we missed in
constructing the cothreads themselves) so this works in all cases.
In the meantime, please insert both DEBUG_ENTER and DEBUG_LEAVE in your
functions. Be sure to put DEBUG_ENTER after your variable declarations
and before any functional code, not to put the function name in any DEBUG
strings (it's already there, trust me), and put a DEBUG_LEAVE if you care
enough.
Changes are going to happen in the way DEBUGs and other printouts occur,
so stay tuned.
2000-12-04 09:35:08 +00:00
|
|
|
|
|
|
|
/* for include files that make too much noise normally */
|
|
|
|
#ifdef GST_DEBUG_FORCE_DISABLE
|
|
|
|
#undef GST_DEBUG_ENABLED
|
|
|
|
#endif
|
|
|
|
/* for applications that really really want all the noise */
|
|
|
|
#ifdef GST_DEBUG_FORCE_ENABLE
|
|
|
|
#define GST_DEBUG_ENABLED
|
|
|
|
#endif
|
|
|
|
|
2001-12-15 18:15:13 +00:00
|
|
|
/*#ifdef GST_DEBUG_ENABLED */
|
2001-01-01 05:18:07 +00:00
|
|
|
#define GST_DEBUG_ENABLE_CATEGORIES 0xffffffff
|
2001-12-15 18:15:13 +00:00
|
|
|
/*#else */
|
|
|
|
/*#define GST_DEBUG_ENABLE_CATEGORIES 0x00000000 */
|
|
|
|
/*#endif */
|
2001-01-01 03:14:40 +00:00
|
|
|
|
Changes made to the DEBUG system. New header file gstdebug.h holds the stuff to keep it out of gst.h's hair. DEBUG ...
Original commit message from CVS:
Changes made to the DEBUG system. New header file gstdebug.h holds the
stuff to keep it out of gst.h's hair. DEBUG prints out the process id,
cothread id, source filename and line number. Two new macros DEBUG_ENTER
and DEBUG_LEAVE are used to show the entry and exit of a given function.
This eventually might be used to construct call trace graphs, even taking
cothreads into account. This would be quite useful in visualizing the
scheduling mechanism.
Minor changes to various debug messages.
Also sitting in gstdebug.h is a prototypical DEBUG_ENTER that's capable of
performing DEBUG_LEAVE automatically. It does this by utilizing a
little-known GCC extension that allows one to call a function with the
same parameters as the current function. The macro uses this to basically
call itself. A boolean is used to ensure that when it calls itself it
actually runs the body of the function. In the meantime it prints stuff
out before and after the real function, as well as constructing a
debugging string. This can be used eventually to provide call-wide data
on the DEBUG lines, instead of having to replicate data on each call to
DEBUG. More research is needed into how this would most cleanly be fit
into some other chunk of code, like GStreamer (I think of this DEBUG trick
as a separate project, sorta).
Unfortunately, the aforementioned DEBUG trick interacts quite poorly with
cothreads. Almost any time it's used in a function that has anything
remotely to do with a cothread context (as in, it runs in one), a segfault
results from the __builtin_apply call, which is the heart of the whole
thing. If someone who really knows assembly could analyze the resulting
code to see what's really going on, we might find a way to fix either the
macro or the cothreads (I'm thinking that there's something we missed in
constructing the cothreads themselves) so this works in all cases.
In the meantime, please insert both DEBUG_ENTER and DEBUG_LEAVE in your
functions. Be sure to put DEBUG_ENTER after your variable declarations
and before any functional code, not to put the function name in any DEBUG
strings (it's already there, trust me), and put a DEBUG_LEAVE if you care
enough.
Changes are going to happen in the way DEBUGs and other printouts occur,
so stay tuned.
2000-12-04 09:35:08 +00:00
|
|
|
|
2001-06-25 20:09:10 +00:00
|
|
|
typedef void (*GstDebugHandler) (gint category,gboolean core,
|
|
|
|
const gchar *file,const gchar *function,
|
|
|
|
gint line,const gchar *debug_string,
|
2001-05-25 21:00:07 +00:00
|
|
|
void *element,gchar *string);
|
2001-04-27 20:31:22 +00:00
|
|
|
|
2001-06-25 20:09:10 +00:00
|
|
|
void gst_default_debug_handler (gint category,gboolean incore,
|
|
|
|
const gchar *file, const gchar *function,
|
|
|
|
gint line,const gchar *debug_string,
|
2001-05-25 21:00:07 +00:00
|
|
|
void *element,gchar *string);
|
Changes made to the DEBUG system. New header file gstdebug.h holds the stuff to keep it out of gst.h's hair. DEBUG ...
Original commit message from CVS:
Changes made to the DEBUG system. New header file gstdebug.h holds the
stuff to keep it out of gst.h's hair. DEBUG prints out the process id,
cothread id, source filename and line number. Two new macros DEBUG_ENTER
and DEBUG_LEAVE are used to show the entry and exit of a given function.
This eventually might be used to construct call trace graphs, even taking
cothreads into account. This would be quite useful in visualizing the
scheduling mechanism.
Minor changes to various debug messages.
Also sitting in gstdebug.h is a prototypical DEBUG_ENTER that's capable of
performing DEBUG_LEAVE automatically. It does this by utilizing a
little-known GCC extension that allows one to call a function with the
same parameters as the current function. The macro uses this to basically
call itself. A boolean is used to ensure that when it calls itself it
actually runs the body of the function. In the meantime it prints stuff
out before and after the real function, as well as constructing a
debugging string. This can be used eventually to provide call-wide data
on the DEBUG lines, instead of having to replicate data on each call to
DEBUG. More research is needed into how this would most cleanly be fit
into some other chunk of code, like GStreamer (I think of this DEBUG trick
as a separate project, sorta).
Unfortunately, the aforementioned DEBUG trick interacts quite poorly with
cothreads. Almost any time it's used in a function that has anything
remotely to do with a cothread context (as in, it runs in one), a segfault
results from the __builtin_apply call, which is the heart of the whole
thing. If someone who really knows assembly could analyze the resulting
code to see what's really going on, we might find a way to fix either the
macro or the cothreads (I'm thinking that there's something we missed in
constructing the cothreads themselves) so this works in all cases.
In the meantime, please insert both DEBUG_ENTER and DEBUG_LEAVE in your
functions. Be sure to put DEBUG_ENTER after your variable declarations
and before any functional code, not to put the function name in any DEBUG
strings (it's already there, trust me), and put a DEBUG_LEAVE if you care
enough.
Changes are going to happen in the way DEBUGs and other printouts occur,
so stay tuned.
2000-12-04 09:35:08 +00:00
|
|
|
|
2001-05-25 21:00:07 +00:00
|
|
|
extern guint32 _gst_debug_categories;
|
|
|
|
extern GstDebugHandler _gst_debug_handler;
|
2001-01-01 03:14:40 +00:00
|
|
|
|
2001-05-25 21:00:07 +00:00
|
|
|
/* fallback, this should probably be a 'weak' symbol or something */
|
|
|
|
G_GNUC_UNUSED static gchar *_debug_string = NULL;
|
2001-01-01 03:14:40 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2002-11-29 17:05:13 +00:00
|
|
|
#ifdef G_HAVE_ISO_VARARGS
|
|
|
|
|
|
|
|
#ifdef GST_DEBUG_ENABLED
|
|
|
|
#define GST_DEBUG(cat, ...) G_STMT_START{ \
|
|
|
|
if ((1<<cat) & _gst_debug_categories) \
|
2002-12-11 21:33:07 +00:00
|
|
|
_gst_debug_handler(cat,_GST_DEBUG_INCORE,__FILE__,FUNCTION,__LINE__,_debug_string, \
|
2002-11-29 17:05:13 +00:00
|
|
|
NULL,g_strdup_printf( __VA_ARGS__ )); \
|
|
|
|
}G_STMT_END
|
|
|
|
|
|
|
|
#define GST_DEBUG_ELEMENT(cat, element, ...) G_STMT_START{ \
|
|
|
|
if ((1<<cat) & _gst_debug_categories) \
|
2002-12-11 21:33:07 +00:00
|
|
|
_gst_debug_handler(cat,_GST_DEBUG_INCORE,__FILE__,FUNCTION,__LINE__,_debug_string, \
|
2002-11-29 17:05:13 +00:00
|
|
|
element,g_strdup_printf( __VA_ARGS__ )); \
|
|
|
|
}G_STMT_END
|
|
|
|
|
|
|
|
#else
|
|
|
|
#define GST_DEBUG(cat, ...)
|
|
|
|
#define GST_DEBUG_ELEMENT(cat,element, ...)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#elif defined(G_HAVE_GNUC_VARARGS)
|
2001-01-01 03:14:40 +00:00
|
|
|
|
2001-05-25 21:00:07 +00:00
|
|
|
#ifdef GST_DEBUG_ENABLED
|
|
|
|
#define GST_DEBUG(cat,format,args...) G_STMT_START{ \
|
|
|
|
if ((1<<cat) & _gst_debug_categories) \
|
2002-12-11 21:33:07 +00:00
|
|
|
_gst_debug_handler(cat,_GST_DEBUG_INCORE,__FILE__,FUNCTION,__LINE__,_debug_string, \
|
2001-05-25 21:00:07 +00:00
|
|
|
NULL,g_strdup_printf( format , ## args )); \
|
2001-01-01 03:14:40 +00:00
|
|
|
}G_STMT_END
|
|
|
|
|
2001-05-25 21:00:07 +00:00
|
|
|
#define GST_DEBUG_ELEMENT(cat,element,format,args...) G_STMT_START{ \
|
|
|
|
if ((1<<cat) & _gst_debug_categories) \
|
2002-12-11 21:33:07 +00:00
|
|
|
_gst_debug_handler(cat,_GST_DEBUG_INCORE,__FILE__,FUNCTION,__LINE__,_debug_string, \
|
2001-05-25 21:00:07 +00:00
|
|
|
element,g_strdup_printf( format , ## args )); \
|
|
|
|
}G_STMT_END
|
2001-01-01 03:14:40 +00:00
|
|
|
|
Changes made to the DEBUG system. New header file gstdebug.h holds the stuff to keep it out of gst.h's hair. DEBUG ...
Original commit message from CVS:
Changes made to the DEBUG system. New header file gstdebug.h holds the
stuff to keep it out of gst.h's hair. DEBUG prints out the process id,
cothread id, source filename and line number. Two new macros DEBUG_ENTER
and DEBUG_LEAVE are used to show the entry and exit of a given function.
This eventually might be used to construct call trace graphs, even taking
cothreads into account. This would be quite useful in visualizing the
scheduling mechanism.
Minor changes to various debug messages.
Also sitting in gstdebug.h is a prototypical DEBUG_ENTER that's capable of
performing DEBUG_LEAVE automatically. It does this by utilizing a
little-known GCC extension that allows one to call a function with the
same parameters as the current function. The macro uses this to basically
call itself. A boolean is used to ensure that when it calls itself it
actually runs the body of the function. In the meantime it prints stuff
out before and after the real function, as well as constructing a
debugging string. This can be used eventually to provide call-wide data
on the DEBUG lines, instead of having to replicate data on each call to
DEBUG. More research is needed into how this would most cleanly be fit
into some other chunk of code, like GStreamer (I think of this DEBUG trick
as a separate project, sorta).
Unfortunately, the aforementioned DEBUG trick interacts quite poorly with
cothreads. Almost any time it's used in a function that has anything
remotely to do with a cothread context (as in, it runs in one), a segfault
results from the __builtin_apply call, which is the heart of the whole
thing. If someone who really knows assembly could analyze the resulting
code to see what's really going on, we might find a way to fix either the
macro or the cothreads (I'm thinking that there's something we missed in
constructing the cothreads themselves) so this works in all cases.
In the meantime, please insert both DEBUG_ENTER and DEBUG_LEAVE in your
functions. Be sure to put DEBUG_ENTER after your variable declarations
and before any functional code, not to put the function name in any DEBUG
strings (it's already there, trust me), and put a DEBUG_LEAVE if you care
enough.
Changes are going to happen in the way DEBUGs and other printouts occur,
so stay tuned.
2000-12-04 09:35:08 +00:00
|
|
|
#else
|
2001-05-25 21:00:07 +00:00
|
|
|
#define GST_DEBUG(cat,format,args...)
|
|
|
|
#define GST_DEBUG_ELEMENT(cat,element,format,args...)
|
Changes made to the DEBUG system. New header file gstdebug.h holds the stuff to keep it out of gst.h's hair. DEBUG ...
Original commit message from CVS:
Changes made to the DEBUG system. New header file gstdebug.h holds the
stuff to keep it out of gst.h's hair. DEBUG prints out the process id,
cothread id, source filename and line number. Two new macros DEBUG_ENTER
and DEBUG_LEAVE are used to show the entry and exit of a given function.
This eventually might be used to construct call trace graphs, even taking
cothreads into account. This would be quite useful in visualizing the
scheduling mechanism.
Minor changes to various debug messages.
Also sitting in gstdebug.h is a prototypical DEBUG_ENTER that's capable of
performing DEBUG_LEAVE automatically. It does this by utilizing a
little-known GCC extension that allows one to call a function with the
same parameters as the current function. The macro uses this to basically
call itself. A boolean is used to ensure that when it calls itself it
actually runs the body of the function. In the meantime it prints stuff
out before and after the real function, as well as constructing a
debugging string. This can be used eventually to provide call-wide data
on the DEBUG lines, instead of having to replicate data on each call to
DEBUG. More research is needed into how this would most cleanly be fit
into some other chunk of code, like GStreamer (I think of this DEBUG trick
as a separate project, sorta).
Unfortunately, the aforementioned DEBUG trick interacts quite poorly with
cothreads. Almost any time it's used in a function that has anything
remotely to do with a cothread context (as in, it runs in one), a segfault
results from the __builtin_apply call, which is the heart of the whole
thing. If someone who really knows assembly could analyze the resulting
code to see what's really going on, we might find a way to fix either the
macro or the cothreads (I'm thinking that there's something we missed in
constructing the cothreads themselves) so this works in all cases.
In the meantime, please insert both DEBUG_ENTER and DEBUG_LEAVE in your
functions. Be sure to put DEBUG_ENTER after your variable declarations
and before any functional code, not to put the function name in any DEBUG
strings (it's already there, trust me), and put a DEBUG_LEAVE if you care
enough.
Changes are going to happen in the way DEBUGs and other printouts occur,
so stay tuned.
2000-12-04 09:35:08 +00:00
|
|
|
#endif
|
|
|
|
|
2002-11-29 17:05:13 +00:00
|
|
|
#endif
|
|
|
|
|
Another big set of changes. Connections are now also pullfunc based. gstqueue has been updated, I don't know of any ...
Original commit message from CVS:
Another big set of changes. Connections are now also pullfunc based.
gstqueue has been updated, I don't know of any other connections offhand.
There are still a few things that need doing, specifically the concept
of a source or connection with connections to multiple thread contexts is
not dealt with. This may force us to move the threadstate from the
element to the pad, maybe keeping the element's copy for simple cases.
Then the Bin would create a structure to pass to the cothreaded _wrappers
of any such elements, which would detail the pads that are to be dealt with
by this particular cothread context.
That will speed things up to, since we don't have to look through the list
of all pads for every Src or Connection element for every iteration, we can
simply step through the list provided by the plan. Special case might even
have a single pad pointer sitting there to trump the list, if there's only
one (the common case anyway).
Task 23098 is tracking these changes. The main task 22588 depends on that
subtask, as well as 22240, which is a consistency check on PAD_DISABLED.
2000-12-08 10:33:01 +00:00
|
|
|
|
|
|
|
|
2001-05-25 21:00:07 +00:00
|
|
|
|
Another big set of changes. Connections are now also pullfunc based. gstqueue has been updated, I don't know of any ...
Original commit message from CVS:
Another big set of changes. Connections are now also pullfunc based.
gstqueue has been updated, I don't know of any other connections offhand.
There are still a few things that need doing, specifically the concept
of a source or connection with connections to multiple thread contexts is
not dealt with. This may force us to move the threadstate from the
element to the pad, maybe keeping the element's copy for simple cases.
Then the Bin would create a structure to pass to the cothreaded _wrappers
of any such elements, which would detail the pads that are to be dealt with
by this particular cothread context.
That will speed things up to, since we don't have to look through the list
of all pads for every Src or Connection element for every iteration, we can
simply step through the list provided by the plan. Special case might even
have a single pad pointer sitting there to trump the list, if there's only
one (the common case anyway).
Task 23098 is tracking these changes. The main task 22588 depends on that
subtask, as well as 22240, which is a consistency check on PAD_DISABLED.
2000-12-08 10:33:01 +00:00
|
|
|
/********** some convenience macros for debugging **********/
|
|
|
|
#define GST_DEBUG_PAD_NAME(pad) \
|
2001-01-29 00:06:02 +00:00
|
|
|
(GST_OBJECT_PARENT(pad) != NULL) ? \
|
|
|
|
GST_OBJECT_NAME (GST_OBJECT_PARENT(pad)) : \
|
|
|
|
"''", GST_OBJECT_NAME (pad)
|
Another big set of changes. Connections are now also pullfunc based. gstqueue has been updated, I don't know of any ...
Original commit message from CVS:
Another big set of changes. Connections are now also pullfunc based.
gstqueue has been updated, I don't know of any other connections offhand.
There are still a few things that need doing, specifically the concept
of a source or connection with connections to multiple thread contexts is
not dealt with. This may force us to move the threadstate from the
element to the pad, maybe keeping the element's copy for simple cases.
Then the Bin would create a structure to pass to the cothreaded _wrappers
of any such elements, which would detail the pads that are to be dealt with
by this particular cothread context.
That will speed things up to, since we don't have to look through the list
of all pads for every Src or Connection element for every iteration, we can
simply step through the list provided by the plan. Special case might even
have a single pad pointer sitting there to trump the list, if there's only
one (the common case anyway).
Task 23098 is tracking these changes. The main task 22588 depends on that
subtask, as well as 22240, which is a consistency check on PAD_DISABLED.
2000-12-08 10:33:01 +00:00
|
|
|
|
2002-11-29 17:05:13 +00:00
|
|
|
#ifdef G_HAVE_ISO_VARARGS
|
|
|
|
|
|
|
|
#ifdef GST_DEBUG_COLOR
|
2003-01-15 21:42:30 +00:00
|
|
|
#define GST_DEBUG_ENTER(...) GST_DEBUG( 31 , "\033[00;37mentering\033[00m: " __VA_ARGS__ )
|
|
|
|
#define GST_DEBUG_LEAVE(...) GST_DEBUG( 31 , "\033[00;37mleaving\033[00m: " __VA_ARGS__ )
|
2002-11-29 17:05:13 +00:00
|
|
|
#else
|
2003-01-15 21:42:30 +00:00
|
|
|
#define GST_DEBUG_ENTER(...) GST_DEBUG( 31 , "entering: " __VA_ARGS__ )
|
|
|
|
#define GST_DEBUG_LEAVE(...) GST_DEBUG( 31 , "leaving: " __VA_ARGS__ )
|
2002-11-29 17:05:13 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#elif defined(G_HAVE_GNUC_VARARGS)
|
|
|
|
|
2001-05-25 21:00:07 +00:00
|
|
|
#ifdef GST_DEBUG_COLOR
|
2002-03-24 22:07:09 +00:00
|
|
|
#define GST_DEBUG_ENTER(format, args...) GST_DEBUG( 31 , format ": \033[00;37mentering\033[00m" , ##args )
|
|
|
|
#define GST_DEBUG_LEAVE(format, args...) GST_DEBUG( 31 , format ": \033[00;37mleaving\033[00m" , ##args )
|
2001-05-25 21:00:07 +00:00
|
|
|
#else
|
2002-03-24 22:07:09 +00:00
|
|
|
#define GST_DEBUG_ENTER(format, args...) GST_DEBUG( 31 , format ": entering" , ##args )
|
|
|
|
#define GST_DEBUG_LEAVE(format, args...) GST_DEBUG( 31 , format ": leaving" , ##args )
|
2001-05-25 21:00:07 +00:00
|
|
|
#endif
|
WARNING: Don't grab this updated unless you're really, REALLY sure.
Original commit message from CVS:
WARNING: Don't grab this updated unless you're really, REALLY sure.
WARNING: Wait for the next one.
Whole lotta changes here, including a few random bits:
examples/*/Makefile: updated to use `libtool gcc`, not just `gcc`
gst/
gstbuffer.h: updated to new flag style
gst.c, gstdebug.h: added new debugging for function ptrs
gstpipeline.c: set type of parent_class to the class, not the object
gstthread.c: ditto
plugins/
cdparanoia/cdparanoia.c: added an argument type, updated some defaults
cobin/spindentity.c: updated to new do/while loopfunction style
mp3encode/lame/gstlame.c: argument types, whole lotta lame options
tests/: various changes
Now, for the big changes: Once again, the scheduling system has changed.
And once again, it broke a whole bunch of things. The gist of the change
is that there is now a function pointer for gst_pad_push and gst_pad_pull,
instead of a hard-wired function. Well, currently they are functions, but
that's for debugging purposes only, they just call the function pointer
after spewing lots of DEBUG().
This changed the GstPad structure a bit, and the GstPad API as well.
Where elements used to provide chain() and pull() functions, they provide
chain() and get() functions. gst_pad_set_pull[region]_function has been
changed to get_pad_set_get[region]_function. This means all the elements
out there that used to have pull functions need to be updated. The calls
to that function have been changed in the normal elements, but the names
of the functions passed is still _pull[region](), which is an aesthetic
issue more than anything.
As for what doesn't work yet, just about anything dealing with Connections
is hosed, meaning threaded stuff won't work. This will be fixed about 12
hours from now, after I've slept, etc. The simplefake.c test works in
both cothreaded and chained cases, but not much else will work due to the
Connection problem. Needless to say, don't grab this unless you *need*
these features *now*, else wait to update this stuff until tomorrow.
I'm going to sleep now.
2000-12-16 10:18:09 +00:00
|
|
|
|
2002-11-29 17:05:13 +00:00
|
|
|
#endif
|
|
|
|
|
WARNING: Don't grab this updated unless you're really, REALLY sure.
Original commit message from CVS:
WARNING: Don't grab this updated unless you're really, REALLY sure.
WARNING: Wait for the next one.
Whole lotta changes here, including a few random bits:
examples/*/Makefile: updated to use `libtool gcc`, not just `gcc`
gst/
gstbuffer.h: updated to new flag style
gst.c, gstdebug.h: added new debugging for function ptrs
gstpipeline.c: set type of parent_class to the class, not the object
gstthread.c: ditto
plugins/
cdparanoia/cdparanoia.c: added an argument type, updated some defaults
cobin/spindentity.c: updated to new do/while loopfunction style
mp3encode/lame/gstlame.c: argument types, whole lotta lame options
tests/: various changes
Now, for the big changes: Once again, the scheduling system has changed.
And once again, it broke a whole bunch of things. The gist of the change
is that there is now a function pointer for gst_pad_push and gst_pad_pull,
instead of a hard-wired function. Well, currently they are functions, but
that's for debugging purposes only, they just call the function pointer
after spewing lots of DEBUG().
This changed the GstPad structure a bit, and the GstPad API as well.
Where elements used to provide chain() and pull() functions, they provide
chain() and get() functions. gst_pad_set_pull[region]_function has been
changed to get_pad_set_get[region]_function. This means all the elements
out there that used to have pull functions need to be updated. The calls
to that function have been changed in the normal elements, but the names
of the functions passed is still _pull[region](), which is an aesthetic
issue more than anything.
As for what doesn't work yet, just about anything dealing with Connections
is hosed, meaning threaded stuff won't work. This will be fixed about 12
hours from now, after I've slept, etc. The simplefake.c test works in
both cothreaded and chained cases, but not much else will work due to the
Connection problem. Needless to say, don't grab this unless you *need*
these features *now*, else wait to update this stuff until tomorrow.
I'm going to sleep now.
2000-12-16 10:18:09 +00:00
|
|
|
|
2001-05-25 21:00:07 +00:00
|
|
|
/***** Colorized debug for thread ids *****/
|
|
|
|
#ifdef GST_DEBUG_COLOR
|
|
|
|
#define GST_DEBUG_THREAD_FORMAT "\033[00;%dm%d\033[00m"
|
|
|
|
#define GST_DEBUG_THREAD_ARGS(id) ( ((id) < 0) ? 37 : ((id) % 6 + 31) ), (id)
|
WARNING: Don't grab this updated unless you're really, REALLY sure.
Original commit message from CVS:
WARNING: Don't grab this updated unless you're really, REALLY sure.
WARNING: Wait for the next one.
Whole lotta changes here, including a few random bits:
examples/*/Makefile: updated to use `libtool gcc`, not just `gcc`
gst/
gstbuffer.h: updated to new flag style
gst.c, gstdebug.h: added new debugging for function ptrs
gstpipeline.c: set type of parent_class to the class, not the object
gstthread.c: ditto
plugins/
cdparanoia/cdparanoia.c: added an argument type, updated some defaults
cobin/spindentity.c: updated to new do/while loopfunction style
mp3encode/lame/gstlame.c: argument types, whole lotta lame options
tests/: various changes
Now, for the big changes: Once again, the scheduling system has changed.
And once again, it broke a whole bunch of things. The gist of the change
is that there is now a function pointer for gst_pad_push and gst_pad_pull,
instead of a hard-wired function. Well, currently they are functions, but
that's for debugging purposes only, they just call the function pointer
after spewing lots of DEBUG().
This changed the GstPad structure a bit, and the GstPad API as well.
Where elements used to provide chain() and pull() functions, they provide
chain() and get() functions. gst_pad_set_pull[region]_function has been
changed to get_pad_set_get[region]_function. This means all the elements
out there that used to have pull functions need to be updated. The calls
to that function have been changed in the normal elements, but the names
of the functions passed is still _pull[region](), which is an aesthetic
issue more than anything.
As for what doesn't work yet, just about anything dealing with Connections
is hosed, meaning threaded stuff won't work. This will be fixed about 12
hours from now, after I've slept, etc. The simplefake.c test works in
both cothreaded and chained cases, but not much else will work due to the
Connection problem. Needless to say, don't grab this unless you *need*
these features *now*, else wait to update this stuff until tomorrow.
I'm going to sleep now.
2000-12-16 10:18:09 +00:00
|
|
|
#else
|
2001-05-25 21:00:07 +00:00
|
|
|
#define GST_DEBUG_THREAD_FORMAT "%d"
|
|
|
|
#define GST_DEBUG_THREAD_ARGS(id) (id)
|
WARNING: Don't grab this updated unless you're really, REALLY sure.
Original commit message from CVS:
WARNING: Don't grab this updated unless you're really, REALLY sure.
WARNING: Wait for the next one.
Whole lotta changes here, including a few random bits:
examples/*/Makefile: updated to use `libtool gcc`, not just `gcc`
gst/
gstbuffer.h: updated to new flag style
gst.c, gstdebug.h: added new debugging for function ptrs
gstpipeline.c: set type of parent_class to the class, not the object
gstthread.c: ditto
plugins/
cdparanoia/cdparanoia.c: added an argument type, updated some defaults
cobin/spindentity.c: updated to new do/while loopfunction style
mp3encode/lame/gstlame.c: argument types, whole lotta lame options
tests/: various changes
Now, for the big changes: Once again, the scheduling system has changed.
And once again, it broke a whole bunch of things. The gist of the change
is that there is now a function pointer for gst_pad_push and gst_pad_pull,
instead of a hard-wired function. Well, currently they are functions, but
that's for debugging purposes only, they just call the function pointer
after spewing lots of DEBUG().
This changed the GstPad structure a bit, and the GstPad API as well.
Where elements used to provide chain() and pull() functions, they provide
chain() and get() functions. gst_pad_set_pull[region]_function has been
changed to get_pad_set_get[region]_function. This means all the elements
out there that used to have pull functions need to be updated. The calls
to that function have been changed in the normal elements, but the names
of the functions passed is still _pull[region](), which is an aesthetic
issue more than anything.
As for what doesn't work yet, just about anything dealing with Connections
is hosed, meaning threaded stuff won't work. This will be fixed about 12
hours from now, after I've slept, etc. The simplefake.c test works in
both cothreaded and chained cases, but not much else will work due to the
Connection problem. Needless to say, don't grab this unless you *need*
these features *now*, else wait to update this stuff until tomorrow.
I'm going to sleep now.
2000-12-16 10:18:09 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2000-12-29 10:02:17 +00:00
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* The following is a DEBUG_ENTER implementation that will wrap the
|
|
|
|
* function it sits at the head of. It removes the need for a
|
|
|
|
* DEBUG_LEAVE call. However, it segfaults whenever it gets anywhere
|
|
|
|
* near cothreads. We will not use it for the moment.
|
|
|
|
*
|
|
|
|
typedef void (*_debug_function_f)();
|
|
|
|
G_GNUC_UNUSED static gchar *_debug_string_pointer = NULL;
|
|
|
|
G_GNUC_UNUSED static GModule *_debug_self_module = NULL;
|
|
|
|
|
2002-11-29 17:05:13 +00:00
|
|
|
#ifdef G_HAVE_ISO_VARARGS
|
|
|
|
|
|
|
|
#define _DEBUG_ENTER_BUILTIN(...) \
|
|
|
|
static int _debug_in_wrapper = 0; \
|
|
|
|
gchar *_debug_string = ({ \
|
|
|
|
if (!_debug_in_wrapper) { \
|
|
|
|
void *_return_value; \
|
|
|
|
gchar *_debug_string; \
|
|
|
|
_debug_function_f function; \
|
|
|
|
void *_function_args = __builtin_apply_args(); \
|
|
|
|
_debug_in_wrapper = 1; \
|
|
|
|
_debug_string = g_strdup_printf(GST_DEBUG_PREFIX("")); \
|
|
|
|
_debug_string_pointer = _debug_string; \
|
|
|
|
fprintf(stderr,"%s: entered " FUNCTION, _debug_string); \
|
|
|
|
fprintf(stderr, __VA_ARGS__ ); \
|
|
|
|
fprintf(stderr,"\n"); \
|
|
|
|
if (_debug_self_module == NULL) _debug_self_module = g_module_open(NULL,0); \
|
|
|
|
g_module_symbol(_debug_self_module,FUNCTION,(gpointer *)&function); \
|
|
|
|
_return_value = __builtin_apply(function,_function_args,64); \
|
|
|
|
fprintf(stderr,"%s: left " FUNCTION, _debug_string); \
|
|
|
|
fprintf(stderr, __VA_ARGS__); \
|
|
|
|
fprintf(stderr,"\n"); \
|
|
|
|
g_free(_debug_string); \
|
|
|
|
__builtin_return(_return_value); \
|
|
|
|
} else { \
|
|
|
|
_debug_in_wrapper = 0; \
|
|
|
|
} \
|
|
|
|
_debug_string_pointer; \
|
|
|
|
});
|
|
|
|
|
|
|
|
#elif defined(G_HAVE_GNUC_VARARGS)
|
|
|
|
|
2000-12-29 10:02:17 +00:00
|
|
|
#define _DEBUG_ENTER_BUILTIN(format,args...) \
|
|
|
|
static int _debug_in_wrapper = 0; \
|
|
|
|
gchar *_debug_string = ({ \
|
|
|
|
if (!_debug_in_wrapper) { \
|
|
|
|
void *_return_value; \
|
|
|
|
gchar *_debug_string; \
|
|
|
|
_debug_function_f function; \
|
|
|
|
void *_function_args = __builtin_apply_args(); \
|
|
|
|
_debug_in_wrapper = 1; \
|
|
|
|
_debug_string = g_strdup_printf(GST_DEBUG_PREFIX("")); \
|
|
|
|
_debug_string_pointer = _debug_string; \
|
2002-11-29 17:05:13 +00:00
|
|
|
fprintf(stderr,"%s: entered " FUNCTION format "\n" , _debug_string , ## args ); \
|
2000-12-29 10:02:17 +00:00
|
|
|
if (_debug_self_module == NULL) _debug_self_module = g_module_open(NULL,0); \
|
2002-11-29 17:05:13 +00:00
|
|
|
g_module_symbol(_debug_self_module,FUNCTION,(gpointer *)&function); \
|
2000-12-29 10:02:17 +00:00
|
|
|
_return_value = __builtin_apply(function,_function_args,64); \
|
2002-11-29 17:05:13 +00:00
|
|
|
fprintf(stderr,"%s: left " FUNCTION format "\n" , _debug_string , ## args ); \
|
2000-12-29 10:02:17 +00:00
|
|
|
g_free(_debug_string); \
|
|
|
|
__builtin_return(_return_value); \
|
|
|
|
} else { \
|
|
|
|
_debug_in_wrapper = 0; \
|
|
|
|
} \
|
|
|
|
_debug_string_pointer; \
|
|
|
|
});
|
|
|
|
|
2002-11-29 17:05:13 +00:00
|
|
|
#endif
|
|
|
|
|
2000-12-29 10:02:17 +00:00
|
|
|
* WARNING: there's a gcc CPP bug lurking in here. The extra space before the ##args *
|
|
|
|
* somehow make the preprocessor leave the _debug_string. If it's removed, the *
|
|
|
|
* _debug_string somehow gets stripped along with the ##args, and that's all she wrote. *
|
2002-11-29 17:05:13 +00:00
|
|
|
|
|
|
|
#ifdef G_HAVE_ISO_VARARGS
|
|
|
|
|
|
|
|
#define _DEBUG_BUILTIN(...) \
|
|
|
|
if (_debug_string != (void *)-1) { \
|
|
|
|
if (_debug_string) { \
|
|
|
|
fprintf(stderr, "%s: " _debug_string); \
|
|
|
|
fprintf(stderr, __VA_ARGS__); \
|
|
|
|
} else { \
|
|
|
|
fprintf(stderr,GST_DEBUG_PREFIX(": " __VA_ARGS__)); \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
|
|
|
#elif defined(G_HAVE_GNUC_VARARGS)
|
|
|
|
|
2000-12-29 10:02:17 +00:00
|
|
|
#define _DEBUG_BUILTIN(format,args...) \
|
|
|
|
if (_debug_string != (void *)-1) { \
|
|
|
|
if (_debug_string) \
|
|
|
|
fprintf(stderr,"%s: " format , _debug_string , ## args); \
|
|
|
|
else \
|
|
|
|
fprintf(stderr,GST_DEBUG_PREFIX(": " format , ## args)); \
|
|
|
|
}
|
|
|
|
|
2002-11-29 17:05:13 +00:00
|
|
|
#endif
|
|
|
|
|
2000-12-29 10:02:17 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* INFO system
|
|
|
|
**********************************************************************/
|
|
|
|
|
2001-06-25 20:09:10 +00:00
|
|
|
typedef void (*GstInfoHandler) (gint category,gboolean incore,
|
|
|
|
const gchar *file,const gchar *function,
|
|
|
|
gint line,const gchar *debug_string,
|
2000-12-29 10:02:17 +00:00
|
|
|
void *element,gchar *string);
|
|
|
|
|
2001-06-25 20:09:10 +00:00
|
|
|
void gst_default_info_handler (gint category,gboolean incore,
|
|
|
|
const gchar *file,const gchar *function,
|
|
|
|
gint line,const gchar *debug_string,
|
2000-12-29 10:02:17 +00:00
|
|
|
void *element,gchar *string);
|
|
|
|
|
|
|
|
extern GstInfoHandler _gst_info_handler;
|
2000-12-30 02:41:15 +00:00
|
|
|
extern guint32 _gst_info_categories;
|
|
|
|
|
2001-01-01 00:44:28 +00:00
|
|
|
/* for include files that make too much noise normally */
|
|
|
|
#ifdef GST_INFO_FORCE_DISABLE
|
|
|
|
#undef GST_INFO_ENABLED
|
|
|
|
#endif
|
|
|
|
/* for applications that really really want all the noise */
|
|
|
|
#ifdef GST_INFO_FORCE_ENABLE
|
|
|
|
#define GST_INFO_ENABLED
|
|
|
|
#endif
|
2000-12-30 02:41:15 +00:00
|
|
|
|
2002-11-29 17:05:13 +00:00
|
|
|
#ifdef G_HAVE_ISO_VARARGS
|
|
|
|
|
|
|
|
#ifdef GST_INFO_ENABLED
|
|
|
|
#define GST_INFO(cat,...) G_STMT_START{ \
|
|
|
|
if ((1<<cat) & _gst_info_categories) \
|
2002-12-11 21:33:07 +00:00
|
|
|
_gst_info_handler(cat,_GST_DEBUG_INCORE,__FILE__,FUNCTION,__LINE__,_debug_string, \
|
2002-11-29 17:05:13 +00:00
|
|
|
NULL,g_strdup_printf( __VA_ARGS__ )); \
|
|
|
|
}G_STMT_END
|
|
|
|
|
|
|
|
#define GST_INFO_ELEMENT(cat,element,...) G_STMT_START{ \
|
|
|
|
if ((1<<cat) & _gst_info_categories) \
|
2002-12-11 21:33:07 +00:00
|
|
|
_gst_info_handler(cat,_GST_DEBUG_INCORE,__FILE__,FUNCTION,__LINE__,_debug_string, \
|
2002-11-29 17:05:13 +00:00
|
|
|
element,g_strdup_printf( __VA_ARGS__ )); \
|
|
|
|
}G_STMT_END
|
|
|
|
|
|
|
|
#else
|
|
|
|
#define GST_INFO(cat,...)
|
|
|
|
#define GST_INFO_ELEMENT(cat,element,...)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#elif defined(G_HAVE_GNUC_VARARGS)
|
|
|
|
|
2001-01-01 00:44:28 +00:00
|
|
|
#ifdef GST_INFO_ENABLED
|
2001-01-01 03:14:40 +00:00
|
|
|
#define GST_INFO(cat,format,args...) G_STMT_START{ \
|
2000-12-30 02:41:15 +00:00
|
|
|
if ((1<<cat) & _gst_info_categories) \
|
2002-12-11 21:33:07 +00:00
|
|
|
_gst_info_handler(cat,_GST_DEBUG_INCORE,__FILE__,FUNCTION,__LINE__,_debug_string, \
|
2000-12-30 02:41:15 +00:00
|
|
|
NULL,g_strdup_printf( format , ## args )); \
|
|
|
|
}G_STMT_END
|
|
|
|
|
2001-01-01 03:14:40 +00:00
|
|
|
#define GST_INFO_ELEMENT(cat,element,format,args...) G_STMT_START{ \
|
2000-12-30 02:41:15 +00:00
|
|
|
if ((1<<cat) & _gst_info_categories) \
|
2002-12-11 21:33:07 +00:00
|
|
|
_gst_info_handler(cat,_GST_DEBUG_INCORE,__FILE__,FUNCTION,__LINE__,_debug_string, \
|
2000-12-30 02:41:15 +00:00
|
|
|
element,g_strdup_printf( format , ## args )); \
|
|
|
|
}G_STMT_END
|
|
|
|
|
2001-01-01 00:44:28 +00:00
|
|
|
#else
|
2001-01-01 03:14:40 +00:00
|
|
|
#define GST_INFO(cat,format,args...)
|
|
|
|
#define GST_INFO_ELEMENT(cat,element,format,args...)
|
2001-01-01 00:44:28 +00:00
|
|
|
#endif
|
2000-12-30 02:41:15 +00:00
|
|
|
|
2002-11-29 17:05:13 +00:00
|
|
|
#endif
|
|
|
|
|
2001-01-01 03:14:40 +00:00
|
|
|
|
2001-01-01 00:17:21 +00:00
|
|
|
void gst_info_set_categories (guint32 categories);
|
2001-01-01 00:44:28 +00:00
|
|
|
guint32 gst_info_get_categories (void);
|
2001-01-01 00:17:21 +00:00
|
|
|
void gst_info_enable_category (gint category);
|
|
|
|
void gst_info_disable_category (gint category);
|
2001-01-01 04:53:26 +00:00
|
|
|
|
|
|
|
void gst_debug_set_categories (guint32 categories);
|
|
|
|
guint32 gst_debug_get_categories (void);
|
|
|
|
void gst_debug_enable_category (gint category);
|
|
|
|
void gst_debug_disable_category (gint category);
|
|
|
|
|
2001-04-27 20:31:22 +00:00
|
|
|
|
2000-12-29 10:02:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* ERROR system
|
|
|
|
**********************************************************************/
|
|
|
|
|
|
|
|
typedef void (*GstErrorHandler) (gchar *file,gchar *function,
|
|
|
|
gint line,gchar *debug_string,
|
|
|
|
void *element,void *object,gchar *string);
|
|
|
|
|
|
|
|
void gst_default_error_handler (gchar *file,gchar *function,
|
|
|
|
gint line,gchar *debug_string,
|
|
|
|
void *element,void *object,gchar *string);
|
|
|
|
|
|
|
|
extern GstErrorHandler _gst_error_handler;
|
|
|
|
|
2002-11-29 17:05:13 +00:00
|
|
|
#ifdef G_HAVE_ISO_VARARGS
|
|
|
|
|
|
|
|
#define GST_ERROR(element,...) \
|
2002-12-11 21:33:07 +00:00
|
|
|
_gst_error_handler(__FILE__,FUNCTION,__LINE__,_debug_string, \
|
2002-11-29 17:05:13 +00:00
|
|
|
element,NULL,g_strdup_printf( __VA_ARGS__ ))
|
|
|
|
|
|
|
|
#define GST_ERROR_OBJECT(element,object,...) \
|
2002-12-11 21:33:07 +00:00
|
|
|
_gst_error_handler(__FILE__,FUNCTION,__LINE__,_debug_string, \
|
2002-11-29 17:05:13 +00:00
|
|
|
element,object,g_strdup_printf( __VA_ARGS__ ))
|
|
|
|
|
|
|
|
#elif defined(G_HAVE_GNUC_VARARGS)
|
|
|
|
|
2001-01-01 03:14:40 +00:00
|
|
|
#define GST_ERROR(element,format,args...) \
|
2002-12-11 21:33:07 +00:00
|
|
|
_gst_error_handler(__FILE__,FUNCTION,__LINE__,_debug_string, \
|
2000-12-29 10:02:17 +00:00
|
|
|
element,NULL,g_strdup_printf( format , ## args ))
|
|
|
|
|
2001-01-01 03:14:40 +00:00
|
|
|
#define GST_ERROR_OBJECT(element,object,format,args...) \
|
2002-12-11 21:33:07 +00:00
|
|
|
_gst_error_handler(__FILE__,FUNCTION,__LINE__,_debug_string, \
|
2000-12-29 10:02:17 +00:00
|
|
|
element,object,g_strdup_printf( format , ## args ))
|
|
|
|
|
2002-11-29 17:05:13 +00:00
|
|
|
#endif
|
|
|
|
|
2001-05-25 21:00:07 +00:00
|
|
|
/********** function pointer stuff **********/
|
2002-12-11 21:33:07 +00:00
|
|
|
#if GST_DEBUG_ENABLED
|
2003-03-14 18:31:47 +00:00
|
|
|
void* _gst_debug_register_funcptr (void *ptr, gchar *ptrname);
|
|
|
|
gchar* _gst_debug_nameof_funcptr (void *ptr);
|
|
|
|
|
2002-12-11 21:33:07 +00:00
|
|
|
#define GST_DEBUG_FUNCPTR(ptr) _gst_debug_register_funcptr((void *)(ptr), #ptr)
|
|
|
|
#define GST_DEBUG_FUNCPTR_NAME(ptr) _gst_debug_nameof_funcptr((void *)ptr)
|
|
|
|
#else
|
|
|
|
#define GST_DEBUG_FUNCPTR(ptr) (ptr)
|
|
|
|
#define GST_DEBUG_FUNCPTR_NAME(ptr) ""
|
2002-12-13 15:33:42 +00:00
|
|
|
#endif /* GST_DEBUG_ENABLED */
|
2001-05-25 21:00:07 +00:00
|
|
|
|
2001-10-17 10:21:27 +00:00
|
|
|
void gst_debug_print_stack_trace (void);
|
|
|
|
|
2000-12-29 10:02:17 +00:00
|
|
|
#endif /* __GSTINFO_H__ */
|