commit Brian's patch with AC fix from thomas

Original commit message from CVS:
commit Brian's patch with AC fix from thomas
This commit is contained in:
Christian Schaller 2002-11-29 11:10:35 +00:00
parent 431fba3939
commit 54cbcd0c18
12 changed files with 320 additions and 21 deletions

View file

@ -3,7 +3,13 @@ AC_CANONICAL_TARGET([])
dnl when going to/from release please set the nano (fourth number) right ! dnl when going to/from release please set the nano (fourth number) right !
dnl releases only do Wall, cvs and prerelease does Werror too dnl releases only do Wall, cvs and prerelease does Werror too
AS_VERSION(gstreamer, GST_VERSION, 0, 4, 2, 1, GST_ERROR="-Wall", GST_ERROR="-Wall -Werror") dnl only use Wall or Werror if compiler is gcc.
if test "x$GCC" = "xyes"; then
AS_VERSION(gstreamer, GST_VERSION, 0, 4, 2, 1, GST_ERROR="-Wall", GST_ERROR="-Wall -Werror")
else
AS_VERSION(gstreamer, GST_VERSION, 0, 4, 2, 1, GST_ERROR="", GST_ERROR="")
fi
dnl AM_MAINTAINER_MODE only provides the option to configure to enable it dnl AM_MAINTAINER_MODE only provides the option to configure to enable it
AM_MAINTAINER_MODE AM_MAINTAINER_MODE
AM_INIT_AUTOMAKE($PACKAGE,$VERSION) AM_INIT_AUTOMAKE($PACKAGE,$VERSION)
@ -173,6 +179,39 @@ main() { atomic_t t; atomic_set(&t,0); atomic_inc(&t); atomic_add(1,&t);return 0
]) ])
fi fi
dnl
dnl Check for functions
dnl
AC_MSG_CHECKING(whether $GCC implements __func__)
AC_CACHE_VAL(have_func,
[AC_TRY_LINK([#include <stdio.h>],[printf("%s", __func__);],
have_func=yes,
have_func=no)])
AC_MSG_RESULT($have_func)
if test "$have_func" = yes; then
AC_DEFINE(HAVE_FUNC,1,[defined if gcc have HAVE_FUNC)])
else
AC_MSG_CHECKING(whether $GCC implements __PRETTY_FUNCTION__)
AC_CACHE_VAL(have_pretty_function,
[AC_TRY_LINK([#include <stdio.h>],[printf("%s", __PRETTY_FUNCTION__);],
have_pretty_function=yes,
have_pretty_function=no)])
AC_MSG_RESULT($have_pretty_function)
if test "$have_pretty_function" = yes; then
AC_DEFINE(HAVE_PRETTY_FUNCTION,1,[defined if gcc have HAVE_PRETTY_FUNCTION)])
else
AC_MSG_CHECKING(whether $GCC implements __FUNCTION__)
AC_CACHE_VAL(have_function,
[AC_TRY_LINK([#include <stdio.h>],[printf("%s", __FUNCTION__);],
have_function=yes,
have_function=no)])
AC_MSG_RESULT($have_function)
if test "$have_function" = yes; then
AC_DEFINE(HAVE_FUNCTION,1,[defined if gcc have HAVE_FUNCTION)])
fi
fi
fi
dnl ###################################################################### dnl ######################################################################
dnl # Check command line parameters, and set shell variables accordingly # dnl # Check command line parameters, and set shell variables accordingly #
dnl ###################################################################### dnl ######################################################################

View file

@ -17,7 +17,7 @@ SCAN_OPTIONS=
# FIXME : # FIXME :
# there's something wrong with gstreamer-sections.txt not being in the dist # there's something wrong with gstreamer-sections.txt not being in the dist
# maybe it doesn't resolve; we're adding it below for now # maybe it doesn't resolve; we're adding it below for now
#EXTRA_DIST = gstreamer.types.in gstreamer.hierarchy $(DOC_MODULE)-sections.txt gstreamer-sections.txt $(DOC_MAIN_SGML_FILE) #EXTRA_DIST = gstreamer.types.in gstreamer.hierarchy $(DOC_MODULE)-sections.txt # gstreamer-sections.txt $(DOC_MAIN_SGML_FILE)
# Extra options to supply to gtkdoc-mkdb. # Extra options to supply to gtkdoc-mkdb.
MKDB_OPTIONS= MKDB_OPTIONS=
@ -73,8 +73,8 @@ EXTRA_DIST = \
$(extra_files) \ $(extra_files) \
$(HTML_IMAGES) \ $(HTML_IMAGES) \
$(DOC_MAIN_SGML_FILE) \ $(DOC_MAIN_SGML_FILE) \
$(DOC_MODULE).types \ $(DOC_MODULE).types
$(DOC_MODULE)-sections.txt # $(DOC_MODULE)-sections.txt
DOC_STAMPS=scan-build.stamp tmpl-build.stamp sgml-build.stamp html-build.stamp \ DOC_STAMPS=scan-build.stamp tmpl-build.stamp sgml-build.stamp html-build.stamp \
$(srcdir)/tmpl.stamp $(srcdir)/sgml.stamp $(srcdir)/html.stamp $(srcdir)/tmpl.stamp $(srcdir)/sgml.stamp $(srcdir)/html.stamp

View file

@ -95,7 +95,7 @@ enum {
/* default scheduler, 'basicomega', can be changed in /* default scheduler, 'basicomega', can be changed in
* gstscheduler.c in function gst_scheduler_factory_class_init * gstscheduler.c in function gst_scheduler_factory_class_init
*/ */
static const struct poptOption options[] = { static const struct poptOption gstreamer_options[] = {
{NULL, NUL, POPT_ARG_CALLBACK|POPT_CBFLAG_PRE|POPT_CBFLAG_POST, &init_popt_callback, 0, NULL, NULL}, {NULL, NUL, POPT_ARG_CALLBACK|POPT_CBFLAG_PRE|POPT_CBFLAG_POST, &init_popt_callback, 0, NULL, NULL},
{"gst-version", NUL, POPT_ARG_NONE|POPT_ARGFLAG_STRIP, NULL, ARG_VERSION, "Print the GStreamer version", NULL}, {"gst-version", NUL, POPT_ARG_NONE|POPT_ARGFLAG_STRIP, NULL, ARG_VERSION, "Print the GStreamer version", NULL},
{"gst-fatal-warnings", NUL, POPT_ARG_NONE|POPT_ARGFLAG_STRIP, NULL, ARG_FATAL_WARNINGS, "Make all warnings fatal", NULL}, {"gst-fatal-warnings", NUL, POPT_ARG_NONE|POPT_ARGFLAG_STRIP, NULL, ARG_FATAL_WARNINGS, "Make all warnings fatal", NULL},
@ -126,7 +126,7 @@ static const struct poptOption options[] = {
const struct poptOption * const struct poptOption *
gst_init_get_popt_table (void) gst_init_get_popt_table (void)
{ {
return options; return gstreamer_options;
} }
/** /**
@ -186,15 +186,15 @@ gst_init_with_popt_table (int *argc, char **argv[],
gchar **temp; gchar **temp;
const struct poptOption *options; const struct poptOption *options;
/* this is probably hacky, no? */ /* this is probably hacky, no? */
const struct poptOption options_with[] = { struct poptOption options_with[] = {
{NULL, NUL, POPT_ARG_INCLUDE_TABLE, poptHelpOptions, 0, "Help options:", NULL}, {NULL, NUL, POPT_ARG_INCLUDE_TABLE, poptHelpOptions, 0, "Help options:", NULL},
{NULL, NUL, POPT_ARG_INCLUDE_TABLE, (struct poptOption *) gst_init_get_popt_table(), 0, "GStreamer options:", NULL}, {NULL, NUL, POPT_ARG_INCLUDE_TABLE, gstreamer_options, 0, "GStreamer options:", NULL},
{NULL, NUL, POPT_ARG_INCLUDE_TABLE, (struct poptOption *) popt_options, 0, "Application options:", NULL}, {NULL, NUL, POPT_ARG_INCLUDE_TABLE, (struct poptOption *) popt_options, 0, "Application options:", NULL},
POPT_TABLEEND POPT_TABLEEND
}; };
const struct poptOption options_without[] = { const struct poptOption options_without[] = {
{NULL, NUL, POPT_ARG_INCLUDE_TABLE, poptHelpOptions, 0, "Help options:", NULL}, {NULL, NUL, POPT_ARG_INCLUDE_TABLE, poptHelpOptions, 0, "Help options:", NULL},
{NULL, NUL, POPT_ARG_INCLUDE_TABLE, (struct poptOption *) gst_init_get_popt_table(), 0, "GStreamer options:", NULL}, {NULL, NUL, POPT_ARG_INCLUDE_TABLE, gstreamer_options, 0, "GStreamer options:", NULL},
POPT_TABLEEND POPT_TABLEEND
}; };

View file

@ -58,6 +58,26 @@ struct _GstCaps {
/* factory macros which make it easier for plugins to instantiate */ /* factory macros which make it easier for plugins to instantiate */
#ifdef G_HAVE_ISO_VARARGS
#define GST_CAPS_NEW(name, type, ...) \
gst_caps_new ( \
name, \
type, \
gst_props_new ( \
__VA_ARGS__, \
NULL))
#define GST_CAPS_FACTORY(factoryname, ...) \
static GstCaps* \
factoryname (void) \
{ \
static GstCaps *caps = NULL; \
if (!caps) { \
caps = gst_caps_chain (__VA_ARGS_, NULL); \
} \
return caps; \
}
#elif defined(G_HAVE_GNUC_VARARGS)
#define GST_CAPS_NEW(name, type, a...) \ #define GST_CAPS_NEW(name, type, a...) \
gst_caps_new ( \ gst_caps_new ( \
name, \ name, \
@ -76,6 +96,7 @@ factoryname (void) \
} \ } \
return caps; \ return caps; \
} }
#endif
#define GST_CAPS_GET(fact) (fact)() #define GST_CAPS_GET(fact) (fact)()
@ -108,8 +129,13 @@ void gst_caps_set_type_id (GstCaps *caps, guint16 type_id);
GstCaps* gst_caps_set_props (GstCaps *caps, GstProps *props); GstCaps* gst_caps_set_props (GstCaps *caps, GstProps *props);
GstProps* gst_caps_get_props (GstCaps *caps); GstProps* gst_caps_get_props (GstCaps *caps);
#ifdef G_HAVE_ISO_VARARGS
#define gst_caps_set(caps, ...) gst_props_set ((caps)->properties, __VA_ARGS__)
#define gst_caps_get(caps, ...) gst_props_get ((caps)->properties, __VA_ARGS__)
#elif defined(G_HAVE_GNUC_VARARGS)
#define gst_caps_set(caps, name, args...) gst_props_set ((caps)->properties, name, ##args) #define gst_caps_set(caps, name, args...) gst_props_set ((caps)->properties, name, ##args)
#define gst_caps_get(caps, name, args...) gst_props_get ((caps)->properties, name, ##args) #define gst_caps_get(caps, name, args...) gst_props_get ((caps)->properties, name, ##args)
#endif
#define gst_caps_get_int(caps,name,res) gst_props_entry_get_int(gst_props_get_entry((caps)->properties,name),res) #define gst_caps_get_int(caps,name,res) gst_props_entry_get_int(gst_props_get_entry((caps)->properties,name),res)
#define gst_caps_get_float(caps,name,res) gst_props_entry_get_float(gst_props_get_entry((caps)->properties,name),res) #define gst_caps_get_float(caps,name,res) gst_props_entry_get_float(gst_props_get_entry((caps)->properties,name),res)

View file

@ -78,6 +78,18 @@ typedef struct
GstEventFlag flags; GstEventFlag flags;
} GstEventMask; } GstEventMask;
#ifdef G_HAVE_ISO_VARARGS
#define GST_EVENT_MASK_FUNCTION(functionname, ...) \
static const GstEventMask* \
functionname (GstPad *pad) \
{ \
static const GstEventMask masks[] = { \
__VA_ARGS__, \
{ 0, } \
}; \
return masks; \
}
#elif defined(G_HAVE_GNUC_VARARGS)
#define GST_EVENT_MASK_FUNCTION(functionname, a...) \ #define GST_EVENT_MASK_FUNCTION(functionname, a...) \
static const GstEventMask* \ static const GstEventMask* \
functionname (GstPad *pad) \ functionname (GstPad *pad) \
@ -88,6 +100,7 @@ functionname (GstPad *pad) \
}; \ }; \
return masks; \ return masks; \
} }
#endif
/* seek events, extends GstEventFlag */ /* seek events, extends GstEventFlag */
typedef enum { typedef enum {

View file

@ -48,6 +48,18 @@ struct _GstFormatDefinition
gchar *description; gchar *description;
}; };
#ifdef G_HAVE_ISO_VARARGS
#define GST_FORMATS_FUNCTION(functionname, ...) \
static const GstFormat* \
functionname (GstPad *pad) \
{ \
static const GstFormat formats[] = { \
__VA_ARGS__, \
0 \
}; \
return formats; \
}
#elif defined(G_HAVE_GNUC_VARARGS)
#define GST_FORMATS_FUNCTION(functionname, a...) \ #define GST_FORMATS_FUNCTION(functionname, a...) \
static const GstFormat* \ static const GstFormat* \
functionname (GstPad *pad) \ functionname (GstPad *pad) \
@ -58,6 +70,7 @@ functionname (GstPad *pad) \
}; \ }; \
return formats; \ return formats; \
} }
#endif
void _gst_format_initialize (void); void _gst_format_initialize (void);

View file

@ -81,8 +81,9 @@ static gchar *_gst_info_category_strings[] = {
"REFCOUNTING", "REFCOUNTING",
"EVENT", "EVENT",
"PARAMS", "PARAMS",
"",
[30] = "CALL_TRACE", "",
"CALL_TRACE",
}; };
/** /**

View file

@ -31,6 +31,15 @@
#include <config.h> #include <config.h>
#endif #endif
#ifdef HAVE_FUNC
#define FUNCTION __func__
#elif HAVE_PRETTY_FUNCTION
#define FUNCTION __PRETTY_FUNCTION__
#elif HAVE_FUNCTION
#define FUNCTION __FUNCTION__
#else
#define FUNCTION ""
#endif
/***** are we in the core or not? *****/ /***** are we in the core or not? *****/
#ifdef __GST_PRIVATE_H__ #ifdef __GST_PRIVATE_H__
@ -136,17 +145,38 @@ G_GNUC_UNUSED static gchar *_debug_string = NULL;
#ifdef G_HAVE_ISO_VARARGS
#ifdef GST_DEBUG_ENABLED
#define GST_DEBUG(cat, ...) G_STMT_START{ \
if ((1<<cat) & _gst_debug_categories) \
_gst_debug_handler(cat,_GST_DEBUG_INCORE,__FILE__,FUNCTION,__LINE__,_debug_string, \
NULL,g_strdup_printf( __VA_ARGS__ )); \
}G_STMT_END
#define GST_DEBUG_ELEMENT(cat, element, ...) G_STMT_START{ \
if ((1<<cat) & _gst_debug_categories) \
_gst_debug_handler(cat,_GST_DEBUG_INCORE,__FILE__,FUNCTION,__LINE__,_debug_string, \
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)
#ifdef GST_DEBUG_ENABLED #ifdef GST_DEBUG_ENABLED
#define GST_DEBUG(cat,format,args...) G_STMT_START{ \ #define GST_DEBUG(cat,format,args...) G_STMT_START{ \
if ((1<<cat) & _gst_debug_categories) \ if ((1<<cat) & _gst_debug_categories) \
_gst_debug_handler(cat,_GST_DEBUG_INCORE,__FILE__,__PRETTY_FUNCTION__,__LINE__,_debug_string, \ _gst_debug_handler(cat,_GST_DEBUG_INCORE,__FILE__,FUNCTION,__LINE__,_debug_string, \
NULL,g_strdup_printf( format , ## args )); \ NULL,g_strdup_printf( format , ## args )); \
}G_STMT_END }G_STMT_END
#define GST_DEBUG_ELEMENT(cat,element,format,args...) G_STMT_START{ \ #define GST_DEBUG_ELEMENT(cat,element,format,args...) G_STMT_START{ \
if ((1<<cat) & _gst_debug_categories) \ if ((1<<cat) & _gst_debug_categories) \
_gst_debug_handler(cat,_GST_DEBUG_INCORE,__FILE__,__PRETTY_FUNCTION__,__LINE__,_debug_string, \ _gst_debug_handler(cat,_GST_DEBUG_INCORE,__FILE__,FUNCTION,__LINE__,_debug_string, \
element,g_strdup_printf( format , ## args )); \ element,g_strdup_printf( format , ## args )); \
}G_STMT_END }G_STMT_END
@ -155,6 +185,8 @@ G_GNUC_UNUSED static gchar *_debug_string = NULL;
#define GST_DEBUG_ELEMENT(cat,element,format,args...) #define GST_DEBUG_ELEMENT(cat,element,format,args...)
#endif #endif
#endif
@ -164,6 +196,18 @@ G_GNUC_UNUSED static gchar *_debug_string = NULL;
GST_OBJECT_NAME (GST_OBJECT_PARENT(pad)) : \ GST_OBJECT_NAME (GST_OBJECT_PARENT(pad)) : \
"''", GST_OBJECT_NAME (pad) "''", GST_OBJECT_NAME (pad)
#ifdef G_HAVE_ISO_VARARGS
#ifdef GST_DEBUG_COLOR
#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__ )
#else
#define GST_DEBUG_ENTER(...) GST_DEBUG( 31 , "entering :" __VA_ARGS__ )
#define GST_DEBUG_LEAVE(...) GST_DEBUG( 31 , "leaving :" __VA_ARGS__ )
#endif
#elif defined(G_HAVE_GNUC_VARARGS)
#ifdef GST_DEBUG_COLOR #ifdef GST_DEBUG_COLOR
#define GST_DEBUG_ENTER(format, args...) GST_DEBUG( 31 , format ": \033[00;37mentering\033[00m" , ##args ) #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 ) #define GST_DEBUG_LEAVE(format, args...) GST_DEBUG( 31 , format ": \033[00;37mleaving\033[00m" , ##args )
@ -172,6 +216,8 @@ G_GNUC_UNUSED static gchar *_debug_string = NULL;
#define GST_DEBUG_LEAVE(format, args...) GST_DEBUG( 31 , format ": leaving" , ##args ) #define GST_DEBUG_LEAVE(format, args...) GST_DEBUG( 31 , format ": leaving" , ##args )
#endif #endif
#endif
/***** Colorized debug for thread ids *****/ /***** Colorized debug for thread ids *****/
#ifdef GST_DEBUG_COLOR #ifdef GST_DEBUG_COLOR
@ -194,6 +240,38 @@ typedef void (*_debug_function_f)();
G_GNUC_UNUSED static gchar *_debug_string_pointer = NULL; G_GNUC_UNUSED static gchar *_debug_string_pointer = NULL;
G_GNUC_UNUSED static GModule *_debug_self_module = NULL; G_GNUC_UNUSED static GModule *_debug_self_module = NULL;
#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)
#define _DEBUG_ENTER_BUILTIN(format,args...) \ #define _DEBUG_ENTER_BUILTIN(format,args...) \
static int _debug_in_wrapper = 0; \ static int _debug_in_wrapper = 0; \
gchar *_debug_string = ({ \ gchar *_debug_string = ({ \
@ -205,11 +283,11 @@ G_GNUC_UNUSED static GModule *_debug_self_module = NULL;
_debug_in_wrapper = 1; \ _debug_in_wrapper = 1; \
_debug_string = g_strdup_printf(GST_DEBUG_PREFIX("")); \ _debug_string = g_strdup_printf(GST_DEBUG_PREFIX("")); \
_debug_string_pointer = _debug_string; \ _debug_string_pointer = _debug_string; \
fprintf(stderr,"%s: entered " __PRETTY_FUNCTION__ format "\n" , _debug_string , ## args ); \ fprintf(stderr,"%s: entered " FUNCTION format "\n" , _debug_string , ## args ); \
if (_debug_self_module == NULL) _debug_self_module = g_module_open(NULL,0); \ if (_debug_self_module == NULL) _debug_self_module = g_module_open(NULL,0); \
g_module_symbol(_debug_self_module,__FUNCTION__,(gpointer *)&function); \ g_module_symbol(_debug_self_module,FUNCTION,(gpointer *)&function); \
_return_value = __builtin_apply(function,_function_args,64); \ _return_value = __builtin_apply(function,_function_args,64); \
fprintf(stderr,"%s: left " __PRETTY_FUNCTION__ format "\n" , _debug_string , ## args ); \ fprintf(stderr,"%s: left " FUNCTION format "\n" , _debug_string , ## args ); \
g_free(_debug_string); \ g_free(_debug_string); \
__builtin_return(_return_value); \ __builtin_return(_return_value); \
} else { \ } else { \
@ -218,9 +296,26 @@ G_GNUC_UNUSED static GModule *_debug_self_module = NULL;
_debug_string_pointer; \ _debug_string_pointer; \
}); });
#endif
* WARNING: there's a gcc CPP bug lurking in here. The extra space before the ##args * * 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 * * 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. * * _debug_string somehow gets stripped along with the ##args, and that's all she wrote. *
#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)
#define _DEBUG_BUILTIN(format,args...) \ #define _DEBUG_BUILTIN(format,args...) \
if (_debug_string != (void *)-1) { \ if (_debug_string != (void *)-1) { \
if (_debug_string) \ if (_debug_string) \
@ -229,6 +324,8 @@ G_GNUC_UNUSED static GModule *_debug_self_module = NULL;
fprintf(stderr,GST_DEBUG_PREFIX(": " format , ## args)); \ fprintf(stderr,GST_DEBUG_PREFIX(": " format , ## args)); \
} }
#endif
*/ */
@ -259,16 +356,38 @@ extern guint32 _gst_info_categories;
#define GST_INFO_ENABLED #define GST_INFO_ENABLED
#endif #endif
#ifdef G_HAVE_ISO_VARARGS
#ifdef GST_INFO_ENABLED
#define GST_INFO(cat,...) G_STMT_START{ \
if ((1<<cat) & _gst_info_categories) \
_gst_info_handler(cat,_GST_DEBUG_INCORE,__FILE__,FUNCTION,__LINE__,_debug_string, \
NULL,g_strdup_printf( __VA_ARGS__ )); \
}G_STMT_END
#define GST_INFO_ELEMENT(cat,element,...) G_STMT_START{ \
if ((1<<cat) & _gst_info_categories) \
_gst_info_handler(cat,_GST_DEBUG_INCORE,__FILE__,FUNCTION,__LINE__,_debug_string, \
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)
#ifdef GST_INFO_ENABLED #ifdef GST_INFO_ENABLED
#define GST_INFO(cat,format,args...) G_STMT_START{ \ #define GST_INFO(cat,format,args...) G_STMT_START{ \
if ((1<<cat) & _gst_info_categories) \ if ((1<<cat) & _gst_info_categories) \
_gst_info_handler(cat,_GST_DEBUG_INCORE,__FILE__,__PRETTY_FUNCTION__,__LINE__,_debug_string, \ _gst_info_handler(cat,_GST_DEBUG_INCORE,__FILE__,FUNCTION,__LINE__,_debug_string, \
NULL,g_strdup_printf( format , ## args )); \ NULL,g_strdup_printf( format , ## args )); \
}G_STMT_END }G_STMT_END
#define GST_INFO_ELEMENT(cat,element,format,args...) G_STMT_START{ \ #define GST_INFO_ELEMENT(cat,element,format,args...) G_STMT_START{ \
if ((1<<cat) & _gst_info_categories) \ if ((1<<cat) & _gst_info_categories) \
_gst_info_handler(cat,_GST_DEBUG_INCORE,__FILE__,__PRETTY_FUNCTION__,__LINE__,_debug_string, \ _gst_info_handler(cat,_GST_DEBUG_INCORE,__FILE__,FUNCTION,__LINE__,_debug_string, \
element,g_strdup_printf( format , ## args )); \ element,g_strdup_printf( format , ## args )); \
}G_STMT_END }G_STMT_END
@ -277,6 +396,8 @@ extern guint32 _gst_info_categories;
#define GST_INFO_ELEMENT(cat,element,format,args...) #define GST_INFO_ELEMENT(cat,element,format,args...)
#endif #endif
#endif
void gst_info_set_categories (guint32 categories); void gst_info_set_categories (guint32 categories);
guint32 gst_info_get_categories (void); guint32 gst_info_get_categories (void);
@ -305,14 +426,28 @@ void gst_default_error_handler (gchar *file,gchar *function,
extern GstErrorHandler _gst_error_handler; extern GstErrorHandler _gst_error_handler;
#ifdef G_HAVE_ISO_VARARGS
#define GST_ERROR(element,...) \
_gst_error_handler(__FILE__,FUNCTION,__LINE__,_debug_string, \
element,NULL,g_strdup_printf( __VA_ARGS__ ))
#define GST_ERROR_OBJECT(element,object,...) \
_gst_error_handler(__FILE__,FUNCTION,__LINE__,_debug_string, \
element,object,g_strdup_printf( __VA_ARGS__ ))
#elif defined(G_HAVE_GNUC_VARARGS)
#define GST_ERROR(element,format,args...) \ #define GST_ERROR(element,format,args...) \
_gst_error_handler(__FILE__,__PRETTY_FUNCTION__,__LINE__,_debug_string, \ _gst_error_handler(__FILE__,FUNCTION,__LINE__,_debug_string, \
element,NULL,g_strdup_printf( format , ## args )) element,NULL,g_strdup_printf( format , ## args ))
#define GST_ERROR_OBJECT(element,object,format,args...) \ #define GST_ERROR_OBJECT(element,object,format,args...) \
_gst_error_handler(__FILE__,__PRETTY_FUNCTION__,__LINE__,_debug_string, \ _gst_error_handler(__FILE__,FUNCTION,__LINE__,_debug_string, \
element,object,g_strdup_printf( format , ## args )) element,object,g_strdup_printf( format , ## args ))
#endif

View file

@ -25,6 +25,18 @@
extern const char *g_log_domain_gstreamer; extern const char *g_log_domain_gstreamer;
#ifdef G_HAVE_ISO_VARARGS
/* information messages */
#define GST_SHOW_INFO
#ifdef GST_SHOW_INFO
#define gst_info(...) fprintf(stderr, __VA_ARGS__)
#else
#define gst_info(...)
#endif
#elif defined(G_HAVE_GNUC_VARARGS)
/* information messages */ /* information messages */
#define GST_SHOW_INFO #define GST_SHOW_INFO
#ifdef GST_SHOW_INFO #ifdef GST_SHOW_INFO
@ -32,5 +44,6 @@ extern const char *g_log_domain_gstreamer;
#else #else
#define gst_info(format,args...) #define gst_info(format,args...)
#endif #endif
#endif
#endif /* __GST_LOG_H__ */ #endif /* __GST_LOG_H__ */

View file

@ -128,6 +128,18 @@ typedef enum {
GST_PAD_QUERY_RATE GST_PAD_QUERY_RATE
} GstPadQueryType; } GstPadQueryType;
#ifdef G_HAVE_ISO_VARARGS
#define GST_PAD_QUERY_TYPE_FUNCTION(functionname, ...) \
static const GstPadQueryType* \
functionname (GstPad *pad) \
{ \
static const GstPadQueryType types[] = { \
__VA_ARGS__, \
0 \
}; \
return types; \
}
#elif defined(G_HAVE_GNUC_VARARGS)
#define GST_PAD_QUERY_TYPE_FUNCTION(functionname, a...) \ #define GST_PAD_QUERY_TYPE_FUNCTION(functionname, a...) \
static const GstPadQueryType* \ static const GstPadQueryType* \
functionname (GstPad *pad) \ functionname (GstPad *pad) \
@ -138,6 +150,7 @@ functionname (GstPad *pad) \
}; \ }; \
return types; \ return types; \
} }
#endif
/* this defines the functions used to chain buffers /* this defines the functions used to chain buffers
@ -335,6 +348,30 @@ struct _GstPadTemplateClass {
void (*pad_created) (GstPadTemplate *templ, GstPad *pad); void (*pad_created) (GstPadTemplate *templ, GstPad *pad);
}; };
#ifdef G_HAVE_ISO_VARARGS
#define GST_PAD_TEMPLATE_NEW(padname, dir, pres, ...) \
gst_pad_template_new ( \
padname, \
dir, \
pres, \
__VA_ARGS__ , \
NULL)
#define GST_PAD_TEMPLATE_FACTORY(name, padname, dir, pres, ...) \
static GstPadTemplate* \
name (void) \
{ \
static GstPadTemplate *templ = NULL; \
if (!templ) { \
templ = GST_PAD_TEMPLATE_NEW ( \
padname, \
dir, \
pres, \
__VA_ARGS__ ); \
} \
return templ; \
}
#elif defined(G_HAVE_GNUC_VARARGS)
/* CR1: the space after 'a' is necessary because of preprocessing in gcc */ /* CR1: the space after 'a' is necessary because of preprocessing in gcc */
#define GST_PAD_TEMPLATE_NEW(padname, dir, pres, a...) \ #define GST_PAD_TEMPLATE_NEW(padname, dir, pres, a...) \
gst_pad_template_new ( \ gst_pad_template_new ( \
@ -358,6 +395,7 @@ name (void) \
} \ } \
return templ; \ return templ; \
} }
#endif
#define GST_PAD_TEMPLATE_GET(fact) (fact)() #define GST_PAD_TEMPLATE_GET(fact) (fact)()

View file

@ -59,7 +59,16 @@ typedef enum {
#define GST_MAKE_FOURCC(a,b,c,d) (guint32)((a)|(b)<<8|(c)<<16|(d)<<24) #define GST_MAKE_FOURCC(a,b,c,d) (guint32)((a)|(b)<<8|(c)<<16|(d)<<24)
#define GST_STR_FOURCC(f) (guint32)(((f)[0])|((f)[1]<<8)|((f)[2]<<16)|((f)[3]<<24)) #define GST_STR_FOURCC(f) (guint32)(((f)[0])|((f)[1]<<8)|((f)[2]<<16)|((f)[3]<<24))
#define GST_PROPS_LIST(a...) GST_PROPS_LIST_TYPE,##a,NULL #ifdef G_HAVE_ISO_VARARGS
#define GST_PROPS_LIST(...) GST_PROPS_LIST_TYPE,__VA_ARGS__,NULL
#elif defined(G_HAVE_GNUC_VARARGS)
#define GST_PROPS_LIST(a...) GST_PROPS_LIST_TYPE,a,NULL
#endif
#define GST_PROPS_GLIST(a) GST_PROPS_GLIST_TYPE,(a) #define GST_PROPS_GLIST(a) GST_PROPS_GLIST_TYPE,(a)
#define GST_PROPS_INT(a) GST_PROPS_INT_TYPE,(a) #define GST_PROPS_INT(a) GST_PROPS_INT_TYPE,(a)
#define GST_PROPS_INT_RANGE(a,b) GST_PROPS_INT_RANGE_TYPE,(a),(b) #define GST_PROPS_INT_RANGE(a,b) GST_PROPS_INT_RANGE_TYPE,(a),(b)

View file

@ -5,12 +5,24 @@
#include "types.h" #include "types.h"
#include <grammar.tab.h> #include <grammar.tab.h>
#ifdef G_HAVE_ISO_VARARGS
#ifdef DEBUG
# define PRINT(...) printf(__VAR_ARGS__)
#else
#define PRINT(...)
#endif
#elif defined(G_HAVE_GNUC_VARARGS)
#ifdef DEBUG #ifdef DEBUG
# define PRINT(a...) printf(##a) # define PRINT(a...) printf(##a)
#else #else
#define PRINT(a...) #define PRINT(a...)
#endif #endif
#endif
#define CHAR(x) PRINT ("char: %c\n", *yytext); return *yytext; #define CHAR(x) PRINT ("char: %c\n", *yytext); return *yytext;
#define YY_DECL int _gst_parse_yylex (YYSTYPE *lvalp) #define YY_DECL int _gst_parse_yylex (YYSTYPE *lvalp)