Commit a63780a3 authored by Wim Taymans's avatar Wim Taymans

Header cleanup: try to include as little as possible; this will probably speed...

Header cleanup: try to include as little as possible; this will probably speed up compilation a bit.

Original commit message from CVS:
Header cleanup: try to include as little as possible; this will probably
speed up compilation a bit.
changed the .c files to use #include "..."
Fix for the 'plugins are loaded twice' bug.
Fix 22186: GstObject flags are now used everywhere. Added *_FLAG_LAST so
elements do not use the same flags. Added some padding in the flag enum
for future expansion.
parent f8386fba
......@@ -83,7 +83,7 @@ noinst_HEADERS = \
gsti386.h \
gstppc.h
CFLAGS += -g -O6 -Wall
CFLAGS += -O6 -Wall
libgst_la_LIBADD = $(GLIB_LIBS) $(GTK_LIBS) $(XML_LIBS)
libgst_la_LDFLAGS = -version-info $(STREAMER_CURRENT):$(STREAMER_REVISION):$(STREAMER_AGE)
......
......@@ -18,8 +18,6 @@
*/
#include <pthread.h>
#include <sys/time.h>
#include <linux/linkage.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
......@@ -30,9 +28,9 @@
/* we make too much noise for normal debugging... */
#define GST_DEBUG_FORCE_DISABLE
#include <gst/gst.h>
#include <gst/cothreads.h>
#include <gst/gstarch.h>
#include "gstdebug.h"
#include "cothreads.h"
#include "gstarch.h"
pthread_key_t _cothread_key = -1;
......
......@@ -22,7 +22,6 @@
#include <glib.h>
#include <setjmp.h>
#include <pthread.h>
#define COTHREAD_STACKSIZE 8192
#define COTHREAD_MAXTHREADS 16
......
......@@ -118,7 +118,7 @@ gst_asyncdisksrc_class_init (GstAsyncDiskSrcClass *klass)
static void
gst_asyncdisksrc_init (GstAsyncDiskSrc *asyncdisksrc)
{
GST_SRC_SET_FLAGS (asyncdisksrc, GST_SRC_ASYNC);
GST_FLAG_SET (asyncdisksrc, GST_SRC_ASYNC);
g_print("init\n");
asyncdisksrc->srcpad = gst_pad_new ("src", GST_PAD_SRC);
......
......@@ -44,9 +44,10 @@ GstElementDetails gst_asyncdisksrc_details;
#define GST_IS_ASYNCDISKSRC_CLASS(obj) \
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_ASYNCDISKSRC))
// NOTE: per-element flags start with 16 for now
typedef enum {
GST_ASYNCDISKSRC_OPEN = (1 << 16),
GST_ASYNCDISKSRC_OPEN = GST_SRC_FLAG_LAST,
GST_ASYNCDISKSRC_FLAG_LAST = GST_SRC_FLAG_LAST + 2,
} GstAsyncDiskSrcFlags;
typedef struct _GstAsyncDiskSrc GstAsyncDiskSrc;
......
......@@ -24,7 +24,6 @@
#include <config.h>
#include <gst/gst.h>
#include <gst/gstclock.h>
#ifdef __cplusplus
......@@ -46,9 +45,10 @@ GstElementDetails gst_audiosink_details;
#define GST_IS_AUDIOSINK_CLASS(obj) \
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIOSINK))
// NOTE: per-element flags start with 16 for now
typedef enum {
GST_AUDIOSINK_OPEN = (1 << 16),
GST_AUDIOSINK_OPEN = GST_SINK_FLAG_LAST,
GST_AUDIOSINK_FLAG_LAST = GST_SINK_FLAG_LAST+2,
} GstAudioSinkFlags;
typedef struct _GstAudioSink GstAudioSink;
......
......@@ -46,9 +46,10 @@ GstElementDetails gst_audiosrc_details;
#define GST_IS_AUDIOSRC_CLASS(obj) \
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIOSRC))
// NOTE: per-element flags start with 16 for now
typedef enum {
GST_AUDIOSRC_OPEN = (1 < 16),
GST_AUDIOSRC_OPEN = GST_SRC_FLAG_LAST,
GST_AUDIOSRC_FLAG_LAST = GST_SRC_FLAG_LAST+2,
} GstAudioSrcFlags;
typedef struct _GstAudioSrc GstAudioSrc;
......
......@@ -45,9 +45,10 @@ extern GstElementDetails gst_disksrc_details;
#define GST_IS_DISKSRC_CLASS(obj) \
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_DISKSRC))
// NOTE: per-element flags start with 16 for now
typedef enum {
GST_DISKSRC_OPEN = (1 << 16),
GST_DISKSRC_OPEN = GST_SRC_FLAG_LAST,
GST_DISKSRC_FLAG_LAST = GST_SRC_FLAG_LAST+2,
} GstDiskSrcFlags;
typedef struct _GstDiskSrc GstDiskSrc;
......
......@@ -72,9 +72,6 @@ GstPlugin *plugin_init (GModule *module)
GstElementFactory *factory;
gint i = 0;
/* we depend on having the usual types loaded first */
gst_plugin_load("gsttypes");
plugin = gst_plugin_new("gstelements");
g_return_val_if_fail(plugin != NULL,NULL);
......
......@@ -47,9 +47,10 @@ GstElementDetails gst_httpsrc_details;
#define GST_IS_HTTPSRC_CLASS(obj) \
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_HTTPSRC))
// NOTE: per-element flags start with 16 for now
typedef enum {
GST_HTTPSRC_OPEN = (1 << 16),
GST_HTTPSRC_OPEN = GST_SRC_FLAG_LAST,
GST_HTTPSRC_FLAG_LAST = GST_SRC_FLAG_LAST+2,
} GstHttpSrcFlags;
typedef struct _GstHttpSrc GstHttpSrc;
......
......@@ -44,9 +44,10 @@ GstElementDetails gst_pipefilter_details;
#define GST_IS_PIPEFILTER_CLASS(obj) \
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_PIPEFILTER))
// NOTE: per-element flags start with 16 for now
typedef enum {
GST_PIPEFILTER_OPEN = (1 << 16 ),
GST_PIPEFILTER_OPEN = GST_FILTER_FLAG_LAST,
GST_PIPEFILTER_FLAG_LAST = GST_FILTER_FLAG_LAST,
} GstPipeFilterFlags;
typedef struct _GstPipefilter GstPipefilter;
......
......@@ -17,7 +17,14 @@
* Boston, MA 02111-1307, USA.
*/
#include <gst/gst.h>
#include "gstdebug.h"
#include "gstcpu.h"
#include "gsttype.h"
#include "gstplugin.h"
#include "gstbuffer.h"
#include "gstbin.h"
#include "gstpipeline.h"
#include "gstthread.h"
extern gint _gst_trace_on;
......@@ -51,9 +58,6 @@ gst_init (int *argc, char **argv[])
gst_elementfactory_register (gst_elementfactory_new("thread",
gst_thread_get_type (), &gst_thread_details));
//gst_plugin_load_elementfactory("gsttypes");
//gst_plugin_load("libgstelements.so");
_gst_trace_on = 0;
if (_gst_trace_on) {
gst_trace = gst_trace_new ("gst.trace",1024);
......
......@@ -21,23 +21,13 @@
#ifndef __GST_H__
#define __GST_H__
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <unistd.h>
#include <gtk/gtk.h>
#include <gmodule.h>
#include <gst/gstdebug.h>
#include <gst/gstlog.h>
#include <gst/gstobject.h>
#include <gst/gstpad.h>
#include <gst/gstbuffer.h>
#include <gst/gstcpu.h>
#include <gst/gstclock.h>
#include <gst/gstelement.h>
#include <gst/gstextratypes.h>
#include <gst/gstbin.h>
......@@ -55,7 +45,6 @@
#include <gst/gsttrace.h>
#include <gst/gstxml.h>
#include <gst/gsttee.h>
#include <gst/cothreads.h>
/* initialize GST */
......
......@@ -20,7 +20,9 @@
#ifndef GST_HGUARD_GSTARCH_H
#define GST_HGUARD_GSTARCH_H
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifdef HAVE_CPU_I386
#include "gsti386.h"
......
......@@ -19,10 +19,10 @@
//#define GST_DEBUG_ENABLED
#include <gst/gst.h>
#include "config.h"
#include "gstbin.h"
#include "gstdebug.h"
#include "gstsrc.h"
#include "gstconnection.h"
GstElementDetails gst_bin_details = {
"Generic bin",
......@@ -592,73 +592,6 @@ gst_bin_src_wrapper (int argc,char *argv[])
return 0;
}
static int
gst_bin_connection_wrapper (int argc,char *argv[])
{
GstElement *element = GST_ELEMENT (argv);
GList *pads;
GstPad *pad;
G_GNUC_UNUSED const gchar *name = gst_element_get_name (element);
DEBUG_ENTER("(%d,\"%s\")",argc,name);
do {
DEBUG("Connection checking pads\n");
pads = element->pads;
while (pads) {
pad = GST_PAD (pads->data);
if (pad->direction == GST_PAD_SRC) {
DEBUG("pullfunc for %s:%s(%p) at %p is set to %p\n",GST_DEBUG_PAD_NAME(pad),pad,&pad->pullfunc,pad->pullfunc);
if (pad->pullfunc == NULL) fprintf(stderr,"error, no pullfunc in \"%s\"\n", name);
(pad->pullfunc)(pad);
}
pads = g_list_next(pads);
}
DEBUG("Connection done checking pads, checking COTHREAD_STOPPING on \"%s\"(%p)\n",
gst_element_get_name(element),element);
} while (!GST_ELEMENT_IS_COTHREAD_STOPPING(element));
GST_FLAG_UNSET(element,GST_ELEMENT_COTHREAD_STOPPING);
DEBUG_LEAVE("");
return 0;
}
static int
gst_bin_sched_wrapper (int argc, char *argv[])
{
_GstBinOutsideSchedule *sched = (_GstBinOutsideSchedule *)argv;
GstElement *element = sched->element;
GSList *pads;
GstPad *pad;
region_struct *region;
G_GNUC_UNUSED const gchar *name = gst_element_get_name (element);
DEBUG_ENTER("(\"%s\")",name);
do {
pads = sched->padlist;
while (pads) {
pad = GST_PAD (pads->data);
region = cothread_get_data (pad->threadstate, "region");
if (region) {
//gst_src_push_region (GST_SRC (element), region->offset, region->size);
if (pad->pullregionfunc == NULL)
fprintf(stderr,"error, no pullregionfunc in \"%s\"\n", name);
(pad->pullregionfunc)(pad, region->offset, region->size);
}
else {
if (pad->pullfunc == NULL)
fprintf(stderr,"error, no pullfunc in \"%s\"\n", name);
(pad->pullfunc)(pad);
}
}
} while (!(sched->flags && GST_ELEMENT_COTHREAD_STOPPING));
sched->flags &= ~GST_ELEMENT_COTHREAD_STOPPING;
DEBUG_LEAVE("");
return 0;
}
static void
gst_bin_pullfunc_proxy (GstPad *pad)
{
......
......@@ -21,13 +21,9 @@
#ifndef __GST_BIN_H__
#define __GST_BIN_H__
#include <gst/gstelement.h>
#include <gst/gstsrc.h>
#include <gst/gstconnection.h>
#include <gst/cothreads.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
......@@ -45,6 +41,8 @@ extern GstElementDetails gst_bin_details;
#define GST_IS_BIN_CLASS(obj) \
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_BIN))
#define GST_BIN_FLAG_LAST (GST_ELEMENT_FLAG_LAST + 2)
typedef struct _GstBin GstBin;
typedef struct _GstBinClass GstBinClass;
......
......@@ -20,9 +20,9 @@
/* this file makes too much noise for most debugging sessions */
#define GST_DEBUG_FORCE_DISABLE
#include <gst/gst.h>
#include <gst/gstbuffer.h>
#include "gstdebug.h"
#include "gstbuffer.h"
GMemChunk *_gst_buffer_chunk;
......@@ -245,7 +245,7 @@ gst_buffer_ref (GstBuffer *buffer)
#ifdef HAVE_ATOMIC_H
//g_return_if_fail(atomic_read(&(buffer->refcount)) > 0);
atomic_inc (&(buffer->refcount))
atomic_inc (&(buffer->refcount));
#else
g_return_if_fail (buffer->refcount > 0);
GST_BUFFER_LOCK (buffer);
......@@ -269,7 +269,7 @@ gst_buffer_ref_by_count (GstBuffer *buffer, int count)
#ifdef HAVE_ATOMIC_H
g_return_if_fail (atomic_read (&(buffer->refcount)) > 0);
atomic_add (count, &(buffer->refcount))
atomic_add (count, &(buffer->refcount));
#else
g_return_if_fail (buffer->refcount > 0);
GST_BUFFER_LOCK (buffer);
......@@ -296,7 +296,7 @@ gst_buffer_unref (GstBuffer *buffer)
#ifdef HAVE_ATOMIC_H
g_return_if_fail (atomic_read (&(buffer->refcount)) > 0);
zero = atomic_dec_and_test (&(buffer->refcount))
zero = atomic_dec_and_test (&(buffer->refcount));
#else
g_return_if_fail (buffer->refcount > 0);
GST_BUFFER_LOCK (buffer);
......
......@@ -21,8 +21,15 @@
#ifndef __GST_BUFFER_H__
#define __GST_BUFFER_H__
#include <gst/gstmeta.h>
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifdef HAVE_ATOMIC_H
#include <asm/atomic.h>
#endif
#include <gst/gstmeta.h>
#ifdef __cplusplus
extern "C" {
......@@ -66,7 +73,7 @@ typedef enum {
typedef struct _GstBuffer GstBuffer;
#include "gstbufferpool.h"
#include <gst/gstbufferpool.h>
struct _GstBuffer {
/* locking */
......
......@@ -18,9 +18,8 @@
*/
#include <gst/gst.h>
#include <gst/gstbufferpool.h>
#include "gstdebug.h"
#include "gstbuffer.h"
/**
......
......@@ -21,7 +21,7 @@
#ifndef __GST_BUFFER_POOL_H__
#define __GST_BUFFER_POOL_H__
#include "gstbuffer.h"
#include <gst/gstbuffer.h>
#ifdef __cplusplus
extern "C" {
......
......@@ -19,8 +19,8 @@
//#define DEBUG_ENABLED
#include <stdarg.h>
#include <gst/gst.h>
#include "gstcaps.h"
#include "gsttype.h"
void
_gst_caps_initialize (void)
......
......@@ -21,7 +21,7 @@
#ifndef __GST_CAPS_H__
#define __GST_CAPS_H__
#include <glib.h>
#include <gnome-xml/parser.h>
#include <gst/gstprops.h>
typedef struct _GstCaps GstCaps;
......
......@@ -19,7 +19,9 @@
#include <sys/time.h>
//#define DEBUG_ENABLED
#include <gstclock.h>
#include "gstclock.h"
#include "gstdebug.h"
#include "gstsink.h"
static GstClock *the_system_clock = NULL;
......
......@@ -22,7 +22,7 @@
#define __GST_CLOCK_H__
#include <gst/gst.h>
#include <gst/gstobject.h>
#ifdef __cplusplus
extern "C" {
......
......@@ -17,7 +17,7 @@
* Boston, MA 02111-1307, USA.
*/
#include <gst/gstconnection.h>
#include "gstconnection.h"
/* Connection signals and args */
......
......@@ -17,8 +17,12 @@
* Boston, MA 02111-1307, USA.
*/
#include <glib.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "gstcpu.h"
static guint32 _gst_cpu_flags;
......
......@@ -21,8 +21,6 @@
#ifndef __GST_CPU_H__
#define __GST_CPU_H__
#include <glib.h>
typedef enum {
GST_CPU_FLAG_MMX = (1<<0),
GST_CPU_FLAG_SSE = (1<<1),
......
......@@ -25,7 +25,8 @@
#include <config.h>
#endif
#include <gst/gst.h>
#include <gmodule.h>
#include <gst/gsttrace.h>
/* for include files that make too much noise normally */
#ifdef GST_DEBUG_FORCE_DISABLE
......
......@@ -17,9 +17,9 @@
* Boston, MA 02111-1307, USA.
*/
#include <gst/gstelement.h>
#include <gst/gstextratypes.h>
#include <gst/gstxml.h>
#include "gstdebug.h"
#include "gstelement.h"
#include "gstextratypes.h"
/* Element signals and args */
enum {
......
......@@ -26,8 +26,6 @@
#include <gst/gstlog.h>
#include <gst/gstobject.h>
#include <gst/gstpad.h>
#include <gst/gstbuffer.h>
#include <gst/gstcaps.h>
#include <gst/cothreads.h>
......@@ -77,12 +75,15 @@ static inline char *_gst_print_statename(int state) {
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_ELEMENT))
typedef enum {
GST_ELEMENT_MULTI_IN = (1 << 4),
GST_ELEMENT_THREAD_SUGGESTED = (1 << 5),
GST_ELEMENT_NO_SEEK = (1 << 6),
GST_ELEMENT_MULTI_IN = GST_OBJECT_FLAG_LAST,
GST_ELEMENT_THREAD_SUGGESTED,
GST_ELEMENT_NO_SEEK,
GST_ELEMENT_NEW_LOOPFUNC = (1 << 16),
GST_ELEMENT_COTHREAD_STOPPING = (1 << 17),
GST_ELEMENT_NEW_LOOPFUNC,
GST_ELEMENT_COTHREAD_STOPPING,
/* use some padding for future expansion */
GST_ELEMENT_FLAG_LAST = GST_OBJECT_FLAG_LAST + 8,
} GstElementFlags;
#define GST_ELEMENT_IS_MULTI_IN(obj) (GST_FLAG_IS_SET(obj,GST_ELEMENT_MULTI_IN))
......
......@@ -19,10 +19,9 @@
//#define DEBUG_ENABLED
#include <gst/gst.h>
#include <gst/gstelement.h>
#include <gst/gstplugin.h>
#include "gstdebug.h"
#include "gstelement.h"
#include "gstplugin.h"
/* global list of registered elementfactories */
......
......@@ -17,7 +17,7 @@
* Boston, MA 02111-1307, USA.
*/
#include <gst/gstextratypes.h>
#include "gstextratypes.h"
GtkType
gst_extra_get_filename_type (void)
......
......@@ -21,8 +21,7 @@
#ifndef __GST_EXTRA_TYPES_H__
#define __GST_EXTRA_TYPES_H__
#include <gst/gst.h>
#include <gnome-xml/parser.h>
#include <gtk/gtk.h>
#ifdef __cplusplus
extern "C" {
......
......@@ -17,7 +17,7 @@
* Boston, MA 02111-1307, USA.
*/
#include <gst/gstfilter.h>
#include "gstfilter.h"
/* Filter signals and args */
......
......@@ -21,10 +21,8 @@
#ifndef __GST_FILTER_H__
#define __GST_FILTER_H__
#include <gst/gstelement.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
......@@ -44,6 +42,8 @@ extern "C" {
typedef struct _GstFilter GstFilter;
typedef struct _GstFilterClass GstFilterClass;
#define GST_FILTER_FLAG_LAST GST_ELEMENT_FLAG_LAST
struct _GstFilter {
GstElement element;
};
......
......@@ -18,8 +18,8 @@
*/
#include <gst/gstmeta.h>
#include <gst/gsttrace.h>
#include "gstmeta.h"
#include "gsttrace.h"
/**
......@@ -54,7 +54,11 @@ gst_meta_ref (GstMeta *meta)
gst_trace_add_entry (NULL, 0, meta, "ref meta");
#ifdef HAVE_ATOMIC_H
atomic_inc (&(meta->refcount));
#else
meta->refcount++;
#endif
}
/**
......@@ -67,12 +71,17 @@ gst_meta_ref (GstMeta *meta)
void
gst_meta_unref (GstMeta *meta)
{
gint zero;
g_return_if_fail (meta != NULL);
gst_trace_add_entry (NULL, 0, meta, "unref meta");
#ifdef HAVE_ATOMIC_H
zero = atomic_dec_and_test (&(meta->refcount));
#else
meta->refcount--;
if (meta->refcount == 0) {
zero = (meta->refcount == 0);
#endif
if (zero) {
// gst_trace_add_entry(NULL,0,meta,"destroy meta");
g_free (meta);
// g_print("freeing metadata\n");
......
......@@ -24,7 +24,14 @@
#include <glib.h>
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifdef HAVE_ATOMIC_H
#include <asm/atomic.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
......@@ -42,12 +49,10 @@ extern "C" {
#define GST_META_FLAG_UNSET(meta,flag) \
G_STMT_START{ (GST_META_FLAGS(meta) &= ~(flag)); }G_STMT_END
typedef enum {
GST_META_FREEABLE = 1 << 0,
} GstMetaFlags;
typedef struct _GstMeta GstMeta;
struct _GstMeta {
......
......@@ -17,10 +17,7 @@
* Boston, MA 02111-1307, USA.
*/
#include <gst/gstobject.h>
#include <gst/gstbin.h>
#include "gstobject.h"
/* Object signals and args */
enum {
......
......@@ -21,18 +21,17 @@
#ifndef __GST_OBJECT_H__