[gstreamermm] Remove the use of libxml++ as is done in the C API.



commit 9d35e49c0dbfc16e14f72b48d8058cfe26025e0a
Author: José Alburquerque <jaalburquerque gmail com>
Date:   Tue Jul 16 18:12:55 2013 -0400

    Remove the use of libxml++ as is done in the C API.
    
        * gstreamer/src/caps.{ccg,hg} (save,load): Remove these methods which
        save and load the caps as XML.
        * gstreamer/src/object.{ccg,hg} (save, restore): Remove these methods
        that save and load the object as XML.
        (signal_object_saved): Remove this signal that is triggered when an
        object is saved as XML (it is now obsolete).
    
        * gstreamer/src/registry.{ccg,hg} ([binary|xml]_[read|write]_cache):
        Remove these methods because they have also been removed in the C API.
        Also update the class docs according to the new docs in the C API.
    
        * gstreamer/src/filelist.am:
        * gstreamer/src/xml.{ccg,hg}: Remove these files defining the XML
        class because it's also been removed in the C API.  Also remove the
        files from the list of files to be built.

 gstreamer/src/caps.ccg     |    8 ---
 gstreamer/src/caps.hg      |   10 ---
 gstreamer/src/filelist.am  |    1 -
 gstreamer/src/object.ccg   |  120 ------------------------------------
 gstreamer/src/object.hg    |   32 ----------
 gstreamer/src/registry.ccg |   28 --------
 gstreamer/src/registry.hg  |  147 +++++++++++++++++---------------------------
 gstreamer/src/xml.ccg      |   53 ----------------
 gstreamer/src/xml.hg       |   98 -----------------------------
 9 files changed, 57 insertions(+), 440 deletions(-)
---
diff --git a/gstreamer/src/caps.ccg b/gstreamer/src/caps.ccg
index 8bd2994..86ea14c 100644
--- a/gstreamer/src/caps.ccg
+++ b/gstreamer/src/caps.ccg
@@ -102,12 +102,4 @@ Caps::set_simple(const Glib::ustring& name, const char* data)
   set_simple(name, std::string(data));
 }
 
-xmlpp::Node* Caps::save(xmlpp::Node* parent) const
-{
-  gst_caps_save_thyself(gobj(), parent->cobj());
-
-  // gst_caps_save_thyself() returns the parent node so return parent here also:
-  return parent;
-}
-
 } //namespace Gst
diff --git a/gstreamer/src/caps.hg b/gstreamer/src/caps.hg
index 7d68af0..ba52937 100644
--- a/gstreamer/src/caps.hg
+++ b/gstreamer/src/caps.hg
@@ -19,7 +19,6 @@
 
 #include <gst/gstcaps.h>
 #include <gstreamermm/structure.h>
-#include <libxml++/nodes/node.h>
 
 _DEFS(gstreamermm,gst)
 
@@ -194,15 +193,6 @@ public:
 
   _WRAP_METHOD(bool simplify(), gst_caps_do_simplify)
 
-  /** Serializes a Gst::Caps to XML and adds it as a child node of @a parent.
-   * @param parent A XML parent node.
-   * @return The parent XML Node.
-   */
-  xmlpp::Node* save(xmlpp::Node* parent) const;
-  _IGNORE(gst_caps_save_thyself)
-
-  _WRAP_METHOD(static Glib::RefPtr<Gst::Caps> load(xmlpp::Node* parent), gst_caps_load_thyself)
-
   _WRAP_METHOD(Glib::ustring to_string() const, gst_caps_to_string)
 
   //This is const (returns a non const) because it always creates a new instance:
diff --git a/gstreamer/src/filelist.am b/gstreamer/src/filelist.am
index ff45dc9..1cd4942 100644
--- a/gstreamer/src/filelist.am
+++ b/gstreamer/src/filelist.am
@@ -152,7 +152,6 @@ files_hg  =                     \
         value.hg                \
         videoorientation.hg     \
         videosink.hg            \
-        xml.hg                  \
         xoverlay.hg             \
         $(plugins_hg)
 
diff --git a/gstreamer/src/object.ccg b/gstreamer/src/object.ccg
index 33a02b8..a2e1d05 100644
--- a/gstreamer/src/object.ccg
+++ b/gstreamer/src/object.ccg
@@ -46,124 +46,4 @@ Object::Object(GstObject* castitem)
   }
 }
 
-xmlpp::Node* Object::save(xmlpp::Node* parent)
-{
-  gst_object_save_thyself(gobj(), parent->cobj());
-
-  // gst_object_save_thyself() returns parent node so do so here also.
-  return parent;
-}
-
-const xmlpp::Node* Object::save(const xmlpp::Node* parent) const
-{
-  gst_object_save_thyself(const_cast<GstObject*>(gobj()),
-    const_cast<xmlNodePtr>(parent->cobj()));
-
-  // gst_object_save_thyself() returns parent node so do so here also.
-  return parent;
-}
-
-GstXmlNodePtr Object_Class::save_thyself_vfunc_callback(GstObject* self, GstXmlNodePtr parent)
-{
-  Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
-      Glib::ObjectBase::_get_current_wrapper((GObject*)self));
-
-  // Non-gtkmmproc-generated custom classes implicitly call the default
-  // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
-  // generated classes can use this optimisation, which avoids the unnecessary
-  // parameter conversions if there is no possibility of the virtual function
-  // being overridden:
-  if(obj_base && obj_base->is_derived_())
-  {
-    CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
-    if(obj) // This can be NULL during destruction.
-    {
-      try // Trap C++ exceptions which would normally be lost because this is a C callback.
-      {
-        xmlpp::Node xmlpp_parent(parent);
-        // Call the virtual member method, which derived classes might override.
-        (void) obj->save_vfunc(&xmlpp_parent);
-        return parent;
-      }
-      catch(...)
-      {
-        Glib::exception_handlers_invoke();
-      }
-    }
-  }
-  
-  BaseClassType *const base = static_cast<BaseClassType*>(
-      g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The 
original underlying C class).
-  );
-
-  // Call the original underlying C function:
-  if(base && base->save_thyself)
-    return (*base->save_thyself)(self, parent);
-
-
-  typedef GstXmlNodePtr RType;
-  return RType();
-}
-void Object_Class::restore_thyself_vfunc_callback(GstObject* self, GstXmlNodePtr self_node)
-{
-  Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
-      Glib::ObjectBase::_get_current_wrapper((GObject*)self));
-
-  // Non-gtkmmproc-generated custom classes implicitly call the default
-  // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
-  // generated classes can use this optimisation, which avoids the unnecessary
-  // parameter conversions if there is no possibility of the virtual function
-  // being overridden:
-  if(obj_base && obj_base->is_derived_())
-  {
-    CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
-    if(obj) // This can be NULL during destruction.
-    {
-      try // Trap C++ exceptions which would normally be lost because this is a C callback.
-      {
-        // Call the virtual member method, which derived classes might override.
-        xmlpp::Node xmlpp_node(self_node);
-        obj->restore_vfunc(&xmlpp_node);
-        return;
-      }
-      catch(...)
-      {
-        Glib::exception_handlers_invoke();
-      }
-    }
-  }
-  
-  BaseClassType *const base = static_cast<BaseClassType*>(
-      g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The 
original underlying C class).
-  );
-
-  // Call the original underlying C function:
-  if(base && base->restore_thyself)
-    (*base->restore_thyself)(self, self_node);
-
-}
-xmlpp::Node* Gst::Object::save_vfunc(xmlpp::Node* parent) 
-{
-  BaseClassType *const base = static_cast<BaseClassType*>(
-      g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class 
(The original underlying C class).
-  );
-
-  if(base && base->save_thyself)
-  {
-    (*base->save_thyself)(gobj(),parent->cobj());
-    return parent;
-  }
-
-  return 0;
-}
-void Gst::Object::restore_vfunc(xmlpp::Node* self_node) 
-{
-  BaseClassType *const base = static_cast<BaseClassType*>(
-      g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class 
(The original underlying C class).
-  );
-
-  if(base && base->restore_thyself)
-    (*base->restore_thyself)(gobj(),self_node->cobj());
-}
-
 } // namespace Gst
diff --git a/gstreamer/src/object.hg b/gstreamer/src/object.hg
index ed6dd2c..847af33 100644
--- a/gstreamer/src/object.hg
+++ b/gstreamer/src/object.hg
@@ -21,7 +21,6 @@
 #include <glibmm/object.h>
 #include <glibmm/listhandle.h>
 #include <glibmm/threads.h>
-#include <libxml++/nodes/node.h>
 
 _DEFS(gstreamermm,gst)
 
@@ -87,20 +86,6 @@ public:
 
   _WRAP_METHOD(bool has_ancestor(const Glib::RefPtr<const Gst::Object>& ancestor) const, 
gst_object_has_ancestor)
 
-  /** Saves object into the parent XML node.
-   * @param parent The parent XML node to save object into.
-   * @return The new xmlpp::Node pointer with the saved object.
-   */
-  xmlpp::Node* save(xmlpp::Node* parent);
-  _IGNORE(gst_object_save_thyself)
-
-  /** Saves object into the parent XML node.
-   * @param parent The parent XML node to save object into.
-   * @return The new xmlpp::Node pointer with the saved object.
-   */
-  const xmlpp::Node* save(const xmlpp::Node* parent) const;
-
-  _WRAP_METHOD(void restore(xmlpp::Node* self), gst_object_restore_thyself)
   _WRAP_METHOD(Glib::ustring get_path_string(), gst_object_get_path_string)
 
   _WRAP_PROPERTY("name", Glib::ustring)
@@ -109,28 +94,11 @@ public:
   //TODO: Maybe GParamSpec should be wrapped in glibmm?
   _WRAP_SIGNAL(void deep_notify(const Glib::RefPtr<Object>& prop_object, GParamSpec* prop), "deep-notify")
 
-  //TODO: Use xmlpp::Node for parameter?
-  _WRAP_SIGNAL(void object_saved(GstXmlNodePtr xml_node), "object-saved")  
-
 #m4 _CONVERSION(`GstObject*', `const Glib::RefPtr<Object>&', `Glib::wrap($3, true)')
 #m4 _CONVERSION(`const Glib::RefPtr<Object>&', `GstObject*', `Glib::unwrap($3)')
 
   _WRAP_SIGNAL(void parent_set(const Glib::RefPtr<Object>& parent), "parent-set")
   _WRAP_SIGNAL(void parent_unset(const Glib::RefPtr<Object>& parent), "parent-unset")
-
-  virtual xmlpp::Node* save_vfunc(xmlpp::Node* parent);
-  virtual void restore_vfunc(xmlpp::Node* self_node);
-
-protected:
-#m4begin
-  _PUSH(SECTION_PCC_CLASS_INIT_VFUNCS)
-  klass->save_thyself = &save_thyself_vfunc_callback;
-  klass->restore_thyself = &restore_thyself_vfunc_callback;
-  _SECTION(SECTION_PH_VFUNCS)
-  static GstXmlNodePtr save_thyself_vfunc_callback(GstObject* self, GstXmlNodePtr parent);
-  static void restore_thyself_vfunc_callback(GstObject* self, GstXmlNodePtr self_node);
-  _POP()
-#m4end
 };
 
 } // namespace Gst
diff --git a/gstreamer/src/registry.ccg b/gstreamer/src/registry.ccg
index 39ddac8..f35cfb4 100644
--- a/gstreamer/src/registry.ccg
+++ b/gstreamer/src/registry.ccg
@@ -114,32 +114,4 @@ Registry::get_feature_list(const PluginFeature::SlotFilter& filter,
     Glib::OWNERSHIP_DEEP);
 }
 
-#ifdef USE_BINARY_REGISTRY
-
-bool Registry::binary_read_cache(const Glib::ustring& location)
-{
-  return gst_registry_binary_read_cache(gobj(), location.c_str());
-}
-
-bool Registry::binary_write_cache(const Glib::ustring& location) const
-{
-  return gst_registry_binary_write_cache(const_cast<GstRegistry*>(gobj()),
-    location.c_str());
-}
-
-#else
-
-bool Registry::xml_read_cache(const Glib::ustring& location)
-{
-  return gst_registry_xml_read_cache(gobj(), location.c_str());
-}
-
-bool Registry::xml_write_cache(const Glib::ustring& location) const
-{
-  return gst_registry_xml_write_cache(const_cast<GstRegistry*>(gobj()),
-    location.c_str());
-}
-
-#endif
-
 } //namespace Gst
diff --git a/gstreamer/src/registry.hg b/gstreamer/src/registry.hg
index e2bd478..8849999 100644
--- a/gstreamer/src/registry.hg
+++ b/gstreamer/src/registry.hg
@@ -31,59 +31,63 @@ class Plugin;
 class PluginFeature;
 
 /** An abstract base class for management of Gst::Plugin objects.
-  * One registry holds the metadata of a set of plugins. All registries build
-  * the GstRegistryPool.
-  *
-  * Design:
-  *
-  * The Gst::Registry object is a list of plugins and some functions for
-  * dealing with them. Gst::Plugins are matched 1-1 with a file on disk, and
-  * may or may not be loaded at a given time. There may be multiple
-  * Gst::Registry objects, but the "default registry" is the only object that
-  * has any meaning to the core.
-  *
-  * The registry.xml file is actually a cache of plugin information. This is
-  * unlike versions prior to 0.10, where the registry file was the primary
-  * source of plugin information, and was created by the gst-register command.
-  *
-  * The primary source, at all times, of plugin information is each plugin file
-  * itself. Thus, if an application wants information about a particular
-  * plugin, or wants to search for a feature that satisfies given criteria, the
-  * primary means of doing so is to load every plugin and look at the resulting
-  * information that is gathered in the default registry. Clearly, this is a
-  * time consuming process, so we cache information in the registry.xml file.
-  *
-  * On startup, plugins are searched for in the plugin search path. This path
-  * can be set directly using the GST_PLUGIN_PATH environment variable. The
-  * registry file is loaded from
-  * ~/.gstreamer-$GST_MAJORMINOR/registry-$ARCH.xml or the file listed in the
-  * GST_REGISTRY env var. The only reason to change the registry location is
-  * for testing.
-  *
-  * For each plugin that is found in the plugin search path, there could be 3
-  * possibilities for cached information:
-  *
-  *    - the cache may not contain information about a given file.
-  *    - the cache may have stale information.
-  *    - the cache may have current information.
-  *
-  * In the first two cases, the plugin is loaded and the cache updated. In
-  * addition to these cases, the cache may have entries for plugins that are
-  * not relevant to the current process. These are marked as not available to
-  * the current process. If the cache is updated for whatever reason, it is
-  * marked dirty.
-  *
-  * A dirty cache is written out at the end of initialization. Each entry is
-  * checked to make sure the information is minimally valid. If not, the entry
-  * is simply dropped.
-  *
-  * Implementation notes:
-  *
-  * The "cache" and "default registry" are different concepts and can represent
-  * different sets of plugins. For various reasons, at init time, the cache is
-  * stored in the default registry, and plugins not relevant to the current
-  * process are marked with the GST_PLUGIN_FLAG_CACHED bit. These plugins are
-  * removed at the end of intitialization.
+ * One registry holds the metadata of a set of plugins.
+ *
+ * Design:
+ *
+ * The Gst::Registry object is a list of plugins and some functions for dealing
+ * with them. Each Gst::Plugin is matched 1-1 with a file on disk, and may or
+ * may not be loaded at a given time.
+ *
+ * The primary source, at all times, of plugin information is each plugin file
+ * itself. Thus, if an application wants information about a particular plugin,
+ * or wants to search for a feature that satisfies given criteria, the primary
+ * means of doing so is to load every plugin and look at the resulting
+ * information that is gathered in the default registry. Clearly, this is a
+ * time consuming process, so we cache information in the registry file. The
+ * format and location of the cache file is internal to gstreamer.
+ *
+ * On startup, plugins are searched for in the plugin search path. The
+ * following locations are checked in this order:
+ *
+ *  - location from --gst-plugin-path commandline option.
+ *  - the GST_PLUGIN_PATH environment variable.
+ *  - the GST_PLUGIN_SYSTEM_PATH environment variable.
+ *  - default locations (if GST_PLUGIN_SYSTEM_PATH is not set). Those default
+ *    locations are: ~/.gstreamer-$GST_API_VERSION/plugins/ and
+ *    $prefix/libs/gstreamer-$GST_API_VERSION/.
+ *
+ * The registry cache file is loaded from
+ * ~/.gstreamer-$GST_API_VERSION/registry-$ARCH.bin or the file listed in the
+ * GST_REGISTRY env var. One reason to change the registry location is for
+ * testing.
+ *
+ * For each plugin that is found in the plugin search path, there could be 3
+ * possibilities for cached information:
+ *
+ *  - the cache may not contain information about a given file.
+ *  - the cache may have stale information.
+ *  - the cache may have current information.
+ *
+ * In the first two cases, the plugin is loaded and the cache updated. In
+ * addition to these cases, the cache may have entries for plugins that are not
+ * relevant to the current process. These are marked as not available to the
+ * current process. If the cache is updated for whatever reason, it is marked
+ * dirty.
+ *
+ * A dirty cache is written out at the end of initialization. Each entry is
+ * checked to make sure the information is minimally valid. If not, the entry
+ * is simply dropped.
+ *
+ * Implementation notes:
+ *
+ * The "cache" and "registry" are different concepts and can represent
+ * different sets of plugins. For various reasons, at init time, the cache is
+ * stored in the default registry, and plugins not relevant to the current
+ * process are marked with the GST_PLUGIN_FLAG_CACHED bit. These plugins are
+ * removed at the end of initialization.
+ *
+ * Last reviewed on 2012-03-29 (0.11.3)
  */
 class Registry : public Object
 {
@@ -168,43 +172,6 @@ public:
   _WRAP_METHOD(Glib::RefPtr<const Gst::PluginFeature> lookup_feature(const Glib::ustring& name) const, 
gst_registry_lookup_feature, constversion)
   _WRAP_METHOD(void add_path(const Glib::ustring& path), gst_registry_add_path)
   _WRAP_METHOD(void scan_path(const Glib::ustring& path), gst_registry_scan_path)
-  // binary or xml registry cache depends on USE_BINARY_REGISTRY def in
-  // gstregistry.h
-
-#ifdef USE_BINARY_REGISTRY
-  /** Read the contents of the binary cache file at location into registry.
-   *
-   * @param location A filename.
-   * @return true on success.
-   */
-  bool binary_read_cache(const Glib::ustring& location);
-  _IGNORE(gst_registry_binary_read_cache)
-
-  /** Write the registry to a cache to file at given location.
-   *
-   * @param location A filename.
-   * @return true on success.
-   */
-  void binary_write_cache(const Glib::ustring& location) const;
-  _IGNORE(gst_registry_binary_write_cache)
-#else
-  /** Read the contents of the XML cache file at location into registry.
-   *
-   * @param location A filename.
-   * @return true on success. 
-   */
-  bool xml_read_cache(const Glib::ustring& location);
-  _IGNORE(gst_registry_xml_read_cache)
-
-  /** Write registry in an XML format at the location given by location.
-   * Directories are automatically created.
-   *
-   * @param location A filename.
-   * @return true on success.
-   */
-  bool xml_write_cache(const Glib::ustring& location) const;
-  _IGNORE(gst_registry_xml_write_cache)
-#endif
 
   _WRAP_METHOD(Glib::RefPtr<Gst::Plugin> lookup(const Glib::ustring& filename), gst_registry_lookup)
   _WRAP_METHOD(Glib::RefPtr<const Gst::Plugin> lookup(const Glib::ustring& filename) const, 
gst_registry_lookup, constversion)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]