diff --git a/gst/elements/gstfakesink.c b/gst/elements/gstfakesink.c
index be8af67bf7..a87f4b2cff 100644
--- a/gst/elements/gstfakesink.c
+++ b/gst/elements/gstfakesink.c
@@ -34,6 +34,7 @@ GstElementDetails gst_fakesink_details = {
/* FakeSink signals and args */
enum {
/* FILL ME */
+ SIGNAL_HANDOFF,
LAST_SIGNAL
};
@@ -49,7 +50,7 @@ static void gst_fakesink_init(GstFakeSink *fakesink);
static void gst_fakesink_chain(GstPad *pad,GstBuffer *buf);
static GstSinkClass *parent_class = NULL;
-//static guint gst_fakesink_signals[LAST_SIGNAL] = { 0 };
+static guint gst_fakesink_signals[LAST_SIGNAL] = { 0 };
GtkType
gst_fakesink_get_type (void)
@@ -75,10 +76,20 @@ gst_fakesink_get_type (void)
static void
gst_fakesink_class_init (GstFakeSinkClass *klass)
{
+ GtkObjectClass *gtkobject_class;
GstSinkClass *gstsink_class;
+ gtkobject_class = (GtkObjectClass*)klass;
gstsink_class = (GstSinkClass*)klass;
+ gst_fakesink_signals[SIGNAL_HANDOFF] =
+ gtk_signal_new ("handoff", GTK_RUN_LAST, gtkobject_class->type,
+ GTK_SIGNAL_OFFSET (GstFakeSinkClass, handoff),
+ gtk_marshal_NONE__NONE, GTK_TYPE_NONE, 0);
+
+ gtk_object_class_add_signals (gtkobject_class, gst_fakesink_signals,
+ LAST_SIGNAL);
+
parent_class = gtk_type_class (GST_TYPE_SINK);
}
@@ -114,4 +125,8 @@ gst_fakesink_chain (GstPad *pad, GstBuffer *buf)
g_print("(%s:%s)< ",GST_DEBUG_PAD_NAME(pad));
gst_buffer_unref (buf);
+
+ gtk_signal_emit (GTK_OBJECT (fakesink), gst_fakesink_signals[SIGNAL_HANDOFF],
+ fakesink);
+
}
diff --git a/gst/elements/gstfakesink.h b/gst/elements/gstfakesink.h
index c04e74f6df..f8bca9ca8f 100644
--- a/gst/elements/gstfakesink.h
+++ b/gst/elements/gstfakesink.h
@@ -56,6 +56,9 @@ struct _GstFakeSink {
struct _GstFakeSinkClass {
GstSinkClass parent_class;
+
+ /* signals */
+ void (*handoff) (GstElement *element,GstPad *pad);
};
GtkType gst_fakesink_get_type(void);
diff --git a/gst/elements/gstidentity.c b/gst/elements/gstidentity.c
index f5546b0cdf..3aa6f1d18b 100644
--- a/gst/elements/gstidentity.c
+++ b/gst/elements/gstidentity.c
@@ -39,7 +39,7 @@ enum {
enum {
ARG_0,
- ARG_CONTROL
+ ARG_LOOP_BASED,
};
@@ -86,11 +86,11 @@ gst_identity_class_init (GstIdentityClass *klass)
parent_class = gtk_type_class (GST_TYPE_FILTER);
- //gtk_object_add_arg_type("GstIdentity::control", GTK_TYPE_INT,
- // GTK_ARG_READWRITE, ARG_CONTROL);
+ gtk_object_add_arg_type ("GstIdentity::loop_based", GTK_TYPE_BOOL,
+ GTK_ARG_READWRITE, ARG_LOOP_BASED);
- //gtkobject_class->set_arg = gst_identity_set_arg;
- //gtkobject_class->get_arg = gst_identity_get_arg;
+ gtkobject_class->set_arg = gst_identity_set_arg;
+ gtkobject_class->get_arg = gst_identity_get_arg;
}
static void
@@ -103,7 +103,7 @@ gst_identity_init (GstIdentity *identity)
identity->srcpad = gst_pad_new ("src", GST_PAD_SRC);
gst_element_add_pad (GST_ELEMENT (identity), identity->srcpad);
- identity->control = 0;
+ identity->loop_based = FALSE;
}
static void
@@ -121,6 +121,22 @@ gst_identity_chain (GstPad *pad, GstBuffer *buf)
gst_pad_push (identity->srcpad, buf);
}
+static void
+gst_identity_loop (GstElement *element)
+{
+ GstIdentity *identity;
+ GstBuffer *buf;
+
+ g_return_if_fail (element != NULL);
+ g_return_if_fail (GST_IS_IDENTITY (element));
+
+ identity = GST_IDENTITY (element);
+
+ buf = gst_pad_pull (identity->sinkpad);
+
+ gst_pad_push (identity->srcpad, buf);
+}
+
static void
gst_identity_set_arg (GtkObject *object, GtkArg *arg, guint id)
{
@@ -132,8 +148,16 @@ gst_identity_set_arg (GtkObject *object, GtkArg *arg, guint id)
identity = GST_IDENTITY (object);
switch(id) {
- case ARG_CONTROL:
- identity->control = GTK_VALUE_INT (*arg);
+ case ARG_LOOP_BASED:
+ identity->loop_based = GTK_VALUE_BOOL (*arg);
+ if (identity->loop_based) {
+ gst_element_set_loop_function (GST_ELEMENT (identity), gst_identity_loop);
+ gst_pad_set_chain_function (identity->sinkpad, NULL);
+ }
+ else {
+ gst_pad_set_chain_function (identity->sinkpad, gst_identity_chain);
+ gst_element_set_loop_function (GST_ELEMENT (identity), NULL);
+ }
break;
default:
break;
@@ -149,8 +173,8 @@ static void gst_identity_get_arg(GtkObject *object,GtkArg *arg,guint id) {
identity = GST_IDENTITY (object);
switch (id) {
- case ARG_CONTROL:
- GTK_VALUE_INT (*arg) = identity->control;
+ case ARG_LOOP_BASED:
+ GTK_VALUE_BOOL (*arg) = identity->loop_based;
break;
default:
arg->type = GTK_TYPE_INVALID;
diff --git a/gst/elements/gstidentity.h b/gst/elements/gstidentity.h
index 5336a40aa5..a60c3c023c 100644
--- a/gst/elements/gstidentity.h
+++ b/gst/elements/gstidentity.h
@@ -54,7 +54,7 @@ struct _GstIdentity {
GstPad *sinkpad;
GstPad *srcpad;
- gint control;
+ gboolean loop_based;
};
struct _GstIdentityClass {
diff --git a/gst/gstautoplug.c b/gst/gstautoplug.c
index ece5dfe0a6..bd42667c39 100644
--- a/gst/gstautoplug.c
+++ b/gst/gstautoplug.c
@@ -20,17 +20,14 @@
#include "gstdebug.h"
#include "gstautoplug.h"
-#define MAX_COST 999999
-
-typedef guint (*GstAutoplugCostFunction) (gpointer src, gpointer dest, gpointer data);
-typedef GList* (*GstAutoplugListFunction) (gpointer data);
+static void gst_autoplug_class_init (GstAutoplugClass *klass);
+static void gst_autoplug_init (GstAutoplug *autoplug);
static GList* gst_autoplug_func (gpointer src, gpointer sink,
GstAutoplugListFunction list_function,
GstAutoplugCostFunction cost_function,
gpointer data);
-
struct _gst_autoplug_node
{
gpointer iNode;
@@ -40,69 +37,33 @@ struct _gst_autoplug_node
typedef struct _gst_autoplug_node gst_autoplug_node;
-static GList*
-gst_autoplug_enqueue (GList *queue, gpointer iNode, gint iDist, gpointer iPrev)
-{
- gst_autoplug_node *node = g_malloc (sizeof (gst_autoplug_node));
+static GstObjectClass *parent_class = NULL;
- node->iNode = iNode;
- node->iDist = iDist;
- node->iPrev = iPrev;
+GtkType gst_autoplug_get_type(void) {
+ static GtkType autoplug_type = 0;
- queue = g_list_append (queue, node);
-
- return queue;
+ if (!autoplug_type) {
+ static const GtkTypeInfo autoplug_info = {
+ "GstAutoplug",
+ sizeof(GstElement),
+ sizeof(GstElementClass),
+ (GtkClassInitFunc)gst_autoplug_class_init,
+ (GtkObjectInitFunc)gst_autoplug_init,
+ (GtkArgSetFunc)NULL,
+ (GtkArgGetFunc)NULL,
+ (GtkClassInitFunc)NULL,
+ };
+ autoplug_type = gtk_type_unique(GST_TYPE_AUTOPLUG,&autoplug_info);
+ }
+ return autoplug_type;
}
-static GList*
-gst_autoplug_dequeue (GList *queue, gpointer *iNode, gint *iDist, gpointer *iPrev)
-{
- GList *head;
- gst_autoplug_node *node;
-
- head = g_list_first (queue);
-
- if (head) {
- node = (gst_autoplug_node *)head->data;
- *iNode = node->iNode;
- *iPrev = node->iPrev;
- *iDist = node->iDist;
- head = g_list_remove (queue, node);
- }
-
- return head;
+static void
+gst_autoplug_class_init(GstAutoplugClass *klass) {
+ parent_class = gtk_type_class(GST_TYPE_OBJECT);
}
-static gint
-find_factory (gst_autoplug_node *rgnNodes, GstElementFactory *factory)
-{
- gint i=0;
-
- while (rgnNodes[i].iNode) {
- if (rgnNodes[i].iNode == factory) return i;
- i++;
- }
-
- return 0;
-}
-
-static GList*
-construct_path (gst_autoplug_node *rgnNodes, GstElementFactory *factory)
-{
- GstElementFactory *current;
- GList *factories = NULL;
-
- current = rgnNodes[find_factory(rgnNodes, factory)].iPrev;
-
- while (current != NULL)
- {
- gpointer next;
- next = rgnNodes[find_factory(rgnNodes, current)].iPrev;
- if (next) factories = g_list_prepend (factories, current);
- current = next;
- }
-
- return factories;
+static void gst_autoplug_init(GstAutoplug *autoplug) {
}
static gboolean
@@ -144,25 +105,6 @@ gst_autoplug_elementfactory_get_list (gpointer data)
return gst_elementfactory_get_list ();
}
-static guint
-gst_autoplug_elementfactory_find_cost (gpointer src, gpointer dest, gpointer data)
-{
- if (gst_autoplug_can_match ((GstElementFactory *)src, (GstElementFactory *)dest)) {
- return 1;
- }
- return MAX_COST;
-}
-
-
-GList*
-gst_autoplug_factories (GstElementFactory *srcfactory, GstElementFactory *sinkfactory)
-{
- return gst_autoplug_func (srcfactory, sinkfactory,
- gst_autoplug_elementfactory_get_list,
- gst_autoplug_elementfactory_find_cost,
- NULL);
-}
-
typedef struct {
GstCaps *src;
GstCaps *sink;
@@ -192,8 +134,10 @@ gst_autoplug_caps_find_cost (gpointer src, gpointer dest, gpointer data)
res = gst_autoplug_can_match ((GstElementFactory *)src, (GstElementFactory *)dest);
}
- if (res) return 1;
- return MAX_COST;
+ if (res)
+ return 1;
+ else
+ return GST_AUTOPLUG_MAX_COST;
}
GList*
@@ -210,34 +154,69 @@ gst_autoplug_caps (GstCaps *srccaps, GstCaps *sinkcaps)
&caps);
}
-GList*
-gst_autoplug_elements (GstElement *src, GstElement *sink)
+static gint
+find_factory (gst_autoplug_node *rgnNodes, gpointer factory)
{
- return NULL;
+ gint i=0;
+
+ while (rgnNodes[i].iNode) {
+ if (rgnNodes[i].iNode == factory) return i;
+ i++;
+ }
+ return 0;
}
-GList*
-gst_autoplug_caps_to_factory (GstCaps *srccaps, GstElementFactory *sinkfactory)
+static GList*
+construct_path (gst_autoplug_node *rgnNodes, gpointer factory)
{
- return NULL;
+ GstElementFactory *current;
+ GList *factories = NULL;
+
+ current = rgnNodes[find_factory(rgnNodes, factory)].iPrev;
+
+ while (current != NULL)
+ {
+ gpointer next;
+ next = rgnNodes[find_factory(rgnNodes, current)].iPrev;
+ if (next) factories = g_list_prepend (factories, current);
+ current = next;
+ }
+ return factories;
}
-GList*
-gst_autoplug_factory_to_caps (GstElementFactory *srcfactory, GstCaps *sinkcaps)
+static GList*
+gst_autoplug_enqueue (GList *queue, gpointer iNode, gint iDist, gpointer iPrev)
{
- return NULL;
+ gst_autoplug_node *node = g_malloc (sizeof (gst_autoplug_node));
+
+ node->iNode = iNode;
+ node->iDist = iDist;
+ node->iPrev = iPrev;
+
+ queue = g_list_append (queue, node);
+
+ return queue;
+}
+
+static GList*
+gst_autoplug_dequeue (GList *queue, gpointer *iNode, gint *iDist, gpointer *iPrev)
+{
+ GList *head;
+ gst_autoplug_node *node;
+
+ head = g_list_first (queue);
+
+ if (head) {
+ node = (gst_autoplug_node *)head->data;
+ *iNode = node->iNode;
+ *iPrev = node->iPrev;
+ *iDist = node->iDist;
+ head = g_list_remove (queue, node);
+ }
+
+ return head;
}
-/**
- * gst_type_get_sink_to_src:
- * @sinkid: the id of the sink
- * @srcid: the id of the source
- *
- * return a list of elementfactories that convert the source
- * type id to the sink type id
- *
- * Returns: a list of elementfactories
- */
static GList*
gst_autoplug_func (gpointer src, gpointer sink,
GstAutoplugListFunction list_function,
@@ -253,8 +232,6 @@ gst_autoplug_func (gpointer src, gpointer sink,
GList *factories;
guint num_factories;
- DEBUG ("%p %p\n", src, sink);
-
elements = g_list_append (elements, sink);
elements = g_list_append (elements, src);
@@ -274,7 +251,7 @@ gst_autoplug_func (gpointer src, gpointer sink,
rgnNodes[i].iDist = 0;
}
else {
- rgnNodes[i].iDist = MAX_COST;
+ rgnNodes[i].iDist = GST_AUTOPLUG_MAX_COST;
}
factories = g_list_next (factories);
@@ -292,8 +269,8 @@ gst_autoplug_func (gpointer src, gpointer sink,
gpointer current = factories2->data;
iCost = cost_function (iNode, current, data);
- if (iCost != MAX_COST) {
- if((MAX_COST == rgnNodes[i].iDist) ||
+ if (iCost != GST_AUTOPLUG_MAX_COST) {
+ if((GST_AUTOPLUG_MAX_COST == rgnNodes[i].iDist) ||
(rgnNodes[i].iDist > (iCost + iDist))) {
rgnNodes[i].iDist = iDist + iCost;
rgnNodes[i].iPrev = iNode;
diff --git a/gst/gstautoplug.h b/gst/gstautoplug.h
index 3f2ba438e0..0493ce9918 100644
--- a/gst/gstautoplug.h
+++ b/gst/gstautoplug.h
@@ -27,18 +27,37 @@
extern "C" {
#endif /* __cplusplus */
+#define GST_TYPE_AUTOPLUG \
+ (gst_object_get_type())
+#define GST_AUTOPLUG(obj) \
+ (GTK_CHECK_CAST((obj),GST_TYPE_AUTOPLUG,GstAutoplug))
+#define GST_AUTOPLUG_CLASS(klass) \
+ (GTK_CHECK_CLASS_CAST((klass),GST_TYPE_AUTOPLUG,GstAutoplugClass))
+#define GST_IS_AUTOPLUG(obj) \
+ (GTK_CHECK_TYPE((obj),GST_TYPE_AUTOPLUG))
+#define GST_IS_AUTOPLUG_CLASS(obj) \
+ (GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_AUTOPLUG))
-GList* gst_autoplug_factories (GstElementFactory *srcfactory,
- GstElementFactory *sinkfactory);
-GList* gst_autoplug_elements (GstElement *src,
- GstElement *sink);
+typedef struct _GstAutoplug GstAutoplug;
+typedef struct _GstAutoplugClass GstAutoplugClass;
+
+#define GST_AUTOPLUG_MAX_COST 999999
+
+typedef guint (*GstAutoplugCostFunction) (gpointer src, gpointer dest, gpointer data);
+typedef GList* (*GstAutoplugListFunction) (gpointer data);
+
+struct _GstAutoplug {
+ GtkObject object;
+};
+
+struct _GstAutoplugClass {
+ GtkObjectClass parent_class;
+};
+
+GtkType gst_autoplug_get_type (void);
GList* gst_autoplug_caps (GstCaps *srccaps, GstCaps *sinkcaps);
-GList* gst_autoplug_caps_to_factory (GstCaps *srccaps, GstElementFactory *sinkfactory);
-
-GList* gst_autoplug_factory_to_caps (GstElementFactory *srcfactory, GstCaps *sinkcaps);
-
#ifdef __cplusplus
}
diff --git a/gst/gstpipeline.c b/gst/gstpipeline.c
index 45593d2250..60080c9d5d 100644
--- a/gst/gstpipeline.c
+++ b/gst/gstpipeline.c
@@ -157,7 +157,8 @@ gst_pipeline_typefind (GstPipeline *pipeline, GstElement *element)
gst_bin_add (GST_BIN (pipeline), typefind);
- gst_bin_create_plan (GST_BIN (pipeline));
+ //gst_bin_create_plan (GST_BIN (pipeline));
+ gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_READY);
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
// keep pushing buffers... the have_type signal handler will set the found flag
diff --git a/gst/gstxml.c b/gst/gstxml.c
index ac426f4722..c76e3598b2 100644
--- a/gst/gstxml.c
+++ b/gst/gstxml.c
@@ -17,6 +17,7 @@
* Boston, MA 02111-1307, USA.
*/
+#include "gstdebug.h"
#include "gstxml.h"
static void gst_xml_class_init (GstXMLClass *klass);
@@ -107,7 +108,6 @@ gst_xml_new (const guchar *fname, const guchar *root)
xml = GST_XML(gtk_type_new(GST_TYPE_XML));
- xml->elements = g_hash_table_new(g_str_hash, g_str_equal);
xml->topelements = NULL;
field = doc->root->childs;
@@ -116,7 +116,11 @@ gst_xml_new (const guchar *fname, const guchar *root)
if (!strcmp(field->name, "element")) {
GstElement *element;
+ xml->elements = g_hash_table_new(g_str_hash, g_str_equal);
+
element = gst_element_load_thyself(field, xml->elements);
+
+ g_hash_table_destroy (xml->elements);
xml->topelements = g_list_prepend (xml->topelements, element);
}
@@ -163,7 +167,7 @@ gst_xml_get_element (GstXML *xml, const guchar *name)
g_return_val_if_fail(xml != NULL, NULL);
g_return_val_if_fail(name != NULL, NULL);
- g_print("gstxml: getting element \"%s\"\n", name);
+ DEBUG ("gstxml: getting element \"%s\"\n", name);
element = g_hash_table_lookup(xml->elements, name);
diff --git a/gstplay/main.c b/gstplay/main.c
index 1c4efdc6d6..cf9864dd1d 100644
--- a/gstplay/main.c
+++ b/gstplay/main.c
@@ -18,8 +18,6 @@ main (int argc, char *argv[])
glade_init();
glade_gnome_init();
- gst_type_dump ();
-
play = gst_media_play_new ();
if (argc > 1) {
diff --git a/plugins/elements/gstfakesink.c b/plugins/elements/gstfakesink.c
index be8af67bf7..a87f4b2cff 100644
--- a/plugins/elements/gstfakesink.c
+++ b/plugins/elements/gstfakesink.c
@@ -34,6 +34,7 @@ GstElementDetails gst_fakesink_details = {
/* FakeSink signals and args */
enum {
/* FILL ME */
+ SIGNAL_HANDOFF,
LAST_SIGNAL
};
@@ -49,7 +50,7 @@ static void gst_fakesink_init(GstFakeSink *fakesink);
static void gst_fakesink_chain(GstPad *pad,GstBuffer *buf);
static GstSinkClass *parent_class = NULL;
-//static guint gst_fakesink_signals[LAST_SIGNAL] = { 0 };
+static guint gst_fakesink_signals[LAST_SIGNAL] = { 0 };
GtkType
gst_fakesink_get_type (void)
@@ -75,10 +76,20 @@ gst_fakesink_get_type (void)
static void
gst_fakesink_class_init (GstFakeSinkClass *klass)
{
+ GtkObjectClass *gtkobject_class;
GstSinkClass *gstsink_class;
+ gtkobject_class = (GtkObjectClass*)klass;
gstsink_class = (GstSinkClass*)klass;
+ gst_fakesink_signals[SIGNAL_HANDOFF] =
+ gtk_signal_new ("handoff", GTK_RUN_LAST, gtkobject_class->type,
+ GTK_SIGNAL_OFFSET (GstFakeSinkClass, handoff),
+ gtk_marshal_NONE__NONE, GTK_TYPE_NONE, 0);
+
+ gtk_object_class_add_signals (gtkobject_class, gst_fakesink_signals,
+ LAST_SIGNAL);
+
parent_class = gtk_type_class (GST_TYPE_SINK);
}
@@ -114,4 +125,8 @@ gst_fakesink_chain (GstPad *pad, GstBuffer *buf)
g_print("(%s:%s)< ",GST_DEBUG_PAD_NAME(pad));
gst_buffer_unref (buf);
+
+ gtk_signal_emit (GTK_OBJECT (fakesink), gst_fakesink_signals[SIGNAL_HANDOFF],
+ fakesink);
+
}
diff --git a/plugins/elements/gstfakesink.h b/plugins/elements/gstfakesink.h
index c04e74f6df..f8bca9ca8f 100644
--- a/plugins/elements/gstfakesink.h
+++ b/plugins/elements/gstfakesink.h
@@ -56,6 +56,9 @@ struct _GstFakeSink {
struct _GstFakeSinkClass {
GstSinkClass parent_class;
+
+ /* signals */
+ void (*handoff) (GstElement *element,GstPad *pad);
};
GtkType gst_fakesink_get_type(void);
diff --git a/plugins/elements/gstidentity.c b/plugins/elements/gstidentity.c
index f5546b0cdf..3aa6f1d18b 100644
--- a/plugins/elements/gstidentity.c
+++ b/plugins/elements/gstidentity.c
@@ -39,7 +39,7 @@ enum {
enum {
ARG_0,
- ARG_CONTROL
+ ARG_LOOP_BASED,
};
@@ -86,11 +86,11 @@ gst_identity_class_init (GstIdentityClass *klass)
parent_class = gtk_type_class (GST_TYPE_FILTER);
- //gtk_object_add_arg_type("GstIdentity::control", GTK_TYPE_INT,
- // GTK_ARG_READWRITE, ARG_CONTROL);
+ gtk_object_add_arg_type ("GstIdentity::loop_based", GTK_TYPE_BOOL,
+ GTK_ARG_READWRITE, ARG_LOOP_BASED);
- //gtkobject_class->set_arg = gst_identity_set_arg;
- //gtkobject_class->get_arg = gst_identity_get_arg;
+ gtkobject_class->set_arg = gst_identity_set_arg;
+ gtkobject_class->get_arg = gst_identity_get_arg;
}
static void
@@ -103,7 +103,7 @@ gst_identity_init (GstIdentity *identity)
identity->srcpad = gst_pad_new ("src", GST_PAD_SRC);
gst_element_add_pad (GST_ELEMENT (identity), identity->srcpad);
- identity->control = 0;
+ identity->loop_based = FALSE;
}
static void
@@ -121,6 +121,22 @@ gst_identity_chain (GstPad *pad, GstBuffer *buf)
gst_pad_push (identity->srcpad, buf);
}
+static void
+gst_identity_loop (GstElement *element)
+{
+ GstIdentity *identity;
+ GstBuffer *buf;
+
+ g_return_if_fail (element != NULL);
+ g_return_if_fail (GST_IS_IDENTITY (element));
+
+ identity = GST_IDENTITY (element);
+
+ buf = gst_pad_pull (identity->sinkpad);
+
+ gst_pad_push (identity->srcpad, buf);
+}
+
static void
gst_identity_set_arg (GtkObject *object, GtkArg *arg, guint id)
{
@@ -132,8 +148,16 @@ gst_identity_set_arg (GtkObject *object, GtkArg *arg, guint id)
identity = GST_IDENTITY (object);
switch(id) {
- case ARG_CONTROL:
- identity->control = GTK_VALUE_INT (*arg);
+ case ARG_LOOP_BASED:
+ identity->loop_based = GTK_VALUE_BOOL (*arg);
+ if (identity->loop_based) {
+ gst_element_set_loop_function (GST_ELEMENT (identity), gst_identity_loop);
+ gst_pad_set_chain_function (identity->sinkpad, NULL);
+ }
+ else {
+ gst_pad_set_chain_function (identity->sinkpad, gst_identity_chain);
+ gst_element_set_loop_function (GST_ELEMENT (identity), NULL);
+ }
break;
default:
break;
@@ -149,8 +173,8 @@ static void gst_identity_get_arg(GtkObject *object,GtkArg *arg,guint id) {
identity = GST_IDENTITY (object);
switch (id) {
- case ARG_CONTROL:
- GTK_VALUE_INT (*arg) = identity->control;
+ case ARG_LOOP_BASED:
+ GTK_VALUE_BOOL (*arg) = identity->loop_based;
break;
default:
arg->type = GTK_TYPE_INVALID;
diff --git a/plugins/elements/gstidentity.h b/plugins/elements/gstidentity.h
index 5336a40aa5..a60c3c023c 100644
--- a/plugins/elements/gstidentity.h
+++ b/plugins/elements/gstidentity.h
@@ -54,7 +54,7 @@ struct _GstIdentity {
GstPad *sinkpad;
GstPad *srcpad;
- gint control;
+ gboolean loop_based;
};
struct _GstIdentityClass {
diff --git a/tests/sched/Makefile b/tests/sched/Makefile
new file mode 100644
index 0000000000..69ad83755c
--- /dev/null
+++ b/tests/sched/Makefile
@@ -0,0 +1,12 @@
+
+CC = libtool gcc
+
+all: runxml
+
+runxml: runxml.c
+ $(CC) -Wall `gstreamer-config --cflags --libs` runxml.c -o runxml
+
+clean:
+ rm -f *.o runxml
+
+
diff --git a/tests/sched/cases/(fs-fs).xml b/tests/sched/cases/(fs-fs).xml
new file mode 100644
index 0000000000..fa7dc97cec
--- /dev/null
+++ b/tests/sched/cases/(fs-fs).xml
@@ -0,0 +1,79 @@
+
+
+
+ new_element
+ thread
+ 0.9.2
+
+ GtkObject::user_data
+
+
+
+ fakesrc
+ fakesrc
+ 0.9.2
+
+ src
+ fakesink.sink
+
+
+ GstFakeSrc::num_sources
+ 1
+
+
+ GtkObject::user_data
+
+
+
+ fakesink
+ fakesink
+ 0.9.2
+
+ sink
+ fakesrc.src
+
+
+ GtkObject::user_data
+
+
+
+
+
+ bin2
+ bin
+ 0.9.2
+
+ GtkObject::user_data
+
+
+
+ fakesrc
+ fakesrc
+ 0.9.2
+
+ src
+ fakesink.sink
+
+
+ GstFakeSrc::num_sources
+ 1
+
+
+ GtkObject::user_data
+
+
+
+ fakesink
+ fakesink
+ 0.9.2
+
+ sink
+ fakesrc.src
+
+
+ GtkObject::user_data
+
+
+
+
+
diff --git a/tests/sched/cases/(fs-i-fs).xml b/tests/sched/cases/(fs-i-fs).xml
new file mode 100644
index 0000000000..9171bd97cf
--- /dev/null
+++ b/tests/sched/cases/(fs-i-fs).xml
@@ -0,0 +1,235 @@
+
+
+
+ bin1
+ bin
+ 0.9.2
+
+ GtkObject::user_data
+
+
+
+ fakesink
+ fakesink
+ 0.9.2
+
+ sink
+ identity.src
+
+
+ GtkObject::user_data
+
+
+
+ fakesrc
+ fakesrc
+ 0.9.2
+
+ src
+ identity.sink
+
+
+ GstFakeSrc::num_sources
+ 1
+
+
+ GtkObject::user_data
+
+
+
+ identity
+ identity
+ 0.9.2
+
+ sink
+ fakesrc.src
+
+
+ src
+ fakesink.sink
+
+
+ GstIdentity::loop_based
+ false
+
+
+ GtkObject::user_data
+
+
+
+
+
+ bin2
+ bin
+ 0.9.2
+
+ GtkObject::user_data
+
+
+
+ fakesink
+ fakesink
+ 0.9.2
+
+ sink
+ identity.src
+
+
+ GtkObject::user_data
+
+
+
+ fakesrc
+ fakesrc
+ 0.9.2
+
+ src
+ identity.sink
+
+
+ GstFakeSrc::num_sources
+ 1
+
+
+ GtkObject::user_data
+
+
+
+ identity
+ identity
+ 0.9.2
+
+ sink
+ fakesrc.src
+
+
+ src
+ fakesink.sink
+
+
+ GstIdentity::loop_based
+ true
+
+
+ GtkObject::user_data
+
+
+
+
+
+ bin3
+ thread
+ 0.9.2
+
+ GtkObject::user_data
+
+
+
+ fakesink
+ fakesink
+ 0.9.2
+
+ sink
+ identity.src
+
+
+ GtkObject::user_data
+
+
+
+ fakesrc
+ fakesrc
+ 0.9.2
+
+ src
+ identity.sink
+
+
+ GstFakeSrc::num_sources
+ 1
+
+
+ GtkObject::user_data
+
+
+
+ identity
+ identity
+ 0.9.2
+
+ sink
+ fakesrc.src
+
+
+ src
+ fakesink.sink
+
+
+ GstIdentity::loop_based
+ false
+
+
+ GtkObject::user_data
+
+
+
+
+
+ bin4
+ thread
+ 0.9.2
+
+ GtkObject::user_data
+
+
+
+ fakesink
+ fakesink
+ 0.9.2
+
+ sink
+ identity.src
+
+
+ GtkObject::user_data
+
+
+
+ fakesrc
+ fakesrc
+ 0.9.2
+
+ src
+ identity.sink
+
+
+ GstFakeSrc::num_sources
+ 1
+
+
+ GtkObject::user_data
+
+
+
+ identity
+ identity
+ 0.9.2
+
+ sink
+ fakesrc.src
+
+
+ src
+ fakesink.sink
+
+
+ GstIdentity::loop_based
+ true
+
+
+ GtkObject::user_data
+
+
+
+
+
diff --git a/tests/sched/cases/(fs-i-i-fs).xml b/tests/sched/cases/(fs-i-i-fs).xml
new file mode 100644
index 0000000000..a4ebc74b0c
--- /dev/null
+++ b/tests/sched/cases/(fs-i-i-fs).xml
@@ -0,0 +1,627 @@
+
+
+
+ bin1
+ bin
+ 0.9.2
+
+ GtkObject::user_data
+
+
+
+ fakesrc
+ fakesrc
+ 0.9.2
+
+ src
+ identity.sink
+
+
+ GstFakeSrc::num_sources
+ 1
+
+
+ GtkObject::user_data
+
+
+
+ fakesink
+ fakesink
+ 0.9.2
+
+ sink
+ identity.src
+
+
+ GtkObject::user_data
+
+
+
+ identity
+ identity
+ 0.9.2
+
+ sink
+ fakesrc.src
+
+
+ src
+ identity.sink
+
+
+ GstIdentity::loop_based
+ false
+
+
+ GtkObject::user_data
+
+
+
+ identity
+ identity
+ 0.9.2
+
+ sink
+ identity.src
+
+
+ src
+ fakesink.sink
+
+
+ GstIdentity::loop_based
+ false
+
+
+ GtkObject::user_data
+
+
+
+
+
+ bin2
+ bin
+ 0.9.2
+
+ GtkObject::user_data
+
+
+
+ fakesrc
+ fakesrc
+ 0.9.2
+
+ src
+ identity.sink
+
+
+ GstFakeSrc::num_sources
+ 1
+
+
+ GtkObject::user_data
+
+
+
+ fakesink
+ fakesink
+ 0.9.2
+
+ sink
+ identity.src
+
+
+ GtkObject::user_data
+
+
+
+ identity
+ identity
+ 0.9.2
+
+ sink
+ fakesrc.src
+
+
+ src
+ identity.sink
+
+
+ GstIdentity::loop_based
+ true
+
+
+ GtkObject::user_data
+
+
+
+ identity
+ identity
+ 0.9.2
+
+ sink
+ identity.src
+
+
+ src
+ fakesink.sink
+
+
+ GstIdentity::loop_based
+ false
+
+
+ GtkObject::user_data
+
+
+
+
+
+ bin3
+ bin
+ 0.9.2
+
+ GtkObject::user_data
+
+
+
+ fakesrc
+ fakesrc
+ 0.9.2
+
+ src
+ identity.sink
+
+
+ GstFakeSrc::num_sources
+ 1
+
+
+ GtkObject::user_data
+
+
+
+ fakesink
+ fakesink
+ 0.9.2
+
+ sink
+ identity.src
+
+
+ GtkObject::user_data
+
+
+
+ identity
+ identity
+ 0.9.2
+
+ sink
+ fakesrc.src
+
+
+ src
+ identity.sink
+
+
+ GstIdentity::loop_based
+ false
+
+
+ GtkObject::user_data
+
+
+
+ identity
+ identity
+ 0.9.2
+
+ sink
+ identity.src
+
+
+ src
+ fakesink.sink
+
+
+ GstIdentity::loop_based
+ true
+
+
+ GtkObject::user_data
+
+
+
+
+
+ bin4
+ bin
+ 0.9.2
+
+ GtkObject::user_data
+
+
+
+ fakesrc
+ fakesrc
+ 0.9.2
+
+ src
+ identity.sink
+
+
+ GstFakeSrc::num_sources
+ 1
+
+
+ GtkObject::user_data
+
+
+
+ fakesink
+ fakesink
+ 0.9.2
+
+ sink
+ identity.src
+
+
+ GtkObject::user_data
+
+
+
+ identity
+ identity
+ 0.9.2
+
+ sink
+ fakesrc.src
+
+
+ src
+ identity.sink
+
+
+ GstIdentity::loop_based
+ true
+
+
+ GtkObject::user_data
+
+
+
+ identity
+ identity
+ 0.9.2
+
+ sink
+ identity.src
+
+
+ src
+ fakesink.sink
+
+
+ GstIdentity::loop_based
+ true
+
+
+ GtkObject::user_data
+
+
+
+
+
+ thread1
+ thread
+ 0.9.2
+
+ GtkObject::user_data
+
+
+
+ fakesrc
+ fakesrc
+ 0.9.2
+
+ src
+ identity.sink
+
+
+ GstFakeSrc::num_sources
+ 1
+
+
+ GtkObject::user_data
+
+
+
+ fakesink
+ fakesink
+ 0.9.2
+
+ sink
+ identity.src
+
+
+ GtkObject::user_data
+
+
+
+ identity
+ identity
+ 0.9.2
+
+ sink
+ fakesrc.src
+
+
+ src
+ identity.sink
+
+
+ GstIdentity::loop_based
+ false
+
+
+ GtkObject::user_data
+
+
+
+ identity
+ identity
+ 0.9.2
+
+ sink
+ identity.src
+
+
+ src
+ fakesink.sink
+
+
+ GstIdentity::loop_based
+ false
+
+
+ GtkObject::user_data
+
+
+
+
+
+ thread2
+ thread
+ 0.9.2
+
+ GtkObject::user_data
+
+
+
+ fakesrc
+ fakesrc
+ 0.9.2
+
+ src
+ identity.sink
+
+
+ GstFakeSrc::num_sources
+ 1
+
+
+ GtkObject::user_data
+
+
+
+ fakesink
+ fakesink
+ 0.9.2
+
+ sink
+ identity.src
+
+
+ GtkObject::user_data
+
+
+
+ identity
+ identity
+ 0.9.2
+
+ sink
+ fakesrc.src
+
+
+ src
+ identity.sink
+
+
+ GstIdentity::loop_based
+ true
+
+
+ GtkObject::user_data
+
+
+
+ identity
+ identity
+ 0.9.2
+
+ sink
+ identity.src
+
+
+ src
+ fakesink.sink
+
+
+ GstIdentity::loop_based
+ false
+
+
+ GtkObject::user_data
+
+
+
+
+
+ thread3
+ thread
+ 0.9.2
+
+ GtkObject::user_data
+
+
+
+ fakesrc
+ fakesrc
+ 0.9.2
+
+ src
+ identity.sink
+
+
+ GstFakeSrc::num_sources
+ 1
+
+
+ GtkObject::user_data
+
+
+
+ fakesink
+ fakesink
+ 0.9.2
+
+ sink
+ identity.src
+
+
+ GtkObject::user_data
+
+
+
+ identity
+ identity
+ 0.9.2
+
+ sink
+ fakesrc.src
+
+
+ src
+ identity.sink
+
+
+ GstIdentity::loop_based
+ false
+
+
+ GtkObject::user_data
+
+
+
+ identity
+ identity
+ 0.9.2
+
+ sink
+ identity.src
+
+
+ src
+ fakesink.sink
+
+
+ GstIdentity::loop_based
+ true
+
+
+ GtkObject::user_data
+
+
+
+
+
+ thread4
+ thread
+ 0.9.2
+
+ GtkObject::user_data
+
+
+
+ fakesrc
+ fakesrc
+ 0.9.2
+
+ src
+ identity.sink
+
+
+ GstFakeSrc::num_sources
+ 1
+
+
+ GtkObject::user_data
+
+
+
+ fakesink
+ fakesink
+ 0.9.2
+
+ sink
+ identity.src
+
+
+ GtkObject::user_data
+
+
+
+ identity
+ identity
+ 0.9.2
+
+ sink
+ fakesrc.src
+
+
+ src
+ identity.sink
+
+
+ GstIdentity::loop_based
+ true
+
+
+ GtkObject::user_data
+
+
+
+ identity
+ identity
+ 0.9.2
+
+ sink
+ identity.src
+
+
+ src
+ fakesink.sink
+
+
+ GstIdentity::loop_based
+ true
+
+
+ GtkObject::user_data
+
+
+
+
+
diff --git a/tests/sched/cases/(fs-i-q[i-fs]).xml b/tests/sched/cases/(fs-i-q[i-fs]).xml
new file mode 100644
index 0000000000..3d0abdc85a
--- /dev/null
+++ b/tests/sched/cases/(fs-i-q[i-fs]).xml
@@ -0,0 +1,107 @@
+
+
+
+ new_element
+ bin
+ 0.9.2
+
+ GtkObject::user_data
+
+
+
+ thread
+ thread
+ 0.9.2
+
+ GstThread::create_thread
+ true
+
+
+ GtkObject::user_data
+
+
+
+ identity
+ identity
+ 0.9.2
+
+ sink
+ queue.src
+
+
+ src
+ fakesink.sink
+
+
+ GtkObject::user_data
+
+
+
+ fakesink
+ fakesink
+ 0.9.2
+
+ sink
+ identity.src
+
+
+ GtkObject::user_data
+
+
+
+
+
+ queue
+ queue
+ 0.9.2
+
+ sink
+ identity1.src
+
+
+ src
+ identity.sink
+
+
+ GstQueue::level
+ 0
+
+
+ GstQueue::max_level
+ 20
+
+
+ GtkObject::user_data
+
+
+
+ fakesrc
+ fakesrc
+ 0.9.2
+
+ src
+ identity1.sink
+
+
+ GtkObject::user_data
+
+
+
+ identity1
+ identity
+ 0.9.2
+
+ sink
+ fakesrc.src
+
+
+ src
+ queue.sink
+
+
+ GtkObject::user_data
+
+
+
+
+
diff --git a/tests/sched/runtestcases b/tests/sched/runtestcases
new file mode 100755
index 0000000000..c79ee3e92b
--- /dev/null
+++ b/tests/sched/runtestcases
@@ -0,0 +1,15 @@
+#/bin/bash
+
+echo "log" > log.txt
+
+for i in cases/*.xml
+do
+ ./runxml $i
+ error=$?
+ if test $error -ne 0;
+ then
+ echo $i " error," $error >>log.txt
+ else
+ echo $i " ok" >>log.txt
+ fi
+done
diff --git a/tests/sched/runxml.c b/tests/sched/runxml.c
new file mode 100644
index 0000000000..af38833553
--- /dev/null
+++ b/tests/sched/runxml.c
@@ -0,0 +1,74 @@
+#include
+
+static void
+buffer_handoff (GstElement *src, GstElement *bin)
+{
+ g_print ("\n\n *** buffer arrived in sink ***\n\n");
+ gst_element_set_state(bin, GST_STATE_NULL);
+}
+
+/* eos will be called when the src element has an end of stream */
+void eos(GstSrc *src, gpointer data)
+{
+ g_print("have eos, quitting\n");
+}
+
+int main(int argc,char *argv[])
+{
+ GstXML *xml;
+ GList *toplevelelements;
+ gint i = 1;
+
+ gst_init(&argc,&argv);
+
+ if (argc < 2) {
+ g_print ("usage: %s \n", argv[0]);
+ exit (-1);
+ }
+
+ g_print ("\n *** using testfile %s\n", argv[1]);
+
+ xml = gst_xml_new(argv[1], NULL);
+
+ toplevelelements = gst_xml_get_topelements (xml);
+
+ while (toplevelelements) {
+ GstElement *bin = (GstElement *)toplevelelements->data;
+ GstElement *src, *sink;
+
+ g_print ("\n ***** testcase %d\n", i++);
+
+ src = gst_bin_get_by_name (GST_BIN (bin), "fakesrc");
+ if (src) {
+ }
+ else {
+ g_print ("could not find src element\n");
+ exit(-1);
+ }
+
+ sink = gst_bin_get_by_name (GST_BIN (bin), "fakesink");
+ if (sink) {
+ gtk_signal_connect (GTK_OBJECT(sink), "handoff",
+ GTK_SIGNAL_FUNC(buffer_handoff), bin);
+ }
+ else {
+ g_print ("could not find sink element\n");
+ exit(-1);
+ }
+
+ gst_element_set_state(bin, GST_STATE_READY);
+ gst_element_set_state(bin, GST_STATE_PLAYING);
+
+ if (GST_IS_THREAD (bin)) {
+ sleep (1);
+ }
+ else {
+ gst_bin_iterate(GST_BIN(bin));
+ }
+
+ toplevelelements = g_list_next (toplevelelements);
+ }
+
+ exit(0);
+}
+
diff --git a/tests/sched/testcases b/tests/sched/testcases
index 8058fbf85b..cdbb45656a 100644
--- a/tests/sched/testcases
+++ b/tests/sched/testcases
@@ -36,6 +36,15 @@
4)
+ [-bin--------------------------------------------------------------]
+ ! [--------] [--------] [--------] [--------] !
+ ! !faksesrc! !identity! !identity! !fakesink! !
+ ! ! src --- sink src -- sink src -- sink ! !
+ ! [--------] [--------] [--------] [--------] !
+ [------------------------------------------------------------------]
+
+4b)
+
[-bin--------------------------------------------------------------]
! [--------] [--------] [--------] [--------] !
! !faksesrc! !identity! !identity! !fakesink! !