gst/registries/gstxmlregistry.*: and update to newer API.
authorAndy Wingo <wingo@pobox.com>
Mon, 5 Sep 2005 16:54:54 +0000 (16:54 +0000)
committerAndy Wingo <wingo@pobox.com>
Mon, 5 Sep 2005 16:54:54 +0000 (16:54 +0000)
Original commit message from CVS:
* gst/registries/gstxmlregistry.h:
* gst/registries/gstxmlregistry.c: and update to newer API.
Incidentally they should be a bit faster now that they don't have
to parse the caps.

ChangeLog
gst/registries/gstxmlregistry.c
gst/registries/gstxmlregistry.h

index fdc6107..b70e0c9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,11 @@
        * gst/registries/gstxmlregistry.h:
        * gst/registries/gstxmlregistry.c: Um... resurrect...
        
+       * gst/registries/gstxmlregistry.h:
+       * gst/registries/gstxmlregistry.c: and update to newer API.
+       Incidentally they should be a bit faster now that they don't have
+       to parse the caps.
+       
 2005-09-05  Andy Wingo  <wingo@pobox.com>
 
        * gst/registries/gstxmlregistry.h:
index f2f8cc7..2faf9f9 100644 (file)
@@ -893,13 +893,8 @@ gst_xml_registry_parse_padtemplate (GMarkupParseContext * context,
     char *s;
 
     s = g_strndup (text, text_len);
-    g_assert (registry->caps == NULL);
-    registry->caps = gst_caps_from_string (s);
-    if (registry->caps == NULL) {
-      g_critical ("Could not parse caps: length %d, content: %*s",
-          (int) text_len, (int) text_len, text);
-    }
-    g_free (s);
+    g_assert (registry->caps_string == NULL);
+    registry->caps_string = s;
     return TRUE;
   }
   return TRUE;
@@ -951,7 +946,7 @@ gst_xml_registry_start_element (GMarkupParseContext * context,
           if (GST_IS_ELEMENT_FACTORY (feature)) {
             GstElementFactory *factory = GST_ELEMENT_FACTORY (feature);
 
-            factory->padtemplates = NULL;
+            factory->staticpadtemplates = NULL;
             xmlregistry->parser = gst_xml_registry_parse_element_factory;
             break;
           } else if (GST_IS_TYPE_FIND_FACTORY (feature)) {
@@ -971,7 +966,7 @@ gst_xml_registry_start_element (GMarkupParseContext * context,
         xmlregistry->name_template = NULL;
         xmlregistry->direction = 0;
         xmlregistry->presence = 0;
-        xmlregistry->caps = NULL;
+        xmlregistry->caps_string = NULL;
       }
       break;
     default:
@@ -1014,17 +1009,20 @@ gst_xml_registry_end_element (GMarkupParseContext * context,
       break;
     case GST_XML_REGISTRY_PADTEMPLATE:
       if (!strcmp (element_name, "padtemplate")) {
-        GstPadTemplate *template;
+        GstStaticPadTemplate *template;
 
-        template = gst_pad_template_new (xmlregistry->name_template,
-            xmlregistry->direction, xmlregistry->presence, xmlregistry->caps);
+        template = g_new0 (GstStaticPadTemplate, 1);
+        template->name_template = xmlregistry->name_template;
+        template->presence = xmlregistry->presence;
+        template->direction = xmlregistry->direction;
+        template->static_caps.string = xmlregistry->caps_string;
 
-        g_free (xmlregistry->name_template);
         xmlregistry->name_template = NULL;
-        xmlregistry->caps = NULL;
+        xmlregistry->caps_string = NULL;
 
-        __gst_element_factory_add_pad_template (GST_ELEMENT_FACTORY
+        __gst_element_factory_add_static_pad_template (GST_ELEMENT_FACTORY
             (xmlregistry->current_feature), template);
+
         xmlregistry->state = GST_XML_REGISTRY_FEATURE;
         xmlregistry->parser = gst_xml_registry_parse_element_factory;
       }
@@ -1213,7 +1211,7 @@ gst_xml_registry_save_feature (GstXMLRegistry * xmlregistry,
     PUT_ESCAPED ("description", factory->details.description);
     PUT_ESCAPED ("author", factory->details.author);
 
-    walk = factory->padtemplates;
+    walk = factory->staticpadtemplates;
 
     while (walk) {
       GstPadTemplate *template = GST_PAD_TEMPLATE (walk->data);
index 1ded630..daff15a 100644 (file)
@@ -102,7 +102,7 @@ struct _GstXMLRegistry {
   gchar                        *name_template;
   GstPadDirection       direction;
   GstPadPresence        presence;
-  GstCaps              *caps;
+  gchar                        *caps_string;
 
   gchar                        *caps_name;
   gchar                        *structure_name;