update to latest copy

Original commit message from CVS:
update to latest copy
This commit is contained in:
Erik Walthinsen 2001-03-09 18:50:12 +00:00
parent 781b4f7ecb
commit 3b2990b425
7 changed files with 129 additions and 101 deletions

View file

@ -29,7 +29,7 @@
#include <sys/mman.h> #include <sys/mman.h>
/* we make too much noise for normal debugging... */ /* we make too much noise for normal debugging... */
//#define GST_DEBUG_FORCE_DISABLE #define GST_DEBUG_FORCE_DISABLE
#include "gst_private.h" #include "gst_private.h"
#include "cothreads.h" #include "cothreads.h"

View file

@ -114,7 +114,7 @@ gst_bin_class_init (GstBinClass *klass)
klass->change_state_type = gst_bin_change_state_type; klass->change_state_type = gst_bin_change_state_type;
klass->create_plan = gst_bin_create_plan_func; klass->create_plan = gst_bin_create_plan_func;
klass->schedule = gst_bin_schedule_func; // klass->schedule = gst_bin_schedule_func;
klass->iterate = gst_bin_iterate_func; klass->iterate = gst_bin_iterate_func;
gstobject_class->save_thyself = gst_bin_save_thyself; gstobject_class->save_thyself = gst_bin_save_thyself;
@ -316,7 +316,7 @@ gst_bin_remove (GstBin *bin,
(GST_STATE (bin) == GST_STATE_PAUSED)); (GST_STATE (bin) == GST_STATE_PAUSED));
// the element must have its parent set to the current bin // the element must have its parent set to the current bin
g_return_if_fail (GST_ELEMENT_PARENT(element) == bin); g_return_if_fail (GST_ELEMENT_PARENT(element) == (GstElement *)bin);
// the element must be in the bin's list of children // the element must be in the bin's list of children
if (g_list_find(bin->children, element) == NULL) { if (g_list_find(bin->children, element) == NULL) {
@ -415,10 +415,10 @@ gst_bin_change_state (GstElement *element)
static GstElementStateReturn static GstElementStateReturn
gst_bin_change_state_norecurse (GstBin *bin) gst_bin_change_state_norecurse (GstBin *bin)
{ {
if (GST_ELEMENT_CLASS (parent_class)->change_state) {
if (GST_ELEMENT_CLASS (parent_class)->change_state) GST_DEBUG(GST_CAT_STATES, "setting bin's own state\n");
return GST_ELEMENT_CLASS (parent_class)->change_state (GST_ELEMENT (bin)); return GST_ELEMENT_CLASS (parent_class)->change_state (GST_ELEMENT (bin));
else } else
return GST_STATE_FAILURE; return GST_STATE_FAILURE;
} }
@ -738,9 +738,11 @@ typedef struct {
} region_struct; } region_struct;
/* seriously depracated!!! */
static void static void
gst_bin_create_plan_func (GstBin *bin) gst_bin_create_plan_func (GstBin *bin)
{ {
/*
GstElement *manager; GstElement *manager;
GList *elements; GList *elements;
GstElement *element; GstElement *element;
@ -749,6 +751,7 @@ gst_bin_create_plan_func (GstBin *bin)
#endif #endif
GSList *pending = NULL; GSList *pending = NULL;
GstBin *pending_bin; GstBin *pending_bin;
*/
GST_DEBUG_ENTER("(\"%s\")",GST_ELEMENT_NAME (bin)); GST_DEBUG_ENTER("(\"%s\")",GST_ELEMENT_NAME (bin));
@ -943,7 +946,21 @@ gst_bin_iterate_func (GstBin *bin)
// FIXME this should be lots more intelligent about where to start // FIXME this should be lots more intelligent about where to start
GST_DEBUG (0,"starting iteration via cothreads\n"); GST_DEBUG (0,"starting iteration via cothreads\n");
entry = GST_ELEMENT (chain->elements->data); entries = chain->elements;
entry = NULL;
// find an element with a threadstate to start with
while (entries) {
entry = GST_ELEMENT (entries->data);
if (entry->threadstate)
break;
entries = g_list_next (entries);
}
// if we couldn't find one, bail out
if (entries == NULL)
GST_ERROR(GST_ELEMENT(bin),"no cothreaded elements found!");
GST_FLAG_SET (entry, GST_ELEMENT_COTHREAD_STOPPING); GST_FLAG_SET (entry, GST_ELEMENT_COTHREAD_STOPPING);
GST_DEBUG (0,"set COTHREAD_STOPPING flag on \"%s\"(@%p)\n", GST_DEBUG (0,"set COTHREAD_STOPPING flag on \"%s\"(@%p)\n",
GST_ELEMENT_NAME (entry),entry); GST_ELEMENT_NAME (entry),entry);

View file

@ -721,7 +721,7 @@ gst_element_set_state (GstElement *element, GstElementState state)
/* if that outright didn't work, we need to bail right away */ /* if that outright didn't work, we need to bail right away */
/* NOTE: this will bail on ASYNC as well! */ /* NOTE: this will bail on ASYNC as well! */
if (return_val == GST_STATE_FAILURE) { if (return_val == GST_STATE_FAILURE) {
// GST_DEBUG (0,"have async return from '%s'\n",GST_ELEMENT_NAME (element)); GST_DEBUG (GST_CAT_STATES,"have failed change_state return from '%s'\n",GST_ELEMENT_NAME (element));
return return_val; return return_val;
} }
} }

View file

@ -1205,6 +1205,8 @@ gst_pad_eos_func(GstPad *pad)
GST_INFO (GST_CAT_PADS,"set EOS on sink pad %s:%s",GST_DEBUG_PAD_NAME(pad)); GST_INFO (GST_CAT_PADS,"set EOS on sink pad %s:%s",GST_DEBUG_PAD_NAME(pad));
GST_FLAG_SET (pad, GST_PAD_EOS); GST_FLAG_SET (pad, GST_PAD_EOS);
gst_element_set_state (GST_ELEMENT(GST_PAD_PARENT(pad)), GST_STATE_READY);
return TRUE; return TRUE;
} }
@ -1232,6 +1234,8 @@ gst_pad_set_eos(GstPad *pad)
GST_INFO (GST_CAT_PADS,"set EOS on src pad %s:%s",GST_DEBUG_PAD_NAME(pad)); GST_INFO (GST_CAT_PADS,"set EOS on src pad %s:%s",GST_DEBUG_PAD_NAME(pad));
GST_FLAG_SET (pad, GST_PAD_EOS); GST_FLAG_SET (pad, GST_PAD_EOS);
gst_element_set_state (GST_ELEMENT(GST_PAD_PARENT(pad)), GST_STATE_READY);
gst_element_signal_eos (GST_ELEMENT (GST_PAD_PARENT (pad))); gst_element_signal_eos (GST_ELEMENT (GST_PAD_PARENT (pad)));
return TRUE; return TRUE;

View file

@ -35,10 +35,10 @@ gst_bin_loopfunc_wrapper (int argc,char *argv[])
GST_DEBUG_ENTER("(%d,'%s')",argc,name); GST_DEBUG_ENTER("(%d,'%s')",argc,name);
do { do {
GST_DEBUG (0,"calling loopfunc %s for element %s\n", GST_DEBUG (GST_CAT_DATAFLOW,"calling loopfunc %s for element %s\n",
GST_DEBUG_FUNCPTR_NAME (element->loopfunc),name); GST_DEBUG_FUNCPTR_NAME (element->loopfunc),name);
(element->loopfunc) (element); (element->loopfunc) (element);
GST_DEBUG (0,"element %s ended loop function\n", name); GST_DEBUG (GST_CAT_DATAFLOW,"element %s ended loop function\n", name);
} while (!GST_ELEMENT_IS_COTHREAD_STOPPING(element)); } while (!GST_ELEMENT_IS_COTHREAD_STOPPING(element));
GST_FLAG_UNSET(element,GST_ELEMENT_COTHREAD_STOPPING); GST_FLAG_UNSET(element,GST_ELEMENT_COTHREAD_STOPPING);
@ -57,7 +57,7 @@ gst_bin_chain_wrapper (int argc,char *argv[])
GstBuffer *buf; GstBuffer *buf;
GST_DEBUG_ENTER("(\"%s\")",name); GST_DEBUG_ENTER("(\"%s\")",name);
GST_DEBUG (0,"stepping through pads\n"); GST_DEBUG (GST_CAT_DATAFLOW,"stepping through pads\n");
do { do {
pads = element->pads; pads = element->pads;
while (pads) { while (pads) {
@ -66,11 +66,11 @@ gst_bin_chain_wrapper (int argc,char *argv[])
if (!GST_IS_REAL_PAD(pad)) continue; if (!GST_IS_REAL_PAD(pad)) continue;
realpad = GST_REAL_PAD(pad); realpad = GST_REAL_PAD(pad);
if (GST_RPAD_DIRECTION(realpad) == GST_PAD_SINK) { if (GST_RPAD_DIRECTION(realpad) == GST_PAD_SINK) {
GST_DEBUG (0,"pulling a buffer from %s:%s\n", name, GST_PAD_NAME (pad)); GST_DEBUG (GST_CAT_DATAFLOW,"pulling a buffer from %s:%s\n", name, GST_PAD_NAME (pad));
buf = gst_pad_pull (pad); buf = gst_pad_pull (pad);
GST_DEBUG (0,"calling chain function of %s:%s\n", name, GST_PAD_NAME (pad)); GST_DEBUG (GST_CAT_DATAFLOW,"calling chain function of %s:%s\n", name, GST_PAD_NAME (pad));
if (buf) GST_RPAD_CHAINFUNC(realpad) (pad,buf); if (buf) GST_RPAD_CHAINFUNC(realpad) (pad,buf);
GST_DEBUG (0,"calling chain function of %s:%s done\n", name, GST_PAD_NAME (pad)); GST_DEBUG (GST_CAT_DATAFLOW,"calling chain function of %s:%s done\n", name, GST_PAD_NAME (pad));
} }
} }
} while (!GST_ELEMENT_IS_COTHREAD_STOPPING(element)); } while (!GST_ELEMENT_IS_COTHREAD_STOPPING(element));
@ -98,7 +98,7 @@ gst_bin_src_wrapper (int argc,char *argv[])
realpad = (GstRealPad*)(pads->data); realpad = (GstRealPad*)(pads->data);
pads = g_list_next(pads); pads = g_list_next(pads);
if (GST_RPAD_DIRECTION(realpad) == GST_PAD_SRC) { if (GST_RPAD_DIRECTION(realpad) == GST_PAD_SRC) {
GST_DEBUG (0,"calling _getfunc for %s:%s\n",GST_DEBUG_PAD_NAME(realpad)); GST_DEBUG (GST_CAT_DATAFLOW,"calling _getfunc for %s:%s\n",GST_DEBUG_PAD_NAME(realpad));
if (realpad->regiontype != GST_REGION_NONE) { if (realpad->regiontype != GST_REGION_NONE) {
g_return_val_if_fail (GST_RPAD_GETREGIONFUNC(realpad) != NULL, 0); g_return_val_if_fail (GST_RPAD_GETREGIONFUNC(realpad) != NULL, 0);
// if (GST_RPAD_GETREGIONFUNC(realpad) == NULL) // if (GST_RPAD_GETREGIONFUNC(realpad) == NULL)
@ -113,7 +113,7 @@ gst_bin_src_wrapper (int argc,char *argv[])
buf = GST_RPAD_GETFUNC(realpad) ((GstPad*)realpad); buf = GST_RPAD_GETFUNC(realpad) ((GstPad*)realpad);
} }
GST_DEBUG (0,"calling gst_pad_push on pad %s:%s\n",GST_DEBUG_PAD_NAME(realpad)); GST_DEBUG (GST_CAT_DATAFLOW,"calling gst_pad_push on pad %s:%s\n",GST_DEBUG_PAD_NAME(realpad));
if (buf) gst_pad_push ((GstPad*)realpad, buf); if (buf) gst_pad_push ((GstPad*)realpad, buf);
} }
} }
@ -127,30 +127,29 @@ gst_bin_src_wrapper (int argc,char *argv[])
static void static void
gst_bin_pushfunc_proxy (GstPad *pad, GstBuffer *buf) gst_bin_pushfunc_proxy (GstPad *pad, GstBuffer *buf)
{ {
GstPad *peer = GST_RPAD_PEER(pad); GstRealPad *peer = GST_RPAD_PEER(pad);
cothread_state *threadstate;
GST_DEBUG_ENTER("(%s:%s)",GST_DEBUG_PAD_NAME(pad)); GST_DEBUG_ENTER("(%s:%s)",GST_DEBUG_PAD_NAME(pad));
GST_DEBUG (GST_CAT_DATAFLOW,"putting buffer %p in peer's pen\n",buf); GST_DEBUG (GST_CAT_DATAFLOW,"putting buffer %p in peer's pen\n",buf);
// FIXME this should be bounded // FIXME this should be bounded
// loop until the bufferpen is empty so we can fill it up again // loop until the bufferpen is empty so we can fill it up again
while (GST_RPAD_BUFPEN(pad) != NULL) { while (GST_RPAD_BUFPEN(pad) != NULL) {
threadstate = GST_ELEMENT (GST_PAD_PARENT (pad))->threadstate; GST_DEBUG (GST_CAT_DATAFLOW, "switching to %p to empty bufpen\n",
GST_DEBUG (GST_CAT_DATAFLOW, "switching to %p to empty bufpen\n",threadstate); GST_ELEMENT (GST_PAD_PARENT (pad))->threadstate);
cothread_switch (threadstate); cothread_switch (GST_ELEMENT (GST_PAD_PARENT (pad))->threadstate);
// we may no longer be the same pad, check. // we may no longer be the same pad, check.
if (GST_RPAD_PEER(peer) != pad) { if (GST_RPAD_PEER(peer) != (GstRealPad *)pad) {
GST_DEBUG (GST_CAT_DATAFLOW, "new pad in mid-switch!\n"); GST_DEBUG (GST_CAT_DATAFLOW, "new pad in mid-switch!\n");
pad = GST_RPAD_PEER(peer); pad = (GstPad *)GST_RPAD_PEER(peer);
} }
} }
threadstate = GST_ELEMENT (GST_PAD_PARENT (pad))->threadstate;
// now fill the bufferpen and switch so it can be consumed // now fill the bufferpen and switch so it can be consumed
GST_RPAD_BUFPEN(GST_RPAD_PEER(pad)) = buf; GST_RPAD_BUFPEN(GST_RPAD_PEER(pad)) = buf;
GST_DEBUG (GST_CAT_DATAFLOW,"switching to %p (@%p)\n",threadstate,&(GST_ELEMENT(GST_PAD_PARENT(pad))->threadstate)); GST_DEBUG (GST_CAT_DATAFLOW,"switching to %p\n",GST_ELEMENT (GST_PAD_PARENT (pad))->threadstate);
cothread_switch (threadstate); cothread_switch (GST_ELEMENT (GST_PAD_PARENT (pad))->threadstate);
GST_DEBUG (GST_CAT_DATAFLOW,"done switching\n"); GST_DEBUG (GST_CAT_DATAFLOW,"done switching\n");
} }
@ -158,26 +157,23 @@ gst_bin_pushfunc_proxy (GstPad *pad, GstBuffer *buf)
static GstBuffer* static GstBuffer*
gst_bin_pullfunc_proxy (GstPad *pad) gst_bin_pullfunc_proxy (GstPad *pad)
{ {
GstPad *peer = GST_RPAD_PEER(pad);
GstBuffer *buf; GstBuffer *buf;
GstRealPad *peer = GST_RPAD_PEER(pad);
cothread_state *threadstate;
GST_DEBUG_ENTER("(%s:%s)",GST_DEBUG_PAD_NAME(pad)); GST_DEBUG_ENTER("(%s:%s)",GST_DEBUG_PAD_NAME(pad));
// FIXME this should be bounded // FIXME this should be bounded
// we will loop switching to the peer until it's filled up the bufferpen // we will loop switching to the peer until it's filled up the bufferpen
while (GST_RPAD_BUFPEN(pad) == NULL) { while (GST_RPAD_BUFPEN(pad) == NULL) {
// get the new threadstate, if it changed (FIXME?)
threadstate = GST_ELEMENT(GST_PAD_PARENT(pad))->threadstate;
GST_DEBUG (GST_CAT_DATAFLOW, "switching to \"%s\": %p to fill bufpen\n", GST_DEBUG (GST_CAT_DATAFLOW, "switching to \"%s\": %p to fill bufpen\n",
GST_ELEMENT_NAME(GST_ELEMENT(GST_PAD_PARENT(pad))),threadstate); GST_ELEMENT_NAME(GST_ELEMENT(GST_PAD_PARENT(pad))),
cothread_switch (threadstate); GST_ELEMENT(GST_PAD_PARENT(pad))->threadstate);
cothread_switch (GST_ELEMENT(GST_PAD_PARENT(pad))->threadstate);
// we may no longer be the same pad, check. // we may no longer be the same pad, check.
if (GST_RPAD_PEER(peer) != pad) { if (GST_RPAD_PEER(peer) != (GstRealPad *)pad) {
GST_DEBUG (GST_CAT_DATAFLOW, "new pad in mid-switch!\n"); GST_DEBUG (GST_CAT_DATAFLOW, "new pad in mid-switch!\n");
pad = GST_RPAD_PEER(peer); pad = (GstPad *)GST_RPAD_PEER(peer);
} }
} }
GST_DEBUG (GST_CAT_DATAFLOW,"done switching\n"); GST_DEBUG (GST_CAT_DATAFLOW,"done switching\n");
@ -192,9 +188,8 @@ static GstBuffer*
gst_bin_pullregionfunc_proxy (GstPad *pad,GstRegionType type,guint64 offset,guint64 len) gst_bin_pullregionfunc_proxy (GstPad *pad,GstRegionType type,guint64 offset,guint64 len)
{ {
GstBuffer *buf; GstBuffer *buf;
GstPad *peer = GST_RPAD_PEER(pad); GstRealPad *peer = GST_RPAD_PEER(pad);
cothread_state *threadstate = GST_ELEMENT(GST_PAD_PARENT(pad))->threadstate;
GST_DEBUG_ENTER("%s:%s,%d,%lld,%lld",GST_DEBUG_PAD_NAME(pad),type,offset,len); GST_DEBUG_ENTER("%s:%s,%d,%lld,%lld",GST_DEBUG_PAD_NAME(pad),type,offset,len);
// put the region info into the pad // put the region info into the pad
@ -205,14 +200,14 @@ gst_bin_pullregionfunc_proxy (GstPad *pad,GstRegionType type,guint64 offset,guin
// FIXME this should be bounded // FIXME this should be bounded
// we will loop switching to the peer until it's filled up the bufferpen // we will loop switching to the peer until it's filled up the bufferpen
while (GST_RPAD_BUFPEN(pad) == NULL) { while (GST_RPAD_BUFPEN(pad) == NULL) {
threadstate = GST_ELEMENT (GST_PAD_PARENT (pad))->threadstate; GST_DEBUG (GST_CAT_DATAFLOW, "switching to %p to fill bufpen\n",
GST_DEBUG (GST_CAT_DATAFLOW, "switching to %p to fill bufpen\n",threadstate); GST_ELEMENT(GST_PAD_PARENT(pad))->threadstate);
cothread_switch (threadstate); cothread_switch (GST_ELEMENT(GST_PAD_PARENT(pad))->threadstate);
// we may no longer be the same pad, check. // we may no longer be the same pad, check.
if (GST_RPAD_PEER(peer) != pad) { if (GST_RPAD_PEER(peer) != (GstRealPad *)pad) {
GST_DEBUG (GST_CAT_DATAFLOW, "new pad in mid-switch!\n"); GST_DEBUG (GST_CAT_DATAFLOW, "new pad in mid-switch!\n");
pad = GST_RPAD_PEER(peer); pad = (GstPad *)GST_RPAD_PEER(peer);
} }
} }
GST_DEBUG (GST_CAT_DATAFLOW,"done switching\n"); GST_DEBUG (GST_CAT_DATAFLOW,"done switching\n");
@ -232,11 +227,11 @@ gst_schedule_cothreaded_chain (GstBin *bin, GstScheduleChain *chain) {
GList *pads; GList *pads;
GstPad *pad; GstPad *pad;
GST_DEBUG (0,"chain is using COTHREADS\n"); GST_DEBUG (GST_CAT_SCHEDULING,"chain is using COTHREADS\n");
// first create thread context // first create thread context
if (bin->threadcontext == NULL) { if (bin->threadcontext == NULL) {
GST_DEBUG (0,"initializing cothread context\n"); GST_DEBUG (GST_CAT_SCHEDULING,"initializing cothread context\n");
bin->threadcontext = cothread_init (); bin->threadcontext = cothread_init ();
} }
@ -252,7 +247,7 @@ gst_schedule_cothreaded_chain (GstBin *bin, GstScheduleChain *chain) {
// if the element has a loopfunc... // if the element has a loopfunc...
if (element->loopfunc != NULL) { if (element->loopfunc != NULL) {
wrapper_function = GST_DEBUG_FUNCPTR(gst_bin_loopfunc_wrapper); wrapper_function = GST_DEBUG_FUNCPTR(gst_bin_loopfunc_wrapper);
GST_DEBUG (0,"element '%s' is a loop-based\n",GST_ELEMENT_NAME(element)); GST_DEBUG (GST_CAT_SCHEDULING,"element '%s' is a loop-based\n",GST_ELEMENT_NAME(element));
} else { } else {
// otherwise we need to decide what kind of cothread // otherwise we need to decide what kind of cothread
// if it's not DECOUPLED, we decide based on whether it's a source or not // if it's not DECOUPLED, we decide based on whether it's a source or not
@ -260,10 +255,10 @@ gst_schedule_cothreaded_chain (GstBin *bin, GstScheduleChain *chain) {
// if it doesn't have any sinks, it must be a source (duh) // if it doesn't have any sinks, it must be a source (duh)
if (element->numsinkpads == 0) { if (element->numsinkpads == 0) {
wrapper_function = GST_DEBUG_FUNCPTR(gst_bin_src_wrapper); wrapper_function = GST_DEBUG_FUNCPTR(gst_bin_src_wrapper);
GST_DEBUG (0,"element '%s' is a source, using _src_wrapper\n",GST_ELEMENT_NAME(element)); GST_DEBUG (GST_CAT_SCHEDULING,"element '%s' is a source, using _src_wrapper\n",GST_ELEMENT_NAME(element));
} else { } else {
wrapper_function = GST_DEBUG_FUNCPTR(gst_bin_chain_wrapper); wrapper_function = GST_DEBUG_FUNCPTR(gst_bin_chain_wrapper);
GST_DEBUG (0,"element '%s' is a filter, using _chain_wrapper\n",GST_ELEMENT_NAME(element)); GST_DEBUG (GST_CAT_SCHEDULING,"element '%s' is a filter, using _chain_wrapper\n",GST_ELEMENT_NAME(element));
} }
} }
} }
@ -282,10 +277,10 @@ gst_schedule_cothreaded_chain (GstBin *bin, GstScheduleChain *chain) {
) { ) {
// set the chain proxies // set the chain proxies
if (GST_RPAD_DIRECTION(pad) == GST_PAD_SINK) { if (GST_RPAD_DIRECTION(pad) == GST_PAD_SINK) {
GST_DEBUG (0,"copying chain function into push proxy for %s:%s\n",GST_DEBUG_PAD_NAME(pad)); GST_DEBUG (GST_CAT_SCHEDULING,"copying chain function into push proxy for %s:%s\n",GST_DEBUG_PAD_NAME(pad));
GST_RPAD_PUSHFUNC(pad) = GST_RPAD_CHAINFUNC(pad); GST_RPAD_PUSHFUNC(pad) = GST_RPAD_CHAINFUNC(pad);
} else { } else {
GST_DEBUG (0,"copying get function into pull proxy for %s:%s\n",GST_DEBUG_PAD_NAME(pad)); GST_DEBUG (GST_CAT_SCHEDULING,"copying get function into pull proxy for %s:%s\n",GST_DEBUG_PAD_NAME(pad));
GST_RPAD_PULLFUNC(pad) = GST_RPAD_GETFUNC(pad); GST_RPAD_PULLFUNC(pad) = GST_RPAD_GETFUNC(pad);
GST_RPAD_PULLREGIONFUNC(pad) = GST_RPAD_GETREGIONFUNC(pad); GST_RPAD_PULLREGIONFUNC(pad) = GST_RPAD_GETREGIONFUNC(pad);
} }
@ -293,10 +288,10 @@ gst_schedule_cothreaded_chain (GstBin *bin, GstScheduleChain *chain) {
// otherwise we really are a cothread // otherwise we really are a cothread
} else { } else {
if (gst_pad_get_direction (pad) == GST_PAD_SINK) { if (gst_pad_get_direction (pad) == GST_PAD_SINK) {
GST_DEBUG (0,"setting cothreaded push proxy for sinkpad %s:%s\n",GST_DEBUG_PAD_NAME(pad)); GST_DEBUG (GST_CAT_SCHEDULING,"setting cothreaded push proxy for sinkpad %s:%s\n",GST_DEBUG_PAD_NAME(pad));
GST_RPAD_PUSHFUNC(pad) = GST_DEBUG_FUNCPTR(gst_bin_pushfunc_proxy); GST_RPAD_PUSHFUNC(pad) = GST_DEBUG_FUNCPTR(gst_bin_pushfunc_proxy);
} else { } else {
GST_DEBUG (0,"setting cothreaded pull proxy for srcpad %s:%s\n",GST_DEBUG_PAD_NAME(pad)); GST_DEBUG (GST_CAT_SCHEDULING,"setting cothreaded pull proxy for srcpad %s:%s\n",GST_DEBUG_PAD_NAME(pad));
GST_RPAD_PULLFUNC(pad) = GST_DEBUG_FUNCPTR(gst_bin_pullfunc_proxy); GST_RPAD_PULLFUNC(pad) = GST_DEBUG_FUNCPTR(gst_bin_pullfunc_proxy);
GST_RPAD_PULLREGIONFUNC(pad) = GST_DEBUG_FUNCPTR(gst_bin_pullregionfunc_proxy); GST_RPAD_PULLREGIONFUNC(pad) = GST_DEBUG_FUNCPTR(gst_bin_pullregionfunc_proxy);
} }
@ -307,10 +302,10 @@ gst_schedule_cothreaded_chain (GstBin *bin, GstScheduleChain *chain) {
if (wrapper_function != NULL) { if (wrapper_function != NULL) {
if (element->threadstate == NULL) { if (element->threadstate == NULL) {
element->threadstate = cothread_create (bin->threadcontext); element->threadstate = cothread_create (bin->threadcontext);
GST_DEBUG (0,"created cothread %p for '%s'\n",element->threadstate,GST_ELEMENT_NAME(element)); GST_DEBUG (GST_CAT_SCHEDULING,"created cothread %p for '%s'\n",element->threadstate,GST_ELEMENT_NAME(element));
} }
cothread_setfunc (element->threadstate, wrapper_function, 0, (char **)element); cothread_setfunc (element->threadstate, wrapper_function, 0, (char **)element);
GST_DEBUG (0,"set wrapper function for '%s' to &%s\n",GST_ELEMENT_NAME(element), GST_DEBUG (GST_CAT_SCHEDULING,"set wrapper function for '%s' to &%s\n",GST_ELEMENT_NAME(element),
GST_DEBUG_FUNCPTR_NAME(wrapper_function)); GST_DEBUG_FUNCPTR_NAME(wrapper_function));
} }
} }
@ -323,7 +318,7 @@ gst_schedule_chained_chain (GstBin *bin, _GstBinChain *chain) {
GList *pads; GList *pads;
GstPad *pad; GstPad *pad;
GST_DEBUG (0,"chain entered\n"); GST_DEBUG (GST_CAT_SCHEDULING,"chain entered\n");
// walk through all the elements // walk through all the elements
elements = chain->elements; elements = chain->elements;
while (elements) { while (elements) {
@ -338,10 +333,10 @@ gst_schedule_chained_chain (GstBin *bin, _GstBinChain *chain) {
if (!GST_IS_REAL_PAD(pad)) continue; if (!GST_IS_REAL_PAD(pad)) continue;
if (GST_RPAD_DIRECTION(pad) == GST_PAD_SINK) { if (GST_RPAD_DIRECTION(pad) == GST_PAD_SINK) {
GST_DEBUG (0,"copying chain function into push proxy for %s:%s\n",GST_DEBUG_PAD_NAME(pad)); GST_DEBUG (GST_CAT_SCHEDULING,"copying chain function into push proxy for %s:%s\n",GST_DEBUG_PAD_NAME(pad));
GST_RPAD_PUSHFUNC(pad) = GST_RPAD_CHAINFUNC(pad); GST_RPAD_PUSHFUNC(pad) = GST_RPAD_CHAINFUNC(pad);
} else { } else {
GST_DEBUG (0,"copying get function into pull proxy for %s:%s\n",GST_DEBUG_PAD_NAME(pad)); GST_DEBUG (GST_CAT_SCHEDULING,"copying get function into pull proxy for %s:%s\n",GST_DEBUG_PAD_NAME(pad));
GST_RPAD_PULLFUNC(pad) = GST_RPAD_GETFUNC(pad); GST_RPAD_PULLFUNC(pad) = GST_RPAD_GETFUNC(pad);
GST_RPAD_PULLREGIONFUNC(pad) = GST_RPAD_GETREGIONFUNC(pad); GST_RPAD_PULLREGIONFUNC(pad) = GST_RPAD_GETREGIONFUNC(pad);
} }
@ -349,6 +344,7 @@ gst_schedule_chained_chain (GstBin *bin, _GstBinChain *chain) {
} }
} }
/* depracated!! */
static void static void
gst_bin_schedule_cleanup (GstBin *bin) gst_bin_schedule_cleanup (GstBin *bin)
{ {
@ -360,6 +356,7 @@ gst_bin_schedule_cleanup (GstBin *bin)
chain = (_GstBinChain *)(chains->data); chain = (_GstBinChain *)(chains->data);
chains = g_list_next(chains); chains = g_list_next(chains);
// g_list_free(chain->disabled);
g_list_free(chain->elements); g_list_free(chain->elements);
g_list_free(chain->entries); g_list_free(chain->entries);
@ -373,10 +370,11 @@ gst_bin_schedule_cleanup (GstBin *bin)
static void static void
gst_scheduler_handle_eos (GstElement *element, _GstBinChain *chain) gst_scheduler_handle_eos (GstElement *element, _GstBinChain *chain)
{ {
GST_DEBUG (0,"chain removed from scheduler, EOS from element \"%s\"\n", GST_ELEMENT_NAME (element)); GST_DEBUG (GST_CAT_SCHEDULING,"chain removed from scheduler, EOS from element \"%s\"\n", GST_ELEMENT_NAME (element));
chain->need_scheduling = FALSE; chain->need_scheduling = FALSE;
} }
/*
void gst_bin_schedule_func(GstBin *bin) { void gst_bin_schedule_func(GstBin *bin) {
GList *elements; GList *elements;
GstElement *element; GstElement *element;
@ -385,14 +383,14 @@ void gst_bin_schedule_func(GstBin *bin) {
GstPad *pad; GstPad *pad;
GstElement *peerparent; GstElement *peerparent;
GList *chains; GList *chains;
_GstBinChain *chain; GstScheduleChain *chain;
GST_DEBUG_ENTER("(\"%s\")",GST_ELEMENT_NAME (GST_ELEMENT (bin))); GST_DEBUG_ENTER("(\"%s\")",GST_ELEMENT_NAME (GST_ELEMENT (bin)));
gst_bin_schedule_cleanup(bin); gst_bin_schedule_cleanup(bin);
// next we have to find all the separate scheduling chains // next we have to find all the separate scheduling chains
GST_DEBUG (0,"attempting to find scheduling chains...\n"); GST_DEBUG (GST_CAT_SCHEDULING,"attempting to find scheduling chains...\n");
// first make a copy of the managed_elements we can mess with // first make a copy of the managed_elements we can mess with
elements = g_list_copy (bin->managed_elements); elements = g_list_copy (bin->managed_elements);
// we have to repeat until the list is empty to get all chains // we have to repeat until the list is empty to get all chains
@ -402,12 +400,12 @@ void gst_bin_schedule_func(GstBin *bin) {
// if this is a DECOUPLED element // if this is a DECOUPLED element
if (GST_FLAG_IS_SET (element, GST_ELEMENT_DECOUPLED)) { if (GST_FLAG_IS_SET (element, GST_ELEMENT_DECOUPLED)) {
// skip this element entirely // skip this element entirely
GST_DEBUG (0,"skipping '%s' because it's decoupled\n",GST_ELEMENT_NAME(element)); GST_DEBUG (GST_CAT_SCHEDULING,"skipping '%s' because it's decoupled\n",GST_ELEMENT_NAME(element));
elements = g_list_next (elements); elements = g_list_next (elements);
continue; continue;
} }
GST_DEBUG (0,"starting with element '%s'\n",GST_ELEMENT_NAME(element)); GST_DEBUG (GST_CAT_SCHEDULING,"starting with element '%s'\n",GST_ELEMENT_NAME(element));
// prime the pending list with the first element off the top // prime the pending list with the first element off the top
pending = g_slist_prepend (NULL, element); pending = g_slist_prepend (NULL, element);
@ -425,7 +423,7 @@ void gst_bin_schedule_func(GstBin *bin) {
pending = g_slist_remove (pending, element); pending = g_slist_remove (pending, element);
// add ourselves to the chain's list of elements // add ourselves to the chain's list of elements
GST_DEBUG (0,"adding '%s' to chain\n",GST_ELEMENT_NAME(element)); GST_DEBUG (GST_CAT_SCHEDULING,"adding '%s' to chain\n",GST_ELEMENT_NAME(element));
chain->elements = g_list_prepend (chain->elements, element); chain->elements = g_list_prepend (chain->elements, element);
chain->num_elements++; chain->num_elements++;
gtk_signal_connect (GTK_OBJECT (element), "eos", gst_scheduler_handle_eos, chain); gtk_signal_connect (GTK_OBJECT (element), "eos", gst_scheduler_handle_eos, chain);
@ -440,13 +438,13 @@ void gst_bin_schedule_func(GstBin *bin) {
if ((element->manager == GST_ELEMENT(bin)) && if ((element->manager == GST_ELEMENT(bin)) &&
!GST_FLAG_IS_SET (element, GST_ELEMENT_DECOUPLED)) { !GST_FLAG_IS_SET (element, GST_ELEMENT_DECOUPLED)) {
// remove ourselves from the outer list of all managed elements // remove ourselves from the outer list of all managed elements
// GST_DEBUG (0,"removing '%s' from list of possible elements\n",GST_ELEMENT_NAME(element)); // GST_DEBUG (GST_CAT_SCHEDULING,"removing '%s' from list of possible elements\n",GST_ELEMENT_NAME(element));
elements = g_list_remove (elements, element); elements = g_list_remove (elements, element);
// if this element is a source, add it as an entry // if this element is a source, add it as an entry
if (element->numsinkpads == 0) { if (element->numsinkpads == 0) {
chain->entries = g_list_prepend (chain->entries, element); chain->entries = g_list_prepend (chain->entries, element);
GST_DEBUG (0,"added '%s' as SRC entry into the chain\n",GST_ELEMENT_NAME(element)); GST_DEBUG (GST_CAT_SCHEDULING,"added '%s' as SRC entry into the chain\n",GST_ELEMENT_NAME(element));
} }
// now we have to walk the pads to find peers // now we have to walk the pads to find peers
@ -455,7 +453,7 @@ void gst_bin_schedule_func(GstBin *bin) {
pad = GST_PAD (pads->data); pad = GST_PAD (pads->data);
pads = g_list_next (pads); pads = g_list_next (pads);
if (!GST_IS_REAL_PAD(pad)) continue; if (!GST_IS_REAL_PAD(pad)) continue;
GST_DEBUG (0,"have pad %s:%s\n",GST_DEBUG_PAD_NAME(pad)); GST_DEBUG (GST_CAT_SCHEDULING,"have pad %s:%s\n",GST_DEBUG_PAD_NAME(pad));
if (GST_RPAD_PEER(pad) == NULL) continue; if (GST_RPAD_PEER(pad) == NULL) continue;
if (GST_RPAD_PEER(pad) == NULL) GST_ERROR(pad,"peer is null!"); if (GST_RPAD_PEER(pad) == NULL) GST_ERROR(pad,"peer is null!");
@ -464,13 +462,13 @@ void gst_bin_schedule_func(GstBin *bin) {
peerparent = GST_ELEMENT(GST_PAD_PARENT (GST_PAD(GST_RPAD_PEER(pad)))); peerparent = GST_ELEMENT(GST_PAD_PARENT (GST_PAD(GST_RPAD_PEER(pad))));
GST_DEBUG (0,"peer pad %p\n", GST_RPAD_PEER(pad)); GST_DEBUG (GST_CAT_SCHEDULING,"peer pad %p\n", GST_RPAD_PEER(pad));
// only bother with if the pad's peer's parent is this bin or it's DECOUPLED // only bother with if the pad's peer's parent is this bin or it's DECOUPLED
// only add it if it's in the list of un-visited elements still // only add it if it's in the list of un-visited elements still
if ((g_list_find (elements, peerparent) != NULL) || if ((g_list_find (elements, peerparent) != NULL) ||
GST_FLAG_IS_SET (peerparent, GST_ELEMENT_DECOUPLED)) { GST_FLAG_IS_SET (peerparent, GST_ELEMENT_DECOUPLED)) {
// add the peer element to the pending list // add the peer element to the pending list
GST_DEBUG (0,"adding '%s' to list of pending elements\n", GST_DEBUG (GST_CAT_SCHEDULING,"adding '%s' to list of pending elements\n",
GST_ELEMENT_NAME(peerparent)); GST_ELEMENT_NAME(peerparent));
pending = g_slist_prepend (pending, peerparent); pending = g_slist_prepend (pending, peerparent);
@ -479,36 +477,36 @@ void gst_bin_schedule_func(GstBin *bin) {
(GST_FLAG_IS_SET (peerparent, GST_ELEMENT_DECOUPLED))) { (GST_FLAG_IS_SET (peerparent, GST_ELEMENT_DECOUPLED))) {
chain->entries = g_list_prepend (chain->entries, peerparent); chain->entries = g_list_prepend (chain->entries, peerparent);
gtk_signal_connect (GTK_OBJECT (peerparent), "eos", gst_scheduler_handle_eos, chain); gtk_signal_connect (GTK_OBJECT (peerparent), "eos", gst_scheduler_handle_eos, chain);
GST_DEBUG (0,"added '%s' as DECOUPLED entry into the chain\n",GST_ELEMENT_NAME(peerparent)); GST_DEBUG (GST_CAT_SCHEDULING,"added '%s' as DECOUPLED entry into the chain\n",GST_ELEMENT_NAME(peerparent));
} }
} else } else
GST_DEBUG (0,"element '%s' has already been dealt with\n",GST_ELEMENT_NAME(peerparent)); GST_DEBUG (GST_CAT_SCHEDULING,"element '%s' has already been dealt with\n",GST_ELEMENT_NAME(peerparent));
} }
} }
} while (pending); } while (pending);
// add the chain to the bin // add the chain to the bin
GST_DEBUG (0,"have chain with %d elements: ",chain->num_elements); GST_DEBUG (GST_CAT_SCHEDULING,"have chain with %d elements: ",chain->num_elements);
{ GList *elements = chain->elements; { GList *elements = chain->elements;
while (elements) { while (elements) {
element = GST_ELEMENT (elements->data); element = GST_ELEMENT (elements->data);
elements = g_list_next(elements); elements = g_list_next(elements);
GST_DEBUG_NOPREFIX(0,"%s, ",GST_ELEMENT_NAME(element)); GST_DEBUG_NOPREFIX(GST_CAT_SCHEDULING,"%s, ",GST_ELEMENT_NAME(element));
} }
} }
GST_DEBUG_NOPREFIX(0,"\n"); GST_DEBUG_NOPREFIX(GST_CAT_DATAFLOW,"\n");
bin->chains = g_list_prepend (bin->chains, chain); bin->chains = g_list_prepend (bin->chains, chain);
bin->num_chains++; bin->num_chains++;
} }
// free up the list in case it's full of DECOUPLED elements // free up the list in case it's full of DECOUPLED elements
g_list_free (elements); g_list_free (elements);
GST_DEBUG (0,"\nwe have %d chains to schedule\n",bin->num_chains); GST_DEBUG (GST_CAT_SCHEDULING,"\nwe have %d chains to schedule\n",bin->num_chains);
// now we have to go through all the chains and schedule them // now we have to go through all the chains and schedule them
chains = bin->chains; chains = bin->chains;
while (chains) { while (chains) {
chain = (_GstBinChain *)(chains->data); chain = (GstScheduleChain *)(chains->data);
chains = g_list_next (chains); chains = g_list_next (chains);
// schedule as appropriate // schedule as appropriate
@ -521,6 +519,7 @@ void gst_bin_schedule_func(GstBin *bin) {
GST_DEBUG_LEAVE("(\"%s\")",GST_ELEMENT_NAME(GST_ELEMENT(bin))); GST_DEBUG_LEAVE("(\"%s\")",GST_ELEMENT_NAME(GST_ELEMENT(bin)));
} }
*/
/* /*
@ -774,7 +773,6 @@ void gst_bin_schedule_func(GstBin *bin) {
*/ */
/*************** INCREMENTAL SCHEDULING CODE STARTS HERE ***************/ /*************** INCREMENTAL SCHEDULING CODE STARTS HERE ***************/
//static GstSchedule realsched; //static GstSchedule realsched;
@ -912,7 +910,7 @@ gst_schedule_chain_enable_element (GstScheduleChain *chain, GstElement *element)
chain->elements = g_list_prepend (chain->elements, element); chain->elements = g_list_prepend (chain->elements, element);
// reschedule the chain // reschedule the chain
gst_schedule_cothreaded_chain(chain->sched->parent,chain); gst_schedule_cothreaded_chain(GST_BIN(chain->sched->parent),chain);
} }
void void
@ -927,7 +925,7 @@ gst_schedule_chain_disable_element (GstScheduleChain *chain, GstElement *element
chain->disabled = g_list_prepend (chain->disabled, element); chain->disabled = g_list_prepend (chain->disabled, element);
// reschedule the chain // reschedule the chain
gst_schedule_cothreaded_chain(chain->sched->parent,chain); gst_schedule_cothreaded_chain(GST_BIN(chain->sched->parent),chain);
} }
void void
@ -1081,8 +1079,8 @@ gst_schedule_pad_disconnect (GstSchedule *sched, GstPad *srcpad, GstPad *sinkpad
GST_INFO (GST_CAT_SCHEDULING, "have pad disconnected callback on %s:%s",GST_DEBUG_PAD_NAME(srcpad)); GST_INFO (GST_CAT_SCHEDULING, "have pad disconnected callback on %s:%s",GST_DEBUG_PAD_NAME(srcpad));
// we need to have the parent elements of each pad // we need to have the parent elements of each pad
element1 = GST_PAD_PARENT(srcpad); element1 = GST_ELEMENT(GST_PAD_PARENT(srcpad));
element2 = GST_PAD_PARENT(sinkpad); element2 = GST_ELEMENT(GST_PAD_PARENT(sinkpad));
GST_INFO (GST_CAT_SCHEDULING, "disconnecting elements \"%s\" and \"%s\"", GST_INFO (GST_CAT_SCHEDULING, "disconnecting elements \"%s\" and \"%s\"",
GST_ELEMENT_NAME(element1), GST_ELEMENT_NAME(element2)); GST_ELEMENT_NAME(element1), GST_ELEMENT_NAME(element2));
@ -1187,9 +1185,6 @@ gst_schedule_disable_element (GstSchedule *sched, GstElement *element)
void void
gst_schedule_remove_element (GstSchedule *sched, GstElement *element) gst_schedule_remove_element (GstSchedule *sched, GstElement *element)
{ {
GList *chains;
GstScheduleChain *chain;
g_return_if_fail (element != NULL); g_return_if_fail (element != NULL);
g_return_if_fail (GST_IS_ELEMENT(element)); g_return_if_fail (GST_IS_ELEMENT(element));
@ -1212,14 +1207,10 @@ gst_schedule_remove_element (GstSchedule *sched, GstElement *element)
gboolean gboolean
gst_schedule_iterate (GstSchedule *sched) gst_schedule_iterate (GstSchedule *sched)
{ {
GstBin *bin = sched->parent; GstBin *bin = GST_BIN(sched->parent);
GList *chains; GList *chains;
GstScheduleChain *chain; GstScheduleChain *chain;
GList *entries;
GstElement *entry; GstElement *entry;
GList *pads;
GstPad *pad;
GstBuffer *buf = NULL;
gint num_scheduled = 0; gint num_scheduled = 0;
gboolean eos = FALSE; gboolean eos = FALSE;
@ -1231,6 +1222,7 @@ gst_schedule_iterate (GstSchedule *sched)
// step through all the chains // step through all the chains
chains = sched->chains; chains = sched->chains;
if (chains == NULL) return FALSE;
while (chains) { while (chains) {
chain = (GstScheduleChain *)(chains->data); chain = (GstScheduleChain *)(chains->data);
chains = g_list_next (chains); chains = g_list_next (chains);
@ -1240,18 +1232,27 @@ gst_schedule_iterate (GstSchedule *sched)
// if (chain->need_cothreads) { // if (chain->need_cothreads) {
// all we really have to do is switch to the first child // all we really have to do is switch to the first child
// FIXME this should be lots more intelligent about where to start // FIXME this should be lots more intelligent about where to start
GST_DEBUG (0,"starting iteration via cothreads\n"); GST_DEBUG (GST_CAT_DATAFLOW,"starting iteration via cothreads\n");
entry = GST_ELEMENT (chain->elements->data); if (chain->elements) {
GST_FLAG_SET (entry, GST_ELEMENT_COTHREAD_STOPPING); // FIXME FIXME FIXME need to not use a DECOUPLED element as entry
GST_DEBUG (0,"set COTHREAD_STOPPING flag on \"%s\"(@%p)\n", entry = GST_ELEMENT (chain->elements->data);
GST_ELEMENT_NAME (entry),entry); if (entry) {
cothread_switch (entry->threadstate); GST_FLAG_SET (entry, GST_ELEMENT_COTHREAD_STOPPING);
GST_DEBUG (GST_CAT_DATAFLOW,"set COTHREAD_STOPPING flag on \"%s\"(@%p)\n",
GST_ELEMENT_NAME (entry),entry);
cothread_switch (entry->threadstate);
} else {
GST_INFO (GST_CAT_DATAFLOW,"no entry into chain!");
}
} else {
GST_INFO (GST_CAT_DATAFLOW,"no entry into chain!");
}
/* /*
} else { } else {
GST_DEBUG (0,"starting iteration via chain-functions\n"); GST_DEBUG (GST_CAT_DATAFLOW,"starting iteration via chain-functions\n");
entries = chain->entries; entries = chain->entries;
g_assert (entries != NULL); g_assert (entries != NULL);
@ -1260,7 +1261,7 @@ gst_schedule_iterate (GstSchedule *sched)
entry = GST_ELEMENT (entries->data); entry = GST_ELEMENT (entries->data);
entries = g_list_next (entries); entries = g_list_next (entries);
GST_DEBUG (0,"have entry \"%s\"\n",GST_ELEMENT_NAME (entry)); GST_DEBUG (GST_CAT_DATAFLOW,"have entry \"%s\"\n",GST_ELEMENT_NAME (entry));
if (GST_IS_BIN (entry)) { if (GST_IS_BIN (entry)) {
gst_bin_iterate (GST_BIN (entry)); gst_bin_iterate (GST_BIN (entry));
@ -1269,7 +1270,7 @@ gst_schedule_iterate (GstSchedule *sched)
while (pads) { while (pads) {
pad = GST_PAD (pads->data); pad = GST_PAD (pads->data);
if (GST_RPAD_DIRECTION(pad) == GST_PAD_SRC) { if (GST_RPAD_DIRECTION(pad) == GST_PAD_SRC) {
GST_DEBUG (0,"calling getfunc of %s:%s\n",GST_DEBUG_PAD_NAME(pad)); GST_DEBUG (GST_CAT_DATAFLOW,"calling getfunc of %s:%s\n",GST_DEBUG_PAD_NAME(pad));
if (GST_REAL_PAD(pad)->getfunc == NULL) if (GST_REAL_PAD(pad)->getfunc == NULL)
fprintf(stderr, "error, no getfunc in \"%s\"\n", GST_ELEMENT_NAME (entry)); fprintf(stderr, "error, no getfunc in \"%s\"\n", GST_ELEMENT_NAME (entry));
else else
@ -1290,9 +1291,9 @@ gst_schedule_iterate (GstSchedule *sched)
// are there any other elements that are still busy? // are there any other elements that are still busy?
if (bin->num_eos_providers) { if (bin->num_eos_providers) {
GST_LOCK (bin); GST_LOCK (bin);
GST_DEBUG (0,"waiting for eos providers\n"); GST_DEBUG (GST_CATA_DATAFLOW,"waiting for eos providers\n");
g_cond_wait (bin->eoscond, GST_OBJECT(bin)->lock); g_cond_wait (bin->eoscond, GST_OBJECT(bin)->lock);
GST_DEBUG (0,"num eos providers %d\n", bin->num_eos_providers); GST_DEBUG (GST_CAT_DATAFLOW,"num eos providers %d\n", bin->num_eos_providers);
GST_UNLOCK (bin); GST_UNLOCK (bin);
} }
else { else {
@ -1302,7 +1303,7 @@ gst_schedule_iterate (GstSchedule *sched)
} }
*/ */
GST_DEBUG (0, "leaving (%s)\n", GST_ELEMENT_NAME (bin)); GST_DEBUG (GST_CAT_DATAFLOW, "leaving (%s)\n", GST_ELEMENT_NAME (bin));
return !eos; return !eos;
} }

View file

@ -66,6 +66,7 @@ struct _GstThread {
pthread_t thread_id; /* id of the thread, if any */ pthread_t thread_id; /* id of the thread, if any */
GMutex *lock; /* thread lock/condititon pair... */ GMutex *lock; /* thread lock/condititon pair... */
GCond *cond; /* used to control the thread */ GCond *cond; /* used to control the thread */
gboolean signaling;
gint transition; /* the current state transition */ gint transition; /* the current state transition */
}; };

View file

@ -1,3 +1,5 @@
<<<<<<< incsched.c
<<<<<<< incsched.c
#include <stdlib.h> #include <stdlib.h>
#include <gst/gst.h> #include <gst/gst.h>
@ -118,8 +120,11 @@ int main(int argc,char *argv[]) {
g_print("\n\nIterating:\n"); g_print("\n\nIterating:\n");
gst_bin_iterate(thread); gst_bin_iterate(thread);
return; //return;
g_print("\n\nSetting EOS on fakesrc and iterating again:\n"); g_print("\n\nSetting EOS on fakesrc and iterating again:\n");
gtk_object_set(GTK_OBJECT(src),"eos",TRUE,NULL); gtk_object_set(GTK_OBJECT(src),"eos",TRUE,NULL);
gst_bin_iterate(thread); gst_bin_iterate(thread);
g_print("\n\nIterating:\n");
gst_bin_iterate(thread);
} }