From e1b5b7485788a65dbdf921509e64b95c42f6aec0 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 30 May 2005 15:51:40 +0000 Subject: [PATCH] gst/: Move elementfactory methods to separate .h file. Original commit message from CVS: * gst/Makefile.am: * gst/gstelement.h: * gst/gstelementfactory.h: * gst/gsttypes.h: Move elementfactory methods to separate .h file. --- ChangeLog | 8 +++ gst/Makefile.am | 1 + gst/gstelement.h | 114 ++++---------------------------------- gst/gstelementfactory.h | 118 ++++++++++++++++++++++++++++++++++++++++ gst/gsttypes.h | 21 +++---- 5 files changed, 147 insertions(+), 115 deletions(-) create mode 100644 gst/gstelementfactory.h diff --git a/ChangeLog b/ChangeLog index 2d8745c99a..c6c39bf95a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2005-05-30 Wim Taymans + + * gst/Makefile.am: + * gst/gstelement.h: + * gst/gstelementfactory.h: + * gst/gsttypes.h: + Move elementfactory methods to separate .h file. + 2005-05-30 Wim Taymans * docs/design/part-overview.txt: diff --git a/gst/Makefile.am b/gst/Makefile.am index 02737b3a78..e4ba8d1874 100644 --- a/gst/Makefile.am +++ b/gst/Makefile.am @@ -158,6 +158,7 @@ gst_headers = \ gstclock.h \ gstcompat.h \ gstelement.h \ + gstelementfactory.h \ gsterror.h \ gstevent.h \ gstfilter.h \ diff --git a/gst/gstelement.h b/gst/gstelement.h index 5b56ed0101..289d21cc7c 100644 --- a/gst/gstelement.h +++ b/gst/gstelement.h @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -38,29 +39,17 @@ G_BEGIN_DECLS -typedef struct _GstElementDetails GstElementDetails; +GST_EXPORT GType _gst_element_type; -/* FIXME: need translatable stuff in here (how handle in registry)? */ -struct _GstElementDetails -{ - /*< public > */ - gchar *longname; /* long, english name */ - gchar *klass; /* type of element, as hierarchy */ - gchar *description; /* insights of one form or another */ - gchar *author; /* who wrote this thing? */ - - /*< private > */ - gpointer _gst_reserved[GST_PADDING]; -}; - -#define GST_ELEMENT_DETAILS(longname,klass,description,author) \ - { longname, klass, description, author, GST_PADDING_INIT } -#define GST_IS_ELEMENT_DETAILS(details) ( \ - (details) && ((details)->longname != NULL) && ((details)->klass != NULL) \ - && ((details)->description != NULL) && ((details)->author != NULL)) +#define GST_TYPE_ELEMENT (_gst_element_type) +#define GST_IS_ELEMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_ELEMENT)) +#define GST_IS_ELEMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_ELEMENT)) +#define GST_ELEMENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_ELEMENT, GstElementClass)) +#define GST_ELEMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_ELEMENT, GstElement)) +#define GST_ELEMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_ELEMENT, GstElementClass)) +#define GST_ELEMENT_CAST(obj) ((GstElement*)(obj)) #define GST_NUM_STATES 4 - /* NOTE: this probably should be done with an #ifdef to decide * whether to safe-cast or to just do the non-checking cast. */ @@ -77,16 +66,6 @@ struct _GstElementDetails #define GST_STATE_PAUSED_TO_READY ((GST_STATE_PAUSED<<8) | GST_STATE_READY) #define GST_STATE_READY_TO_NULL ((GST_STATE_READY<<8) | GST_STATE_NULL) -GST_EXPORT GType _gst_element_type; - -#define GST_TYPE_ELEMENT (_gst_element_type) -#define GST_IS_ELEMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_ELEMENT)) -#define GST_IS_ELEMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_ELEMENT)) -#define GST_ELEMENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_ELEMENT, GstElementClass)) -#define GST_ELEMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_ELEMENT, GstElement)) -#define GST_ELEMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_ELEMENT, GstElementClass)) -#define GST_ELEMENT_CAST(obj) ((GstElement*)(obj)) - /* convenience functions */ #ifdef G_HAVE_ISO_VARARGS #define GST_ELEMENT_QUERY_TYPE_FUNCTION(functionname, ...) \ @@ -181,9 +160,6 @@ G_STMT_START { \ #define GST_STATE_SIGNAL(elem) g_cond_signal (GST_STATE_GET_COND (elem)); #define GST_STATE_BROADCAST(elem) g_cond_broadcast (GST_STATE_GET_COND (elem)); -typedef struct _GstElementFactory GstElementFactory; -typedef struct _GstElementFactoryClass GstElementFactoryClass; - struct _GstElement { GstObject object; @@ -198,11 +174,9 @@ struct _GstElement change. it is cleared when doing another state change. */ /*< public >*/ /* with LOCK */ /* element manager */ - GstPipeline *manager; - GstBus *bus; + GstPipeline *manager; + GstBus *bus; GstScheduler *scheduler; - /* private pointer for the scheduler */ - gpointer sched_private; /* allocated clock */ GstClock *clock; @@ -363,72 +337,6 @@ void gst_element_lost_state (GstElement * element); /* factory management */ GstElementFactory* gst_element_get_factory (GstElement *element); -/* - * - * factories stuff - * - **/ - -#define GST_TYPE_ELEMENT_FACTORY (gst_element_factory_get_type()) -#define GST_ELEMENT_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_ELEMENT_FACTORY,\ - GstElementFactory)) -#define GST_ELEMENT_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_ELEMENT_FACTORY,\ - GstElementFactoryClass)) -#define GST_IS_ELEMENT_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ELEMENT_FACTORY)) -#define GST_IS_ELEMENT_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_ELEMENT_FACTORY)) - -struct _GstElementFactory { - GstPluginFeature parent; - - GType type; /* unique GType of element or 0 if not loaded */ - - GstElementDetails details; - - GList * staticpadtemplates; - guint numpadtemplates; - - /* URI interface stuff */ - guint uri_type; - gchar ** uri_protocols; - - GList * interfaces; /* interfaces this element implements */ - - gpointer _gst_reserved[GST_PADDING]; -}; - -struct _GstElementFactoryClass { - GstPluginFeatureClass parent_class; - - gpointer _gst_reserved[GST_PADDING]; -}; - -GType gst_element_factory_get_type (void); - -gboolean gst_element_register (GstPlugin *plugin, - const gchar *name, - guint rank, - GType type); - -GstElementFactory * gst_element_factory_find (const gchar *name); -GType gst_element_factory_get_element_type (GstElementFactory *factory); -G_CONST_RETURN gchar * gst_element_factory_get_longname (GstElementFactory *factory); -G_CONST_RETURN gchar * gst_element_factory_get_klass (GstElementFactory *factory); -G_CONST_RETURN gchar * gst_element_factory_get_description (GstElementFactory *factory); -G_CONST_RETURN gchar * gst_element_factory_get_author (GstElementFactory *factory); -guint gst_element_factory_get_num_pad_templates (GstElementFactory *factory); -G_CONST_RETURN GList * gst_element_factory_get_static_pad_templates (GstElementFactory *factory); -guint gst_element_factory_get_uri_type (GstElementFactory *factory); -gchar ** gst_element_factory_get_uri_protocols (GstElementFactory *factory); - -GstElement* gst_element_factory_create (GstElementFactory *factory, - const gchar *name); -GstElement* gst_element_factory_make (const gchar *factoryname, const gchar *name); - -void __gst_element_factory_add_static_pad_template (GstElementFactory *elementfactory, - GstStaticPadTemplate *templ); -void __gst_element_factory_add_interface (GstElementFactory *elementfactory, - const gchar *interfacename); - G_END_DECLS #endif /* __GST_ELEMENT_H__ */ diff --git a/gst/gstelementfactory.h b/gst/gstelementfactory.h new file mode 100644 index 0000000000..8aadec5308 --- /dev/null +++ b/gst/gstelementfactory.h @@ -0,0 +1,118 @@ +/* GStreamer + * Copyright (C) 1999,2000 Erik Walthinsen + * 2000,2004 Wim Taymans + * + * gstelement.h: Header for GstElement + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + + +#ifndef __GST_ELEMENT_FACTORY_H__ +#define __GST_ELEMENT_FACTORY_H__ + +#include +#include +#include +#include +#include +#include +#include + +G_BEGIN_DECLS + +/* FIXME: need translatable stuff in here (how handle in registry)? */ +struct _GstElementDetails +{ + /*< public > */ + gchar *longname; /* long, english name */ + gchar *klass; /* type of element, as hierarchy */ + gchar *description; /* insights of one form or another */ + gchar *author; /* who wrote this thing? */ + + /*< private > */ + gpointer _gst_reserved[GST_PADDING]; +}; + +#define GST_ELEMENT_DETAILS(longname,klass,description,author) \ + { longname, klass, description, author, GST_PADDING_INIT } +#define GST_IS_ELEMENT_DETAILS(details) ( \ + (details) && ((details)->longname != NULL) && ((details)->klass != NULL) \ + && ((details)->description != NULL) && ((details)->author != NULL)) + +#define GST_TYPE_ELEMENT_FACTORY (gst_element_factory_get_type()) +#define GST_ELEMENT_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_ELEMENT_FACTORY,\ + GstElementFactory)) +#define GST_ELEMENT_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_ELEMENT_FACTORY,\ + GstElementFactoryClass)) +#define GST_IS_ELEMENT_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ELEMENT_FACTORY)) +#define GST_IS_ELEMENT_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_ELEMENT_FACTORY)) + +struct _GstElementFactory { + GstPluginFeature parent; + + GType type; /* unique GType of element or 0 if not loaded */ + + GstElementDetails details; + + GList * staticpadtemplates; + guint numpadtemplates; + + /* URI interface stuff */ + guint uri_type; + gchar ** uri_protocols; + + GList * interfaces; /* interfaces this element implements */ + + gpointer _gst_reserved[GST_PADDING]; +}; + +struct _GstElementFactoryClass { + GstPluginFeatureClass parent_class; + + gpointer _gst_reserved[GST_PADDING]; +}; + +GType gst_element_factory_get_type (void); + +GstElementFactory * gst_element_factory_find (const gchar *name); + +GType gst_element_factory_get_element_type (GstElementFactory *factory); +G_CONST_RETURN gchar * gst_element_factory_get_longname (GstElementFactory *factory); +G_CONST_RETURN gchar * gst_element_factory_get_klass (GstElementFactory *factory); +G_CONST_RETURN gchar * gst_element_factory_get_description (GstElementFactory *factory); +G_CONST_RETURN gchar * gst_element_factory_get_author (GstElementFactory *factory); +guint gst_element_factory_get_num_pad_templates (GstElementFactory *factory); +G_CONST_RETURN GList * gst_element_factory_get_static_pad_templates (GstElementFactory *factory); +guint gst_element_factory_get_uri_type (GstElementFactory *factory); +gchar ** gst_element_factory_get_uri_protocols (GstElementFactory *factory); + +GstElement* gst_element_factory_create (GstElementFactory *factory, + const gchar *name); +GstElement* gst_element_factory_make (const gchar *factoryname, const gchar *name); + +void __gst_element_factory_add_static_pad_template (GstElementFactory *elementfactory, + GstStaticPadTemplate *templ); +void __gst_element_factory_add_interface (GstElementFactory *elementfactory, + const gchar *interfacename); +gboolean gst_element_register (GstPlugin *plugin, const gchar *name, + guint rank, GType type); + + + +G_END_DECLS + +#endif /* __GST_ELEMENT_FACTORY_H__ */ diff --git a/gst/gsttypes.h b/gst/gsttypes.h index dcc13c682a..8b369a769b 100644 --- a/gst/gsttypes.h +++ b/gst/gsttypes.h @@ -24,20 +24,23 @@ G_BEGIN_DECLS +typedef struct _GstBin GstBin; +typedef struct _GstBinClass GstBinClass; +typedef struct _GstBus GstBus; +typedef struct _GstBusClass GstBusClass; +typedef struct _GstElement GstElement; +typedef struct _GstElementClass GstElementClass; +typedef struct _GstElementDetails GstElementDetails; +typedef struct _GstElementFactory GstElementFactory; +typedef struct _GstElementFactoryClass GstElementFactoryClass; typedef struct _GstObject GstObject; typedef struct _GstObjectClass GstObjectClass; typedef struct _GstPad GstPad; typedef struct _GstPadClass GstPadClass; typedef struct _GstPadTemplate GstPadTemplate; typedef struct _GstPadTemplateClass GstPadTemplateClass; -typedef struct _GstElement GstElement; -typedef struct _GstElementClass GstElementClass; -typedef struct _GstBin GstBin; -typedef struct _GstBinClass GstBinClass; typedef struct _GstPipeline GstPipeline; typedef struct _GstPipelineClass GstPipelineClass; -typedef struct _GstBus GstBus; -typedef struct _GstBusClass GstBusClass; typedef struct _GstScheduler GstScheduler; typedef struct _GstSchedulerClass GstSchedulerClass; @@ -55,12 +58,6 @@ typedef enum { GST_STATE_ASYNC = 2 } GstElementStateReturn; -typedef enum { - GST_RESULT_OK, - GST_RESULT_NOK, - GST_RESULT_NOT_IMPL -} GstResult; - typedef enum { GST_RANK_NONE = 0, GST_RANK_MARGINAL = 64,