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.
155 lines
5.6 KiB
C
155 lines
5.6 KiB
C
/* Gnome-Streamer
|
|
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
|
*
|
|
* 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.
|
|
*/
|
|
|
|
|
|
#ifndef __GSTDEBUG_H__
|
|
#define __GSTDEBUG_H__
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
#include <config.h>
|
|
#endif
|
|
|
|
#include <gmodule.h>
|
|
#include <gst/gsttrace.h>
|
|
|
|
/* 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
|
|
|
|
|
|
#define GST_DEBUG_PREFIX(format,args...) \
|
|
"DEBUG(%d:%d)" __PRETTY_FUNCTION__ ":%d" format , getpid() , cothread_getcurrent() , __LINE__ , ## args
|
|
|
|
|
|
/* fallback, this should probably be a 'weak' symbol or something */
|
|
G_GNUC_UNUSED static gchar *_debug_string = NULL;
|
|
|
|
|
|
/**********************************************************************
|
|
* 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;
|
|
|
|
#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; \
|
|
fprintf(stderr,"%s: entered " __PRETTY_FUNCTION__ format "\n" , _debug_string , ## args ); \
|
|
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 " __PRETTY_FUNCTION__ format "\n" , _debug_string , ## args ); \
|
|
g_free(_debug_string); \
|
|
__builtin_return(_return_value); \
|
|
} else { \
|
|
_debug_in_wrapper = 0; \
|
|
} \
|
|
_debug_string_pointer; \
|
|
});
|
|
|
|
/* 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. */
|
|
#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)); \
|
|
}
|
|
|
|
#ifdef GST_DEBUG_ENABLED
|
|
#define DEBUG(format,args...) \
|
|
(_debug_string != NULL) ? \
|
|
fprintf(stderr,GST_DEBUG_PREFIX("%s: "format , _debug_string , ## args )) : \
|
|
fprintf(stderr,GST_DEBUG_PREFIX(": "format , ## args ))
|
|
#define DEBUG_ENTER(format, args...) \
|
|
fprintf(stderr,GST_DEBUG_PREFIX(format": entering\n" , ## args ))
|
|
#define DEBUG_SET_STRING(format, args...) \
|
|
gchar *_debug_string = g_strdup_printf(format , ## args )
|
|
#define DEBUG_ENTER_STRING DEBUG_ENTER("%s",_debug_string)
|
|
#define DEBUG_LEAVE(format, args...) \
|
|
if (_debug_string != NULL) g_free(_debug_string),\
|
|
fprintf(stderr,GST_DEBUG_PREFIX(format": leaving\n" , ## args ))
|
|
#define DEBUG_LEAVE_STRING DEBUG_LEAVE("%s",_debug_string)
|
|
#else
|
|
#define DEBUG(format, args...)
|
|
#define DEBUG_ENTER(format, args...)
|
|
#define DEBUG_LEAVE(format, args...)
|
|
#define DEBUG_SET_STRING(format, args...)
|
|
#define DEBUG_ENTER_STRING
|
|
#endif
|
|
|
|
|
|
|
|
/********** some convenience macros for debugging **********/
|
|
#define GST_DEBUG_PAD_NAME(pad) \
|
|
((pad)->parent != NULL) ? gst_element_get_name(GST_ELEMENT((pad)->parent)) : "''", gst_pad_get_name(pad)
|
|
|
|
|
|
|
|
/********** function pointer stuff **********/
|
|
extern GHashTable *__gst_function_pointers;
|
|
|
|
#ifdef GST_DEBUG_ENABLED
|
|
#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) ""
|
|
#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;
|
|
}
|
|
|
|
static inline gchar *
|
|
_gst_debug_nameof_funcptr (void *ptr)
|
|
{
|
|
gchar *ptrname = __gst_function_pointers ? g_hash_table_lookup(__gst_function_pointers,ptr) : NULL;
|
|
// FIXME this must go away, it's a major leak
|
|
if (!ptrname) return g_strdup_printf("%p",ptr);
|
|
else return ptrname;
|
|
}
|
|
|
|
#endif /* __GST_H__ */
|