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)
*/
#include <pthread.h>
-#include <sys/time.h>
-#include <linux/linkage.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
/* 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;
#include <glib.h>
#include <setjmp.h>
-#include <pthread.h>
#define COTHREAD_STACKSIZE 8192
#define COTHREAD_MAXTHREADS 16
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);
#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;
#include <config.h>
#include <gst/gst.h>
-#include <gst/gstclock.h>
#ifdef __cplusplus
#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;
#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;
#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;
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);
#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;
#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;
* 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;
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);
#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>
#include <gst/gsttrace.h>
#include <gst/gstxml.h>
#include <gst/gsttee.h>
-
#include <gst/cothreads.h>
/* initialize GST */
#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"
//#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",
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)
{
#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 */
#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;
/* 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;
#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);
#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);
#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);
#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" {
typedef struct _GstBuffer GstBuffer;
-#include "gstbufferpool.h"
+#include <gst/gstbufferpool.h>
struct _GstBuffer {
/* locking */
*/
-#include <gst/gst.h>
-#include <gst/gstbufferpool.h>
-
+#include "gstdebug.h"
+#include "gstbuffer.h"
/**
#ifndef __GST_BUFFER_POOL_H__
#define __GST_BUFFER_POOL_H__
-#include "gstbuffer.h"
+#include <gst/gstbuffer.h>
#ifdef __cplusplus
extern "C" {
//#define DEBUG_ENABLED
-#include <stdarg.h>
-#include <gst/gst.h>
+#include "gstcaps.h"
+#include "gsttype.h"
void
_gst_caps_initialize (void)
#ifndef __GST_CAPS_H__
#define __GST_CAPS_H__
-#include <glib.h>
+#include <gnome-xml/parser.h>
#include <gst/gstprops.h>
typedef struct _GstCaps GstCaps;
#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;
#define __GST_CLOCK_H__
-#include <gst/gst.h>
+#include <gst/gstobject.h>
#ifdef __cplusplus
extern "C" {
* Boston, MA 02111-1307, USA.
*/
-#include <gst/gstconnection.h>
+#include "gstconnection.h"
/* Connection signals and args */
* Boston, MA 02111-1307, USA.
*/
+#include <glib.h>
+#ifdef HAVE_CONFIG_H
#include "config.h"
+#endif
+
#include "gstcpu.h"
static guint32 _gst_cpu_flags;
#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),
#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
* 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 {
#include <gst/gstlog.h>
#include <gst/gstobject.h>
#include <gst/gstpad.h>
-#include <gst/gstbuffer.h>
-#include <gst/gstcaps.h>
#include <gst/cothreads.h>
(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))
//#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 */
* Boston, MA 02111-1307, USA.
*/
-#include <gst/gstextratypes.h>
+#include "gstextratypes.h"
GtkType
gst_extra_get_filename_type (void)
#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" {
* Boston, MA 02111-1307, USA.
*/
-#include <gst/gstfilter.h>
+#include "gstfilter.h"
/* Filter signals and args */
#ifndef __GST_FILTER_H__
#define __GST_FILTER_H__
-
#include <gst/gstelement.h>
-
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
typedef struct _GstFilter GstFilter;
typedef struct _GstFilterClass GstFilterClass;
+#define GST_FILTER_FLAG_LAST GST_ELEMENT_FLAG_LAST
+
struct _GstFilter {
GstElement element;
};
*/
-#include <gst/gstmeta.h>
-#include <gst/gsttrace.h>
+#include "gstmeta.h"
+#include "gsttrace.h"
/**
gst_trace_add_entry (NULL, 0, meta, "ref meta");
+#ifdef HAVE_ATOMIC_H
+ atomic_inc (&(meta->refcount));
+#else
meta->refcount++;
+#endif
}
/**
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");
#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 */
#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 {
* Boston, MA 02111-1307, USA.
*/
-
-#include <gst/gstobject.h>
-#include <gst/gstbin.h>
-
+#include "gstobject.h"
/* Object signals and args */
enum {
#ifndef __GST_OBJECT_H__
#define __GST_OBJECT_H__
-
#include <gtk/gtk.h>
#include <gst/gsttrace.h>
-//#include "config.h"
-#undef HAVE_ATOMIC_H
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
#ifdef HAVE_ATOMIC_H
#include <asm/atomic.h>
#endif
-
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
typedef struct _GstObject GstObject;
typedef struct _GstObjectClass GstObjectClass;
+#define GST_OBJECT_FLAG_LAST 4
+
struct _GstObject {
GtkObject object;
#define GST_FLAGS(obj) GTK_OBJECT_FLAGS(obj)
-#define GST_FLAG_IS_SET(obj,flag) (GST_FLAGS (obj) & (flag))
-#define GST_FLAG_SET(obj,flag) G_STMT_START{ (GST_FLAGS (obj) |= (flag)); }G_STMT_END
-#define GST_FLAG_UNSET(obj,flag) G_STMT_START{ (GST_FLAGS (obj) &= ~(flag)); }G_STMT_END
+#define GST_FLAG_IS_SET(obj,flag) (GST_FLAGS (obj) & (1<<(flag)))
+#define GST_FLAG_SET(obj,flag) G_STMT_START{ (GST_FLAGS (obj) |= (1<<(flag))); }G_STMT_END
+#define GST_FLAG_UNSET(obj,flag) G_STMT_START{ (GST_FLAGS (obj) &= ~(1<<(flag))); }G_STMT_END
#define GST_LOCK(obj) (g_mutex_lock(GST_OBJECT(obj)->lock))
#define GST_TRYLOCK(obj) (g_mutex_trylock(GST_OBJECT(obj)->lock))
//#define DEBUG_ENABLED
-#include <gst/gst.h>
-#include <gst/gstpad.h>
-#include <gst/gstelement.h>
-#include <gst/gsttype.h>
-
+#include "gstdebug.h"
+#include "gstpad.h"
+#include "gstelement.h"
+#include "gsttype.h"
/* Pad signals and args */
enum {
GstPadTemplate*
gst_padtemplate_create (gchar *name_template,
GstPadDirection direction, GstPadPresence presence,
- GstCaps *caps, ...)
+ GstCaps *caps)
{
GstPadTemplate *new;
#include <gnome-xml/parser.h>
+
#include <gst/gstobject.h>
#include <gst/gstbuffer.h>
#include <gst/cothreads.h>
#include <gst/gstcaps.h>
-
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
} GstPadDirection;
typedef enum {
- GST_PAD_DISABLED = (1 << 4),
+ GST_PAD_DISABLED = GST_OBJECT_FLAG_LAST,
+
+ GST_PAD_FLAG_LAST = GST_OBJECT_FLAG_LAST+2,
} GstPadFlags;
struct _GstPad {
GstPadTemplate* gst_padtemplate_new (GstPadFactory *factory);
GstPadTemplate* gst_padtemplate_create (gchar *name_template,
GstPadDirection direction, GstPadPresence presence,
- GstCaps *caps, ...);
+ GstCaps *caps);
xmlNodePtr gst_padtemplate_save_thyself (GstPadTemplate *pad, xmlNodePtr parent);
GstPadTemplate* gst_padtemplate_load_thyself (xmlNodePtr parent);
* Boston, MA 02111-1307, USA.
*/
-#include <gst/gstpipeline.h>
-#include <gst/gstthread.h>
-#include <gst/gstsink.h>
-#include <gst/gstutils.h>
-#include <gst/gsttype.h>
-
-#include "config.h"
+#include "gstpipeline.h"
+#include "gstthread.h"
+#include "gstsink.h"
+#include "gstutils.h"
+#include "gsttype.h"
GstElementDetails gst_pipeline_details = {
"Pipeline object",
#include <gst/gstbin.h>
-
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
* Boston, MA 02111-1307, USA.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
-#include <gst/gstplugin.h>
+#include "gstplugin.h"
-#include "config.h"
//#undef PLUGINS_USE_SRCDIR
gint _gst_libraries_seqno;
/* whether or not to spew library load issues */
-gboolean _gst_plugin_spew = TRUE;
+gboolean _gst_plugin_spew = FALSE;
-void _gst_plugin_initialize() {
+void
+_gst_plugin_initialize (void)
+{
xmlDocPtr doc;
_gst_modules = NULL;
_gst_modules_seqno = 0;
/* if this is set, we add build-directory paths to the list */
#ifdef PLUGINS_USE_SRCDIR
/* the catch-all plugins directory */
- _gst_plugin_paths = g_list_append(_gst_plugin_paths,
- PLUGINS_SRCDIR "/plugins");
+ _gst_plugin_paths = g_list_prepend (_gst_plugin_paths,
+ PLUGINS_SRCDIR "/plugins");
/* the libreary directory */
- _gst_plugin_paths = g_list_append(_gst_plugin_paths,
- PLUGINS_SRCDIR "/libs");
+ _gst_plugin_paths = g_list_prepend (_gst_plugin_paths,
+ PLUGINS_SRCDIR "/libs");
/* location libgstelements.so */
- _gst_plugin_paths = g_list_append(_gst_plugin_paths,
- PLUGINS_SRCDIR "/gst/elements");
- _gst_plugin_paths = g_list_append(_gst_plugin_paths,
- PLUGINS_SRCDIR "/gst/types");
+ _gst_plugin_paths = g_list_prepend (_gst_plugin_paths,
+ PLUGINS_SRCDIR "/gst/elements");
+ _gst_plugin_paths = g_list_prepend (_gst_plugin_paths,
+ PLUGINS_SRCDIR "/gst/types");
#else
/* add the main (installed) library path */
- _gst_plugin_paths = g_list_append(_gst_plugin_paths,PLUGINS_DIR);
+ _gst_plugin_paths = g_list_prepend (_gst_plugin_paths, PLUGINS_DIR);
#endif /* PLUGINS_USE_SRCDIR */
- doc = xmlParseFile("/etc/gstreamer/reg.xml");
+ doc = xmlParseFile ("/etc/gstreamer/reg.xml");
- if (!doc || strcmp(doc->root->name, "GST-PluginRegistry")) {
- g_print("gstplugin: registry needs rebuild\n");
- gst_plugin_load_all();
+ if (!doc || strcmp (doc->root->name, "GST-PluginRegistry")) {
+ g_print ("gstplugin: registry needs rebuild\n");
+ gst_plugin_load_all ();
return;
}
- gst_plugin_load_thyself(doc->root);
+ gst_plugin_load_thyself (doc->root);
}
-static gboolean gst_plugin_load_recurse(gchar *directory,gchar *name) {
+static gboolean
+gst_plugin_load_recurse (gchar *directory, gchar *name)
+{
DIR *dir;
struct dirent *dirent;
gboolean loaded = FALSE;
- //g_print("recursive load of '%s' in '%s'\n", name, directory);
+ //g_print("recursive load of '%s' in '%s'\n", name, directory);
dir = opendir(directory);
if (dir) {
while ((dirent = readdir(dir))) {
if (strcmp(dirent->d_name,".") && strcmp(dirent->d_name,"..")) {
loaded = gst_plugin_load_recurse(g_strjoin("/",directory,dirent->d_name,
NULL),name);
- if (loaded && name) return TRUE;
+ if (loaded && name) return TRUE;
}
}
closedir(dir);
if ((temp = strstr(directory,name)) &&
(!strcmp(temp,name))) {
loaded = gst_plugin_load_absolute(directory);
- return loaded;
}
} else if ((temp = strstr(directory,".so")) &&
(!strcmp(temp,".so"))) {
loaded = gst_plugin_load_absolute(directory);
- //return loaded;
}
}
}
*
* Load all plugins in the path.
*/
-void gst_plugin_load_all() {
+void
+gst_plugin_load_all(void)
+{
GList *path;
path = _gst_plugin_paths;
*
* Returns: whether the library was loaded or not
*/
-gboolean gst_library_load(gchar *name) {
+gboolean
+gst_library_load (gchar *name)
+{
gboolean res;
GList *libraries = _gst_libraries;
}
static void
-gst_plugin_remove(GstPlugin *plugin)
+gst_plugin_remove (GstPlugin *plugin)
{
GList *factories;
*
* Returns: whether the plugin was loaded or not
*/
-gboolean gst_plugin_load(gchar *name) {
+gboolean
+gst_plugin_load (gchar *name)
+{
GList *path;
gchar *libspath;
+ GstPlugin *plugin;
//g_print("attempting to load plugin '%s'\n",name);
+ plugin = gst_plugin_find (name);
+
+ if (plugin && plugin->loaded) return TRUE;
+
path = _gst_plugin_paths;
while (path != NULL) {
if (gst_plugin_load_absolute(g_module_build_path(path->data,name)))
*
* Returns: whether or not the plugin loaded
*/
-gboolean gst_plugin_load_absolute(gchar *name) {
+gboolean
+gst_plugin_load_absolute (gchar *name)
+{
GModule *module;
GstPluginInitFunc initfunc;
GstPlugin *plugin;
g_print("gstplugin: plugin %s loaded\n", plugin->name);
plugin->filename = g_strdup(name);
plugin->loaded = TRUE;
- _gst_modules = g_list_append(_gst_modules,module);
+ _gst_modules = g_list_prepend(_gst_modules,module);
_gst_modules_seqno++;
_gst_plugins = g_list_prepend(_gst_plugins,plugin);
_gst_plugins_seqno++;
}
return TRUE;
} else if (_gst_plugin_spew) {
-// if (strstr(g_module_error(),"No such") == NULL)
- gst_info("error loading plugin: %s, reason: %s\n", name, g_module_error());
+ gst_info("error loading plugin: %s, reason: %s\n", name, g_module_error());
}
return FALSE;
*
* Returns: new plugin
*/
-GstPlugin *gst_plugin_new(gchar *name) {
- GstPlugin *plugin = (GstPlugin *)g_malloc(sizeof(GstPlugin));
+GstPlugin*
+gst_plugin_new (gchar *name)
+{
+ GstPlugin *plugin;
+
+ // return NULL if the plugin is allready loaded
+ plugin = gst_plugin_find (name);
+ if (plugin) return NULL;
+
+ plugin = (GstPlugin *)g_malloc(sizeof(GstPlugin));
- // FIXME need to make sure the plugin hasn't already loaded
plugin->name = g_strdup(name);
plugin->longname = NULL;
plugin->types = NULL;
*
* Sets the long name (should be descriptive) of the plugin.
*/
-void gst_plugin_set_longname(GstPlugin *plugin,gchar *longname) {
+void
+gst_plugin_set_longname (GstPlugin *plugin, gchar *longname)
+{
g_return_if_fail(plugin != NULL);
if (plugin->longname) g_free(plugin->longname);
*
* Returns: pointer to the #GstPlugin if found, NULL otherwise
*/
-GstPlugin *gst_plugin_find(const gchar *name) {
+GstPlugin*
+gst_plugin_find (const gchar *name)
+{
GList *plugins = _gst_plugins;
g_return_val_if_fail(name != NULL, NULL);
*
* Returns: @GstElementFactory if found, NULL if not
*/
-GstElementFactory *gst_plugin_find_elementfactory(gchar *name) {
+GstElementFactory*
+gst_plugin_find_elementfactory (gchar *name)
+{
GList *plugins, *factories;
GstElementFactory *factory;
*
* Returns: @GstElementFactory if loaded, NULL if not
*/
-GstElementFactory *gst_plugin_load_elementfactory(gchar *name) {
+GstElementFactory*
+gst_plugin_load_elementfactory (gchar *name)
+{
GList *plugins, *factories;
GstElementFactory *factory = NULL;
GstPlugin *plugin;
*
* Load a registered typefactory by mime type.
*/
-void gst_plugin_load_typefactory(gchar *mime) {
+void
+gst_plugin_load_typefactory (gchar *mime)
+{
GList *plugins, *factories;
GstTypeFactory *factory;
GstPlugin *plugin;
- g_return_if_fail(mime != NULL);
+ g_return_if_fail (mime != NULL);
plugins = _gst_plugins;
while (plugins) {
*
* Add factory to the list of those provided by the plugin.
*/
-void gst_plugin_add_factory(GstPlugin *plugin,GstElementFactory *factory) {
- g_return_if_fail(plugin != NULL);
- g_return_if_fail(factory != NULL);
+void
+gst_plugin_add_factory (GstPlugin *plugin, GstElementFactory *factory)
+{
+ g_return_if_fail (plugin != NULL);
+ g_return_if_fail (factory != NULL);
// g_print("adding factory to plugin\n");
- plugin->elements = g_list_append(plugin->elements,factory);
+ plugin->elements = g_list_prepend (plugin->elements, factory);
gst_elementfactory_register (factory);
}
*
* Add a typefactory to the list of those provided by the plugin.
*/
-void gst_plugin_add_type(GstPlugin *plugin,GstTypeFactory *factory) {
- g_return_if_fail(plugin != NULL);
- g_return_if_fail(factory != NULL);
+void
+gst_plugin_add_type (GstPlugin *plugin, GstTypeFactory *factory)
+{
+ g_return_if_fail (plugin != NULL);
+ g_return_if_fail (factory != NULL);
// g_print("adding factory to plugin\n");
- plugin->types = g_list_append(plugin->types,factory);
+ plugin->types = g_list_prepend (plugin->types, factory);
}
/**
*
* Returns; a GList of GstPlugin elements
*/
-GList *gst_plugin_get_list() {
+GList*
+gst_plugin_get_list(void)
+{
return _gst_plugins;
}
*
* Returns: the new XML node
*/
-xmlNodePtr gst_plugin_save_thyself(xmlNodePtr parent) {
+xmlNodePtr
+gst_plugin_save_thyself (xmlNodePtr parent)
+{
xmlNodePtr tree, subtree;
GList *plugins = NULL, *elements = NULL, *types = NULL;
*
* load the plugin from an XML representation
*/
-void gst_plugin_load_thyself(xmlNodePtr parent) {
+void
+gst_plugin_load_thyself (xmlNodePtr parent)
+{
xmlNodePtr kinderen;
gint elementcount = 0;
gint typecount = 0;
#ifndef __GST_PLUGIN_H__
#define __GST_PLUGIN_H__
-
#include <gmodule.h>
+#include <gnome-xml/parser.h>
#include <gst/gsttype.h>
#include <gst/gstelement.h>
//#define DEBUG_ENABLED
-#include <stdarg.h>
-#include <gst/gst.h>
-#include <gst/gstpropsprivate.h>
+#include "gstdebug.h"
+#include "gstprops.h"
+#include "gstpropsprivate.h"
static gboolean gst_props_entry_check_compatibility (GstPropsEntry *entry1, GstPropsEntry *entry2);
#define __GST_PROPS_H__
#include <glib.h>
+#include <gnome-xml/parser.h>
typedef struct _GstProps GstProps;
typedef gpointer GstPropsFactoryEntry;
*/
-#include <gst/gstsink.h>
+#include "gstsink.h"
/* Sink signals and args */
typedef struct _GstSink GstSink;
typedef struct _GstSinkClass GstSinkClass;
+#define GST_SINK_FLAG_LAST GST_ELEMENT_FLAG_LAST
+
struct _GstSink {
GstElement element;
};
* Boston, MA 02111-1307, USA.
*/
-#include <gst/gst.h>
+#include "gstsrc.h"
/* Src signals and args */
static void
gst_src_init (GstSrc *src)
{
- src->flags = 0;
}
/**
#include <gst/gstelement.h>
-
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_SRC))
typedef enum {
- GST_SRC_ASYNC = (1 << 0),
-} GstSrcFlags;
+ GST_SRC_ASYNC = GST_ELEMENT_FLAG_LAST,
-#define GST_SRC_FLAGS(obj) \
- (GST_SRC(obj)->flags)
-#define GST_SRC_ASYNC(obj) \
- ((GST_SRC_FLAGS(obj) & GST_SRC_ASYNC))
+ GST_SRC_FLAG_LAST = GST_ELEMENT_FLAG_LAST +2,
+} GstSrcFlags;
typedef struct _GstSrc GstSrc;
typedef struct _GstSrcClass GstSrcClass;
+#define GST_SRC_ASYNC(obj) (GST_FLAG_IS_SET(obj,GST_SRC_ASYNC))
+
struct _GstSrc {
GstElement element;
- gint32 flags;
};
struct _GstSrcClass {
void (*eos) (GstSrc *src);
};
-#define GST_SRC_SET_FLAGS(src,flag) \
- G_STMT_START{ (GST_SRC_FLAGS (src) |= (flag)); }G_STMT_END
-#define GST_SRC_UNSET_FLAGS(src,flag) \
- G_STMT_START{ (GST_SRC_FLAGS (src) &= ~(flag)); }G_STMT_END
-
GtkType gst_src_get_type (void);
void gst_src_signal_eos (GstSrc *src);
* Boston, MA 02111-1307, USA.
*/
-#include <gsttee.h>
-
-#include "config.h"
+#include "gsttee.h"
GstElementDetails gst_tee_details = {
"Tee pipe fitting",
* Boston, MA 02111-1307, USA.
*/
-#include <gst/gst.h>
-#include <gst/gstthread.h>
+#include <unistd.h>
-#include "config.h"
+#include "gstthread.h"
+#include "gstdebug.h"
GstElementDetails gst_thread_details = {
"Threaded container",
#define __GST_THREAD_H__
-#include <gst/gstbin.h>
#include <pthread.h>
+#include <gst/gstbin.h>
#ifdef __cplusplus
extern "C" {
typedef enum {
- GST_THREAD_CREATE = (1 << 16),
- GST_THREAD_STATE_SPINNING = (1 << 17),
- GST_THREAD_STATE_REAPING = (1 << 18),
+ GST_THREAD_CREATE = GST_BIN_FLAG_LAST,
+ GST_THREAD_STATE_SPINNING,
+ GST_THREAD_STATE_REAPING,
+
+ /* padding */
+ GST_THREAD_FLAG_LAST = GST_BIN_FLAG_LAST + 4,
} GstThreadState;
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
-#include <glib.h>
-#include <gst/gsttrace.h>
+
+#include "gsttrace.h"
#ifdef HAVE_RDTS
__inline__ void read_tsc(guint64 *dst) {
#ifndef __GST_TRACE_H__
#define __GST_TRACE_H__
+#include <glib.h>
typedef struct _GstTrace GstTrace;
typedef struct _GstTraceEntry GstTraceEntry;
* I'm not overly worried yet...
*/
-#include <gst/gst.h>
#include <string.h>
+#include "gsttype.h"
+#include "gstplugin.h"
/* global list of registered types */
GList *_gst_types;
*/
-#include <gtk/gtk.h>
+#include "gstutils.h"
/**
* gst_util_get_int_arg:
* Boston, MA 02111-1307, USA.
*/
-#include <gst/gstxml.h>
+#include "gstxml.h"
static void gst_xml_class_init(GstXMLClass *klass);
static void gst_xml_init(GstXML *xml);
#ifndef __GST_XML_H__
#define __GST_XML_H__
-#include <gst/gst.h>
#include <gnome-xml/parser.h>
+#include <gst/gstelement.h>
#ifdef __cplusplus
extern "C" {
*/
-#include <gtk/gtk.h>
#include <gst/gst.h>
#include <string.h>
gtk_widget_show (GTK_WIDGET (mplay->play));
- mplay->status = glade_xml_get_widget (mplay->xml, "status_area");
+ mplay->status = (GstStatusArea *)glade_xml_get_widget (mplay->xml, "status_area");
gst_status_area_set_state (mplay->status, GST_STATUS_AREA_STATE_INIT);
gst_status_area_set_playtime (mplay->status, "00:00 / 00:00");
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);
#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;
#include <config.h>
#include <gst/gst.h>
-#include <gst/gstclock.h>
#ifdef __cplusplus
#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;
#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;
#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;
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);
#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;
#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;
caps
queue
registry
+rip
+paranoia
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
+#include <unistd.h>
+#include <stdlib.h>
int main(int argc,char *argv[]) {
- GstPipeline *pipeline;
+ GstElement *pipeline;
GstElement *paranoia,*lame,*sink;
int i;
int outfile;
fprintf(stderr,"\n");
gst_bin_iterate(GST_BIN(pipeline));
}
+
+ return 0;
}
unlink("/etc/gstreamer/reg.xml");
gst_init(&argc,&argv);
- gst_plugin_load_all();
doc = xmlNewDoc("1.0");
doc->root = xmlNewDocNode(doc, NULL, "GST-PluginRegistry", NULL);