From ca7539c40ea26af548ae6b265149035aae22a38b Mon Sep 17 00:00:00 2001 From: David Schleef Date: Fri, 7 May 2004 02:36:28 +0000 Subject: [PATCH] Changes to handle compilers that don't have variadic macro support. In particular, glib headers define some inlines ... Original commit message from CVS: Changes to handle compilers that don't have variadic macro support. In particular, glib headers define some inlines that need G_LOG_DOMAIN defined. Additional fixes for MSVC builds. * gst/Makefile.am: * gst/cothreads.c: * gst/elements/gstfdsink.c: * gst/elements/gstfdsrc.c: * gst/elements/gstfilesink.c: * gst/elements/gstfilesrc.c: * gst/gst_private.h: * gst/gstatomic.c: * gst/gstcaps.c: (gst_caps_append): * gst/gstcpu.c: (gst_cpuid_i386): * gst/gstelement.c: * gst/gsterror.c: * gst/gstfilter.c: * gst/gstinfo.h: * gst/gstprobe.c: * gst/gstquery.c: * gst/gstregistry.c: * gst/gststructure.c: * gst/gsttaginterface.c: * gst/gsttrace.c: (gst_trace_new): * gst/gsttrashstack.c: * gst/gsturi.c: * gst/gstvalue.c: * gst/parse/grammar.y: * gst/parse/parse.l: * tools/gst-inspect.c: (main): * tools/gst-launch.c: (main): * tools/gst-xmlinspect.c: (PUT_STRING): --- ChangeLog | 35 ++++++++++++++++++ gst/Makefile.am | 6 +-- gst/cothreads.c | 4 +- gst/elements/gstfdsink.c | 2 + gst/elements/gstfdsrc.c | 11 ++++-- gst/elements/gstfilesink.c | 2 + gst/elements/gstfilesrc.c | 12 ++++++ gst/gst_private.h | 36 +++++++++++++++++- gst/gstatomic.c | 1 + gst/gstcaps.c | 4 +- gst/gstcpu.c | 2 +- gst/gstelement.c | 2 +- gst/gsterror.c | 2 +- gst/gstfilter.c | 1 + gst/gstinfo.h | 2 +- gst/gstprobe.c | 2 +- gst/gstquery.c | 2 +- gst/gstregistry.c | 2 +- gst/gststructure.c | 2 +- gst/gsttaginterface.c | 2 +- gst/gsttagsetter.c | 2 +- gst/gsttrace.c | 2 +- gst/gsttrashstack.c | 1 + gst/gsturi.c | 2 +- gst/gstvalue.c | 2 +- gst/parse/grammar.y | 83 +++++++++++++++++++++++++++++++----------- gst/parse/parse.l | 11 +++++- plugins/elements/gstfdsink.c | 2 + plugins/elements/gstfdsrc.c | 11 ++++-- plugins/elements/gstfilesink.c | 2 + plugins/elements/gstfilesrc.c | 12 ++++++ tools/gst-inspect.c | 2 + tools/gst-launch.c | 20 ++++++++++ tools/gst-xmlinspect.c | 15 ++++++++ 34 files changed, 246 insertions(+), 53 deletions(-) diff --git a/ChangeLog b/ChangeLog index b0e74d8..c054e02 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,38 @@ +2004-05-06 David Schleef + + Changes to handle compilers that don't have variadic macro + support. In particular, glib headers define some inlines + that need G_LOG_DOMAIN defined. Additional fixes for MSVC + builds. + * gst/Makefile.am: + * gst/cothreads.c: + * gst/elements/gstfdsink.c: + * gst/elements/gstfdsrc.c: + * gst/elements/gstfilesink.c: + * gst/elements/gstfilesrc.c: + * gst/gst_private.h: + * gst/gstatomic.c: + * gst/gstcaps.c: (gst_caps_append): + * gst/gstcpu.c: (gst_cpuid_i386): + * gst/gstelement.c: + * gst/gsterror.c: + * gst/gstfilter.c: + * gst/gstinfo.h: + * gst/gstprobe.c: + * gst/gstquery.c: + * gst/gstregistry.c: + * gst/gststructure.c: + * gst/gsttaginterface.c: + * gst/gsttrace.c: (gst_trace_new): + * gst/gsttrashstack.c: + * gst/gsturi.c: + * gst/gstvalue.c: + * gst/parse/grammar.y: + * gst/parse/parse.l: + * tools/gst-inspect.c: (main): + * tools/gst-launch.c: (main): + * tools/gst-xmlinspect.c: (PUT_STRING): + 2004-05-06 Benjamin Otte * gst/elements/gstfilesrc.c: (gst_filesrc_get), diff --git a/gst/Makefile.am b/gst/Makefile.am index ed4b598..38aa3cd 100644 --- a/gst/Makefile.am +++ b/gst/Makefile.am @@ -227,8 +227,8 @@ gstmarshal.h: gstmarshal.list mv gstmarshal.h.tmp gstmarshal.h gstmarshal.c: gstmarshal.list - echo "#include \"glib-object.h\"" >gstmarshal.c.tmp - echo "#include \"gst_private.h\"" >> gstmarshal.c.tmp + echo "#include \"gst_private.h\"" > gstmarshal.c.tmp + echo "#include \"glib-object.h\"" >> gstmarshal.c.tmp echo "#include \"gstmarshal.h\"" >> gstmarshal.c.tmp glib-genmarshal --body --prefix=gst_marshal $^ >> gstmarshal.c.tmp mv gstmarshal.c.tmp gstmarshal.c @@ -243,7 +243,7 @@ gstenumtypes.h: $(gst_headers) gstenumtypes.c: $(gst_headers) glib-mkenums \ - --fhead "#include " \ + --fhead "#include \"gst_private.h\"\n#include " \ --fprod "\n/* enumerations from \"@filename@\" */" \ --vhead "GType\n@enum_name@_get_type (void)\n{\n static GType etype = 0;\n if (etype == 0) {\n static const G@Type@Value values[] = {" \ --vprod " { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \ diff --git a/gst/cothreads.c b/gst/cothreads.c index 0816a7e..edc71e6 100644 --- a/gst/cothreads.c +++ b/gst/cothreads.c @@ -20,6 +20,8 @@ * Boston, MA 02111-1307, USA. */ + +#include "gst_private.h" #include #include @@ -31,8 +33,6 @@ #include #include -#include "gst_private.h" - #include "cothreads.h" #include "gstarch.h" #include "gstinfo.h" diff --git a/gst/elements/gstfdsink.c b/gst/elements/gstfdsink.c index d003e16..93f8f57 100644 --- a/gst/elements/gstfdsink.c +++ b/gst/elements/gstfdsink.c @@ -25,7 +25,9 @@ #endif #include "gstfdsink.h" +#ifdef HAVE_UNISTD_H #include +#endif GST_DEBUG_CATEGORY_STATIC (gst_fdsink_debug); #define GST_CAT_DEFAULT gst_fdsink_debug diff --git a/gst/elements/gstfdsrc.c b/gst/elements/gstfdsrc.c index 11fafdf..8ea04d7 100644 --- a/gst/elements/gstfdsrc.c +++ b/gst/elements/gstfdsrc.c @@ -20,18 +20,21 @@ * Boston, MA 02111-1307, USA. */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif +#include "gst/gst_private.h" + #include #include #include #include +#ifdef HAVE_UNISTD_H #include +#endif #include #include -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - #include "gstfdsrc.h" #define DEFAULT_BLOCKSIZE 4096 diff --git a/gst/elements/gstfilesink.c b/gst/elements/gstfilesink.c index e00cd16..78a7010 100644 --- a/gst/elements/gstfilesink.c +++ b/gst/elements/gstfilesink.c @@ -33,7 +33,9 @@ #include #include #include +#ifdef HAVE_UNISTD_H #include +#endif GST_DEBUG_CATEGORY_STATIC (gst_filesink_debug); diff --git a/gst/elements/gstfilesrc.c b/gst/elements/gstfilesrc.c index 5f6a4ce..ce0530b 100644 --- a/gst/elements/gstfilesrc.c +++ b/gst/elements/gstfilesrc.c @@ -30,7 +30,9 @@ #include #include #include +#ifdef HAVE_UNISTD_H #include +#endif #ifdef HAVE_MMAP #include #endif @@ -39,6 +41,16 @@ #include "../gst-i18n-lib.h" +/* FIXME we should be using glib for this */ +#ifndef S_ISREG +#define S_ISREG(mode) ((mode)&_S_IFREG) +#endif +#ifndef S_ISDIR +#define S_ISDIR(mode) ((mode)&_S_IFDIR) +#endif +#ifndef S_ISSOCK +#define S_ISSOCK(x) (0) +#endif /********************************************************************** * GStreamer Default File Source diff --git a/gst/gst_private.h b/gst/gst_private.h index 4b32451..b84ea92 100644 --- a/gst/gst_private.h +++ b/gst/gst_private.h @@ -28,13 +28,15 @@ # include "config.h" #endif +/* This needs to be before glib.h, since it might be used in inline + * functions */ +extern const char *g_log_domain_gstreamer; + #include #include #include -extern const char *g_log_domain_gstreamer; - gboolean __gst_in_valgrind (void); /*** debugging categories *****************************************************/ @@ -71,6 +73,36 @@ extern GstDebugCategory *GST_CAT_EVENT; extern GstDebugCategory *GST_CAT_PARAMS; extern GstDebugCategory *GST_CAT_CALL_TRACE; +#else + +#define GST_CAT_GST_INIT NULL +#define GST_CAT_COTHREADS NULL +#define GST_CAT_COTHREAD_SWITCH NULL +#define GST_CAT_AUTOPLUG NULL +#define GST_CAT_AUTOPLUG_ATTEMPT NULL +#define GST_CAT_PARENTAGE NULL +#define GST_CAT_STATES NULL +#define GST_CAT_PLANNING NULL +#define GST_CAT_SCHEDULING NULL +#define GST_CAT_DATAFLOW NULL +#define GST_CAT_BUFFER NULL +#define GST_CAT_CAPS NULL +#define GST_CAT_CLOCK NULL +#define GST_CAT_ELEMENT_PADS NULL +#define GST_CAT_PADS NULL +#define GST_CAT_PIPELINE NULL +#define GST_CAT_PLUGIN_LOADING NULL +#define GST_CAT_PLUGIN_INFO NULL +#define GST_CAT_PROPERTIES NULL +#define GST_CAT_THREAD NULL +#define GST_CAT_XML NULL +#define GST_CAT_NEGOTIATION NULL +#define GST_CAT_REFCOUNTING NULL +#define GST_CAT_ERROR_SYSTEM NULL +#define GST_CAT_EVENT NULL +#define GST_CAT_PARAMS NULL +#define GST_CAT_CALL_TRACE NULL + #endif #endif /* __GST_PRIVATE_H__ */ diff --git a/gst/gstatomic.c b/gst/gstatomic.c index 8fb8543..9ed8421 100644 --- a/gst/gstatomic.c +++ b/gst/gstatomic.c @@ -20,5 +20,6 @@ #define GST_IMPLEMENT_INLINES 1 #define __GST_ATOMIC_C__ +#include "gst_private.h" #include "gstatomic.h" #include "gstatomic_impl.h" diff --git a/gst/gstcaps.c b/gst/gstcaps.c index b0e435c..65e0391 100644 --- a/gst/gstcaps.c +++ b/gst/gstcaps.c @@ -23,9 +23,8 @@ #include #include -#include - #include "gst_private.h" +#include #define CAPS_POISON(caps) G_STMT_START{ \ if (caps) { \ @@ -291,6 +290,7 @@ gst_caps_append (GstCaps * caps1, GstCaps * caps2) CAPS_POISON (caps2); #endif if (gst_caps_is_any (caps1) || gst_caps_is_any (caps2)) { + /* FIXME: this leaks */ caps1->flags |= GST_CAPS_FLAGS_ANY; for (i = 0; i < caps2->structs->len; i++) { structure = gst_caps_get_structure (caps2, i); diff --git a/gst/gstcpu.c b/gst/gstcpu.c index 02600b7..9c7cf2d 100644 --- a/gst/gstcpu.c +++ b/gst/gstcpu.c @@ -21,9 +21,9 @@ * Boston, MA 02111-1307, USA. */ +#include "gst_private.h" #include -#include "gst_private.h" #include "gstcpu.h" #include "gstinfo.h" diff --git a/gst/gstelement.c b/gst/gstelement.c index 70775c1..ba131c9 100644 --- a/gst/gstelement.c +++ b/gst/gstelement.c @@ -20,10 +20,10 @@ * Boston, MA 02111-1307, USA. */ +#include "gst_private.h" #include #include #include -#include "gst_private.h" #include "gstelement.h" #include "gstbin.h" diff --git a/gst/gsterror.c b/gst/gsterror.c index 974b2a6..2b4b236 100644 --- a/gst/gsterror.c +++ b/gst/gsterror.c @@ -21,8 +21,8 @@ #include "config.h" #endif -#include #include "gst_private.h" +#include #include "gst-i18n-lib.h" #define TABLE(t, d, a, b) t[GST_ ## d ## _ERROR_ ## a] = g_strdup (b) diff --git a/gst/gstfilter.c b/gst/gstfilter.c index 0d121bf..f3e84d7 100644 --- a/gst/gstfilter.c +++ b/gst/gstfilter.c @@ -17,6 +17,7 @@ * Boston, MA 02111-1307, USA. */ +#include "gst_private.h" #include /** diff --git a/gst/gstinfo.h b/gst/gstinfo.h index 1bdaf85..accb970 100644 --- a/gst/gstinfo.h +++ b/gst/gstinfo.h @@ -812,7 +812,7 @@ GST_LOG (const char *format, ...) void gst_debug_print_stack_trace (void); /* timestamp debugging macros */ -#define GST_TIME_FORMAT "u:%02u:%02u:%09u" +#define GST_TIME_FORMAT "u:%02u:%02u.%09u" #define GST_TIME_ARGS(t) \ (guint) (t / (GST_SECOND * 60 * 60)), \ (guint) ((t / (GST_SECOND * 60)) % 60), \ diff --git a/gst/gstprobe.c b/gst/gstprobe.c index d21e80c..e4d4588 100644 --- a/gst/gstprobe.c +++ b/gst/gstprobe.c @@ -21,8 +21,8 @@ */ -#include "gstprobe.h" #include "gst_private.h" +#include "gstprobe.h" /** * gst_probe_new: diff --git a/gst/gstquery.c b/gst/gstquery.c index 85e05ff..f37cc77 100644 --- a/gst/gstquery.c +++ b/gst/gstquery.c @@ -22,8 +22,8 @@ #include -#include "gstquery.h" #include "gst_private.h" +#include "gstquery.h" static GList *_gst_queries = NULL; static GHashTable *_nick_to_query = NULL; diff --git a/gst/gstregistry.c b/gst/gstregistry.c index ff843e2..50db8e1 100644 --- a/gst/gstregistry.c +++ b/gst/gstregistry.c @@ -23,6 +23,7 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif +#include "gst_private.h" #include #include #include @@ -33,7 +34,6 @@ #include #include -#include "gst_private.h" #include "gstinfo.h" #include "gstregistry.h" diff --git a/gst/gststructure.c b/gst/gststructure.c index be01e26..1ba07fb 100644 --- a/gst/gststructure.c +++ b/gst/gststructure.c @@ -25,9 +25,9 @@ #include +#include "gst_private.h" #include #include -#include "gst_private.h" typedef struct _GstStructureField GstStructureField; diff --git a/gst/gsttaginterface.c b/gst/gsttaginterface.c index a70644c..339b6ba 100644 --- a/gst/gsttaginterface.c +++ b/gst/gsttaginterface.c @@ -24,10 +24,10 @@ # include "config.h" #endif +#include "gst_private.h" #include "gsttaginterface.h" #include #include -#include "gst_private.h" GST_DEBUG_CATEGORY_STATIC (gst_tag_interface_debug); #define GST_CAT_DEFAULT tag_tag_interface_debug diff --git a/gst/gsttagsetter.c b/gst/gsttagsetter.c index a70644c..339b6ba 100644 --- a/gst/gsttagsetter.c +++ b/gst/gsttagsetter.c @@ -24,10 +24,10 @@ # include "config.h" #endif +#include "gst_private.h" #include "gsttaginterface.h" #include #include -#include "gst_private.h" GST_DEBUG_CATEGORY_STATIC (gst_tag_interface_debug); #define GST_CAT_DEFAULT tag_tag_interface_debug diff --git a/gst/gsttrace.c b/gst/gsttrace.c index 76ede60..80e0da5 100644 --- a/gst/gsttrace.c +++ b/gst/gsttrace.c @@ -74,7 +74,7 @@ gst_trace_new (gchar * filename, gint size) #define S_IWUSR S_IWRITE #endif #ifndef S_IRUSR -#define S_IDUSR S_IREAD +#define S_IRUSR S_IREAD #endif trace->fd = open (trace->filename, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); diff --git a/gst/gsttrashstack.c b/gst/gsttrashstack.c index 8254281..8f011d8 100644 --- a/gst/gsttrashstack.c +++ b/gst/gsttrashstack.c @@ -20,4 +20,5 @@ #define GST_IMPLEMENT_INLINES 1 #define __GST_TRASH_STACK_C__ +#include "gst_private.h" #include "gsttrashstack.h" diff --git a/gst/gsturi.c b/gst/gsturi.c index 0afe54e..2ed88d4 100644 --- a/gst/gsturi.c +++ b/gst/gsturi.c @@ -24,11 +24,11 @@ # include "config.h" #endif +#include "gst_private.h" #include "gsturi.h" #include "gstinfo.h" #include "gstregistrypool.h" #include "gstmarshal.h" -#include "gst_private.h" #include diff --git a/gst/gstvalue.c b/gst/gstvalue.c index a7d7363..6223882 100644 --- a/gst/gstvalue.c +++ b/gst/gstvalue.c @@ -24,9 +24,9 @@ #include #include +#include "gst_private.h" #include #include -#include "gst_private.h" typedef struct _GstValueUnionInfo GstValueUnionInfo; struct _GstValueUnionInfo diff --git a/gst/parse/grammar.y b/gst/parse/grammar.y index 507f859..27061c5 100644 --- a/gst/parse/grammar.y +++ b/gst/parse/grammar.y @@ -136,7 +136,7 @@ typedef struct { }G_STMT_END #endif -#else +#elif defined(G_HAVE_ISO_VARARGS) #define SET_ERROR(error, type, ...) G_STMT_START{ \ GST_CAT_ERROR (GST_CAT_PIPELINE, "error while parsing" ); \ @@ -149,19 +149,58 @@ typedef struct { # define YYDEBUG 1 #endif -#endif /* G_HAVE_ISO_VARARGS */ +#else + +static inline void +SET_ERROR (GError **error, gint type, const char *format, ...) +{ + if (error) { + if (*error) { + g_warning ("error while parsing"); + } else { + va_list varargs; + char *string; + + va_start (varargs, format); + string = g_strdup_vprintf (format, varargs); + va_end (varargs); + + g_set_error (error, GST_PARSE_ERROR, type, string); + + g_free (string); + } + } +} + +#ifndef GST_DISABLE_GST_DEBUG +# define YYDEBUG 1 +static inline void +YYPRINTF(const char *format, ...) +{ + va_list varargs; + gchar *temp; + + va_start (varargs, format); + temp = g_strdup_vprintf ( format, varargs ); + GST_CAT_LOG (GST_CAT_PIPELINE, "%s", temp); + g_free (temp); + va_end (varargs); +} +#endif + +#endif #define GST_BIN_MAKE(res, type, chainval, assign) G_STMT_START{ \ chain_t *chain = chainval; \ GSList *walk; \ GstBin *bin = (GstBin *) gst_element_factory_make (type, NULL); \ if (!chain) { \ - ERROR (GST_PARSE_ERROR_EMPTY_BIN, _("specified empty bin \"%s\", not allowed"), type); \ + SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_EMPTY_BIN, _("specified empty bin \"%s\", not allowed"), type); \ g_slist_foreach (assign, (GFunc) gst_parse_strfree, NULL); \ g_slist_free (assign); \ YYERROR; \ } else if (!bin) { \ - ERROR (GST_PARSE_ERROR_NO_SUCH_ELEMENT, _("no bin \"%s\", skipping"), type); \ + SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_NO_SUCH_ELEMENT, _("no bin \"%s\", skipping"), type); \ g_slist_foreach (assign, (GFunc) gst_parse_strfree, NULL); \ g_slist_free (assign); \ res = chain; \ @@ -299,7 +338,7 @@ gst_parse_element_set (gchar *value, GstElement *element, graph_t *graph) } g_object_set_property (G_OBJECT (element), value, &v); } else { - ERROR (GST_PARSE_ERROR_NO_SUCH_PROPERTY, _("no property \"%s\" in element \"%s\""), value, GST_ELEMENT_NAME (element)); + SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_NO_SUCH_PROPERTY, _("no property \"%s\" in element \"%s\""), value, GST_ELEMENT_NAME (element)); } out: @@ -311,12 +350,12 @@ out: return; error: - ERROR (GST_PARSE_ERROR_COULD_NOT_SET_PROPERTY, + SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_COULD_NOT_SET_PROPERTY, _("could not set property \"%s\" in element \"%s\" to \"%s\""), value, GST_ELEMENT_NAME (element), pos); goto out; error_conversion: - ERROR (GST_PARSE_ERROR_COULD_NOT_SET_PROPERTY, + SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_COULD_NOT_SET_PROPERTY, _("could not convert \"%s\" so that it fits property \"%s\" in element \"%s\""), pos, value, GST_ELEMENT_NAME (element)); goto out; @@ -502,7 +541,7 @@ success: return 0; error: - ERROR (GST_PARSE_ERROR_LINK, _("could not link %s to %s"), GST_ELEMENT_NAME (src), GST_ELEMENT_NAME (sink)); + SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_LINK, _("could not link %s to %s"), GST_ELEMENT_NAME (src), GST_ELEMENT_NAME (sink)); gst_parse_free_link (link); return -1; } @@ -547,7 +586,7 @@ static int yyerror (const char *s); element: IDENTIFIER { $$ = gst_element_factory_make ($1, NULL); if (!$$) - ERROR (GST_PARSE_ERROR_NO_SUCH_ELEMENT, _("no element \"%s\""), $1); + SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_NO_SUCH_ELEMENT, _("no element \"%s\""), $1); gst_parse_strfree ($1); if (!$$) YYERROR; @@ -598,7 +637,7 @@ link: linkpart LINK linkpart { $$ = $1; if ($2) { $$->caps = gst_caps_from_string ($2); if (!$$->caps) - ERROR (GST_PARSE_ERROR_LINK, _("could not parse caps \"%s\""), $2); + SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_LINK, _("could not parse caps \"%s\""), $2); gst_parse_strfree ($2); } $$->sink_name = $3->src_name; @@ -620,13 +659,13 @@ chain: element { $$ = gst_parse_chain_new (); | bin { $$ = $1; } | chain chain { if ($1->back && $2->front) { if (!$1->back->sink_name) { - ERROR (GST_PARSE_ERROR_LINK, _("link without source element")); + SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_LINK, _("link without source element")); gst_parse_free_link ($1->back); } else { ((graph_t *) graph)->links = g_slist_prepend (((graph_t *) graph)->links, $1->back); } if (!$2->front->src_name) { - ERROR (GST_PARSE_ERROR_LINK, _("link without sink element")); + SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_LINK, _("link without sink element")); gst_parse_free_link ($2->front); } else { ((graph_t *) graph)->links = g_slist_prepend (((graph_t *) graph)->links, $2->front); @@ -670,10 +709,10 @@ chain: element { $$ = gst_parse_chain_new (); for (walk = $2; walk; walk = walk->next) { link_t *link = (link_t *) walk->data; if (!link->sink_name && walk->next) { - ERROR (GST_PARSE_ERROR_LINK, _("link without sink element")); + SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_LINK, _("link without sink element")); gst_parse_free_link (link); } else if (!link->src_name && !link->src) { - ERROR (GST_PARSE_ERROR_LINK, _("link without source element")); + SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_LINK, _("link without source element")); gst_parse_free_link (link); } else { if (walk->next) { @@ -689,7 +728,7 @@ chain: element { $$ = gst_parse_chain_new (); | chain error { $$ = $1; } | link chain { if ($2->front) { if (!$2->front->src_name) { - ERROR (GST_PARSE_ERROR_LINK, _("link without source element")); + SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_LINK, _("link without source element")); gst_parse_free_link ($2->front); } else { ((graph_t *) graph)->links = g_slist_prepend (((graph_t *) graph)->links, $2->front); @@ -706,7 +745,7 @@ chain: element { $$ = gst_parse_chain_new (); GstElement *element = gst_element_make_from_uri (GST_URI_SRC, $1, NULL); if (!element) { - ERROR (GST_PARSE_ERROR_NO_SUCH_ELEMENT, + SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_NO_SUCH_ELEMENT, _("no source element for URI \"%s\""), $1); } else { $$->front->src = element; @@ -716,7 +755,7 @@ chain: element { $$ = gst_parse_chain_new (); $$->elements = g_slist_prepend ($$->elements, element); } } else { - ERROR (GST_PARSE_ERROR_LINK, + SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_LINK, _("no element to link URI \"%s\" to"), $1); } g_free ($1); @@ -724,11 +763,11 @@ chain: element { $$ = gst_parse_chain_new (); | link PARSE_URL { GstElement *element = gst_element_make_from_uri (GST_URI_SINK, $2, NULL); if (!element) { - ERROR (GST_PARSE_ERROR_NO_SUCH_ELEMENT, + SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_NO_SUCH_ELEMENT, _("no sink element for URI \"%s\""), $2); YYERROR; } else if ($1->sink_name || $1->sink_pads) { - ERROR (GST_PARSE_ERROR_LINK, + SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_LINK, _("could not link sink element for URI \"%s\""), $2); YYERROR; } else { @@ -741,13 +780,13 @@ chain: element { $$ = gst_parse_chain_new (); g_free ($2); } ; -graph: /* NOP */ { ERROR (GST_PARSE_ERROR_EMPTY, _("empty pipeline not allowed")); +graph: /* NOP */ { SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_EMPTY, _("empty pipeline not allowed")); $$ = (graph_t *) graph; } | chain { $$ = (graph_t *) graph; if ($1->front) { if (!$1->front->src_name) { - ERROR (GST_PARSE_ERROR_LINK, _("link without source element")); + SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_LINK, _("link without source element")); gst_parse_free_link ($1->front); } else { $$->links = g_slist_prepend ($$->links, $1->front); @@ -756,7 +795,7 @@ graph: /* NOP */ { ERROR (GST_PARSE_ERROR_EMPTY, _("empty pipeline not a } if ($1->back) { if (!$1->back->sink_name) { - ERROR (GST_PARSE_ERROR_LINK, _("link without sink element")); + SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_LINK, _("link without sink element")); gst_parse_free_link ($1->back); } else { $$->links = g_slist_prepend ($$->links, $1->back); diff --git a/gst/parse/parse.l b/gst/parse/parse.l index 14b4f22..2411709 100644 --- a/gst/parse/parse.l +++ b/gst/parse/parse.l @@ -14,7 +14,16 @@ #elif defined(G_HAVE_GNUC_VARARGS) #define PRINT(args...) GST_CAT_DEBUG (GST_CAT_PIPELINE, "flex: " args) #else -#define PRINT(args...) +static inline void +PRINT (const char *format, ...) +{ + va_list varargs; + + va_start (varargs, format); + GST_CAT_LEVEL_LOG_valist (GST_CAT_PIPELINE, GST_LEVEL_DEBUG, NULL, + format, varargs); + va_end (varargs); +} #endif #define YY_DECL int _gst_parse_yylex (YYSTYPE *lvalp) diff --git a/plugins/elements/gstfdsink.c b/plugins/elements/gstfdsink.c index d003e16..93f8f57 100644 --- a/plugins/elements/gstfdsink.c +++ b/plugins/elements/gstfdsink.c @@ -25,7 +25,9 @@ #endif #include "gstfdsink.h" +#ifdef HAVE_UNISTD_H #include +#endif GST_DEBUG_CATEGORY_STATIC (gst_fdsink_debug); #define GST_CAT_DEFAULT gst_fdsink_debug diff --git a/plugins/elements/gstfdsrc.c b/plugins/elements/gstfdsrc.c index 11fafdf..8ea04d7 100644 --- a/plugins/elements/gstfdsrc.c +++ b/plugins/elements/gstfdsrc.c @@ -20,18 +20,21 @@ * Boston, MA 02111-1307, USA. */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif +#include "gst/gst_private.h" + #include #include #include #include +#ifdef HAVE_UNISTD_H #include +#endif #include #include -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - #include "gstfdsrc.h" #define DEFAULT_BLOCKSIZE 4096 diff --git a/plugins/elements/gstfilesink.c b/plugins/elements/gstfilesink.c index e00cd16..78a7010 100644 --- a/plugins/elements/gstfilesink.c +++ b/plugins/elements/gstfilesink.c @@ -33,7 +33,9 @@ #include #include #include +#ifdef HAVE_UNISTD_H #include +#endif GST_DEBUG_CATEGORY_STATIC (gst_filesink_debug); diff --git a/plugins/elements/gstfilesrc.c b/plugins/elements/gstfilesrc.c index 5f6a4ce..ce0530b 100644 --- a/plugins/elements/gstfilesrc.c +++ b/plugins/elements/gstfilesrc.c @@ -30,7 +30,9 @@ #include #include #include +#ifdef HAVE_UNISTD_H #include +#endif #ifdef HAVE_MMAP #include #endif @@ -39,6 +41,16 @@ #include "../gst-i18n-lib.h" +/* FIXME we should be using glib for this */ +#ifndef S_ISREG +#define S_ISREG(mode) ((mode)&_S_IFREG) +#endif +#ifndef S_ISDIR +#define S_ISDIR(mode) ((mode)&_S_IFDIR) +#endif +#ifndef S_ISSOCK +#define S_ISSOCK(x) (0) +#endif /********************************************************************** * GStreamer Default File Source diff --git a/tools/gst-inspect.c b/tools/gst-inspect.c index 4f2495e..50e79a6 100644 --- a/tools/gst-inspect.c +++ b/tools/gst-inspect.c @@ -941,9 +941,11 @@ main (int argc, char *argv[]) POPT_TABLEEND }; +#ifdef GETTEXT_PACKAGE bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); +#endif gst_init_with_popt_table (&argc, &argv, options); gst_control_init (&argc, &argv); diff --git a/tools/gst-launch.c b/tools/gst-launch.c index 82abafe..3d06058 100644 --- a/tools/gst-launch.c +++ b/tools/gst-launch.c @@ -25,11 +25,20 @@ # include "config.h" #endif +/* FIXME: hack alert */ +#ifdef _MSC_VER +#define DISABLE_FAULT_HANDLER +#endif + #include #include #include +#ifdef HAVE_UNISTD_H #include +#endif +#ifndef DISABLE_FAULT_HANDLER #include +#endif #include /* for LC_ALL */ #include "gst/gst-i18n-app.h" @@ -42,9 +51,12 @@ #endif extern volatile gboolean glib_on_error_halt; + +#ifndef DISABLE_FAULT_HANDLER static void fault_restore (void); static void fault_spin (void); static void sigint_restore (void); +#endif static gint max_iterations = 0; static guint64 iterations = 0; @@ -156,6 +168,7 @@ xmllaunch_parse_cmdline (const gchar ** argv) } #endif +#ifndef DISABLE_FAULT_HANDLER #ifndef USE_SIGINFO static void fault_handler_sighandler (int signum) @@ -247,6 +260,7 @@ fault_setup (void) sigaction (SIGSEGV, &action, NULL); sigaction (SIGQUIT, &action, NULL); } +#endif static void print_tag (const GstTagList * list, const gchar * tag, gpointer unused) @@ -282,6 +296,7 @@ found_tag (GObject * pipeline, GstElement * source, GstTagList * tags) gst_tag_list_foreach (tags, print_tag, NULL); } +#ifndef DISABLE_FAULT_HANDLER /* we only use sighandler here because the registers are not important */ static void sigint_handler_sighandler (int signum) @@ -340,6 +355,7 @@ play_signal_setup (void) sigaction (SIGUSR1, &action, NULL); sigaction (SIGUSR2, &action, NULL); } +#endif int main (int argc, char *argv[]) @@ -379,9 +395,11 @@ main (int argc, char *argv[]) free (malloc (8)); /* -lefence */ +#ifdef GETTEXT_PACKAGE bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); +#endif gst_alloc_trace_set_flags_all (GST_ALLOC_TRACE_LIVE); @@ -406,11 +424,13 @@ main (int argc, char *argv[]) } argc = j; +#ifndef DISABLE_FAULT_HANDLER if (!no_fault) fault_setup (); sigint_setup (); play_signal_setup (); +#endif if (trace) { if (!gst_alloc_trace_available ()) { diff --git a/tools/gst-xmlinspect.c b/tools/gst-xmlinspect.c index ca49f8c..84e35ba 100644 --- a/tools/gst-xmlinspect.c +++ b/tools/gst-xmlinspect.c @@ -6,6 +6,7 @@ #include #include #include +#include #define PUT_START_TAG(pfx,tag) \ G_STMT_START{ \ @@ -43,6 +44,20 @@ G_STMT_START{ \ g_print ("%*.*s"str"\n", pfx, pfx, "" , ##a); \ }G_STMT_END +#else + +static inline void +PUT_STRING (int pfx, const char *format, ...) +{ + va_list varargs; + + g_print ("%*.*s", pfx, pfx, ""); + va_start (varargs, format); + g_vprintf (format, varargs); + va_end (varargs); + g_print ("\n"); +} + #endif static void -- 2.7.4