mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-08 08:25:33 +00:00
Use new functions from core to render a bin from a string. Fixes build. Up requirements to core CVS.
Original commit message from CVS: * configure.ac: * ext/gconf/gconf.c: (gst_gconf_render_bin_from_key): Use new functions from core to render a bin from a string. Fixes build. Up requirements to core CVS.
This commit is contained in:
parent
638225aebb
commit
4062420223
4 changed files with 20 additions and 83 deletions
|
@ -1,3 +1,10 @@
|
|||
2006-02-02 Tim-Philipp Müller <tim at centricular dot net>
|
||||
|
||||
* configure.ac:
|
||||
* ext/gconf/gconf.c: (gst_gconf_render_bin_from_key):
|
||||
Use new functions from core to render a bin from a
|
||||
string. Fixes build. Up requirements to core CVS.
|
||||
|
||||
2006-02-01 Tim-Philipp Müller <tim at centricular dot net>
|
||||
|
||||
* gst/auparse/gstauparse.c: (gst_au_parse_chain):
|
||||
|
|
2
common
2
common
|
@ -1 +1 @@
|
|||
Subproject commit 0b93085188e83fe678ec5ded2823cd7c24dfa843
|
||||
Subproject commit 1140eabed84dd1d8d6df7df88f5c8bdf20a8faa1
|
|
@ -36,7 +36,7 @@ AS_LIBTOOL_TAGS
|
|||
AM_PROG_LIBTOOL
|
||||
|
||||
dnl *** required versions of GStreamer stuff ***
|
||||
GST_REQ=0.10.2
|
||||
GST_REQ=0.10.2.1
|
||||
GSTPB_REQ=0.10.2
|
||||
|
||||
dnl *** autotools stuff ****
|
||||
|
|
|
@ -45,47 +45,6 @@ gst_gconf_get_client (void)
|
|||
return _gst_gconf_client;
|
||||
}
|
||||
|
||||
/* go through a bin, finding the one pad that is unconnected in the given
|
||||
* * direction, and return that pad */
|
||||
static GstPad *
|
||||
gst_bin_find_unconnected_pad (GstBin * bin, GstPadDirection direction)
|
||||
{
|
||||
GstPad *pad = NULL;
|
||||
GList *elements = NULL;
|
||||
const GList *pads = NULL;
|
||||
GstElement *element = NULL;
|
||||
|
||||
GST_OBJECT_LOCK (bin);
|
||||
elements = bin->children;
|
||||
/* traverse all elements looking for unconnected pads */
|
||||
while (elements && pad == NULL) {
|
||||
element = GST_ELEMENT (elements->data);
|
||||
GST_OBJECT_LOCK (element);
|
||||
pads = element->pads;
|
||||
while (pads) {
|
||||
GstPad *testpad = GST_PAD (pads->data);
|
||||
|
||||
/* check if the direction matches */
|
||||
if (GST_PAD_DIRECTION (testpad) == direction) {
|
||||
GST_OBJECT_LOCK (testpad);
|
||||
if (GST_PAD_PEER (testpad) == NULL) {
|
||||
GST_OBJECT_UNLOCK (testpad);
|
||||
/* found it ! */
|
||||
pad = testpad;
|
||||
break;
|
||||
}
|
||||
GST_OBJECT_UNLOCK (testpad);
|
||||
}
|
||||
pads = g_list_next (pads);
|
||||
}
|
||||
GST_OBJECT_UNLOCK (element);
|
||||
elements = g_list_next (elements);
|
||||
}
|
||||
GST_OBJECT_UNLOCK (bin);
|
||||
|
||||
return pad;
|
||||
}
|
||||
|
||||
/* external functions */
|
||||
|
||||
/**
|
||||
|
@ -138,43 +97,6 @@ gst_gconf_set_string (const gchar * key, const gchar * value)
|
|||
g_free (full_key);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_gconf_render_bin_from_description:
|
||||
* @description: a #gchar string describing the bin.
|
||||
*
|
||||
* Render bin from description @description.
|
||||
*
|
||||
* Returns: a #GstElement containing the rendered bin.
|
||||
*/
|
||||
GstElement *
|
||||
gst_gconf_render_bin_from_description (const gchar * description)
|
||||
{
|
||||
GstElement *bin = NULL;
|
||||
GstPad *pad = NULL;
|
||||
GError *error = NULL;
|
||||
gchar *desc = NULL;
|
||||
|
||||
/* parse the pipeline to a bin */
|
||||
desc = g_strdup_printf ("bin.( %s )", description);
|
||||
bin = GST_ELEMENT (gst_parse_launch (desc, &error));
|
||||
g_free (desc);
|
||||
if (error) {
|
||||
GST_ERROR ("gstgconf: error parsing pipeline %s\n%s\n",
|
||||
description, error->message);
|
||||
g_error_free (error);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* find pads and ghost them if necessary */
|
||||
if ((pad = gst_bin_find_unconnected_pad (GST_BIN (bin), GST_PAD_SRC))) {
|
||||
gst_element_add_pad (bin, gst_ghost_pad_new ("src", pad));
|
||||
}
|
||||
if ((pad = gst_bin_find_unconnected_pad (GST_BIN (bin), GST_PAD_SINK))) {
|
||||
gst_element_add_pad (bin, gst_ghost_pad_new ("sink", pad));
|
||||
}
|
||||
return bin;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_gconf_render_bin_from_key:
|
||||
* @key: a #gchar string corresponding to a GConf key.
|
||||
|
@ -190,9 +112,17 @@ gst_gconf_render_bin_from_key (const gchar * key)
|
|||
gchar *value;
|
||||
|
||||
value = gst_gconf_get_string (key);
|
||||
if (value)
|
||||
bin = gst_gconf_render_bin_from_description (value);
|
||||
g_free (value);
|
||||
if (value) {
|
||||
GError *err = NULL;
|
||||
|
||||
bin = gst_parse_bin_from_description (value, TRUE, &err);
|
||||
if (err) {
|
||||
GST_ERROR ("gconf: error creating bin '%s': %s", value, err->message);
|
||||
g_error_free (err);
|
||||
}
|
||||
|
||||
g_free (value);
|
||||
}
|
||||
return bin;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue