reworked things to fully deal with having XML disabled

Original commit message from CVS:
reworked things to fully deal with having XML disabled
This commit is contained in:
Erik Walthinsen 2001-10-01 19:41:03 +00:00
parent e68dc8f315
commit 95fae173f7
12 changed files with 75 additions and 62 deletions

View file

@ -160,6 +160,7 @@ libgstincludedir = $(includedir)/gst
libgstinclude_HEADERS = \ libgstinclude_HEADERS = \
cothreads.h \ cothreads.h \
gst.h \ gst.h \
gstconfig.h \
$(GST_OBJECT_MODEL_HDR) \ $(GST_OBJECT_MODEL_HDR) \
gstobject.h \ gstobject.h \
gsttypes.h \ gsttypes.h \

View file

@ -430,7 +430,7 @@ gst_autoplugger_cache_empty(GstElement *element, GstAutoplugger *autoplugger)
// try to PLAY the whole thing // try to PLAY the whole thing
gst_element_set_state(GST_ELEMENT_SCHED(autoplugger)->parent,GST_STATE_PLAYING); gst_element_set_state(GST_ELEMENT_SCHED(autoplugger)->parent,GST_STATE_PLAYING);
xmlSaveFile("autoplugger.gst", gst_xml_write(GST_ELEMENT_SCHED(autoplugger)->parent)); // xmlSaveFile("autoplugger.gst", gst_xml_write(GST_ELEMENT_SCHED(autoplugger)->parent));
GST_INFO(GST_CAT_AUTOPLUG, "autoplugger_cache_empty finished"); GST_INFO(GST_CAT_AUTOPLUG, "autoplugger_cache_empty finished");
} }

View file

@ -21,6 +21,9 @@
*/ */
//#define GST_DEBUG_ENABLED //#define GST_DEBUG_ENABLED
#include <gst/gstconfig.h>
#include "gst_private.h" #include "gst_private.h"
#include "gstautoplug.h" #include "gstautoplug.h"
@ -167,8 +170,10 @@ gst_autoplug_to_renderers (GstAutoplug *autoplug, GstCaps *srccaps, GstElement *
static void gst_autoplugfactory_class_init (GstAutoplugFactoryClass *klass); static void gst_autoplugfactory_class_init (GstAutoplugFactoryClass *klass);
static void gst_autoplugfactory_init (GstAutoplugFactory *factory); static void gst_autoplugfactory_init (GstAutoplugFactory *factory);
#ifndef GST_DISABLE_LOADSAVE
static xmlNodePtr gst_autoplugfactory_save_thyself (GstObject *object, xmlNodePtr parent); static xmlNodePtr gst_autoplugfactory_save_thyself (GstObject *object, xmlNodePtr parent);
static void gst_autoplugfactory_restore_thyself (GstObject *object, xmlNodePtr parent); static void gst_autoplugfactory_restore_thyself (GstObject *object, xmlNodePtr parent);
#endif
static GstPluginFeatureClass *factory_parent_class = NULL; static GstPluginFeatureClass *factory_parent_class = NULL;
//static guint gst_autoplugfactory_signals[LAST_SIGNAL] = { 0 }; //static guint gst_autoplugfactory_signals[LAST_SIGNAL] = { 0 };
@ -209,8 +214,10 @@ gst_autoplugfactory_class_init (GstAutoplugFactoryClass *klass)
factory_parent_class = g_type_class_ref (GST_TYPE_PLUGIN_FEATURE); factory_parent_class = g_type_class_ref (GST_TYPE_PLUGIN_FEATURE);
#ifndef GST_DISABLE_LOADSAVE
gstobject_class->save_thyself = GST_DEBUG_FUNCPTR (gst_autoplugfactory_save_thyself); gstobject_class->save_thyself = GST_DEBUG_FUNCPTR (gst_autoplugfactory_save_thyself);
gstobject_class->restore_thyself = GST_DEBUG_FUNCPTR (gst_autoplugfactory_restore_thyself); gstobject_class->restore_thyself = GST_DEBUG_FUNCPTR (gst_autoplugfactory_restore_thyself);
#endif
_gst_autoplugfactories = NULL; _gst_autoplugfactories = NULL;
} }
@ -359,6 +366,7 @@ gst_autoplugfactory_make (const gchar *name)
return gst_autoplugfactory_create (factory);; return gst_autoplugfactory_create (factory);;
} }
#ifndef GST_DISABLE_LOADSAVE
static xmlNodePtr static xmlNodePtr
gst_autoplugfactory_save_thyself (GstObject *object, xmlNodePtr parent) gst_autoplugfactory_save_thyself (GstObject *object, xmlNodePtr parent)
{ {
@ -405,3 +413,4 @@ gst_autoplugfactory_restore_thyself (GstObject *object, xmlNodePtr parent)
children = children->next; children = children->next;
} }
} }
#endif

View file

@ -444,8 +444,6 @@ gst_buffer_span (GstBuffer *buf1, guint32 offset, GstBuffer *buf2, guint32 len)
} }
// if the two buffers have the same parent and are adjacent // if the two buffers have the same parent and are adjacent
// if ((buf1->parent == buf2->parent) &&
// ((buf1->data + buf1->size) == buf2->data)) {
if (gst_buffer_is_span_fast(buf1,buf2)) { if (gst_buffer_is_span_fast(buf1,buf2)) {
// we simply create a subbuffer of the common parent // we simply create a subbuffer of the common parent
newbuf = gst_buffer_create_sub (buf1->parent, buf1->data - (buf1->parent->data) + offset, len); newbuf = gst_buffer_create_sub (buf1->parent, buf1->data - (buf1->parent->data) + offset, len);

View file

@ -24,14 +24,7 @@
#ifndef __GST_CAPS_H__ #ifndef __GST_CAPS_H__
#define __GST_CAPS_H__ #define __GST_CAPS_H__
#include <parser.h> // NOTE: this is xml-config's fault #include <gst/gstconfig.h>
// Include compatability defines: if libxml hasn't already defined these,
// we have an old version 1.x
#ifndef xmlChildrenNode
#define xmlChildrenNode childs
#define xmlRootNode root
#endif
#include <gst/gstprops.h> #include <gst/gstprops.h>
@ -118,7 +111,9 @@ GstCaps* gst_caps_prepend (GstCaps *caps, GstCaps *capstoadd);
gboolean gst_caps_check_compatibility (GstCaps *fromcaps, GstCaps *tocaps); gboolean gst_caps_check_compatibility (GstCaps *fromcaps, GstCaps *tocaps);
#ifndef GST_DISABLE_LOADSAVE
xmlNodePtr gst_caps_save_thyself (GstCaps *caps, xmlNodePtr parent); xmlNodePtr gst_caps_save_thyself (GstCaps *caps, xmlNodePtr parent);
GstCaps* gst_caps_load_thyself (xmlNodePtr parent); GstCaps* gst_caps_load_thyself (xmlNodePtr parent);
#endif
#endif /* __GST_CAPS_H__ */ #endif /* __GST_CAPS_H__ */

36
gst/gstconfig.h Normal file
View file

@ -0,0 +1,36 @@
/* This header interprets the various GST_* macros that are typically *
* provided by the gstreamer-config or gstreamer.pc files. */
#ifndef __GST_CONFIG_H__
#define __GST_CONFIG_H__
/***** We include config.h in case someone perhaps used a gstreamer.m4 or
something else that provides funky overrides. BEWARE! *****/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
/***** Deal with XML stuff, we have to handle both loadsave and registry *****/
// TEMPORARY!!
#define GST_DISABLE_LOADSAVE
#define GST_DISABLE_REGISTRY
#if (! (defined(GST_DISABLE_LOADSAVE) && defined(GST_DISABLE_REGISTRY)) )
#include <parser.h>
// Include compatability defines: if libxml hasn't already defined these,
// we have an old version 1.x
#ifndef xmlChildrenNode
#define xmlChildrenNode childs
#define xmlRootNode root
#endif
#else
#define GST_DISABLE_LOADSAVE_REGISTRY
#endif
#endif /* __GST_CONFIG_H__ */

View file

@ -24,14 +24,7 @@
#ifndef __GST_ELEMENT_H__ #ifndef __GST_ELEMENT_H__
#define __GST_ELEMENT_H__ #define __GST_ELEMENT_H__
#include <parser.h> // NOTE: this is xml-config's fault #include <gst/gstconfig.h>
// Include compatability defines: if libxml hasn't already defined these,
// we have an old version 1.x
#ifndef xmlChildrenNode
#define xmlChildrenNode childs
#define xmlRootNode root
#endif
#include <gst/gstobject.h> #include <gst/gstobject.h>
#include <gst/gstpad.h> #include <gst/gstpad.h>
@ -234,8 +227,10 @@ void gst_element_error (GstElement *element, const gchar *error);
GstElementFactory* gst_element_get_factory (GstElement *element); GstElementFactory* gst_element_get_factory (GstElement *element);
#ifndef GST_DISABLE_LOADSAVE
/* XML write and read */ /* XML write and read */
GstElement* gst_element_restore_thyself (xmlNodePtr self, GstObject *parent); GstElement* gst_element_restore_thyself (xmlNodePtr self, GstObject *parent);
#endif
/* /*

View file

@ -24,10 +24,7 @@
#ifndef __GST_OBJECT_H__ #ifndef __GST_OBJECT_H__
#define __GST_OBJECT_H__ #define __GST_OBJECT_H__
#ifdef HAVE_CONFIG_H #include <gst/gstconfig.h>
#include "config.h"
#endif
#ifdef USE_GLIB2 #ifdef USE_GLIB2
#include <glib-object.h> // note that this gets wrapped in __GST_OBJECT_H__ #include <glib-object.h> // note that this gets wrapped in __GST_OBJECT_H__
@ -36,15 +33,13 @@
#include <gst/gobject2gtk.h> #include <gst/gobject2gtk.h>
#endif #endif
#include <gst/gsttrace.h>
#include <parser.h>
#include <gst/gsttypes.h>
#ifdef HAVE_ATOMIC_H #ifdef HAVE_ATOMIC_H
#include <asm/atomic.h> #include <asm/atomic.h>
#endif #endif
#include <gst/gsttrace.h>
#include <gst/gsttypes.h>
// FIXME // FIXME
#include "gstlog.h" #include "gstlog.h"
@ -107,13 +102,17 @@ struct _GstObjectClass {
/* signals */ /* signals */
void (*parent_set) (GstObject *object, GstObject *parent); void (*parent_set) (GstObject *object, GstObject *parent);
#ifndef GST_DISABLE_LOADSAVE
void (*object_saved) (GstObject *object, xmlNodePtr parent); void (*object_saved) (GstObject *object, xmlNodePtr parent);
#endif
/* functions go here */ /* functions go here */
void (*destroy) (GstObject *object); void (*destroy) (GstObject *object);
#ifndef GST_DISABLE_LOADSAVE
xmlNodePtr (*save_thyself) (GstObject *object, xmlNodePtr parent); xmlNodePtr (*save_thyself) (GstObject *object, xmlNodePtr parent);
void (*restore_thyself) (GstObject *object, xmlNodePtr self); void (*restore_thyself) (GstObject *object, xmlNodePtr self);
#endif
}; };
#define GST_FLAGS(obj) (GST_OBJECT (obj)->flags) #define GST_FLAGS(obj) (GST_OBJECT (obj)->flags)
@ -153,6 +152,7 @@ xmlNodePtr gst_object_save_thyself (GstObject *object, xmlNodePtr parent);
void gst_object_restore_thyself (GstObject *object, xmlNodePtr parent); void gst_object_restore_thyself (GstObject *object, xmlNodePtr parent);
#else #else
#pragma GCC poison gst_object_save_thyself #pragma GCC poison gst_object_save_thyself
#pragma GCC poison gst_object_restore_thyself
#endif #endif
/* refcounting */ /* refcounting */

View file

@ -24,14 +24,7 @@
#ifndef __GST_PAD_H__ #ifndef __GST_PAD_H__
#define __GST_PAD_H__ #define __GST_PAD_H__
#include <parser.h> // NOTE: This is xml-config's fault #include <gst/gstconfig.h>
// Include compatability defines: if libxml hasn't already defined these,
// we have an old version 1.x
#ifndef xmlChildrenNode
#define xmlChildrenNode childs
#define xmlRootNode root
#endif
#include <gst/gstobject.h> #include <gst/gstobject.h>
#include <gst/gstbuffer.h> #include <gst/gstbuffer.h>
@ -424,7 +417,9 @@ GstBuffer* gst_pad_peek (GstPad *pad);
GstPad* gst_pad_select (GList *padlist); GstPad* gst_pad_select (GList *padlist);
GstPad* gst_pad_selectv (GstPad *pad, ...); GstPad* gst_pad_selectv (GstPad *pad, ...);
#ifndef GST_DISABLE_LOADSAVE
void gst_pad_load_and_connect (xmlNodePtr self, GstObject *parent); void gst_pad_load_and_connect (xmlNodePtr self, GstObject *parent);
#endif
/* ghostpads */ /* ghostpads */
@ -441,8 +436,10 @@ GstPadTemplate* gst_padtemplate_new (gchar *name_template,
GstCaps* gst_padtemplate_get_caps (GstPadTemplate *templ); GstCaps* gst_padtemplate_get_caps (GstPadTemplate *templ);
GstCaps* gst_padtemplate_get_caps_by_name (GstPadTemplate *templ, const gchar *name); GstCaps* gst_padtemplate_get_caps_by_name (GstPadTemplate *templ, const gchar *name);
#ifndef GST_DISABLE_LOADSAVE
xmlNodePtr gst_padtemplate_save_thyself (GstPadTemplate *templ, xmlNodePtr parent); xmlNodePtr gst_padtemplate_save_thyself (GstPadTemplate *templ, xmlNodePtr parent);
GstPadTemplate* gst_padtemplate_load_thyself (xmlNodePtr parent); GstPadTemplate* gst_padtemplate_load_thyself (xmlNodePtr parent);
#endif
#ifdef __cplusplus #ifdef __cplusplus

View file

@ -24,15 +24,9 @@
#ifndef __GST_PLUGIN_H__ #ifndef __GST_PLUGIN_H__
#define __GST_PLUGIN_H__ #define __GST_PLUGIN_H__
#include <gmodule.h> #include <gst/gstconfig.h>
#include <parser.h> // NOTE: this is xml-config's fault
// Include compatability defines: if libxml hasn't already defined these, #include <gmodule.h>
// we have an old version 1.x
#ifndef xmlChildrenNode
#define xmlChildrenNode childs
#define xmlRootNode root
#endif
#include <gst/gstpluginfeature.h> #include <gst/gstpluginfeature.h>

View file

@ -24,16 +24,9 @@
#ifndef __GST_PROPS_H__ #ifndef __GST_PROPS_H__
#define __GST_PROPS_H__ #define __GST_PROPS_H__
#include <gst/gstconfig.h>
#include <glib.h> #include <glib.h>
#include <parser.h> // NOTE: this is xml-config's fault
// Include compatability defines: if libxml hasn't already defined these,
// we have an old version 1.x
#ifndef xmlChildrenNode
#define xmlChildrenNode childs
#define xmlRootNode root
#endif
typedef struct _GstProps GstProps; typedef struct _GstProps GstProps;
@ -95,7 +88,9 @@ gulong gst_props_get_fourcc_int (GstProps *props, const gchar *name);
gboolean gst_props_get_boolean (GstProps *props, const gchar *name); gboolean gst_props_get_boolean (GstProps *props, const gchar *name);
const gchar* gst_props_get_string (GstProps *props, const gchar *name); const gchar* gst_props_get_string (GstProps *props, const gchar *name);
#ifndef GST_DISABLE_LOADSAVE
xmlNodePtr gst_props_save_thyself (GstProps *props, xmlNodePtr parent); xmlNodePtr gst_props_save_thyself (GstProps *props, xmlNodePtr parent);
GstProps* gst_props_load_thyself (xmlNodePtr parent); GstProps* gst_props_load_thyself (xmlNodePtr parent);
#endif
#endif /* __GST_PROPS_H__ */ #endif /* __GST_PROPS_H__ */

View file

@ -23,17 +23,10 @@
#ifndef __GST_XML_H__ #ifndef __GST_XML_H__
#define __GST_XML_H__ #define __GST_XML_H__
#include <gst/gstconfig.h>
#ifndef GST_DISABLE_LOADSAVE #ifndef GST_DISABLE_LOADSAVE
#include <parser.h>
// Include compatability defines: if libxml hasn't already defined these,
// we have an old version 1.x
#ifndef xmlChildrenNode
#define xmlChildrenNode childs
#define xmlRootNode root
#endif
#include <gst/gstelement.h> #include <gst/gstelement.h>
#ifdef __cplusplus #ifdef __cplusplus