Commit 3ec27583 authored by Wim Taymans's avatar Wim Taymans

Merged the CAPSNEGO1 branch..

Original commit message from CVS:
Merged the CAPSNEGO1 branch..
parent db744107
......@@ -770,6 +770,7 @@ tests/Makefile
tests/sched/Makefile
tests/eos/Makefile
testsuite/Makefile
tests/nego/Makefile
examples/Makefile
examples/autoplug/Makefile
examples/helloworld/Makefile
......
......@@ -128,7 +128,7 @@ the element when it knows the values for the caps.
-----------------------
when two pads are connected the following steps will take
placei (not sure, FIXME):
place (not sure, FIXME):
- if both pads have caps, the caps are checked. If the caps
are incompatible, the padtemplates are checked, if they
......
......@@ -329,14 +329,14 @@ gst_editor_pads_create (GstEditorProperty *property, GstEditorElement *element)
while (pads) {
GstPad *pad = (GstPad *)pads->data;
GList *caps = gst_pad_get_caps_list (pad);
GstCaps *caps = gst_pad_get_caps (pad);
gchar *mime;
gchar *data[2];
GtkCTreeNode *padnode;
if (caps) {
GstType *type;
type = gst_type_find_by_id (((GstCaps *)caps->data)->id);
type = gst_type_find_by_id (caps->id);
mime = type->mime;
}
else {
......@@ -348,13 +348,8 @@ gst_editor_pads_create (GstEditorProperty *property, GstEditorElement *element)
padnode = gtk_ctree_insert_node (GTK_CTREE (tree), NULL, NULL, data, 0,
NULL, NULL, NULL, NULL, FALSE, TRUE);
while (caps) {
GstCaps *cap = (GstCaps *)caps->data;
gst_editor_add_caps_to_tree (cap, tree, padnode);
caps = g_list_next (caps);
}
gst_editor_add_caps_to_tree (caps, tree, padnode);
pads = g_list_next (pads);
}
......
......@@ -41,7 +41,7 @@ static GList* gst_autoplug_func (gpointer src, gpointer sink,
static GstElement* gst_static_autoplug_to_caps (GstAutoplug *autoplug,
GList *srccaps, GList *sinkcaps, va_list args);
GstCaps *srccaps, GstCaps *sinkcaps, va_list args);
static GstAutoplugClass *parent_class = NULL;
......@@ -118,7 +118,8 @@ gst_autoplug_can_match (GstElementFactory *src, GstElementFactory *dest)
if (srctemp->direction == GST_PAD_SRC &&
desttemp->direction == GST_PAD_SINK) {
if (gst_caps_list_check_compatibility (srctemp->caps, desttemp->caps)) {
if (gst_caps_check_compatibility (gst_padtemplate_get_caps (srctemp),
gst_padtemplate_get_caps (desttemp))) {
GST_INFO (GST_CAT_AUTOPLUG_ATTEMPT,
"factory \"%s\" can connect with factory \"%s\"", src->name, dest->name);
return TRUE;
......@@ -151,7 +152,7 @@ gst_autoplug_pads_autoplug_func (GstElement *src, GstPad *pad, GstElement *sink)
if (gst_pad_get_direction(sinkpad) == GST_PAD_SINK &&
!GST_PAD_CONNECTED(sinkpad))
{
if (gst_caps_list_check_compatibility (gst_pad_get_caps_list(pad), gst_pad_get_caps_list(sinkpad))) {
if (gst_caps_check_compatibility (gst_pad_get_caps(pad), gst_pad_get_caps(sinkpad))) {
gst_pad_connect(pad, sinkpad);
GST_DEBUG (0,"gstpipeline: autoconnect pad \"%s\" in element %s <-> ", GST_PAD_NAME (pad),
GST_ELEMENT_NAME(src));
......@@ -175,7 +176,7 @@ gst_autoplug_pads_autoplug_func (GstElement *src, GstPad *pad, GstElement *sink)
typedef struct {
GstElement *result;
GList *endcap;
GstCaps *endcap;
gint i;
} dynamic_pad_struct;
......@@ -190,9 +191,10 @@ autoplug_dynamic_pad (GstElement *element, GstPad *pad, gpointer data)
while (pads) {
GstPad *pad = GST_PAD (pads->data);
GstPadTemplate *templ = GST_PAD_PADTEMPLATE (pad);
pads = g_list_next (pads);
if (gst_caps_list_check_compatibility (gst_pad_get_caps_list (pad), info->endcap)) {
if (gst_caps_check_compatibility (GST_PADTEMPLATE_CAPS (templ), info->endcap)) {
gst_element_add_ghost_pad (info->result, pad, g_strdup_printf("src_%02d", info->i));
GST_DEBUG (0,"gstpipeline: new dynamic pad %s\n", GST_PAD_NAME (pad));
break;
......@@ -232,8 +234,8 @@ gst_autoplug_elementfactory_get_list (gpointer data)
}
typedef struct {
GList *src;
GList *sink;
GstCaps *src;
GstCaps *sink;
} caps_struct;
#define IS_CAPS(cap) (((cap) == caps->src) || (cap) == caps->sink)
......@@ -245,16 +247,13 @@ gst_autoplug_caps_find_cost (gpointer src, gpointer dest, gpointer data)
gboolean res;
if (IS_CAPS (src) && IS_CAPS (dest)) {
res = gst_caps_list_check_compatibility ((GList *)src, (GList *)dest);
//GST_INFO (GST_CAT_AUTOPLUG_ATTEMPT,"caps %d to caps %d %d", ((GstCaps *)src)->id, ((GstCaps *)dest)->id, res);
res = gst_caps_check_compatibility ((GstCaps *)src, (GstCaps *)dest);
}
else if (IS_CAPS (src)) {
res = gst_elementfactory_can_sink_caps_list ((GstElementFactory *)dest, (GList *)src);
//GST_INFO (GST_CAT_AUTOPLUG_ATTEMPT,"factory %s to src caps %d %d", ((GstElementFactory *)dest)->name, ((GstCaps *)src)->id, res);
res = gst_elementfactory_can_sink_caps ((GstElementFactory *)dest, (GstCaps *)src);
}
else if (IS_CAPS (dest)) {
res = gst_elementfactory_can_src_caps_list ((GstElementFactory *)src, (GList *)dest);
//GST_INFO (GST_CAT_AUTOPLUG_ATTEMPT,"factory %s to sink caps %d %d", ((GstElementFactory *)src)->name, ((GstCaps *)dest)->id, res);
res = gst_elementfactory_can_src_caps ((GstElementFactory *)src, (GstCaps *)dest);
}
else {
res = gst_autoplug_can_match ((GstElementFactory *)src, (GstElementFactory *)dest);
......@@ -267,10 +266,10 @@ gst_autoplug_caps_find_cost (gpointer src, gpointer dest, gpointer data)
}
static GstElement*
gst_static_autoplug_to_caps (GstAutoplug *autoplug, GList *srccaps, GList *sinkcaps, va_list args)
gst_static_autoplug_to_caps (GstAutoplug *autoplug, GstCaps *srccaps, GstCaps *sinkcaps, va_list args)
{
caps_struct caps;
GList *capslist;
GstCaps *capslist;
GstElement *result = NULL, *srcelement = NULL;
GList **factories;
GList *chains = NULL;
......@@ -307,7 +306,7 @@ gst_static_autoplug_to_caps (GstAutoplug *autoplug, GList *srccaps, GList *sinkc
else {
}
capslist = va_arg (args, GList *);
capslist = va_arg (args, GstCaps *);
}
/*
......@@ -376,8 +375,9 @@ gst_static_autoplug_to_caps (GstAutoplug *autoplug, GList *srccaps, GList *sinkc
while (pads) {
GstPad *pad = GST_PAD (pads->data);
GstPadTemplate *templ = GST_PAD_PADTEMPLATE (pad);
if (gst_caps_list_check_compatibility (srccaps, gst_pad_get_caps_list (pad))) {
if (gst_caps_check_compatibility (srccaps, GST_PADTEMPLATE_CAPS (templ))) {
gst_element_add_ghost_pad (result, pad, "sink");
break;
}
......@@ -430,7 +430,7 @@ differ:
* find a suitable pad to turn into a ghostpad
*/
{
GList *endcap = (GList *)(endcaps->data);
GstCaps *endcap = (GstCaps *)(endcaps->data);
GList *pads = gst_element_get_pad_list (thesrcelement);
gboolean have_pad = FALSE;
endcaps = g_list_next (endcaps);
......@@ -439,9 +439,10 @@ differ:
while (pads) {
GstPad *pad = GST_PAD (pads->data);
GstPadTemplate *templ = GST_PAD_PADTEMPLATE (pad);
pads = g_list_next (pads);
if (gst_caps_list_check_compatibility (gst_pad_get_caps_list (pad), endcap)) {
if (gst_caps_check_compatibility (GST_PADTEMPLATE_CAPS (templ), endcap)) {
gst_element_add_ghost_pad (result, pad, g_strdup_printf("src_%02d", i));
have_pad = TRUE;
break;
......
......@@ -41,7 +41,7 @@ static GList* gst_autoplug_func (gpointer src, gpointer sink,
static GstElement* gst_static_autoplug_to_render (GstAutoplug *autoplug,
GList *srccaps, GstElement *target, va_list args);
GstCaps *srccaps, GstElement *target, va_list args);
static GstAutoplugClass *parent_class = NULL;
......@@ -118,7 +118,7 @@ gst_autoplug_can_match (GstElementFactory *src, GstElementFactory *dest)
if (srctemp->direction == GST_PAD_SRC &&
desttemp->direction == GST_PAD_SINK) {
if (gst_caps_list_check_compatibility (srctemp->caps, desttemp->caps)) {
if (gst_caps_check_compatibility (GST_PADTEMPLATE_CAPS (srctemp), GST_PADTEMPLATE_CAPS (desttemp))) {
GST_INFO (GST_CAT_AUTOPLUG_ATTEMPT,
"factory \"%s\" can connect with factory \"%s\"", src->name, dest->name);
return TRUE;
......@@ -148,20 +148,14 @@ gst_autoplug_pads_autoplug_func (GstElement *src, GstPad *pad, GstElement *sink)
GstPad *sinkpad = (GstPad *)sinkpads->data;
// if we have a match, connect the pads
if (gst_pad_get_direction(sinkpad) == GST_PAD_SINK &&
!GST_PAD_CONNECTED(sinkpad))
if (gst_pad_get_direction(sinkpad) == GST_PAD_SINK &&
!GST_PAD_CONNECTED (pad) && !GST_PAD_CONNECTED(sinkpad))
{
if (gst_caps_list_check_compatibility (gst_pad_get_caps_list(pad), gst_pad_get_caps_list(sinkpad))) {
gst_pad_connect(pad, sinkpad);
GST_DEBUG (0,"gstpipeline: autoconnect pad \"%s\" in element %s <-> ", GST_PAD_NAME (pad),
GST_ELEMENT_NAME(src));
GST_DEBUG (0,"pad \"%s\" in element %s\n", GST_PAD_NAME (sinkpad),
GST_ELEMENT_NAME(sink));
connected = TRUE;
break;
if ((connected = gst_pad_connect (pad, sinkpad))) {
break;
}
else {
GST_DEBUG (0,"pads incompatible %s, %s\n", GST_PAD_NAME (pad), GST_PAD_NAME (sinkpad));
GST_DEBUG (0,"pads incompatible %s, %s\n", GST_PAD_NAME (pad), GST_PAD_NAME (sinkpad));
}
}
sinkpads = g_list_next(sinkpads);
......@@ -173,33 +167,6 @@ gst_autoplug_pads_autoplug_func (GstElement *src, GstPad *pad, GstElement *sink)
return connected;
}
typedef struct {
GstElement *result;
GList *endcap;
gint i;
} dynamic_pad_struct;
static void
autoplug_dynamic_pad (GstElement *element, GstPad *pad, gpointer data)
{
dynamic_pad_struct *info = (dynamic_pad_struct *)data;
GList *pads = gst_element_get_pad_list (element);
GST_DEBUG (0,"attempting to dynamically create a ghostpad for %s=%s\n", GST_ELEMENT_NAME (element),
GST_PAD_NAME (pad));
while (pads) {
GstPad *pad = GST_PAD (pads->data);
pads = g_list_next (pads);
if (gst_caps_list_check_compatibility (gst_pad_get_caps_list (pad), info->endcap)) {
gst_element_add_ghost_pad (info->result, pad, g_strdup_printf("src_%02d", info->i));
GST_DEBUG (0,"gstpipeline: new dynamic pad %s\n", GST_PAD_NAME (pad));
break;
}
}
}
static void
gst_autoplug_pads_autoplug (GstElement *src, GstElement *sink)
{
......@@ -211,8 +178,11 @@ gst_autoplug_pads_autoplug (GstElement *src, GstElement *sink)
while (srcpads && !connected) {
GstPad *srcpad = (GstPad *)srcpads->data;
if (gst_pad_get_direction(srcpad) == GST_PAD_SRC)
if (gst_pad_get_direction(srcpad) == GST_PAD_SRC) {
connected = gst_autoplug_pads_autoplug_func (src, srcpad, sink);
if (connected)
break;
}
srcpads = g_list_next(srcpads);
}
......@@ -234,8 +204,8 @@ gst_autoplug_elementfactory_get_list (gpointer data)
}
typedef struct {
GList *src;
GList *sink;
GstCaps *src;
GstCaps *sink;
} caps_struct;
#define IS_CAPS(cap) (((cap) == caps->src) || (cap) == caps->sink)
......@@ -247,15 +217,15 @@ gst_autoplug_caps_find_cost (gpointer src, gpointer dest, gpointer data)
gboolean res;
if (IS_CAPS (src) && IS_CAPS (dest)) {
res = gst_caps_list_check_compatibility ((GList *)src, (GList *)dest);
res = gst_caps_check_compatibility ((GstCaps *)src, (GstCaps *)dest);
//GST_INFO (GST_CAT_AUTOPLUG_ATTEMPT,"caps %d to caps %d %d", ((GstCaps *)src)->id, ((GstCaps *)dest)->id, res);
}
else if (IS_CAPS (src)) {
res = gst_elementfactory_can_sink_caps_list ((GstElementFactory *)dest, (GList *)src);
res = gst_elementfactory_can_sink_caps ((GstElementFactory *)dest, (GstCaps *)src);
//GST_INFO (GST_CAT_AUTOPLUG_ATTEMPT,"factory %s to src caps %d %d", ((GstElementFactory *)dest)->name, ((GstCaps *)src)->id, res);
}
else if (IS_CAPS (dest)) {
res = gst_elementfactory_can_src_caps_list ((GstElementFactory *)src, (GList *)dest);
res = gst_elementfactory_can_src_caps ((GstElementFactory *)src, (GstCaps *)dest);
//GST_INFO (GST_CAT_AUTOPLUG_ATTEMPT,"factory %s to sink caps %d %d", ((GstElementFactory *)src)->name, ((GstCaps *)dest)->id, res);
}
else {
......@@ -269,7 +239,7 @@ gst_autoplug_caps_find_cost (gpointer src, gpointer dest, gpointer data)
}
static GstElement*
gst_static_autoplug_to_render (GstAutoplug *autoplug, GList *srccaps, GstElement *target, va_list args)
gst_static_autoplug_to_render (GstAutoplug *autoplug, GstCaps *srccaps, GstElement *target, va_list args)
{
caps_struct caps;
GstElement *targetelement;
......@@ -292,10 +262,12 @@ gst_static_autoplug_to_render (GstAutoplug *autoplug, GList *srccaps, GstElement
while (targetelement) {
GList *elements;
GstPad *pad;
GstPadTemplate *templ;
pad = GST_PAD (gst_element_get_pad_list (targetelement)->data);
templ = GST_PAD_PADTEMPLATE (pad);
caps.sink = gst_pad_get_caps_list (pad);
caps.sink = GST_PADTEMPLATE_CAPS (templ);
GST_INFO (GST_CAT_AUTOPLUG_ATTEMPT,"autoplugging two caps structures");
......@@ -381,8 +353,9 @@ gst_static_autoplug_to_render (GstAutoplug *autoplug, GList *srccaps, GstElement
while (pads) {
GstPad *pad = GST_PAD (pads->data);
GstPadTemplate *templ = GST_PAD_PADTEMPLATE (pad);
if (gst_caps_list_check_compatibility (srccaps, gst_pad_get_caps_list (pad))) {
if (gst_caps_check_compatibility (srccaps, GST_PADTEMPLATE_CAPS (templ))) {
gst_element_add_ghost_pad (result, pad, "sink");
break;
}
......@@ -435,8 +408,7 @@ differ:
// this element suggests the use of a thread, so we set one up...
if (GST_ELEMENT_IS_THREAD_SUGGESTED(element) || use_thread) {
GstElement *queue;
GList *sinkpads;
GstPad *srcpad, *sinkpad;
GstPad *srcpad;
use_thread = FALSE;
......@@ -453,22 +425,6 @@ differ:
srcpad = gst_element_get_pad(queue, "src");
sinkpads = gst_element_get_pad_list(element);
while (sinkpads) {
sinkpad = (GstPad *)sinkpads->data;
// FIXME connect matching pads, not just the first one...
if (gst_pad_get_direction(sinkpad) == GST_PAD_SINK &&
!GST_PAD_CONNECTED(sinkpad)) {
GList *caps = gst_pad_get_caps_list (sinkpad);
// the queue has the type of the elements it connects
gst_pad_set_caps_list (srcpad, caps);
gst_pad_set_caps_list (gst_element_get_pad(queue, "sink"), caps);
break;
}
sinkpads = g_list_next(sinkpads);
}
gst_autoplug_pads_autoplug(thesrcelement, queue);
GST_DEBUG (0,"adding element %s\n", GST_ELEMENT_NAME (element));
......
......@@ -417,8 +417,9 @@ gst_audiosink_change_state (GstElement *element)
/* otherwise (READY or higher) we need to open the sound card */
} else {
if (!GST_FLAG_IS_SET (element, GST_AUDIOSINK_OPEN)) {
if (!gst_audiosink_open_audio (GST_AUDIOSINK (element)))
return GST_STATE_FAILURE;
if (!gst_audiosink_open_audio (GST_AUDIOSINK (element))) {
//return GST_STATE_FAILURE;
}
}
}
......
......@@ -102,7 +102,7 @@ gst_autoplug_signal_new_object (GstAutoplug *autoplug, GstObject *object)
GstElement*
gst_autoplug_to_caps (GstAutoplug *autoplug, GList *srccaps, GList *sinkcaps, ...)
gst_autoplug_to_caps (GstAutoplug *autoplug, GstCaps *srccaps, GstCaps *sinkcaps, ...)
{
GstAutoplugClass *oclass;
GstElement *element = NULL;
......@@ -120,7 +120,7 @@ gst_autoplug_to_caps (GstAutoplug *autoplug, GList *srccaps, GList *sinkcaps, ..
}
GstElement*
gst_autoplug_to_renderers (GstAutoplug *autoplug, GList *srccaps, GstElement *target, ...)
gst_autoplug_to_renderers (GstAutoplug *autoplug, GstCaps *srccaps, GstElement *target, ...)
{
GstAutoplugClass *oclass;
GstElement *element = NULL;
......
......@@ -63,8 +63,8 @@ struct _GstAutoplugClass {
void (*new_object) (GstAutoplug *autoplug, GstObject *object);
/* perform the autoplugging */
GstElement* (*autoplug_to_caps) (GstAutoplug *autoplug, GList *srccaps, GList *sinkcaps, va_list args);
GstElement* (*autoplug_to_renderers) (GstAutoplug *autoplug, GList *srccaps, GstElement *target, va_list args);
GstElement* (*autoplug_to_caps) (GstAutoplug *autoplug, GstCaps *srccaps, GstCaps *sinkcaps, va_list args);
GstElement* (*autoplug_to_renderers) (GstAutoplug *autoplug, GstCaps *srccaps, GstElement *target, va_list args);
};
typedef struct _GstAutoplugFactory GstAutoplugFactory;
......@@ -79,8 +79,8 @@ GtkType gst_autoplug_get_type (void);
void gst_autoplug_signal_new_object (GstAutoplug *autoplug, GstObject *object);
GstElement* gst_autoplug_to_caps (GstAutoplug *autoplug, GList *srccaps, GList *sinkcaps, ...);
GstElement* gst_autoplug_to_renderers (GstAutoplug *autoplug, GList *srccaps,
GstElement* gst_autoplug_to_caps (GstAutoplug *autoplug, GstCaps *srccaps, GstCaps *sinkcaps, ...);
GstElement* gst_autoplug_to_renderers (GstAutoplug *autoplug, GstCaps *srccaps,
GstElement *target, ...);
......
......@@ -72,6 +72,7 @@ gst_caps_new (const gchar *name, const gchar *mime)
caps->name = g_strdup (name);
caps->id = get_type_for_mime (mime);
caps->properties = NULL;
caps->next = NULL;
return caps;
}
......@@ -297,20 +298,77 @@ gst_caps_get_props (GstCaps *caps)
}
/**
* gst_caps_check_compatibility:
* @fromcaps: a capabilty
* @tocaps: a capabilty
* gst_caps_append:
* @caps: a capabilty
* @capstoadd: the capability to append
*
* Checks whether two capabilities are compatible.
* Appends a capability to the existing capability.
*
* Returns: TRUE if compatible, FALSE otherwise
* Returns: the new capability
*/
gboolean
gst_caps_check_compatibility (GstCaps *fromcaps, GstCaps *tocaps)
GstCaps*
gst_caps_append (GstCaps *caps, GstCaps *capstoadd)
{
g_return_val_if_fail (fromcaps != NULL, FALSE);
g_return_val_if_fail (tocaps != NULL, FALSE);
GstCaps *orig = caps;
if (caps == NULL)
return capstoadd;
while (caps->next) {
caps = caps->next;
}
caps->next = capstoadd;
return orig;
}
/**
* gst_caps_prepend:
* @caps: a capabilty
* @capstoadd: a capabilty to prepend
*
* prepend the capability to the list of capabilities
*
* Returns: the new capability
*/
GstCaps*
gst_caps_prepend (GstCaps *caps, GstCaps *capstoadd)
{
GstCaps *orig = capstoadd;
if (capstoadd == NULL)
return caps;
while (capstoadd->next) {
capstoadd = capstoadd->next;
}
capstoadd->next = caps;
return orig;
}
GstCaps*
gst_caps_get_by_name (GstCaps *caps, const gchar *name)
{
g_return_val_if_fail (caps != NULL, NULL);
g_return_val_if_fail (name != NULL, NULL);
while (caps) {
if (!strcmp (caps->name, name))
return caps;
caps = caps->next;
}
return NULL;
}
static gboolean
gst_caps_check_compatibility_func (GstCaps *fromcaps, GstCaps *tocaps)
{
if (fromcaps == NULL ||
tocaps == NULL)
return TRUE;
if (fromcaps->id != tocaps->id) {
GST_DEBUG (0,"gstcaps: mime types differ (%d to %d)\n",
fromcaps->id, tocaps->id);
......@@ -343,21 +401,18 @@ gst_caps_check_compatibility (GstCaps *fromcaps, GstCaps *tocaps)
* Returns: TRUE if compatible, FALSE otherwise
*/
gboolean
gst_caps_list_check_compatibility (GList *fromcaps, GList *tocaps)
gst_caps_check_compatibility (GstCaps *fromcaps, GstCaps *tocaps)
{
while (fromcaps) {
GstCaps *fromcap = (GstCaps *)fromcaps->data;
GList *destcaps = tocaps;
GstCaps *destcaps = tocaps;
while (destcaps) {
GstCaps *destcap = (GstCaps *)destcaps->data;
if (gst_caps_check_compatibility (fromcap, destcap))
if (gst_caps_check_compatibility_func (fromcaps, destcaps))
return TRUE;
destcaps = g_list_next (destcaps);
destcaps = destcaps->next;
}
fromcaps = g_list_next (fromcaps);
fromcaps = fromcaps->next;
}
return FALSE;
}
......@@ -375,15 +430,20 @@ xmlNodePtr
gst_caps_save_thyself (GstCaps *caps, xmlNodePtr parent)
{
xmlNodePtr subtree;
xmlNodePtr subsubtree;
g_return_val_if_fail (caps != NULL, NULL);
while (caps) {
subtree = xmlNewChild (parent, NULL, "capscomp", NULL);
xmlNewChild (parent, NULL, "name", caps->name);
xmlNewChild (parent, NULL, "type", gst_type_find_by_id (caps->id)->mime);
if (caps->properties) {
subtree = xmlNewChild (parent, NULL, "properties", NULL);
xmlNewChild (subtree, NULL, "name", caps->name);
xmlNewChild (subtree, NULL, "type", gst_type_find_by_id (caps->id)->mime);
if (caps->properties) {
subsubtree = xmlNewChild (subtree, NULL, "properties", NULL);
gst_props_save_thyself (caps->properties, subtree);
gst_props_save_thyself (caps->properties, subsubtree);
}
caps = caps->next;
}
return parent;
......@@ -400,26 +460,36 @@ gst_caps_save_thyself (GstCaps *caps, xmlNodePtr parent)
GstCaps*
gst_caps_load_thyself (xmlNodePtr parent)
{
GstCaps *caps = g_new0 (GstCaps, 1);
GstCaps *result = NULL;
xmlNodePtr field = parent->xmlChildrenNode;
gchar *content;
while (field) {
if (!strcmp (field->name, "name")) {
caps->name = xmlNodeGetContent (field);
}
if (!strcmp (field->name, "type")) {
content = xmlNodeGetContent (field);
caps->id = get_type_for_mime (content);
g_free (content);
}
else if (!strcmp (field->name, "properties")) {
caps->properties = gst_props_load_thyself (field);
if (!strcmp (field->name, "capscomp")) {
xmlNodePtr subfield = field->xmlChildrenNode;
GstCaps *caps = g_new0 (GstCaps, 1);
gchar *content;
while (subfield) {
if (!strcmp (subfield->name, "name")) {
caps->name = xmlNodeGetContent (subfield);
}
if (!strcmp (subfield->name, "type")) {
content = xmlNodeGetContent (subfield);
caps->id = get_type_for_mime (content);
g_free (content);
}
else if (!strcmp (subfield->name, "properties")) {
caps->properties = gst_props_load_thyself (subfield);
}
subfield = subfield->next;
}
result = gst_caps_append (result, caps);
}
field = field->next;
}