Commit c287566d authored by Erik Walthinsen's avatar Erik Walthinsen

Massive scheduling changes (again). Not entirely complete, but getting...

Massive scheduling changes (again).  Not entirely complete, but getting closer.  Need to think about various scheduli...

Original commit message from CVS:
Massive scheduling changes (again).  Not entirely complete, but getting
closer.  Need to think about various scheduling plans that we might want
to produce, and figure out the rules for what is legal, and how to get
the results we need as far as the plan.
parent 1e3492f0
......@@ -57,8 +57,8 @@ static void gst_asyncdisksrc_init (GstAsyncDiskSrc *asyncdisksrc);
static void gst_asyncdisksrc_set_arg (GtkObject *object, GtkArg *arg, guint id);
static void gst_asyncdisksrc_get_arg (GtkObject *object, GtkArg *arg, guint id);
static void gst_asyncdisksrc_get (GstPad *pad);
static void gst_asyncdisksrc_get_region (GstPad *pad, gulong offset, gulong size);
static GstBuffer * gst_asyncdisksrc_get (GstPad *pad);
static GstBuffer * gst_asyncdisksrc_get_region (GstPad *pad, gulong offset, gulong size);
static GstElementStateReturn gst_asyncdisksrc_change_state (GstElement *element);
......@@ -209,35 +209,34 @@ gst_asyncdisksrc_get_arg (GtkObject *object, GtkArg *arg, guint id)
*
* Push a new buffer from the asyncdisksrc at the current offset.
*/
static void
static GstBuffer *
gst_asyncdisksrc_get (GstPad *pad)
{
GstAsyncDiskSrc *src;
GstBuffer *buf;
g_return_if_fail (pad != NULL);
g_return_val_if_fail (pad != NULL, NULL);
src = GST_ASYNCDISKSRC (gst_pad_get_parent(pad));
g_return_if_fail (GST_FLAG_IS_SET (src, GST_ASYNCDISKSRC_OPEN));
g_return_val_if_fail (GST_FLAG_IS_SET (src, GST_ASYNCDISKSRC_OPEN), NULL);
/* deal with EOF state */
if (src->curoffset >= src->size) {
gst_src_signal_eos (GST_SRC (src));
return;
return NULL;
}
/* create the buffer */
// FIXME: should eventually use a bufferpool for this
buf = gst_buffer_new ();
g_return_if_fail (buf != NULL);
g_return_val_if_fail (buf != NULL, NULL);
/* simply set the buffer to point to the correct region of the file */
GST_BUFFER_DATA (buf) = src->map + src->curoffset;
GST_BUFFER_OFFSET (buf) = src->curoffset;
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_DONTFREE);
if ((src->curoffset + src->bytes_per_read) >
src->size) {
if ((src->curoffset + src->bytes_per_read) > src->size) {
GST_BUFFER_SIZE (buf) = src->size - src->curoffset;
// FIXME: set the buffer's EOF bit here
} else
......@@ -250,8 +249,8 @@ gst_asyncdisksrc_get (GstPad *pad)
src->new_seek = FALSE;
}
/* we're done, push the buffer off now */
gst_pad_push (pad, buf);
/* we're done, return the buffer */
return buf;
}
/**
......@@ -262,29 +261,29 @@ gst_asyncdisksrc_get (GstPad *pad)
*
* Push a new buffer from the asyncdisksrc of given size at given offset.
*/
static void
static GstBuffer *
gst_asyncdisksrc_get_region (GstPad *pad, gulong offset, gulong size)
{
GstAsyncDiskSrc *src;
GstBuffer *buf;
g_return_if_fail (pad != NULL);
g_return_val_if_fail (pad != NULL, NULL);
src = GST_ASYNCDISKSRC (gst_pad_get_parent(pad));
g_return_if_fail (GST_IS_ASYNCDISKSRC (src));
g_return_if_fail (GST_FLAG_IS_SET (src, GST_ASYNCDISKSRC_OPEN));
g_return_val_if_fail (GST_IS_ASYNCDISKSRC (src), NULL);
g_return_val_if_fail (GST_FLAG_IS_SET (src, GST_ASYNCDISKSRC_OPEN), NULL);
/* deal with EOF state */
if (offset >= src->size) {
gst_src_signal_eos (GST_SRC (src));
return;
return NULL;
}
/* create the buffer */
// FIXME: should eventually use a bufferpool for this
buf = gst_buffer_new ();
g_return_if_fail (buf);
g_return_val_if_fail (buf != NULL, NULL);
/* simply set the buffer to point to the correct region of the file */
GST_BUFFER_DATA (buf) = src->map + offset;
......
......@@ -64,7 +64,7 @@ static void gst_audiosrc_close_audio (GstAudioSrc *src);
static gboolean gst_audiosrc_open_audio (GstAudioSrc *src);
static void gst_audiosrc_sync_parms (GstAudioSrc *audiosrc);
static void gst_audiosrc_get (GstPad *pad);
static GstBuffer * gst_audiosrc_get (GstPad *pad);
static GstSrcClass *parent_class = NULL;
//static guint gst_audiosrc_signals[LAST_SIGNAL] = { 0 };
......@@ -140,27 +140,29 @@ gst_audiosrc_init (GstAudioSrc *audiosrc)
audiosrc->seq = 0;
}
void gst_audiosrc_get(GstPad *pad) {
static GstBuffer *
gst_audiosrc_get (GstPad *pad)
{
GstAudioSrc *src;
GstBuffer *buf;
glong readbytes;
g_return_if_fail(pad != NULL);
g_return_val_if_fail (pad != NULL, NULL);
src = GST_AUDIOSRC(gst_pad_get_parent(pad));
// g_print("attempting to read something from soundcard\n");
buf = gst_buffer_new ();
g_return_if_fail (buf);
g_return_val_if_fail (buf, NULL);
GST_BUFFER_DATA (buf) = (gpointer)g_malloc (src->bytes_per_read);
readbytes = read (src->fd,GST_BUFFER_DATA (buf),
src->bytes_per_read);
if (readbytes == 0) {
gst_src_signal_eos (GST_SRC (src));
return;
return NULL;
}
GST_BUFFER_SIZE (buf) = readbytes;
......@@ -170,8 +172,8 @@ void gst_audiosrc_get(GstPad *pad) {
// gst_buffer_add_meta(buf,GST_META(newmeta));
gst_pad_push (pad,buf);
// g_print("pushed buffer from soundcard of %d bytes\n",readbytes);
return buf;
}
static void
......
......@@ -58,7 +58,7 @@ static void gst_disksrc_get_arg (GtkObject *object, GtkArg *arg, guint id);
static void gst_disksrc_close_file (GstDiskSrc *src);
static void gst_disksrc_get (GstPad *pad);
static GstBuffer * gst_disksrc_get (GstPad *pad);
static GstElementStateReturn gst_disksrc_change_state (GstElement *element);
......@@ -199,7 +199,7 @@ gst_disksrc_get_arg (GtkObject *object, GtkArg *arg, guint id)
}
}
static void
static GstBuffer *
gst_disksrc_get (GstPad *pad)
{
GstDiskSrc *src;
......@@ -250,8 +250,8 @@ gst_disksrc_get (GstPad *pad)
DEBUG("pushing %d bytes with offset %d\n", GST_BUFFER_SIZE(buf), GST_BUFFER_OFFSET (buf));
/* we're done, push the buffer off now */
gst_pad_push (pad, buf);
DEBUG("pushing %d bytes with offset %d done\n", GST_BUFFER_SIZE(buf), GST_BUFFER_OFFSET (buf));
DEBUG("returning %d bytes with offset %d done\n", GST_BUFFER_SIZE(buf), GST_BUFFER_OFFSET (buf));
return buf;
}
......
......@@ -39,14 +39,17 @@ enum {
enum {
ARG_0,
/* FILL ME */
ARG_NUM_SOURCES,
};
static void gst_fakesrc_class_init (GstFakeSrcClass *klass);
static void gst_fakesrc_init (GstFakeSrc *fakesrc);
static void gst_fakesrc_class_init (GstFakeSrcClass *klass);
static void gst_fakesrc_init (GstFakeSrc *fakesrc);
static void gst_fakesrc_set_arg (GtkObject *object, GtkArg *arg, guint id);
static void gst_fakesrc_get_arg (GtkObject *object, GtkArg *arg, guint id);
static void gst_fakesrc_get (GstPad *pad);
static GstBuffer * gst_fakesrc_get (GstPad *pad);
static GstSrcClass *parent_class = NULL;
//static guint gst_fakesrc_signals[LAST_SIGNAL] = { 0 };
......@@ -75,44 +78,95 @@ gst_fakesrc_get_type (void)
static void
gst_fakesrc_class_init (GstFakeSrcClass *klass)
{
GtkObjectClass *gtkobject_class;
GstSrcClass *gstsrc_class;
gtkobject_class = (GtkObjectClass*)klass;
gstsrc_class = (GstSrcClass*)klass;
parent_class = gtk_type_class (GST_TYPE_SRC);
gtk_object_add_arg_type ("GstFakeSrc::num_sources", GTK_TYPE_INT,
GTK_ARG_READWRITE, ARG_NUM_SOURCES);
gtkobject_class->set_arg = gst_fakesrc_set_arg;
gtkobject_class->get_arg = gst_fakesrc_get_arg;
}
static void gst_fakesrc_init(GstFakeSrc *fakesrc) {
// create our output pad
fakesrc->srcpad = gst_pad_new("src",GST_PAD_SRC);
gst_pad_set_get_function(fakesrc->srcpad,gst_fakesrc_get);
gst_element_add_pad(GST_ELEMENT(fakesrc),fakesrc->srcpad);
GstPad *pad;
// set the default number of
fakesrc->numsrcpads = 1;
// create our first output pad
pad = gst_pad_new("src",GST_PAD_SRC);
gst_pad_set_get_function(pad,gst_fakesrc_get);
gst_element_add_pad(GST_ELEMENT(fakesrc),pad);
fakesrc->srcpads = g_slist_append(NULL,pad);
// we're ready right away, since we don't have any args...
// gst_element_set_state(GST_ELEMENT(fakesrc),GST_STATE_READY);
}
/**
* gst_fakesrc_new:
* @name: then name of the fakse source
*
* create a new fakesrc
*
* Returns: The new element.
*/
GstElement *gst_fakesrc_new(gchar *name) {
GstElement *fakesrc = GST_ELEMENT(gtk_type_new(GST_TYPE_FAKESRC));
gst_element_set_name(GST_ELEMENT(fakesrc),name);
return fakesrc;
static void
gst_fakesrc_set_arg (GtkObject *object, GtkArg *arg, guint id)
{
GstFakeSrc *src;
gint new_numsrcs;
GstPad *pad;
/* it's not null if we got it, but it might not be ours */
src = GST_FAKESRC (object);
switch(id) {
case ARG_NUM_SOURCES:
new_numsrcs = GTK_VALUE_INT (*arg);
if (new_numsrcs > src->numsrcpads) {
while (src->numsrcpads != new_numsrcs) {
pad = gst_pad_new(g_strdup_printf("src%d",src->numsrcpads),GST_PAD_SRC);
gst_pad_set_get_function(pad,gst_fakesrc_get);
gst_element_add_pad(GST_ELEMENT(src),pad);
src->srcpads = g_slist_append(src->srcpads,pad);
src->numsrcpads;
}
}
break;
default:
break;
}
}
static void
gst_fakesrc_get_arg (GtkObject *object, GtkArg *arg, guint id)
{
GstFakeSrc *src;
/* it's not null if we got it, but it might not be ours */
g_return_if_fail (GST_IS_FAKESRC (object));
src = GST_FAKESRC (object);
switch (id) {
case ARG_NUM_SOURCES:
GTK_VALUE_INT (*arg) = src->numsrcpads;
break;
default:
arg->type = GTK_TYPE_INVALID;
break;
}
}
/**
* gst_fakesrc_get:
* @src: the faksesrc to get
*
* generate an empty buffer and push it to the next element.
*/
void gst_fakesrc_get(GstPad *pad) {
static GstBuffer *
gst_fakesrc_get(GstPad *pad)
{
GstFakeSrc *src;
GstBuffer *buf;
......@@ -122,5 +176,5 @@ void gst_fakesrc_get(GstPad *pad) {
g_print("(%s:%s)> ",GST_DEBUG_PAD_NAME(pad));
buf = gst_buffer_new();
gst_pad_push(pad,buf);
return buf;
}
......@@ -51,7 +51,8 @@ typedef struct _GstFakeSrcClass GstFakeSrcClass;
struct _GstFakeSrc {
GstSrc src;
GstPad *srcpad;
gint numsrcpads;
GSList *srcpads;
};
struct _GstFakeSrcClass {
......
......@@ -51,13 +51,13 @@ enum {
};
static void gst_fdsrc_class_init (GstFdSrcClass *klass);
static void gst_fdsrc_init (GstFdSrc *fdsrc);
static void gst_fdsrc_class_init (GstFdSrcClass *klass);
static void gst_fdsrc_init (GstFdSrc *fdsrc);
static void gst_fdsrc_set_arg (GtkObject *object, GtkArg *arg, guint id);
static void gst_fdsrc_get_arg (GtkObject *object, GtkArg *arg, guint id);
static void gst_fdsrc_set_arg (GtkObject *object, GtkArg *arg, guint id);
static void gst_fdsrc_get_arg (GtkObject *object, GtkArg *arg, guint id);
static void gst_fdsrc_get (GstPad *pad);
static GstBuffer * gst_fdsrc_get (GstPad *pad);
static GstSrcClass *parent_class = NULL;
......@@ -175,28 +175,30 @@ gst_fdsrc_get_arg (GtkObject *object, GtkArg *arg, guint id)
}
}
void gst_fdsrc_get(GstPad *pad) {
static GstBuffer *
gst_fdsrc_get(GstPad *pad)
{
GstFdSrc *src;
GstBuffer *buf;
glong readbytes;
g_return_if_fail(pad != NULL);
g_return_val_if_fail (pad != NULL, NULL);
src = GST_FDSRC(gst_pad_get_parent(pad));
/* create the buffer */
// FIXME: should eventually use a bufferpool for this
buf = gst_buffer_new ();
g_return_if_fail (buf);
g_return_val_if_fail (buf, NULL);
/* allocate the space for the buffer data */
GST_BUFFER_DATA(buf) = g_malloc(src->bytes_per_read);
g_return_if_fail(GST_BUFFER_DATA(buf) != NULL);
g_return_val_if_fail(GST_BUFFER_DATA(buf) != NULL, NULL);
/* read it in from the file */
readbytes = read(src->fd,GST_BUFFER_DATA(buf),src->bytes_per_read);
if (readbytes == 0) {
gst_src_signal_eos(GST_SRC(src));
return;
return NULL;
}
/* if we didn't get as many bytes as we asked for, we're at EOF */
......@@ -208,6 +210,6 @@ void gst_fdsrc_get(GstPad *pad) {
GST_BUFFER_SIZE(buf) = readbytes;
src->curoffset += readbytes;
/* we're done, push the buffer off now */
gst_pad_push(pad,buf);
/* we're done, return the buffer */
return buf;
}
......@@ -55,7 +55,7 @@ static void gst_httpsrc_set_arg (GtkObject *object, GtkArg *arg, guint id);
static void gst_httpsrc_get_arg (GtkObject *object, GtkArg *arg, guint id);
static GstElementStateReturn gst_httpsrc_change_state (GstElement *element);
static void gst_httpsrc_get (GstPad *pad);
static GstBuffer * gst_httpsrc_get (GstPad *pad);
static gboolean gst_httpsrc_open_url (GstHttpSrc *src);
static void gst_httpsrc_close_url (GstHttpSrc *src);
......@@ -122,12 +122,14 @@ static void gst_httpsrc_init(GstHttpSrc *httpsrc) {
httpsrc->bytes_per_read = 4096;
}
static void gst_httpsrc_get(GstPad *pad) {
static GstBuffer *
gst_httpsrc_get(GstPad *pad)
{
GstHttpSrc *src;
GstBuffer *buf;
glong readbytes;
g_return_if_fail(pad != NULL);
g_return_val_if_fail (pad != NULL, NULL);
src = GST_HTTPSRC(gst_pad_get_parent(pad));
buf = gst_buffer_new();
......@@ -136,7 +138,7 @@ static void gst_httpsrc_get(GstPad *pad) {
if (readbytes == 0) {
gst_src_signal_eos(GST_SRC(src));
return;
return NULL;
}
if (readbytes < src->bytes_per_read) {
......@@ -146,7 +148,7 @@ static void gst_httpsrc_get(GstPad *pad) {
GST_BUFFER_SIZE(buf) = readbytes;
src->curoffset += readbytes;
gst_pad_push(pad,buf);
return buf;
}
static gboolean
......
......@@ -116,12 +116,14 @@ gst_queue_class_init (GstQueueClass *klass)
static void
gst_queue_init (GstQueue *queue)
{
GST_FLAG_SET (queue, GST_ELEMENT_SCHEDULE_PASSIVELY);
queue->sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
gst_pad_set_chain_function (queue->sinkpad, gst_queue_chain);
gst_pad_set_chain_function (queue->sinkpad, GST_DEBUG_FUNCPTR(gst_queue_chain));
gst_element_add_pad (GST_ELEMENT (queue), queue->sinkpad);
queue->srcpad = gst_pad_new ("src", GST_PAD_SRC);
gst_pad_set_get_function (queue->srcpad, gst_queue_get);
gst_pad_set_get_function (queue->srcpad, GST_DEBUG_FUNCPTR(gst_queue_get));
gst_element_add_pad (GST_ELEMENT (queue), queue->srcpad);
queue->queue = NULL;
......@@ -173,19 +175,19 @@ gst_queue_chain (GstPad *pad, GstBuffer *buf)
/* we have to lock the queue since we span threads */
DEBUG("queue: try have queue lock\n");
// DEBUG("queue: try have queue lock\n");
GST_LOCK (queue);
DEBUG("queue: %s adding buffer %p %ld\n", name, buf, pthread_self ());
DEBUG("queue: have queue lock\n");
// DEBUG("queue: %s adding buffer %p %ld\n", name, buf, pthread_self ());
// DEBUG("queue: have queue lock\n");
if (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLUSH)) {
gst_queue_flush (queue);
}
DEBUG("queue: %s: chain %d %p\n", name, queue->level_buffers, buf);
// DEBUG("queue: %s: chain %d %p\n", name, queue->level_buffers, buf);
while (queue->level_buffers >= queue->max_buffers) {
DEBUG("queue: %s waiting %d\n", name, queue->level_buffers);
// DEBUG("queue: %s waiting %d\n", name, queue->level_buffers);
STATUS("%s: O\n");
GST_UNLOCK (queue);
g_mutex_lock (queue->fulllock);
......@@ -193,26 +195,27 @@ gst_queue_chain (GstPad *pad, GstBuffer *buf)
g_mutex_unlock (queue->fulllock);
GST_LOCK (queue);
STATUS("%s: O+\n");
DEBUG("queue: %s waiting done %d\n", name, queue->level_buffers);
// DEBUG("queue: %s waiting done %d\n", name, queue->level_buffers);
}
/* put the buffer on the tail of the list */
queue->queue = g_slist_append (queue->queue, buf);
STATUS("%s: +\n");
// STATUS("%s: +\n");
g_print("(%s:%s)+ ",GST_DEBUG_PAD_NAME(pad));
/* if we were empty, but aren't any more, signal a condition */
tosignal = (queue->level_buffers >= 0);
queue->level_buffers++;
/* we can unlock now */
DEBUG("queue: %s chain %d end signal(%d,%p)\n", name, queue->level_buffers, tosignal, queue->emptycond);
// DEBUG("queue: %s chain %d end signal(%d,%p)\n", name, queue->level_buffers, tosignal, queue->emptycond);
GST_UNLOCK (queue);
if (tosignal) {
g_mutex_lock (queue->emptylock);
STATUS("%s: >\n");
// STATUS("%s: >\n");
g_cond_signal (queue->emptycond);
STATUS("%s: >>\n");
// STATUS("%s: >>\n");
g_mutex_unlock (queue->emptylock);
}
}
......@@ -229,19 +232,19 @@ gst_queue_get (GstPad *pad)
name = gst_element_get_name (GST_ELEMENT (queue));
/* have to lock for thread-safety */
DEBUG("queue: %s try have queue lock\n", name);
// DEBUG("queue: %s try have queue lock\n", name);
GST_LOCK (queue);
DEBUG("queue: %s push %d %ld %p\n", name, queue->level_buffers, pthread_self (), queue->emptycond);
DEBUG("queue: %s have queue lock\n", name);
// DEBUG("queue: %s push %d %ld %p\n", name, queue->level_buffers, pthread_self (), queue->emptycond);
// DEBUG("queue: %s have queue lock\n", name);
while (!queue->level_buffers) {
STATUS("queue: %s U released lock\n");
GST_UNLOCK (queue);
// STATUS("queue: %s U released lock\n");
// GST_UNLOCK (queue);
g_mutex_lock (queue->emptylock);
g_cond_wait (queue->emptycond, queue->emptylock);
g_mutex_unlock (queue->emptylock);
GST_LOCK (queue);
STATUS("queue: %s U- getting lock\n");
// STATUS("queue: %s U- getting lock\n");
}
front = queue->queue;
......@@ -250,21 +253,22 @@ gst_queue_get (GstPad *pad)
g_slist_free (front);
queue->level_buffers--;
STATUS("%s: -\n");
// STATUS("%s: -\n");
g_print("(%s:%s)- ",GST_DEBUG_PAD_NAME(pad));
tosignal = queue->level_buffers < queue->max_buffers;
GST_UNLOCK(queue);
if (tosignal) {
g_mutex_lock (queue->fulllock);
STATUS("%s: < \n");
// STATUS("%s: < \n");
g_cond_signal (queue->fullcond);
STATUS("%s: << \n");
// STATUS("%s: << \n");
g_mutex_unlock (queue->fulllock);
}
DEBUG("queue: %s pushing %d %p \n", name, queue->level_buffers, buf);
// DEBUG("queue: %s pushing %d %p \n", name, queue->level_buffers, buf);
gst_pad_push (queue->srcpad, buf);
DEBUG("queue: %s pushing %d done \n", name, queue->level_buffers);
// DEBUG("queue: %s pushing %d done \n", name, queue->level_buffers);
/* unlock now */
}
......
......@@ -62,7 +62,7 @@ static void gst_sinesrc_get_arg(GtkObject *object,GtkArg *arg,guint id);
//static gboolean gst_sinesrc_open_audio(GstSineSrc *src);
void gst_sinesrc_sync_parms(GstSineSrc *sinesrc);
void gst_sinesrc_get(GstPad *pad);
static GstBuffer * gst_sinesrc_get(GstPad *pad);
static GstSrcClass *parent_class = NULL;
//static guint gst_sinesrc_signals[LAST_SIGNAL] = { 0 };
......@@ -142,7 +142,9 @@ GstElement *gst_sinesrc_new_with_fd(gchar *name,gchar *filename) {
return sinesrc;
}
void gst_sinesrc_get(GstPad *pad) {
static GstBuffer *
gst_sinesrc_get(GstPad *pad)
{
GstSineSrc *src;
GstBuffer *buf;
gint16 *samples;
......@@ -150,11 +152,11 @@ void gst_sinesrc_get(GstPad *pad) {
gint volume;
gdouble val;
g_return_if_fail(pad != NULL);
g_return_val_if_fail (pad != NULL, NULL);
src = GST_SINESRC(gst_pad_get_parent(pad));
buf = gst_buffer_new();
g_return_if_fail(buf);
g_return_val_if_fail (buf, NULL);
GST_BUFFER_DATA(buf) = (gpointer)malloc(4096);
samples = (gint16*)GST_BUFFER_DATA(buf);
GST_BUFFER_SIZE(buf) = 4096;
......@@ -173,8 +175,8 @@ void gst_sinesrc_get(GstPad *pad) {
src->sentmeta = TRUE;
}
gst_pad_push(pad,buf);
g_print(">");
return buf;
}
static void gst_sinesrc_set_arg(GtkObject *object,GtkArg *arg,guint id) {
......
This diff is collapsed.
......@@ -41,7 +41,16 @@ extern GstElementDetails gst_bin_details;
#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 enum {
// this bin is a manager of child elements, i.e. a pipeline or thread
GST_BIN_FLAG_MANAGER = GST_ELEMENT_FLAG_LAST,
// we prefer to have cothreads when its an option, over chain-based
GST_BIN_FLAG_PREFER_COTHREADS,
/* padding */
GST_BIN_FLAG_LAST = GST_ELEMENT_FLAG_LAST + 4,
} GstBinFlags;
typedef struct _GstBin GstBin;
typedef struct _GstBinClass GstBinClass;
......@@ -55,8 +64,10 @@ struct _GstBin {
// iteration state
gboolean need_cothreads;
GList *managed_elements;
gint num_managed_elements;
GList *entries;
gint numentries;
gint num_entries;
cothread_context *threadcontext;
gboolean use_cothreads;
......@@ -66,29 +77,19 @@ struct _GstBin {
struct _GstBinClass {
GstElementClass parent_class;
/* signals */
void (*object_added) (GstObject *object, GstObject *child);
/* change the state of elements of the given type */
gboolean (*change_state_type) (GstBin *bin,
GstElementState state,
GtkType type);
/* create a plan for the execution of the bin */
void (*create_plan) (GstBin *bin);
/* run a full iteration of operation */
void (*iterate) (GstBin *bin);
};
/* this struct is used for odd scheduling cases */
typedef struct __GstBinOutsideSchedule {
guint32 flags;
GstElement *element;
GstBin *bin;
cothread_state *threadstate;
GSList *padlist;
} _GstBinOutsideSchedule;
GtkType gst_bin_get_type (void);
......@@ -96,22 +97,26 @@ GstElement* gst_bin_new (gchar *name);
#define gst_bin_destroy(bin) gst_object_destroy(GST_OBJECT(bin))
/* add and remove elements from the bin */
void gst_bin_add (GstBin *bin, GstElement *element);
void gst_bin_remove (GstBin *bin, GstElement *element);
void gst_bin_add (GstBin *bin,
GstElement *element);
void gst_bin_remove (GstBin *bin,
GstElement *element);