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.
This commit is contained in:
Andy Wingo 2002-01-19 06:29:40 +00:00
parent a7c3fc7d6c
commit a43702feb0
6 changed files with 49 additions and 22 deletions

View file

@ -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;

View file

@ -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)
@ -773,6 +774,21 @@ gst_pad_get_sched (GstPad *pad)
return GST_RPAD_SCHED(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

View file

@ -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);

View file

@ -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
*/

View file

@ -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;

View file

@ -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);