Changes to handle compilers that don't have variadic macro support. In particular...
authorDavid Schleef <ds@schleef.org>
Fri, 7 May 2004 02:36:28 +0000 (02:36 +0000)
committerDavid Schleef <ds@schleef.org>
Fri, 7 May 2004 02:36:28 +0000 (02:36 +0000)
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):

34 files changed:
ChangeLog
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/gstcpu.c
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/gsttagsetter.c
gst/gsttrace.c
gst/gsttrashstack.c
gst/gsturi.c
gst/gstvalue.c
gst/parse/grammar.y
gst/parse/parse.l
plugins/elements/gstfdsink.c
plugins/elements/gstfdsrc.c
plugins/elements/gstfilesink.c
plugins/elements/gstfilesrc.c
tools/gst-inspect.c
tools/gst-launch.c
tools/gst-xmlinspect.c

index b0e74d8..c054e02 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,38 @@
+2004-05-06  David Schleef  <ds@schleef.org>
+
+       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  <in7y118@public.uni-hamburg.de>
 
        * gst/elements/gstfilesrc.c: (gst_filesrc_get),
index ed4b598..38aa3cd 100644 (file)
@@ -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 <gst/gst.h>" \
+       --fhead "#include \"gst_private.h\"\n#include <gst/gst.h>" \
        --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@\" }," \
index 0816a7e..edc71e6 100644 (file)
@@ -20,6 +20,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
+
+#include "gst_private.h"
 #include <glib.h>
 
 #include <sys/time.h>
@@ -31,8 +33,6 @@
 #include <errno.h>
 #include <sys/mman.h>
 
-#include "gst_private.h"
-
 #include "cothreads.h"
 #include "gstarch.h"
 #include "gstinfo.h"
index d003e16..93f8f57 100644 (file)
@@ -25,7 +25,9 @@
 #endif
 
 #include "gstfdsink.h"
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
 
 GST_DEBUG_CATEGORY_STATIC (gst_fdsink_debug);
 #define GST_CAT_DEFAULT gst_fdsink_debug
index 11fafdf..8ea04d7 100644 (file)
  * Boston, MA 02111-1307, USA.
  */
 
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+#include "gst/gst_private.h"
+
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <stdio.h>
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
 #include <stdlib.h>
 #include <errno.h>
 
-#ifdef HAVE_CONFIG_H
-#  include "config.h"
-#endif
-
 #include "gstfdsrc.h"
 
 #define DEFAULT_BLOCKSIZE      4096
index e00cd16..78a7010 100644 (file)
@@ -33,7 +33,9 @@
 #include <string.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
 
 
 GST_DEBUG_CATEGORY_STATIC (gst_filesink_debug);
index 5f6a4ce..ce0530b 100644 (file)
@@ -30,7 +30,9 @@
 #include <stdio.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
 #ifdef HAVE_MMAP
 #include <sys/mman.h>
 #endif
 
 #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
index 4b32451..b84ea92 100644 (file)
 #  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 <glib.h>
 
 #include <stdlib.h>
 #include <string.h>
 
-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__ */
index 8fb8543..9ed8421 100644 (file)
@@ -20,5 +20,6 @@
 #define GST_IMPLEMENT_INLINES 1
 #define __GST_ATOMIC_C__
 
+#include "gst_private.h"
 #include "gstatomic.h"
 #include "gstatomic_impl.h"
index b0e435c..65e0391 100644 (file)
@@ -23,9 +23,8 @@
 #include <string.h>
 #include <signal.h>
 
-#include <gst/gst.h>
-
 #include "gst_private.h"
+#include <gst/gst.h>
 
 #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);
index 02600b7..9c7cf2d 100644 (file)
@@ -21,9 +21,9 @@
  * Boston, MA 02111-1307, USA.
  */
 
+#include "gst_private.h"
 #include <glib.h>
 
-#include "gst_private.h"
 
 #include "gstcpu.h"
 #include "gstinfo.h"
index 70775c1..ba131c9 100644 (file)
  * Boston, MA 02111-1307, USA.
  */
 
+#include "gst_private.h"
 #include <glib.h>
 #include <stdarg.h>
 #include <gobject/gvaluecollector.h>
-#include "gst_private.h"
 
 #include "gstelement.h"
 #include "gstbin.h"
index 974b2a6..2b4b236 100644 (file)
@@ -21,8 +21,8 @@
 #include "config.h"
 #endif
 
-#include <gst/gst.h>
 #include "gst_private.h"
+#include <gst/gst.h>
 #include "gst-i18n-lib.h"
 
 #define TABLE(t, d, a, b) t[GST_ ## d ## _ERROR_ ## a] = g_strdup (b)
index 0d121bf..f3e84d7 100644 (file)
@@ -17,6 +17,7 @@
  * Boston, MA 02111-1307, USA.
  */
 
+#include "gst_private.h"
 #include <gst/gstfilter.h>
 
 /**
index 1bdaf85..accb970 100644 (file)
@@ -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), \
index d21e80c..e4d4588 100644 (file)
@@ -21,8 +21,8 @@
  */
 
 
-#include "gstprobe.h"
 #include "gst_private.h"
+#include "gstprobe.h"
 
 /**
  * gst_probe_new:
index 85e05ff..f37cc77 100644 (file)
@@ -22,8 +22,8 @@
 
 #include <string.h>
 
-#include "gstquery.h"
 #include "gst_private.h"
+#include "gstquery.h"
 
 static GList *_gst_queries = NULL;
 static GHashTable *_nick_to_query = NULL;
index ff843e2..50db8e1 100644 (file)
@@ -23,6 +23,7 @@
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
+#include "gst_private.h"
 #include <glib.h>
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -33,7 +34,6 @@
 #include <stdio.h>
 #include <string.h>
 
-#include "gst_private.h"
 
 #include "gstinfo.h"
 #include "gstregistry.h"
index be01e26..1ba07fb 100644 (file)
@@ -25,9 +25,9 @@
 
 #include <string.h>
 
+#include "gst_private.h"
 #include <gst/gst.h>
 #include <gobject/gvaluecollector.h>
-#include "gst_private.h"
 
 typedef struct _GstStructureField GstStructureField;
 
index a70644c..339b6ba 100644 (file)
 #  include "config.h"
 #endif
 
+#include "gst_private.h"
 #include "gsttaginterface.h"
 #include <gobject/gvaluecollector.h>
 #include <string.h>
-#include "gst_private.h"
 
 GST_DEBUG_CATEGORY_STATIC (gst_tag_interface_debug);
 #define GST_CAT_DEFAULT tag_tag_interface_debug
index a70644c..339b6ba 100644 (file)
 #  include "config.h"
 #endif
 
+#include "gst_private.h"
 #include "gsttaginterface.h"
 #include <gobject/gvaluecollector.h>
 #include <string.h>
-#include "gst_private.h"
 
 GST_DEBUG_CATEGORY_STATIC (gst_tag_interface_debug);
 #define GST_CAT_DEFAULT tag_tag_interface_debug
index 76ede60..80e0da5 100644 (file)
@@ -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);
index 8254281..8f011d8 100644 (file)
@@ -20,4 +20,5 @@
 #define GST_IMPLEMENT_INLINES 1
 #define __GST_TRASH_STACK_C__
 
+#include "gst_private.h"
 #include "gsttrashstack.h"
index 0afe54e..2ed88d4 100644 (file)
 #  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 <string.h>
 
index a7d7363..6223882 100644 (file)
@@ -24,9 +24,9 @@
 #include <string.h>
 #include <ctype.h>
 
+#include "gst_private.h"
 #include <gst/gst.h>
 #include <gobject/gvaluecollector.h>
-#include "gst_private.h"
 
 typedef struct _GstValueUnionInfo GstValueUnionInfo;
 struct _GstValueUnionInfo
index 507f859..27061c5 100644 (file)
@@ -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);
index 14b4f22..2411709 100644 (file)
 #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)
index d003e16..93f8f57 100644 (file)
@@ -25,7 +25,9 @@
 #endif
 
 #include "gstfdsink.h"
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
 
 GST_DEBUG_CATEGORY_STATIC (gst_fdsink_debug);
 #define GST_CAT_DEFAULT gst_fdsink_debug
index 11fafdf..8ea04d7 100644 (file)
  * Boston, MA 02111-1307, USA.
  */
 
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+#include "gst/gst_private.h"
+
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <stdio.h>
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
 #include <stdlib.h>
 #include <errno.h>
 
-#ifdef HAVE_CONFIG_H
-#  include "config.h"
-#endif
-
 #include "gstfdsrc.h"
 
 #define DEFAULT_BLOCKSIZE      4096
index e00cd16..78a7010 100644 (file)
@@ -33,7 +33,9 @@
 #include <string.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
 
 
 GST_DEBUG_CATEGORY_STATIC (gst_filesink_debug);
index 5f6a4ce..ce0530b 100644 (file)
@@ -30,7 +30,9 @@
 #include <stdio.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
 #ifdef HAVE_MMAP
 #include <sys/mman.h>
 #endif
 
 #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
index 4f2495e..50e79a6 100644 (file)
@@ -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);
index 82abafe..3d06058 100644 (file)
 #  include "config.h"
 #endif
 
+/* FIXME: hack alert */
+#ifdef _MSC_VER
+#define DISABLE_FAULT_HANDLER
+#endif
+
 #include <string.h>
 #include <stdlib.h>
 #include <signal.h>
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
+#ifndef DISABLE_FAULT_HANDLER
 #include <sys/wait.h>
+#endif
 #include <locale.h>             /* for LC_ALL */
 #include "gst/gst-i18n-app.h"
 
 #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 ()) {
index ca49f8c..84e35ba 100644 (file)
@@ -6,6 +6,7 @@
 #include <gst/control/control.h>
 #include <string.h>
 #include <locale.h>
+#include <glib/gprintf.h>
 
 #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