From 44b4312d961bfed19e99f744a2e02f48a6b80172 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 7 Jun 2011 13:25:26 +0200 Subject: [PATCH] fix some circular includes typedef some structs before including other files to avoid circular dependencies in the header files. --- gst/gstelement.h | 1 + gst/gstelementfactory.h | 1 + gst/gstevent.h | 9 ++++++++- gst/gstmessage.h | 1 + gst/gstpad.h | 39 +++++++++++++++++++-------------------- gst/gstpadtemplate.h | 9 ++++----- gst/gstutils.c | 1 - gst/gstutils.h | 12 ------------ 8 files changed, 34 insertions(+), 39 deletions(-) diff --git a/gst/gstelement.h b/gst/gstelement.h index e05b859..8ffd6ed 100644 --- a/gst/gstelement.h +++ b/gst/gstelement.h @@ -64,6 +64,7 @@ typedef enum { #include #include #include +#include #include G_BEGIN_DECLS diff --git a/gst/gstelementfactory.h b/gst/gstelementfactory.h index 8f648e0..323aa7a 100644 --- a/gst/gstelementfactory.h +++ b/gst/gstelementfactory.h @@ -32,6 +32,7 @@ typedef struct _GstElementFactoryClass GstElementFactoryClass; #include #include #include +#include #include G_BEGIN_DECLS diff --git a/gst/gstevent.h b/gst/gstevent.h index 8ed06e6..0e22b3c 100644 --- a/gst/gstevent.h +++ b/gst/gstevent.h @@ -25,6 +25,8 @@ #ifndef __GST_EVENT_H__ #define __GST_EVENT_H__ +typedef struct _GstEvent GstEvent; + #include #include #include @@ -32,12 +34,13 @@ #include #include #include +#include +#include G_BEGIN_DECLS extern GType _gst_event_type; -typedef struct _GstEvent GstEvent; #define GST_TYPE_EVENT (_gst_event_type) #define GST_IS_EVENT(obj) (GST_IS_MINI_OBJECT_TYPE (obj, GST_TYPE_EVENT)) @@ -422,6 +425,10 @@ GstEvent * gst_event_new_buffer_size (GstFormat format, gint64 minsiz void gst_event_parse_buffer_size (GstEvent *event, GstFormat *format, gint64 *minsize, gint64 *maxsize, gboolean *async); +/* sink message */ +GstEvent* gst_event_new_sink_message (GstMessage *msg); +void gst_event_parse_sink_message (GstEvent *event, GstMessage **msg); + /* QOS events */ GstEvent* gst_event_new_qos (GstQOSType type, gdouble proportion, GstClockTimeDiff diff, GstClockTime timestamp); diff --git a/gst/gstmessage.h b/gst/gstmessage.h index 7d8de66..c93e413 100644 --- a/gst/gstmessage.h +++ b/gst/gstmessage.h @@ -132,6 +132,7 @@ typedef enum #include #include #include +#include /** * GST_MESSAGE_TRACE_NAME: diff --git a/gst/gstpad.h b/gst/gstpad.h index 349f075..93fef63 100644 --- a/gst/gstpad.h +++ b/gst/gstpad.h @@ -26,10 +26,29 @@ #include +typedef struct _GstPad GstPad; +typedef struct _GstPadPrivate GstPadPrivate; +typedef struct _GstPadClass GstPadClass; + +/** + * GstPadDirection: + * @GST_PAD_UNKNOWN: direction is unknown. + * @GST_PAD_SRC: the pad is a source pad. + * @GST_PAD_SINK: the pad is a sink pad. + * + * The direction of a pad. + */ +typedef enum { + GST_PAD_UNKNOWN, + GST_PAD_SRC, + GST_PAD_SINK +} GstPadDirection; + #include #include #include #include +#include #include #include #include @@ -47,9 +66,6 @@ G_BEGIN_DECLS #define GST_PAD_CAST(obj) ((GstPad*)(obj)) -typedef struct _GstPad GstPad; -typedef struct _GstPadPrivate GstPadPrivate; -typedef struct _GstPadClass GstPadClass; /** * GstPadLinkReturn: @@ -549,20 +565,6 @@ typedef GstProbeReturn (*GstPadProbeCallback) (GstPad *pad, Gs typedef GstFlowReturn (*GstPadStickyEventsForeachFunction) (GstPad *pad, GstEvent *event, gpointer user_data); /** - * GstPadDirection: - * @GST_PAD_UNKNOWN: direction is unknown. - * @GST_PAD_SRC: the pad is a source pad. - * @GST_PAD_SINK: the pad is a sink pad. - * - * The direction of a pad. - */ -typedef enum { - GST_PAD_UNKNOWN, - GST_PAD_SRC, - GST_PAD_SINK -} GstPadDirection; - -/** * GstPadFlags: * @GST_PAD_BLOCKED: is dataflow on a pad blocked * @GST_PAD_FLUSHING: is pad refusing buffers @@ -594,9 +596,6 @@ typedef enum { GST_PAD_FLAG_LAST = (GST_OBJECT_FLAG_LAST << 16) } GstPadFlags; -/* FIXME: this awful circular dependency need to be resolved properly (see padtemplate.h) */ -typedef struct _GstPadTemplate GstPadTemplate; - /** * GstPad: * @element_private: private data owned by the parent element diff --git a/gst/gstpadtemplate.h b/gst/gstpadtemplate.h index e8e5921..bc2bcee 100644 --- a/gst/gstpadtemplate.h +++ b/gst/gstpadtemplate.h @@ -26,6 +26,10 @@ #include +typedef struct _GstPadTemplate GstPadTemplate; +typedef struct _GstPadTemplateClass GstPadTemplateClass; +typedef struct _GstStaticPadTemplate GstStaticPadTemplate; + #include #include #include @@ -35,11 +39,6 @@ G_BEGIN_DECLS -/* FIXME: this awful circular dependency need to be resolved properly (see pad.h) */ -/*typedef struct _GstPadTemplate GstPadTemplate; */ -typedef struct _GstPadTemplateClass GstPadTemplateClass; -typedef struct _GstStaticPadTemplate GstStaticPadTemplate; - #define GST_TYPE_STATIC_PAD_TEMPLATE (gst_static_pad_template_get_type ()) #define GST_TYPE_PAD_TEMPLATE (gst_pad_template_get_type ()) diff --git a/gst/gstutils.c b/gst/gstutils.c index 0c3ed81..21a0b5a 100644 --- a/gst/gstutils.c +++ b/gst/gstutils.c @@ -25,7 +25,6 @@ * SECTION:gstutils * @short_description: Various utility functions * - * When defining own plugins, use the GST_BOILERPLATE ease gobject creation. */ #include "gst_private.h" diff --git a/gst/gstutils.h b/gst/gstutils.h index f48b630..a838eee 100644 --- a/gst/gstutils.h +++ b/gst/gstutils.h @@ -817,18 +817,6 @@ gboolean gst_util_fraction_add (gint a_n, gint a_d, gint b_n, gint b_d, gint *re gint gst_util_fraction_compare (gint a_n, gint a_d, gint b_n, gint b_d); -/* sink message event - * - * FIXME: This should be in gstevent.h but can't because - * it needs GstMessage and this would introduce circular - * header includes. And forward declarations of typedefs - * are unfortunately not possible. The implementation of - * these functions is in gstevent.c. - */ -GstEvent* gst_event_new_sink_message (GstMessage *msg); -void gst_event_parse_sink_message (GstEvent *event, GstMessage **msg); - - G_END_DECLS #endif /* __GST_UTILS_H__ */ -- 2.7.4