2000-01-30 09:03:00 +00:00
|
|
|
/* Gnome-Streamer
|
|
|
|
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
2000-12-15 01:57:34 +00:00
|
|
|
#include "gstdebug.h"
|
|
|
|
#include "gstelement.h"
|
|
|
|
#include "gstextratypes.h"
|
2000-01-30 09:03:00 +00:00
|
|
|
|
|
|
|
/* Element signals and args */
|
|
|
|
enum {
|
|
|
|
STATE_CHANGE,
|
|
|
|
NEW_PAD,
|
|
|
|
NEW_GHOST_PAD,
|
|
|
|
ERROR,
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
ARG_0,
|
|
|
|
/* FILL ME */
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2000-11-11 15:13:50 +00:00
|
|
|
static void gst_element_class_init (GstElementClass *klass);
|
|
|
|
static void gst_element_init (GstElement *element);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2000-11-11 15:13:50 +00:00
|
|
|
static void gst_element_real_destroy (GtkObject *object);
|
2000-07-17 17:14:15 +00:00
|
|
|
|
2000-11-11 15:13:50 +00:00
|
|
|
static GstElementStateReturn gst_element_change_state(GstElement *element);
|
2000-07-17 17:14:15 +00:00
|
|
|
|
2000-01-30 09:03:00 +00:00
|
|
|
static GstObjectClass *parent_class = NULL;
|
|
|
|
static guint gst_element_signals[LAST_SIGNAL] = { 0 };
|
|
|
|
|
|
|
|
GtkType gst_element_get_type(void) {
|
|
|
|
static GtkType element_type = 0;
|
|
|
|
|
|
|
|
if (!element_type) {
|
|
|
|
static const GtkTypeInfo element_info = {
|
|
|
|
"GstElement",
|
|
|
|
sizeof(GstElement),
|
|
|
|
sizeof(GstElementClass),
|
|
|
|
(GtkClassInitFunc)gst_element_class_init,
|
|
|
|
(GtkObjectInitFunc)gst_element_init,
|
|
|
|
(GtkArgSetFunc)NULL,
|
|
|
|
(GtkArgGetFunc)NULL,
|
|
|
|
(GtkClassInitFunc)NULL,
|
|
|
|
};
|
|
|
|
element_type = gtk_type_unique(GST_TYPE_OBJECT,&element_info);
|
|
|
|
}
|
|
|
|
return element_type;
|
|
|
|
}
|
|
|
|
|
2000-11-11 15:13:50 +00:00
|
|
|
static void
|
|
|
|
gst_element_class_init (GstElementClass *klass)
|
|
|
|
{
|
2000-01-30 09:03:00 +00:00
|
|
|
GtkObjectClass *gtkobject_class;
|
|
|
|
|
|
|
|
gtkobject_class = (GtkObjectClass*)klass;
|
|
|
|
|
|
|
|
parent_class = gtk_type_class(GST_TYPE_OBJECT);
|
|
|
|
|
|
|
|
gst_element_signals[STATE_CHANGE] =
|
2000-11-11 15:13:50 +00:00
|
|
|
gtk_signal_new ("state_change", GTK_RUN_LAST, gtkobject_class->type,
|
|
|
|
GTK_SIGNAL_OFFSET (GstElementClass, state_change),
|
|
|
|
gtk_marshal_NONE__INT, GTK_TYPE_NONE, 1,
|
|
|
|
GTK_TYPE_INT);
|
2000-01-30 09:03:00 +00:00
|
|
|
gst_element_signals[NEW_PAD] =
|
2000-11-11 15:13:50 +00:00
|
|
|
gtk_signal_new ("new_pad", GTK_RUN_LAST, gtkobject_class->type,
|
|
|
|
GTK_SIGNAL_OFFSET (GstElementClass, new_pad),
|
|
|
|
gtk_marshal_NONE__POINTER, GTK_TYPE_NONE, 1,
|
|
|
|
GST_TYPE_PAD);
|
2000-01-30 09:03:00 +00:00
|
|
|
gst_element_signals[NEW_GHOST_PAD] =
|
2000-11-11 15:13:50 +00:00
|
|
|
gtk_signal_new ("new_ghost_pad", GTK_RUN_LAST, gtkobject_class->type,
|
|
|
|
GTK_SIGNAL_OFFSET (GstElementClass, new_ghost_pad),
|
|
|
|
gtk_marshal_NONE__POINTER, GTK_TYPE_NONE, 1,
|
|
|
|
GST_TYPE_PAD);
|
2000-01-30 09:03:00 +00:00
|
|
|
gst_element_signals[ERROR] =
|
2000-11-11 15:13:50 +00:00
|
|
|
gtk_signal_new ("error", GTK_RUN_LAST, gtkobject_class->type,
|
|
|
|
GTK_SIGNAL_OFFSET (GstElementClass, error),
|
|
|
|
gtk_marshal_NONE__STRING, GTK_TYPE_NONE,1,
|
|
|
|
GTK_TYPE_STRING);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
|
|
|
|
2000-11-11 15:13:50 +00:00
|
|
|
gtk_object_class_add_signals (gtkobject_class, gst_element_signals, LAST_SIGNAL);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
|
|
|
klass->change_state = gst_element_change_state;
|
|
|
|
|
|
|
|
gtkobject_class->destroy = gst_element_real_destroy;
|
|
|
|
}
|
|
|
|
|
2000-11-11 15:13:50 +00:00
|
|
|
static void
|
|
|
|
gst_element_init (GstElement *element)
|
|
|
|
{
|
2000-07-17 17:14:15 +00:00
|
|
|
element->current_state = GST_STATE_NULL;
|
|
|
|
element->pending_state = -1;
|
2000-01-30 09:03:00 +00:00
|
|
|
element->numpads = 0;
|
2000-12-20 09:39:43 +00:00
|
|
|
element->numsrcpads = 0;
|
|
|
|
element->numsinkpads = 0;
|
2000-01-30 09:03:00 +00:00
|
|
|
element->pads = NULL;
|
|
|
|
element->loopfunc = NULL;
|
Another big set of changes. Connections are now also pullfunc based. gstqueue has been updated, I don't know of any ...
Original commit message from CVS:
Another big set of changes. Connections are now also pullfunc based.
gstqueue has been updated, I don't know of any other connections offhand.
There are still a few things that need doing, specifically the concept
of a source or connection with connections to multiple thread contexts is
not dealt with. This may force us to move the threadstate from the
element to the pad, maybe keeping the element's copy for simple cases.
Then the Bin would create a structure to pass to the cothreaded _wrappers
of any such elements, which would detail the pads that are to be dealt with
by this particular cothread context.
That will speed things up to, since we don't have to look through the list
of all pads for every Src or Connection element for every iteration, we can
simply step through the list provided by the plan. Special case might even
have a single pad pointer sitting there to trump the list, if there's only
one (the common case anyway).
Task 23098 is tracking these changes. The main task 22588 depends on that
subtask, as well as 22240, which is a consistency check on PAD_DISABLED.
2000-12-08 10:33:01 +00:00
|
|
|
element->threadstate = NULL;
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_element_new:
|
|
|
|
*
|
2000-02-02 06:26:44 +00:00
|
|
|
* Create a new element. Should never be used, as it does no good.
|
2000-01-30 09:03:00 +00:00
|
|
|
*
|
|
|
|
* Returns: new element
|
|
|
|
*/
|
2000-11-11 15:13:50 +00:00
|
|
|
GstElement*
|
|
|
|
gst_element_new(void)
|
|
|
|
{
|
|
|
|
return GST_ELEMENT (gtk_type_new (GST_TYPE_ELEMENT));
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_element_add_pad:
|
|
|
|
* @element: element to add pad to
|
|
|
|
* @pad: pad to add
|
|
|
|
*
|
|
|
|
* Add a pad (connection point) to the element, setting the parent of the
|
|
|
|
* pad to the element (and thus adding a reference).
|
|
|
|
*/
|
2000-11-11 15:13:50 +00:00
|
|
|
void
|
|
|
|
gst_element_add_pad (GstElement *element, GstPad *pad)
|
|
|
|
{
|
|
|
|
g_return_if_fail (element != NULL);
|
|
|
|
g_return_if_fail (GST_IS_ELEMENT (element));
|
|
|
|
g_return_if_fail (pad != NULL);
|
|
|
|
g_return_if_fail (GST_IS_PAD (pad));
|
2000-01-30 09:03:00 +00:00
|
|
|
|
|
|
|
/* set the pad's parent */
|
2000-12-11 00:24:32 +00:00
|
|
|
DEBUG("setting parent of pad '%s'(%p) to '%s'(%p)\n",
|
|
|
|
gst_pad_get_name(pad),pad,gst_element_get_name(element),element);
|
2000-11-11 15:13:50 +00:00
|
|
|
gst_pad_set_parent (pad,GST_OBJECT (element));
|
2000-01-30 09:03:00 +00:00
|
|
|
|
|
|
|
/* add it to the list */
|
2000-11-11 15:13:50 +00:00
|
|
|
element->pads = g_list_append (element->pads, pad);
|
2000-01-30 09:03:00 +00:00
|
|
|
element->numpads++;
|
2000-12-20 09:39:43 +00:00
|
|
|
if (gst_pad_get_direction (pad) == GST_PAD_SRC)
|
|
|
|
element->numsrcpads++;
|
|
|
|
else
|
|
|
|
element->numsinkpads++;
|
2000-01-30 09:03:00 +00:00
|
|
|
|
|
|
|
/* emit the NEW_PAD signal */
|
|
|
|
// g_print("emitting NEW_PAD signal, \"%s\"!\n",gst_pad_get_name(pad));
|
2000-11-11 15:13:50 +00:00
|
|
|
gtk_signal_emit (GTK_OBJECT (element), gst_element_signals[NEW_PAD], pad);
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_element_add_ghost_pad:
|
|
|
|
* @element: element to add ghost pad to
|
|
|
|
* @pad: ghost pad to add
|
|
|
|
*
|
|
|
|
* Add a ghost pad to the element, setting the ghost parent of the pad to
|
|
|
|
* the element (and thus adding a reference).
|
|
|
|
*/
|
2000-11-11 15:13:50 +00:00
|
|
|
void
|
|
|
|
gst_element_add_ghost_pad (GstElement *element, GstPad *pad)
|
|
|
|
{
|
|
|
|
g_return_if_fail (element != NULL);
|
|
|
|
g_return_if_fail (GST_IS_ELEMENT (element));
|
|
|
|
g_return_if_fail (pad != NULL);
|
|
|
|
g_return_if_fail (GST_IS_PAD (pad));
|
2000-01-30 09:03:00 +00:00
|
|
|
|
|
|
|
/* set the pad's parent */
|
2000-11-11 15:13:50 +00:00
|
|
|
gst_pad_add_ghost_parent (pad,GST_OBJECT (element));
|
2000-01-30 09:03:00 +00:00
|
|
|
|
|
|
|
/* add it to the list */
|
2000-11-11 15:13:50 +00:00
|
|
|
element->pads = g_list_append (element->pads, pad);
|
2000-01-30 09:03:00 +00:00
|
|
|
element->numpads++;
|
|
|
|
|
|
|
|
/* emit the NEW_PAD signal */
|
2000-11-11 15:13:50 +00:00
|
|
|
gtk_signal_emit (GTK_OBJECT (element), gst_element_signals[NEW_GHOST_PAD], pad);
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_element_get_pad:
|
|
|
|
* @element: element to find pad of
|
|
|
|
* @name: name of pad to retrieve
|
|
|
|
*
|
|
|
|
* Retrieve a pad from the element by name.
|
|
|
|
*
|
|
|
|
* Returns: requested pad if found, otherwise NULL.
|
|
|
|
*/
|
2000-11-11 15:13:50 +00:00
|
|
|
GstPad*
|
|
|
|
gst_element_get_pad (GstElement *element, gchar *name)
|
|
|
|
{
|
2000-01-30 09:03:00 +00:00
|
|
|
GList *walk;
|
|
|
|
|
2000-11-11 15:13:50 +00:00
|
|
|
g_return_val_if_fail (element != NULL, NULL);
|
|
|
|
g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
|
|
|
|
|
2000-01-30 09:03:00 +00:00
|
|
|
if (name == NULL)
|
|
|
|
return NULL;
|
|
|
|
if (!element->numpads)
|
|
|
|
return NULL;
|
|
|
|
|
2000-11-23 20:39:54 +00:00
|
|
|
/* look through the list, matching by name */
|
2000-01-30 09:03:00 +00:00
|
|
|
walk = element->pads;
|
|
|
|
while (walk) {
|
2000-11-11 15:13:50 +00:00
|
|
|
if (!strcmp (((GstPad *)(walk->data))->name, name))
|
2000-01-30 09:03:00 +00:00
|
|
|
return (GstPad *)(walk->data);
|
2000-11-11 15:13:50 +00:00
|
|
|
walk = g_list_next (walk);
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_element_get_pad_list:
|
|
|
|
* @element: element to get pads of
|
|
|
|
*
|
|
|
|
* Retrieve a list of the pads associated with the element.
|
|
|
|
*
|
2000-03-27 19:53:43 +00:00
|
|
|
* Returns: GList of pads
|
2000-01-30 09:03:00 +00:00
|
|
|
*/
|
2000-11-11 15:13:50 +00:00
|
|
|
GList*
|
|
|
|
gst_element_get_pad_list (GstElement *element)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (element != NULL, NULL);
|
|
|
|
g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2000-11-23 20:39:54 +00:00
|
|
|
/* return the list of pads */
|
2000-01-30 09:03:00 +00:00
|
|
|
return element->pads;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_element_connect:
|
|
|
|
* @src: element containing source pad
|
|
|
|
* @srcpadname: name of pad in source element
|
|
|
|
* @dest: element containing destination pad
|
|
|
|
* @destpadname: name of pad in destination element
|
|
|
|
*
|
|
|
|
* Connect the two named pads of the source and destination elements.
|
|
|
|
* Side effect is that if one of the pads has no parent, it becomes a
|
|
|
|
* child of the parent of the other element. If they have different
|
|
|
|
* parents, the connection fails.
|
|
|
|
*/
|
2000-11-11 15:13:50 +00:00
|
|
|
void
|
|
|
|
gst_element_connect (GstElement *src, gchar *srcpadname,
|
|
|
|
GstElement *dest, gchar *destpadname)
|
|
|
|
{
|
2000-01-30 09:03:00 +00:00
|
|
|
GstPad *srcpad,*destpad;
|
|
|
|
GstObject *srcparent,*destparent;
|
|
|
|
|
2000-11-11 15:13:50 +00:00
|
|
|
g_return_if_fail (src != NULL);
|
|
|
|
g_return_if_fail (GST_IS_ELEMENT(src));
|
|
|
|
g_return_if_fail (srcpadname != NULL);
|
|
|
|
g_return_if_fail (dest != NULL);
|
|
|
|
g_return_if_fail (GST_IS_ELEMENT(dest));
|
|
|
|
g_return_if_fail (destpadname != NULL);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2000-11-23 20:39:54 +00:00
|
|
|
/* obtain the pads requested */
|
2000-11-11 15:13:50 +00:00
|
|
|
srcpad = gst_element_get_pad (src, srcpadname);
|
|
|
|
g_return_if_fail (srcpad != NULL);
|
2000-12-09 09:13:09 +00:00
|
|
|
destpad = gst_element_get_pad (dest, destpadname);
|
2000-11-11 15:13:50 +00:00
|
|
|
g_return_if_fail (destpad != NULL);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2000-11-23 20:39:54 +00:00
|
|
|
/* find the parent elements of each element */
|
2000-11-11 15:13:50 +00:00
|
|
|
srcparent = gst_object_get_parent (GST_OBJECT (src));
|
|
|
|
destparent = gst_object_get_parent (GST_OBJECT (dest));
|
|
|
|
|
2000-11-23 20:39:54 +00:00
|
|
|
/* have to make sure that they have the same parents... */
|
2000-12-09 09:13:09 +00:00
|
|
|
g_return_if_fail (srcparent == destparent);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2000-11-23 20:39:54 +00:00
|
|
|
/* we're satisified they can be connected, let's do it */
|
|
|
|
gst_pad_connect(srcpad,destpad);
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
|
|
|
|
2000-02-02 06:26:44 +00:00
|
|
|
/**
|
|
|
|
* gst_element_error:
|
|
|
|
* @element: Element with the error
|
|
|
|
* @error: String describing the error
|
|
|
|
*
|
|
|
|
* This function is used internally by elements to signal an error
|
|
|
|
* condition. It results in the "error" signal.
|
|
|
|
*/
|
2000-11-11 15:13:50 +00:00
|
|
|
void
|
|
|
|
gst_element_error (GstElement *element, gchar *error)
|
|
|
|
{
|
|
|
|
g_error("GstElement: error in element '%s': %s\n", element->name, error);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2000-11-23 20:39:54 +00:00
|
|
|
/* FIXME: this is not finished!!! */
|
|
|
|
|
2000-11-11 15:13:50 +00:00
|
|
|
gtk_signal_emit (GTK_OBJECT (element), gst_element_signals[ERROR], error);
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_element_set_state:
|
|
|
|
* @element: element to change state of
|
|
|
|
* @state: new element state
|
|
|
|
*
|
2000-09-14 20:31:03 +00:00
|
|
|
* Sets the state of the element. This function will only set
|
|
|
|
* the elements pending state.
|
2000-01-30 09:03:00 +00:00
|
|
|
*
|
|
|
|
* Returns: whether or not the state was successfully set.
|
|
|
|
*/
|
2000-11-11 15:13:50 +00:00
|
|
|
gint
|
|
|
|
gst_element_set_state (GstElement *element, GstElementState state)
|
|
|
|
{
|
2000-01-30 09:03:00 +00:00
|
|
|
GstElementClass *oclass;
|
2000-11-23 08:13:43 +00:00
|
|
|
GstElementState curpending;
|
2000-07-17 17:14:15 +00:00
|
|
|
GstElementStateReturn return_val = GST_STATE_SUCCESS;
|
2000-01-30 09:03:00 +00:00
|
|
|
|
|
|
|
// g_print("gst_element_set_state(\"%s\",%08lx)\n",
|
|
|
|
// element->name,state);
|
|
|
|
|
2000-11-11 15:13:50 +00:00
|
|
|
g_return_val_if_fail (element != NULL, GST_STATE_FAILURE);
|
|
|
|
g_return_val_if_fail (GST_IS_ELEMENT (element), GST_STATE_FAILURE);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2000-11-23 20:39:54 +00:00
|
|
|
/* start with the current state */
|
2000-11-23 08:13:43 +00:00
|
|
|
curpending = GST_STATE(element);
|
2000-11-23 20:39:54 +00:00
|
|
|
|
|
|
|
/* loop until the final requested state is set */
|
2000-11-23 08:13:43 +00:00
|
|
|
while (GST_STATE(element) != state) {
|
2000-11-23 20:39:54 +00:00
|
|
|
/* move the curpending state in the correct direction */
|
2000-11-23 08:13:43 +00:00
|
|
|
if (curpending < state) curpending++;
|
|
|
|
else curpending--;
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2000-11-23 20:39:54 +00:00
|
|
|
/* set the pending state variable */
|
|
|
|
// FIXME: should probably check to see that we don't already have one
|
2000-11-23 08:13:43 +00:00
|
|
|
GST_STATE_PENDING (element) = curpending;
|
|
|
|
|
2000-11-23 20:39:54 +00:00
|
|
|
/* call the state change function so it can set the state */
|
2000-11-23 08:13:43 +00:00
|
|
|
oclass = GST_ELEMENT_CLASS (GTK_OBJECT (element)->klass);
|
|
|
|
if (oclass->change_state)
|
|
|
|
return_val = (oclass->change_state)(element);
|
|
|
|
|
2000-11-23 20:39:54 +00:00
|
|
|
/* if that outright didn't work, we need to bail right away */
|
|
|
|
/* NOTE: this will bail on ASYNC as well! */
|
|
|
|
if (return_val != GST_STATE_SUCCESS) return return_val;
|
2000-11-23 08:13:43 +00:00
|
|
|
}
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2000-11-23 20:39:54 +00:00
|
|
|
/* this is redundant, really, it will always return SUCCESS */
|
2000-07-17 17:14:15 +00:00
|
|
|
return return_val;
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
|
|
|
|
2000-09-14 20:31:03 +00:00
|
|
|
/**
|
|
|
|
* gst_element_get_factory:
|
|
|
|
* @element: element to request the factory
|
|
|
|
*
|
|
|
|
* Retrieves the factory that was used to create this element
|
|
|
|
*
|
|
|
|
* Returns: the factory used for creating this element
|
|
|
|
*/
|
2000-11-11 15:13:50 +00:00
|
|
|
GstElementFactory*
|
|
|
|
gst_element_get_factory (GstElement *element)
|
|
|
|
{
|
2000-08-21 21:20:38 +00:00
|
|
|
GstElementClass *oclass;
|
|
|
|
|
2000-11-11 15:13:50 +00:00
|
|
|
g_return_val_if_fail (element != NULL, NULL);
|
|
|
|
g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
|
2000-08-21 21:20:38 +00:00
|
|
|
|
2000-11-11 15:13:50 +00:00
|
|
|
oclass = GST_ELEMENT_CLASS (GTK_OBJECT (element)->klass);
|
2000-08-21 21:20:38 +00:00
|
|
|
|
|
|
|
return oclass->elementfactory;
|
|
|
|
}
|
|
|
|
|
2000-03-27 19:53:43 +00:00
|
|
|
/**
|
|
|
|
* gst_element_change_state:
|
|
|
|
* @element: element to change state of
|
|
|
|
*
|
|
|
|
* Changes the state of the element, but more importantly fires off a signal
|
2000-09-14 20:31:03 +00:00
|
|
|
* indicating the new state.
|
|
|
|
* The element will have no pending states anymore.
|
2000-03-27 19:53:43 +00:00
|
|
|
*
|
|
|
|
* Returns: whether or not the state change was successfully set.
|
|
|
|
*/
|
2000-11-11 15:13:50 +00:00
|
|
|
GstElementStateReturn
|
|
|
|
gst_element_change_state (GstElement *element)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (element != NULL, GST_STATE_FAILURE);
|
|
|
|
g_return_val_if_fail (GST_IS_ELEMENT (element), GST_STATE_FAILURE);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
|
|
|
// g_print("gst_element_change_state(\"%s\",%d)\n",
|
|
|
|
// element->name,state);
|
|
|
|
|
2000-11-11 15:13:50 +00:00
|
|
|
GST_STATE (element) = GST_STATE_PENDING (element);
|
|
|
|
GST_STATE_PENDING (element) = GST_STATE_NONE_PENDING;
|
2000-08-18 20:35:48 +00:00
|
|
|
|
2000-11-11 15:13:50 +00:00
|
|
|
gtk_signal_emit (GTK_OBJECT (element), gst_element_signals[STATE_CHANGE],
|
|
|
|
GST_STATE (element));
|
2000-04-09 21:36:56 +00:00
|
|
|
return TRUE;
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_element_set_name:
|
|
|
|
* @element: GstElement to set name of
|
|
|
|
* @name: new name of element
|
|
|
|
*
|
|
|
|
* Set the name of the element, getting rid of the old name if there was
|
|
|
|
* one.
|
|
|
|
*/
|
2000-11-11 15:13:50 +00:00
|
|
|
void
|
|
|
|
gst_element_set_name (GstElement *element, gchar *name)
|
|
|
|
{
|
|
|
|
g_return_if_fail (element != NULL);
|
|
|
|
g_return_if_fail (GST_IS_ELEMENT (element));
|
|
|
|
g_return_if_fail (name != NULL);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
|
|
|
if (element->name != NULL)
|
|
|
|
g_free(element->name);
|
|
|
|
|
2000-11-11 15:13:50 +00:00
|
|
|
element->name = g_strdup (name);
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_element_get_name:
|
|
|
|
* @element: GstElement to set name of
|
|
|
|
*
|
|
|
|
* Get the name of the element.
|
|
|
|
*
|
|
|
|
* Returns: name of the element
|
|
|
|
*/
|
2000-11-11 15:13:50 +00:00
|
|
|
const gchar*
|
|
|
|
gst_element_get_name (GstElement *element)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (element != NULL, NULL);
|
|
|
|
g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
|
|
|
return element->name;
|
|
|
|
}
|
|
|
|
|
2000-11-11 15:13:50 +00:00
|
|
|
static void
|
|
|
|
gst_element_real_destroy (GtkObject *object)
|
|
|
|
{
|
|
|
|
GstElement *element = GST_ELEMENT (object);
|
2000-01-30 09:03:00 +00:00
|
|
|
GList *pads;
|
|
|
|
GstPad *pad;
|
|
|
|
|
|
|
|
// g_print("in gst_element_real_destroy()\n");
|
|
|
|
|
|
|
|
if (element->name)
|
2000-11-11 15:13:50 +00:00
|
|
|
g_free (element->name);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
|
|
|
pads = element->pads;
|
|
|
|
while (pads) {
|
2000-11-11 15:13:50 +00:00
|
|
|
pad = GST_PAD (pads->data);
|
|
|
|
gst_pad_destroy (pad);
|
|
|
|
pads = g_list_next (pads);
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
|
|
|
|
2000-11-11 15:13:50 +00:00
|
|
|
g_list_free (element->pads);
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
|
|
|
|
2000-02-27 23:18:38 +00:00
|
|
|
/*
|
2000-01-30 09:03:00 +00:00
|
|
|
static gchar *_gst_element_type_names[] = {
|
|
|
|
"invalid",
|
|
|
|
"none",
|
|
|
|
"char",
|
|
|
|
"uchar",
|
|
|
|
"bool",
|
|
|
|
"int",
|
|
|
|
"uint",
|
|
|
|
"long",
|
|
|
|
"ulong",
|
|
|
|
"float",
|
|
|
|
"double",
|
|
|
|
"string",
|
|
|
|
};
|
2000-02-27 23:18:38 +00:00
|
|
|
*/
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2000-03-27 19:53:43 +00:00
|
|
|
/**
|
|
|
|
* gst_element_save_thyself:
|
|
|
|
* @element: GstElement to save
|
|
|
|
* @parent: the xml parent node
|
|
|
|
*
|
|
|
|
* saves the element
|
|
|
|
*
|
|
|
|
* Returns: the new xml node
|
|
|
|
*/
|
2000-11-11 15:13:50 +00:00
|
|
|
xmlNodePtr
|
|
|
|
gst_element_save_thyself (GstElement *element,
|
|
|
|
xmlNodePtr parent)
|
|
|
|
{
|
2000-09-27 19:33:10 +00:00
|
|
|
xmlNodePtr self;
|
2000-01-30 09:03:00 +00:00
|
|
|
GList *pads;
|
|
|
|
GstPad *pad;
|
|
|
|
GstElementClass *oclass;
|
|
|
|
GstElementFactory *factory;
|
|
|
|
GtkType type;
|
|
|
|
|
2000-11-11 15:13:50 +00:00
|
|
|
oclass = GST_ELEMENT_CLASS (GTK_OBJECT (element)->klass);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2000-11-11 15:13:50 +00:00
|
|
|
self = xmlNewChild (parent, NULL, "element", NULL);
|
|
|
|
xmlNewChild(self, NULL, "name", element->name);
|
2000-01-30 09:03:00 +00:00
|
|
|
if (oclass->elementfactory != NULL) {
|
|
|
|
factory = (GstElementFactory *)oclass->elementfactory;
|
2000-11-11 15:13:50 +00:00
|
|
|
xmlNewChild (self, NULL, "type", factory->name);
|
|
|
|
xmlNewChild (self, NULL, "version", factory->details->version);
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pads = element->pads;
|
|
|
|
while (pads) {
|
2000-11-11 15:13:50 +00:00
|
|
|
xmlNodePtr padtag = xmlNewChild (self, NULL, "pad", NULL);
|
|
|
|
pad = GST_PAD (pads->data);
|
2000-01-30 09:03:00 +00:00
|
|
|
// figure out if it's a direct pad or a ghostpad
|
2000-11-11 15:13:50 +00:00
|
|
|
if (GST_ELEMENT (pad->parent) == element)
|
|
|
|
gst_pad_save_thyself (pad, padtag);
|
|
|
|
pads = g_list_next (pads);
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// output all args to the element
|
2000-11-11 15:13:50 +00:00
|
|
|
type = GTK_OBJECT_TYPE (element);
|
2000-01-30 09:03:00 +00:00
|
|
|
while (type != GTK_TYPE_INVALID) {
|
|
|
|
GtkArg *args;
|
|
|
|
guint32 *flags;
|
|
|
|
guint num_args,i;
|
|
|
|
|
2000-11-11 15:13:50 +00:00
|
|
|
args = gtk_object_query_args (type, &flags, &num_args);
|
|
|
|
|
|
|
|
for (i=0; i<num_args; i++) {
|
2000-01-30 09:03:00 +00:00
|
|
|
if ((args[i].type > GTK_TYPE_NONE) &&
|
2000-11-11 15:13:50 +00:00
|
|
|
//(args[i].type <= GTK_TYPE_STRING) &&
|
|
|
|
(flags[i] & GTK_ARG_READABLE)) {
|
2000-01-30 09:03:00 +00:00
|
|
|
xmlNodePtr arg;
|
2000-11-11 15:13:50 +00:00
|
|
|
gtk_object_getv (GTK_OBJECT (element), 1, &args[i]);
|
|
|
|
arg = xmlNewChild (self, NULL, "arg", NULL);
|
|
|
|
xmlNewChild (arg, NULL, "name", args[i].name);
|
2000-01-30 09:03:00 +00:00
|
|
|
switch (args[i].type) {
|
|
|
|
case GTK_TYPE_CHAR:
|
2000-11-11 15:13:50 +00:00
|
|
|
xmlNewChild (arg, NULL, "value",
|
|
|
|
g_strdup_printf ("%c", GTK_VALUE_CHAR (args[i])));
|
2000-01-30 09:03:00 +00:00
|
|
|
break;
|
|
|
|
case GTK_TYPE_UCHAR:
|
2000-11-11 15:13:50 +00:00
|
|
|
xmlNewChild (arg, NULL, "value",
|
|
|
|
g_strdup_printf ("%d", GTK_VALUE_UCHAR (args[i])));
|
2000-01-30 09:03:00 +00:00
|
|
|
break;
|
|
|
|
case GTK_TYPE_BOOL:
|
2000-11-11 15:13:50 +00:00
|
|
|
xmlNewChild (arg, NULL, "value",
|
|
|
|
GTK_VALUE_BOOL (args[i]) ? "true" : "false");
|
2000-01-30 09:03:00 +00:00
|
|
|
break;
|
|
|
|
case GTK_TYPE_INT:
|
2000-11-11 15:13:50 +00:00
|
|
|
xmlNewChild (arg, NULL, "value",
|
|
|
|
g_strdup_printf ("%d", GTK_VALUE_INT (args[i])));
|
2000-01-30 09:03:00 +00:00
|
|
|
break;
|
|
|
|
case GTK_TYPE_LONG:
|
2000-11-11 15:13:50 +00:00
|
|
|
xmlNewChild (arg, NULL, "value",
|
|
|
|
g_strdup_printf ("%ld", GTK_VALUE_LONG (args[i])));
|
2000-01-30 09:03:00 +00:00
|
|
|
break;
|
|
|
|
case GTK_TYPE_ULONG:
|
2000-11-11 15:13:50 +00:00
|
|
|
xmlNewChild (arg, NULL, "value",
|
|
|
|
g_strdup_printf ("%lu", GTK_VALUE_ULONG (args[i])));
|
2000-01-30 09:03:00 +00:00
|
|
|
break;
|
|
|
|
case GTK_TYPE_FLOAT:
|
2000-11-11 15:13:50 +00:00
|
|
|
xmlNewChild (arg, NULL, "value",
|
|
|
|
g_strdup_printf ("%f", GTK_VALUE_FLOAT (args[i])));
|
2000-01-30 09:03:00 +00:00
|
|
|
break;
|
|
|
|
case GTK_TYPE_DOUBLE:
|
2000-11-11 15:13:50 +00:00
|
|
|
xmlNewChild (arg, NULL, "value",
|
|
|
|
g_strdup_printf ("%g", GTK_VALUE_DOUBLE (args[i])));
|
2000-01-30 09:03:00 +00:00
|
|
|
break;
|
|
|
|
case GTK_TYPE_STRING:
|
2000-11-11 15:13:50 +00:00
|
|
|
xmlNewChild (arg, NULL, "value", GTK_VALUE_STRING (args[i]));
|
2000-01-30 09:03:00 +00:00
|
|
|
break;
|
2000-11-11 15:13:50 +00:00
|
|
|
default:
|
|
|
|
if (args[i].type == GST_TYPE_FILENAME) {
|
|
|
|
xmlNewChild (arg, NULL, "value", GTK_VALUE_STRING (args[i]));
|
|
|
|
}
|
|
|
|
break;
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2000-11-11 15:13:50 +00:00
|
|
|
type = gtk_type_parent (type);
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (oclass->save_thyself)
|
2000-11-11 15:13:50 +00:00
|
|
|
(oclass->save_thyself)(element, self);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2000-09-27 19:33:10 +00:00
|
|
|
/**
|
|
|
|
* gst_element_load_thyself:
|
|
|
|
* @parent: the xml parent node
|
2000-10-25 19:09:53 +00:00
|
|
|
* @elements: a hashtable to store the elements in. This is used
|
|
|
|
* to resolve inter element dependecies during the loading.
|
2000-09-27 19:33:10 +00:00
|
|
|
*
|
|
|
|
* load the element based on the XML description
|
|
|
|
*
|
|
|
|
* Returns: the new element
|
|
|
|
*/
|
2000-11-11 15:13:50 +00:00
|
|
|
GstElement*
|
|
|
|
gst_element_load_thyself (xmlNodePtr parent,
|
|
|
|
GHashTable *elements)
|
|
|
|
{
|
2000-09-27 19:33:10 +00:00
|
|
|
xmlNodePtr children = parent->childs;
|
|
|
|
GstElement *element;
|
|
|
|
GstElementClass *oclass;
|
|
|
|
guchar *name = NULL;
|
|
|
|
guchar *value = NULL;
|
|
|
|
guchar *type = NULL;
|
|
|
|
|
|
|
|
// first get the needed tags to cunstruct the element
|
|
|
|
while (children) {
|
2000-11-11 15:13:50 +00:00
|
|
|
if (!strcmp (children->name, "name")) {
|
|
|
|
name = g_strdup (xmlNodeGetContent (children));
|
2000-09-27 19:33:10 +00:00
|
|
|
}
|
2000-11-11 15:13:50 +00:00
|
|
|
else if (!strcmp (children->name, "type")) {
|
|
|
|
type = g_strdup (xmlNodeGetContent (children));
|
2000-09-27 19:33:10 +00:00
|
|
|
}
|
|
|
|
children = children->next;
|
|
|
|
}
|
2000-12-23 03:17:52 +00:00
|
|
|
g_return_val_if_fail (name != NULL, NULL);
|
|
|
|
g_return_val_if_fail (type != NULL, NULL);
|
2000-09-27 19:33:10 +00:00
|
|
|
|
2000-11-11 15:13:50 +00:00
|
|
|
g_print ("gstelement: loading \"%s\" of type \"%s\"\n", name, type);
|
2000-09-27 19:33:10 +00:00
|
|
|
|
2000-11-11 15:13:50 +00:00
|
|
|
element = gst_elementfactory_make (type, name);
|
2000-09-27 19:33:10 +00:00
|
|
|
|
2000-12-23 03:17:52 +00:00
|
|
|
g_return_val_if_fail (element != NULL, NULL);
|
2000-09-27 19:33:10 +00:00
|
|
|
|
2000-11-11 15:13:50 +00:00
|
|
|
g_hash_table_insert (elements, g_strdup (gst_element_get_name (element)), element);
|
2000-09-27 19:33:10 +00:00
|
|
|
|
|
|
|
// we have the element now, set the arguments and pads
|
|
|
|
children = parent->childs;
|
|
|
|
|
|
|
|
while (children) {
|
2000-11-11 15:13:50 +00:00
|
|
|
if (!strcmp (children->name, "pad")) {
|
|
|
|
gst_pad_load_and_connect (children, GST_OBJECT(element), elements);
|
2000-09-27 19:33:10 +00:00
|
|
|
}
|
2000-11-11 15:13:50 +00:00
|
|
|
else if (!strcmp (children->name, "arg")) {
|
2000-09-27 19:33:10 +00:00
|
|
|
xmlNodePtr child = children->childs;
|
|
|
|
|
|
|
|
while (child) {
|
2000-11-11 15:13:50 +00:00
|
|
|
if (!strcmp (child->name, "name")) {
|
|
|
|
name = g_strdup (xmlNodeGetContent (child));
|
2000-09-27 19:33:10 +00:00
|
|
|
}
|
2000-11-11 15:13:50 +00:00
|
|
|
else if (!strcmp (child->name, "value")) {
|
|
|
|
value = g_strdup (xmlNodeGetContent (child));
|
2000-09-27 19:33:10 +00:00
|
|
|
}
|
|
|
|
child = child->next;
|
|
|
|
}
|
|
|
|
if (name && value) {
|
2000-11-11 15:13:50 +00:00
|
|
|
GtkType type = GTK_OBJECT_TYPE (element);
|
2000-09-27 19:33:10 +00:00
|
|
|
GtkArgInfo *info;
|
|
|
|
gchar *result;
|
|
|
|
|
2000-11-11 15:13:50 +00:00
|
|
|
result = gtk_object_arg_get_info (type, name, &info);
|
2000-09-27 19:33:10 +00:00
|
|
|
|
|
|
|
if (result) {
|
|
|
|
g_print("gstelement: %s\n", result);
|
|
|
|
}
|
|
|
|
else if (info->arg_flags & GTK_ARG_WRITABLE) {
|
|
|
|
switch (info->type) {
|
|
|
|
case GTK_TYPE_STRING:
|
2000-11-11 15:13:50 +00:00
|
|
|
gtk_object_set (GTK_OBJECT (element), name, value, NULL);
|
2000-09-27 19:33:10 +00:00
|
|
|
break;
|
|
|
|
case GTK_TYPE_INT: {
|
|
|
|
gint i;
|
2000-11-11 15:13:50 +00:00
|
|
|
sscanf (value, "%d", &i);
|
|
|
|
gtk_object_set (GTK_OBJECT (element), name, i, NULL);
|
2000-09-27 19:33:10 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case GTK_TYPE_LONG: {
|
|
|
|
glong i;
|
2000-11-11 15:13:50 +00:00
|
|
|
sscanf (value, "%ld", &i);
|
|
|
|
gtk_object_set (GTK_OBJECT (element), name, i, NULL);
|
2000-09-27 19:33:10 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case GTK_TYPE_ULONG: {
|
|
|
|
gulong i;
|
2000-11-11 15:13:50 +00:00
|
|
|
sscanf (value, "%lu", &i);
|
|
|
|
gtk_object_set (GTK_OBJECT (element), name, i, NULL);
|
2000-09-27 19:33:10 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case GTK_TYPE_BOOL: {
|
|
|
|
gboolean i = FALSE;
|
2000-11-11 15:13:50 +00:00
|
|
|
if (!strcmp ("true", value)) i = TRUE;
|
|
|
|
gtk_object_set (GTK_OBJECT (element), name, i, NULL);
|
2000-09-27 19:33:10 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case GTK_TYPE_CHAR: {
|
|
|
|
gchar i;
|
2000-11-11 15:13:50 +00:00
|
|
|
sscanf (value, "%c", &i);
|
|
|
|
gtk_object_set (GTK_OBJECT (element), name, i, NULL);
|
2000-09-27 19:33:10 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case GTK_TYPE_UCHAR: {
|
|
|
|
guchar i;
|
2000-11-11 15:13:50 +00:00
|
|
|
sscanf (value, "%c", &i);
|
|
|
|
gtk_object_set (GTK_OBJECT (element), name, i, NULL);
|
2000-09-27 19:33:10 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case GTK_TYPE_FLOAT: {
|
|
|
|
gfloat i;
|
2000-11-11 15:13:50 +00:00
|
|
|
sscanf (value, "%f", &i);
|
|
|
|
gtk_object_set (GTK_OBJECT (element), name, i, NULL);
|
2000-09-27 19:33:10 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case GTK_TYPE_DOUBLE: {
|
|
|
|
gdouble i;
|
2000-11-11 15:13:50 +00:00
|
|
|
sscanf (value, "%g", (float *)&i);
|
|
|
|
gtk_object_set (GTK_OBJECT (element), name, i, NULL);
|
2000-09-27 19:33:10 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
2000-11-11 15:13:50 +00:00
|
|
|
if (info->type == GST_TYPE_FILENAME) {
|
|
|
|
gtk_object_set (GTK_OBJECT (element), name, value, NULL);
|
|
|
|
}
|
2000-09-27 19:33:10 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
children = children->next;
|
|
|
|
}
|
|
|
|
|
2000-11-11 15:13:50 +00:00
|
|
|
oclass = GST_ELEMENT_CLASS (GTK_OBJECT (element)->klass);
|
2000-09-27 19:33:10 +00:00
|
|
|
if (oclass->restore_thyself)
|
2000-11-11 15:13:50 +00:00
|
|
|
(oclass->restore_thyself) (element, parent, elements);
|
2000-09-27 19:33:10 +00:00
|
|
|
|
|
|
|
return element;
|
|
|
|
}
|
|
|
|
|
2000-02-02 06:26:44 +00:00
|
|
|
/**
|
|
|
|
* gst_element_set_manager:
|
|
|
|
* @element: Element to set manager of.
|
|
|
|
* @manager: Element to be the manager.
|
|
|
|
*
|
|
|
|
* Sets the manager of the element. For internal use only, unless you're
|
|
|
|
* writing a new bin subclass.
|
|
|
|
*/
|
2000-11-11 15:13:50 +00:00
|
|
|
void
|
|
|
|
gst_element_set_manager (GstElement *element,
|
|
|
|
GstElement *manager)
|
|
|
|
{
|
2000-01-30 09:03:00 +00:00
|
|
|
element->manager = manager;
|
|
|
|
}
|
|
|
|
|
2000-02-02 06:26:44 +00:00
|
|
|
/**
|
|
|
|
* gst_element_get_manager:
|
|
|
|
* @element: Element to get manager of.
|
|
|
|
*
|
|
|
|
* Returns the manager of the element.
|
|
|
|
*
|
|
|
|
* Returns: Element's manager
|
|
|
|
*/
|
2000-11-11 15:13:50 +00:00
|
|
|
GstElement*
|
|
|
|
gst_element_get_manager (GstElement *element)
|
|
|
|
{
|
2000-01-30 09:03:00 +00:00
|
|
|
return element->manager;
|
|
|
|
}
|
|
|
|
|
|
|
|
// note that this casts a char ** to a GstElement *. Ick.
|
2000-11-11 15:13:50 +00:00
|
|
|
int
|
|
|
|
gst_element_loopfunc_wrapper (int argc, char **argv)
|
|
|
|
{
|
|
|
|
GstElement *element = GST_ELEMENT (argv);
|
2000-11-23 21:49:09 +00:00
|
|
|
while (1) {
|
|
|
|
/* if NEW_LOOPFUNC is set, clear it, we're implicitly updating */
|
|
|
|
if (GST_FLAG_IS_SET(element,GST_ELEMENT_NEW_LOOPFUNC))
|
|
|
|
GST_FLAG_UNSET(element,GST_ELEMENT_NEW_LOOPFUNC);
|
|
|
|
|
|
|
|
/* start up the loop function */
|
|
|
|
element->loopfunc (element);
|
|
|
|
}
|
2000-07-17 17:14:15 +00:00
|
|
|
return 0;
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
|
|
|
|
2000-02-02 06:26:44 +00:00
|
|
|
/**
|
|
|
|
* gst_element_set_loop_function:
|
|
|
|
* @element: Element to set loop function of.
|
|
|
|
* @loop: Pointer to loop function.
|
|
|
|
*
|
|
|
|
* This sets the loop function for the element. The function pointed to
|
|
|
|
* can deviate from the GstElementLoopFunction definition in type of
|
|
|
|
* pointer only.
|
2000-11-23 21:49:09 +00:00
|
|
|
*
|
|
|
|
* NOTE: in order for this to take effect, the current loop function *must*
|
|
|
|
* exit. Assuming the loop function itself is the only one who will cause
|
|
|
|
* a new loopfunc to be assigned, this should be no problem.
|
2000-02-02 06:26:44 +00:00
|
|
|
*/
|
2000-11-11 15:13:50 +00:00
|
|
|
void
|
|
|
|
gst_element_set_loop_function(GstElement *element,
|
|
|
|
GstElementLoopFunction loop)
|
|
|
|
{
|
2000-11-23 21:49:09 +00:00
|
|
|
/* set the loop function */
|
2000-01-30 09:03:00 +00:00
|
|
|
element->loopfunc = loop;
|
2000-11-23 21:49:09 +00:00
|
|
|
|
|
|
|
/* set the NEW_LOOPFUNC flag so everyone knows to go try again */
|
|
|
|
GST_FLAG_SET(element,GST_ELEMENT_NEW_LOOPFUNC);
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|