mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-30 05:31:15 +00:00
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:
parent
d0abadd974
commit
51cbf22624
65 changed files with 987 additions and 783 deletions
|
@ -405,24 +405,16 @@ circumstances.
|
||||||
@element:
|
@element:
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### FUNCTION gst_element_save_thyself ##### -->
|
|
||||||
<para>
|
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
@element:
|
|
||||||
@parent:
|
|
||||||
@Returns:
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### FUNCTION gst_element_load_thyself ##### -->
|
<!-- ##### FUNCTION gst_element_load_thyself ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
@self:
|
||||||
@parent:
|
@parent:
|
||||||
@elements:
|
|
||||||
@Returns:
|
@Returns:
|
||||||
|
<!-- # Unused Parameters # -->
|
||||||
|
@elements:
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### FUNCTION gst_elementfactory_new ##### -->
|
<!-- ##### FUNCTION gst_elementfactory_new ##### -->
|
||||||
|
|
|
@ -503,22 +503,14 @@ Call the EOS function of the pad
|
||||||
@pad: the pad to call the eos function of.
|
@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 ##### -->
|
<!-- ##### FUNCTION gst_pad_load_and_connect ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
@self:
|
||||||
@parent:
|
@parent:
|
||||||
|
<!-- # Unused Parameters # -->
|
||||||
@element:
|
@element:
|
||||||
@elements:
|
@elements:
|
||||||
|
|
||||||
|
|
|
@ -217,13 +217,6 @@ the stream.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### FUNCTION gst_object_get_type ##### -->
|
|
||||||
<para>
|
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
@Returns:
|
|
||||||
|
|
||||||
<!-- ##### MACRO GST_SINESRC ##### -->
|
<!-- ##### MACRO GST_SINESRC ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
|
||||||
|
@ -231,6 +224,13 @@ the stream.
|
||||||
|
|
||||||
@obj:
|
@obj:
|
||||||
|
|
||||||
|
<!-- ##### FUNCTION gst_object_get_type ##### -->
|
||||||
|
<para>
|
||||||
|
|
||||||
|
</para>
|
||||||
|
|
||||||
|
@Returns:
|
||||||
|
|
||||||
<!-- ##### SECTION ./tmpl/plugin.sgml:Long_Description ##### -->
|
<!-- ##### SECTION ./tmpl/plugin.sgml:Long_Description ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
|
||||||
|
@ -1613,6 +1613,16 @@ Query the element for the current mime type
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ##### FUNCTION gst_xml_new_from_memory ##### -->
|
||||||
|
<para>
|
||||||
|
|
||||||
|
</para>
|
||||||
|
|
||||||
|
@buffer:
|
||||||
|
@size:
|
||||||
|
@root:
|
||||||
|
@Returns:
|
||||||
|
|
||||||
<!-- ##### SECTION ./tmpl/gstgetbits.sgml:Long_Description ##### -->
|
<!-- ##### SECTION ./tmpl/gstgetbits.sgml:Long_Description ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
|
||||||
|
@ -1916,6 +1926,15 @@ Indicates this pad is active
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ##### FUNCTION gst_element_save_thyself ##### -->
|
||||||
|
<para>
|
||||||
|
|
||||||
|
</para>
|
||||||
|
|
||||||
|
@element:
|
||||||
|
@parent:
|
||||||
|
@Returns:
|
||||||
|
|
||||||
<!-- ##### FUNCTION gst_sinesrc_push ##### -->
|
<!-- ##### FUNCTION gst_sinesrc_push ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
|
||||||
|
@ -1993,6 +2012,15 @@ Indicates this pad is active
|
||||||
|
|
||||||
@obj:
|
@obj:
|
||||||
|
|
||||||
|
<!-- ##### FUNCTION gst_pad_save_thyself ##### -->
|
||||||
|
<para>
|
||||||
|
|
||||||
|
</para>
|
||||||
|
|
||||||
|
@pad:
|
||||||
|
@parent:
|
||||||
|
@Returns:
|
||||||
|
|
||||||
<!-- ##### STRUCT GstElementClass ##### -->
|
<!-- ##### STRUCT GstElementClass ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
|
||||||
|
|
|
@ -21,28 +21,18 @@ All GstElements can be serialized to an XML presentation and subsequently loaded
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
@object:
|
@object:
|
||||||
@elements:
|
|
||||||
@topelements:
|
@topelements:
|
||||||
|
@ns:
|
||||||
|
|
||||||
<!-- ##### FUNCTION gst_xml_new ##### -->
|
<!-- ##### FUNCTION gst_xml_new ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
@Returns:
|
||||||
|
<!-- # Unused Parameters # -->
|
||||||
@fname:
|
@fname:
|
||||||
@root:
|
@root:
|
||||||
@Returns:
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### FUNCTION gst_xml_new_from_memory ##### -->
|
|
||||||
<para>
|
|
||||||
|
|
||||||
</para>
|
|
||||||
|
|
||||||
@buffer:
|
|
||||||
@size:
|
|
||||||
@root:
|
|
||||||
@Returns:
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### FUNCTION gst_xml_write ##### -->
|
<!-- ##### FUNCTION gst_xml_write ##### -->
|
||||||
|
|
|
@ -139,7 +139,7 @@ gst_editor_pad_new(GstEditorElement *parent,GstPad *pad,
|
||||||
GstEditorPad *peereditorpad;
|
GstEditorPad *peereditorpad;
|
||||||
|
|
||||||
// FIXME does this need to check for ghost/real?
|
// 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);
|
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",
|
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;
|
return editorpad;
|
||||||
}
|
}
|
||||||
|
@ -454,10 +454,7 @@ static void
|
||||||
gst_editor_pad_position_changed(GstEditorPad *pad,
|
gst_editor_pad_position_changed(GstEditorPad *pad,
|
||||||
GstEditorElement *element)
|
GstEditorElement *element)
|
||||||
{
|
{
|
||||||
GList *pads;
|
|
||||||
|
|
||||||
if (pad->connection) {
|
if (pad->connection) {
|
||||||
// g_print("updating pad's connection\n");
|
|
||||||
pad->connection->resize = TRUE;
|
pad->connection->resize = TRUE;
|
||||||
gst_editor_connection_resize(pad->connection);
|
gst_editor_connection_resize(pad->connection);
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,7 +128,8 @@ gst_editor_project_new_from_file (const guchar *fname)
|
||||||
|
|
||||||
editorproject = gst_editor_project_new();
|
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);
|
elements = gst_xml_get_topelements(xml);
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ static void gst_example_get_arg (GtkObject *object,GtkArg *arg,guint id);
|
||||||
GstPadTemplate *src_template, *sink_template;
|
GstPadTemplate *src_template, *sink_template;
|
||||||
|
|
||||||
static GstElementClass *parent_class = NULL;
|
static GstElementClass *parent_class = NULL;
|
||||||
static guint gst_example_signals[LAST_SIGNAL] = { 0 };
|
//static guint gst_example_signals[LAST_SIGNAL] = { 0 };
|
||||||
|
|
||||||
GtkType
|
GtkType
|
||||||
gst_example_get_type(void)
|
gst_example_get_type(void)
|
||||||
|
@ -134,15 +134,13 @@ static void
|
||||||
gst_example_chain (GstPad *pad, GstBuffer *buf)
|
gst_example_chain (GstPad *pad, GstBuffer *buf)
|
||||||
{
|
{
|
||||||
GstExample *example;
|
GstExample *example;
|
||||||
guchar *data;
|
|
||||||
gint i;
|
|
||||||
|
|
||||||
g_return_if_fail(pad != NULL);
|
g_return_if_fail(pad != NULL);
|
||||||
g_return_if_fail(GST_IS_PAD(pad));
|
g_return_if_fail(GST_IS_PAD(pad));
|
||||||
g_return_if_fail(buf != NULL);
|
g_return_if_fail(buf != NULL);
|
||||||
//g_return_if_fail(GST_IS_BUFFER(buf));
|
//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(example != NULL);
|
||||||
g_return_if_fail(GST_IS_EXAMPLE(example));
|
g_return_if_fail(GST_IS_EXAMPLE(example));
|
||||||
|
@ -199,10 +197,10 @@ plugin_init (GModule *module)
|
||||||
GstElementFactory *factory;
|
GstElementFactory *factory;
|
||||||
|
|
||||||
plugin = gst_plugin_new("example");
|
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);
|
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);
|
sink_template = gst_padtemplate_new (&sink_factory);
|
||||||
gst_elementfactory_add_padtemplate (factory, sink_template);
|
gst_elementfactory_add_padtemplate (factory, sink_template);
|
||||||
|
|
|
@ -3,33 +3,40 @@
|
||||||
|
|
||||||
gboolean playing;
|
gboolean playing;
|
||||||
|
|
||||||
/* eos will be called when the src element has an end of stream */
|
static void
|
||||||
void eos(GstElement *element, gpointer data)
|
xml_loaded (GstXML *xml, GstObject *object, gpointer data)
|
||||||
{
|
{
|
||||||
g_print("have eos, quitting\n");
|
if (GST_IS_PAD (object)) {
|
||||||
|
g_print ("pad loaded '%s'\n", gst_pad_get_name (GST_PAD (object)));
|
||||||
playing = FALSE;
|
}
|
||||||
|
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;
|
GstXML *xml;
|
||||||
GstElement *bin;
|
GstElement *bin;
|
||||||
GstElement *disk;
|
gboolean ret;
|
||||||
|
|
||||||
gst_init(&argc,&argv);
|
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");
|
bin = gst_xml_get_element(xml, "bin");
|
||||||
|
g_assert (bin != NULL);
|
||||||
|
|
||||||
gst_element_set_state(bin, GST_STATE_PLAYING);
|
gst_element_set_state(bin, GST_STATE_PLAYING);
|
||||||
|
|
||||||
playing = TRUE;
|
playing = TRUE;
|
||||||
|
|
||||||
while (playing) {
|
while (gst_bin_iterate(GST_BIN(bin)));
|
||||||
gst_bin_iterate(GST_BIN(bin));
|
|
||||||
}
|
|
||||||
|
|
||||||
gst_element_set_state(bin, GST_STATE_NULL);
|
gst_element_set_state(bin, GST_STATE_NULL);
|
||||||
|
|
||||||
|
|
|
@ -218,7 +218,7 @@ gst_asyncdisksrc_get (GstPad *pad)
|
||||||
GstBuffer *buf;
|
GstBuffer *buf;
|
||||||
|
|
||||||
g_return_val_if_fail (pad != NULL, NULL);
|
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);
|
g_return_val_if_fail (GST_FLAG_IS_SET (src, GST_ASYNCDISKSRC_OPEN), NULL);
|
||||||
|
|
||||||
/* deal with EOF state */
|
/* 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);
|
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_IS_ASYNCDISKSRC (src), NULL);
|
||||||
g_return_val_if_fail (GST_FLAG_IS_SET (src, GST_ASYNCDISKSRC_OPEN), NULL);
|
g_return_val_if_fail (GST_FLAG_IS_SET (src, GST_ASYNCDISKSRC_OPEN), NULL);
|
||||||
|
|
|
@ -244,7 +244,7 @@ gst_audiosink_chain (GstPad *pad, GstBuffer *buf)
|
||||||
/* this has to be an audio buffer */
|
/* this has to be an audio buffer */
|
||||||
// g_return_if_fail(((GstMeta *)buf->meta)->type !=
|
// g_return_if_fail(((GstMeta *)buf->meta)->type !=
|
||||||
//gst_audiosink_type_audio);
|
//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));
|
// g_return_if_fail(GST_FLAG_IS_SET(audiosink,GST_STATE_RUNNING));
|
||||||
|
|
||||||
if ((in_flush = GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLUSH))) {
|
if ((in_flush = GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLUSH))) {
|
||||||
|
|
|
@ -149,7 +149,7 @@ gst_audiosrc_get (GstPad *pad)
|
||||||
glong readbytes;
|
glong readbytes;
|
||||||
|
|
||||||
g_return_val_if_fail (pad != NULL, NULL);
|
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");
|
// g_print("attempting to read something from soundcard\n");
|
||||||
|
|
||||||
|
|
|
@ -208,7 +208,7 @@ gst_disksrc_get (GstPad *pad)
|
||||||
glong readbytes;
|
glong readbytes;
|
||||||
|
|
||||||
g_return_val_if_fail (pad != NULL, NULL);
|
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_FLAG_IS_SET (src, GST_DISKSRC_OPEN), NULL);
|
||||||
g_return_val_if_fail (GST_STATE (src) >= GST_STATE_READY, NULL);
|
g_return_val_if_fail (GST_STATE (src) >= GST_STATE_READY, NULL);
|
||||||
|
|
||||||
|
|
|
@ -180,7 +180,7 @@ gst_fakesink_chain (GstPad *pad, GstBuffer *buf)
|
||||||
g_return_if_fail (GST_IS_PAD (pad));
|
g_return_if_fail (GST_IS_PAD (pad));
|
||||||
g_return_if_fail (buf != NULL);
|
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));
|
g_print("fakesink: ******* (%s:%s)< \n",GST_DEBUG_PAD_NAME(pad));
|
||||||
|
|
||||||
gst_buffer_unref (buf);
|
gst_buffer_unref (buf);
|
||||||
|
|
|
@ -269,9 +269,11 @@ gst_fakesrc_get(GstPad *pad)
|
||||||
GstFakeSrc *src;
|
GstFakeSrc *src;
|
||||||
GstBuffer *buf;
|
GstBuffer *buf;
|
||||||
|
|
||||||
g_return_val_if_fail(pad != NULL, 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);
|
src = GST_FAKESRC (gst_pad_get_parent (pad));
|
||||||
|
|
||||||
|
g_return_val_if_fail (GST_IS_FAKESRC (src), NULL);
|
||||||
|
|
||||||
if (src->num_buffers == 0) {
|
if (src->num_buffers == 0) {
|
||||||
gst_pad_set_eos (pad);
|
gst_pad_set_eos (pad);
|
||||||
|
|
|
@ -113,7 +113,7 @@ gst_fdsink_chain (GstPad *pad, GstBuffer *buf)
|
||||||
g_return_if_fail (GST_IS_PAD (pad));
|
g_return_if_fail (GST_IS_PAD (pad));
|
||||||
g_return_if_fail (buf != NULL);
|
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);
|
g_return_if_fail (fdsink->fd >= 0);
|
||||||
|
|
||||||
|
|
|
@ -184,7 +184,7 @@ gst_fdsrc_get(GstPad *pad)
|
||||||
glong readbytes;
|
glong readbytes;
|
||||||
|
|
||||||
g_return_val_if_fail (pad != NULL, NULL);
|
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 */
|
/* create the buffer */
|
||||||
// FIXME: should eventually use a bufferpool for this
|
// FIXME: should eventually use a bufferpool for this
|
||||||
|
|
|
@ -131,7 +131,7 @@ gst_httpsrc_get(GstPad *pad)
|
||||||
glong readbytes;
|
glong readbytes;
|
||||||
|
|
||||||
g_return_val_if_fail (pad != NULL, NULL);
|
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();
|
buf = gst_buffer_new();
|
||||||
GST_BUFFER_DATA(buf) = (gpointer)malloc(src->bytes_per_read);
|
GST_BUFFER_DATA(buf) = (gpointer)malloc(src->bytes_per_read);
|
||||||
|
|
|
@ -120,7 +120,7 @@ gst_identity_chain (GstPad *pad, GstBuffer *buf)
|
||||||
g_return_if_fail (GST_IS_PAD (pad));
|
g_return_if_fail (GST_IS_PAD (pad));
|
||||||
g_return_if_fail (buf != NULL);
|
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));
|
g_print("identity: ******* (%s:%s)i \n",GST_DEBUG_PAD_NAME(pad));
|
||||||
|
|
||||||
gst_pad_push (identity->srcpad, buf);
|
gst_pad_push (identity->srcpad, buf);
|
||||||
|
|
|
@ -118,13 +118,6 @@ static void gst_pipefilter_init(GstPipefilter *pipefilter) {
|
||||||
pipefilter->seq = 0;
|
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) {
|
static gboolean gst_pipefilter_read_and_push(GstPipefilter *pipefilter) {
|
||||||
GstBuffer *newbuf;
|
GstBuffer *newbuf;
|
||||||
glong readbytes;
|
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(GST_IS_PAD(pad));
|
||||||
g_return_if_fail(buf != NULL);
|
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));
|
while (gst_pipefilter_read_and_push(pipefilter));
|
||||||
|
|
||||||
|
|
|
@ -132,18 +132,6 @@ static void gst_sinesrc_init(GstSineSrc *sinesrc) {
|
||||||
sinesrc->sentmeta = FALSE;
|
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 *
|
static GstBuffer *
|
||||||
gst_sinesrc_get(GstPad *pad)
|
gst_sinesrc_get(GstPad *pad)
|
||||||
{
|
{
|
||||||
|
@ -155,7 +143,7 @@ gst_sinesrc_get(GstPad *pad)
|
||||||
gdouble val;
|
gdouble val;
|
||||||
|
|
||||||
g_return_val_if_fail (pad != NULL, NULL);
|
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();
|
buf = gst_buffer_new();
|
||||||
g_return_val_if_fail (buf, NULL);
|
g_return_val_if_fail (buf, NULL);
|
||||||
|
|
|
@ -181,7 +181,7 @@ gst_tee_chain (GstPad *pad, GstBuffer *buf)
|
||||||
g_return_if_fail (GST_IS_PAD (pad));
|
g_return_if_fail (GST_IS_PAD (pad));
|
||||||
g_return_if_fail (buf != NULL);
|
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");
|
gst_trace_add_entry (NULL, 0, buf, "tee buffer");
|
||||||
|
|
||||||
for (i=0; i<tee->numsrcpads-1; i++)
|
for (i=0; i<tee->numsrcpads-1; i++)
|
||||||
|
|
136
gst/gstbin.c
136
gst/gstbin.c
|
@ -28,8 +28,6 @@
|
||||||
|
|
||||||
#include "gstscheduler.h"
|
#include "gstscheduler.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
GstElementDetails gst_bin_details = {
|
GstElementDetails gst_bin_details = {
|
||||||
"Generic bin",
|
"Generic bin",
|
||||||
"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 void gst_bin_create_plan_func (GstBin *bin);
|
||||||
static gboolean gst_bin_iterate_func (GstBin *bin);
|
static gboolean gst_bin_iterate_func (GstBin *bin);
|
||||||
|
|
||||||
static xmlNodePtr gst_bin_save_thyself (GstElement *element, xmlNodePtr parent);
|
static xmlNodePtr gst_bin_save_thyself (GstObject *object, xmlNodePtr parent);
|
||||||
static void gst_bin_restore_thyself (GstElement *element, xmlNodePtr parent,
|
static void gst_bin_restore_thyself (GstObject *object, xmlNodePtr self);
|
||||||
GHashTable *elements);
|
|
||||||
|
|
||||||
/* Bin signals and args */
|
/* Bin signals and args */
|
||||||
enum {
|
enum {
|
||||||
|
@ -99,9 +96,11 @@ static void
|
||||||
gst_bin_class_init (GstBinClass *klass)
|
gst_bin_class_init (GstBinClass *klass)
|
||||||
{
|
{
|
||||||
GtkObjectClass *gtkobject_class;
|
GtkObjectClass *gtkobject_class;
|
||||||
|
GstObjectClass *gstobject_class;
|
||||||
GstElementClass *gstelement_class;
|
GstElementClass *gstelement_class;
|
||||||
|
|
||||||
gtkobject_class = (GtkObjectClass*)klass;
|
gtkobject_class = (GtkObjectClass*)klass;
|
||||||
|
gstobject_class = (GstObjectClass*)klass;
|
||||||
gstelement_class = (GstElementClass*)klass;
|
gstelement_class = (GstElementClass*)klass;
|
||||||
|
|
||||||
parent_class = gtk_type_class (GST_TYPE_ELEMENT);
|
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->schedule = gst_bin_schedule_func;
|
||||||
klass->iterate = gst_bin_iterate_func;
|
klass->iterate = gst_bin_iterate_func;
|
||||||
|
|
||||||
|
gstobject_class->save_thyself = gst_bin_save_thyself;
|
||||||
|
gstobject_class->restore_thyself = gst_bin_restore_thyself;
|
||||||
|
|
||||||
gstelement_class->change_state = gst_bin_change_state;
|
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;
|
gtkobject_class->destroy = gst_bin_real_destroy;
|
||||||
}
|
}
|
||||||
|
@ -180,7 +180,7 @@ gst_bin_add (GstBin *bin,
|
||||||
bin->numchildren++;
|
bin->numchildren++;
|
||||||
gst_object_set_parent (GST_OBJECT (element), GST_OBJECT (bin));
|
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... */
|
/* we know we have at least one child, we just added one... */
|
||||||
// if (GST_STATE(element) < GST_STATE_READY)
|
// 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->children = g_list_remove (bin->children, element);
|
||||||
bin->numchildren--;
|
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 we're down to zero children, force state to NULL */
|
||||||
if (bin->numchildren == 0)
|
if (bin->numchildren == 0)
|
||||||
|
@ -235,7 +235,7 @@ gst_bin_change_state (GstElement *element)
|
||||||
GList *children;
|
GList *children;
|
||||||
GstElement *child;
|
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);
|
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;
|
children = bin->children;
|
||||||
while (children) {
|
while (children) {
|
||||||
child = GST_ELEMENT (children->data);
|
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))) {
|
switch (gst_element_set_state (child, GST_STATE_PENDING (element))) {
|
||||||
case GST_STATE_FAILURE:
|
case GST_STATE_FAILURE:
|
||||||
GST_STATE_PENDING (element) = GST_STATE_NONE_PENDING;
|
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)));
|
GST_STATE_PENDING (element), _gst_print_statename (GST_STATE_PENDING (element)));
|
||||||
return GST_STATE_FAILURE;
|
return GST_STATE_FAILURE;
|
||||||
break;
|
break;
|
||||||
case GST_STATE_ASYNC:
|
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;
|
break;
|
||||||
}
|
}
|
||||||
// g_print("\n");
|
// g_print("\n");
|
||||||
|
@ -355,7 +355,7 @@ gst_bin_set_state_type (GstBin *bin,
|
||||||
GstBinClass *oclass;
|
GstBinClass *oclass;
|
||||||
|
|
||||||
GST_DEBUG (0,"gst_bin_set_state_type(\"%s\",%d,%d)\n",
|
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 (bin != NULL, FALSE);
|
||||||
g_return_val_if_fail (GST_IS_BIN (bin), 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;
|
children = bin->children;
|
||||||
while (children) {
|
while (children) {
|
||||||
child = GST_ELEMENT (children->data);
|
child = GST_ELEMENT (children->data);
|
||||||
if (!strcmp (child->name,name))
|
if (!strcmp (gst_object_get_name (GST_OBJECT (child)),name))
|
||||||
return child;
|
return child;
|
||||||
if (GST_IS_BIN (child)) {
|
if (GST_IS_BIN (child)) {
|
||||||
GstElement *res = gst_bin_get_by_name (GST_BIN (child), name);
|
GstElement *res = gst_bin_get_by_name (GST_BIN (child), name);
|
||||||
|
@ -424,6 +424,41 @@ gst_bin_get_by_name (GstBin *bin,
|
||||||
return NULL;
|
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:
|
* gst_bin_get_list:
|
||||||
* @bin: #Gstbin to get the list from
|
* @bin: #Gstbin to get the list from
|
||||||
|
@ -442,48 +477,46 @@ gst_bin_get_list (GstBin *bin)
|
||||||
}
|
}
|
||||||
|
|
||||||
static xmlNodePtr
|
static xmlNodePtr
|
||||||
gst_bin_save_thyself (GstElement *element,
|
gst_bin_save_thyself (GstObject *object,
|
||||||
xmlNodePtr parent)
|
xmlNodePtr parent)
|
||||||
{
|
{
|
||||||
GstBin *bin = GST_BIN (element);
|
GstBin *bin = GST_BIN (object);
|
||||||
xmlNodePtr childlist;
|
xmlNodePtr childlist, elementnode;
|
||||||
GList *children;
|
GList *children;
|
||||||
GstElement *child;
|
GstElement *child;
|
||||||
|
|
||||||
if (GST_ELEMENT_CLASS (parent_class)->save_thyself)
|
if (GST_OBJECT_CLASS (parent_class)->save_thyself)
|
||||||
GST_ELEMENT_CLASS (parent_class)->save_thyself (GST_ELEMENT (bin), parent);
|
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);
|
GST_INFO_ELEMENT (GST_CAT_XML, bin, "saving %d children", bin->numchildren);
|
||||||
|
|
||||||
children = bin->children;
|
children = bin->children;
|
||||||
while (children) {
|
while (children) {
|
||||||
child = GST_ELEMENT (children->data);
|
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);
|
children = g_list_next (children);
|
||||||
}
|
}
|
||||||
return childlist;
|
return childlist;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_bin_restore_thyself (GstElement *element,
|
gst_bin_restore_thyself (GstObject *object,
|
||||||
xmlNodePtr parent,
|
xmlNodePtr self)
|
||||||
GHashTable *elements)
|
|
||||||
{
|
{
|
||||||
GstBin *bin = GST_BIN (element);
|
GstBin *bin = GST_BIN (object);
|
||||||
xmlNodePtr field = parent->xmlChildrenNode;
|
xmlNodePtr field = self->xmlChildrenNode;
|
||||||
xmlNodePtr childlist;
|
xmlNodePtr childlist;
|
||||||
|
|
||||||
// g_print("gstbin: restore \"%s\"\n", gst_element_get_name (element));
|
|
||||||
|
|
||||||
while (field) {
|
while (field) {
|
||||||
if (!strcmp (field->name, "children")) {
|
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;
|
childlist = field->xmlChildrenNode;
|
||||||
while (childlist) {
|
while (childlist) {
|
||||||
if (!strcmp (childlist->name, "element")) {
|
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);
|
gst_bin_add (bin, element);
|
||||||
}
|
}
|
||||||
|
@ -493,7 +526,6 @@ gst_bin_restore_thyself (GstElement *element,
|
||||||
|
|
||||||
field = field->next;
|
field = field->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -520,14 +552,14 @@ gst_bin_iterate (GstBin *bin)
|
||||||
GstBinClass *oclass;
|
GstBinClass *oclass;
|
||||||
gboolean eos = TRUE;
|
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);
|
oclass = GST_BIN_CLASS (GTK_OBJECT (bin)->klass);
|
||||||
|
|
||||||
if (oclass->iterate)
|
if (oclass->iterate)
|
||||||
eos = (oclass->iterate) (bin);
|
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;
|
return eos;
|
||||||
}
|
}
|
||||||
|
@ -553,7 +585,7 @@ gst_bin_create_plan (GstBin *bin)
|
||||||
static void
|
static void
|
||||||
gst_bin_received_eos (GstElement *element, GstBin *bin)
|
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);
|
bin->num_eos_providers);
|
||||||
|
|
||||||
GST_LOCK (bin);
|
GST_LOCK (bin);
|
||||||
|
@ -599,7 +631,7 @@ gst_bin_create_plan_func (GstBin *bin)
|
||||||
GSList *pending = NULL;
|
GSList *pending = NULL;
|
||||||
GstBin *pending_bin;
|
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");
|
GST_INFO_ELEMENT (GST_CAT_PLANNING, bin, "creating plan");
|
||||||
|
|
||||||
|
@ -612,11 +644,11 @@ gst_bin_create_plan_func (GstBin *bin)
|
||||||
} else {
|
} else {
|
||||||
manager = gst_element_get_manager (GST_ELEMENT (bin));
|
manager = gst_element_get_manager (GST_ELEMENT (bin));
|
||||||
if (!manager) {
|
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);
|
manager = GST_ELEMENT (bin);
|
||||||
GST_FLAG_SET (bin, GST_BIN_FLAG_MANAGER);
|
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);
|
gst_element_set_manager (GST_ELEMENT (bin), manager);
|
||||||
|
|
||||||
|
@ -633,22 +665,22 @@ gst_bin_create_plan_func (GstBin *bin)
|
||||||
element = GST_ELEMENT (elements->data);
|
element = GST_ELEMENT (elements->data);
|
||||||
elements = g_list_next (elements);
|
elements = g_list_next (elements);
|
||||||
#ifdef GST_DEBUG_ENABLED
|
#ifdef GST_DEBUG_ENABLED
|
||||||
elementname = gst_element_get_name (element);
|
elementname = GST_ELEMENT_NAME (element);
|
||||||
#endif
|
#endif
|
||||||
GST_DEBUG (0,"have element \"%s\"\n",elementname);
|
GST_DEBUG (0,"have element \"%s\"\n",elementname);
|
||||||
|
|
||||||
// first set their manager
|
// 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);
|
gst_element_set_manager (element, manager);
|
||||||
|
|
||||||
// we do recursion and such for Bins
|
// we do recursion and such for Bins
|
||||||
if (GST_IS_BIN (element)) {
|
if (GST_IS_BIN (element)) {
|
||||||
// recurse into the child Bin
|
// recurse into the child Bin
|
||||||
GST_DEBUG (0,"recursing into child Bin \"%s\" with manager \"%s\"\n",elementname,
|
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_bin_create_plan (GST_BIN (element));
|
||||||
GST_DEBUG (0,"after recurse got manager \"%s\"\n",
|
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
|
// 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)) {
|
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);
|
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 we're not a manager thread, we're done.
|
||||||
if (!GST_FLAG_IS_SET (bin, GST_BIN_FLAG_MANAGER)) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -697,13 +729,13 @@ gst_bin_create_plan_func (GstBin *bin)
|
||||||
|
|
||||||
// walk the list of elements, find bins, and do stuff
|
// walk the list of elements, find bins, and do stuff
|
||||||
GST_DEBUG (0,"checking Bin \"%s\" for managed elements\n",
|
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;
|
elements = pending_bin->children;
|
||||||
while (elements) {
|
while (elements) {
|
||||||
element = GST_ELEMENT (elements->data);
|
element = GST_ELEMENT (elements->data);
|
||||||
elements = g_list_next (elements);
|
elements = g_list_next (elements);
|
||||||
#ifdef GST_DEBUG_ENABLED
|
#ifdef GST_DEBUG_ENABLED
|
||||||
elementname = gst_element_get_name (element);
|
elementname = GST_ELEMENT_NAME (element);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// if it's ours, add it to the list
|
// if it's ours, add it to the list
|
||||||
|
@ -734,10 +766,10 @@ gst_bin_create_plan_func (GstBin *bin)
|
||||||
gst_bin_schedule(bin);
|
gst_bin_schedule(bin);
|
||||||
|
|
||||||
g_print ("gstbin \"%s\", eos providers:%d\n",
|
g_print ("gstbin \"%s\", eos providers:%d\n",
|
||||||
gst_element_get_name (GST_ELEMENT (bin)),
|
GST_ELEMENT_NAME (bin),
|
||||||
bin->num_eos_providers);
|
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
|
static gboolean
|
||||||
|
@ -753,7 +785,7 @@ gst_bin_iterate_func (GstBin *bin)
|
||||||
gint num_scheduled = 0;
|
gint num_scheduled = 0;
|
||||||
gboolean eos = FALSE;
|
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 (bin != NULL, TRUE);
|
||||||
g_return_val_if_fail (GST_IS_BIN (bin), 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);
|
entry = GST_ELEMENT (chain->elements->data);
|
||||||
GST_FLAG_SET (entry, GST_ELEMENT_COTHREAD_STOPPING);
|
GST_FLAG_SET (entry, GST_ELEMENT_COTHREAD_STOPPING);
|
||||||
GST_DEBUG (0,"set COTHREAD_STOPPING flag on \"%s\"(@%p)\n",
|
GST_DEBUG (0,"set COTHREAD_STOPPING flag on \"%s\"(@%p)\n",
|
||||||
gst_element_get_name(entry),entry);
|
GST_ELEMENT_NAME (entry),entry);
|
||||||
cothread_switch (entry->threadstate);
|
cothread_switch (entry->threadstate);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -789,7 +821,7 @@ gst_bin_iterate_func (GstBin *bin)
|
||||||
entry = GST_ELEMENT (entries->data);
|
entry = GST_ELEMENT (entries->data);
|
||||||
entries = g_list_next (entries);
|
entries = g_list_next (entries);
|
||||||
|
|
||||||
GST_DEBUG (0,"have entry \"%s\"\n",gst_element_get_name(entry));
|
GST_DEBUG (0,"have entry \"%s\"\n",GST_ELEMENT_NAME (entry));
|
||||||
|
|
||||||
if (GST_IS_BIN (entry)) {
|
if (GST_IS_BIN (entry)) {
|
||||||
gst_bin_iterate (GST_BIN (entry));
|
gst_bin_iterate (GST_BIN (entry));
|
||||||
|
@ -800,7 +832,7 @@ gst_bin_iterate_func (GstBin *bin)
|
||||||
if (GST_RPAD_DIRECTION(pad) == GST_PAD_SRC) {
|
if (GST_RPAD_DIRECTION(pad) == GST_PAD_SRC) {
|
||||||
GST_DEBUG (0,"calling getfunc of %s:%s\n",GST_DEBUG_PAD_NAME(pad));
|
GST_DEBUG (0,"calling getfunc of %s:%s\n",GST_DEBUG_PAD_NAME(pad));
|
||||||
if (GST_REAL_PAD(pad)->getfunc == NULL)
|
if (GST_REAL_PAD(pad)->getfunc == NULL)
|
||||||
fprintf(stderr, "error, no getfunc in \"%s\"\n", gst_element_get_name (entry));
|
fprintf(stderr, "error, no getfunc in \"%s\"\n", GST_ELEMENT_NAME (entry));
|
||||||
else
|
else
|
||||||
buf = (GST_REAL_PAD(pad)->getfunc)(pad);
|
buf = (GST_REAL_PAD(pad)->getfunc)(pad);
|
||||||
if (buf) gst_pad_push(pad,buf);
|
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;
|
return !eos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -125,6 +125,8 @@ void gst_bin_remove (GstBin *bin,
|
||||||
/* retrieve a single element or the list of children */
|
/* retrieve a single element or the list of children */
|
||||||
GstElement* gst_bin_get_by_name (GstBin *bin,
|
GstElement* gst_bin_get_by_name (GstBin *bin,
|
||||||
const gchar *name);
|
const gchar *name);
|
||||||
|
GstElement* gst_bin_get_by_name_recurse_up (GstBin *bin,
|
||||||
|
const gchar *name);
|
||||||
GList* gst_bin_get_list (GstBin *bin);
|
GList* gst_bin_get_list (GstBin *bin);
|
||||||
|
|
||||||
void gst_bin_create_plan (GstBin *bin);
|
void gst_bin_create_plan (GstBin *bin);
|
||||||
|
|
|
@ -133,7 +133,7 @@ gst_clock_wait (GstClock *clock, GstClockTime time, GstObject *obj)
|
||||||
|
|
||||||
diff = GST_CLOCK_DIFF (time, now);
|
diff = GST_CLOCK_DIFF (time, now);
|
||||||
// if we are not behind wait a bit
|
// 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);
|
g_mutex_unlock (clock->lock);
|
||||||
if (diff > 10000 ) {
|
if (diff > 10000 ) {
|
||||||
|
@ -143,8 +143,8 @@ gst_clock_wait (GstClock *clock, GstClockTime time, GstObject *obj)
|
||||||
if (!tfnow.tv_sec) {
|
if (!tfnow.tv_sec) {
|
||||||
select(0, NULL, NULL, NULL, &tfnow);
|
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);
|
(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);
|
||||||
}
|
}
|
||||||
|
|
217
gst/gstelement.c
217
gst/gstelement.c
|
@ -49,7 +49,9 @@ 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 GstObjectClass *parent_class = NULL;
|
||||||
static guint gst_element_signals[LAST_SIGNAL] = { 0 };
|
static guint gst_element_signals[LAST_SIGNAL] = { 0 };
|
||||||
|
@ -77,8 +79,10 @@ static void
|
||||||
gst_element_class_init (GstElementClass *klass)
|
gst_element_class_init (GstElementClass *klass)
|
||||||
{
|
{
|
||||||
GtkObjectClass *gtkobject_class;
|
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);
|
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);
|
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->change_state = gst_element_change_state;
|
||||||
klass->elementfactory = NULL;
|
klass->elementfactory = NULL;
|
||||||
|
|
||||||
gtkobject_class->destroy = gst_element_real_destroy;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -142,6 +148,78 @@ gst_element_new(void)
|
||||||
return GST_ELEMENT (gtk_type_new (GST_TYPE_ELEMENT));
|
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:
|
* gst_element_add_pad:
|
||||||
* @element: element to add pad to
|
* @element: element to add pad to
|
||||||
|
@ -160,8 +238,8 @@ gst_element_add_pad (GstElement *element, GstPad *pad)
|
||||||
|
|
||||||
/* set the pad's parent */
|
/* set the pad's parent */
|
||||||
GST_DEBUG (0,"setting parent of pad '%s'(%p) to '%s'(%p)\n",
|
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_NAME (pad), pad, GST_ELEMENT_NAME (element), element);
|
||||||
gst_pad_set_parent (pad,GST_OBJECT (element));
|
gst_object_set_parent (GST_OBJECT (pad), GST_OBJECT (element));
|
||||||
|
|
||||||
/* add it to the list */
|
/* add it to the list */
|
||||||
element->pads = g_list_append (element->pads, pad);
|
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);
|
ghostpad = gst_ghost_pad_new (name, pad);
|
||||||
|
|
||||||
/* add it to the list */
|
/* 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->pads = g_list_append (element->pads, ghostpad);
|
||||||
element->numpads++;
|
element->numpads++;
|
||||||
// set the parent of the ghostpad
|
// 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));
|
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;
|
return NULL;
|
||||||
|
|
||||||
GST_DEBUG(GST_CAT_ELEMENT_PADS,"searching for pad '%s' in element %s\n",
|
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
|
// look through the list, matching by name
|
||||||
walk = element->pads;
|
walk = element->pads;
|
||||||
while (walk) {
|
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);
|
GST_DEBUG(GST_CAT_ELEMENT_PADS,"found pad '%s'\n",name);
|
||||||
return GST_PAD(walk->data);
|
return pad;
|
||||||
}
|
}
|
||||||
walk = g_list_next (walk);
|
walk = g_list_next (walk);
|
||||||
}
|
}
|
||||||
|
@ -521,7 +600,7 @@ gst_element_connect (GstElement *src, const gchar *srcpadname,
|
||||||
/*
|
/*
|
||||||
if (srcparent != destparent) {
|
if (srcparent != destparent) {
|
||||||
GST_ERROR_OBJECT(srcparent,destparent,"%s and %s have different parents",
|
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;
|
return;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
@ -579,7 +658,7 @@ gst_element_disconnect (GstElement *src, const gchar *srcpadname,
|
||||||
void
|
void
|
||||||
gst_element_error (GstElement *element, const gchar *error)
|
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!!! */
|
/* 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 */
|
/* if that outright didn't work, we need to bail right away */
|
||||||
/* NOTE: this will bail on ASYNC as well! */
|
/* NOTE: this will bail on ASYNC as well! */
|
||||||
if (return_val == GST_STATE_FAILURE) {
|
if (return_val == GST_STATE_FAILURE) {
|
||||||
// GST_DEBUG (0,"have async return from '%s'\n",gst_element_get_name(element));
|
// GST_DEBUG (0,"have async return from '%s'\n",GST_ELEMENT_NAME (element));
|
||||||
return return_val;
|
return return_val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -688,44 +767,6 @@ gst_element_change_state (GstElement *element)
|
||||||
return TRUE;
|
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
|
static void
|
||||||
gst_element_real_destroy (GtkObject *object)
|
gst_element_real_destroy (GtkObject *object)
|
||||||
{
|
{
|
||||||
|
@ -735,9 +776,6 @@ gst_element_real_destroy (GtkObject *object)
|
||||||
|
|
||||||
// g_print("in gst_element_real_destroy()\n");
|
// g_print("in gst_element_real_destroy()\n");
|
||||||
|
|
||||||
if (element->name)
|
|
||||||
g_free (element->name);
|
|
||||||
|
|
||||||
pads = element->pads;
|
pads = element->pads;
|
||||||
while (pads) {
|
while (pads) {
|
||||||
pad = GST_PAD (pads->data);
|
pad = GST_PAD (pads->data);
|
||||||
|
@ -774,25 +812,30 @@ static gchar *_gst_element_type_names[] = {
|
||||||
*
|
*
|
||||||
* Returns: the new xml node
|
* Returns: the new xml node
|
||||||
*/
|
*/
|
||||||
xmlNodePtr
|
static xmlNodePtr
|
||||||
gst_element_save_thyself (GstElement *element,
|
gst_element_save_thyself (GstObject *object,
|
||||||
xmlNodePtr parent)
|
xmlNodePtr parent)
|
||||||
{
|
{
|
||||||
xmlNodePtr self;
|
|
||||||
GList *pads;
|
GList *pads;
|
||||||
GstPad *pad;
|
|
||||||
GstElementClass *oclass;
|
GstElementClass *oclass;
|
||||||
GstElementFactory *factory;
|
|
||||||
GtkType type;
|
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);
|
oclass = GST_ELEMENT_CLASS (GTK_OBJECT (element)->klass);
|
||||||
|
|
||||||
self = xmlNewChild (parent, NULL, "element", NULL);
|
xmlNewChild(parent, NULL, "name", gst_object_get_name (GST_OBJECT (element)));
|
||||||
xmlNewChild(self, NULL, "name", element->name);
|
|
||||||
if (oclass->elementfactory != NULL) {
|
if (oclass->elementfactory != NULL) {
|
||||||
factory = (GstElementFactory *)oclass->elementfactory;
|
GstElementFactory *factory = (GstElementFactory *)oclass->elementfactory;
|
||||||
xmlNewChild (self, NULL, "type", factory->name);
|
|
||||||
xmlNewChild (self, NULL, "version", factory->details->version);
|
xmlNewChild (parent, NULL, "type", factory->name);
|
||||||
|
xmlNewChild (parent, NULL, "version", factory->details->version);
|
||||||
}
|
}
|
||||||
|
|
||||||
// output all args to the element
|
// output all args to the element
|
||||||
|
@ -806,11 +849,10 @@ gst_element_save_thyself (GstElement *element,
|
||||||
|
|
||||||
for (i=0; i<num_args; i++) {
|
for (i=0; i<num_args; i++) {
|
||||||
if ((args[i].type > GTK_TYPE_NONE) &&
|
if ((args[i].type > GTK_TYPE_NONE) &&
|
||||||
//(args[i].type <= GTK_TYPE_STRING) &&
|
|
||||||
(flags[i] & GTK_ARG_READABLE)) {
|
(flags[i] & GTK_ARG_READABLE)) {
|
||||||
xmlNodePtr arg;
|
xmlNodePtr arg;
|
||||||
gtk_object_getv (GTK_OBJECT (element), 1, &args[i]);
|
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);
|
xmlNewChild (arg, NULL, "name", args[i].name);
|
||||||
switch (args[i].type) {
|
switch (args[i].type) {
|
||||||
case GTK_TYPE_CHAR:
|
case GTK_TYPE_CHAR:
|
||||||
|
@ -861,24 +903,20 @@ gst_element_save_thyself (GstElement *element,
|
||||||
|
|
||||||
pads = element->pads;
|
pads = element->pads;
|
||||||
while (pads) {
|
while (pads) {
|
||||||
xmlNodePtr padtag = xmlNewChild (self, NULL, "pad", NULL);
|
GstPad *pad = GST_PAD (pads->data);
|
||||||
pad = GST_PAD (pads->data);
|
xmlNodePtr padtag = xmlNewChild (parent, NULL, "pad", NULL);
|
||||||
// figure out if it's a direct pad or a ghostpad
|
// figure out if it's a direct pad or a ghostpad
|
||||||
if (GST_ELEMENT (pad->parent) == element)
|
if (GST_ELEMENT (GST_OBJECT_PARENT (pad)) == element)
|
||||||
gst_pad_save_thyself (pad, padtag);
|
gst_object_save_thyself (GST_OBJECT (pad), padtag);
|
||||||
pads = g_list_next (pads);
|
pads = g_list_next (pads);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return parent;
|
||||||
if (oclass->save_thyself)
|
|
||||||
(oclass->save_thyself)(element, self);
|
|
||||||
|
|
||||||
return self;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_element_load_thyself:
|
* gst_element_load_thyself:
|
||||||
* @parent: the xml parent node
|
* @self: the xml node
|
||||||
* @elements: a hashtable to store the elements in. This is used
|
* @elements: a hashtable to store the elements in. This is used
|
||||||
* to resolve inter element dependecies during the loading.
|
* to resolve inter element dependecies during the loading.
|
||||||
*
|
*
|
||||||
|
@ -887,12 +925,11 @@ gst_element_save_thyself (GstElement *element,
|
||||||
* Returns: the new element
|
* Returns: the new element
|
||||||
*/
|
*/
|
||||||
GstElement*
|
GstElement*
|
||||||
gst_element_load_thyself (xmlNodePtr parent,
|
gst_element_load_thyself (xmlNodePtr self, GstObject *parent)
|
||||||
GHashTable *elements)
|
|
||||||
{
|
{
|
||||||
xmlNodePtr children = parent->xmlChildrenNode;
|
xmlNodePtr children = self->xmlChildrenNode;
|
||||||
GstElement *element;
|
GstElement *element;
|
||||||
GstElementClass *oclass;
|
GstObjectClass *oclass;
|
||||||
guchar *name = NULL;
|
guchar *name = NULL;
|
||||||
guchar *value = NULL;
|
guchar *value = NULL;
|
||||||
guchar *type = NULL;
|
guchar *type = NULL;
|
||||||
|
@ -915,10 +952,13 @@ gst_element_load_thyself (xmlNodePtr parent,
|
||||||
|
|
||||||
g_return_val_if_fail (element != NULL, NULL);
|
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
|
// we have the element now, set the arguments
|
||||||
children = parent->xmlChildrenNode;
|
children = self->xmlChildrenNode;
|
||||||
|
|
||||||
while (children) {
|
while (children) {
|
||||||
if (!strcmp (children->name, "arg")) {
|
if (!strcmp (children->name, "arg")) {
|
||||||
|
@ -1009,18 +1049,21 @@ gst_element_load_thyself (xmlNodePtr parent,
|
||||||
children = children->next;
|
children = children->next;
|
||||||
}
|
}
|
||||||
// we have the element now, set the pads
|
// we have the element now, set the pads
|
||||||
children = parent->xmlChildrenNode;
|
children = self->xmlChildrenNode;
|
||||||
|
|
||||||
while (children) {
|
while (children) {
|
||||||
if (!strcmp (children->name, "pad")) {
|
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;
|
children = children->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
oclass = GST_ELEMENT_CLASS (GTK_OBJECT (element)->klass);
|
oclass = GST_OBJECT_CLASS (GTK_OBJECT (element)->klass);
|
||||||
if (oclass->restore_thyself)
|
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;
|
return element;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,6 @@
|
||||||
#include <gst/gstpad.h>
|
#include <gst/gstpad.h>
|
||||||
#include <gst/cothreads.h>
|
#include <gst/cothreads.h>
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#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_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_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 _GstElement GstElement;
|
||||||
typedef struct _GstElementClass GstElementClass;
|
typedef struct _GstElementClass GstElementClass;
|
||||||
|
@ -132,8 +133,6 @@ typedef void (*GstElementLoopFunction) (GstElement *element);
|
||||||
struct _GstElement {
|
struct _GstElement {
|
||||||
GstObject object;
|
GstObject object;
|
||||||
|
|
||||||
gchar *name;
|
|
||||||
|
|
||||||
guint8 current_state;
|
guint8 current_state;
|
||||||
guint8 pending_state;
|
guint8 pending_state;
|
||||||
|
|
||||||
|
@ -165,10 +164,6 @@ struct _GstElementClass {
|
||||||
GstElementStateReturn (*change_state) (GstElement *element);
|
GstElementStateReturn (*change_state) (GstElement *element);
|
||||||
/* request a new pad */
|
/* request a new pad */
|
||||||
GstPad* (*request_new_pad) (GstElement *element, GstPadTemplate *templ);
|
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 {
|
struct _GstElementDetails {
|
||||||
|
@ -200,6 +195,9 @@ void gst_element_set_loop_function (GstElement *element,
|
||||||
void gst_element_set_name (GstElement *element, const gchar *name);
|
void gst_element_set_name (GstElement *element, const gchar *name);
|
||||||
const gchar* gst_element_get_name (GstElement *element);
|
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);
|
void gst_element_set_manager (GstElement *element, GstElement *manager);
|
||||||
GstElement* gst_element_get_manager (GstElement *element);
|
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);
|
GstElementFactory* gst_element_get_factory (GstElement *element);
|
||||||
|
|
||||||
/* XML write and read */
|
/* XML write and read */
|
||||||
xmlNodePtr gst_element_save_thyself (GstElement *element, xmlNodePtr parent);
|
GstElement* gst_element_load_thyself (xmlNodePtr self, GstObject *parent);
|
||||||
GstElement* gst_element_load_thyself (xmlNodePtr parent, GHashTable *elements);
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -167,7 +167,7 @@ gst_elementfactory_create (GstElementFactory *factory,
|
||||||
oclass->elementfactory = factory;
|
oclass->elementfactory = factory;
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_element_set_name(GST_ELEMENT(element),name);
|
gst_object_set_name (GST_OBJECT (element),name);
|
||||||
|
|
||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "gst_private.h"
|
#include "gst_private.h"
|
||||||
#include "gst.h"
|
#include "gstelement.h"
|
||||||
|
#include "gstpad.h"
|
||||||
|
|
||||||
extern gchar *_gst_progname;
|
extern gchar *_gst_progname;
|
||||||
|
|
||||||
|
@ -91,7 +92,7 @@ gst_default_info_handler (gint category, gchar *file, gchar *function,
|
||||||
if (category != GST_CAT_GST_INIT)
|
if (category != GST_CAT_GST_INIT)
|
||||||
location = g_strdup_printf("%s:%d%s:",function,line,debug_string);
|
location = g_strdup_printf("%s:%d%s:",function,line,debug_string);
|
||||||
if (element && GST_IS_ELEMENT (element))
|
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);
|
fprintf(stderr,"INFO:%s%s %s\n",location,elementname,string);
|
||||||
|
|
||||||
|
|
|
@ -110,9 +110,9 @@ G_GNUC_UNUSED static gchar *_debug_string = NULL;
|
||||||
|
|
||||||
/********** some convenience macros for debugging **********/
|
/********** some convenience macros for debugging **********/
|
||||||
#define GST_DEBUG_PAD_NAME(pad) \
|
#define GST_DEBUG_PAD_NAME(pad) \
|
||||||
(GST_PAD_PARENT(pad) != NULL) ? \
|
(GST_OBJECT_PARENT(pad) != NULL) ? \
|
||||||
gst_element_get_name(GST_ELEMENT(GST_PAD_PARENT(pad))) : \
|
GST_OBJECT_NAME (GST_OBJECT_PARENT(pad)) : \
|
||||||
"''", gst_pad_get_name((GstPad*)pad)
|
"''", GST_OBJECT_NAME (pad)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
227
gst/gstobject.c
227
gst/gstobject.c
|
@ -23,8 +23,6 @@
|
||||||
#include "gst_private.h"
|
#include "gst_private.h"
|
||||||
|
|
||||||
#include "gstobject.h"
|
#include "gstobject.h"
|
||||||
#include "gstpad.h"
|
|
||||||
#include "gstelement.h"
|
|
||||||
|
|
||||||
/* Object signals and args */
|
/* Object signals and args */
|
||||||
enum {
|
enum {
|
||||||
|
@ -38,14 +36,15 @@ enum {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static void gst_object_class_init(GstObjectClass *klass);
|
static void gst_object_class_init (GstObjectClass *klass);
|
||||||
static void gst_object_init(GstObject *object);
|
static void gst_object_init (GstObject *object);
|
||||||
|
|
||||||
|
|
||||||
static GtkObjectClass *parent_class = NULL;
|
static GtkObjectClass *parent_class = NULL;
|
||||||
static guint gst_object_signals[LAST_SIGNAL] = { 0 };
|
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;
|
static GtkType object_type = 0;
|
||||||
|
|
||||||
if (!object_type) {
|
if (!object_type) {
|
||||||
|
@ -64,22 +63,28 @@ GtkType gst_object_get_type(void) {
|
||||||
return object_type;
|
return object_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gst_object_class_init(GstObjectClass *klass) {
|
static void
|
||||||
|
gst_object_class_init (GstObjectClass *klass)
|
||||||
|
{
|
||||||
GtkObjectClass *gtkobject_class;
|
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] =
|
gst_object_signals[PARENT_SET] =
|
||||||
gtk_signal_new("parent_set",GTK_RUN_LAST,gtkobject_class->type,
|
gtk_signal_new ("parent_set", GTK_RUN_LAST, gtkobject_class->type,
|
||||||
GTK_SIGNAL_OFFSET(GstObjectClass,parent_set),
|
GTK_SIGNAL_OFFSET (GstObjectClass, parent_set),
|
||||||
gtk_marshal_NONE__POINTER,GTK_TYPE_NONE,1,
|
gtk_marshal_NONE__POINTER, GTK_TYPE_NONE, 1,
|
||||||
GST_TYPE_OBJECT);
|
GST_TYPE_OBJECT);
|
||||||
gtk_object_class_add_signals(gtkobject_class,gst_object_signals,LAST_SIGNAL);
|
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();
|
object->lock = g_mutex_new();
|
||||||
#ifdef HAVE_ATOMIC_H
|
#ifdef HAVE_ATOMIC_H
|
||||||
atomic_set(&(object->refcount),1);
|
atomic_set(&(object->refcount),1);
|
||||||
|
@ -96,8 +101,47 @@ static void gst_object_init(GstObject *object) {
|
||||||
*
|
*
|
||||||
* Returns: new object
|
* Returns: new object
|
||||||
*/
|
*/
|
||||||
GstObject *gst_object_new() {
|
GstObject*
|
||||||
return GST_OBJECT(gtk_type_new(gst_object_get_type()));
|
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.
|
* incremented.
|
||||||
* signals the parent-set signal
|
* signals the parent-set signal
|
||||||
*/
|
*/
|
||||||
void gst_object_set_parent(GstObject *object,GstObject *parent) {
|
void
|
||||||
g_return_if_fail(object != NULL);
|
gst_object_set_parent (GstObject *object, GstObject *parent)
|
||||||
g_return_if_fail(GST_IS_OBJECT(object));
|
{
|
||||||
g_return_if_fail(parent != NULL);
|
g_return_if_fail (object != NULL);
|
||||||
g_return_if_fail(GST_IS_OBJECT(parent));
|
g_return_if_fail (GST_IS_OBJECT (object));
|
||||||
g_return_if_fail(object != parent);
|
g_return_if_fail (parent != NULL);
|
||||||
|
g_return_if_fail (GST_IS_OBJECT (parent));
|
||||||
|
g_return_if_fail (object != parent);
|
||||||
|
|
||||||
if (object->parent != NULL) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_object_ref(object);
|
gst_object_ref (object);
|
||||||
gst_object_sink(object);
|
gst_object_sink (object);
|
||||||
object->parent = parent;
|
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
|
* Returns: parent of the object
|
||||||
*/
|
*/
|
||||||
GstObject *gst_object_get_parent(GstObject *object) {
|
GstObject*
|
||||||
g_return_val_if_fail(object != NULL, NULL);
|
gst_object_get_parent (GstObject *object)
|
||||||
g_return_val_if_fail(GST_IS_OBJECT(object), NULL);
|
{
|
||||||
|
g_return_val_if_fail (object != NULL, NULL);
|
||||||
|
g_return_val_if_fail (GST_IS_OBJECT (object), NULL);
|
||||||
|
|
||||||
return object->parent;
|
return object->parent;
|
||||||
}
|
}
|
||||||
|
@ -149,14 +197,16 @@ GstObject *gst_object_get_parent(GstObject *object) {
|
||||||
*
|
*
|
||||||
* Clear the parent of the object, removing the associated reference.
|
* Clear the parent of the object, removing the associated reference.
|
||||||
*/
|
*/
|
||||||
void gst_object_unparent(GstObject *object) {
|
void
|
||||||
g_return_if_fail(object != NULL);
|
gst_object_unparent (GstObject *object)
|
||||||
g_return_if_fail(GST_IS_OBJECT(object));
|
{
|
||||||
|
g_return_if_fail (object != NULL);
|
||||||
|
g_return_if_fail (GST_IS_OBJECT(object));
|
||||||
if (object->parent == NULL)
|
if (object->parent == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
object->parent = NULL;
|
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.
|
* Increments the refence count on the object.
|
||||||
*/
|
*/
|
||||||
#ifndef gst_object_ref
|
#ifndef gst_object_ref
|
||||||
void gst_object_ref (GstObject *object) {
|
void
|
||||||
g_return_if_fail(object != NULL);
|
gst_object_ref (GstObject *object)
|
||||||
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
|
#ifdef HAVE_ATOMIC_H
|
||||||
g_return_if_fail(atomic_read(&(object->refcount)) > 0);
|
g_return_if_fail (atomic_read (&(object->refcount)) > 0);
|
||||||
atomic_inc(&(object->refcount))
|
atomic_inc (&(object->refcount))
|
||||||
#else
|
#else
|
||||||
g_return_if_fail(object->refcount > 0);
|
g_return_if_fail (object->refcount > 0);
|
||||||
GST_LOCK(object);
|
GST_LOCK (object);
|
||||||
object->refcount++;
|
object->refcount++;
|
||||||
GST_UNLOCK(object);
|
GST_UNLOCK (object);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif /* gst_object_ref */
|
#endif /* gst_object_ref */
|
||||||
|
@ -190,36 +242,38 @@ void gst_object_ref (GstObject *object) {
|
||||||
* zero, destroy the object.
|
* zero, destroy the object.
|
||||||
*/
|
*/
|
||||||
#ifndef gst_object_unref
|
#ifndef gst_object_unref
|
||||||
void gst_object_unref (GstObject *object) {
|
void
|
||||||
|
gst_object_unref (GstObject *object)
|
||||||
|
{
|
||||||
int reftest;
|
int reftest;
|
||||||
|
|
||||||
g_return_if_fail(object != NULL);
|
g_return_if_fail (object != NULL);
|
||||||
g_return_if_fail(GST_IS_OBJECT(object));
|
g_return_if_fail (GST_IS_OBJECT (object));
|
||||||
|
|
||||||
#ifdef HAVE_ATOMIC_H
|
#ifdef HAVE_ATOMIC_H
|
||||||
g_return_if_fail(atomic_read(&(object->refcount)) > 0);
|
g_return_if_fail (atomic_read (&(object->refcount)) > 0);
|
||||||
reftest = atomic_dec_and_test(&(object->refcount))
|
reftest = atomic_dec_and_test (&(object->refcount))
|
||||||
#else
|
#else
|
||||||
g_return_if_fail(object->refcount > 0);
|
g_return_if_fail (object->refcount > 0);
|
||||||
GST_LOCK(object);
|
GST_LOCK (object);
|
||||||
object->refcount--;
|
object->refcount--;
|
||||||
reftest = (object->refcount == 0);
|
reftest = (object->refcount == 0);
|
||||||
GST_UNLOCK(object);
|
GST_UNLOCK (object);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* if we ended up with the refcount at zero */
|
/* if we ended up with the refcount at zero */
|
||||||
if (reftest) {
|
if (reftest) {
|
||||||
/* get the count to 1 for gtk_object_destroy() */
|
/* get the count to 1 for gtk_object_destroy() */
|
||||||
#ifdef HAVE_ATOMIC_H
|
#ifdef HAVE_ATOMIC_H
|
||||||
atomic_set(&(object->refcount),1);
|
atomic_set (&(object->refcount),1);
|
||||||
#else
|
#else
|
||||||
object->refcount = 1;
|
object->refcount = 1;
|
||||||
#endif
|
#endif
|
||||||
/* destroy it */
|
/* destroy it */
|
||||||
gtk_object_destroy(GTK_OBJECT(object));
|
gtk_object_destroy (GTK_OBJECT (object));
|
||||||
/* drop the refcount back to zero */
|
/* drop the refcount back to zero */
|
||||||
#ifdef HAVE_ATOMIC_H
|
#ifdef HAVE_ATOMIC_H
|
||||||
atomic_set(&(object->refcount),0);
|
atomic_set (&(object->refcount),0);
|
||||||
#else
|
#else
|
||||||
object->refcount = 0;
|
object->refcount = 0;
|
||||||
#endif
|
#endif
|
||||||
|
@ -240,17 +294,41 @@ void gst_object_unref (GstObject *object) {
|
||||||
* creating a new object to symbolically 'take ownership of' the object.
|
* creating a new object to symbolically 'take ownership of' the object.
|
||||||
*/
|
*/
|
||||||
#ifndef gst_object_sink
|
#ifndef gst_object_sink
|
||||||
void gst_object_sink(GstObject *object) {
|
void
|
||||||
g_return_if_fail(object != NULL);
|
gst_object_sink (GstObject *object)
|
||||||
g_return_if_fail(GST_IS_OBJECT(object));
|
{
|
||||||
|
g_return_if_fail (object != NULL);
|
||||||
|
g_return_if_fail (GST_IS_OBJECT (object));
|
||||||
|
|
||||||
if (GTK_OBJECT_FLOATING(object)) {
|
if (GTK_OBJECT_FLOATING (object)) {
|
||||||
GTK_OBJECT_UNSET_FLAGS(object, GTK_FLOATING);
|
GTK_OBJECT_UNSET_FLAGS (object, GTK_FLOATING);
|
||||||
gst_object_unref(object);
|
gst_object_unref (object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* gst_object_sink */
|
#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:
|
* gst_object_get_path_string:
|
||||||
|
@ -262,7 +340,7 @@ void gst_object_sink(GstObject *object) {
|
||||||
* Returns: a string describing the path of the object
|
* Returns: a string describing the path of the object
|
||||||
*/
|
*/
|
||||||
gchar*
|
gchar*
|
||||||
gst_object_get_path_string(GstObject *object)
|
gst_object_get_path_string (GstObject *object)
|
||||||
{
|
{
|
||||||
GSList *parentage = NULL;
|
GSList *parentage = NULL;
|
||||||
GSList *parents;
|
GSList *parents;
|
||||||
|
@ -276,14 +354,8 @@ gst_object_get_path_string(GstObject *object)
|
||||||
|
|
||||||
// first walk the object hierarchy to build a list of the parents
|
// first walk the object hierarchy to build a list of the parents
|
||||||
do {
|
do {
|
||||||
if (GST_IS_OBJECT(object)) {
|
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);
|
parent = gst_object_get_parent (object);
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
parentage = g_slist_prepend (parentage, NULL);
|
parentage = g_slist_prepend (parentage, NULL);
|
||||||
parent = NULL;
|
parent = NULL;
|
||||||
|
@ -299,21 +371,12 @@ gst_object_get_path_string(GstObject *object)
|
||||||
// then walk the parent list and print them out
|
// then walk the parent list and print them out
|
||||||
parents = parentage;
|
parents = parentage;
|
||||||
while (parents) {
|
while (parents) {
|
||||||
if (GST_IS_OBJECT(parents->data)) {
|
if (GST_IS_OBJECT (parents->data)) {
|
||||||
if (GST_IS_PAD(parents->data)) {
|
GstObjectClass *oclass = GST_OBJECT_CLASS (GTK_OBJECT (parents->data));
|
||||||
component = gst_pad_get_name(GST_PAD(parents->data));
|
|
||||||
separator = ".";
|
component = GST_OBJECT_NAME (parents->data);
|
||||||
|
separator = oclass->path_string_separator;
|
||||||
free_component = FALSE;
|
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;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
component = g_strdup_printf("%p",parents->data);
|
component = g_strdup_printf("%p",parents->data);
|
||||||
separator = "/";
|
separator = "/";
|
||||||
|
@ -321,7 +384,7 @@ gst_object_get_path_string(GstObject *object)
|
||||||
}
|
}
|
||||||
|
|
||||||
prevpath = path;
|
prevpath = path;
|
||||||
path = g_strjoin(separator,prevpath,component,NULL);
|
path = g_strjoin (separator, prevpath, component, NULL);
|
||||||
g_free(prevpath);
|
g_free(prevpath);
|
||||||
if (free_component)
|
if (free_component)
|
||||||
g_free((gchar *)component);
|
g_free((gchar *)component);
|
||||||
|
@ -329,7 +392,7 @@ gst_object_get_path_string(GstObject *object)
|
||||||
parents = g_slist_next(parents);
|
parents = g_slist_next(parents);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_slist_free(parentage);
|
g_slist_free (parentage);
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include <gst/gsttrace.h>
|
#include <gst/gsttrace.h>
|
||||||
|
#include <parser.h>
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
@ -62,6 +63,7 @@ typedef struct _GstObjectClass GstObjectClass;
|
||||||
struct _GstObject {
|
struct _GstObject {
|
||||||
GtkObject object;
|
GtkObject object;
|
||||||
|
|
||||||
|
gchar *name;
|
||||||
/* have to have a refcount for the object */
|
/* have to have a refcount for the object */
|
||||||
#ifdef HAVE_ATOMIC_H
|
#ifdef HAVE_ATOMIC_H
|
||||||
atomic_t refcount;
|
atomic_t refcount;
|
||||||
|
@ -79,32 +81,47 @@ struct _GstObject {
|
||||||
struct _GstObjectClass {
|
struct _GstObjectClass {
|
||||||
GtkObjectClass parent_class;
|
GtkObjectClass parent_class;
|
||||||
|
|
||||||
|
gchar *path_string_separator;
|
||||||
|
|
||||||
/* signals */
|
/* signals */
|
||||||
void (*parent_set) (GstObject *object,GstObject *parent);
|
void (*parent_set) (GstObject *object, GstObject *parent);
|
||||||
|
|
||||||
/* functions go here */
|
/* 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_FLAGS(obj) GTK_OBJECT_FLAGS(obj)
|
||||||
#define GST_FLAG_IS_SET(obj,flag) (GST_FLAGS (obj) & (1<<(flag)))
|
#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_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
|
#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_LOCK(obj) (g_mutex_lock(GST_OBJECT(obj)->lock))
|
||||||
#define GST_TRYLOCK(obj) (g_mutex_trylock(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_UNLOCK(obj) (g_mutex_unlock(GST_OBJECT(obj)->lock))
|
||||||
|
#define GST_GET_LOCK(obj) (GST_OBJECT(obj)->lock)
|
||||||
|
|
||||||
|
|
||||||
/* normal GtkObject stuff */
|
/* normal GtkObject stuff */
|
||||||
GtkType gst_object_get_type (void);
|
GtkType gst_object_get_type (void);
|
||||||
GstObject* gst_object_new (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 */
|
/* 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);
|
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 */
|
/* refcounting */
|
||||||
#define gst_object_ref(object) gtk_object_ref(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_unref(object) gtk_object_unref(GTK_OBJECT(object));
|
||||||
|
|
130
gst/gstpad.c
130
gst/gstpad.c
|
@ -26,12 +26,16 @@
|
||||||
#include "gstpad.h"
|
#include "gstpad.h"
|
||||||
#include "gstelement.h"
|
#include "gstelement.h"
|
||||||
#include "gsttype.h"
|
#include "gsttype.h"
|
||||||
|
#include "gstbin.h"
|
||||||
|
|
||||||
|
|
||||||
/***** Start with the base GstPad class *****/
|
/***** Start with the base GstPad class *****/
|
||||||
static void gst_pad_class_init (GstPadClass *klass);
|
static void gst_pad_class_init (GstPadClass *klass);
|
||||||
static void gst_pad_init (GstPad *pad);
|
static void gst_pad_init (GstPad *pad);
|
||||||
|
|
||||||
|
static xmlNodePtr gst_pad_save_thyself (GstObject *object, xmlNodePtr parent);
|
||||||
|
|
||||||
|
|
||||||
static GstObject *pad_parent_class = NULL;
|
static GstObject *pad_parent_class = NULL;
|
||||||
|
|
||||||
GtkType
|
GtkType
|
||||||
|
@ -63,9 +67,7 @@ gst_pad_class_init (GstPadClass *klass)
|
||||||
static void
|
static void
|
||||||
gst_pad_init (GstPad *pad)
|
gst_pad_init (GstPad *pad)
|
||||||
{
|
{
|
||||||
pad->name = NULL;
|
|
||||||
pad->element_private = NULL;
|
pad->element_private = NULL;
|
||||||
pad->parent = NULL;
|
|
||||||
|
|
||||||
pad->padtemplate = NULL;
|
pad->padtemplate = NULL;
|
||||||
}
|
}
|
||||||
|
@ -126,8 +128,10 @@ static void
|
||||||
gst_real_pad_class_init (GstRealPadClass *klass)
|
gst_real_pad_class_init (GstRealPadClass *klass)
|
||||||
{
|
{
|
||||||
GtkObjectClass *gtkobject_class;
|
GtkObjectClass *gtkobject_class;
|
||||||
|
GstObjectClass *gstobject_class;
|
||||||
|
|
||||||
gtkobject_class = (GtkObjectClass*)klass;
|
gtkobject_class = (GtkObjectClass*)klass;
|
||||||
|
gstobject_class = (GstObjectClass*)klass;
|
||||||
|
|
||||||
real_pad_parent_class = gtk_type_class(GST_TYPE_PAD);
|
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->destroy = gst_real_pad_destroy;
|
||||||
gtkobject_class->set_arg = gst_real_pad_set_arg;
|
gtkobject_class->set_arg = gst_real_pad_set_arg;
|
||||||
gtkobject_class->get_arg = gst_real_pad_get_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
|
static void
|
||||||
|
@ -228,7 +235,7 @@ gst_pad_new (gchar *name,
|
||||||
g_return_val_if_fail (direction != GST_PAD_UNKNOWN, NULL);
|
g_return_val_if_fail (direction != GST_PAD_UNKNOWN, NULL);
|
||||||
|
|
||||||
pad = gtk_type_new (gst_real_pad_get_type ());
|
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;
|
GST_RPAD_DIRECTION(pad) = direction;
|
||||||
|
|
||||||
return GST_PAD(pad);
|
return GST_PAD(pad);
|
||||||
|
@ -290,10 +297,7 @@ gst_pad_set_name (GstPad *pad,
|
||||||
g_return_if_fail (pad != NULL);
|
g_return_if_fail (pad != NULL);
|
||||||
g_return_if_fail (GST_IS_PAD (pad));
|
g_return_if_fail (GST_IS_PAD (pad));
|
||||||
|
|
||||||
if (pad->name != NULL)
|
gst_object_set_name (GST_OBJECT (pad), name);
|
||||||
g_free (pad->name);
|
|
||||||
|
|
||||||
pad->name = g_strdup (name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -310,7 +314,7 @@ gst_pad_get_name (GstPad *pad)
|
||||||
g_return_val_if_fail (pad != NULL, NULL);
|
g_return_val_if_fail (pad != NULL, NULL);
|
||||||
g_return_val_if_fail (GST_IS_PAD (pad), 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;
|
GList *pads;
|
||||||
GstPad *target_pad;
|
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)) {
|
if (GST_RPAD_QOSFUNC(pad)) {
|
||||||
(GST_RPAD_QOSFUNC(pad)) (pad,qos_message);
|
(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)));
|
element = GST_ELEMENT (GST_PAD_PARENT(GST_RPAD_PEER(pad)));
|
||||||
|
|
||||||
pads = element->pads;
|
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) {
|
while (pads) {
|
||||||
target_pad = GST_PAD (pads->data);
|
target_pad = GST_PAD (pads->data);
|
||||||
if (GST_RPAD_DIRECTION(target_pad) == GST_PAD_SINK) {
|
if (GST_RPAD_DIRECTION(target_pad) == GST_PAD_SINK) {
|
||||||
|
@ -564,14 +568,29 @@ gst_pad_set_parent (GstPad *pad,
|
||||||
{
|
{
|
||||||
g_return_if_fail (pad != NULL);
|
g_return_if_fail (pad != NULL);
|
||||||
g_return_if_fail (GST_IS_PAD (pad));
|
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 (parent != NULL);
|
||||||
g_return_if_fail (GTK_IS_OBJECT (parent));
|
g_return_if_fail (GTK_IS_OBJECT (parent));
|
||||||
g_return_if_fail ((gpointer)pad != (gpointer)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);
|
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:
|
* gst_pad_get_ghost_pad_list:
|
||||||
* @pad: the pad to get the ghost parents from
|
* @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");
|
// g_print("in gst_pad_real_destroy()\n");
|
||||||
|
|
||||||
if (pad->name)
|
|
||||||
g_free (pad->name);
|
|
||||||
g_list_free (GST_REAL_PAD(pad)->ghostpads);
|
g_list_free (GST_REAL_PAD(pad)->ghostpads);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_pad_load_and_connect:
|
* gst_pad_load_and_connect:
|
||||||
* @parent: the parent XML node to read the description from
|
* @self: the XML node to read the description from
|
||||||
* @element: the element that has the source pad
|
* @parent: the element that has the pad
|
||||||
* @elements: a hashtable with elements
|
|
||||||
*
|
*
|
||||||
* Read the pad definition from the XML node and connect the given 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
|
void
|
||||||
gst_pad_load_and_connect (xmlNodePtr parent,
|
gst_pad_load_and_connect (xmlNodePtr self,
|
||||||
GstObject *element,
|
GstObject *parent)
|
||||||
GHashTable *elements)
|
|
||||||
{
|
{
|
||||||
xmlNodePtr field = parent->childs;
|
xmlNodePtr field = self->childs;
|
||||||
GstPad *pad = NULL, *targetpad;
|
GstPad *pad = NULL, *targetpad;
|
||||||
guchar *peer = NULL;
|
guchar *peer = NULL;
|
||||||
gchar **split;
|
gchar **split;
|
||||||
GstElement *target;
|
GstElement *target;
|
||||||
|
GstObject *grandparent;
|
||||||
|
|
||||||
while (field) {
|
while (field) {
|
||||||
if (!strcmp(field->name, "name")) {
|
if (!strcmp (field->name, "name")) {
|
||||||
pad = gst_element_get_pad(GST_ELEMENT(element), xmlNodeGetContent(field));
|
pad = gst_element_get_pad (GST_ELEMENT (parent), xmlNodeGetContent (field));
|
||||||
}
|
}
|
||||||
else if (!strcmp(field->name, "peer")) {
|
else if (!strcmp(field->name, "peer")) {
|
||||||
peer = g_strdup(xmlNodeGetContent(field));
|
peer = g_strdup (xmlNodeGetContent (field));
|
||||||
}
|
}
|
||||||
field = field->next;
|
field = field->next;
|
||||||
}
|
}
|
||||||
g_return_if_fail(pad != NULL);
|
g_return_if_fail (pad != NULL);
|
||||||
|
|
||||||
if (peer == NULL) return;
|
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[0] != NULL);
|
||||||
g_return_if_fail(split[1] != 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;
|
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;
|
if (targetpad == NULL) goto cleanup;
|
||||||
|
|
||||||
gst_pad_connect(pad, targetpad);
|
gst_pad_connect (pad, targetpad);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
g_strfreev(split);
|
g_strfreev (split);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -851,25 +856,24 @@ cleanup:
|
||||||
*
|
*
|
||||||
* Returns: the xml representation of the pad
|
* Returns: the xml representation of the pad
|
||||||
*/
|
*/
|
||||||
xmlNodePtr
|
static xmlNodePtr
|
||||||
gst_pad_save_thyself (GstPad *pad,
|
gst_pad_save_thyself (GstObject *object,
|
||||||
xmlNodePtr parent)
|
xmlNodePtr parent)
|
||||||
{
|
{
|
||||||
GstRealPad *realpad;
|
GstRealPad *realpad;
|
||||||
GstPad *peer;
|
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) {
|
if (GST_RPAD_PEER(realpad) != NULL) {
|
||||||
peer = GST_PAD(GST_RPAD_PEER(realpad));
|
peer = GST_PAD(GST_RPAD_PEER(realpad));
|
||||||
// first check to see if the peer's parent's parent is the same
|
// 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
|
// we just save it off
|
||||||
xmlNewChild(parent,NULL,"peer",g_strdup_printf("%s.%s",
|
xmlNewChild(parent,NULL,"peer",g_strdup_printf("%s.%s",
|
||||||
GST_ELEMENT(peer->parent)->name,peer->name));
|
GST_OBJECT_NAME (GST_PAD_PARENT (peer)), GST_PAD_NAME (peer)));
|
||||||
} else
|
} else
|
||||||
xmlNewChild(parent,NULL,"peer","");
|
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);
|
g_return_val_if_fail (GST_IS_GHOST_PAD (pad), NULL);
|
||||||
|
|
||||||
self = xmlNewChild(parent,NULL,"ghostpad",NULL);
|
self = xmlNewChild(parent,NULL,"ghostpad",NULL);
|
||||||
xmlNewChild(self,NULL,"name",pad->name);
|
xmlNewChild(self,NULL,"name", GST_PAD_NAME (pad));
|
||||||
xmlNewChild(self,NULL,"parent",GST_ELEMENT(pad->parent)->name);
|
xmlNewChild(self,NULL,"parent", GST_OBJECT_NAME (GST_PAD_PARENT (pad)));
|
||||||
|
|
||||||
// FIXME FIXME FIXME!
|
// 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));
|
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 (element != NULL, FALSE);
|
||||||
// g_return_val_if_fail (GST_IS_ELEMENT(element), 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_INFO (GST_CAT_PADS,"set EOS on src pad %s:%s",GST_DEBUG_PAD_NAME(pad));
|
||||||
GST_FLAG_SET (pad, GST_PAD_EOS);
|
GST_FLAG_SET (pad, GST_PAD_EOS);
|
||||||
|
|
||||||
gst_element_signal_eos (GST_ELEMENT (pad->parent));
|
gst_element_signal_eos (GST_ELEMENT (GST_PAD_PARENT (pad)));
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -1307,7 +1311,7 @@ gst_ghost_pad_new (gchar *name,
|
||||||
g_return_val_if_fail (GST_IS_PAD(pad), NULL);
|
g_return_val_if_fail (GST_IS_PAD(pad), NULL);
|
||||||
|
|
||||||
ghostpad = gtk_type_new (gst_ghost_pad_get_type ());
|
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);
|
GST_GPAD_REALPAD(ghostpad) = GST_PAD_REALIZE(pad);
|
||||||
|
|
||||||
// add ourselves to the real pad's list of ghostpads
|
// add ourselves to the real pad's list of ghostpads
|
||||||
|
|
16
gst/gstpad.h
16
gst/gstpad.h
|
@ -96,9 +96,7 @@ typedef enum {
|
||||||
struct _GstPad {
|
struct _GstPad {
|
||||||
GstObject object;
|
GstObject object;
|
||||||
|
|
||||||
gchar *name;
|
|
||||||
gpointer element_private;
|
gpointer element_private;
|
||||||
GstObject *parent;
|
|
||||||
|
|
||||||
GstPadTemplate *padtemplate; /* the template for this pad */
|
GstPadTemplate *padtemplate; /* the template for this pad */
|
||||||
};
|
};
|
||||||
|
@ -154,9 +152,9 @@ struct _GstGhostPadClass {
|
||||||
|
|
||||||
/***** helper macros *****/
|
/***** helper macros *****/
|
||||||
/* GstPad */
|
/* 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_ELEMENT_PRIVATE(pad) (((GstPad *)(pad))->element_private)
|
||||||
#define GST_PAD_PARENT(pad) (((GstPad *)(pad))->parent)
|
|
||||||
#define GST_PAD_PADTEMPLATE(pad) (((GstPad *)(pad))->padtemplate)
|
#define GST_PAD_PADTEMPLATE(pad) (((GstPad *)(pad))->padtemplate)
|
||||||
|
|
||||||
/* GstRealPad */
|
/* GstRealPad */
|
||||||
|
@ -252,14 +250,15 @@ GList* gst_pad_get_caps_list (GstPad *pad);
|
||||||
GstCaps* gst_pad_get_caps_by_name (GstPad *pad, gchar *name);
|
GstCaps* gst_pad_get_caps_by_name (GstPad *pad, gchar *name);
|
||||||
gboolean gst_pad_check_compatibility (GstPad *srcpad, GstPad *sinkpad);
|
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_element_private (GstPad *pad, gpointer priv);
|
void gst_pad_set_element_private (GstPad *pad, gpointer priv);
|
||||||
gpointer gst_pad_get_element_private (GstPad *pad);
|
gpointer gst_pad_get_element_private (GstPad *pad);
|
||||||
|
|
||||||
|
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);
|
void gst_pad_set_parent (GstPad *pad, GstObject *parent);
|
||||||
GstObject* gst_pad_get_parent (GstPad *pad);
|
GstObject* gst_pad_get_parent (GstPad *pad);
|
||||||
|
|
||||||
void gst_pad_add_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);
|
void gst_pad_remove_ghost_pad (GstPad *pad, GstPad *ghostpad);
|
||||||
GList* gst_pad_get_ghost_pad_list (GstPad *pad);
|
GList* gst_pad_get_ghost_pad_list (GstPad *pad);
|
||||||
|
@ -293,8 +292,7 @@ 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 self, GstObject *parent);
|
||||||
void gst_pad_load_and_connect (xmlNodePtr parent, GstObject *element, GHashTable *elements);
|
|
||||||
|
|
||||||
|
|
||||||
/* ghostpads */
|
/* ghostpads */
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
|
|
||||||
#include "gst_private.h"
|
#include "gst_private.h"
|
||||||
#include "gstparse.h"
|
#include "gstparse.h"
|
||||||
|
#include "gstpipeline.h"
|
||||||
|
#include "gstthread.h"
|
||||||
|
|
||||||
typedef struct _gst_parse_priv gst_parse_priv;
|
typedef struct _gst_parse_priv gst_parse_priv;
|
||||||
struct _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");
|
gst_info("have NEW_PAD signal\n");
|
||||||
// if it matches, connect it
|
// 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_pad_connect(pad,peer->peer);
|
||||||
gst_info("delayed connect of '%s' to '%s'\n",
|
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 "); }
|
if (GST_IS_PIPELINE(parent)) { closingchar = '\0';DEBUG("in pipeline "); }
|
||||||
else if (GST_IS_THREAD(parent)) { closingchar = '}';DEBUG("in thread "); }
|
else if (GST_IS_THREAD(parent)) { closingchar = '}';DEBUG("in thread "); }
|
||||||
else { closingchar = ')';DEBUG("in bin "); }
|
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) {
|
while (i < argc) {
|
||||||
arg = argv[i];
|
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
|
// end of the container
|
||||||
} else if (arg[0] == closingchar) {
|
} else if (arg[0] == closingchar) {
|
||||||
// time to finish off this bin
|
// 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;
|
retval = i+1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -146,12 +148,12 @@ gst_parse_launch_cmdline(int argc,char *argv[],GstBin *parent,gst_parse_priv *pr
|
||||||
if (srcpadname != NULL) {
|
if (srcpadname != NULL) {
|
||||||
srcpad = gst_element_get_pad(previous,srcpadname);
|
srcpad = gst_element_get_pad(previous,srcpadname);
|
||||||
if (!srcpad)
|
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) {
|
if (srcpad == NULL) {
|
||||||
// check through the list to find the first sink pad
|
// 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);
|
pads = gst_element_get_pad_list(previous);
|
||||||
while (pads) {
|
while (pads) {
|
||||||
srcpad = GST_PAD(pads->data);
|
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';
|
pos[0] = '\0';
|
||||||
argval = pos+1;
|
argval = pos+1;
|
||||||
DEBUG("attempting to set argument '%s' to '%s' on element '%s'\n",
|
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);
|
gtk_object_set(GTK_OBJECT(previous),argname,argval,NULL);
|
||||||
g_free(argname);
|
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");
|
fprintf(stderr,"Couldn't create a bin!\n");
|
||||||
// exit(-1);
|
// 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] == '{') {
|
} else if (arg[0] == '{') {
|
||||||
// create a thread and add it to the current parent
|
// create a thread and add it to the current parent
|
||||||
element = gst_thread_new(g_strdup_printf("thread%d",priv->threadcount++));
|
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");
|
fprintf(stderr,"Couldn't create a thread!\n");
|
||||||
// exit(-1);
|
// 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);
|
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);
|
fprintf(stderr,"Couldn't create a '%s', no such element or need to run gstraemer-register?\n",arg);
|
||||||
// exit(-1);
|
// 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);
|
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 we're the first element, ghost all the sinkpads
|
||||||
if (elementcount == 1) {
|
if (elementcount == 1) {
|
||||||
DEBUG("first element, ghosting all of %s's sink pads to parent %s\n",
|
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);
|
pads = gst_element_get_pad_list (element);
|
||||||
while (pads) {
|
while (pads) {
|
||||||
sinkpad = GST_PAD (pads->data);
|
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");
|
if (!sinkpad) DEBUG("much oddness, pad doesn't seem to exist\n");
|
||||||
else if (gst_pad_get_direction (sinkpad) == GST_PAD_SINK) {
|
else if (gst_pad_get_direction (sinkpad) == GST_PAD_SINK) {
|
||||||
gst_element_add_ghost_pad (GST_ELEMENT (parent), sinkpad,
|
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(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
|
// ghost all the src pads of the bin
|
||||||
if (prevelement != NULL) {
|
if (prevelement != NULL) {
|
||||||
DEBUG("last element, ghosting all of %s's src pads to parent %s\n",
|
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);
|
pads = gst_element_get_pad_list (prevelement);
|
||||||
while (pads) {
|
while (pads) {
|
||||||
srcpad = GST_PAD (pads->data);
|
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");
|
if (!srcpad) DEBUG("much oddness, pad doesn't seem to exist\n");
|
||||||
else if (gst_pad_get_direction (srcpad) == GST_PAD_SRC) {
|
else if (gst_pad_get_direction (srcpad) == GST_PAD_SRC) {
|
||||||
gst_element_add_ghost_pad (GST_ELEMENT (parent), srcpad,
|
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(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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,8 +23,8 @@
|
||||||
#ifndef __GST_PARSE_H__
|
#ifndef __GST_PARSE_H__
|
||||||
#define __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__ */
|
||||||
|
|
|
@ -125,7 +125,7 @@ static void
|
||||||
gst_pipeline_prepare (GstPipeline *pipeline)
|
gst_pipeline_prepare (GstPipeline *pipeline)
|
||||||
{
|
{
|
||||||
GST_DEBUG (0,"GstPipeline: preparing pipeline \"%s\" for playing\n",
|
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
|
static void
|
||||||
|
@ -144,7 +144,7 @@ gst_pipeline_typefind (GstPipeline *pipeline, GstElement *element)
|
||||||
GstCaps *caps = NULL;
|
GstCaps *caps = NULL;
|
||||||
|
|
||||||
GST_DEBUG (0,"GstPipeline: typefind for element \"%s\" %p\n",
|
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");
|
typefind = gst_elementfactory_make ("typefind", "typefind");
|
||||||
g_return_val_if_fail (typefind != NULL, FALSE);
|
g_return_val_if_fail (typefind != NULL, FALSE);
|
||||||
|
@ -189,7 +189,7 @@ gst_pipeline_pads_autoplug_func (GstElement *src, GstPad *pad, GstElement *sink)
|
||||||
gboolean connected = FALSE;
|
gboolean connected = FALSE;
|
||||||
|
|
||||||
GST_DEBUG (0,"gstpipeline: autoplug pad connect function for \"%s\" to \"%s\"\n",
|
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);
|
sinkpads = gst_element_get_pad_list(sink);
|
||||||
while (sinkpads) {
|
while (sinkpads) {
|
||||||
|
@ -201,15 +201,15 @@ gst_pipeline_pads_autoplug_func (GstElement *src, GstPad *pad, GstElement *sink)
|
||||||
{
|
{
|
||||||
if (gst_caps_list_check_compatibility (gst_pad_get_caps_list(pad), gst_pad_get_caps_list(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_pad_connect(pad, sinkpad);
|
||||||
GST_DEBUG (0,"gstpipeline: autoconnect pad \"%s\" in element %s <-> ", pad->name,
|
GST_DEBUG (0,"gstpipeline: autoconnect pad \"%s\" in element %s <-> ", GST_PAD_NAME (pad),
|
||||||
gst_element_get_name(src));
|
GST_ELEMENT_NAME(src));
|
||||||
GST_DEBUG (0,"pad \"%s\" in element %s\n", sinkpad->name,
|
GST_DEBUG (0,"pad \"%s\" in element %s\n", GST_PAD_NAME (sinkpad),
|
||||||
gst_element_get_name(sink));
|
GST_ELEMENT_NAME(sink));
|
||||||
connected = TRUE;
|
connected = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else {
|
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);
|
sinkpads = g_list_next(sinkpads);
|
||||||
|
@ -240,7 +240,7 @@ gst_pipeline_pads_autoplug (GstElement *src, GstElement *sink)
|
||||||
|
|
||||||
if (!connected) {
|
if (!connected) {
|
||||||
GST_DEBUG (0,"gstpipeline: delaying pad connections for \"%s\" to \"%s\"\n",
|
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_connect(GTK_OBJECT(src),"new_pad",
|
||||||
GTK_SIGNAL_FUNC(gst_pipeline_pads_autoplug_func), sink);
|
GTK_SIGNAL_FUNC(gst_pipeline_pads_autoplug_func), sink);
|
||||||
}
|
}
|
||||||
|
@ -266,7 +266,7 @@ gst_pipeline_add_src (GstPipeline *pipeline, GstElement *src)
|
||||||
|
|
||||||
if (pipeline->src) {
|
if (pipeline->src) {
|
||||||
printf("gstpipeline: *WARNING* removing previously added element \"%s\"\n",
|
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);
|
gst_bin_remove(GST_BIN(pipeline), pipeline->src);
|
||||||
}
|
}
|
||||||
pipeline->src = src;
|
pipeline->src = src;
|
||||||
|
@ -319,27 +319,27 @@ gst_pipeline_autoplug (GstPipeline *pipeline)
|
||||||
g_return_val_if_fail(GST_IS_PIPELINE(pipeline), FALSE);
|
g_return_val_if_fail(GST_IS_PIPELINE(pipeline), FALSE);
|
||||||
|
|
||||||
GST_DEBUG (0,"GstPipeline: autopluging pipeline \"%s\"\n",
|
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...
|
// fase 1, run typedetect on the source if needed...
|
||||||
if (!pipeline->src) {
|
if (!pipeline->src) {
|
||||||
GST_DEBUG (0,"GstPipeline: no source detected, can't autoplug pipeline \"%s\"\n",
|
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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_DEBUG (0,"GstPipeline: source \"%s\" has no MIME type, running typefind...\n",
|
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);
|
src_caps = gst_pipeline_typefind(pipeline, pipeline->src);
|
||||||
|
|
||||||
if (src_caps) {
|
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);
|
src_caps->id);
|
||||||
}
|
}
|
||||||
else {
|
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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -440,15 +440,15 @@ differ:
|
||||||
|
|
||||||
use_thread = FALSE;
|
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
|
// create a new queue and add to the previous bin
|
||||||
queue = gst_elementfactory_make("queue", g_strconcat("queue_", gst_element_get_name(element), NULL));
|
queue = gst_elementfactory_make("queue", g_strconcat("queue_", GST_ELEMENT_NAME(element), NULL));
|
||||||
GST_DEBUG (0,"adding element \"%s\"\n", element->name);
|
GST_DEBUG (0,"adding element \"%s\"\n", GST_ELEMENT_NAME (element));
|
||||||
gst_bin_add(GST_BIN(thebin), queue);
|
gst_bin_add(GST_BIN(thebin), queue);
|
||||||
|
|
||||||
// this will be the new bin for all following elements
|
// 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");
|
srcpad = gst_element_get_pad(queue, "src");
|
||||||
|
|
||||||
|
@ -470,15 +470,15 @@ differ:
|
||||||
}
|
}
|
||||||
gst_pipeline_pads_autoplug(thesrcelement, queue);
|
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_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);
|
gst_bin_add(GST_BIN(pipeline), thebin);
|
||||||
thesrcelement = queue;
|
thesrcelement = queue;
|
||||||
}
|
}
|
||||||
// no thread needed, easy case
|
// no thread needed, easy case
|
||||||
else {
|
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_bin_add(GST_BIN(thebin), element);
|
||||||
}
|
}
|
||||||
gst_pipeline_pads_autoplug(thesrcelement, element);
|
gst_pipeline_pads_autoplug(thesrcelement, element);
|
||||||
|
@ -493,7 +493,7 @@ next:
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
GST_DEBUG (0,"GstPipeline: unable to autoplug pipeline \"%s\"\n",
|
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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -733,7 +733,7 @@ gst_plugin_save_thyself (xmlNodePtr parent)
|
||||||
types = plugin->types;
|
types = plugin->types;
|
||||||
while (types) {
|
while (types) {
|
||||||
GstTypeFactory *factory = (GstTypeFactory *)types->data;
|
GstTypeFactory *factory = (GstTypeFactory *)types->data;
|
||||||
subtree = xmlNewChild(tree,NULL,"type",NULL);
|
subtree = xmlNewChild(tree,NULL,"typefactory",NULL);
|
||||||
|
|
||||||
gst_typefactory_save_thyself(factory, subtree);
|
gst_typefactory_save_thyself(factory, subtree);
|
||||||
|
|
||||||
|
@ -742,7 +742,7 @@ gst_plugin_save_thyself (xmlNodePtr parent)
|
||||||
elements = plugin->elements;
|
elements = plugin->elements;
|
||||||
while (elements) {
|
while (elements) {
|
||||||
GstElementFactory *factory = (GstElementFactory *)elements->data;
|
GstElementFactory *factory = (GstElementFactory *)elements->data;
|
||||||
subtree = xmlNewChild(tree,NULL,"element",NULL);
|
subtree = xmlNewChild(tree,NULL,"elementfactory",NULL);
|
||||||
|
|
||||||
gst_elementfactory_save_thyself(factory, subtree);
|
gst_elementfactory_save_thyself(factory, subtree);
|
||||||
|
|
||||||
|
@ -794,12 +794,12 @@ gst_plugin_load_thyself (xmlNodePtr parent)
|
||||||
else if (!strcmp(field->name, "filename")) {
|
else if (!strcmp(field->name, "filename")) {
|
||||||
plugin->filename = xmlNodeGetContent(field);
|
plugin->filename = xmlNodeGetContent(field);
|
||||||
}
|
}
|
||||||
else if (!strcmp(field->name, "element")) {
|
else if (!strcmp(field->name, "elementfactory")) {
|
||||||
GstElementFactory *factory = gst_elementfactory_load_thyself(field);
|
GstElementFactory *factory = gst_elementfactory_load_thyself(field);
|
||||||
gst_plugin_add_factory (plugin, factory);
|
gst_plugin_add_factory (plugin, factory);
|
||||||
elementcount++;
|
elementcount++;
|
||||||
}
|
}
|
||||||
else if (!strcmp(field->name, "type")) {
|
else if (!strcmp(field->name, "typefactory")) {
|
||||||
GstTypeFactory *factory = gst_typefactory_load_thyself(field);
|
GstTypeFactory *factory = gst_typefactory_load_thyself(field);
|
||||||
gst_plugin_add_type (plugin, factory);
|
gst_plugin_add_type (plugin, factory);
|
||||||
elementcount++;
|
elementcount++;
|
||||||
|
|
|
@ -153,12 +153,12 @@ gst_queue_handle_eos (GstPad *pad)
|
||||||
{
|
{
|
||||||
GstQueue *queue;
|
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_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);
|
queue->level_buffers);
|
||||||
|
|
||||||
GST_FLAG_SET (pad, GST_PAD_EOS);
|
GST_FLAG_SET (pad, GST_PAD_EOS);
|
||||||
|
@ -182,7 +182,7 @@ static void
|
||||||
gst_queue_flush (GstQueue *queue)
|
gst_queue_flush (GstQueue *queue)
|
||||||
{
|
{
|
||||||
g_slist_foreach (queue->queue, gst_queue_cleanup_buffers,
|
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);
|
g_slist_free (queue->queue);
|
||||||
|
|
||||||
queue->queue = NULL;
|
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 (GST_IS_PAD (pad));
|
||||||
g_return_if_fail (buf != NULL);
|
g_return_if_fail (buf != NULL);
|
||||||
|
|
||||||
queue = GST_QUEUE (pad->parent);
|
queue = GST_QUEUE (GST_OBJECT_PARENT (pad));
|
||||||
name = gst_element_get_name (GST_ELEMENT (queue));
|
name = GST_ELEMENT_NAME (queue);
|
||||||
|
|
||||||
/* we have to lock the queue since we span threads */
|
/* we have to lock the queue since we span threads */
|
||||||
|
|
||||||
|
@ -251,12 +251,12 @@ gst_queue_chain (GstPad *pad, GstBuffer *buf)
|
||||||
static GstBuffer *
|
static GstBuffer *
|
||||||
gst_queue_get (GstPad *pad)
|
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;
|
GstBuffer *buf = NULL;
|
||||||
GSList *front;
|
GSList *front;
|
||||||
const guchar *name;
|
const guchar *name;
|
||||||
|
|
||||||
name = gst_element_get_name (GST_ELEMENT (queue));
|
name = GST_ELEMENT_NAME (queue);
|
||||||
|
|
||||||
/* have to lock for thread-safety */
|
/* have to lock for thread-safety */
|
||||||
GST_DEBUG (0,"queue: %s try have queue lock\n", name);
|
GST_DEBUG (0,"queue: %s try have queue lock\n", name);
|
||||||
|
|
|
@ -30,7 +30,7 @@ static int
|
||||||
gst_bin_loopfunc_wrapper (int argc,char *argv[])
|
gst_bin_loopfunc_wrapper (int argc,char *argv[])
|
||||||
{
|
{
|
||||||
GstElement *element = GST_ELEMENT (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);
|
GST_DEBUG_ENTER("(%d,'%s')",argc,name);
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ static int
|
||||||
gst_bin_chain_wrapper (int argc,char *argv[])
|
gst_bin_chain_wrapper (int argc,char *argv[])
|
||||||
{
|
{
|
||||||
GstElement *element = GST_ELEMENT (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;
|
GList *pads;
|
||||||
GstPad *pad;
|
GstPad *pad;
|
||||||
GstRealPad *realpad;
|
GstRealPad *realpad;
|
||||||
|
@ -66,11 +66,11 @@ gst_bin_chain_wrapper (int argc,char *argv[])
|
||||||
if (!GST_IS_REAL_PAD(pad)) continue;
|
if (!GST_IS_REAL_PAD(pad)) continue;
|
||||||
realpad = GST_REAL_PAD(pad);
|
realpad = GST_REAL_PAD(pad);
|
||||||
if (GST_RPAD_DIRECTION(realpad) == GST_PAD_SINK) {
|
if (GST_RPAD_DIRECTION(realpad) == GST_PAD_SINK) {
|
||||||
GST_DEBUG (0,"pulling a buffer from %s:%s\n", name, gst_pad_get_name (pad));
|
GST_DEBUG (0,"pulling a buffer from %s:%s\n", name, GST_PAD_NAME (pad));
|
||||||
buf = gst_pad_pull (pad);
|
buf = gst_pad_pull (pad);
|
||||||
GST_DEBUG (0,"calling chain function of %s:%s\n", name, gst_pad_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);
|
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));
|
} while (!GST_ELEMENT_IS_COTHREAD_STOPPING(element));
|
||||||
|
@ -87,7 +87,7 @@ gst_bin_src_wrapper (int argc,char *argv[])
|
||||||
GList *pads;
|
GList *pads;
|
||||||
GstRealPad *realpad;
|
GstRealPad *realpad;
|
||||||
GstBuffer *buf;
|
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);
|
GST_DEBUG_ENTER("(%d,\"%s\")",argc,name);
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ gst_bin_src_wrapper (int argc,char *argv[])
|
||||||
static void
|
static void
|
||||||
gst_bin_pushfunc_proxy (GstPad *pad, GstBuffer *buf)
|
gst_bin_pushfunc_proxy (GstPad *pad, GstBuffer *buf)
|
||||||
{
|
{
|
||||||
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_ENTER("(%s:%s)",GST_DEBUG_PAD_NAME(pad));
|
||||||
GST_DEBUG (0,"putting buffer %p in peer's pen\n",buf);
|
GST_DEBUG (0,"putting buffer %p in peer's pen\n",buf);
|
||||||
GST_RPAD_BUFPEN(GST_RPAD_PEER(pad)) = 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 the element has a loopfunc...
|
||||||
if (element->loopfunc != NULL) {
|
if (element->loopfunc != NULL) {
|
||||||
wrapper_function = GST_DEBUG_FUNCPTR(gst_bin_loopfunc_wrapper);
|
wrapper_function = GST_DEBUG_FUNCPTR(gst_bin_loopfunc_wrapper);
|
||||||
GST_DEBUG (0,"\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 {
|
} else {
|
||||||
// otherwise we need to decide what kind of cothread
|
// otherwise we need to decide what kind of cothread
|
||||||
// if it's not DECOUPLED, we decide based on whether it's a source or not
|
// if it's not DECOUPLED, we decide based on whether it's a source or not
|
||||||
|
@ -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 it doesn't have any sinks, it must be a source (duh)
|
||||||
if (element->numsinkpads == 0) {
|
if (element->numsinkpads == 0) {
|
||||||
wrapper_function = GST_DEBUG_FUNCPTR(gst_bin_src_wrapper);
|
wrapper_function = GST_DEBUG_FUNCPTR(gst_bin_src_wrapper);
|
||||||
GST_DEBUG (0,"\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 {
|
} else {
|
||||||
wrapper_function = GST_DEBUG_FUNCPTR(gst_bin_chain_wrapper);
|
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 the element is DECOUPLED or outside the manager, we have to chain
|
||||||
if ((wrapper_function == NULL) ||
|
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
|
// set the chain proxies
|
||||||
if (GST_RPAD_DIRECTION(pad) == GST_PAD_SINK) {
|
if (GST_RPAD_DIRECTION(pad) == GST_PAD_SINK) {
|
||||||
GST_DEBUG (0,"copying chain function into push proxy for %s:%s\n",GST_DEBUG_PAD_NAME(pad));
|
GST_DEBUG (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 (wrapper_function != NULL) {
|
||||||
if (element->threadstate == NULL) {
|
if (element->threadstate == NULL) {
|
||||||
element->threadstate = cothread_create (bin->threadcontext);
|
element->threadstate = cothread_create (bin->threadcontext);
|
||||||
GST_DEBUG (0,"created cothread %p for '%s'\n",element->threadstate,gst_element_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);
|
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));
|
GST_DEBUG_FUNCPTR_NAME(wrapper_function));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -327,7 +327,7 @@ gst_bin_schedule_cleanup (GstBin *bin)
|
||||||
static void
|
static void
|
||||||
gst_scheduler_handle_eos (GstElement *element, _GstBinChain *chain)
|
gst_scheduler_handle_eos (GstElement *element, _GstBinChain *chain)
|
||||||
{
|
{
|
||||||
GST_DEBUG (0,"chain removed from scheduler, EOS from element \"%s\"\n", gst_element_get_name (element));
|
GST_DEBUG (0,"chain removed from scheduler, EOS from element \"%s\"\n", GST_ELEMENT_NAME (element));
|
||||||
chain->need_scheduling = FALSE;
|
chain->need_scheduling = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -341,7 +341,7 @@ void gst_bin_schedule_func(GstBin *bin) {
|
||||||
GList *chains;
|
GList *chains;
|
||||||
_GstBinChain *chain;
|
_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);
|
gst_bin_schedule_cleanup(bin);
|
||||||
|
|
||||||
|
@ -356,12 +356,12 @@ void gst_bin_schedule_func(GstBin *bin) {
|
||||||
// if this is a DECOUPLED element
|
// if this is a DECOUPLED element
|
||||||
if (GST_FLAG_IS_SET (element, GST_ELEMENT_DECOUPLED)) {
|
if (GST_FLAG_IS_SET (element, GST_ELEMENT_DECOUPLED)) {
|
||||||
// skip this element entirely
|
// skip this element entirely
|
||||||
GST_DEBUG (0,"skipping '%s' because it's decoupled\n",gst_element_get_name(element));
|
GST_DEBUG (0,"skipping '%s' because it's decoupled\n",GST_ELEMENT_NAME(element));
|
||||||
elements = g_list_next (elements);
|
elements = g_list_next (elements);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_DEBUG (0,"starting with element '%s'\n",gst_element_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
|
// prime the pending list with the first element off the top
|
||||||
pending = g_slist_prepend (NULL, element);
|
pending = g_slist_prepend (NULL, element);
|
||||||
|
@ -379,7 +379,7 @@ void gst_bin_schedule_func(GstBin *bin) {
|
||||||
pending = g_slist_remove (pending, element);
|
pending = g_slist_remove (pending, element);
|
||||||
|
|
||||||
// add ourselves to the chain's list of elements
|
// add ourselves to the chain's list of elements
|
||||||
GST_DEBUG (0,"adding '%s' to chain\n",gst_element_get_name(element));
|
GST_DEBUG (0,"adding '%s' to chain\n",GST_ELEMENT_NAME(element));
|
||||||
chain->elements = g_list_prepend (chain->elements, element);
|
chain->elements = g_list_prepend (chain->elements, element);
|
||||||
chain->num_elements++;
|
chain->num_elements++;
|
||||||
gtk_signal_connect (GTK_OBJECT (element), "eos", gst_scheduler_handle_eos, chain);
|
gtk_signal_connect (GTK_OBJECT (element), "eos", gst_scheduler_handle_eos, chain);
|
||||||
|
@ -394,13 +394,13 @@ void gst_bin_schedule_func(GstBin *bin) {
|
||||||
if ((element->manager == GST_ELEMENT(bin)) &&
|
if ((element->manager == GST_ELEMENT(bin)) &&
|
||||||
!GST_FLAG_IS_SET (element, GST_ELEMENT_DECOUPLED)) {
|
!GST_FLAG_IS_SET (element, GST_ELEMENT_DECOUPLED)) {
|
||||||
// remove ourselves from the outer list of all managed elements
|
// remove ourselves from the outer list of all managed elements
|
||||||
// GST_DEBUG (0,"removing '%s' from list of possible elements\n",gst_element_get_name(element));
|
// GST_DEBUG (0,"removing '%s' from list of possible elements\n",GST_ELEMENT_NAME(element));
|
||||||
elements = g_list_remove (elements, element);
|
elements = g_list_remove (elements, element);
|
||||||
|
|
||||||
// if this element is a source, add it as an entry
|
// if this element is a source, add it as an entry
|
||||||
if (element->numsinkpads == 0) {
|
if (element->numsinkpads == 0) {
|
||||||
chain->entries = g_list_prepend (chain->entries, element);
|
chain->entries = g_list_prepend (chain->entries, element);
|
||||||
GST_DEBUG (0,"added '%s' as SRC entry into the chain\n",gst_element_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
|
// 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!");
|
if (GST_RPAD_PEER(pad) == NULL) GST_ERROR(pad,"peer is null!");
|
||||||
g_assert(GST_RPAD_PEER(pad) != 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));
|
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
|
// 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)) {
|
GST_FLAG_IS_SET (peerparent, GST_ELEMENT_DECOUPLED)) {
|
||||||
// add the peer element to the pending list
|
// add the peer element to the pending list
|
||||||
GST_DEBUG (0,"adding '%s' to list of pending elements\n",
|
GST_DEBUG (0,"adding '%s' to list of pending elements\n",
|
||||||
gst_element_get_name(peerparent));
|
GST_ELEMENT_NAME(peerparent));
|
||||||
pending = g_slist_prepend (pending, peerparent);
|
pending = g_slist_prepend (pending, peerparent);
|
||||||
|
|
||||||
// if this is a sink pad, then the element on the other side is an entry
|
// 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))) {
|
(GST_FLAG_IS_SET (peerparent, GST_ELEMENT_DECOUPLED))) {
|
||||||
chain->entries = g_list_prepend (chain->entries, peerparent);
|
chain->entries = g_list_prepend (chain->entries, peerparent);
|
||||||
gtk_signal_connect (GTK_OBJECT (peerparent), "eos", gst_scheduler_handle_eos, chain);
|
gtk_signal_connect (GTK_OBJECT (peerparent), "eos", gst_scheduler_handle_eos, chain);
|
||||||
GST_DEBUG (0,"added '%s' as DECOUPLED entry into the chain\n",gst_element_get_name(peerparent));
|
GST_DEBUG (0,"added '%s' as DECOUPLED entry into the chain\n",GST_ELEMENT_NAME(peerparent));
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
GST_DEBUG (0,"element '%s' has already been dealt with\n",gst_element_get_name(peerparent));
|
GST_DEBUG (0,"element '%s' has already been dealt with\n",GST_ELEMENT_NAME(peerparent));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (pending);
|
} while (pending);
|
||||||
|
@ -446,7 +446,7 @@ void gst_bin_schedule_func(GstBin *bin) {
|
||||||
while (elements) {
|
while (elements) {
|
||||||
element = GST_ELEMENT (elements->data);
|
element = GST_ELEMENT (elements->data);
|
||||||
elements = g_list_next(elements);
|
elements = g_list_next(elements);
|
||||||
GST_DEBUG_NOPREFIX(0,"%s, ",gst_element_get_name(element));
|
GST_DEBUG_NOPREFIX(0,"%s, ",GST_ELEMENT_NAME(element));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GST_DEBUG_NOPREFIX(0,"\n");
|
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)) &&
|
if ((GST_IS_SRC (outside) || GST_IS_CONNECTION (outside)) &&
|
||||||
(gst_object_get_parent (GST_OBJECT (outside)) != GST_OBJECT (bin))) {
|
(gst_object_get_parent (GST_OBJECT (outside)) != GST_OBJECT (bin))) {
|
||||||
if (gst_pad_get_direction (pad) == GST_PAD_SINK) {
|
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 (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);
|
//GST_DEBUG_PAD_NAME(pad->peer),GST_DEBUG_PAD_NAME(pad),&pad->pullfunc);
|
||||||
// pad->pullfunc = pad->peer->pullfunc;
|
// pad->pullfunc = pad->peer->pullfunc;
|
||||||
|
@ -507,7 +507,7 @@ void gst_bin_schedule_func(GstBin *bin) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
} else if (GST_IS_SRC (element)) {
|
} 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->entries = g_list_prepend (bin->entries,element);
|
||||||
bin->num_entries++;
|
bin->num_entries++;
|
||||||
cothread_setfunc(element->threadstate,gst_bin_src_wrapper,0,(char **)element);
|
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;
|
elements = bin->children;
|
||||||
while (elements) {
|
while (elements) {
|
||||||
element = GST_ELEMENT (elements->data);
|
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)) {
|
if (GST_IS_BIN (element)) {
|
||||||
gst_bin_create_plan (GST_BIN (element));
|
gst_bin_create_plan (GST_BIN (element));
|
||||||
}
|
}
|
||||||
if (GST_IS_SRC (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->entries = g_list_prepend (bin->entries, element);
|
||||||
bin->num_entries++;
|
bin->num_entries++;
|
||||||
}
|
}
|
||||||
|
@ -571,7 +571,7 @@ void gst_bin_schedule_func(GstBin *bin) {
|
||||||
// get the pad's peer
|
// get the pad's peer
|
||||||
peer = GST_RPAD_PEER(pad);
|
peer = GST_RPAD_PEER(pad);
|
||||||
if (!peer) {
|
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;
|
break;
|
||||||
}
|
}
|
||||||
// get the parent of the peer of the pad
|
// 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_object_get_parent (GST_OBJECT (outside)) != GST_OBJECT (bin))) {
|
||||||
gst_info("gstbin: element \"%s\" is the external source Connection "
|
gst_info("gstbin: element \"%s\" is the external source Connection "
|
||||||
"for internal element \"%s\"\n",
|
"for internal element \"%s\"\n",
|
||||||
gst_element_get_name (GST_ELEMENT (outside)),
|
GST_ELEMENT_NAME (GST_ELEMENT (outside)),
|
||||||
gst_element_get_name (GST_ELEMENT (element)));
|
GST_ELEMENT_NAME (GST_ELEMENT (element)));
|
||||||
bin->entries = g_list_prepend (bin->entries, outside);
|
bin->entries = g_list_prepend (bin->entries, outside);
|
||||||
bin->num_entries++;
|
bin->num_entries++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
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);
|
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
|
// first of all, if there's a loopfunc, the decision's already made
|
||||||
if (element->loopfunc != NULL) {
|
if (element->loopfunc != NULL) {
|
||||||
wrapper_function = GST_DEBUG_FUNCPTR(gst_bin_loopfunc_wrapper);
|
wrapper_function = GST_DEBUG_FUNCPTR(gst_bin_loopfunc_wrapper);
|
||||||
GST_DEBUG (0,"element %s is a 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 {
|
} else {
|
||||||
// otherwise we need to decide if it needs a cothread
|
// 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
|
// 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) {
|
if (element->threadstate == NULL) {
|
||||||
element->threadstate = cothread_create (bin->threadcontext);
|
element->threadstate = cothread_create (bin->threadcontext);
|
||||||
GST_DEBUG (0,"created cothread %p (@%p) for \"%s\"\n",element->threadstate,
|
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);
|
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));
|
GST_DEBUG_FUNCPTR_NAME(wrapper_function));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,14 +53,13 @@ enum {
|
||||||
static void gst_thread_class_init (GstThreadClass *klass);
|
static void gst_thread_class_init (GstThreadClass *klass);
|
||||||
static void gst_thread_init (GstThread *thread);
|
static void gst_thread_init (GstThread *thread);
|
||||||
|
|
||||||
static void gst_thread_set_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 void gst_thread_get_arg (GtkObject *object, GtkArg *arg, guint id);
|
||||||
|
|
||||||
static GstElementStateReturn gst_thread_change_state (GstElement *element);
|
static GstElementStateReturn gst_thread_change_state (GstElement *element);
|
||||||
|
|
||||||
static xmlNodePtr gst_thread_save_thyself (GstElement *element,xmlNodePtr parent);
|
static xmlNodePtr gst_thread_save_thyself (GstObject *object, xmlNodePtr parent);
|
||||||
static void gst_thread_restore_thyself (GstElement *element,xmlNodePtr parent,
|
static void gst_thread_restore_thyself (GstObject *object, xmlNodePtr self);
|
||||||
GHashTable *elements);
|
|
||||||
|
|
||||||
static void gst_thread_signal_thread (GstThread *thread);
|
static void gst_thread_signal_thread (GstThread *thread);
|
||||||
static void gst_thread_wait_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_object_add_arg_type ("GstThread::create_thread", GTK_TYPE_BOOL,
|
||||||
GTK_ARG_READWRITE, ARG_CREATE_THREAD);
|
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->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;
|
gstbin_class->schedule = gst_thread_schedule_dummy;
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ gst_thread_class_init (GstThreadClass *klass)
|
||||||
static void
|
static void
|
||||||
gst_thread_init (GstThread *thread)
|
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
|
// we're a manager by default
|
||||||
GST_FLAG_SET (thread, GST_BIN_FLAG_MANAGER);
|
GST_FLAG_SET (thread, GST_BIN_FLAG_MANAGER);
|
||||||
|
@ -212,12 +212,12 @@ gst_thread_change_state (GstElement *element)
|
||||||
gint pending, transition;
|
gint pending, transition;
|
||||||
|
|
||||||
g_return_val_if_fail (GST_IS_THREAD(element), FALSE);
|
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);
|
thread = GST_THREAD (element);
|
||||||
|
|
||||||
GST_INFO (GST_CAT_THREAD,"gstthread: thread \"%s\" change state %d",
|
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));
|
GST_STATE_PENDING (element));
|
||||||
|
|
||||||
pending = GST_STATE_PENDING (element);
|
pending = GST_STATE_PENDING (element);
|
||||||
|
@ -238,7 +238,7 @@ gst_thread_change_state (GstElement *element)
|
||||||
// if (!stateset) return FALSE;
|
// if (!stateset) return FALSE;
|
||||||
// we want to prepare our internal state for doing the iterations
|
// we want to prepare our internal state for doing the iterations
|
||||||
GST_INFO (GST_CAT_THREAD, "gstthread: preparing thread \"%s\" for 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
|
// set the state to idle
|
||||||
GST_FLAG_UNSET (thread, GST_THREAD_STATE_SPINNING);
|
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)) {
|
if (GST_FLAG_IS_SET (thread, GST_THREAD_CREATE)) {
|
||||||
GST_INFO (GST_CAT_THREAD, "gstthread: starting thread \"%s\"",
|
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
|
// create the thread
|
||||||
pthread_create (&thread->thread_id, NULL,
|
pthread_create (&thread->thread_id, NULL,
|
||||||
|
@ -257,28 +257,28 @@ gst_thread_change_state (GstElement *element)
|
||||||
// gst_thread_wait_thread (thread);
|
// gst_thread_wait_thread (thread);
|
||||||
} else {
|
} else {
|
||||||
GST_INFO (GST_CAT_THREAD, "gstthread: NOT starting thread \"%s\"",
|
GST_INFO (GST_CAT_THREAD, "gstthread: NOT starting thread \"%s\"",
|
||||||
gst_element_get_name (GST_ELEMENT (element)));
|
GST_ELEMENT_NAME (GST_ELEMENT (element)));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_STATE_PAUSED_TO_PLAYING:
|
case GST_STATE_PAUSED_TO_PLAYING:
|
||||||
case GST_STATE_READY_TO_PLAYING:
|
case GST_STATE_READY_TO_PLAYING:
|
||||||
if (!stateset) return FALSE;
|
if (!stateset) return FALSE;
|
||||||
GST_INFO (GST_CAT_THREAD, "gstthread: starting thread \"%s\"",
|
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_FLAG_SET (thread, GST_THREAD_STATE_SPINNING);
|
||||||
gst_thread_signal_thread (thread);
|
gst_thread_signal_thread (thread);
|
||||||
break;
|
break;
|
||||||
case GST_STATE_PLAYING_TO_PAUSED:
|
case GST_STATE_PLAYING_TO_PAUSED:
|
||||||
GST_INFO (GST_CAT_THREAD,"gstthread: pausing thread \"%s\"",
|
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_FLAG_UNSET(thread,GST_THREAD_STATE_SPINNING);
|
||||||
gst_thread_signal_thread (thread);
|
gst_thread_signal_thread (thread);
|
||||||
break;
|
break;
|
||||||
case GST_STATE_READY_TO_NULL:
|
case GST_STATE_READY_TO_NULL:
|
||||||
GST_INFO (GST_CAT_THREAD,"gstthread: stopping thread \"%s\"",
|
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_FLAG_SET (thread, GST_THREAD_STATE_REAPING);
|
||||||
gst_thread_signal_thread (thread);
|
gst_thread_signal_thread (thread);
|
||||||
|
@ -303,7 +303,7 @@ gst_thread_main_loop (void *arg)
|
||||||
GstThread *thread = GST_THREAD (arg);
|
GstThread *thread = GST_THREAD (arg);
|
||||||
|
|
||||||
GST_INFO (GST_CAT_THREAD,"gstthread: thread \"%s\" is running with PID %d",
|
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
|
// construct the plan and signal back
|
||||||
if (GST_BIN_CLASS (parent_class)->schedule)
|
if (GST_BIN_CLASS (parent_class)->schedule)
|
||||||
|
@ -318,7 +318,7 @@ gst_thread_main_loop (void *arg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
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);
|
gst_thread_wait_thread (thread);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -327,7 +327,7 @@ gst_thread_main_loop (void *arg)
|
||||||
//pthread_join (thread->thread_id, 0);
|
//pthread_join (thread->thread_id, 0);
|
||||||
|
|
||||||
GST_INFO (GST_CAT_THREAD, "gstthread: thread \"%s\" is stopped",
|
GST_INFO (GST_CAT_THREAD, "gstthread: thread \"%s\" is stopped",
|
||||||
gst_element_get_name (GST_ELEMENT (thread)));
|
GST_ELEMENT_NAME (thread));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,21 +351,20 @@ gst_thread_wait_thread (GstThread *thread)
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_thread_restore_thyself (GstElement *element,
|
gst_thread_restore_thyself (GstObject *object,
|
||||||
xmlNodePtr parent,
|
xmlNodePtr self)
|
||||||
GHashTable *elements)
|
|
||||||
{
|
{
|
||||||
GST_DEBUG (0,"gstthread: restore\n");
|
GST_DEBUG (0,"gstthread: restore\n");
|
||||||
|
|
||||||
if (GST_ELEMENT_CLASS (parent_class)->restore_thyself)
|
if (GST_OBJECT_CLASS (parent_class)->restore_thyself)
|
||||||
GST_ELEMENT_CLASS (parent_class)->restore_thyself (element,parent, elements);
|
GST_OBJECT_CLASS (parent_class)->restore_thyself (object, self);
|
||||||
}
|
}
|
||||||
|
|
||||||
static xmlNodePtr
|
static xmlNodePtr
|
||||||
gst_thread_save_thyself (GstElement *element,
|
gst_thread_save_thyself (GstObject *object,
|
||||||
xmlNodePtr parent)
|
xmlNodePtr self)
|
||||||
{
|
{
|
||||||
if (GST_ELEMENT_CLASS (parent_class)->save_thyself)
|
if (GST_OBJECT_CLASS (parent_class)->save_thyself)
|
||||||
GST_ELEMENT_CLASS (parent_class)->save_thyself (element,parent);
|
GST_OBJECT_CLASS (parent_class)->save_thyself (object, self);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,9 +161,9 @@ gst_typefind_chain (GstPad *pad, GstBuffer *buf)
|
||||||
g_return_if_fail (GST_IS_PAD (pad));
|
g_return_if_fail (GST_IS_PAD (pad));
|
||||||
g_return_if_fail (buf != NULL);
|
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_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 ();
|
type_list = gst_type_get_list ();
|
||||||
|
|
||||||
|
|
132
gst/gstxml.c
132
gst/gstxml.c
|
@ -25,11 +25,18 @@
|
||||||
#include "gstxml.h"
|
#include "gstxml.h"
|
||||||
#include "gstbin.h"
|
#include "gstbin.h"
|
||||||
|
|
||||||
|
enum {
|
||||||
|
OBJECT_LOADED,
|
||||||
|
OBJECT_SAVED,
|
||||||
|
LAST_SIGNAL
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
static void gst_xml_class_init (GstXMLClass *klass);
|
static void gst_xml_class_init (GstXMLClass *klass);
|
||||||
static void gst_xml_init (GstXML *xml);
|
static void gst_xml_init (GstXML *xml);
|
||||||
|
|
||||||
static GstObjectClass *parent_class = NULL;
|
static GstObjectClass *parent_class = NULL;
|
||||||
|
static guint gst_xml_signals[LAST_SIGNAL] = { 0 };
|
||||||
|
|
||||||
GtkType
|
GtkType
|
||||||
gst_xml_get_type(void)
|
gst_xml_get_type(void)
|
||||||
|
@ -39,15 +46,15 @@ gst_xml_get_type(void)
|
||||||
if (!xml_type) {
|
if (!xml_type) {
|
||||||
static const GtkTypeInfo xml_info = {
|
static const GtkTypeInfo xml_info = {
|
||||||
"GstXML",
|
"GstXML",
|
||||||
sizeof(GstElement),
|
sizeof(GstXML),
|
||||||
sizeof(GstElementClass),
|
sizeof(GstXMLClass),
|
||||||
(GtkClassInitFunc)gst_xml_class_init,
|
(GtkClassInitFunc)gst_xml_class_init,
|
||||||
(GtkObjectInitFunc)gst_xml_init,
|
(GtkObjectInitFunc)gst_xml_init,
|
||||||
(GtkArgSetFunc)NULL,
|
(GtkArgSetFunc)NULL,
|
||||||
(GtkArgGetFunc)NULL,
|
(GtkArgGetFunc)NULL,
|
||||||
(GtkClassInitFunc)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;
|
return xml_type;
|
||||||
}
|
}
|
||||||
|
@ -55,12 +62,44 @@ gst_xml_get_type(void)
|
||||||
static void
|
static void
|
||||||
gst_xml_class_init (GstXMLClass *klass)
|
gst_xml_class_init (GstXMLClass *klass)
|
||||||
{
|
{
|
||||||
|
GtkObjectClass *gtkobject_class;
|
||||||
|
|
||||||
|
gtkobject_class = (GtkObjectClass *)klass;
|
||||||
|
|
||||||
parent_class = gtk_type_class (GST_TYPE_OBJECT);
|
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
|
static void
|
||||||
gst_xml_init(GstXML *xml)
|
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)
|
gst_xml_write (GstElement *element)
|
||||||
{
|
{
|
||||||
xmlDocPtr doc;
|
xmlDocPtr doc;
|
||||||
|
xmlNodePtr elementnode;
|
||||||
|
xmlNsPtr ns;
|
||||||
|
|
||||||
doc = xmlNewDoc ("1.0");
|
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;
|
return doc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstXML*
|
static gboolean
|
||||||
gst_xml_real_parse (xmlDocPtr doc, const guchar *root)
|
gst_xml_real_parse (GstXML *xml, xmlDocPtr doc, const guchar *root)
|
||||||
{
|
{
|
||||||
GstXML *xml;
|
xmlNodePtr field, cur;
|
||||||
xmlNodePtr field;
|
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");
|
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 = cur->xmlChildrenNode;
|
||||||
|
|
||||||
field = doc->xmlRootNode->xmlChildrenNode;
|
|
||||||
|
|
||||||
while (field) {
|
while (field) {
|
||||||
if (!strcmp(field->name, "element")) {
|
if (!strcmp(field->name, "element") && (field->ns == xml->ns)) {
|
||||||
GstElement *element;
|
GstElement *element;
|
||||||
|
|
||||||
xml->elements = g_hash_table_new(g_str_hash, g_str_equal);
|
element = gst_element_load_thyself(field, NULL);
|
||||||
|
|
||||||
element = gst_element_load_thyself(field, xml->elements);
|
|
||||||
|
|
||||||
g_hash_table_destroy (xml->elements);
|
|
||||||
|
|
||||||
xml->topelements = g_list_prepend (xml->topelements, element);
|
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);
|
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
|
* @fname: The filename with the xml description
|
||||||
* @root: The name of the root object to build
|
* @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
|
* tree is cached to speed up creating another GstXML object for
|
||||||
* the same file
|
* the same file
|
||||||
*
|
*
|
||||||
* Returns: a pointer to a new GstXML object
|
* Returns: TRUE on success, FALSE otherwise
|
||||||
*/
|
*/
|
||||||
GstXML*
|
gboolean
|
||||||
gst_xml_new (const guchar *fname, const guchar *root)
|
gst_xml_parse_file (GstXML *xml, const guchar *fname, const guchar *root)
|
||||||
{
|
{
|
||||||
xmlDocPtr doc;
|
xmlDocPtr doc;
|
||||||
|
|
||||||
g_return_val_if_fail(fname != NULL, NULL);
|
g_return_val_if_fail(fname != NULL, FALSE);
|
||||||
|
|
||||||
doc = xmlParseFile(fname);
|
doc = xmlParseFile(fname);
|
||||||
|
|
||||||
if (!doc) {
|
if (!doc) {
|
||||||
g_warning("gstxml: XML file \"%s\" could not be read\n", fname);
|
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
|
* @buffer: a pointer to the in memory XML buffer
|
||||||
* @size: the size of the buffer
|
* @size: the size of the buffer
|
||||||
* @root: the name of the root objects to build
|
* @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
|
* Returns: a pointer to a new GstXML object
|
||||||
*/
|
*/
|
||||||
GstXML*
|
gboolean
|
||||||
gst_xml_new_from_memory (guchar *buffer, guint size, const gchar *root)
|
gst_xml_parse_memory (GstXML *xml, guchar *buffer, guint size, const gchar *root)
|
||||||
{
|
{
|
||||||
xmlDocPtr doc;
|
xmlDocPtr doc;
|
||||||
|
|
||||||
g_return_val_if_fail(buffer != NULL, NULL);
|
g_return_val_if_fail(buffer != NULL, FALSE);
|
||||||
|
|
||||||
doc = xmlParseMemory (buffer, size);
|
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:
|
* gst_xml_get_topelements:
|
||||||
* @xml: The GstXML to get the elements from
|
* @xml: The GstXML to get the elements from
|
||||||
|
@ -219,7 +280,8 @@ gst_xml_get_element (GstXML *xml, const guchar *name)
|
||||||
while (topelements) {
|
while (topelements) {
|
||||||
GstElement *top = GST_ELEMENT (topelements->data);
|
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;
|
return top;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
27
gst/gstxml.h
27
gst/gstxml.h
|
@ -1,6 +1,6 @@
|
||||||
/* GStreamer
|
/* GStreamer
|
||||||
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
* 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
|
* gstxml.h: Header for XML save/restore operations
|
||||||
*
|
*
|
||||||
|
@ -23,7 +23,6 @@
|
||||||
#ifndef __GST_XML_H__
|
#ifndef __GST_XML_H__
|
||||||
#define __GST_XML_H__
|
#define __GST_XML_H__
|
||||||
|
|
||||||
//#include <gnome-xml/parser.h>
|
|
||||||
#include <parser.h>
|
#include <parser.h>
|
||||||
|
|
||||||
// Include compatability defines: if libxml hasn't already defined these,
|
// Include compatability defines: if libxml hasn't already defined these,
|
||||||
|
@ -33,16 +32,14 @@
|
||||||
#define xmlRootNode root
|
#define xmlRootNode root
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include <gst/gstelement.h>
|
#include <gst/gstelement.h>
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
#define GST_TYPE_XML \
|
#define GST_TYPE_XML \
|
||||||
(gst_object_get_type())
|
(gst_xml_get_type())
|
||||||
#define GST_XML(obj) \
|
#define GST_XML(obj) \
|
||||||
(GTK_CHECK_CAST((obj),GST_TYPE_XML,GstXML))
|
(GTK_CHECK_CAST((obj),GST_TYPE_XML,GstXML))
|
||||||
#define GST_XML_CLASS(klass) \
|
#define GST_XML_CLASS(klass) \
|
||||||
|
@ -56,14 +53,19 @@ typedef struct _GstXML GstXML;
|
||||||
typedef struct _GstXMLClass GstXMLClass;
|
typedef struct _GstXMLClass GstXMLClass;
|
||||||
|
|
||||||
struct _GstXML {
|
struct _GstXML {
|
||||||
GtkObject object;
|
GstObject object;
|
||||||
|
|
||||||
GHashTable *elements;
|
|
||||||
GList *topelements;
|
GList *topelements;
|
||||||
|
|
||||||
|
xmlNsPtr ns;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstXMLClass {
|
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);
|
GtkType gst_xml_get_type (void);
|
||||||
|
@ -72,13 +74,18 @@ GtkType gst_xml_get_type (void);
|
||||||
/* create an XML document out of a pipeline */
|
/* create an XML document out of a pipeline */
|
||||||
xmlDocPtr gst_xml_write (GstElement *element);
|
xmlDocPtr gst_xml_write (GstElement *element);
|
||||||
|
|
||||||
GstXML* gst_xml_new (const guchar *fname, const guchar *root);
|
GstXML* gst_xml_new (void);
|
||||||
GstXML* gst_xml_new_from_memory (guchar *buffer, guint size, const gchar *root);
|
|
||||||
|
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);
|
GstElement* gst_xml_get_element (GstXML *xml, const guchar *name);
|
||||||
GList* gst_xml_get_topelements (GstXML *xml);
|
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
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
|
@ -218,7 +218,7 @@ gst_asyncdisksrc_get (GstPad *pad)
|
||||||
GstBuffer *buf;
|
GstBuffer *buf;
|
||||||
|
|
||||||
g_return_val_if_fail (pad != NULL, NULL);
|
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);
|
g_return_val_if_fail (GST_FLAG_IS_SET (src, GST_ASYNCDISKSRC_OPEN), NULL);
|
||||||
|
|
||||||
/* deal with EOF state */
|
/* 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);
|
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_IS_ASYNCDISKSRC (src), NULL);
|
||||||
g_return_val_if_fail (GST_FLAG_IS_SET (src, GST_ASYNCDISKSRC_OPEN), NULL);
|
g_return_val_if_fail (GST_FLAG_IS_SET (src, GST_ASYNCDISKSRC_OPEN), NULL);
|
||||||
|
|
|
@ -244,7 +244,7 @@ gst_audiosink_chain (GstPad *pad, GstBuffer *buf)
|
||||||
/* this has to be an audio buffer */
|
/* this has to be an audio buffer */
|
||||||
// g_return_if_fail(((GstMeta *)buf->meta)->type !=
|
// g_return_if_fail(((GstMeta *)buf->meta)->type !=
|
||||||
//gst_audiosink_type_audio);
|
//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));
|
// g_return_if_fail(GST_FLAG_IS_SET(audiosink,GST_STATE_RUNNING));
|
||||||
|
|
||||||
if ((in_flush = GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLUSH))) {
|
if ((in_flush = GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLUSH))) {
|
||||||
|
|
|
@ -149,7 +149,7 @@ gst_audiosrc_get (GstPad *pad)
|
||||||
glong readbytes;
|
glong readbytes;
|
||||||
|
|
||||||
g_return_val_if_fail (pad != NULL, NULL);
|
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");
|
// g_print("attempting to read something from soundcard\n");
|
||||||
|
|
||||||
|
|
|
@ -208,7 +208,7 @@ gst_disksrc_get (GstPad *pad)
|
||||||
glong readbytes;
|
glong readbytes;
|
||||||
|
|
||||||
g_return_val_if_fail (pad != NULL, NULL);
|
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_FLAG_IS_SET (src, GST_DISKSRC_OPEN), NULL);
|
||||||
g_return_val_if_fail (GST_STATE (src) >= GST_STATE_READY, NULL);
|
g_return_val_if_fail (GST_STATE (src) >= GST_STATE_READY, NULL);
|
||||||
|
|
||||||
|
|
|
@ -180,7 +180,7 @@ gst_fakesink_chain (GstPad *pad, GstBuffer *buf)
|
||||||
g_return_if_fail (GST_IS_PAD (pad));
|
g_return_if_fail (GST_IS_PAD (pad));
|
||||||
g_return_if_fail (buf != NULL);
|
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));
|
g_print("fakesink: ******* (%s:%s)< \n",GST_DEBUG_PAD_NAME(pad));
|
||||||
|
|
||||||
gst_buffer_unref (buf);
|
gst_buffer_unref (buf);
|
||||||
|
|
|
@ -269,9 +269,11 @@ gst_fakesrc_get(GstPad *pad)
|
||||||
GstFakeSrc *src;
|
GstFakeSrc *src;
|
||||||
GstBuffer *buf;
|
GstBuffer *buf;
|
||||||
|
|
||||||
g_return_val_if_fail(pad != NULL, 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);
|
src = GST_FAKESRC (gst_pad_get_parent (pad));
|
||||||
|
|
||||||
|
g_return_val_if_fail (GST_IS_FAKESRC (src), NULL);
|
||||||
|
|
||||||
if (src->num_buffers == 0) {
|
if (src->num_buffers == 0) {
|
||||||
gst_pad_set_eos (pad);
|
gst_pad_set_eos (pad);
|
||||||
|
|
|
@ -113,7 +113,7 @@ gst_fdsink_chain (GstPad *pad, GstBuffer *buf)
|
||||||
g_return_if_fail (GST_IS_PAD (pad));
|
g_return_if_fail (GST_IS_PAD (pad));
|
||||||
g_return_if_fail (buf != NULL);
|
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);
|
g_return_if_fail (fdsink->fd >= 0);
|
||||||
|
|
||||||
|
|
|
@ -184,7 +184,7 @@ gst_fdsrc_get(GstPad *pad)
|
||||||
glong readbytes;
|
glong readbytes;
|
||||||
|
|
||||||
g_return_val_if_fail (pad != NULL, NULL);
|
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 */
|
/* create the buffer */
|
||||||
// FIXME: should eventually use a bufferpool for this
|
// FIXME: should eventually use a bufferpool for this
|
||||||
|
|
|
@ -131,7 +131,7 @@ gst_httpsrc_get(GstPad *pad)
|
||||||
glong readbytes;
|
glong readbytes;
|
||||||
|
|
||||||
g_return_val_if_fail (pad != NULL, NULL);
|
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();
|
buf = gst_buffer_new();
|
||||||
GST_BUFFER_DATA(buf) = (gpointer)malloc(src->bytes_per_read);
|
GST_BUFFER_DATA(buf) = (gpointer)malloc(src->bytes_per_read);
|
||||||
|
|
|
@ -120,7 +120,7 @@ gst_identity_chain (GstPad *pad, GstBuffer *buf)
|
||||||
g_return_if_fail (GST_IS_PAD (pad));
|
g_return_if_fail (GST_IS_PAD (pad));
|
||||||
g_return_if_fail (buf != NULL);
|
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));
|
g_print("identity: ******* (%s:%s)i \n",GST_DEBUG_PAD_NAME(pad));
|
||||||
|
|
||||||
gst_pad_push (identity->srcpad, buf);
|
gst_pad_push (identity->srcpad, buf);
|
||||||
|
|
|
@ -118,13 +118,6 @@ static void gst_pipefilter_init(GstPipefilter *pipefilter) {
|
||||||
pipefilter->seq = 0;
|
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) {
|
static gboolean gst_pipefilter_read_and_push(GstPipefilter *pipefilter) {
|
||||||
GstBuffer *newbuf;
|
GstBuffer *newbuf;
|
||||||
glong readbytes;
|
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(GST_IS_PAD(pad));
|
||||||
g_return_if_fail(buf != NULL);
|
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));
|
while (gst_pipefilter_read_and_push(pipefilter));
|
||||||
|
|
||||||
|
|
|
@ -153,12 +153,12 @@ gst_queue_handle_eos (GstPad *pad)
|
||||||
{
|
{
|
||||||
GstQueue *queue;
|
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_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);
|
queue->level_buffers);
|
||||||
|
|
||||||
GST_FLAG_SET (pad, GST_PAD_EOS);
|
GST_FLAG_SET (pad, GST_PAD_EOS);
|
||||||
|
@ -182,7 +182,7 @@ static void
|
||||||
gst_queue_flush (GstQueue *queue)
|
gst_queue_flush (GstQueue *queue)
|
||||||
{
|
{
|
||||||
g_slist_foreach (queue->queue, gst_queue_cleanup_buffers,
|
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);
|
g_slist_free (queue->queue);
|
||||||
|
|
||||||
queue->queue = NULL;
|
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 (GST_IS_PAD (pad));
|
||||||
g_return_if_fail (buf != NULL);
|
g_return_if_fail (buf != NULL);
|
||||||
|
|
||||||
queue = GST_QUEUE (pad->parent);
|
queue = GST_QUEUE (GST_OBJECT_PARENT (pad));
|
||||||
name = gst_element_get_name (GST_ELEMENT (queue));
|
name = GST_ELEMENT_NAME (queue);
|
||||||
|
|
||||||
/* we have to lock the queue since we span threads */
|
/* we have to lock the queue since we span threads */
|
||||||
|
|
||||||
|
@ -251,12 +251,12 @@ gst_queue_chain (GstPad *pad, GstBuffer *buf)
|
||||||
static GstBuffer *
|
static GstBuffer *
|
||||||
gst_queue_get (GstPad *pad)
|
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;
|
GstBuffer *buf = NULL;
|
||||||
GSList *front;
|
GSList *front;
|
||||||
const guchar *name;
|
const guchar *name;
|
||||||
|
|
||||||
name = gst_element_get_name (GST_ELEMENT (queue));
|
name = GST_ELEMENT_NAME (queue);
|
||||||
|
|
||||||
/* have to lock for thread-safety */
|
/* have to lock for thread-safety */
|
||||||
GST_DEBUG (0,"queue: %s try have queue lock\n", name);
|
GST_DEBUG (0,"queue: %s try have queue lock\n", name);
|
||||||
|
|
|
@ -132,18 +132,6 @@ static void gst_sinesrc_init(GstSineSrc *sinesrc) {
|
||||||
sinesrc->sentmeta = FALSE;
|
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 *
|
static GstBuffer *
|
||||||
gst_sinesrc_get(GstPad *pad)
|
gst_sinesrc_get(GstPad *pad)
|
||||||
{
|
{
|
||||||
|
@ -155,7 +143,7 @@ gst_sinesrc_get(GstPad *pad)
|
||||||
gdouble val;
|
gdouble val;
|
||||||
|
|
||||||
g_return_val_if_fail (pad != NULL, NULL);
|
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();
|
buf = gst_buffer_new();
|
||||||
g_return_val_if_fail (buf, NULL);
|
g_return_val_if_fail (buf, NULL);
|
||||||
|
|
|
@ -181,7 +181,7 @@ gst_tee_chain (GstPad *pad, GstBuffer *buf)
|
||||||
g_return_if_fail (GST_IS_PAD (pad));
|
g_return_if_fail (GST_IS_PAD (pad));
|
||||||
g_return_if_fail (buf != NULL);
|
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");
|
gst_trace_add_entry (NULL, 0, buf, "tee buffer");
|
||||||
|
|
||||||
for (i=0; i<tee->numsrcpads-1; i++)
|
for (i=0; i<tee->numsrcpads-1; i++)
|
||||||
|
|
|
@ -31,9 +31,6 @@ int main(int argc,char *argv[]) {
|
||||||
gst_pad_connect(gst_element_get_pad(audiosrc,"src"),
|
gst_pad_connect(gst_element_get_pad(audiosrc,"src"),
|
||||||
gst_element_get_pad(fdsink,"sink"));
|
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");
|
g_print("\nok, runnable, hitting 'play'...\n");
|
||||||
gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_PLAYING);
|
gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_PLAYING);
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ static void gst_example_get_arg (GtkObject *object,GtkArg *arg,guint id);
|
||||||
GstPadTemplate *src_template, *sink_template;
|
GstPadTemplate *src_template, *sink_template;
|
||||||
|
|
||||||
static GstElementClass *parent_class = NULL;
|
static GstElementClass *parent_class = NULL;
|
||||||
static guint gst_example_signals[LAST_SIGNAL] = { 0 };
|
//static guint gst_example_signals[LAST_SIGNAL] = { 0 };
|
||||||
|
|
||||||
GtkType
|
GtkType
|
||||||
gst_example_get_type(void)
|
gst_example_get_type(void)
|
||||||
|
@ -134,15 +134,13 @@ static void
|
||||||
gst_example_chain (GstPad *pad, GstBuffer *buf)
|
gst_example_chain (GstPad *pad, GstBuffer *buf)
|
||||||
{
|
{
|
||||||
GstExample *example;
|
GstExample *example;
|
||||||
guchar *data;
|
|
||||||
gint i;
|
|
||||||
|
|
||||||
g_return_if_fail(pad != NULL);
|
g_return_if_fail(pad != NULL);
|
||||||
g_return_if_fail(GST_IS_PAD(pad));
|
g_return_if_fail(GST_IS_PAD(pad));
|
||||||
g_return_if_fail(buf != NULL);
|
g_return_if_fail(buf != NULL);
|
||||||
//g_return_if_fail(GST_IS_BUFFER(buf));
|
//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(example != NULL);
|
||||||
g_return_if_fail(GST_IS_EXAMPLE(example));
|
g_return_if_fail(GST_IS_EXAMPLE(example));
|
||||||
|
@ -199,10 +197,10 @@ plugin_init (GModule *module)
|
||||||
GstElementFactory *factory;
|
GstElementFactory *factory;
|
||||||
|
|
||||||
plugin = gst_plugin_new("example");
|
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);
|
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);
|
sink_template = gst_padtemplate_new (&sink_factory);
|
||||||
gst_elementfactory_add_padtemplate (factory, sink_template);
|
gst_elementfactory_add_padtemplate (factory, sink_template);
|
||||||
|
|
|
@ -3,33 +3,40 @@
|
||||||
|
|
||||||
gboolean playing;
|
gboolean playing;
|
||||||
|
|
||||||
/* eos will be called when the src element has an end of stream */
|
static void
|
||||||
void eos(GstElement *element, gpointer data)
|
xml_loaded (GstXML *xml, GstObject *object, gpointer data)
|
||||||
{
|
{
|
||||||
g_print("have eos, quitting\n");
|
if (GST_IS_PAD (object)) {
|
||||||
|
g_print ("pad loaded '%s'\n", gst_pad_get_name (GST_PAD (object)));
|
||||||
playing = FALSE;
|
}
|
||||||
|
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;
|
GstXML *xml;
|
||||||
GstElement *bin;
|
GstElement *bin;
|
||||||
GstElement *disk;
|
gboolean ret;
|
||||||
|
|
||||||
gst_init(&argc,&argv);
|
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");
|
bin = gst_xml_get_element(xml, "bin");
|
||||||
|
g_assert (bin != NULL);
|
||||||
|
|
||||||
gst_element_set_state(bin, GST_STATE_PLAYING);
|
gst_element_set_state(bin, GST_STATE_PLAYING);
|
||||||
|
|
||||||
playing = TRUE;
|
playing = TRUE;
|
||||||
|
|
||||||
while (playing) {
|
while (gst_bin_iterate(GST_BIN(bin)));
|
||||||
gst_bin_iterate(GST_BIN(bin));
|
|
||||||
}
|
|
||||||
|
|
||||||
gst_element_set_state(bin, GST_STATE_NULL);
|
gst_element_set_state(bin, GST_STATE_NULL);
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,8 @@ int main(int argc,char *argv[])
|
||||||
|
|
||||||
g_print ("\n *** using testfile %s\n", argv[1]);
|
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);
|
toplevelelements = gst_xml_get_topelements (xml);
|
||||||
|
|
||||||
|
|
|
@ -84,6 +84,7 @@ struct _GstPropsEntry {
|
||||||
|
|
||||||
gint print_element_info(GstElementFactory *factory) {
|
gint print_element_info(GstElementFactory *factory) {
|
||||||
GstElement *element;
|
GstElement *element;
|
||||||
|
GstObjectClass *gstobject_class;
|
||||||
GstElementClass *gstelement_class;
|
GstElementClass *gstelement_class;
|
||||||
GList *pads, *caps;
|
GList *pads, *caps;
|
||||||
GstPad *pad;
|
GstPad *pad;
|
||||||
|
@ -99,6 +100,8 @@ gint print_element_info(GstElementFactory *factory) {
|
||||||
g_print ("couldn't construct element for some reason\n");
|
g_print ("couldn't construct element for some reason\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gstobject_class = GST_OBJECT_CLASS (GTK_OBJECT (element)->klass);
|
||||||
gstelement_class = GST_ELEMENT_CLASS (GTK_OBJECT (element)->klass);
|
gstelement_class = GST_ELEMENT_CLASS (GTK_OBJECT (element)->klass);
|
||||||
|
|
||||||
printf("Factory Details:\n");
|
printf("Factory Details:\n");
|
||||||
|
@ -184,9 +187,9 @@ gint print_element_info(GstElementFactory *factory) {
|
||||||
printf(" Has change_state() function\n");
|
printf(" Has change_state() function\n");
|
||||||
else
|
else
|
||||||
printf(" No change_state() class function\n");
|
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");
|
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(" Has custom restore_thyself() class function\n");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue