/**
* cothread_context_free:
+ * @ctx: the cothread context to free
*
* Free the cothread context.
*/
thread->pc = (void *) func;
}
+/**
+ * cothread_stop:
+ * @thread: the cothread to stop
+ *
+ * Stop the cothread and reset the stack and program counter.
+ */
void
cothread_stop (cothread_state * thread)
{
}
if (src->rt_num_buffers == 0) {
- gst_element_set_state (GST_ELEMENT (src), GST_STATE_PAUSED);
+ gst_element_set_eos (GST_ELEMENT (src));
return GST_BUFFER(gst_event_new (GST_EVENT_EOS));
}
else {
/* read it in from the file */
readbytes = read(src->fd,GST_BUFFER_DATA(buf),src->bytes_per_read);
+ /* if nothing was read, we're in eos */
if (readbytes == 0) {
- return NULL;
+ gst_element_set_eos (GST_ELEMENT (src));
+ return GST_BUFFER (gst_event_new (GST_EVENT_EOS));
}
- /* if we didn't get as many bytes as we asked for, we're at EOF */
- if (readbytes < src->bytes_per_read) {
- /* set the buffer's EOF bit here */
- GST_BUFFER_FLAG_SET (buf, GST_BUFFER_EOS);
- }
GST_BUFFER_OFFSET(buf) = src->curoffset;
GST_BUFFER_SIZE(buf) = readbytes;
src->curoffset += readbytes;
/* check for EOF */
if (src->curoffset == src->filelen) {
- gst_element_set_state (GST_ELEMENT (src), GST_STATE_PAUSED);
+ gst_element_set_eos (GST_ELEMENT (src));
return GST_BUFFER (gst_event_new(GST_EVENT_EOS));
}
region.size = readsize;
map = g_tree_search (src->map_regions,
(GCompareFunc) gst_filesrc_search_region_match,
- ®ion);
+ (gpointer)®ion);
/* if we found an exact match, subbuffer it */
if (map != NULL) {
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_DONTFREE);
if (src->new_seek) {
- GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLUSH);
+ /* fixme, do something here */
src->new_seek = FALSE;
}
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_DONTFREE);
if (src->new_seek) {
- GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLUSH);
+ /* fixme, do something here */
src->new_seek = FALSE;
}
GstEvent *event = GST_EVENT (buf);
statistics->stats.events += 1;
if (GST_EVENT_TYPE(event) == GST_EVENT_EOS) {
- gst_element_set_state (GST_ELEMENT (statistics), GST_STATE_PAUSED);
+ gst_element_set_eos (GST_ELEMENT (statistics));
if (statistics->update_on_eos) {
update = TRUE;
}
GST_BUFFER_ORIGINAL,
GST_BUFFER_DONTFREE,
- GST_BUFFER_FLUSH,
- GST_BUFFER_EOS,
- GST_BUFFER_DISCONTINUOUS,
} GstBufferFlags;
/**
* gst_element_error:
* @element: Element with the error
- * @error: String describing the error
+ * @error: A printf-like string describing the error
+ * @...: optional arguments for the string
*
* This function is used internally by elements to signal an error
* condition. It results in the "error" signal.
/* g_print("gst_element_set_state(\"%s\",%08lx)\n", */
/* element->name,state); */
- g_return_val_if_fail (element != NULL, GST_STATE_FAILURE);
g_return_val_if_fail (GST_IS_ELEMENT (element), GST_STATE_FAILURE);
GST_DEBUG_ELEMENT (GST_CAT_STATES,element, "setting state from %s to %s\n",
GstElementState old_state;
GstObject *parent;
- g_return_val_if_fail (element != NULL, GST_STATE_FAILURE);
g_return_val_if_fail (GST_IS_ELEMENT (element), GST_STATE_FAILURE);
old_state = GST_STATE (element);
{
GstElementClass *oclass;
- g_return_val_if_fail (element != NULL, NULL);
g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
oclass = GST_ELEMENT_CLASS (G_OBJECT_GET_CLASS(element));
gst_element_set_sched (GstElement *element,
GstScheduler *sched)
{
- GST_INFO_ELEMENT (GST_CAT_PARENTAGE, element, "setting scheduler to %p",sched);
+ g_return_if_fail (GST_IS_ELEMENT (element));
+
+ GST_INFO_ELEMENT (GST_CAT_PARENTAGE, element, "setting scheduler to %p", sched);
+
element->sched = sched;
}
GstScheduler*
gst_element_get_sched (GstElement *element)
{
+ g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
+
return element->sched;
}
gst_element_set_loop_function(GstElement *element,
GstElementLoopFunction loop)
{
+ g_return_if_fail (GST_IS_ELEMENT (element));
+
/* set the loop function */
element->loopfunc = loop;
/* set the NEW_LOOPFUNC flag so everyone knows to go try again */
- GST_FLAG_SET(element,GST_ELEMENT_NEW_LOOPFUNC);
+ GST_FLAG_SET (element, GST_ELEMENT_NEW_LOOPFUNC);
}
/**
- * gst_element_signal_eos:
- * @element: element to trigger the eos signal of
+ * gst_element_set_eos:
+ * @element: element to set to the EOS state
*
- * Throws the eos signal to indicate that the end of the stream is reached.
+ * Perform the actions needed to bring the element in the EOS state.
*/
void
-gst_element_signal_eos (GstElement *element)
+gst_element_set_eos (GstElement *element)
{
- g_return_if_fail (element != NULL);
g_return_if_fail (GST_IS_ELEMENT (element));
- GST_DEBUG(GST_CAT_EVENT, "signaling EOS on element %s\n",GST_OBJECT_NAME(element));
+ GST_DEBUG (GST_CAT_EVENT, "setting EOS on element %s\n", GST_OBJECT_NAME (element));
+
+ gst_element_set_state (element, GST_STATE_PAUSED);
+
g_signal_emit (G_OBJECT (element), gst_element_signals[EOS], 0);
}
void gst_element_disconnect (GstElement *src, const gchar *srcpadname,
GstElement *dest, const gchar *destpadname);
-void gst_element_signal_eos (GstElement *element);
+void gst_element_set_eos (GstElement *element);
void gst_element_send_event (GstElement *element, GstEvent *event);
GST_DEBUG (GST_CAT_ELEMENTFACTORY,"class %s\n", GST_OBJECT_NAME (factory));
oclass->elementfactory = factory;
- // copy pad template pointers to the element class
+ /* copy pad template pointers to the element class */
oclass->padtemplates = g_list_copy(factory->padtemplates);
oclass->numpadtemplates = factory->numpadtemplates;
}
}
-/*
+/**
* gst_pad_set_sched:
* @pad: the pad to set the scheduler for
* @sched: The scheduler to set
}
}
/* FIXME */
- while (result && ! GST_BUFFER_FLAG_IS_SET (result, GST_BUFFER_EOS)
- && !(GST_BUFFER_OFFSET (result) == offset &&
+ while (result && !(GST_BUFFER_OFFSET (result) == offset &&
GST_BUFFER_SIZE (result) == len));
return result;
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_EOS:
- gst_element_set_state (element, GST_STATE_PAUSED);
+ gst_element_set_eos (element);
gst_pad_event_default_dispatch (pad, element, event);
gst_event_free (event);
/* we have to try to schedule another element because this one is disabled */
switch (GST_EVENT_TYPE(event)) {
case GST_EVENT_EOS:
GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "queue \"%s\" eos\n", GST_ELEMENT_NAME (queue));
- gst_element_set_state (GST_ELEMENT (queue), GST_STATE_PAUSED);
+ gst_element_set_eos (GST_ELEMENT (queue));
break;
default:
break;
* @transition: the state transition
*
* Tell the scheduler that an element changed its state.
+ *
+ * Returns: a GstElementStateReturn indicating success or failure
+ * of the state transition.
*/
GstElementStateReturn
gst_scheduler_state_transition (GstScheduler *sched, GstElement *element, gint transition)
*
* Tell the scheduler to interrupt execution of this element.
*
- * Retruns: TRUE if the element should return NULL from the chain/get
+ * Returns: TRUE if the element should return NULL from the chain/get
* function.
*/
gboolean
break;
case GST_STATE_PLAYING_TO_PAUSED:
{
- //GList *elements = (element->sched)->elements;
- GList *elements = gst_bin_get_list(GST_BIN (thread));
+ GList *elements = gst_bin_get_list (GST_BIN (thread));
THR_INFO ("pausing thread");
}
if (src->rt_num_buffers == 0) {
- gst_element_set_state (GST_ELEMENT (src), GST_STATE_PAUSED);
+ gst_element_set_eos (GST_ELEMENT (src));
return GST_BUFFER(gst_event_new (GST_EVENT_EOS));
}
else {
/* read it in from the file */
readbytes = read(src->fd,GST_BUFFER_DATA(buf),src->bytes_per_read);
+ /* if nothing was read, we're in eos */
if (readbytes == 0) {
- return NULL;
+ gst_element_set_eos (GST_ELEMENT (src));
+ return GST_BUFFER (gst_event_new (GST_EVENT_EOS));
}
- /* if we didn't get as many bytes as we asked for, we're at EOF */
- if (readbytes < src->bytes_per_read) {
- /* set the buffer's EOF bit here */
- GST_BUFFER_FLAG_SET (buf, GST_BUFFER_EOS);
- }
GST_BUFFER_OFFSET(buf) = src->curoffset;
GST_BUFFER_SIZE(buf) = readbytes;
src->curoffset += readbytes;
/* check for EOF */
if (src->curoffset == src->filelen) {
- gst_element_set_state (GST_ELEMENT (src), GST_STATE_PAUSED);
+ gst_element_set_eos (GST_ELEMENT (src));
return GST_BUFFER (gst_event_new(GST_EVENT_EOS));
}
region.size = readsize;
map = g_tree_search (src->map_regions,
(GCompareFunc) gst_filesrc_search_region_match,
- ®ion);
+ (gpointer)®ion);
/* if we found an exact match, subbuffer it */
if (map != NULL) {
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_DONTFREE);
if (src->new_seek) {
- GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLUSH);
+ /* fixme, do something here */
src->new_seek = FALSE;
}
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_DONTFREE);
if (src->new_seek) {
- GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLUSH);
+ /* fixme, do something here */
src->new_seek = FALSE;
}
switch (GST_EVENT_TYPE(event)) {
case GST_EVENT_EOS:
GST_DEBUG_ELEMENT (GST_CAT_DATAFLOW, queue, "queue \"%s\" eos\n", GST_ELEMENT_NAME (queue));
- gst_element_set_state (GST_ELEMENT (queue), GST_STATE_PAUSED);
+ gst_element_set_eos (GST_ELEMENT (queue));
break;
default:
break;
GstEvent *event = GST_EVENT (buf);
statistics->stats.events += 1;
if (GST_EVENT_TYPE(event) == GST_EVENT_EOS) {
- gst_element_set_state (GST_ELEMENT (statistics), GST_STATE_PAUSED);
+ gst_element_set_eos (GST_ELEMENT (statistics));
if (statistics->update_on_eos) {
update = TRUE;
}