summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2002-01-19 06:29:40 +0000
committerAndy Wingo <wingo@pobox.com>2002-01-19 06:29:40 +0000
commita43702feb036cd7e47799bc08c4ac02528052009 (patch)
treee87092a0bffc91b061412669c4d5a5e1d8e635eb
parenta7c3fc7d6ce57b4f47607952f05fd1637aa2f7c4 (diff)
miscellaneous fixes, added gst_pad_unset_sched() api.
Original commit message from CVS: miscellaneous fixes, added gst_pad_unset_sched() api. although I unref the old pipeline and the cothread context gets freed in dynamic-pipeline.c, I still get segfaults.
-rw-r--r--gst/gstbin.c2
-rw-r--r--gst/gstpad.c20
-rw-r--r--gst/gstpad.h1
-rw-r--r--gst/gstscheduler.c35
-rw-r--r--gst/schedulers/gstbasicscheduler.c7
-rw-r--r--tests/sched/dynamic-pipeline.c6
6 files changed, 49 insertions, 22 deletions
diff --git a/gst/gstbin.c b/gst/gstbin.c
index 2c68a3162..c4282859b 100644
--- a/gst/gstbin.c
+++ b/gst/gstbin.c
@@ -751,7 +751,7 @@ gst_bin_iterate_func (GstBin * bin)
}
}
else {
- g_warning ("bin \"%d\" can't be iterated on!\n", GST_ELEMENT_NAME (bin));
+ g_warning ("bin \"%s\" can't be iterated on!\n", GST_ELEMENT_NAME (bin));
}
return FALSE;
diff --git a/gst/gstpad.c b/gst/gstpad.c
index 04ca54ed6..3e9811207 100644
--- a/gst/gstpad.c
+++ b/gst/gstpad.c
@@ -621,11 +621,12 @@ gst_pad_connect_filtered (GstPad *srcpad, GstPad *sinkpad, GstCaps *filtercaps)
g_warning ("cannot connect pads from decoupled elements with the same sched\n");
return FALSE;
} else if (realsrc->sched != realsink->sched && num_decoupled != 1) {
- g_warning ("connecting pads with different scheds requires one decoupled element (queue)\n");
+ g_warning ("connecting pads with different scheds requires exactly one decoupled element (queue)\n");
return FALSE;
}
} else if (realsrc->sched || realsink->sched) {
g_warning ("you can't connect to a non-managed element");
+ return FALSE;
}
/* check for reversed directions and swap if necessary */
@@ -745,7 +746,7 @@ gst_pad_get_padtemplate (GstPad *pad)
* @pad: the pad to set the scheduler for
* @sched: The scheduler to set
*
- * Set the sceduler for the pad
+ * Set the scheduler for the pad
*/
void
gst_pad_set_sched (GstPad *pad, GstScheduler *sched)
@@ -774,6 +775,21 @@ gst_pad_get_sched (GstPad *pad)
}
/**
+ * gst_pad_unset_sched:
+ * @pad: the pad to unset the scheduler for
+ *
+ * Unset the scheduler for the pad
+ */
+void
+gst_pad_unset_sched (GstPad *pad)
+{
+ g_return_if_fail (pad != NULL);
+ g_return_if_fail (GST_IS_PAD (pad));
+
+ GST_RPAD_SCHED(pad) = NULL;
+}
+
+/**
* gst_pad_get_real_parent:
* @pad: the pad to get the parent from
*
diff --git a/gst/gstpad.h b/gst/gstpad.h
index 974af3ce3..1038bffa1 100644
--- a/gst/gstpad.h
+++ b/gst/gstpad.h
@@ -373,6 +373,7 @@ GstElement* gst_pad_get_real_parent (GstPad *pad);
void gst_pad_set_sched (GstPad *pad, GstScheduler *sched);
GstScheduler* gst_pad_get_sched (GstPad *pad);
+void gst_pad_unset_sched (GstPad *pad);
void gst_pad_add_ghost_pad (GstPad *pad, GstPad *ghostpad);
void gst_pad_remove_ghost_pad (GstPad *pad, GstPad *ghostpad);
diff --git a/gst/gstscheduler.c b/gst/gstscheduler.c
index 8bba009c5..63a063646 100644
--- a/gst/gstscheduler.c
+++ b/gst/gstscheduler.c
@@ -71,7 +71,7 @@ gst_scheduler_init (GstScheduler *sched)
/**
* gst_scheduler_setup:
- * @sched: the schedulerr
+ * @sched: the scheduler
*
* Prepare the scheduler.
*/
@@ -86,7 +86,7 @@ gst_scheduler_setup (GstScheduler *sched)
/**
* gst_scheduler_reset:
- * @sched: the schedulerr
+ * @sched: the scheduler
*
* Reset the scheduler
*/
@@ -101,7 +101,7 @@ gst_scheduler_reset (GstScheduler *sched)
/**
* gst_scheduler_pad_connect:
- * @sched: the schedulerr
+ * @sched: the scheduler
* @srcpad: the srcpad to connect
* @sinkpad: the sinkpad to connect to
*
@@ -120,7 +120,7 @@ gst_scheduler_pad_connect (GstScheduler *sched, GstPad *srcpad, GstPad *sinkpad)
/**
* gst_scheduler_pad_disconnect:
- * @sched: the schedulerr
+ * @sched: the scheduler
* @srcpad: the srcpad to disconnect
* @sinkpad: the sinkpad to disconnect from
*
@@ -139,7 +139,7 @@ gst_scheduler_pad_disconnect (GstScheduler *sched, GstPad *srcpad, GstPad *sinkp
/**
* gst_scheduler_pad_select:
- * @sched: the schedulerr
+ * @sched: the scheduler
* @padlist: the padlist to select on
*
* register the given padlist for a select operation.
@@ -158,7 +158,7 @@ gst_scheduler_pad_select (GstScheduler *sched, GList *padlist)
/**
* gst_scheduler_add_element:
- * @sched: the schedulerr
+ * @sched: the scheduler
* @element: the element to add to the schedulerr
*
* Add an element to the schedulerr.
@@ -175,7 +175,7 @@ gst_scheduler_add_element (GstScheduler *sched, GstElement *element)
/**
* gst_scheduler_state_transition:
- * @sched: the schedulerr
+ * @sched: the scheduler
* @element: the element with the state transition
* @transition: the state transition
*
@@ -199,23 +199,28 @@ gst_scheduler_state_transition (GstScheduler *sched, GstElement *element, gint t
/**
* gst_scheduler_remove_element:
* @sched: the schedulerr
- * @element: the element to remove
+ * @element: the element to remov
*
* Remove an element from the schedulerr.
*/
void
gst_scheduler_remove_element (GstScheduler *sched, GstElement *element)
{
+ GList *l;
+
g_return_if_fail (GST_IS_SCHEDULER (sched));
g_return_if_fail (GST_IS_ELEMENT (element));
if (CLASS (sched)->remove_element)
CLASS (sched)->remove_element (sched, element);
+
+ for (l=element->pads; l; l=l->next)
+ gst_pad_unset_sched ((GstPad*) l->data);
}
/**
* gst_scheduler_lock_element:
- * @sched: the schedulerr
+ * @sched: the scheduler
* @element: the element to lock
*
* Acquire a lock on the given element in the given scheduler.
@@ -232,7 +237,7 @@ gst_scheduler_lock_element (GstScheduler *sched, GstElement *element)
/**
* gst_scheduler_unlock_element:
- * @sched: the schedulerr
+ * @sched: the scheduler
* @element: the element to unlock
*
* Release the lock on the given element in the given scheduler.
@@ -249,7 +254,7 @@ gst_scheduler_unlock_element (GstScheduler *sched, GstElement *element)
/**
* gst_scheduler_error:
- * @sched: the schedulerr
+ * @sched: the scheduler
* @element: the element with the error
*
* Tell the scheduler an element was in error
@@ -266,7 +271,7 @@ gst_scheduler_error (GstScheduler *sched, GstElement *element)
/**
* gst_scheduler_yield:
- * @sched: the schedulerr
+ * @sched: the scheduler
* @element: the element requesting a yield
*
* Tell the scheduler to schedule another element.
@@ -283,7 +288,7 @@ gst_scheduler_yield (GstScheduler *sched, GstElement *element)
/**
* gst_scheduler_interrupt:
- * @sched: the schedulerr
+ * @sched: the scheduler
* @element: the element requesting an interrupt
*
* Tell the scheduler to interrupt execution of this element.
@@ -305,7 +310,7 @@ gst_scheduler_interrupt (GstScheduler *sched, GstElement *element)
/**
* gst_scheduler_iterate:
- * @sched: the schedulerr
+ * @sched: the scheduler
*
* Perform one iteration on the schedulerr.
*
@@ -323,7 +328,7 @@ gst_scheduler_iterate (GstScheduler *sched)
/**
* gst_scheduler_show:
- * @sched: the schedulerr
+ * @sched: the scheduler
*
* Dump the state of the schedulerr
*/
diff --git a/gst/schedulers/gstbasicscheduler.c b/gst/schedulers/gstbasicscheduler.c
index 3027380d2..5510201fc 100644
--- a/gst/schedulers/gstbasicscheduler.c
+++ b/gst/schedulers/gstbasicscheduler.c
@@ -920,10 +920,9 @@ gst_basic_scheduler_add_element (GstScheduler * sched, GstElement * element)
GST_INFO (GST_CAT_SCHEDULING, "adding element \"%s\" to scheduler", GST_ELEMENT_NAME (element));
/* if the element already has a different scheduler, remove the element from it */
- if (GST_ELEMENT_SCHED (element)) {
- gst_basic_scheduler_remove_element (GST_ELEMENT_SCHED (element), element);
- }
-
+ if (GST_ELEMENT_SCHED (element))
+ GST_ERROR(GST_CAT_SCHEDULING, "grave error");
+
/* set the sched pointer in the element itself */
GST_ELEMENT_SCHED (element) = sched;
diff --git a/tests/sched/dynamic-pipeline.c b/tests/sched/dynamic-pipeline.c
index 77d6213c9..abaee6f7c 100644
--- a/tests/sched/dynamic-pipeline.c
+++ b/tests/sched/dynamic-pipeline.c
@@ -1,5 +1,10 @@
#include <gst/gst.h>
+/* This test will fail because it tries to allocate two cothread_context's in
+ * one thread. This will cause a segfault. This is a problem with gstreamer's
+ * cothreading that will be fixed in the future.
+ */
+
int main (int argc, char *argv[])
{
GstElement *fakesrc, *fakesink1, *fakesink2, *pipe1, *pipe2;
@@ -32,6 +37,7 @@ int main (int argc, char *argv[])
gst_object_ref(GST_OBJECT(fakesrc));
gst_bin_remove(GST_BIN(pipe1), fakesrc);
gst_bin_remove(GST_BIN(pipe1), fakesink1);
+ gst_object_unref(GST_OBJECT(pipe1));
// make a new pipeline
gst_bin_add (GST_BIN(pipe2), fakesink2);