This is a megapatch with the following changes:

Original commit message from CVS:
This is a megapatch with the following changes:

- moved the gchar *name to GstObject, removed the ones in GstElement and
GstPad.
- moved the parent handling completely into GstObject. This cause *all* of
the plugins to fail (except those that used gst_pad_get_parent)
- rearanged the XML save handling.
- GstObject now has a class function save/restore_thyself.
- GstObject has a generic method gst_object_save_thyself, this makes it
possible to fire a signal wehever a new object is loaded. This is needed
so we can add XML save hooks.
- GstXML API has changed slightly. You now have to create a GstXML object
first before you can actually load something. This makes it possible to
attach a signal to GstXML whenever an object is loaded. I'm not sure we
will keep this interface.
- GstObject can now print the path_string without knowing about the GstPad and
GstElement types.
- Added gst_bin_get_by_name_recurse_up to lookup an element in the current
element hierarchy.
- added XML namespaces to the saved pipelines the namespace is:
http://gstreamer.net/gst-core/1.0/
namespaces are needed to distinguish user generated XML from the core XML.

Note that the plugins still contain a macro GST_OBJECT_PARENT that will be
replaced with gst_pad_get_parent shortly.
This commit is contained in:
Wim Taymans 2001-01-29 00:06:02 +00:00
parent d0abadd974
commit 51cbf22624
65 changed files with 987 additions and 783 deletions

View file

@ -405,24 +405,16 @@ circumstances.
@element:
<!-- ##### FUNCTION gst_element_save_thyself ##### -->
<para>
</para>
@element:
@parent:
@Returns:
<!-- ##### FUNCTION gst_element_load_thyself ##### -->
<para>
</para>
@self:
@parent:
@elements:
@Returns:
<!-- # Unused Parameters # -->
@elements:
<!-- ##### FUNCTION gst_elementfactory_new ##### -->

View file

@ -503,22 +503,14 @@ Call the EOS function of the pad
@pad: the pad to call the eos function of.
<!-- ##### FUNCTION gst_pad_save_thyself ##### -->
<para>
</para>
@pad:
@parent:
@Returns:
<!-- ##### FUNCTION gst_pad_load_and_connect ##### -->
<para>
</para>
@self:
@parent:
<!-- # Unused Parameters # -->
@element:
@elements:

View file

@ -217,13 +217,6 @@ the stream.
</para>
<!-- ##### FUNCTION gst_object_get_type ##### -->
<para>
</para>
@Returns:
<!-- ##### MACRO GST_SINESRC ##### -->
<para>
@ -231,6 +224,13 @@ the stream.
@obj:
<!-- ##### FUNCTION gst_object_get_type ##### -->
<para>
</para>
@Returns:
<!-- ##### SECTION ./tmpl/plugin.sgml:Long_Description ##### -->
<para>
@ -1613,6 +1613,16 @@ Query the element for the current mime type
</para>
<!-- ##### FUNCTION gst_xml_new_from_memory ##### -->
<para>
</para>
@buffer:
@size:
@root:
@Returns:
<!-- ##### SECTION ./tmpl/gstgetbits.sgml:Long_Description ##### -->
<para>
@ -1916,6 +1926,15 @@ Indicates this pad is active
</para>
<!-- ##### FUNCTION gst_element_save_thyself ##### -->
<para>
</para>
@element:
@parent:
@Returns:
<!-- ##### FUNCTION gst_sinesrc_push ##### -->
<para>
@ -1993,6 +2012,15 @@ Indicates this pad is active
@obj:
<!-- ##### FUNCTION gst_pad_save_thyself ##### -->
<para>
</para>
@pad:
@parent:
@Returns:
<!-- ##### STRUCT GstElementClass ##### -->
<para>

View file

@ -21,28 +21,18 @@ All GstElements can be serialized to an XML presentation and subsequently loaded
</para>
@object:
@elements:
@topelements:
@ns:
<!-- ##### FUNCTION gst_xml_new ##### -->
<para>
</para>
@Returns:
<!-- # Unused Parameters # -->
@fname:
@root:
@Returns:
<!-- ##### FUNCTION gst_xml_new_from_memory ##### -->
<para>
</para>
@buffer:
@size:
@root:
@Returns:
<!-- ##### FUNCTION gst_xml_write ##### -->

View file

@ -139,7 +139,7 @@ gst_editor_pad_new(GstEditorElement *parent,GstPad *pad,
GstEditorPad *peereditorpad;
// FIXME does this need to check for ghost/real?
peerpad = GST_PAD_PEER(pad);
peerpad = gst_pad_get_peer (pad);
peereditorpad = GST_EDITOR_GET_OBJECT (peerpad);
@ -152,7 +152,7 @@ gst_editor_pad_new(GstEditorElement *parent,GstPad *pad,
}
gtk_signal_connect_object (GTK_OBJECT (parent), "position_changed",
gst_editor_pad_position_changed, editorpad);
gst_editor_pad_position_changed, GTK_OBJECT (editorpad));
return editorpad;
}
@ -454,10 +454,7 @@ static void
gst_editor_pad_position_changed(GstEditorPad *pad,
GstEditorElement *element)
{
GList *pads;
if (pad->connection) {
// g_print("updating pad's connection\n");
pad->connection->resize = TRUE;
gst_editor_connection_resize(pad->connection);
}

View file

@ -128,7 +128,8 @@ gst_editor_project_new_from_file (const guchar *fname)
editorproject = gst_editor_project_new();
xml = gst_xml_new (fname, NULL);
xml = gst_xml_new ();
gst_xml_parse_file (xml, fname, NULL);
elements = gst_xml_get_topelements(xml);

View file

@ -76,7 +76,7 @@ static void gst_example_get_arg (GtkObject *object,GtkArg *arg,guint id);
GstPadTemplate *src_template, *sink_template;
static GstElementClass *parent_class = NULL;
static guint gst_example_signals[LAST_SIGNAL] = { 0 };
//static guint gst_example_signals[LAST_SIGNAL] = { 0 };
GtkType
gst_example_get_type(void)
@ -134,15 +134,13 @@ static void
gst_example_chain (GstPad *pad, GstBuffer *buf)
{
GstExample *example;
guchar *data;
gint i;
g_return_if_fail(pad != NULL);
g_return_if_fail(GST_IS_PAD(pad));
g_return_if_fail(buf != NULL);
//g_return_if_fail(GST_IS_BUFFER(buf));
example = GST_EXAMPLE(pad->parent);
example = GST_EXAMPLE(gst_pad_get_parent (pad));
g_return_if_fail(example != NULL);
g_return_if_fail(GST_IS_EXAMPLE(example));
@ -199,10 +197,10 @@ plugin_init (GModule *module)
GstElementFactory *factory;
plugin = gst_plugin_new("example");
g_return_if_fail(plugin != NULL);
g_return_val_if_fail(plugin != NULL, NULL);
factory = gst_elementfactory_new("example", GST_TYPE_EXAMPLE, &example_details);
g_return_if_fail(factory != NULL);
g_return_val_if_fail(factory != NULL, NULL);
sink_template = gst_padtemplate_new (&sink_factory);
gst_elementfactory_add_padtemplate (factory, sink_template);

View file

@ -52,7 +52,7 @@ int main(int argc,char *argv[])
gst_bin_add(GST_BIN(thread), queue2);
gst_bin_add(GST_BIN(thread2), audiosink);
gst_pad_connect(gst_element_get_pad(disksrc,"src"),
gst_element_get_pad(queue,"sink"));

View file

@ -3,33 +3,40 @@
gboolean playing;
/* eos will be called when the src element has an end of stream */
void eos(GstElement *element, gpointer data)
static void
xml_loaded (GstXML *xml, GstObject *object, gpointer data)
{
g_print("have eos, quitting\n");
playing = FALSE;
if (GST_IS_PAD (object)) {
g_print ("pad loaded '%s'\n", gst_pad_get_name (GST_PAD (object)));
}
else if (GST_IS_ELEMENT (object)) {
g_print ("element loaded '%s'\n", gst_element_get_name (GST_ELEMENT (object)));
}
}
int main(int argc,char *argv[])
int main(int argc,char *argv[])
{
GstXML *xml;
GstElement *bin;
GstElement *disk;
gboolean ret;
gst_init(&argc,&argv);
xml = gst_xml_new("xmlTest.gst", NULL);
xml = gst_xml_new ();
gtk_signal_connect (GTK_OBJECT (xml), "object_loaded", xml_loaded, NULL);
ret = gst_xml_parse_file(xml, "xmlTest.gst", NULL);
g_assert (ret == TRUE);
bin = gst_xml_get_element(xml, "bin");
g_assert (bin != NULL);
gst_element_set_state(bin, GST_STATE_PLAYING);
playing = TRUE;
while (playing) {
gst_bin_iterate(GST_BIN(bin));
}
while (gst_bin_iterate(GST_BIN(bin)));
gst_element_set_state(bin, GST_STATE_NULL);

View file

@ -218,7 +218,7 @@ gst_asyncdisksrc_get (GstPad *pad)
GstBuffer *buf;
g_return_val_if_fail (pad != NULL, NULL);
src = GST_ASYNCDISKSRC (gst_pad_get_parent(pad));
src = GST_ASYNCDISKSRC (gst_pad_get_parent (pad));
g_return_val_if_fail (GST_FLAG_IS_SET (src, GST_ASYNCDISKSRC_OPEN), NULL);
/* deal with EOF state */
@ -276,7 +276,7 @@ gst_asyncdisksrc_get_region (GstPad *pad, gulong offset, gulong size)
g_return_val_if_fail (pad != NULL, NULL);
src = GST_ASYNCDISKSRC (gst_pad_get_parent(pad));
src = GST_ASYNCDISKSRC (gst_pad_get_parent (pad));
g_return_val_if_fail (GST_IS_ASYNCDISKSRC (src), NULL);
g_return_val_if_fail (GST_FLAG_IS_SET (src, GST_ASYNCDISKSRC_OPEN), NULL);

View file

@ -244,7 +244,7 @@ gst_audiosink_chain (GstPad *pad, GstBuffer *buf)
/* this has to be an audio buffer */
// g_return_if_fail(((GstMeta *)buf->meta)->type !=
//gst_audiosink_type_audio);
audiosink = GST_AUDIOSINK (pad->parent);
audiosink = GST_AUDIOSINK (gst_pad_get_parent (pad));
// g_return_if_fail(GST_FLAG_IS_SET(audiosink,GST_STATE_RUNNING));
if ((in_flush = GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLUSH))) {

View file

@ -149,7 +149,7 @@ gst_audiosrc_get (GstPad *pad)
glong readbytes;
g_return_val_if_fail (pad != NULL, NULL);
src = GST_AUDIOSRC(gst_pad_get_parent(pad));
src = GST_AUDIOSRC(gst_pad_get_parent (pad));
// g_print("attempting to read something from soundcard\n");

View file

@ -208,7 +208,7 @@ gst_disksrc_get (GstPad *pad)
glong readbytes;
g_return_val_if_fail (pad != NULL, NULL);
src = GST_DISKSRC(gst_pad_get_parent(pad));
src = GST_DISKSRC(gst_pad_get_parent (pad));
g_return_val_if_fail (GST_FLAG_IS_SET (src, GST_DISKSRC_OPEN), NULL);
g_return_val_if_fail (GST_STATE (src) >= GST_STATE_READY, NULL);

View file

@ -180,7 +180,7 @@ gst_fakesink_chain (GstPad *pad, GstBuffer *buf)
g_return_if_fail (GST_IS_PAD (pad));
g_return_if_fail (buf != NULL);
fakesink = GST_FAKESINK (pad->parent);
fakesink = GST_FAKESINK (gst_pad_get_parent (pad));
g_print("fakesink: ******* (%s:%s)< \n",GST_DEBUG_PAD_NAME(pad));
gst_buffer_unref (buf);

View file

@ -269,9 +269,11 @@ gst_fakesrc_get(GstPad *pad)
GstFakeSrc *src;
GstBuffer *buf;
g_return_val_if_fail(pad != NULL, NULL);
src = GST_FAKESRC(gst_pad_get_parent(pad));
g_return_val_if_fail(GST_IS_FAKESRC(src), NULL);
g_return_val_if_fail (pad != NULL, NULL);
src = GST_FAKESRC (gst_pad_get_parent (pad));
g_return_val_if_fail (GST_IS_FAKESRC (src), NULL);
if (src->num_buffers == 0) {
gst_pad_set_eos (pad);

View file

@ -113,7 +113,7 @@ gst_fdsink_chain (GstPad *pad, GstBuffer *buf)
g_return_if_fail (GST_IS_PAD (pad));
g_return_if_fail (buf != NULL);
fdsink = GST_FDSINK (pad->parent);
fdsink = GST_FDSINK (gst_pad_get_parent (pad));
g_return_if_fail (fdsink->fd >= 0);

View file

@ -184,7 +184,7 @@ gst_fdsrc_get(GstPad *pad)
glong readbytes;
g_return_val_if_fail (pad != NULL, NULL);
src = GST_FDSRC(gst_pad_get_parent(pad));
src = GST_FDSRC(gst_pad_get_parent (pad));
/* create the buffer */
// FIXME: should eventually use a bufferpool for this

View file

@ -131,7 +131,7 @@ gst_httpsrc_get(GstPad *pad)
glong readbytes;
g_return_val_if_fail (pad != NULL, NULL);
src = GST_HTTPSRC(gst_pad_get_parent(pad));
src = GST_HTTPSRC(gst_pad_get_parent (pad));
buf = gst_buffer_new();
GST_BUFFER_DATA(buf) = (gpointer)malloc(src->bytes_per_read);

View file

@ -120,7 +120,7 @@ gst_identity_chain (GstPad *pad, GstBuffer *buf)
g_return_if_fail (GST_IS_PAD (pad));
g_return_if_fail (buf != NULL);
identity = GST_IDENTITY (pad->parent);
identity = GST_IDENTITY (gst_pad_get_parent (pad));
g_print("identity: ******* (%s:%s)i \n",GST_DEBUG_PAD_NAME(pad));
gst_pad_push (identity->srcpad, buf);

View file

@ -118,13 +118,6 @@ static void gst_pipefilter_init(GstPipefilter *pipefilter) {
pipefilter->seq = 0;
}
GstElement *gst_pipefilter_new(gchar *name) {
GstElement *pipefilter = GST_ELEMENT(gtk_type_new(GST_TYPE_PIPEFILTER));
gst_element_set_name(GST_ELEMENT(pipefilter),name);
return pipefilter;
}
static gboolean gst_pipefilter_read_and_push(GstPipefilter *pipefilter) {
GstBuffer *newbuf;
glong readbytes;
@ -179,7 +172,7 @@ void gst_pipefilter_chain(GstPad *pad,GstBuffer *buf) {
g_return_if_fail(GST_IS_PAD(pad));
g_return_if_fail(buf != NULL);
pipefilter = GST_PIPEFILTER(pad->parent);
pipefilter = GST_PIPEFILTER (gst_pad_get_parent (pad));
while (gst_pipefilter_read_and_push(pipefilter));

View file

@ -132,18 +132,6 @@ static void gst_sinesrc_init(GstSineSrc *sinesrc) {
sinesrc->sentmeta = FALSE;
}
GstElement *gst_sinesrc_new(gchar *name) {
GstElement *sinesrc = GST_ELEMENT(gtk_type_new(GST_TYPE_SINESRC));
gst_element_set_name(GST_ELEMENT(sinesrc),name);
return sinesrc;
}
GstElement *gst_sinesrc_new_with_fd(gchar *name,gchar *filename) {
GstElement *sinesrc = gst_sinesrc_new(name);
gtk_object_set(GTK_OBJECT(sinesrc),"location",filename,NULL);
return sinesrc;
}
static GstBuffer *
gst_sinesrc_get(GstPad *pad)
{
@ -155,7 +143,7 @@ gst_sinesrc_get(GstPad *pad)
gdouble val;
g_return_val_if_fail (pad != NULL, NULL);
src = GST_SINESRC(gst_pad_get_parent(pad));
src = GST_SINESRC(gst_pad_get_parent (pad));
buf = gst_buffer_new();
g_return_val_if_fail (buf, NULL);

View file

@ -181,7 +181,7 @@ gst_tee_chain (GstPad *pad, GstBuffer *buf)
g_return_if_fail (GST_IS_PAD (pad));
g_return_if_fail (buf != NULL);
tee = GST_TEE (pad->parent);
tee = GST_TEE (gst_pad_get_parent (pad));
gst_trace_add_entry (NULL, 0, buf, "tee buffer");
for (i=0; i<tee->numsrcpads-1; i++)

View file

@ -28,8 +28,6 @@
#include "gstscheduler.h"
GstElementDetails gst_bin_details = {
"Generic bin",
"Bin",
@ -51,9 +49,8 @@ static gboolean gst_bin_change_state_type (GstBin *bin,
static void gst_bin_create_plan_func (GstBin *bin);
static gboolean gst_bin_iterate_func (GstBin *bin);
static xmlNodePtr gst_bin_save_thyself (GstElement *element, xmlNodePtr parent);
static void gst_bin_restore_thyself (GstElement *element, xmlNodePtr parent,
GHashTable *elements);
static xmlNodePtr gst_bin_save_thyself (GstObject *object, xmlNodePtr parent);
static void gst_bin_restore_thyself (GstObject *object, xmlNodePtr self);
/* Bin signals and args */
enum {
@ -99,9 +96,11 @@ static void
gst_bin_class_init (GstBinClass *klass)
{
GtkObjectClass *gtkobject_class;
GstObjectClass *gstobject_class;
GstElementClass *gstelement_class;
gtkobject_class = (GtkObjectClass*)klass;
gstobject_class = (GstObjectClass*)klass;
gstelement_class = (GstElementClass*)klass;
parent_class = gtk_type_class (GST_TYPE_ELEMENT);
@ -118,9 +117,10 @@ gst_bin_class_init (GstBinClass *klass)
klass->schedule = gst_bin_schedule_func;
klass->iterate = gst_bin_iterate_func;
gstobject_class->save_thyself = gst_bin_save_thyself;
gstobject_class->restore_thyself = gst_bin_restore_thyself;
gstelement_class->change_state = gst_bin_change_state;
gstelement_class->save_thyself = gst_bin_save_thyself;
gstelement_class->restore_thyself = gst_bin_restore_thyself;
gtkobject_class->destroy = gst_bin_real_destroy;
}
@ -180,7 +180,7 @@ gst_bin_add (GstBin *bin,
bin->numchildren++;
gst_object_set_parent (GST_OBJECT (element), GST_OBJECT (bin));
GST_INFO_ELEMENT (GST_CAT_PARENTAGE, bin, "added child %s", gst_element_get_name(element));
GST_INFO_ELEMENT (GST_CAT_PARENTAGE, bin, "added child %s", GST_ELEMENT_NAME (element));
/* we know we have at least one child, we just added one... */
// if (GST_STATE(element) < GST_STATE_READY)
@ -220,7 +220,7 @@ gst_bin_remove (GstBin *bin,
bin->children = g_list_remove (bin->children, element);
bin->numchildren--;
GST_INFO_ELEMENT (GST_CAT_PARENTAGE, bin, "removed child %s", gst_element_get_name(element));
GST_INFO_ELEMENT (GST_CAT_PARENTAGE, bin, "removed child %s", GST_ELEMENT_NAME (element));
/* if we're down to zero children, force state to NULL */
if (bin->numchildren == 0)
@ -235,7 +235,7 @@ gst_bin_change_state (GstElement *element)
GList *children;
GstElement *child;
GST_DEBUG_ENTER("(\"%s\")",gst_element_get_name (element));
GST_DEBUG_ENTER("(\"%s\")",GST_ELEMENT_NAME (element));
g_return_val_if_fail (GST_IS_BIN (element), GST_STATE_FAILURE);
@ -271,16 +271,16 @@ gst_bin_change_state (GstElement *element)
children = bin->children;
while (children) {
child = GST_ELEMENT (children->data);
GST_DEBUG (0,"setting state on '%s'\n",gst_element_get_name (child));
GST_DEBUG (0,"setting state on '%s'\n",GST_ELEMENT_NAME (child));
switch (gst_element_set_state (child, GST_STATE_PENDING (element))) {
case GST_STATE_FAILURE:
GST_STATE_PENDING (element) = GST_STATE_NONE_PENDING;
GST_DEBUG (0,"child '%s' failed to go to state %d(%s)\n", gst_element_get_name (child),
GST_DEBUG (0,"child '%s' failed to go to state %d(%s)\n", GST_ELEMENT_NAME (child),
GST_STATE_PENDING (element), _gst_print_statename (GST_STATE_PENDING (element)));
return GST_STATE_FAILURE;
break;
case GST_STATE_ASYNC:
GST_DEBUG (0,"child '%s' is changing state asynchronously\n", gst_element_get_name (child));
GST_DEBUG (0,"child '%s' is changing state asynchronously\n", GST_ELEMENT_NAME (child));
break;
}
// g_print("\n");
@ -355,7 +355,7 @@ gst_bin_set_state_type (GstBin *bin,
GstBinClass *oclass;
GST_DEBUG (0,"gst_bin_set_state_type(\"%s\",%d,%d)\n",
gst_element_get_name (GST_ELEMENT (bin)), state,type);
GST_ELEMENT_NAME (bin), state,type);
g_return_val_if_fail (bin != NULL, FALSE);
g_return_val_if_fail (GST_IS_BIN (bin), FALSE);
@ -411,7 +411,7 @@ gst_bin_get_by_name (GstBin *bin,
children = bin->children;
while (children) {
child = GST_ELEMENT (children->data);
if (!strcmp (child->name,name))
if (!strcmp (gst_object_get_name (GST_OBJECT (child)),name))
return child;
if (GST_IS_BIN (child)) {
GstElement *res = gst_bin_get_by_name (GST_BIN (child), name);
@ -424,6 +424,41 @@ gst_bin_get_by_name (GstBin *bin,
return NULL;
}
/**
* gst_bin_get_by_name_recurse_up:
* @bin: #Gstbin to search
* @name: the element name to search for
*
* Get the element with the given name from this bin. If the
* element is not found, a recursion is performed on the parent bin.
*
* Returns: the element with the given name
*/
GstElement*
gst_bin_get_by_name_recurse_up (GstBin *bin,
const gchar *name)
{
GstElement *result = NULL;
GstObject *parent;
g_return_val_if_fail (bin != NULL, NULL);
g_return_val_if_fail (GST_IS_BIN (bin), NULL);
g_return_val_if_fail (name != NULL, NULL);
result = gst_bin_get_by_name (bin, name);
if (result)
return result;
parent = gst_object_get_parent (GST_OBJECT (bin));
if (parent && GST_IS_BIN (parent)) {
result = gst_bin_get_by_name_recurse_up (GST_BIN (parent), name);
}
return result;
}
/**
* gst_bin_get_list:
* @bin: #Gstbin to get the list from
@ -442,48 +477,46 @@ gst_bin_get_list (GstBin *bin)
}
static xmlNodePtr
gst_bin_save_thyself (GstElement *element,
gst_bin_save_thyself (GstObject *object,
xmlNodePtr parent)
{
GstBin *bin = GST_BIN (element);
xmlNodePtr childlist;
GstBin *bin = GST_BIN (object);
xmlNodePtr childlist, elementnode;
GList *children;
GstElement *child;
if (GST_ELEMENT_CLASS (parent_class)->save_thyself)
GST_ELEMENT_CLASS (parent_class)->save_thyself (GST_ELEMENT (bin), parent);
if (GST_OBJECT_CLASS (parent_class)->save_thyself)
GST_OBJECT_CLASS (parent_class)->save_thyself (GST_OBJECT (bin), parent);
childlist = xmlNewChild (parent,NULL,"children",NULL);
childlist = xmlNewChild (parent, NULL, "children", NULL);
GST_INFO_ELEMENT (GST_CAT_XML, bin, "saving %d children", bin->numchildren);
children = bin->children;
while (children) {
child = GST_ELEMENT (children->data);
gst_element_save_thyself (child, childlist);
elementnode = xmlNewChild (childlist, NULL, "element", NULL);
gst_object_save_thyself (GST_OBJECT (child), elementnode);
children = g_list_next (children);
}
return childlist;
}
static void
gst_bin_restore_thyself (GstElement *element,
xmlNodePtr parent,
GHashTable *elements)
gst_bin_restore_thyself (GstObject *object,
xmlNodePtr self)
{
GstBin *bin = GST_BIN (element);
xmlNodePtr field = parent->xmlChildrenNode;
GstBin *bin = GST_BIN (object);
xmlNodePtr field = self->xmlChildrenNode;
xmlNodePtr childlist;
// g_print("gstbin: restore \"%s\"\n", gst_element_get_name (element));
while (field) {
if (!strcmp (field->name, "children")) {
GST_INFO_ELEMENT (GST_CAT_XML, element, "loading children");
GST_INFO_ELEMENT (GST_CAT_XML, GST_ELEMENT (object), "loading children");
childlist = field->xmlChildrenNode;
while (childlist) {
if (!strcmp (childlist->name, "element")) {
GstElement *element = gst_element_load_thyself (childlist, elements);
GstElement *element = gst_element_load_thyself (childlist, GST_OBJECT (bin));
gst_bin_add (bin, element);
}
@ -493,7 +526,6 @@ gst_bin_restore_thyself (GstElement *element,
field = field->next;
}
}
void
@ -520,14 +552,14 @@ gst_bin_iterate (GstBin *bin)
GstBinClass *oclass;
gboolean eos = TRUE;
GST_DEBUG_ENTER("(\"%s\")",gst_element_get_name(GST_ELEMENT(bin)));
GST_DEBUG_ENTER("(\"%s\")",GST_ELEMENT_NAME (bin));
oclass = GST_BIN_CLASS (GTK_OBJECT (bin)->klass);
if (oclass->iterate)
eos = (oclass->iterate) (bin);
GST_DEBUG_LEAVE("(\"%s\")",gst_element_get_name(GST_ELEMENT(bin)));
GST_DEBUG_LEAVE("(\"%s\")",GST_ELEMENT_NAME (bin));
return eos;
}
@ -553,7 +585,7 @@ gst_bin_create_plan (GstBin *bin)
static void
gst_bin_received_eos (GstElement *element, GstBin *bin)
{
GST_INFO_ELEMENT (GST_CAT_PLANNING, bin, "child %s fired eos, pending %d\n", gst_element_get_name (element),
GST_INFO_ELEMENT (GST_CAT_PLANNING, bin, "child %s fired eos, pending %d\n", GST_ELEMENT_NAME (element),
bin->num_eos_providers);
GST_LOCK (bin);
@ -599,7 +631,7 @@ gst_bin_create_plan_func (GstBin *bin)
GSList *pending = NULL;
GstBin *pending_bin;
GST_DEBUG_ENTER("(\"%s\")",gst_element_get_name (GST_ELEMENT (bin)));
GST_DEBUG_ENTER("(\"%s\")",GST_ELEMENT_NAME (bin));
GST_INFO_ELEMENT (GST_CAT_PLANNING, bin, "creating plan");
@ -612,11 +644,11 @@ gst_bin_create_plan_func (GstBin *bin)
} else {
manager = gst_element_get_manager (GST_ELEMENT (bin));
if (!manager) {
GST_DEBUG (0,"manager not set for element \"%s\" assuming manager is self\n", gst_element_get_name (GST_ELEMENT (bin)));
GST_DEBUG (0,"manager not set for element \"%s\" assuming manager is self\n", GST_ELEMENT_NAME (bin));
manager = GST_ELEMENT (bin);
GST_FLAG_SET (bin, GST_BIN_FLAG_MANAGER);
}
GST_DEBUG (0,"setting manager to \"%s\"\n", gst_element_get_name (manager));
GST_DEBUG (0,"setting manager to \"%s\"\n", GST_ELEMENT_NAME (manager));
}
gst_element_set_manager (GST_ELEMENT (bin), manager);
@ -633,22 +665,22 @@ gst_bin_create_plan_func (GstBin *bin)
element = GST_ELEMENT (elements->data);
elements = g_list_next (elements);
#ifdef GST_DEBUG_ENABLED
elementname = gst_element_get_name (element);
elementname = GST_ELEMENT_NAME (element);
#endif
GST_DEBUG (0,"have element \"%s\"\n",elementname);
// first set their manager
GST_DEBUG (0,"setting manager of \"%s\" to \"%s\"\n",elementname,gst_element_get_name(manager));
GST_DEBUG (0,"setting manager of \"%s\" to \"%s\"\n",elementname,GST_ELEMENT_NAME (manager));
gst_element_set_manager (element, manager);
// we do recursion and such for Bins
if (GST_IS_BIN (element)) {
// recurse into the child Bin
GST_DEBUG (0,"recursing into child Bin \"%s\" with manager \"%s\"\n",elementname,
gst_element_get_name(element->manager));
GST_ELEMENT_NAME (element->manager));
gst_bin_create_plan (GST_BIN (element));
GST_DEBUG (0,"after recurse got manager \"%s\"\n",
gst_element_get_name(element->manager));
GST_ELEMENT_NAME (element->manager));
// check to see if it needs cothreads and isn't self-managing
if (((GST_BIN (element))->need_cothreads) && !GST_FLAG_IS_SET(element,GST_BIN_FLAG_MANAGER)) {
GST_DEBUG (0,"requiring cothreads because child bin \"%s\" does\n",elementname);
@ -677,7 +709,7 @@ gst_bin_create_plan_func (GstBin *bin)
// if we're not a manager thread, we're done.
if (!GST_FLAG_IS_SET (bin, GST_BIN_FLAG_MANAGER)) {
GST_DEBUG_LEAVE("(\"%s\")",gst_element_get_name(GST_ELEMENT(bin)));
GST_DEBUG_LEAVE("(\"%s\")",GST_ELEMENT_NAME (bin));
return;
}
@ -697,13 +729,13 @@ gst_bin_create_plan_func (GstBin *bin)
// walk the list of elements, find bins, and do stuff
GST_DEBUG (0,"checking Bin \"%s\" for managed elements\n",
gst_element_get_name (GST_ELEMENT (pending_bin)));
GST_ELEMENT_NAME (pending_bin));
elements = pending_bin->children;
while (elements) {
element = GST_ELEMENT (elements->data);
elements = g_list_next (elements);
#ifdef GST_DEBUG_ENABLED
elementname = gst_element_get_name (element);
elementname = GST_ELEMENT_NAME (element);
#endif
// if it's ours, add it to the list
@ -734,10 +766,10 @@ gst_bin_create_plan_func (GstBin *bin)
gst_bin_schedule(bin);
g_print ("gstbin \"%s\", eos providers:%d\n",
gst_element_get_name (GST_ELEMENT (bin)),
GST_ELEMENT_NAME (bin),
bin->num_eos_providers);
GST_DEBUG_LEAVE("(\"%s\")",gst_element_get_name(GST_ELEMENT(bin)));
GST_DEBUG_LEAVE("(\"%s\")",GST_ELEMENT_NAME (bin));
}
static gboolean
@ -753,7 +785,7 @@ gst_bin_iterate_func (GstBin *bin)
gint num_scheduled = 0;
gboolean eos = FALSE;
GST_DEBUG_ENTER("(\"%s\")", gst_element_get_name (GST_ELEMENT (bin)));
GST_DEBUG_ENTER("(\"%s\")", GST_ELEMENT_NAME (bin));
g_return_val_if_fail (bin != NULL, TRUE);
g_return_val_if_fail (GST_IS_BIN (bin), TRUE);
@ -775,7 +807,7 @@ gst_bin_iterate_func (GstBin *bin)
entry = GST_ELEMENT (chain->elements->data);
GST_FLAG_SET (entry, GST_ELEMENT_COTHREAD_STOPPING);
GST_DEBUG (0,"set COTHREAD_STOPPING flag on \"%s\"(@%p)\n",
gst_element_get_name(entry),entry);
GST_ELEMENT_NAME (entry),entry);
cothread_switch (entry->threadstate);
} else {
@ -789,7 +821,7 @@ gst_bin_iterate_func (GstBin *bin)
entry = GST_ELEMENT (entries->data);
entries = g_list_next (entries);
GST_DEBUG (0,"have entry \"%s\"\n",gst_element_get_name(entry));
GST_DEBUG (0,"have entry \"%s\"\n",GST_ELEMENT_NAME (entry));
if (GST_IS_BIN (entry)) {
gst_bin_iterate (GST_BIN (entry));
@ -800,7 +832,7 @@ gst_bin_iterate_func (GstBin *bin)
if (GST_RPAD_DIRECTION(pad) == GST_PAD_SRC) {
GST_DEBUG (0,"calling getfunc of %s:%s\n",GST_DEBUG_PAD_NAME(pad));
if (GST_REAL_PAD(pad)->getfunc == NULL)
fprintf(stderr, "error, no getfunc in \"%s\"\n", gst_element_get_name (entry));
fprintf(stderr, "error, no getfunc in \"%s\"\n", GST_ELEMENT_NAME (entry));
else
buf = (GST_REAL_PAD(pad)->getfunc)(pad);
if (buf) gst_pad_push(pad,buf);
@ -829,7 +861,7 @@ gst_bin_iterate_func (GstBin *bin)
}
}
GST_DEBUG_LEAVE("(%s)", gst_element_get_name (GST_ELEMENT (bin)));
GST_DEBUG_LEAVE("(%s)", GST_ELEMENT_NAME (bin));
return !eos;
}

View file

@ -125,6 +125,8 @@ void gst_bin_remove (GstBin *bin,
/* retrieve a single element or the list of children */
GstElement* gst_bin_get_by_name (GstBin *bin,
const gchar *name);
GstElement* gst_bin_get_by_name_recurse_up (GstBin *bin,
const gchar *name);
GList* gst_bin_get_list (GstBin *bin);
void gst_bin_create_plan (GstBin *bin);

View file

@ -40,25 +40,25 @@ static GstClock *the_system_clock = NULL;
* Returns: the new clock element
*/
GstClock*
gst_clock_new (gchar *name)
gst_clock_new (gchar *name)
{
GstClock *clock = (GstClock *) g_malloc(sizeof(GstClock));
clock->name = g_strdup (name);
clock->sinkobjects = NULL;
clock->sinkmutex = g_mutex_new ();
clock->lock = g_mutex_new ();
g_mutex_lock (clock->sinkmutex);
clock->num = 0;
clock->num_locked = 0;
clock->locking = FALSE;
return clock;
}
GstClock*
gst_clock_get_system(void)
gst_clock_get_system(void)
{
if (the_system_clock == NULL) {
the_system_clock = gst_clock_new ("system_clock");
@ -67,8 +67,8 @@ gst_clock_get_system(void)
return the_system_clock;
}
void
gst_clock_register (GstClock *clock, GstObject *obj)
void
gst_clock_register (GstClock *clock, GstObject *obj)
{
if ((GST_ELEMENT(obj))->numsrcpads == 0) {
GST_DEBUG (0,"gst_clock: setting registered sink object 0x%p\n", obj);
@ -77,8 +77,8 @@ gst_clock_register (GstClock *clock, GstObject *obj)
}
}
void
gst_clock_set (GstClock *clock, GstClockTime time)
void
gst_clock_set (GstClock *clock, GstClockTime time)
{
struct timeval tfnow;
GstClockTime now;
@ -91,7 +91,7 @@ gst_clock_set (GstClock *clock, GstClockTime time)
GST_DEBUG (0,"gst_clock: setting clock to %llu %llu %llu\n", time, now, clock->start_time);
}
GstClockTimeDiff
GstClockTimeDiff
gst_clock_current_diff (GstClock *clock, GstClockTime time)
{
struct timeval tfnow;
@ -99,14 +99,14 @@ gst_clock_current_diff (GstClock *clock, GstClockTime time)
gettimeofday (&tfnow, (struct timezone *)NULL);
g_mutex_lock (clock->lock);
now = ((guint64)tfnow.tv_sec*1000000LL+tfnow.tv_usec) - (guint64)clock->start_time;
now = ((guint64)tfnow.tv_sec*1000000LL+tfnow.tv_usec) - (guint64)clock->start_time;
g_mutex_unlock (clock->lock);
return GST_CLOCK_DIFF (time, now);
}
void
gst_clock_reset (GstClock *clock)
void
gst_clock_reset (GstClock *clock)
{
struct timeval tfnow;
@ -119,8 +119,8 @@ gst_clock_reset (GstClock *clock)
g_mutex_unlock (clock->lock);
}
void
gst_clock_wait (GstClock *clock, GstClockTime time, GstObject *obj)
void
gst_clock_wait (GstClock *clock, GstClockTime time, GstObject *obj)
{
struct timeval tfnow;
GstClockTime now;
@ -133,8 +133,8 @@ gst_clock_wait (GstClock *clock, GstClockTime time, GstObject *obj)
diff = GST_CLOCK_DIFF (time, now);
// if we are not behind wait a bit
GST_DEBUG (0,"gst_clock: %s waiting for time %08llu %08llu %08lld\n", gst_element_get_name(GST_ELEMENT(obj)), time, now, diff);
GST_DEBUG (0,"gst_clock: %s waiting for time %08llu %08llu %08lld\n", GST_OBJECT_NAME (obj), time, now, diff);
g_mutex_unlock (clock->lock);
if (diff > 10000 ) {
tfnow.tv_usec = (diff % 1000000);
@ -143,8 +143,8 @@ gst_clock_wait (GstClock *clock, GstClockTime time, GstObject *obj)
if (!tfnow.tv_sec) {
select(0, NULL, NULL, NULL, &tfnow);
}
else GST_DEBUG (0,"gst_clock: %s waiting %u %llu %llu %llu seconds\n", gst_element_get_name(GST_ELEMENT(obj)),
else GST_DEBUG (0,"gst_clock: %s waiting %u %llu %llu %llu seconds\n", GST_OBJECT_NAME (obj),
(int)tfnow.tv_sec, now, diff, time);
}
GST_DEBUG (0,"gst_clock: %s waiting for time %08llu %08llu %08lld done \n", gst_element_get_name(GST_ELEMENT(obj)), time, now, diff);
GST_DEBUG (0,"gst_clock: %s waiting for time %08llu %08llu %08lld done \n", GST_OBJECT_NAME (obj), time, now, diff);
}

View file

@ -44,12 +44,14 @@ enum {
};
static void gst_element_class_init (GstElementClass *klass);
static void gst_element_init (GstElement *element);
static void gst_element_class_init (GstElementClass *klass);
static void gst_element_init (GstElement *element);
static void gst_element_real_destroy (GtkObject *object);
static void gst_element_real_destroy (GtkObject *object);
static GstElementStateReturn gst_element_change_state(GstElement *element);
static GstElementStateReturn gst_element_change_state (GstElement *element);
static xmlNodePtr gst_element_save_thyself (GstObject *object, xmlNodePtr parent);
static GstObjectClass *parent_class = NULL;
static guint gst_element_signals[LAST_SIGNAL] = { 0 };
@ -77,8 +79,10 @@ static void
gst_element_class_init (GstElementClass *klass)
{
GtkObjectClass *gtkobject_class;
GstObjectClass *gstobject_class;
gtkobject_class = (GtkObjectClass*)klass;
gtkobject_class = (GtkObjectClass*) klass;
gstobject_class = (GstObjectClass*) klass;
parent_class = gtk_type_class(GST_TYPE_OBJECT);
@ -110,10 +114,12 @@ gst_element_class_init (GstElementClass *klass)
gtk_object_class_add_signals (gtkobject_class, gst_element_signals, LAST_SIGNAL);
gtkobject_class->destroy = gst_element_real_destroy;
gstobject_class->save_thyself = gst_element_save_thyself;
klass->change_state = gst_element_change_state;
klass->elementfactory = NULL;
gtkobject_class->destroy = gst_element_real_destroy;
}
static void
@ -142,6 +148,78 @@ gst_element_new(void)
return GST_ELEMENT (gtk_type_new (GST_TYPE_ELEMENT));
}
/**
* 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.
*/
void
gst_element_set_name (GstElement *element, const gchar *name)
{
g_return_if_fail (element != NULL);
g_return_if_fail (GST_IS_ELEMENT (element));
g_return_if_fail (name != NULL);
gst_object_set_name (GST_OBJECT (element), name);
}
/**
* gst_element_get_name:
* @element: GstElement to get name of
*
* Get the name of the element.
*
* Returns: name of the element
*/
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);
return GST_OBJECT_NAME (element);
}
/**
* gst_element_set_parent:
* @element: GstElement to set parent of
* @name: new parent of the object
*
* Set the parent of the element.
*/
void
gst_element_set_parent (GstElement *element, GstObject *parent)
{
g_return_if_fail (element != NULL);
g_return_if_fail (GST_IS_ELEMENT (element));
g_return_if_fail (GST_OBJECT_PARENT (element) == NULL);
g_return_if_fail (parent != NULL);
g_return_if_fail (GTK_IS_OBJECT (parent));
g_return_if_fail ((gpointer)element != (gpointer)parent);
gst_object_set_parent (GST_OBJECT (element), parent);
}
/**
* gst_element_get_parent:
* @element: GstElement to get the parent of
*
* Get the parent of the element.
*
* Returns: parent of the element
*/
GstObject*
gst_element_get_parent (GstElement *element)
{
g_return_val_if_fail (element != NULL, NULL);
g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
return GST_OBJECT_PARENT (element);
}
/**
* gst_element_add_pad:
* @element: element to add pad to
@ -160,8 +238,8 @@ gst_element_add_pad (GstElement *element, GstPad *pad)
/* set the pad's parent */
GST_DEBUG (0,"setting parent of pad '%s'(%p) to '%s'(%p)\n",
gst_pad_get_name(pad),pad,gst_element_get_name(element),element);
gst_pad_set_parent (pad,GST_OBJECT (element));
GST_PAD_NAME (pad), pad, GST_ELEMENT_NAME (element), element);
gst_object_set_parent (GST_OBJECT (pad), GST_OBJECT (element));
/* add it to the list */
element->pads = g_list_append (element->pads, pad);
@ -198,11 +276,11 @@ gst_element_add_ghost_pad (GstElement *element, GstPad *pad, gchar *name)
ghostpad = gst_ghost_pad_new (name, pad);
/* add it to the list */
GST_DEBUG(0,"adding ghost pad %s to element %s\n",name,gst_element_get_name(element));
GST_DEBUG(0,"adding ghost pad %s to element %s\n", name, GST_ELEMENT_NAME (element));
element->pads = g_list_append (element->pads, ghostpad);
element->numpads++;
// set the parent of the ghostpad
gst_pad_set_parent(ghostpad, GST_OBJECT (element));
gst_object_set_parent (GST_OBJECT (ghostpad), GST_OBJECT (element));
GST_DEBUG(0,"added ghostpad %s:%s\n",GST_DEBUG_PAD_NAME(ghostpad));
@ -253,14 +331,15 @@ gst_element_get_pad (GstElement *element, const gchar *name)
return NULL;
GST_DEBUG(GST_CAT_ELEMENT_PADS,"searching for pad '%s' in element %s\n",
name,gst_element_get_name(element));
name, GST_ELEMENT_NAME (element));
// look through the list, matching by name
walk = element->pads;
while (walk) {
if (!strcmp ((GST_PAD(walk->data))->name, name)) {
GstPad *pad = GST_PAD(walk->data);
if (!strcmp (gst_object_get_name (GST_OBJECT(pad)), name)) {
GST_DEBUG(GST_CAT_ELEMENT_PADS,"found pad '%s'\n",name);
return GST_PAD(walk->data);
return pad;
}
walk = g_list_next (walk);
}
@ -521,7 +600,7 @@ gst_element_connect (GstElement *src, const gchar *srcpadname,
/*
if (srcparent != destparent) {
GST_ERROR_OBJECT(srcparent,destparent,"%s and %s have different parents",
gst_element_get_name(src),gst_element_get_name(dest));
GST_ELEMENT_NAME (src),GST_ELEMENT_NAME (dest));
return;
}
*/
@ -579,7 +658,7 @@ gst_element_disconnect (GstElement *src, const gchar *srcpadname,
void
gst_element_error (GstElement *element, const gchar *error)
{
g_error("GstElement: error in element '%s': %s\n", element->name, error);
g_error("GstElement: error in element '%s': %s\n", gst_object_get_name (GST_OBJECT (element)), error);
/* FIXME: this is not finished!!! */
@ -631,7 +710,7 @@ gst_element_set_state (GstElement *element, GstElementState state)
/* 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_FAILURE) {
// GST_DEBUG (0,"have async return from '%s'\n",gst_element_get_name(element));
// GST_DEBUG (0,"have async return from '%s'\n",GST_ELEMENT_NAME (element));
return return_val;
}
}
@ -688,44 +767,6 @@ gst_element_change_state (GstElement *element)
return TRUE;
}
/**
* 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.
*/
void
gst_element_set_name (GstElement *element, const gchar *name)
{
g_return_if_fail (element != NULL);
g_return_if_fail (GST_IS_ELEMENT (element));
g_return_if_fail (name != NULL);
if (element->name != NULL)
g_free(element->name);
element->name = g_strdup (name);
}
/**
* gst_element_get_name:
* @element: GstElement to get name of
*
* Get the name of the element.
*
* Returns: name of the element
*/
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);
return element->name;
}
static void
gst_element_real_destroy (GtkObject *object)
{
@ -735,9 +776,6 @@ gst_element_real_destroy (GtkObject *object)
// g_print("in gst_element_real_destroy()\n");
if (element->name)
g_free (element->name);
pads = element->pads;
while (pads) {
pad = GST_PAD (pads->data);
@ -774,25 +812,30 @@ static gchar *_gst_element_type_names[] = {
*
* Returns: the new xml node
*/
xmlNodePtr
gst_element_save_thyself (GstElement *element,
static xmlNodePtr
gst_element_save_thyself (GstObject *object,
xmlNodePtr parent)
{
xmlNodePtr self;
GList *pads;
GstPad *pad;
GstElementClass *oclass;
GstElementFactory *factory;
GtkType type;
GstElement *element;
g_return_val_if_fail (object != NULL, parent);
g_return_val_if_fail (GST_IS_ELEMENT (object), parent);
g_return_val_if_fail (parent != NULL, parent);
element = GST_ELEMENT (object);
oclass = GST_ELEMENT_CLASS (GTK_OBJECT (element)->klass);
self = xmlNewChild (parent, NULL, "element", NULL);
xmlNewChild(self, NULL, "name", element->name);
xmlNewChild(parent, NULL, "name", gst_object_get_name (GST_OBJECT (element)));
if (oclass->elementfactory != NULL) {
factory = (GstElementFactory *)oclass->elementfactory;
xmlNewChild (self, NULL, "type", factory->name);
xmlNewChild (self, NULL, "version", factory->details->version);
GstElementFactory *factory = (GstElementFactory *)oclass->elementfactory;
xmlNewChild (parent, NULL, "type", factory->name);
xmlNewChild (parent, NULL, "version", factory->details->version);
}
// output all args to the element
@ -806,11 +849,10 @@ gst_element_save_thyself (GstElement *element,
for (i=0; i<num_args; i++) {
if ((args[i].type > GTK_TYPE_NONE) &&
//(args[i].type <= GTK_TYPE_STRING) &&
(flags[i] & GTK_ARG_READABLE)) {
xmlNodePtr arg;
gtk_object_getv (GTK_OBJECT (element), 1, &args[i]);
arg = xmlNewChild (self, NULL, "arg", NULL);
arg = xmlNewChild (parent, NULL, "arg", NULL);
xmlNewChild (arg, NULL, "name", args[i].name);
switch (args[i].type) {
case GTK_TYPE_CHAR:
@ -861,24 +903,20 @@ gst_element_save_thyself (GstElement *element,
pads = element->pads;
while (pads) {
xmlNodePtr padtag = xmlNewChild (self, NULL, "pad", NULL);
pad = GST_PAD (pads->data);
GstPad *pad = GST_PAD (pads->data);
xmlNodePtr padtag = xmlNewChild (parent, NULL, "pad", NULL);
// figure out if it's a direct pad or a ghostpad
if (GST_ELEMENT (pad->parent) == element)
gst_pad_save_thyself (pad, padtag);
if (GST_ELEMENT (GST_OBJECT_PARENT (pad)) == element)
gst_object_save_thyself (GST_OBJECT (pad), padtag);
pads = g_list_next (pads);
}
if (oclass->save_thyself)
(oclass->save_thyself)(element, self);
return self;
return parent;
}
/**
* gst_element_load_thyself:
* @parent: the xml parent node
* @self: the xml node
* @elements: a hashtable to store the elements in. This is used
* to resolve inter element dependecies during the loading.
*
@ -887,12 +925,11 @@ gst_element_save_thyself (GstElement *element,
* Returns: the new element
*/
GstElement*
gst_element_load_thyself (xmlNodePtr parent,
GHashTable *elements)
gst_element_load_thyself (xmlNodePtr self, GstObject *parent)
{
xmlNodePtr children = parent->xmlChildrenNode;
xmlNodePtr children = self->xmlChildrenNode;
GstElement *element;
GstElementClass *oclass;
GstObjectClass *oclass;
guchar *name = NULL;
guchar *value = NULL;
guchar *type = NULL;
@ -915,10 +952,13 @@ gst_element_load_thyself (xmlNodePtr parent,
g_return_val_if_fail (element != NULL, NULL);
g_hash_table_insert (elements, g_strdup (gst_element_get_name (element)), element);
// ne need to set the parent on this object bacause the pads
// will go through the hierarchy to connect to thier peers
if (parent)
gst_object_set_parent (GST_OBJECT (element), parent);
// we have the element now, set the arguments
children = parent->xmlChildrenNode;
children = self->xmlChildrenNode;
while (children) {
if (!strcmp (children->name, "arg")) {
@ -1009,18 +1049,21 @@ gst_element_load_thyself (xmlNodePtr parent,
children = children->next;
}
// we have the element now, set the pads
children = parent->xmlChildrenNode;
children = self->xmlChildrenNode;
while (children) {
if (!strcmp (children->name, "pad")) {
gst_pad_load_and_connect (children, GST_OBJECT(element), elements);
gst_pad_load_and_connect (children, GST_OBJECT (element));
}
children = children->next;
}
oclass = GST_ELEMENT_CLASS (GTK_OBJECT (element)->klass);
oclass = GST_OBJECT_CLASS (GTK_OBJECT (element)->klass);
if (oclass->restore_thyself)
(oclass->restore_thyself) (element, parent, elements);
(oclass->restore_thyself) (GST_OBJECT (element), self);
if (parent)
gst_object_unparent (GST_OBJECT (element));
return element;
}

View file

@ -37,7 +37,6 @@
#include <gst/gstpad.h>
#include <gst/cothreads.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
@ -121,6 +120,8 @@ typedef enum {
#define GST_ELEMENT_IS_COTHREAD_STOPPING(obj) (GST_FLAG_IS_SET(obj,GST_ELEMENT_COTHREAD_STOPPING))
#define GST_ELEMENT_IS_EOS(obj) (GST_FLAG_IS_SET(obj,GST_ELEMENT_EOS))
#define GST_ELEMENT_NAME(obj) (GST_OBJECT_NAME(obj))
#define GST_ELEMENT_PARENT(obj) (GST_OBJECT_PARENT(obj))
typedef struct _GstElement GstElement;
typedef struct _GstElementClass GstElementClass;
@ -132,8 +133,6 @@ typedef void (*GstElementLoopFunction) (GstElement *element);
struct _GstElement {
GstObject object;
gchar *name;
guint8 current_state;
guint8 pending_state;
@ -165,10 +164,6 @@ struct _GstElementClass {
GstElementStateReturn (*change_state) (GstElement *element);
/* request a new pad */
GstPad* (*request_new_pad) (GstElement *element, GstPadTemplate *templ);
/* create or read XML representation of self */
xmlNodePtr (*save_thyself) (GstElement *element, xmlNodePtr parent);
void (*restore_thyself) (GstElement *element, xmlNodePtr self, GHashTable *elements);
};
struct _GstElementDetails {
@ -197,8 +192,11 @@ GstElement* gst_element_new (void);
void gst_element_set_loop_function (GstElement *element,
GstElementLoopFunction loop);
void gst_element_set_name (GstElement *element, const gchar *name);
const gchar* gst_element_get_name (GstElement *element);
void gst_element_set_name (GstElement *element, const gchar *name);
const gchar* gst_element_get_name (GstElement *element);
void gst_element_set_parent (GstElement *element, GstObject *parent);
GstObject* gst_element_get_parent (GstElement *element);
void gst_element_set_manager (GstElement *element, GstElement *manager);
GstElement* gst_element_get_manager (GstElement *element);
@ -230,8 +228,7 @@ void gst_element_error (GstElement *element, const gchar *error);
GstElementFactory* gst_element_get_factory (GstElement *element);
/* XML write and read */
xmlNodePtr gst_element_save_thyself (GstElement *element, xmlNodePtr parent);
GstElement* gst_element_load_thyself (xmlNodePtr parent, GHashTable *elements);
GstElement* gst_element_load_thyself (xmlNodePtr self, GstObject *parent);
/*

View file

@ -167,7 +167,7 @@ gst_elementfactory_create (GstElementFactory *factory,
oclass->elementfactory = factory;
}
gst_element_set_name(GST_ELEMENT(element),name);
gst_object_set_name (GST_OBJECT (element),name);
return element;
}

View file

@ -21,7 +21,8 @@
*/
#include "gst_private.h"
#include "gst.h"
#include "gstelement.h"
#include "gstpad.h"
extern gchar *_gst_progname;
@ -91,7 +92,7 @@ gst_default_info_handler (gint category, gchar *file, gchar *function,
if (category != GST_CAT_GST_INIT)
location = g_strdup_printf("%s:%d%s:",function,line,debug_string);
if (element && GST_IS_ELEMENT (element))
elementname = g_strdup_printf (" [%s]",gst_element_get_name (element));
elementname = g_strdup_printf (" [%s]", GST_OBJECT_NAME (element));
fprintf(stderr,"INFO:%s%s %s\n",location,elementname,string);

View file

@ -110,9 +110,9 @@ G_GNUC_UNUSED static gchar *_debug_string = NULL;
/********** some convenience macros for debugging **********/
#define GST_DEBUG_PAD_NAME(pad) \
(GST_PAD_PARENT(pad) != NULL) ? \
gst_element_get_name(GST_ELEMENT(GST_PAD_PARENT(pad))) : \
"''", gst_pad_get_name((GstPad*)pad)
(GST_OBJECT_PARENT(pad) != NULL) ? \
GST_OBJECT_NAME (GST_OBJECT_PARENT(pad)) : \
"''", GST_OBJECT_NAME (pad)

View file

@ -23,8 +23,6 @@
#include "gst_private.h"
#include "gstobject.h"
#include "gstpad.h"
#include "gstelement.h"
/* Object signals and args */
enum {
@ -38,14 +36,15 @@ enum {
};
static void gst_object_class_init(GstObjectClass *klass);
static void gst_object_init(GstObject *object);
static void gst_object_class_init (GstObjectClass *klass);
static void gst_object_init (GstObject *object);
static GtkObjectClass *parent_class = NULL;
static guint gst_object_signals[LAST_SIGNAL] = { 0 };
GtkType gst_object_get_type(void) {
GtkType
gst_object_get_type (void)
{
static GtkType object_type = 0;
if (!object_type) {
@ -64,22 +63,28 @@ GtkType gst_object_get_type(void) {
return object_type;
}
static void gst_object_class_init(GstObjectClass *klass) {
static void
gst_object_class_init (GstObjectClass *klass)
{
GtkObjectClass *gtkobject_class;
gtkobject_class = (GtkObjectClass*)klass;
gtkobject_class = (GtkObjectClass*) klass;
parent_class = gtk_type_class(gtk_object_get_type());
parent_class = gtk_type_class (gtk_object_get_type ());
gst_object_signals[PARENT_SET] =
gtk_signal_new("parent_set",GTK_RUN_LAST,gtkobject_class->type,
GTK_SIGNAL_OFFSET(GstObjectClass,parent_set),
gtk_marshal_NONE__POINTER,GTK_TYPE_NONE,1,
GST_TYPE_OBJECT);
gtk_object_class_add_signals(gtkobject_class,gst_object_signals,LAST_SIGNAL);
gtk_signal_new ("parent_set", GTK_RUN_LAST, gtkobject_class->type,
GTK_SIGNAL_OFFSET (GstObjectClass, parent_set),
gtk_marshal_NONE__POINTER, GTK_TYPE_NONE, 1,
GST_TYPE_OBJECT);
gtk_object_class_add_signals (gtkobject_class, gst_object_signals, LAST_SIGNAL);
klass->path_string_separator = "/";
}
static void gst_object_init(GstObject *object) {
static void
gst_object_init (GstObject *object)
{
object->lock = g_mutex_new();
#ifdef HAVE_ATOMIC_H
atomic_set(&(object->refcount),1);
@ -96,8 +101,47 @@ static void gst_object_init(GstObject *object) {
*
* Returns: new object
*/
GstObject *gst_object_new() {
return GST_OBJECT(gtk_type_new(gst_object_get_type()));
GstObject*
gst_object_new (void)
{
return GST_OBJECT (gtk_type_new (gst_object_get_type ()));
}
/**
* gst_object_set_name:
* @object: GstObject to set the name of
* @name: new name of object
*
* Set the name of the object.
*/
void
gst_object_set_name (GstObject *object, const gchar *name)
{
g_return_if_fail (object != NULL);
g_return_if_fail (GST_IS_OBJECT (object));
g_return_if_fail (name != NULL);
if (object->name != NULL)
g_free (object->name);
object->name = g_strdup (name);
}
/**
* gst_object_get_name:
* @object: GstObject to get the name of
*
* Get the name of the object.
*
* Returns: name of the object
*/
const gchar*
gst_object_get_name (GstObject *object)
{
g_return_val_if_fail (object != NULL, NULL);
g_return_val_if_fail (GST_IS_OBJECT (object), NULL);
return object->name;
}
/**
@ -109,23 +153,25 @@ GstObject *gst_object_new() {
* incremented.
* signals the parent-set signal
*/
void gst_object_set_parent(GstObject *object,GstObject *parent) {
g_return_if_fail(object != NULL);
g_return_if_fail(GST_IS_OBJECT(object));
g_return_if_fail(parent != NULL);
g_return_if_fail(GST_IS_OBJECT(parent));
g_return_if_fail(object != parent);
void
gst_object_set_parent (GstObject *object, GstObject *parent)
{
g_return_if_fail (object != NULL);
g_return_if_fail (GST_IS_OBJECT (object));
g_return_if_fail (parent != NULL);
g_return_if_fail (GST_IS_OBJECT (parent));
g_return_if_fail (object != parent);
if (object->parent != NULL) {
GST_ERROR_OBJECT(object,object->parent,"object's parent is already set, must unparent first");
GST_ERROR_OBJECT (object,object->parent, "object's parent is already set, must unparent first");
return;
}
gst_object_ref(object);
gst_object_sink(object);
gst_object_ref (object);
gst_object_sink (object);
object->parent = parent;
gtk_signal_emit(GTK_OBJECT(object),gst_object_signals[PARENT_SET],parent);
gtk_signal_emit (GTK_OBJECT (object), gst_object_signals[PARENT_SET], parent);
}
/**
@ -136,9 +182,11 @@ void gst_object_set_parent(GstObject *object,GstObject *parent) {
*
* Returns: parent of the object
*/
GstObject *gst_object_get_parent(GstObject *object) {
g_return_val_if_fail(object != NULL, NULL);
g_return_val_if_fail(GST_IS_OBJECT(object), NULL);
GstObject*
gst_object_get_parent (GstObject *object)
{
g_return_val_if_fail (object != NULL, NULL);
g_return_val_if_fail (GST_IS_OBJECT (object), NULL);
return object->parent;
}
@ -149,14 +197,16 @@ GstObject *gst_object_get_parent(GstObject *object) {
*
* Clear the parent of the object, removing the associated reference.
*/
void gst_object_unparent(GstObject *object) {
g_return_if_fail(object != NULL);
g_return_if_fail(GST_IS_OBJECT(object));
void
gst_object_unparent (GstObject *object)
{
g_return_if_fail (object != NULL);
g_return_if_fail (GST_IS_OBJECT(object));
if (object->parent == NULL)
return;
object->parent = NULL;
gst_object_unref(object);
gst_object_unref (object);
}
/**
@ -166,18 +216,20 @@ void gst_object_unparent(GstObject *object) {
* Increments the refence count on the object.
*/
#ifndef gst_object_ref
void gst_object_ref (GstObject *object) {
g_return_if_fail(object != NULL);
g_return_if_fail(GST_IS_OBJECT(object));
void
gst_object_ref (GstObject *object)
{
g_return_if_fail (object != NULL);
g_return_if_fail (GST_IS_OBJECT (object));
#ifdef HAVE_ATOMIC_H
g_return_if_fail(atomic_read(&(object->refcount)) > 0);
atomic_inc(&(object->refcount))
g_return_if_fail (atomic_read (&(object->refcount)) > 0);
atomic_inc (&(object->refcount))
#else
g_return_if_fail(object->refcount > 0);
GST_LOCK(object);
g_return_if_fail (object->refcount > 0);
GST_LOCK (object);
object->refcount++;
GST_UNLOCK(object);
GST_UNLOCK (object);
#endif
}
#endif /* gst_object_ref */
@ -190,36 +242,38 @@ void gst_object_ref (GstObject *object) {
* zero, destroy the object.
*/
#ifndef gst_object_unref
void gst_object_unref (GstObject *object) {
void
gst_object_unref (GstObject *object)
{
int reftest;
g_return_if_fail(object != NULL);
g_return_if_fail(GST_IS_OBJECT(object));
g_return_if_fail (object != NULL);
g_return_if_fail (GST_IS_OBJECT (object));
#ifdef HAVE_ATOMIC_H
g_return_if_fail(atomic_read(&(object->refcount)) > 0);
reftest = atomic_dec_and_test(&(object->refcount))
g_return_if_fail (atomic_read (&(object->refcount)) > 0);
reftest = atomic_dec_and_test (&(object->refcount))
#else
g_return_if_fail(object->refcount > 0);
GST_LOCK(object);
g_return_if_fail (object->refcount > 0);
GST_LOCK (object);
object->refcount--;
reftest = (object->refcount == 0);
GST_UNLOCK(object);
GST_UNLOCK (object);
#endif
/* if we ended up with the refcount at zero */
if (reftest) {
/* get the count to 1 for gtk_object_destroy() */
#ifdef HAVE_ATOMIC_H
atomic_set(&(object->refcount),1);
atomic_set (&(object->refcount),1);
#else
object->refcount = 1;
#endif
/* destroy it */
gtk_object_destroy(GTK_OBJECT(object));
gtk_object_destroy (GTK_OBJECT (object));
/* drop the refcount back to zero */
#ifdef HAVE_ATOMIC_H
atomic_set(&(object->refcount),0);
atomic_set (&(object->refcount),0);
#else
object->refcount = 0;
#endif
@ -240,17 +294,41 @@ void gst_object_unref (GstObject *object) {
* creating a new object to symbolically 'take ownership of' the object.
*/
#ifndef gst_object_sink
void gst_object_sink(GstObject *object) {
g_return_if_fail(object != NULL);
g_return_if_fail(GST_IS_OBJECT(object));
void
gst_object_sink (GstObject *object)
{
g_return_if_fail (object != NULL);
g_return_if_fail (GST_IS_OBJECT (object));
if (GTK_OBJECT_FLOATING(object)) {
GTK_OBJECT_UNSET_FLAGS(object, GTK_FLOATING);
gst_object_unref(object);
if (GTK_OBJECT_FLOATING (object)) {
GTK_OBJECT_UNSET_FLAGS (object, GTK_FLOATING);
gst_object_unref (object);
}
}
#endif /* gst_object_sink */
xmlNodePtr
gst_object_save_thyself (GstObject *object, xmlNodePtr parent)
{
GstObjectClass *oclass;
g_return_val_if_fail (object != NULL, parent);
g_return_val_if_fail (GST_IS_OBJECT (object), parent);
g_return_val_if_fail (parent != NULL, parent);
oclass = GST_OBJECT_CLASS (GTK_OBJECT (object)->klass);
if (oclass->save_thyself)
oclass->save_thyself (object, parent);
return parent;
}
void
gst_object_load_thyself (xmlNodePtr self, GstObject *parent)
{
g_print ("gstobject: load thyself\n");
}
/**
* gst_object_get_path_string:
@ -258,79 +336,64 @@ void gst_object_sink(GstObject *object) {
*
* Generates a string describing the path of the object in
* the object hierarchy. Usefull for debugging
*
*
* Returns: a string describing the path of the object
*/
gchar*
gst_object_get_path_string(GstObject *object)
gst_object_get_path_string (GstObject *object)
{
GSList *parentage = NULL;
GSList *parents;
void *parent;
gchar *prevpath, *path = "";
gchar *prevpath, *path = "";
const char *component;
gchar *separator = "";
gboolean free_component;
parentage = g_slist_prepend (NULL, object);
// first walk the object hierarchy to build a list of the parents
do {
if (GST_IS_OBJECT(object)) {
if (GST_IS_PAD(object)) {
parent = GST_PAD(object)->parent;
// } else if (GST_IS_ELEMENT(object)) {
// parent = gst_element_get_parent(GST_ELEMENT(object));
} else {
parent = gst_object_get_parent (object);
}
if (GST_IS_OBJECT (object)) {
parent = gst_object_get_parent (object);
} else {
parentage = g_slist_prepend (parentage, NULL);
parent = NULL;
}
if (parent != NULL) {
if (parent != NULL) {
parentage = g_slist_prepend (parentage, parent);
}
object = parent;
} while (object != NULL);
// then walk the parent list and print them out
parents = parentage;
while (parents) {
if (GST_IS_OBJECT(parents->data)) {
if (GST_IS_PAD(parents->data)) {
component = gst_pad_get_name(GST_PAD(parents->data));
separator = ".";
free_component = FALSE;
} else if (GST_IS_ELEMENT(parents->data)) {
component = gst_element_get_name(GST_ELEMENT(parents->data));
separator = "/";
free_component = FALSE;
} else {
// component = g_strdup_printf("a %s",gtk_type_name(gtk_identifier_get_type(parents->data)));
component = g_strdup_printf("unknown%p",parents->data);
separator = "/";
free_component = TRUE;
}
if (GST_IS_OBJECT (parents->data)) {
GstObjectClass *oclass = GST_OBJECT_CLASS (GTK_OBJECT (parents->data));
component = GST_OBJECT_NAME (parents->data);
separator = oclass->path_string_separator;
free_component = FALSE;
} else {
component = g_strdup_printf("%p",parents->data);
component = g_strdup_printf("%p",parents->data);
separator = "/";
free_component = TRUE;
}
prevpath = path;
path = g_strjoin(separator,prevpath,component,NULL);
path = g_strjoin (separator, prevpath, component, NULL);
g_free(prevpath);
if (free_component)
g_free((gchar *)component);
parents = g_slist_next(parents);
}
g_slist_free(parentage);
g_slist_free (parentage);
return path;
}

View file

@ -26,6 +26,7 @@
#include <gtk/gtk.h>
#include <gst/gsttrace.h>
#include <parser.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
@ -62,6 +63,7 @@ typedef struct _GstObjectClass GstObjectClass;
struct _GstObject {
GtkObject object;
gchar *name;
/* have to have a refcount for the object */
#ifdef HAVE_ATOMIC_H
atomic_t refcount;
@ -79,39 +81,54 @@ struct _GstObject {
struct _GstObjectClass {
GtkObjectClass parent_class;
gchar *path_string_separator;
/* signals */
void (*parent_set) (GstObject *object,GstObject *parent);
void (*parent_set) (GstObject *object, GstObject *parent);
/* functions go here */
xmlNodePtr (*save_thyself) (GstObject *object, xmlNodePtr parent);
void (*restore_thyself) (GstObject *object, xmlNodePtr self);
};
#define GST_OBJECT_NAME(obj) (const gchar*)(((GstObject *)(obj))->name)
#define GST_OBJECT_PARENT(obj) (((GstObject *)(obj))->parent)
#define GST_FLAGS(obj) GTK_OBJECT_FLAGS(obj)
#define GST_FLAG_IS_SET(obj,flag) (GST_FLAGS (obj) & (1<<(flag)))
#define GST_FLAG_SET(obj,flag) G_STMT_START{ (GST_FLAGS (obj) |= (1<<(flag))); }G_STMT_END
#define GST_FLAG_UNSET(obj,flag) G_STMT_START{ (GST_FLAGS (obj) &= ~(1<<(flag))); }G_STMT_END
/* object locking */
#define GST_LOCK(obj) (g_mutex_lock(GST_OBJECT(obj)->lock))
#define GST_TRYLOCK(obj) (g_mutex_trylock(GST_OBJECT(obj)->lock))
#define GST_UNLOCK(obj) (g_mutex_unlock(GST_OBJECT(obj)->lock))
#define GST_GET_LOCK(obj) (GST_OBJECT(obj)->lock)
/* normal GtkObject stuff */
GtkType gst_object_get_type (void);
GstObject* gst_object_new (void);
GtkType gst_object_get_type (void);
GstObject* gst_object_new (void);
/* name routines */
void gst_object_set_name (GstObject *object, const gchar *name);
const gchar* gst_object_get_name (GstObject *object);
/* parentage routines */
void gst_object_set_parent (GstObject *object,GstObject *parent);
void gst_object_set_parent (GstObject *object,GstObject *parent);
GstObject* gst_object_get_parent (GstObject *object);
void gst_object_unparent (GstObject *object);
void gst_object_unparent (GstObject *object);
xmlNodePtr gst_object_save_thyself (GstObject *object, xmlNodePtr parent);
/* refcounting */
#define gst_object_ref(object) gtk_object_ref(GTK_OBJECT(object));
#define gst_object_unref(object) gtk_object_unref(GTK_OBJECT(object));
#define gst_object_sink(object) gtk_object_sink(GTK_OBJECT(object));
#define gst_object_ref(object) gtk_object_ref(GTK_OBJECT(object));
#define gst_object_unref(object) gtk_object_unref(GTK_OBJECT(object));
#define gst_object_sink(object) gtk_object_sink(GTK_OBJECT(object));
/* destroying an object */
#define gst_object_destroy(object) gtk_object_destroy(GTK_OBJECT(object))
#define gst_object_destroy(object) gtk_object_destroy(GTK_OBJECT(object))
/* printing out the 'path' of the object */
gchar * gst_object_get_path_string (GstObject *object);
@ -122,5 +139,5 @@ gchar * gst_object_get_path_string (GstObject *object);
#endif /* __cplusplus */
#endif /* __GST_OBJECT_H__ */
#endif /* __GST_OBJECT_H__ */

View file

@ -26,11 +26,15 @@
#include "gstpad.h"
#include "gstelement.h"
#include "gsttype.h"
#include "gstbin.h"
/***** Start with the base GstPad class *****/
static void gst_pad_class_init (GstPadClass *klass);
static void gst_pad_init (GstPad *pad);
static void gst_pad_class_init (GstPadClass *klass);
static void gst_pad_init (GstPad *pad);
static xmlNodePtr gst_pad_save_thyself (GstObject *object, xmlNodePtr parent);
static GstObject *pad_parent_class = NULL;
@ -63,9 +67,7 @@ gst_pad_class_init (GstPadClass *klass)
static void
gst_pad_init (GstPad *pad)
{
pad->name = NULL;
pad->element_private = NULL;
pad->parent = NULL;
pad->padtemplate = NULL;
}
@ -87,16 +89,16 @@ enum {
/* FILL ME */
};
static void gst_real_pad_class_init (GstRealPadClass *klass);
static void gst_real_pad_init (GstRealPad *pad);
static void gst_real_pad_class_init (GstRealPadClass *klass);
static void gst_real_pad_init (GstRealPad *pad);
static void gst_real_pad_set_arg (GtkObject *object,GtkArg *arg,guint id);
static void gst_real_pad_get_arg (GtkObject *object,GtkArg *arg,guint id);
static void gst_real_pad_set_arg (GtkObject *object,GtkArg *arg,guint id);
static void gst_real_pad_get_arg (GtkObject *object,GtkArg *arg,guint id);
static void gst_real_pad_destroy (GtkObject *object);
static void gst_real_pad_destroy (GtkObject *object);
static void gst_pad_push_func (GstPad *pad, GstBuffer *buf);
static gboolean gst_pad_eos_func (GstPad *pad);
static void gst_pad_push_func (GstPad *pad, GstBuffer *buf);
static gboolean gst_pad_eos_func (GstPad *pad);
static GstPad *real_pad_parent_class = NULL;
@ -126,8 +128,10 @@ static void
gst_real_pad_class_init (GstRealPadClass *klass)
{
GtkObjectClass *gtkobject_class;
GstObjectClass *gstobject_class;
gtkobject_class = (GtkObjectClass*)klass;
gstobject_class = (GstObjectClass*)klass;
real_pad_parent_class = gtk_type_class(GST_TYPE_PAD);
@ -149,6 +153,9 @@ gst_real_pad_class_init (GstRealPadClass *klass)
gtkobject_class->destroy = gst_real_pad_destroy;
gtkobject_class->set_arg = gst_real_pad_set_arg;
gtkobject_class->get_arg = gst_real_pad_get_arg;
gstobject_class->save_thyself = gst_pad_save_thyself;
gstobject_class->path_string_separator = ".";
}
static void
@ -228,7 +235,7 @@ gst_pad_new (gchar *name,
g_return_val_if_fail (direction != GST_PAD_UNKNOWN, NULL);
pad = gtk_type_new (gst_real_pad_get_type ());
GST_PAD_NAME(pad) = g_strdup (name);
gst_object_set_name (GST_OBJECT (pad), name);
GST_RPAD_DIRECTION(pad) = direction;
return GST_PAD(pad);
@ -290,10 +297,7 @@ gst_pad_set_name (GstPad *pad,
g_return_if_fail (pad != NULL);
g_return_if_fail (GST_IS_PAD (pad));
if (pad->name != NULL)
g_free (pad->name);
pad->name = g_strdup (name);
gst_object_set_name (GST_OBJECT (pad), name);
}
/**
@ -310,7 +314,7 @@ gst_pad_get_name (GstPad *pad)
g_return_val_if_fail (pad != NULL, NULL);
g_return_val_if_fail (GST_IS_PAD (pad), NULL);
return GST_PAD_NAME(pad);
return GST_OBJECT_NAME (pad);
}
/**
@ -436,7 +440,7 @@ gst_pad_handle_qos(GstPad *pad,
GList *pads;
GstPad *target_pad;
GST_DEBUG (0,"gst_pad_handle_qos(\"%s\",%08ld)\n", GST_ELEMENT(pad->parent)->name,qos_message);
GST_DEBUG (0,"gst_pad_handle_qos(\"%s\",%08ld)\n", GST_OBJECT_NAME (GST_PAD_PARENT (pad)),qos_message);
if (GST_RPAD_QOSFUNC(pad)) {
(GST_RPAD_QOSFUNC(pad)) (pad,qos_message);
@ -444,7 +448,7 @@ gst_pad_handle_qos(GstPad *pad,
element = GST_ELEMENT (GST_PAD_PARENT(GST_RPAD_PEER(pad)));
pads = element->pads;
GST_DEBUG (0,"gst_pad_handle_qos recurse(\"%s\",%08ld)\n", element->name, qos_message);
GST_DEBUG (0,"gst_pad_handle_qos recurse(\"%s\",%08ld)\n", GST_ELEMENT_NAME (element), qos_message);
while (pads) {
target_pad = GST_PAD (pads->data);
if (GST_RPAD_DIRECTION(target_pad) == GST_PAD_SINK) {
@ -560,18 +564,33 @@ gst_pad_connect (GstPad *srcpad,
*/
void
gst_pad_set_parent (GstPad *pad,
GstObject *parent)
GstObject *parent)
{
g_return_if_fail (pad != NULL);
g_return_if_fail (GST_IS_PAD (pad));
g_return_if_fail (pad->parent == NULL);
g_return_if_fail (GST_PAD_PARENT (pad) == NULL);
g_return_if_fail (parent != NULL);
g_return_if_fail (GTK_IS_OBJECT (parent));
g_return_if_fail ((gpointer)pad != (gpointer)parent);
//g_print("set parent %s\n", gst_element_get_name(parent));
gst_object_set_parent (GST_OBJECT (pad), parent);
}
GST_PAD_PARENT(pad) = parent;
/**
* gst_pad_get_parent:
* @pad: the pad to get the parent from
*
* Get the parent object of this pad.
*
* Returns: the parent object
*/
GstObject*
gst_pad_get_parent (GstPad *pad)
{
g_return_val_if_fail (pad != NULL, NULL);
g_return_val_if_fail (GST_IS_PAD (pad), NULL);
return GST_OBJECT_PARENT (pad);
}
/**
@ -621,23 +640,6 @@ gst_pad_remove_ghost_pad (GstPad *pad,
realpad->ghostpads = g_list_remove (realpad->ghostpads, ghostpad);
}
/**
* gst_pad_get_parent:
* @pad: the pad to get the parent from
*
* Get the parent object of this pad.
*
* Returns: the parent object
*/
GstObject*
gst_pad_get_parent (GstPad *pad)
{
g_return_val_if_fail (pad != NULL, NULL);
g_return_val_if_fail (GST_IS_PAD (pad), NULL);
return GST_PAD_PARENT(pad);
}
/**
* gst_pad_get_ghost_pad_list:
* @pad: the pad to get the ghost parents from
@ -783,62 +785,65 @@ gst_real_pad_destroy (GtkObject *object)
// g_print("in gst_pad_real_destroy()\n");
if (pad->name)
g_free (pad->name);
g_list_free (GST_REAL_PAD(pad)->ghostpads);
}
/**
* gst_pad_load_and_connect:
* @parent: the parent XML node to read the description from
* @element: the element that has the source pad
* @elements: a hashtable with elements
* @self: the XML node to read the description from
* @parent: the element that has the pad
*
* Read the pad definition from the XML node and connect the given pad
* in element to a pad of an element in the hashtable.
* in element to a pad of an element up in the hierarchy.
*/
void
gst_pad_load_and_connect (xmlNodePtr parent,
GstObject *element,
GHashTable *elements)
gst_pad_load_and_connect (xmlNodePtr self,
GstObject *parent)
{
xmlNodePtr field = parent->childs;
xmlNodePtr field = self->childs;
GstPad *pad = NULL, *targetpad;
guchar *peer = NULL;
gchar **split;
GstElement *target;
GstObject *grandparent;
while (field) {
if (!strcmp(field->name, "name")) {
pad = gst_element_get_pad(GST_ELEMENT(element), xmlNodeGetContent(field));
if (!strcmp (field->name, "name")) {
pad = gst_element_get_pad (GST_ELEMENT (parent), xmlNodeGetContent (field));
}
else if (!strcmp(field->name, "peer")) {
peer = g_strdup(xmlNodeGetContent(field));
peer = g_strdup (xmlNodeGetContent (field));
}
field = field->next;
}
g_return_if_fail(pad != NULL);
g_return_if_fail (pad != NULL);
if (peer == NULL) return;
split = g_strsplit(peer, ".", 2);
split = g_strsplit (peer, ".", 2);
g_return_if_fail(split[0] != NULL);
g_return_if_fail(split[1] != NULL);
g_return_if_fail (split[0] != NULL);
g_return_if_fail (split[1] != NULL);
target = (GstElement *)g_hash_table_lookup(elements, split[0]);
grandparent = gst_object_get_parent (parent);
if (grandparent && GST_IS_BIN (grandparent)) {
target = gst_bin_get_by_name_recurse_up (GST_BIN (grandparent), split[0]);
}
else
goto cleanup;
if (target == NULL) goto cleanup;
targetpad = gst_element_get_pad(target, split[1]);
targetpad = gst_element_get_pad (target, split[1]);
if (targetpad == NULL) goto cleanup;
gst_pad_connect(pad, targetpad);
gst_pad_connect (pad, targetpad);
cleanup:
g_strfreev(split);
g_strfreev (split);
}
@ -851,25 +856,24 @@ cleanup:
*
* Returns: the xml representation of the pad
*/
xmlNodePtr
gst_pad_save_thyself (GstPad *pad,
static xmlNodePtr
gst_pad_save_thyself (GstObject *object,
xmlNodePtr parent)
{
GstRealPad *realpad;
GstPad *peer;
g_return_val_if_fail (GST_IS_REAL_PAD (pad), NULL);
g_return_val_if_fail (GST_IS_REAL_PAD (object), NULL);
realpad = GST_REAL_PAD(pad);
realpad = GST_REAL_PAD(object);
xmlNewChild(parent,NULL,"name",pad->name);
xmlNewChild(parent,NULL,"name", GST_PAD_NAME (realpad));
if (GST_RPAD_PEER(realpad) != NULL) {
peer = GST_PAD(GST_RPAD_PEER(realpad));
// first check to see if the peer's parent's parent is the same
//if (pad->parent->parent == peer->parent->parent)
// we just save it off
xmlNewChild(parent,NULL,"peer",g_strdup_printf("%s.%s",
GST_ELEMENT(peer->parent)->name,peer->name));
// we just save it off
xmlNewChild(parent,NULL,"peer",g_strdup_printf("%s.%s",
GST_OBJECT_NAME (GST_PAD_PARENT (peer)), GST_PAD_NAME (peer)));
} else
xmlNewChild(parent,NULL,"peer","");
@ -896,8 +900,8 @@ gst_pad_ghost_save_thyself (GstPad *pad,
g_return_val_if_fail (GST_IS_GHOST_PAD (pad), NULL);
self = xmlNewChild(parent,NULL,"ghostpad",NULL);
xmlNewChild(self,NULL,"name",pad->name);
xmlNewChild(self,NULL,"parent",GST_ELEMENT(pad->parent)->name);
xmlNewChild(self,NULL,"name", GST_PAD_NAME (pad));
xmlNewChild(self,NULL,"parent", GST_OBJECT_NAME (GST_PAD_PARENT (pad)));
// FIXME FIXME FIXME!
@ -1137,7 +1141,7 @@ gst_pad_eos_func(GstPad *pad)
GST_INFO (GST_CAT_PADS,"attempting to set EOS on sink pad %s:%s",GST_DEBUG_PAD_NAME(pad));
element = GST_ELEMENT(gst_pad_get_parent (pad));
element = GST_ELEMENT (gst_object_get_parent (GST_OBJECT (pad)));
// g_return_val_if_fail (element != NULL, FALSE);
// g_return_val_if_fail (GST_IS_ELEMENT(element), FALSE);
@ -1184,7 +1188,7 @@ gst_pad_set_eos(GstPad *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_element_signal_eos (GST_ELEMENT (pad->parent));
gst_element_signal_eos (GST_ELEMENT (GST_PAD_PARENT (pad)));
return TRUE;
}
@ -1307,7 +1311,7 @@ gst_ghost_pad_new (gchar *name,
g_return_val_if_fail (GST_IS_PAD(pad), NULL);
ghostpad = gtk_type_new (gst_ghost_pad_get_type ());
GST_PAD_NAME(ghostpad) = g_strdup (name);
gst_pad_set_name (GST_PAD (ghostpad), name);
GST_GPAD_REALPAD(ghostpad) = GST_PAD_REALIZE(pad);
// add ourselves to the real pad's list of ghostpads

View file

@ -96,9 +96,7 @@ typedef enum {
struct _GstPad {
GstObject object;
gchar *name;
gpointer element_private;
GstObject *parent;
GstPadTemplate *padtemplate; /* the template for this pad */
};
@ -154,9 +152,9 @@ struct _GstGhostPadClass {
/***** helper macros *****/
/* GstPad */
#define GST_PAD_NAME(pad) (((GstPad *)(pad))->name)
#define GST_PAD_NAME(pad) (GST_OBJECT_NAME(pad))
#define GST_PAD_PARENT(pad) (GST_OBJECT_PARENT(pad))
#define GST_PAD_ELEMENT_PRIVATE(pad) (((GstPad *)(pad))->element_private)
#define GST_PAD_PARENT(pad) (((GstPad *)(pad))->parent)
#define GST_PAD_PADTEMPLATE(pad) (((GstPad *)(pad))->padtemplate)
/* GstRealPad */
@ -236,41 +234,42 @@ GtkType gst_real_pad_get_type (void);
GtkType gst_ghost_pad_get_type (void);
GstPad* gst_pad_new (gchar *name, GstPadDirection direction);
#define gst_pad_destroy(pad) gst_object_destroy (GST_OBJECT (pad))
#define gst_pad_destroy(pad) gst_object_destroy (GST_OBJECT (pad))
GstPad* gst_pad_new_from_template (GstPadTemplate *templ, gchar *name);
GstPadDirection gst_pad_get_direction (GstPad *pad);
GstPadDirection gst_pad_get_direction (GstPad *pad);
void gst_pad_set_chain_function (GstPad *pad, GstPadChainFunction chain);
void gst_pad_set_get_function (GstPad *pad, GstPadGetFunction get);
void gst_pad_set_chain_function (GstPad *pad, GstPadChainFunction chain);
void gst_pad_set_get_function (GstPad *pad, GstPadGetFunction get);
void gst_pad_set_getregion_function (GstPad *pad, GstPadGetRegionFunction getregion);
void gst_pad_set_qos_function (GstPad *pad, GstPadQoSFunction qos);
void gst_pad_set_qos_function (GstPad *pad, GstPadQoSFunction qos);
void gst_pad_set_eos_function (GstPad *pad, GstPadEOSFunction eos);
void gst_pad_set_caps_list (GstPad *pad, GList *caps);
GList* gst_pad_get_caps_list (GstPad *pad);
GstCaps* gst_pad_get_caps_by_name (GstPad *pad, gchar *name);
gboolean gst_pad_check_compatibility (GstPad *srcpad, GstPad *sinkpad);
void gst_pad_set_name (GstPad *pad, const gchar *name);
const gchar* gst_pad_get_name (GstPad *pad);
void gst_pad_set_caps_list (GstPad *pad, GList *caps);
GList* gst_pad_get_caps_list (GstPad *pad);
GstCaps* gst_pad_get_caps_by_name (GstPad *pad, gchar *name);
gboolean gst_pad_check_compatibility (GstPad *srcpad, GstPad *sinkpad);
void gst_pad_set_element_private (GstPad *pad, gpointer priv);
gpointer gst_pad_get_element_private (GstPad *pad);
void gst_pad_set_parent (GstPad *pad, GstObject *parent);
void gst_pad_set_name (GstPad *pad, const gchar *name);
const gchar* gst_pad_get_name (GstPad *pad);
void gst_pad_set_parent (GstPad *pad, GstObject *parent);
GstObject* gst_pad_get_parent (GstPad *pad);
void gst_pad_add_ghost_pad (GstPad *pad, GstPad *ghostpad);
void gst_pad_remove_ghost_pad (GstPad *pad, GstPad *ghostpad);
void gst_pad_add_ghost_pad (GstPad *pad, GstPad *ghostpad);
void gst_pad_remove_ghost_pad (GstPad *pad, GstPad *ghostpad);
GList* gst_pad_get_ghost_pad_list (GstPad *pad);
GstPad* gst_pad_get_peer (GstPad *pad);
void gst_pad_connect (GstPad *srcpad, GstPad *sinkpad);
void gst_pad_disconnect (GstPad *srcpad, GstPad *sinkpad);
void gst_pad_connect (GstPad *srcpad, GstPad *sinkpad);
void gst_pad_disconnect (GstPad *srcpad, GstPad *sinkpad);
#if 1
void gst_pad_push (GstPad *pad, GstBuffer *buffer);
void gst_pad_push (GstPad *pad, GstBuffer *buffer);
#else
#define gst_pad_push(pad,buf) G_STMT_START{ \
if ((pad)->peer->pushfunc) ((pad)->peer->pushfunc)((pad)->peer,(buf)); \
@ -291,10 +290,9 @@ GstPad * gst_pad_select (GstPad *nextpad, ...);
#define gst_pad_eos(pad) (GST_RPAD_EOSFUNC(GST_RPAD_PEER(pad))(GST_PAD(GST_RPAD_PEER(pad))))
gboolean gst_pad_set_eos (GstPad *pad);
void gst_pad_handle_qos (GstPad *pad, glong qos_message);
void gst_pad_handle_qos (GstPad *pad, glong qos_message);
xmlNodePtr gst_pad_save_thyself (GstPad *pad, xmlNodePtr parent);
void gst_pad_load_and_connect (xmlNodePtr parent, GstObject *element, GHashTable *elements);
void gst_pad_load_and_connect (xmlNodePtr self, GstObject *parent);
/* ghostpads */
@ -303,14 +301,14 @@ GstPad * gst_ghost_pad_new (gchar *name,GstPad *pad);
/* templates and factories */
GtkType gst_padtemplate_get_type (void);
GtkType gst_padtemplate_get_type (void);
GstPadTemplate* gst_padtemplate_new (GstPadFactory *factory);
GstPadTemplate* gst_padtemplate_create (gchar *name_template,
GstPadTemplate* gst_padtemplate_create (gchar *name_template,
GstPadDirection direction, GstPadPresence presence,
GList *caps);
xmlNodePtr gst_padtemplate_save_thyself (GstPadTemplate *templ, xmlNodePtr parent);
xmlNodePtr gst_padtemplate_save_thyself (GstPadTemplate *templ, xmlNodePtr parent);
GstPadTemplate* gst_padtemplate_load_thyself (xmlNodePtr parent);
#ifdef __cplusplus
@ -318,5 +316,5 @@ GstPadTemplate* gst_padtemplate_load_thyself (xmlNodePtr parent);
#endif /* __cplusplus */
#endif /* __GST_PAD_H__ */
#endif /* __GST_PAD_H__ */

View file

@ -28,6 +28,8 @@
#include "gst_private.h"
#include "gstparse.h"
#include "gstpipeline.h"
#include "gstthread.h"
typedef struct _gst_parse_priv gst_parse_priv;
struct _gst_parse_priv {
@ -51,10 +53,10 @@ gst_parse_newpad(GstElement *element,GstPad *pad,launch_delayed_pad *peer)
{
gst_info("have NEW_PAD signal\n");
// if it matches, connect it
if (!strcmp(gst_pad_get_name(pad),peer->name)) {
if (!strcmp(GST_PAD_NAME(pad),peer->name)) {
gst_pad_connect(pad,peer->peer);
gst_info("delayed connect of '%s' to '%s'\n",
gst_pad_get_name(pad),gst_pad_get_name(peer->peer));
GST_PAD_NAME(pad),GST_PAD_NAME(peer->peer));
}
}
*/
@ -93,7 +95,7 @@ gst_parse_launch_cmdline(int argc,char *argv[],GstBin *parent,gst_parse_priv *pr
if (GST_IS_PIPELINE(parent)) { closingchar = '\0';DEBUG("in pipeline "); }
else if (GST_IS_THREAD(parent)) { closingchar = '}';DEBUG("in thread "); }
else { closingchar = ')';DEBUG("in bin "); }
DEBUG_NOPREFIX("%s\n",gst_element_get_name (GST_ELEMENT (parent)));
DEBUG_NOPREFIX("%s\n",GST_ELEMENT_NAME (GST_ELEMENT (parent)));
while (i < argc) {
arg = argv[i];
@ -112,7 +114,7 @@ gst_parse_launch_cmdline(int argc,char *argv[],GstBin *parent,gst_parse_priv *pr
// end of the container
} else if (arg[0] == closingchar) {
// time to finish off this bin
DEBUG("exiting container %s\n",gst_element_get_name (GST_ELEMENT (parent)));
DEBUG("exiting container %s\n",GST_ELEMENT_NAME (GST_ELEMENT (parent)));
retval = i+1;
break;
@ -146,12 +148,12 @@ gst_parse_launch_cmdline(int argc,char *argv[],GstBin *parent,gst_parse_priv *pr
if (srcpadname != NULL) {
srcpad = gst_element_get_pad(previous,srcpadname);
if (!srcpad)
GST_DEBUG(0,"NO SUCH pad %s in element %s\n",srcpadname,gst_element_get_name(previous));
GST_DEBUG(0,"NO SUCH pad %s in element %s\n",srcpadname,GST_ELEMENT_NAME(previous));
}
if (srcpad == NULL) {
// check through the list to find the first sink pad
GST_DEBUG(0,"CHECKING through element %s for pad named %s\n",gst_element_get_name(previous),srcpadname);
GST_DEBUG(0,"CHECKING through element %s for pad named %s\n",GST_ELEMENT_NAME(previous),srcpadname);
pads = gst_element_get_pad_list(previous);
while (pads) {
srcpad = GST_PAD(pads->data);
@ -177,7 +179,7 @@ if (GST_IS_GHOST_PAD(srcpad)) GST_DEBUG(0,"it's a ghost pad\n");
pos[0] = '\0';
argval = pos+1;
DEBUG("attempting to set argument '%s' to '%s' on element '%s'\n",
argname,argval,gst_element_get_name(previous));
argname,argval,GST_ELEMENT_NAME(previous));
gtk_object_set(GTK_OBJECT(previous),argname,argval,NULL);
g_free(argname);
@ -193,7 +195,7 @@ if (GST_IS_GHOST_PAD(srcpad)) GST_DEBUG(0,"it's a ghost pad\n");
fprintf(stderr,"Couldn't create a bin!\n");
// exit(-1);
}
GST_DEBUG(0,"CREATED bin %s\n",gst_element_get_name(element));
GST_DEBUG(0,"CREATED bin %s\n",GST_ELEMENT_NAME(element));
} else if (arg[0] == '{') {
// create a thread and add it to the current parent
element = gst_thread_new(g_strdup_printf("thread%d",priv->threadcount++));
@ -201,7 +203,7 @@ if (GST_IS_GHOST_PAD(srcpad)) GST_DEBUG(0,"it's a ghost pad\n");
fprintf(stderr,"Couldn't create a thread!\n");
// exit(-1);
}
GST_DEBUG(0,"CREATED thread %s\n",gst_element_get_name(element));
GST_DEBUG(0,"CREATED thread %s\n",GST_ELEMENT_NAME(element));
}
i += gst_parse_launch_cmdline(argc - i, argv + i + 1, GST_BIN (element), priv);
@ -216,7 +218,7 @@ if (GST_IS_GHOST_PAD(srcpad)) GST_DEBUG(0,"it's a ghost pad\n");
fprintf(stderr,"Couldn't create a '%s', no such element or need to run gstraemer-register?\n",arg);
// exit(-1);
}
GST_DEBUG(0,"CREATED element %s\n",gst_element_get_name(element));
GST_DEBUG(0,"CREATED element %s\n",GST_ELEMENT_NAME(element));
}
gst_bin_add (GST_BIN (parent), element);
@ -254,7 +256,7 @@ if (GST_IS_GHOST_PAD(srcpad)) GST_DEBUG(0,"it's a ghost pad\n");
// if we're the first element, ghost all the sinkpads
if (elementcount == 1) {
DEBUG("first element, ghosting all of %s's sink pads to parent %s\n",
gst_element_get_name(element),gst_element_get_name(GST_ELEMENT(parent)));
GST_ELEMENT_NAME(element),GST_ELEMENT_NAME(GST_ELEMENT(parent)));
pads = gst_element_get_pad_list (element);
while (pads) {
sinkpad = GST_PAD (pads->data);
@ -262,9 +264,9 @@ if (GST_IS_GHOST_PAD(srcpad)) GST_DEBUG(0,"it's a ghost pad\n");
if (!sinkpad) DEBUG("much oddness, pad doesn't seem to exist\n");
else if (gst_pad_get_direction (sinkpad) == GST_PAD_SINK) {
gst_element_add_ghost_pad (GST_ELEMENT (parent), sinkpad,
g_strdup_printf("%s-ghost",gst_pad_get_name(sinkpad)));
g_strdup_printf("%s-ghost",GST_PAD_NAME(sinkpad)));
GST_DEBUG(0,"GHOSTED %s:%s to %s as %s-ghost\n",
GST_DEBUG_PAD_NAME(sinkpad),gst_element_get_name(GST_ELEMENT(parent)),gst_pad_get_name(sinkpad));
GST_DEBUG_PAD_NAME(sinkpad),GST_ELEMENT_NAME(GST_ELEMENT(parent)),GST_PAD_NAME(sinkpad));
}
}
}
@ -279,7 +281,7 @@ g_strdup_printf("%s-ghost",gst_pad_get_name(sinkpad)));
// ghost all the src pads of the bin
if (prevelement != NULL) {
DEBUG("last element, ghosting all of %s's src pads to parent %s\n",
gst_element_get_name(prevelement),gst_element_get_name(GST_ELEMENT(parent)));
GST_ELEMENT_NAME(prevelement),GST_ELEMENT_NAME(GST_ELEMENT(parent)));
pads = gst_element_get_pad_list (prevelement);
while (pads) {
srcpad = GST_PAD (pads->data);
@ -287,9 +289,9 @@ g_strdup_printf("%s-ghost",gst_pad_get_name(sinkpad)));
if (!srcpad) DEBUG("much oddness, pad doesn't seem to exist\n");
else if (gst_pad_get_direction (srcpad) == GST_PAD_SRC) {
gst_element_add_ghost_pad (GST_ELEMENT (parent), srcpad,
g_strdup_printf("%s-ghost",gst_pad_get_name(srcpad)));
g_strdup_printf("%s-ghost",GST_PAD_NAME(srcpad)));
GST_DEBUG(0,"GHOSTED %s:%s to %s as %s-ghost\n",
GST_DEBUG_PAD_NAME(srcpad),gst_element_get_name(GST_ELEMENT(parent)),gst_pad_get_name(srcpad));
GST_DEBUG_PAD_NAME(srcpad),GST_ELEMENT_NAME (parent),GST_PAD_NAME(srcpad));
}
}
}

View file

@ -23,8 +23,8 @@
#ifndef __GST_PARSE_H__
#define __GST_PARSE_H__
#include "gst.h"
#include <gst/gstbin.h>
gint gst_parse_launch(const gchar *cmdline,GstBin *parent);
gint gst_parse_launch (const gchar *cmdline, GstBin *parent);
#endif __GST_PARSE_H__
#endif /* __GST_PARSE_H__ */

View file

@ -125,7 +125,7 @@ static void
gst_pipeline_prepare (GstPipeline *pipeline)
{
GST_DEBUG (0,"GstPipeline: preparing pipeline \"%s\" for playing\n",
gst_element_get_name(GST_ELEMENT(pipeline)));
GST_ELEMENT_NAME(GST_ELEMENT(pipeline)));
}
static void
@ -144,7 +144,7 @@ gst_pipeline_typefind (GstPipeline *pipeline, GstElement *element)
GstCaps *caps = NULL;
GST_DEBUG (0,"GstPipeline: typefind for element \"%s\" %p\n",
gst_element_get_name(element), &found);
GST_ELEMENT_NAME(element), &found);
typefind = gst_elementfactory_make ("typefind", "typefind");
g_return_val_if_fail (typefind != NULL, FALSE);
@ -189,27 +189,27 @@ gst_pipeline_pads_autoplug_func (GstElement *src, GstPad *pad, GstElement *sink)
gboolean connected = FALSE;
GST_DEBUG (0,"gstpipeline: autoplug pad connect function for \"%s\" to \"%s\"\n",
gst_element_get_name(src), gst_element_get_name(sink));
GST_ELEMENT_NAME(src), GST_ELEMENT_NAME(sink));
sinkpads = gst_element_get_pad_list(sink);
while (sinkpads) {
GstPad *sinkpad = (GstPad *)sinkpads->data;
// if we have a match, connect the pads
if (gst_pad_get_direction(sinkpad) == GST_PAD_SINK &&
!GST_PAD_CONNECTED(sinkpad))
if (gst_pad_get_direction(sinkpad) == GST_PAD_SINK &&
!GST_PAD_CONNECTED(sinkpad))
{
if (gst_caps_list_check_compatibility (gst_pad_get_caps_list(pad), gst_pad_get_caps_list(sinkpad))) {
gst_pad_connect(pad, sinkpad);
GST_DEBUG (0,"gstpipeline: autoconnect pad \"%s\" in element %s <-> ", pad->name,
gst_element_get_name(src));
GST_DEBUG (0,"pad \"%s\" in element %s\n", sinkpad->name,
gst_element_get_name(sink));
GST_DEBUG (0,"gstpipeline: autoconnect pad \"%s\" in element %s <-> ", GST_PAD_NAME (pad),
GST_ELEMENT_NAME(src));
GST_DEBUG (0,"pad \"%s\" in element %s\n", GST_PAD_NAME (sinkpad),
GST_ELEMENT_NAME(sink));
connected = TRUE;
break;
}
else {
GST_DEBUG (0,"pads incompatible %s, %s\n", gst_pad_get_name (pad), gst_pad_get_name (sinkpad));
GST_DEBUG (0,"pads incompatible %s, %s\n", GST_PAD_NAME (pad), GST_PAD_NAME (sinkpad));
}
}
sinkpads = g_list_next(sinkpads);
@ -240,7 +240,7 @@ gst_pipeline_pads_autoplug (GstElement *src, GstElement *sink)
if (!connected) {
GST_DEBUG (0,"gstpipeline: delaying pad connections for \"%s\" to \"%s\"\n",
gst_element_get_name(src), gst_element_get_name(sink));
GST_ELEMENT_NAME(src), GST_ELEMENT_NAME(sink));
gtk_signal_connect(GTK_OBJECT(src),"new_pad",
GTK_SIGNAL_FUNC(gst_pipeline_pads_autoplug_func), sink);
}
@ -266,7 +266,7 @@ gst_pipeline_add_src (GstPipeline *pipeline, GstElement *src)
if (pipeline->src) {
printf("gstpipeline: *WARNING* removing previously added element \"%s\"\n",
gst_element_get_name(pipeline->src));
GST_ELEMENT_NAME(pipeline->src));
gst_bin_remove(GST_BIN(pipeline), pipeline->src);
}
pipeline->src = src;
@ -319,27 +319,27 @@ gst_pipeline_autoplug (GstPipeline *pipeline)
g_return_val_if_fail(GST_IS_PIPELINE(pipeline), FALSE);
GST_DEBUG (0,"GstPipeline: autopluging pipeline \"%s\"\n",
gst_element_get_name(GST_ELEMENT(pipeline)));
GST_ELEMENT_NAME(GST_ELEMENT(pipeline)));
// fase 1, run typedetect on the source if needed...
if (!pipeline->src) {
GST_DEBUG (0,"GstPipeline: no source detected, can't autoplug pipeline \"%s\"\n",
gst_element_get_name(GST_ELEMENT(pipeline)));
GST_ELEMENT_NAME(GST_ELEMENT(pipeline)));
return FALSE;
}
GST_DEBUG (0,"GstPipeline: source \"%s\" has no MIME type, running typefind...\n",
gst_element_get_name(pipeline->src));
GST_ELEMENT_NAME(pipeline->src));
src_caps = gst_pipeline_typefind(pipeline, pipeline->src);
if (src_caps) {
GST_DEBUG (0,"GstPipeline: source \"%s\" type found %d\n", gst_element_get_name(pipeline->src),
GST_DEBUG (0,"GstPipeline: source \"%s\" type found %d\n", GST_ELEMENT_NAME(pipeline->src),
src_caps->id);
}
else {
GST_DEBUG (0,"GstPipeline: source \"%s\" has no type\n", gst_element_get_name(pipeline->src));
GST_DEBUG (0,"GstPipeline: source \"%s\" has no type\n", GST_ELEMENT_NAME(pipeline->src));
return FALSE;
}
@ -440,15 +440,15 @@ differ:
use_thread = FALSE;
GST_DEBUG (0,"sugest new thread for \"%s\" %08x\n", element->name, GST_FLAGS(element));
GST_DEBUG (0,"sugest new thread for \"%s\" %08x\n", GST_ELEMENT_NAME (element), GST_FLAGS(element));
// create a new queue and add to the previous bin
queue = gst_elementfactory_make("queue", g_strconcat("queue_", gst_element_get_name(element), NULL));
GST_DEBUG (0,"adding element \"%s\"\n", element->name);
queue = gst_elementfactory_make("queue", g_strconcat("queue_", GST_ELEMENT_NAME(element), NULL));
GST_DEBUG (0,"adding element \"%s\"\n", GST_ELEMENT_NAME (element));
gst_bin_add(GST_BIN(thebin), queue);
// this will be the new bin for all following elements
thebin = gst_elementfactory_make("thread", g_strconcat("thread_", gst_element_get_name(element), NULL));
thebin = gst_elementfactory_make("thread", g_strconcat("thread_", GST_ELEMENT_NAME(element), NULL));
srcpad = gst_element_get_pad(queue, "src");
@ -470,15 +470,15 @@ differ:
}
gst_pipeline_pads_autoplug(thesrcelement, queue);
GST_DEBUG (0,"adding element %s\n", gst_element_get_name (element));
GST_DEBUG (0,"adding element %s\n", GST_ELEMENT_NAME (element));
gst_bin_add(GST_BIN(thebin), element);
GST_DEBUG (0,"adding element %s\n", gst_element_get_name (thebin));
GST_DEBUG (0,"adding element %s\n", GST_ELEMENT_NAME (thebin));
gst_bin_add(GST_BIN(pipeline), thebin);
thesrcelement = queue;
}
// no thread needed, easy case
else {
GST_DEBUG (0,"adding element %s\n", gst_element_get_name (element));
GST_DEBUG (0,"adding element %s\n", GST_ELEMENT_NAME (element));
gst_bin_add(GST_BIN(thebin), element);
}
gst_pipeline_pads_autoplug(thesrcelement, element);
@ -493,7 +493,7 @@ next:
return TRUE;
GST_DEBUG (0,"GstPipeline: unable to autoplug pipeline \"%s\"\n",
gst_element_get_name(GST_ELEMENT(pipeline)));
GST_ELEMENT_NAME(GST_ELEMENT(pipeline)));
return FALSE;
}

View file

@ -54,8 +54,8 @@ gboolean _gst_warn_old_registry = TRUE;
static gboolean plugin_times_older_than(time_t regtime);
static time_t get_time(const char * path);
void
_gst_plugin_initialize (void)
void
_gst_plugin_initialize (void)
{
xmlDocPtr doc;
_gst_modules = NULL;
@ -123,7 +123,7 @@ plugin_times_older_than_recurse(gchar *path, time_t regtime)
path, (long)pathtime, (long)regtime);
return FALSE;
}
dir = opendir(path);
if (dir) {
while ((dirent = readdir(dir))) {
@ -161,8 +161,8 @@ plugin_times_older_than(time_t regtime)
return TRUE;
}
static gboolean
gst_plugin_load_recurse (gchar *directory, gchar *name)
static gboolean
gst_plugin_load_recurse (gchar *directory, gchar *name)
{
DIR *dir;
struct dirent *dirent;
@ -189,7 +189,7 @@ gst_plugin_load_recurse (gchar *directory, gchar *name)
if (strstr(directory,".so")) {
gchar *temp;
if (name) {
if ((temp = strstr(directory,name)) &&
if ((temp = strstr(directory,name)) &&
(!strcmp(temp,name))) {
loaded = gst_plugin_load_absolute(directory);
}
@ -207,8 +207,8 @@ gst_plugin_load_recurse (gchar *directory, gchar *name)
*
* Load all plugins in the path.
*/
void
gst_plugin_load_all(void)
void
gst_plugin_load_all(void)
{
GList *path;
@ -231,8 +231,8 @@ gst_plugin_load_all(void)
*
* Returns: whether the library was loaded or not
*/
gboolean
gst_library_load (const gchar *name)
gboolean
gst_library_load (const gchar *name)
{
gboolean res;
GList *libraries = _gst_libraries;
@ -242,7 +242,7 @@ gst_library_load (const gchar *name)
libraries = g_list_next(libraries);
}
// for now this is the same
res = gst_plugin_load(name);
@ -253,8 +253,8 @@ gst_library_load (const gchar *name)
return res;
}
static void
gst_plugin_remove (GstPlugin *plugin)
static void
gst_plugin_remove (GstPlugin *plugin)
{
GList *factories;
@ -263,7 +263,7 @@ gst_plugin_remove (GstPlugin *plugin)
gst_elementfactory_destroy ((GstElementFactory*)(factories->data));
factories = g_list_next(factories);
}
_gst_plugins = g_list_remove(_gst_plugins, plugin);
// don't free the stuct because someone can have a handle to it
@ -278,8 +278,8 @@ gst_plugin_remove (GstPlugin *plugin)
*
* Returns: whether the plugin was loaded or not
*/
gboolean
gst_plugin_load (const gchar *name)
gboolean
gst_plugin_load (const gchar *name)
{
GList *path;
gchar *libspath;
@ -327,8 +327,8 @@ gst_plugin_load (const gchar *name)
*
* Returns: whether or not the plugin loaded
*/
gboolean
gst_plugin_load_absolute (const gchar *name)
gboolean
gst_plugin_load_absolute (const gchar *name)
{
GModule *module;
GstPluginInitFunc initfunc;
@ -379,7 +379,7 @@ gst_plugin_load_absolute (const gchar *name)
* Returns: new plugin
*/
GstPlugin*
gst_plugin_new (const gchar *name)
gst_plugin_new (const gchar *name)
{
GstPlugin *plugin;
@ -441,12 +441,12 @@ gst_plugin_set_name (GstPlugin *plugin, const gchar *name)
*
* Sets the long name (should be descriptive) of the plugin.
*/
void
gst_plugin_set_longname (GstPlugin *plugin, const gchar *longname)
void
gst_plugin_set_longname (GstPlugin *plugin, const gchar *longname)
{
g_return_if_fail(plugin != NULL);
if (plugin->longname)
if (plugin->longname)
g_free(plugin->longname);
plugin->longname = g_strdup(longname);
@ -510,7 +510,7 @@ gst_plugin_is_loaded (GstPlugin *plugin)
* Returns: pointer to the #GstPlugin if found, NULL otherwise
*/
GstPlugin*
gst_plugin_find (const gchar *name)
gst_plugin_find (const gchar *name)
{
GList *plugins = _gst_plugins;
@ -529,7 +529,7 @@ gst_plugin_find (const gchar *name)
return NULL;
}
/**
/**
* gst_plugin_find_elementfactory:
* @name: name of elementfactory to find
*
@ -538,7 +538,7 @@ gst_plugin_find (const gchar *name)
* Returns: @GstElementFactory if found, NULL if not
*/
GstElementFactory*
gst_plugin_find_elementfactory (const gchar *name)
gst_plugin_find_elementfactory (const gchar *name)
{
GList *plugins, *factories;
GstElementFactory *factory;
@ -560,7 +560,7 @@ gst_plugin_find_elementfactory (const gchar *name)
return NULL;
}
/**
/**
* gst_plugin_load_elementfactory:
* @name: name of elementfactory to load
*
@ -569,7 +569,7 @@ gst_plugin_find_elementfactory (const gchar *name)
* Returns: @GstElementFactory if loaded, NULL if not
*/
GstElementFactory*
gst_plugin_load_elementfactory (const gchar *name)
gst_plugin_load_elementfactory (const gchar *name)
{
GList *plugins, *factories;
GstElementFactory *factory = NULL;
@ -581,15 +581,15 @@ gst_plugin_load_elementfactory (const gchar *name)
while (plugins) {
plugin = (GstPlugin *)plugins->data;
factories = plugin->elements;
while (factories) {
factory = (GstElementFactory*)(factories->data);
if (!strcmp(factory->name,name)) {
if (!plugin->loaded) {
gchar *filename = g_strdup (plugin->filename);
gchar *pluginname = g_strdup (plugin->name);
GST_INFO (GST_CAT_PLUGIN_LOADING,"loaded elementfactory %s from plugin %s",name,plugin->name);
gst_plugin_remove(plugin);
if (!gst_plugin_load_absolute(filename)) {
@ -609,14 +609,14 @@ gst_plugin_load_elementfactory (const gchar *name)
return factory;
}
/**
/**
* gst_plugin_load_typefactory:
* @mime: name of typefactory to load
*
* Load a registered typefactory by mime type.
*/
void
gst_plugin_load_typefactory (const gchar *mime)
void
gst_plugin_load_typefactory (const gchar *mime)
{
GList *plugins, *factories;
GstTypeFactory *factory;
@ -628,15 +628,15 @@ gst_plugin_load_typefactory (const gchar *mime)
while (plugins) {
plugin = (GstPlugin *)plugins->data;
factories = g_list_copy (plugin->types);
while (factories) {
factory = (GstTypeFactory*)(factories->data);
if (!strcmp(factory->mime,mime)) {
if (!plugin->loaded) {
gchar *filename = g_strdup (plugin->filename);
gchar *pluginname = g_strdup (plugin->name);
GST_INFO (GST_CAT_PLUGIN_LOADING,"loading type factory for \"%s\" from plugin %s",mime,plugin->name);
plugin->loaded = TRUE;
gst_plugin_remove(plugin);
@ -666,8 +666,8 @@ gst_plugin_load_typefactory (const gchar *mime)
*
* Add factory to the list of those provided by the plugin.
*/
void
gst_plugin_add_factory (GstPlugin *plugin, GstElementFactory *factory)
void
gst_plugin_add_factory (GstPlugin *plugin, GstElementFactory *factory)
{
g_return_if_fail (plugin != NULL);
g_return_if_fail (factory != NULL);
@ -684,8 +684,8 @@ gst_plugin_add_factory (GstPlugin *plugin, GstElementFactory *factory)
*
* Add a typefactory to the list of those provided by the plugin.
*/
void
gst_plugin_add_type (GstPlugin *plugin, GstTypeFactory *factory)
void
gst_plugin_add_type (GstPlugin *plugin, GstTypeFactory *factory)
{
g_return_if_fail (plugin != NULL);
g_return_if_fail (factory != NULL);
@ -704,7 +704,7 @@ gst_plugin_add_type (GstPlugin *plugin, GstTypeFactory *factory)
* Returns; a GList of GstPlugin elements
*/
GList*
gst_plugin_get_list(void)
gst_plugin_get_list(void)
{
return _gst_plugins;
}
@ -717,8 +717,8 @@ gst_plugin_get_list(void)
*
* Returns: the new XML node
*/
xmlNodePtr
gst_plugin_save_thyself (xmlNodePtr parent)
xmlNodePtr
gst_plugin_save_thyself (xmlNodePtr parent)
{
xmlNodePtr tree, subtree;
GList *plugins = NULL, *elements = NULL, *types = NULL;
@ -733,7 +733,7 @@ gst_plugin_save_thyself (xmlNodePtr parent)
types = plugin->types;
while (types) {
GstTypeFactory *factory = (GstTypeFactory *)types->data;
subtree = xmlNewChild(tree,NULL,"type",NULL);
subtree = xmlNewChild(tree,NULL,"typefactory",NULL);
gst_typefactory_save_thyself(factory, subtree);
@ -742,7 +742,7 @@ gst_plugin_save_thyself (xmlNodePtr parent)
elements = plugin->elements;
while (elements) {
GstElementFactory *factory = (GstElementFactory *)elements->data;
subtree = xmlNewChild(tree,NULL,"element",NULL);
subtree = xmlNewChild(tree,NULL,"elementfactory",NULL);
gst_elementfactory_save_thyself(factory, subtree);
@ -759,14 +759,14 @@ gst_plugin_save_thyself (xmlNodePtr parent)
*
* load the plugin from an XML representation
*/
void
gst_plugin_load_thyself (xmlNodePtr parent)
void
gst_plugin_load_thyself (xmlNodePtr parent)
{
xmlNodePtr kinderen;
xmlNodePtr kinderen;
gint elementcount = 0;
gint typecount = 0;
gchar *pluginname;
kinderen = parent->xmlChildrenNode; // Dutch invasion :-)
while (kinderen) {
if (!strcmp(kinderen->name, "plugin")) {
@ -794,12 +794,12 @@ gst_plugin_load_thyself (xmlNodePtr parent)
else if (!strcmp(field->name, "filename")) {
plugin->filename = xmlNodeGetContent(field);
}
else if (!strcmp(field->name, "element")) {
else if (!strcmp(field->name, "elementfactory")) {
GstElementFactory *factory = gst_elementfactory_load_thyself(field);
gst_plugin_add_factory (plugin, factory);
elementcount++;
}
else if (!strcmp(field->name, "type")) {
else if (!strcmp(field->name, "typefactory")) {
GstTypeFactory *factory = gst_typefactory_load_thyself(field);
gst_plugin_add_type (plugin, factory);
elementcount++;

View file

@ -153,12 +153,12 @@ gst_queue_handle_eos (GstPad *pad)
{
GstQueue *queue;
queue = GST_QUEUE(pad->parent);
queue = GST_QUEUE (GST_OBJECT_PARENT (pad));
GST_DEBUG (0,"queue: %s received eos\n", gst_element_get_name (GST_ELEMENT (queue)));
GST_DEBUG (0,"queue: %s received eos\n", GST_ELEMENT_NAME (queue));
GST_LOCK (queue);
GST_DEBUG (0,"queue: %s has %d buffers left\n", gst_element_get_name (GST_ELEMENT (queue)),
GST_DEBUG (0,"queue: %s has %d buffers left\n", GST_ELEMENT_NAME (queue),
queue->level_buffers);
GST_FLAG_SET (pad, GST_PAD_EOS);
@ -182,7 +182,7 @@ static void
gst_queue_flush (GstQueue *queue)
{
g_slist_foreach (queue->queue, gst_queue_cleanup_buffers,
(char *)gst_element_get_name (GST_ELEMENT (queue)));
(char *) GST_ELEMENT_NAME (queue));
g_slist_free (queue->queue);
queue->queue = NULL;
@ -201,8 +201,8 @@ gst_queue_chain (GstPad *pad, GstBuffer *buf)
g_return_if_fail (GST_IS_PAD (pad));
g_return_if_fail (buf != NULL);
queue = GST_QUEUE (pad->parent);
name = gst_element_get_name (GST_ELEMENT (queue));
queue = GST_QUEUE (GST_OBJECT_PARENT (pad));
name = GST_ELEMENT_NAME (queue);
/* we have to lock the queue since we span threads */
@ -251,12 +251,12 @@ gst_queue_chain (GstPad *pad, GstBuffer *buf)
static GstBuffer *
gst_queue_get (GstPad *pad)
{
GstQueue *queue = GST_QUEUE (gst_pad_get_parent(pad));
GstQueue *queue = GST_QUEUE (GST_OBJECT_PARENT (pad));
GstBuffer *buf = NULL;
GSList *front;
const guchar *name;
name = gst_element_get_name (GST_ELEMENT (queue));
name = GST_ELEMENT_NAME (queue);
/* have to lock for thread-safety */
GST_DEBUG (0,"queue: %s try have queue lock\n", name);

View file

@ -30,7 +30,7 @@ static int
gst_bin_loopfunc_wrapper (int argc,char *argv[])
{
GstElement *element = GST_ELEMENT (argv);
G_GNUC_UNUSED const gchar *name = gst_element_get_name (element);
G_GNUC_UNUSED const gchar *name = GST_ELEMENT_NAME (element);
GST_DEBUG_ENTER("(%d,'%s')",argc,name);
@ -50,7 +50,7 @@ static int
gst_bin_chain_wrapper (int argc,char *argv[])
{
GstElement *element = GST_ELEMENT (argv);
G_GNUC_UNUSED const gchar *name = gst_element_get_name (element);
G_GNUC_UNUSED const gchar *name = GST_ELEMENT_NAME (element);
GList *pads;
GstPad *pad;
GstRealPad *realpad;
@ -66,11 +66,11 @@ gst_bin_chain_wrapper (int argc,char *argv[])
if (!GST_IS_REAL_PAD(pad)) continue;
realpad = GST_REAL_PAD(pad);
if (GST_RPAD_DIRECTION(realpad) == GST_PAD_SINK) {
GST_DEBUG (0,"pulling a buffer from %s:%s\n", name, gst_pad_get_name (pad));
GST_DEBUG (0,"pulling a buffer from %s:%s\n", name, GST_PAD_NAME (pad));
buf = gst_pad_pull (pad);
GST_DEBUG (0,"calling chain function of %s:%s\n", name, gst_pad_get_name (pad));
GST_DEBUG (0,"calling chain function of %s:%s\n", name, GST_PAD_NAME (pad));
if (buf) GST_RPAD_CHAINFUNC(realpad) (pad,buf);
GST_DEBUG (0,"calling chain function of %s:%s done\n", name, gst_pad_get_name (pad));
GST_DEBUG (0,"calling chain function of %s:%s done\n", name, GST_PAD_NAME (pad));
}
}
} while (!GST_ELEMENT_IS_COTHREAD_STOPPING(element));
@ -87,7 +87,7 @@ gst_bin_src_wrapper (int argc,char *argv[])
GList *pads;
GstRealPad *realpad;
GstBuffer *buf;
G_GNUC_UNUSED const gchar *name = gst_element_get_name (element);
G_GNUC_UNUSED const gchar *name = GST_ELEMENT_NAME (element);
GST_DEBUG_ENTER("(%d,\"%s\")",argc,name);
@ -125,7 +125,7 @@ gst_bin_src_wrapper (int argc,char *argv[])
static void
gst_bin_pushfunc_proxy (GstPad *pad, GstBuffer *buf)
{
cothread_state *threadstate = GST_ELEMENT(pad->parent)->threadstate;
cothread_state *threadstate = GST_ELEMENT (GST_PAD_PARENT (pad))->threadstate;
GST_DEBUG_ENTER("(%s:%s)",GST_DEBUG_PAD_NAME(pad));
GST_DEBUG (0,"putting buffer %p in peer's pen\n",buf);
GST_RPAD_BUFPEN(GST_RPAD_PEER(pad)) = buf;
@ -209,7 +209,7 @@ gst_schedule_cothreaded_chain (GstBin *bin, _GstBinChain *chain) {
// if the element has a loopfunc...
if (element->loopfunc != NULL) {
wrapper_function = GST_DEBUG_FUNCPTR(gst_bin_loopfunc_wrapper);
GST_DEBUG (0,"\nelement '%s' is a loop-based\n",gst_element_get_name(element));
GST_DEBUG (0,"\nelement '%s' is a loop-based\n",GST_ELEMENT_NAME(element));
} else {
// 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
@ -217,10 +217,10 @@ gst_schedule_cothreaded_chain (GstBin *bin, _GstBinChain *chain) {
// if it doesn't have any sinks, it must be a source (duh)
if (element->numsinkpads == 0) {
wrapper_function = GST_DEBUG_FUNCPTR(gst_bin_src_wrapper);
GST_DEBUG (0,"\nelement '%s' is a source, using _src_wrapper\n",gst_element_get_name(element));
GST_DEBUG (0,"\nelement '%s' is a source, using _src_wrapper\n",GST_ELEMENT_NAME(element));
} else {
wrapper_function = GST_DEBUG_FUNCPTR(gst_bin_chain_wrapper);
GST_DEBUG (0,"\nelement '%s' is a filter, using _chain_wrapper\n",gst_element_get_name(element));
GST_DEBUG (0,"\nelement '%s' is a filter, using _chain_wrapper\n",GST_ELEMENT_NAME(element));
}
}
}
@ -234,7 +234,7 @@ gst_schedule_cothreaded_chain (GstBin *bin, _GstBinChain *chain) {
// if the element is DECOUPLED or outside the manager, we have to chain
if ((wrapper_function == NULL) ||
(GST_ELEMENT(GST_PAD(GST_RPAD_PEER(pad))->parent)->manager != GST_ELEMENT(bin))) {
(GST_ELEMENT (GST_PAD_PARENT (GST_PAD (GST_RPAD_PEER (pad))))->manager != GST_ELEMENT(bin))) {
// set the chain proxies
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));
@ -261,10 +261,10 @@ gst_schedule_cothreaded_chain (GstBin *bin, _GstBinChain *chain) {
if (wrapper_function != NULL) {
if (element->threadstate == NULL) {
element->threadstate = cothread_create (bin->threadcontext);
GST_DEBUG (0,"created cothread %p for '%s'\n",element->threadstate,gst_element_get_name(element));
GST_DEBUG (0,"created cothread %p for '%s'\n",element->threadstate,GST_ELEMENT_NAME(element));
}
cothread_setfunc (element->threadstate, wrapper_function, 0, (char **)element);
GST_DEBUG (0,"set wrapper function for '%s' to &%s\n",gst_element_get_name(element),
GST_DEBUG (0,"set wrapper function for '%s' to &%s\n",GST_ELEMENT_NAME(element),
GST_DEBUG_FUNCPTR_NAME(wrapper_function));
}
}
@ -327,7 +327,7 @@ gst_bin_schedule_cleanup (GstBin *bin)
static void
gst_scheduler_handle_eos (GstElement *element, _GstBinChain *chain)
{
GST_DEBUG (0,"chain removed from scheduler, EOS from element \"%s\"\n", gst_element_get_name (element));
GST_DEBUG (0,"chain removed from scheduler, EOS from element \"%s\"\n", GST_ELEMENT_NAME (element));
chain->need_scheduling = FALSE;
}
@ -341,7 +341,7 @@ void gst_bin_schedule_func(GstBin *bin) {
GList *chains;
_GstBinChain *chain;
GST_DEBUG_ENTER("(\"%s\")",gst_element_get_name (GST_ELEMENT (bin)));
GST_DEBUG_ENTER("(\"%s\")",GST_ELEMENT_NAME (GST_ELEMENT (bin)));
gst_bin_schedule_cleanup(bin);
@ -356,12 +356,12 @@ void gst_bin_schedule_func(GstBin *bin) {
// if this is a DECOUPLED element
if (GST_FLAG_IS_SET (element, GST_ELEMENT_DECOUPLED)) {
// skip this element entirely
GST_DEBUG (0,"skipping '%s' because it's decoupled\n",gst_element_get_name(element));
GST_DEBUG (0,"skipping '%s' because it's decoupled\n",GST_ELEMENT_NAME(element));
elements = g_list_next (elements);
continue;
}
GST_DEBUG (0,"starting with element '%s'\n",gst_element_get_name(element));
GST_DEBUG (0,"starting with element '%s'\n",GST_ELEMENT_NAME(element));
// prime the pending list with the first element off the top
pending = g_slist_prepend (NULL, element);
@ -379,7 +379,7 @@ void gst_bin_schedule_func(GstBin *bin) {
pending = g_slist_remove (pending, element);
// add ourselves to the chain's list of elements
GST_DEBUG (0,"adding '%s' to chain\n",gst_element_get_name(element));
GST_DEBUG (0,"adding '%s' to chain\n",GST_ELEMENT_NAME(element));
chain->elements = g_list_prepend (chain->elements, element);
chain->num_elements++;
gtk_signal_connect (GTK_OBJECT (element), "eos", gst_scheduler_handle_eos, chain);
@ -394,13 +394,13 @@ void gst_bin_schedule_func(GstBin *bin) {
if ((element->manager == GST_ELEMENT(bin)) &&
!GST_FLAG_IS_SET (element, GST_ELEMENT_DECOUPLED)) {
// remove ourselves from the outer list of all managed elements
// GST_DEBUG (0,"removing '%s' from list of possible elements\n",gst_element_get_name(element));
// GST_DEBUG (0,"removing '%s' from list of possible elements\n",GST_ELEMENT_NAME(element));
elements = g_list_remove (elements, element);
// if this element is a source, add it as an entry
if (element->numsinkpads == 0) {
chain->entries = g_list_prepend (chain->entries, element);
GST_DEBUG (0,"added '%s' as SRC entry into the chain\n",gst_element_get_name(element));
GST_DEBUG (0,"added '%s' as SRC entry into the chain\n",GST_ELEMENT_NAME(element));
}
// now we have to walk the pads to find peers
@ -413,9 +413,9 @@ void gst_bin_schedule_func(GstBin *bin) {
if (GST_RPAD_PEER(pad) == NULL) GST_ERROR(pad,"peer is null!");
g_assert(GST_RPAD_PEER(pad) != NULL);
g_assert(GST_PAD(GST_RPAD_PEER(pad))->parent != NULL);
g_assert(GST_PAD_PARENT (GST_PAD(GST_RPAD_PEER(pad))) != NULL);
peerparent = GST_ELEMENT(GST_PAD(GST_RPAD_PEER(pad))->parent);
peerparent = GST_ELEMENT(GST_PAD_PARENT (GST_PAD(GST_RPAD_PEER(pad))));
GST_DEBUG (0,"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
@ -424,7 +424,7 @@ void gst_bin_schedule_func(GstBin *bin) {
GST_FLAG_IS_SET (peerparent, GST_ELEMENT_DECOUPLED)) {
// add the peer element to the pending list
GST_DEBUG (0,"adding '%s' to list of pending elements\n",
gst_element_get_name(peerparent));
GST_ELEMENT_NAME(peerparent));
pending = g_slist_prepend (pending, peerparent);
// if this is a sink pad, then the element on the other side is an entry
@ -432,10 +432,10 @@ void gst_bin_schedule_func(GstBin *bin) {
(GST_FLAG_IS_SET (peerparent, GST_ELEMENT_DECOUPLED))) {
chain->entries = g_list_prepend (chain->entries, peerparent);
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_get_name(peerparent));
GST_DEBUG (0,"added '%s' as DECOUPLED entry into the chain\n",GST_ELEMENT_NAME(peerparent));
}
} else
GST_DEBUG (0,"element '%s' has already been dealt with\n",gst_element_get_name(peerparent));
GST_DEBUG (0,"element '%s' has already been dealt with\n",GST_ELEMENT_NAME(peerparent));
}
}
} while (pending);
@ -446,7 +446,7 @@ void gst_bin_schedule_func(GstBin *bin) {
while (elements) {
element = GST_ELEMENT (elements->data);
elements = g_list_next(elements);
GST_DEBUG_NOPREFIX(0,"%s, ",gst_element_get_name(element));
GST_DEBUG_NOPREFIX(0,"%s, ",GST_ELEMENT_NAME(element));
}
}
GST_DEBUG_NOPREFIX(0,"\n");
@ -472,7 +472,7 @@ void gst_bin_schedule_func(GstBin *bin) {
}
}
GST_DEBUG_LEAVE("(\"%s\")",gst_element_get_name(GST_ELEMENT(bin)));
GST_DEBUG_LEAVE("(\"%s\")",GST_ELEMENT_NAME(GST_ELEMENT(bin)));
}
@ -490,7 +490,7 @@ void gst_bin_schedule_func(GstBin *bin) {
if ((GST_IS_SRC (outside) || GST_IS_CONNECTION (outside)) &&
(gst_object_get_parent (GST_OBJECT (outside)) != GST_OBJECT (bin))) {
if (gst_pad_get_direction (pad) == GST_PAD_SINK) {
GST_DEBUG (0,"dealing with outside source element %s\n",gst_element_get_name(outside));
GST_DEBUG (0,"dealing with outside source element %s\n",GST_ELEMENT_NAME(outside));
// GST_DEBUG (0,"PUNT: copying pullfunc ptr from %s:%s to %s:%s (@ %p)\n",
//GST_DEBUG_PAD_NAME(pad->peer),GST_DEBUG_PAD_NAME(pad),&pad->pullfunc);
// pad->pullfunc = pad->peer->pullfunc;
@ -507,7 +507,7 @@ void gst_bin_schedule_func(GstBin *bin) {
/*
} else if (GST_IS_SRC (element)) {
GST_DEBUG (0,"adding '%s' as entry point, because it's a source\n",gst_element_get_name (element));
GST_DEBUG (0,"adding '%s' as entry point, because it's a source\n",GST_ELEMENT_NAME (element));
bin->entries = g_list_prepend (bin->entries,element);
bin->num_entries++;
cothread_setfunc(element->threadstate,gst_bin_src_wrapper,0,(char **)element);
@ -544,12 +544,12 @@ void gst_bin_schedule_func(GstBin *bin) {
elements = bin->children;
while (elements) {
element = GST_ELEMENT (elements->data);
GST_DEBUG (0,"found element \"%s\"\n", gst_element_get_name (element));
GST_DEBUG (0,"found element \"%s\"\n", GST_ELEMENT_NAME (element));
if (GST_IS_BIN (element)) {
gst_bin_create_plan (GST_BIN (element));
}
if (GST_IS_SRC (element)) {
GST_DEBUG (0,"adding '%s' as entry point, because it's a source\n",gst_element_get_name (element));
GST_DEBUG (0,"adding '%s' as entry point, because it's a source\n",GST_ELEMENT_NAME (element));
bin->entries = g_list_prepend (bin->entries, element);
bin->num_entries++;
}
@ -571,7 +571,7 @@ void gst_bin_schedule_func(GstBin *bin) {
// get the pad's peer
peer = GST_RPAD_PEER(pad);
if (!peer) {
GST_DEBUG (0,"found SINK pad %s has no peer\n", gst_pad_get_name (pad));
GST_DEBUG (0,"found SINK pad %s has no peer\n", GST_ELEMENT_NAME (pad));
break;
}
// get the parent of the peer of the pad
@ -582,14 +582,14 @@ void gst_bin_schedule_func(GstBin *bin) {
(gst_object_get_parent (GST_OBJECT (outside)) != GST_OBJECT (bin))) {
gst_info("gstbin: element \"%s\" is the external source Connection "
"for internal element \"%s\"\n",
gst_element_get_name (GST_ELEMENT (outside)),
gst_element_get_name (GST_ELEMENT (element)));
GST_ELEMENT_NAME (GST_ELEMENT (outside)),
GST_ELEMENT_NAME (GST_ELEMENT (element)));
bin->entries = g_list_prepend (bin->entries, outside);
bin->num_entries++;
}
}
else {
GST_DEBUG (0,"found pad %s\n", gst_pad_get_name (pad));
GST_DEBUG (0,"found pad %s\n", GST_ELEMENT_NAME (pad));
}
pads = g_list_next (pads);
@ -626,7 +626,7 @@ void gst_bin_schedule_func(GstBin *bin) {
// first of all, if there's a loopfunc, the decision's already made
if (element->loopfunc != NULL) {
wrapper_function = GST_DEBUG_FUNCPTR(gst_bin_loopfunc_wrapper);
GST_DEBUG (0,"element %s is a loopfunc, must use a cothread\n",gst_element_get_name(element));
GST_DEBUG (0,"element %s is a loopfunc, must use a cothread\n",GST_ELEMENT_NAME (element));
} else {
// otherwise we need to decide if it needs a cothread
// if it's complex, or cothreads are preferred and it's *not* decoupled, cothread it
@ -685,10 +685,10 @@ void gst_bin_schedule_func(GstBin *bin) {
if (element->threadstate == NULL) {
element->threadstate = cothread_create (bin->threadcontext);
GST_DEBUG (0,"created cothread %p (@%p) for \"%s\"\n",element->threadstate,
&element->threadstate,gst_element_get_name(element));
&element->threadstate,GST_ELEMENT_NAME (element));
}
cothread_setfunc (element->threadstate, wrapper_function, 0, (char **)element);
GST_DEBUG (0,"set wrapper function for \"%s\" to &%s\n",gst_element_get_name(element),
GST_DEBUG (0,"set wrapper function for \"%s\" to &%s\n",GST_ELEMENT_NAME (element),
GST_DEBUG_FUNCPTR_NAME(wrapper_function));
}

View file

@ -53,14 +53,13 @@ enum {
static void gst_thread_class_init (GstThreadClass *klass);
static void gst_thread_init (GstThread *thread);
static void gst_thread_set_arg (GtkObject *object,GtkArg *arg,guint id);
static void gst_thread_get_arg (GtkObject *object,GtkArg *arg,guint id);
static void gst_thread_set_arg (GtkObject *object, GtkArg *arg, guint id);
static void gst_thread_get_arg (GtkObject *object, GtkArg *arg, guint id);
static GstElementStateReturn gst_thread_change_state (GstElement *element);
static xmlNodePtr gst_thread_save_thyself (GstElement *element,xmlNodePtr parent);
static void gst_thread_restore_thyself (GstElement *element,xmlNodePtr parent,
GHashTable *elements);
static xmlNodePtr gst_thread_save_thyself (GstObject *object, xmlNodePtr parent);
static void gst_thread_restore_thyself (GstObject *object, xmlNodePtr self);
static void gst_thread_signal_thread (GstThread *thread);
static void gst_thread_wait_thread (GstThread *thread);
@ -109,9 +108,10 @@ gst_thread_class_init (GstThreadClass *klass)
gtk_object_add_arg_type ("GstThread::create_thread", GTK_TYPE_BOOL,
GTK_ARG_READWRITE, ARG_CREATE_THREAD);
gstobject_class->save_thyself = gst_thread_save_thyself;
gstobject_class->restore_thyself = gst_thread_restore_thyself;
gstelement_class->change_state = gst_thread_change_state;
gstelement_class->save_thyself = gst_thread_save_thyself;
gstelement_class->restore_thyself = gst_thread_restore_thyself;
gstbin_class->schedule = gst_thread_schedule_dummy;
@ -123,7 +123,7 @@ gst_thread_class_init (GstThreadClass *klass)
static void
gst_thread_init (GstThread *thread)
{
GST_DEBUG (0,"initializing thread '%s'\n",gst_element_get_name(GST_ELEMENT(thread)));
GST_DEBUG (0,"initializing thread '%s'\n",GST_ELEMENT_NAME (thread));
// we're a manager by default
GST_FLAG_SET (thread, GST_BIN_FLAG_MANAGER);
@ -212,12 +212,12 @@ gst_thread_change_state (GstElement *element)
gint pending, transition;
g_return_val_if_fail (GST_IS_THREAD(element), FALSE);
GST_DEBUG_ENTER("(\"%s\")",gst_element_get_name(element));
GST_DEBUG_ENTER("(\"%s\")",GST_ELEMENT_NAME(element));
thread = GST_THREAD (element);
GST_INFO (GST_CAT_THREAD,"gstthread: thread \"%s\" change state %d",
gst_element_get_name (GST_ELEMENT (element)),
GST_ELEMENT_NAME (GST_ELEMENT (element)),
GST_STATE_PENDING (element));
pending = GST_STATE_PENDING (element);
@ -238,7 +238,7 @@ gst_thread_change_state (GstElement *element)
// if (!stateset) return FALSE;
// we want to prepare our internal state for doing the iterations
GST_INFO (GST_CAT_THREAD, "gstthread: preparing thread \"%s\" for iterations:",
gst_element_get_name (GST_ELEMENT (element)));
GST_ELEMENT_NAME (GST_ELEMENT (element)));
// set the state to idle
GST_FLAG_UNSET (thread, GST_THREAD_STATE_SPINNING);
@ -247,7 +247,7 @@ gst_thread_change_state (GstElement *element)
if (GST_FLAG_IS_SET (thread, GST_THREAD_CREATE)) {
GST_INFO (GST_CAT_THREAD, "gstthread: starting thread \"%s\"",
gst_element_get_name (GST_ELEMENT (element)));
GST_ELEMENT_NAME (GST_ELEMENT (element)));
// create the thread
pthread_create (&thread->thread_id, NULL,
@ -257,28 +257,28 @@ gst_thread_change_state (GstElement *element)
// gst_thread_wait_thread (thread);
} else {
GST_INFO (GST_CAT_THREAD, "gstthread: NOT starting thread \"%s\"",
gst_element_get_name (GST_ELEMENT (element)));
GST_ELEMENT_NAME (GST_ELEMENT (element)));
}
break;
case GST_STATE_PAUSED_TO_PLAYING:
case GST_STATE_READY_TO_PLAYING:
if (!stateset) return FALSE;
GST_INFO (GST_CAT_THREAD, "gstthread: starting thread \"%s\"",
gst_element_get_name (GST_ELEMENT (element)));
GST_ELEMENT_NAME (GST_ELEMENT (element)));
GST_FLAG_SET (thread, GST_THREAD_STATE_SPINNING);
gst_thread_signal_thread (thread);
break;
case GST_STATE_PLAYING_TO_PAUSED:
GST_INFO (GST_CAT_THREAD,"gstthread: pausing thread \"%s\"",
gst_element_get_name (GST_ELEMENT (element)));
GST_ELEMENT_NAME (GST_ELEMENT (element)));
//GST_FLAG_UNSET(thread,GST_THREAD_STATE_SPINNING);
gst_thread_signal_thread (thread);
break;
case GST_STATE_READY_TO_NULL:
GST_INFO (GST_CAT_THREAD,"gstthread: stopping thread \"%s\"",
gst_element_get_name (GST_ELEMENT (element)));
GST_ELEMENT_NAME (GST_ELEMENT (element)));
GST_FLAG_SET (thread, GST_THREAD_STATE_REAPING);
gst_thread_signal_thread (thread);
@ -303,7 +303,7 @@ gst_thread_main_loop (void *arg)
GstThread *thread = GST_THREAD (arg);
GST_INFO (GST_CAT_THREAD,"gstthread: thread \"%s\" is running with PID %d",
gst_element_get_name (GST_ELEMENT (thread)), getpid ());
GST_ELEMENT_NAME (GST_ELEMENT (thread)), getpid ());
// construct the plan and signal back
if (GST_BIN_CLASS (parent_class)->schedule)
@ -318,7 +318,7 @@ gst_thread_main_loop (void *arg)
}
}
else {
GST_DEBUG (0, "thread \"%s\" waiting\n", gst_element_get_name (GST_ELEMENT (thread)));
GST_DEBUG (0, "thread \"%s\" waiting\n", GST_ELEMENT_NAME (GST_ELEMENT (thread)));
gst_thread_wait_thread (thread);
}
}
@ -327,7 +327,7 @@ gst_thread_main_loop (void *arg)
//pthread_join (thread->thread_id, 0);
GST_INFO (GST_CAT_THREAD, "gstthread: thread \"%s\" is stopped",
gst_element_get_name (GST_ELEMENT (thread)));
GST_ELEMENT_NAME (thread));
return NULL;
}
@ -351,21 +351,20 @@ gst_thread_wait_thread (GstThread *thread)
static void
gst_thread_restore_thyself (GstElement *element,
xmlNodePtr parent,
GHashTable *elements)
gst_thread_restore_thyself (GstObject *object,
xmlNodePtr self)
{
GST_DEBUG (0,"gstthread: restore\n");
if (GST_ELEMENT_CLASS (parent_class)->restore_thyself)
GST_ELEMENT_CLASS (parent_class)->restore_thyself (element,parent, elements);
if (GST_OBJECT_CLASS (parent_class)->restore_thyself)
GST_OBJECT_CLASS (parent_class)->restore_thyself (object, self);
}
static xmlNodePtr
gst_thread_save_thyself (GstElement *element,
xmlNodePtr parent)
gst_thread_save_thyself (GstObject *object,
xmlNodePtr self)
{
if (GST_ELEMENT_CLASS (parent_class)->save_thyself)
GST_ELEMENT_CLASS (parent_class)->save_thyself (element,parent);
if (GST_OBJECT_CLASS (parent_class)->save_thyself)
GST_OBJECT_CLASS (parent_class)->save_thyself (object, self);
return NULL;
}

View file

@ -161,9 +161,9 @@ gst_typefind_chain (GstPad *pad, GstBuffer *buf)
g_return_if_fail (GST_IS_PAD (pad));
g_return_if_fail (buf != NULL);
typefind = GST_TYPEFIND (pad->parent);
typefind = GST_TYPEFIND (GST_OBJECT_PARENT (pad));
GST_DEBUG (0,"got buffer of %d bytes in '%s'\n",
GST_BUFFER_SIZE (buf), gst_element_get_name (GST_ELEMENT (typefind)));
GST_BUFFER_SIZE (buf), GST_OBJECT_NAME (typefind));
type_list = gst_type_get_list ();

View file

@ -25,11 +25,18 @@
#include "gstxml.h"
#include "gstbin.h"
enum {
OBJECT_LOADED,
OBJECT_SAVED,
LAST_SIGNAL
};
static void gst_xml_class_init (GstXMLClass *klass);
static void gst_xml_init (GstXML *xml);
static GstObjectClass *parent_class = NULL;
static guint gst_xml_signals[LAST_SIGNAL] = { 0 };
GtkType
gst_xml_get_type(void)
@ -39,15 +46,15 @@ gst_xml_get_type(void)
if (!xml_type) {
static const GtkTypeInfo xml_info = {
"GstXML",
sizeof(GstElement),
sizeof(GstElementClass),
sizeof(GstXML),
sizeof(GstXMLClass),
(GtkClassInitFunc)gst_xml_class_init,
(GtkObjectInitFunc)gst_xml_init,
(GtkArgSetFunc)NULL,
(GtkArgGetFunc)NULL,
(GtkClassInitFunc)NULL,
};
xml_type = gtk_type_unique (GST_TYPE_XML, &xml_info);
xml_type = gtk_type_unique (GST_TYPE_OBJECT, &xml_info);
}
return xml_type;
}
@ -55,12 +62,44 @@ gst_xml_get_type(void)
static void
gst_xml_class_init (GstXMLClass *klass)
{
GtkObjectClass *gtkobject_class;
gtkobject_class = (GtkObjectClass *)klass;
parent_class = gtk_type_class (GST_TYPE_OBJECT);
gst_xml_signals[OBJECT_LOADED] =
gtk_signal_new ("object_loaded", GTK_RUN_LAST, gtkobject_class->type,
GTK_SIGNAL_OFFSET (GstXMLClass, object_loaded),
gtk_marshal_NONE__POINTER_POINTER, GTK_TYPE_NONE, 2,
GST_TYPE_OBJECT, GTK_TYPE_POINTER);
gst_xml_signals[OBJECT_SAVED] =
gtk_signal_new ("object_saved", GTK_RUN_LAST, gtkobject_class->type,
GTK_SIGNAL_OFFSET (GstXMLClass, object_saved),
gtk_marshal_NONE__POINTER_POINTER, GTK_TYPE_NONE, 2,
GST_TYPE_OBJECT, GTK_TYPE_POINTER);
gtk_object_class_add_signals (gtkobject_class, gst_xml_signals, LAST_SIGNAL);
}
static void
gst_xml_init(GstXML *xml)
{
xml->topelements = NULL;
}
/**
* gst_xml_new:
*
* Create a new GstXML parser object.
*
* Returns: a pointer to a new GstXML object.
*/
GstXML*
gst_xml_new (void)
{
return GST_XML (gtk_type_new (GST_TYPE_XML));
}
/**
@ -75,41 +114,52 @@ xmlDocPtr
gst_xml_write (GstElement *element)
{
xmlDocPtr doc;
xmlNodePtr elementnode;
xmlNsPtr ns;
doc = xmlNewDoc ("1.0");
doc->xmlRootNode = xmlNewDocNode (doc, NULL, "GST-Pipeline", NULL);
xmlNewGlobalNs (doc, "http://gstreamer.net/gst-core/1.0/", "gst");
ns = xmlNewNs (doc->xmlRootNode, "http://gstreamer.net/gst-core/1.0/", "gst");
gst_element_save_thyself (element, doc->xmlRootNode);
doc->xmlRootNode = xmlNewDocNode (doc, ns, "GST-Pipeline", NULL);
elementnode = xmlNewChild (doc->xmlRootNode, NULL, "element", NULL);
gst_object_save_thyself (GST_OBJECT (element), elementnode);
return doc;
}
static GstXML*
gst_xml_real_parse (xmlDocPtr doc, const guchar *root)
static gboolean
gst_xml_real_parse (GstXML *xml, xmlDocPtr doc, const guchar *root)
{
GstXML *xml;
xmlNodePtr field;
xmlNodePtr field, cur;
xmlNsPtr ns;
if (strcmp(doc->xmlRootNode->name, "GST-Pipeline")) {
cur = xmlDocGetRootElement(doc);
if (cur == NULL) {
g_warning("gstxml: empty document\n");
return FALSE ;
}
ns = xmlSearchNsByHref(doc, cur, "http://gstreamer.net/gst-core/1.0/");
if (ns == NULL) {
g_warning("gstxml: document of wrong type, core namespace not found\n");
return FALSE;
}
if (strcmp(cur->name, "GST-Pipeline")) {
g_warning("gstxml: XML file is in wrong format\n");
return NULL;
return FALSE;
}
xml = GST_XML(gtk_type_new(GST_TYPE_XML));
xml->ns = ns;
xml->topelements = NULL;
field = doc->xmlRootNode->xmlChildrenNode;
field = cur->xmlChildrenNode;
while (field) {
if (!strcmp(field->name, "element")) {
if (!strcmp(field->name, "element") && (field->ns == xml->ns)) {
GstElement *element;
xml->elements = g_hash_table_new(g_str_hash, g_str_equal);
element = gst_element_load_thyself(field, xml->elements);
g_hash_table_destroy (xml->elements);
element = gst_element_load_thyself(field, NULL);
xml->topelements = g_list_prepend (xml->topelements, element);
}
@ -118,11 +168,11 @@ gst_xml_real_parse (xmlDocPtr doc, const guchar *root)
xml->topelements = g_list_reverse (xml->topelements);
return xml;
return TRUE;
}
/**
* gst_xml_new:
* gst_xml_parse_file:
* @fname: The filename with the xml description
* @root: The name of the root object to build
*
@ -134,27 +184,27 @@ gst_xml_real_parse (xmlDocPtr doc, const guchar *root)
* tree is cached to speed up creating another GstXML object for
* the same file
*
* Returns: a pointer to a new GstXML object
* Returns: TRUE on success, FALSE otherwise
*/
GstXML*
gst_xml_new (const guchar *fname, const guchar *root)
gboolean
gst_xml_parse_file (GstXML *xml, const guchar *fname, const guchar *root)
{
xmlDocPtr doc;
g_return_val_if_fail(fname != NULL, NULL);
g_return_val_if_fail(fname != NULL, FALSE);
doc = xmlParseFile(fname);
if (!doc) {
g_warning("gstxml: XML file \"%s\" could not be read\n", fname);
return NULL;
return FALSE;
}
return gst_xml_real_parse (doc, root);
return gst_xml_real_parse (xml, doc, root);
}
/**
* gst_xml_new_from_memory:
* gst_xml_parse_memory:
* @buffer: a pointer to the in memory XML buffer
* @size: the size of the buffer
* @root: the name of the root objects to build
@ -164,18 +214,29 @@ gst_xml_new (const guchar *fname, const guchar *root)
*
* Returns: a pointer to a new GstXML object
*/
GstXML*
gst_xml_new_from_memory (guchar *buffer, guint size, const gchar *root)
gboolean
gst_xml_parse_memory (GstXML *xml, guchar *buffer, guint size, const gchar *root)
{
xmlDocPtr doc;
g_return_val_if_fail(buffer != NULL, NULL);
g_return_val_if_fail(buffer != NULL, FALSE);
doc = xmlParseMemory (buffer, size);
return gst_xml_real_parse (doc, root);
return gst_xml_real_parse (xml, doc, root);
}
void
gst_xml_object_loaded (GstXML *xml, GstObject *object, xmlNodePtr self)
{
gtk_signal_emit (GTK_OBJECT (xml), gst_xml_signals[OBJECT_LOADED], object, self);
}
void
gst_xml_object_saved (GstXML *xml, GstObject *object, xmlNodePtr self)
{
gtk_signal_emit (GTK_OBJECT (xml), gst_xml_signals[OBJECT_SAVED], object, self);
}
/**
* gst_xml_get_topelements:
* @xml: The GstXML to get the elements from
@ -219,7 +280,8 @@ gst_xml_get_element (GstXML *xml, const guchar *name)
while (topelements) {
GstElement *top = GST_ELEMENT (topelements->data);
if (!strcmp (gst_element_get_name (top), name)) {
GST_DEBUG (0,"gstxml: getting element \"%s\"\n", name);
if (!strcmp (GST_ELEMENT_NAME (top), name)) {
return top;
}
else {

View file

@ -1,6 +1,6 @@
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wtay@chello.be>
* 2000 Wim Taymans <wim.taymans@chello.be>
*
* gstxml.h: Header for XML save/restore operations
*
@ -23,7 +23,6 @@
#ifndef __GST_XML_H__
#define __GST_XML_H__
//#include <gnome-xml/parser.h>
#include <parser.h>
// Include compatability defines: if libxml hasn't already defined these,
@ -33,16 +32,14 @@
#define xmlRootNode root
#endif
#include <gst/gstelement.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#define GST_TYPE_XML \
(gst_object_get_type())
(gst_xml_get_type())
#define GST_XML(obj) \
(GTK_CHECK_CAST((obj),GST_TYPE_XML,GstXML))
#define GST_XML_CLASS(klass) \
@ -56,14 +53,19 @@ typedef struct _GstXML GstXML;
typedef struct _GstXMLClass GstXMLClass;
struct _GstXML {
GtkObject object;
GstObject object;
GHashTable *elements;
GList *topelements;
xmlNsPtr ns;
};
struct _GstXMLClass {
GtkObjectClass parent_class;
GstObjectClass parent_class;
/* signal callbacks */
void (*object_loaded) (GstXML *xml, GstObject *object, xmlNodePtr self);
void (*object_saved) (GstXML *xml, GstObject *object, xmlNodePtr self);
};
GtkType gst_xml_get_type (void);
@ -72,13 +74,18 @@ GtkType gst_xml_get_type (void);
/* create an XML document out of a pipeline */
xmlDocPtr gst_xml_write (GstElement *element);
GstXML* gst_xml_new (const guchar *fname, const guchar *root);
GstXML* gst_xml_new_from_memory (guchar *buffer, guint size, const gchar *root);
GstXML* gst_xml_new (void);
gboolean gst_xml_parse_file (GstXML *xml, const guchar *fname, const guchar *root);
gboolean gst_xml_parse_memory (GstXML *xml, guchar *buffer, guint size, const gchar *root);
GstElement* gst_xml_get_element (GstXML *xml, const guchar *name);
GList* gst_xml_get_topelements (GstXML *xml);
void gst_xml_object_loaded (GstXML *xml, GstObject *object, xmlNodePtr self);
void gst_xml_object_saved (GstXML *xml, GstObject *object, xmlNodePtr self);
#ifdef __cplusplus
}
#endif /* __cplusplus */

View file

@ -12,18 +12,18 @@
#include "gstmediaplay.h"
#include "callbacks.h"
static void gst_media_play_class_init (GstMediaPlayClass *klass);
static void gst_media_play_init (GstMediaPlay *play);
static void gst_media_play_class_init (GstMediaPlayClass *klass);
static void gst_media_play_init (GstMediaPlay *play);
static void gst_media_play_set_arg (GtkObject *object,GtkArg *arg,guint id);
static void gst_media_play_get_arg (GtkObject *object,GtkArg *arg,guint id);
static void gst_media_play_set_arg (GtkObject *object,GtkArg *arg,guint id);
static void gst_media_play_get_arg (GtkObject *object,GtkArg *arg,guint id);
static void gst_media_play_frame_displayed (GstPlay *play, GstMediaPlay *mplay);
static void gst_media_play_state_changed (GstPlay *play, GstPlayState state, GstMediaPlay *mplay);
static void gst_media_play_slider_changed (GtkAdjustment *adj, GstMediaPlay *mplay);
static void gst_media_play_frame_displayed (GstPlay *play, GstMediaPlay *mplay);
static void gst_media_play_state_changed (GstPlay *play, GstPlayState state, GstMediaPlay *mplay);
static void gst_media_play_slider_changed (GtkAdjustment *adj, GstMediaPlay *mplay);
static void update_buttons (GstMediaPlay *mplay, GstPlayState state);
static void update_slider (GstMediaPlay *mplay, GtkAdjustment *adjustment, gfloat value);
static void update_buttons (GstMediaPlay *mplay, GstPlayState state);
static void update_slider (GstMediaPlay *mplay, GtkAdjustment *adjustment, gfloat value);
/* signals and args */
enum {
@ -47,7 +47,7 @@ target_drag_data_received (GtkWidget *widget,
if (strstr (data->data, "file:")) {
g_print ("Got: %s\n",&data->data[5]);
gdk_threads_leave ();
gst_media_play_start_uri (play, g_strchomp(&data->data[5]));
gst_media_play_start_uri (play, g_strchomp(&data->data[5]));
gdk_threads_enter ();
}
}
@ -59,8 +59,8 @@ static GtkTargetEntry target_table[] = {
static GtkObject *parent_class = NULL;
//static guint gst_media_play_signals[LAST_SIGNAL] = { 0 };
GtkType
gst_media_play_get_type(void)
GtkType
gst_media_play_get_type(void)
{
static GtkType play_type = 0;

View file

@ -218,7 +218,7 @@ gst_asyncdisksrc_get (GstPad *pad)
GstBuffer *buf;
g_return_val_if_fail (pad != NULL, NULL);
src = GST_ASYNCDISKSRC (gst_pad_get_parent(pad));
src = GST_ASYNCDISKSRC (gst_pad_get_parent (pad));
g_return_val_if_fail (GST_FLAG_IS_SET (src, GST_ASYNCDISKSRC_OPEN), NULL);
/* deal with EOF state */
@ -276,7 +276,7 @@ gst_asyncdisksrc_get_region (GstPad *pad, gulong offset, gulong size)
g_return_val_if_fail (pad != NULL, NULL);
src = GST_ASYNCDISKSRC (gst_pad_get_parent(pad));
src = GST_ASYNCDISKSRC (gst_pad_get_parent (pad));
g_return_val_if_fail (GST_IS_ASYNCDISKSRC (src), NULL);
g_return_val_if_fail (GST_FLAG_IS_SET (src, GST_ASYNCDISKSRC_OPEN), NULL);

View file

@ -244,7 +244,7 @@ gst_audiosink_chain (GstPad *pad, GstBuffer *buf)
/* this has to be an audio buffer */
// g_return_if_fail(((GstMeta *)buf->meta)->type !=
//gst_audiosink_type_audio);
audiosink = GST_AUDIOSINK (pad->parent);
audiosink = GST_AUDIOSINK (gst_pad_get_parent (pad));
// g_return_if_fail(GST_FLAG_IS_SET(audiosink,GST_STATE_RUNNING));
if ((in_flush = GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLUSH))) {

View file

@ -149,7 +149,7 @@ gst_audiosrc_get (GstPad *pad)
glong readbytes;
g_return_val_if_fail (pad != NULL, NULL);
src = GST_AUDIOSRC(gst_pad_get_parent(pad));
src = GST_AUDIOSRC(gst_pad_get_parent (pad));
// g_print("attempting to read something from soundcard\n");

View file

@ -208,7 +208,7 @@ gst_disksrc_get (GstPad *pad)
glong readbytes;
g_return_val_if_fail (pad != NULL, NULL);
src = GST_DISKSRC(gst_pad_get_parent(pad));
src = GST_DISKSRC(gst_pad_get_parent (pad));
g_return_val_if_fail (GST_FLAG_IS_SET (src, GST_DISKSRC_OPEN), NULL);
g_return_val_if_fail (GST_STATE (src) >= GST_STATE_READY, NULL);

View file

@ -180,7 +180,7 @@ gst_fakesink_chain (GstPad *pad, GstBuffer *buf)
g_return_if_fail (GST_IS_PAD (pad));
g_return_if_fail (buf != NULL);
fakesink = GST_FAKESINK (pad->parent);
fakesink = GST_FAKESINK (gst_pad_get_parent (pad));
g_print("fakesink: ******* (%s:%s)< \n",GST_DEBUG_PAD_NAME(pad));
gst_buffer_unref (buf);

View file

@ -269,9 +269,11 @@ gst_fakesrc_get(GstPad *pad)
GstFakeSrc *src;
GstBuffer *buf;
g_return_val_if_fail(pad != NULL, NULL);
src = GST_FAKESRC(gst_pad_get_parent(pad));
g_return_val_if_fail(GST_IS_FAKESRC(src), NULL);
g_return_val_if_fail (pad != NULL, NULL);
src = GST_FAKESRC (gst_pad_get_parent (pad));
g_return_val_if_fail (GST_IS_FAKESRC (src), NULL);
if (src->num_buffers == 0) {
gst_pad_set_eos (pad);

View file

@ -113,7 +113,7 @@ gst_fdsink_chain (GstPad *pad, GstBuffer *buf)
g_return_if_fail (GST_IS_PAD (pad));
g_return_if_fail (buf != NULL);
fdsink = GST_FDSINK (pad->parent);
fdsink = GST_FDSINK (gst_pad_get_parent (pad));
g_return_if_fail (fdsink->fd >= 0);

View file

@ -184,7 +184,7 @@ gst_fdsrc_get(GstPad *pad)
glong readbytes;
g_return_val_if_fail (pad != NULL, NULL);
src = GST_FDSRC(gst_pad_get_parent(pad));
src = GST_FDSRC(gst_pad_get_parent (pad));
/* create the buffer */
// FIXME: should eventually use a bufferpool for this

View file

@ -131,7 +131,7 @@ gst_httpsrc_get(GstPad *pad)
glong readbytes;
g_return_val_if_fail (pad != NULL, NULL);
src = GST_HTTPSRC(gst_pad_get_parent(pad));
src = GST_HTTPSRC(gst_pad_get_parent (pad));
buf = gst_buffer_new();
GST_BUFFER_DATA(buf) = (gpointer)malloc(src->bytes_per_read);

View file

@ -120,7 +120,7 @@ gst_identity_chain (GstPad *pad, GstBuffer *buf)
g_return_if_fail (GST_IS_PAD (pad));
g_return_if_fail (buf != NULL);
identity = GST_IDENTITY (pad->parent);
identity = GST_IDENTITY (gst_pad_get_parent (pad));
g_print("identity: ******* (%s:%s)i \n",GST_DEBUG_PAD_NAME(pad));
gst_pad_push (identity->srcpad, buf);

View file

@ -118,13 +118,6 @@ static void gst_pipefilter_init(GstPipefilter *pipefilter) {
pipefilter->seq = 0;
}
GstElement *gst_pipefilter_new(gchar *name) {
GstElement *pipefilter = GST_ELEMENT(gtk_type_new(GST_TYPE_PIPEFILTER));
gst_element_set_name(GST_ELEMENT(pipefilter),name);
return pipefilter;
}
static gboolean gst_pipefilter_read_and_push(GstPipefilter *pipefilter) {
GstBuffer *newbuf;
glong readbytes;
@ -179,7 +172,7 @@ void gst_pipefilter_chain(GstPad *pad,GstBuffer *buf) {
g_return_if_fail(GST_IS_PAD(pad));
g_return_if_fail(buf != NULL);
pipefilter = GST_PIPEFILTER(pad->parent);
pipefilter = GST_PIPEFILTER (gst_pad_get_parent (pad));
while (gst_pipefilter_read_and_push(pipefilter));

View file

@ -153,12 +153,12 @@ gst_queue_handle_eos (GstPad *pad)
{
GstQueue *queue;
queue = GST_QUEUE(pad->parent);
queue = GST_QUEUE (GST_OBJECT_PARENT (pad));
GST_DEBUG (0,"queue: %s received eos\n", gst_element_get_name (GST_ELEMENT (queue)));
GST_DEBUG (0,"queue: %s received eos\n", GST_ELEMENT_NAME (queue));
GST_LOCK (queue);
GST_DEBUG (0,"queue: %s has %d buffers left\n", gst_element_get_name (GST_ELEMENT (queue)),
GST_DEBUG (0,"queue: %s has %d buffers left\n", GST_ELEMENT_NAME (queue),
queue->level_buffers);
GST_FLAG_SET (pad, GST_PAD_EOS);
@ -182,7 +182,7 @@ static void
gst_queue_flush (GstQueue *queue)
{
g_slist_foreach (queue->queue, gst_queue_cleanup_buffers,
(char *)gst_element_get_name (GST_ELEMENT (queue)));
(char *) GST_ELEMENT_NAME (queue));
g_slist_free (queue->queue);
queue->queue = NULL;
@ -201,8 +201,8 @@ gst_queue_chain (GstPad *pad, GstBuffer *buf)
g_return_if_fail (GST_IS_PAD (pad));
g_return_if_fail (buf != NULL);
queue = GST_QUEUE (pad->parent);
name = gst_element_get_name (GST_ELEMENT (queue));
queue = GST_QUEUE (GST_OBJECT_PARENT (pad));
name = GST_ELEMENT_NAME (queue);
/* we have to lock the queue since we span threads */
@ -251,12 +251,12 @@ gst_queue_chain (GstPad *pad, GstBuffer *buf)
static GstBuffer *
gst_queue_get (GstPad *pad)
{
GstQueue *queue = GST_QUEUE (gst_pad_get_parent(pad));
GstQueue *queue = GST_QUEUE (GST_OBJECT_PARENT (pad));
GstBuffer *buf = NULL;
GSList *front;
const guchar *name;
name = gst_element_get_name (GST_ELEMENT (queue));
name = GST_ELEMENT_NAME (queue);
/* have to lock for thread-safety */
GST_DEBUG (0,"queue: %s try have queue lock\n", name);

View file

@ -132,18 +132,6 @@ static void gst_sinesrc_init(GstSineSrc *sinesrc) {
sinesrc->sentmeta = FALSE;
}
GstElement *gst_sinesrc_new(gchar *name) {
GstElement *sinesrc = GST_ELEMENT(gtk_type_new(GST_TYPE_SINESRC));
gst_element_set_name(GST_ELEMENT(sinesrc),name);
return sinesrc;
}
GstElement *gst_sinesrc_new_with_fd(gchar *name,gchar *filename) {
GstElement *sinesrc = gst_sinesrc_new(name);
gtk_object_set(GTK_OBJECT(sinesrc),"location",filename,NULL);
return sinesrc;
}
static GstBuffer *
gst_sinesrc_get(GstPad *pad)
{
@ -155,7 +143,7 @@ gst_sinesrc_get(GstPad *pad)
gdouble val;
g_return_val_if_fail (pad != NULL, NULL);
src = GST_SINESRC(gst_pad_get_parent(pad));
src = GST_SINESRC(gst_pad_get_parent (pad));
buf = gst_buffer_new();
g_return_val_if_fail (buf, NULL);

View file

@ -181,7 +181,7 @@ gst_tee_chain (GstPad *pad, GstBuffer *buf)
g_return_if_fail (GST_IS_PAD (pad));
g_return_if_fail (buf != NULL);
tee = GST_TEE (pad->parent);
tee = GST_TEE (gst_pad_get_parent (pad));
gst_trace_add_entry (NULL, 0, buf, "tee buffer");
for (i=0; i<tee->numsrcpads-1; i++)

View file

@ -31,9 +31,6 @@ int main(int argc,char *argv[]) {
gst_pad_connect(gst_element_get_pad(audiosrc,"src"),
gst_element_get_pad(fdsink,"sink"));
g_print("\neverything's built, setting it up to be runnable\n");
gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_READY);
g_print("\nok, runnable, hitting 'play'...\n");
gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_PLAYING);

View file

@ -76,7 +76,7 @@ static void gst_example_get_arg (GtkObject *object,GtkArg *arg,guint id);
GstPadTemplate *src_template, *sink_template;
static GstElementClass *parent_class = NULL;
static guint gst_example_signals[LAST_SIGNAL] = { 0 };
//static guint gst_example_signals[LAST_SIGNAL] = { 0 };
GtkType
gst_example_get_type(void)
@ -134,15 +134,13 @@ static void
gst_example_chain (GstPad *pad, GstBuffer *buf)
{
GstExample *example;
guchar *data;
gint i;
g_return_if_fail(pad != NULL);
g_return_if_fail(GST_IS_PAD(pad));
g_return_if_fail(buf != NULL);
//g_return_if_fail(GST_IS_BUFFER(buf));
example = GST_EXAMPLE(pad->parent);
example = GST_EXAMPLE(gst_pad_get_parent (pad));
g_return_if_fail(example != NULL);
g_return_if_fail(GST_IS_EXAMPLE(example));
@ -199,10 +197,10 @@ plugin_init (GModule *module)
GstElementFactory *factory;
plugin = gst_plugin_new("example");
g_return_if_fail(plugin != NULL);
g_return_val_if_fail(plugin != NULL, NULL);
factory = gst_elementfactory_new("example", GST_TYPE_EXAMPLE, &example_details);
g_return_if_fail(factory != NULL);
g_return_val_if_fail(factory != NULL, NULL);
sink_template = gst_padtemplate_new (&sink_factory);
gst_elementfactory_add_padtemplate (factory, sink_template);

View file

@ -52,7 +52,7 @@ int main(int argc,char *argv[])
gst_bin_add(GST_BIN(thread), queue2);
gst_bin_add(GST_BIN(thread2), audiosink);
gst_pad_connect(gst_element_get_pad(disksrc,"src"),
gst_element_get_pad(queue,"sink"));

View file

@ -3,33 +3,40 @@
gboolean playing;
/* eos will be called when the src element has an end of stream */
void eos(GstElement *element, gpointer data)
static void
xml_loaded (GstXML *xml, GstObject *object, gpointer data)
{
g_print("have eos, quitting\n");
playing = FALSE;
if (GST_IS_PAD (object)) {
g_print ("pad loaded '%s'\n", gst_pad_get_name (GST_PAD (object)));
}
else if (GST_IS_ELEMENT (object)) {
g_print ("element loaded '%s'\n", gst_element_get_name (GST_ELEMENT (object)));
}
}
int main(int argc,char *argv[])
int main(int argc,char *argv[])
{
GstXML *xml;
GstElement *bin;
GstElement *disk;
gboolean ret;
gst_init(&argc,&argv);
xml = gst_xml_new("xmlTest.gst", NULL);
xml = gst_xml_new ();
gtk_signal_connect (GTK_OBJECT (xml), "object_loaded", xml_loaded, NULL);
ret = gst_xml_parse_file(xml, "xmlTest.gst", NULL);
g_assert (ret == TRUE);
bin = gst_xml_get_element(xml, "bin");
g_assert (bin != NULL);
gst_element_set_state(bin, GST_STATE_PLAYING);
playing = TRUE;
while (playing) {
gst_bin_iterate(GST_BIN(bin));
}
while (gst_bin_iterate(GST_BIN(bin)));
gst_element_set_state(bin, GST_STATE_NULL);

View file

@ -41,7 +41,8 @@ int main(int argc,char *argv[])
g_print ("\n *** using testfile %s\n", argv[1]);
xml = gst_xml_new(argv[1], NULL);
xml = gst_xml_new();
xml = gst_xml_parse_file (xml, argv[1], NULL);
toplevelelements = gst_xml_get_topelements (xml);

View file

@ -84,6 +84,7 @@ struct _GstPropsEntry {
gint print_element_info(GstElementFactory *factory) {
GstElement *element;
GstObjectClass *gstobject_class;
GstElementClass *gstelement_class;
GList *pads, *caps;
GstPad *pad;
@ -99,6 +100,8 @@ gint print_element_info(GstElementFactory *factory) {
g_print ("couldn't construct element for some reason\n");
return -1;
}
gstobject_class = GST_OBJECT_CLASS (GTK_OBJECT (element)->klass);
gstelement_class = GST_ELEMENT_CLASS (GTK_OBJECT (element)->klass);
printf("Factory Details:\n");
@ -184,9 +187,9 @@ gint print_element_info(GstElementFactory *factory) {
printf(" Has change_state() function\n");
else
printf(" No change_state() class function\n");
if (gstelement_class->save_thyself)
if (gstobject_class->save_thyself)
printf(" Has custom save_thyself() class function\n");
if (gstelement_class->restore_thyself)
if (gstobject_class->restore_thyself)
printf(" Has custom restore_thyself() class function\n");
printf("\n");