gnomemm r1364 - in gstreamermm/trunk: . gstreamer/src tools/m4
- From: jaalburqu svn gnome org
- To: svn-commits-list gnome org
- Subject: gnomemm r1364 - in gstreamermm/trunk: . gstreamer/src tools/m4
- Date: Fri, 22 Feb 2008 04:06:11 +0000 (GMT)
Author: jaalburqu
Date: Fri Feb 22 04:06:11 2008
New Revision: 1364
URL: http://svn.gnome.org/viewvc/gnomemm?rev=1364&view=rev
Log:
2008-02-21 Josà Alburquerque <jaalburqu svn gnome org>
* gstreamer/src/Makefile_list_of_hg.am_fragment:
* gstreamer/src/registry.ccg:
* gstreamer/src/registry.hg: Added Registry
* gstreamer/src/plugin.ccg:
* gstreamer/src/plugin.hg: Removed unnecessary SlotInit code and
name_filter() method (which is a standard gstreamer filter "slot" not
a member method)
* gstreamer/src/pluginfeature.hg: Renamed SlotFeatureFilter to
SlotFilter
* tools/m4/convert_gst.m4: Added PluginFeature and Registry
conversions; Removed unused GstURIHandler conversion
Added:
gstreamermm/trunk/gstreamer/src/registry.ccg
gstreamermm/trunk/gstreamer/src/registry.hg
Modified:
gstreamermm/trunk/ChangeLog
gstreamermm/trunk/gstreamer/src/Makefile_list_of_hg.am_fragment
gstreamermm/trunk/gstreamer/src/plugin.ccg
gstreamermm/trunk/gstreamer/src/plugin.hg
gstreamermm/trunk/gstreamer/src/pluginfeature.hg
gstreamermm/trunk/tools/m4/convert_gst.m4
Modified: gstreamermm/trunk/gstreamer/src/Makefile_list_of_hg.am_fragment
==============================================================================
--- gstreamermm/trunk/gstreamer/src/Makefile_list_of_hg.am_fragment (original)
+++ gstreamermm/trunk/gstreamer/src/Makefile_list_of_hg.am_fragment Fri Feb 22 04:06:11 2008
@@ -8,8 +8,8 @@
element.hg elementfactory.hg enums.hg error.hg event.hg filter.hg \
format.hg index.hg indexfactory.hg iterator.hg message.hg pad.hg \
padtemplate.hg parse.hg pipeline.hg plugin.hg pluginfeature.hg \
- query.hg structure.hg systemclock.hg task.hg urihandler.hg value.hg \
- xml.hg
+ query.hg registry.hg structure.hg systemclock.hg task.hg \
+ urihandler.hg value.hg xml.hg
files_general_deprecated_hg =
Modified: gstreamermm/trunk/gstreamer/src/plugin.ccg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/plugin.ccg (original)
+++ gstreamermm/trunk/gstreamer/src/plugin.ccg Fri Feb 22 04:06:11 2008
@@ -20,35 +20,3 @@
*/
#include <gst/gstplugin.h>
-
-static gboolean SignalProxy_Init_gstreamermm_callback(GstPlugin* plugin, void* data)
-{
- Gst::Plugin::SlotInit* the_slot = static_cast<Gst::Plugin::SlotInit*>(data);
-
- #ifdef GLIBMM_EXCEPTIONS_ENABLED
- try
- {
- #endif //GLIBMM_EXCEPTIONS_ENABLED
- return (*the_slot)(Glib::wrap(plugin, true));
- #ifdef GLIBMM_EXCEPTIONS_ENABLED
- }
- catch(...)
- {
- Glib::exception_handlers_invoke();
- }
-
- return 0; // arbitrary value
- #endif //GLIBMM_EXCEPTIONS_ENABLED
-}
-
-namespace Gst
-{
-
-/*
-bool Plugin::register_static(int major_version, int minor_version, const Glib::ustring& name, const Glib::ustring& description, SlotInit init_slot, const Glib::ustring& version, const Glib::ustring& license, const Glib::ustring& source, const Glib::ustring& package, const Glib::ustring& origin)
-{
- return gst_plugin_register_static(major_version, minor_version, name.c_str(), description.c_str(), init_slot, version.c_str(), license.c_str(), source.c_str(), package.c_str(), origin.c_str());
-}
-*/
-
-} //namespace Gst
Modified: gstreamermm/trunk/gstreamer/src/plugin.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/plugin.hg (original)
+++ gstreamermm/trunk/gstreamer/src/plugin.hg Fri Feb 22 04:06:11 2008
@@ -58,14 +58,8 @@
public:
/** For example,
- * bool on_plugin_init(const Glib::RefPtr<Plugin>& plugin);
- */
- typedef sigc::slot< bool, const Glib::RefPtr<Plugin>& > SlotInit;
-
- /** For example,
* bool on_plugin_filter(const Glib::RefPtr<Plugin>& plugin);
*/
-
typedef sigc::slot< bool, const Glib::RefPtr<Plugin>& > SlotFilter;
_WRAP_METHOD(static Glib::QueryQuark error_quark(), gst_plugin_error_quark)
@@ -81,16 +75,12 @@
_WRAP_METHOD(GModule* get_module() const, gst_plugin_get_module)
_WRAP_METHOD(bool is_loaded() const, gst_plugin_is_loaded)
- _WRAP_METHOD(bool name_filter(const Glib::ustring& name) const, gst_plugin_name_filter)
_WRAP_METHOD(static Glib::RefPtr<Plugin> load_file(const Glib::ustring& name), gst_plugin_load_file, errthrow)
_WRAP_METHOD(Glib::RefPtr<Plugin> load(), gst_plugin_load)
_WRAP_METHOD(static Glib::RefPtr<Plugin> load_by_name(const Glib::ustring& name), gst_plugin_load_by_name)
_WRAP_METHOD(static void free(Glib::ListHandle< Glib::RefPtr<Plugin> >), gst_plugin_list_free)
-
- //TODO: Does this need to be wrapped? How do I handle the slot since the GstPluginInitFunc type doesn't have a "gpointer* data" parameter?
- //static bool register_static(int major_version, int minor_version, const Glib::ustring& name, const Glib::ustring& description, SlotInit init_slot, const Glib::ustring& version, const Glib::ustring& license, const Glib::ustring& source, const Glib::ustring& package, const Glib::ustring& origin);
};
} // namespace Gst
Modified: gstreamermm/trunk/gstreamer/src/pluginfeature.hg
==============================================================================
--- gstreamermm/trunk/gstreamer/src/pluginfeature.hg (original)
+++ gstreamermm/trunk/gstreamer/src/pluginfeature.hg Fri Feb 22 04:06:11 2008
@@ -42,9 +42,9 @@
public:
/** For example,
- * bool on_feature_filter(const Glib::RefPtr<PluginFeature>& feature);
+ * bool on_filter(const Glib::RefPtr<PluginFeature>& feature);
*/
- typedef sigc::slot< bool, const Glib::RefPtr<PluginFeature>& > SlotFeatureFilter;
+ typedef sigc::slot< bool, const Glib::RefPtr<PluginFeature>& > SlotFilter;
bool type_name_filter(const TypeNameData& data) const;
Added: gstreamermm/trunk/gstreamer/src/registry.ccg
==============================================================================
--- (empty file)
+++ gstreamermm/trunk/gstreamer/src/registry.ccg Fri Feb 22 04:06:11 2008
@@ -0,0 +1,110 @@
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+/* gstreamermm - a C++ wrapper for gstreamer
+ *
+ * Copyright 2008 The gstreamermm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <gst/gstregistry.h>
+#include <gstreamermm/pluginfeature.h>
+#include <gstreamermm/plugin.h>
+
+static gboolean Registry_Plugin_Filter_gstreamermm_callback(GstPlugin* plugin, void* data)
+{
+ Gst::Plugin::SlotFilter* the_slot = static_cast<Gst::Plugin::SlotFilter*>(data);
+
+ #ifdef GLIBMM_EXCEPTIONS_ENABLED
+ try
+ {
+ #endif //GLIBMM_EXCEPTIONS_ENABLED
+ return (*the_slot)(Glib::wrap(plugin, true));
+ #ifdef GLIBMM_EXCEPTIONS_ENABLED
+ }
+ catch(...)
+ {
+ Glib::exception_handlers_invoke();
+ }
+
+ return 0; // arbitrary value
+ #endif //GLIBMM_EXCEPTIONS_ENABLED
+}
+
+static gboolean Registry_PluginFeature_Filter_gstreamermm_callback(GstPluginFeature* feature, void* data)
+{
+ Gst::PluginFeature::SlotFilter* the_slot = static_cast<Gst::PluginFeature::SlotFilter*>(data);
+
+ #ifdef GLIBMM_EXCEPTIONS_ENABLED
+ try
+ {
+ #endif //GLIBMM_EXCEPTIONS_ENABLED
+ return (*the_slot)(Glib::wrap(feature, true));
+ #ifdef GLIBMM_EXCEPTIONS_ENABLED
+ }
+ catch(...)
+ {
+ Glib::exception_handlers_invoke();
+ }
+
+ return 0; // arbitrary value
+ #endif //GLIBMM_EXCEPTIONS_ENABLED
+}
+namespace Gst
+{
+
+Glib::ListHandle< Glib::RefPtr<Plugin> >
+Registry::get_plugin_list(const Plugin::SlotFilter& filter, bool first)
+{
+ Plugin::SlotFilter slot_copy(filter);
+ GList* list = gst_registry_plugin_filter(gobj(), &Registry_Plugin_Filter_gstreamermm_callback, first, &slot_copy);
+ return Glib::ListHandle< Glib::RefPtr<Plugin> >(list, Glib::OWNERSHIP_DEEP);
+}
+
+Glib::ListHandle< Glib::RefPtr<PluginFeature> >
+Registry::get_feature_list(const PluginFeature::SlotFilter& filter, bool first)
+{
+ PluginFeature::SlotFilter slot_copy(filter);
+ GList* list = gst_registry_feature_filter(gobj(), &Registry_PluginFeature_Filter_gstreamermm_callback, first, &slot_copy);
+ return Glib::ListHandle< Glib::RefPtr<PluginFeature> >(list, 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)
+{
+ return gst_registry_binary_write_cache(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)
+{
+ return gst_registry_xml_write_cache(gobj(), location.c_str());
+}
+
+#endif
+
+} //namespace Gst
Added: gstreamermm/trunk/gstreamer/src/registry.hg
==============================================================================
--- (empty file)
+++ gstreamermm/trunk/gstreamer/src/registry.hg Fri Feb 22 04:06:11 2008
@@ -0,0 +1,179 @@
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+/* gstreamermm - a C++ wrapper for gstreamer
+ *
+ * Copyright 2008 The gstreamermm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <gst/gstregistry.h>
+#include <gstreamermm/object.h>
+#include <gstreamermm/plugin.h>
+#include <gstreamermm/pluginfeature.h>
+
+_DEFS(gstreamermm,gst)
+_PINCLUDE(gstreamermm/private/object_p.h)
+
+namespace Gst
+{
+
+class Plugin;
+class PluginFeature;
+
+/** Registry â Abstract base class for management of Plugin objects.
+ * One registry holds the metadata of a set of plugins. All registries build
+ * the GstRegistryPool.
+ *
+ * Design:
+ *
+ * The Registry object is a list of plugins and some functions for dealing
+ * with them. 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 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.
+ */
+class Registry : public Object
+{
+ _CLASS_GOBJECT(Registry, GstRegistry, GST_REGISTRY, Gst::Object, GstObject)
+
+public:
+ _WRAP_METHOD(static Glib::RefPtr<Registry> get_default(), gst_registry_get_default)
+
+#m4 _CONVERSION(`GList*',`Glib::ListHandle< Glib::RefPtr<PluginFeature> >',`$2($3, Glib::OWNERSHIP_DEEP)')
+ _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<PluginFeature> > get_feature_list(GType type), gst_registry_get_feature_list)
+ _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<PluginFeature> > get_feature_list(const Glib::ustring& name), gst_registry_get_feature_list_by_plugin)
+
+#m4 _CONVERSION(`GList*',`Glib::ListHandle< Glib::ustring >',`$2($3, Glib::OWNERSHIP_DEEP)')
+ _WRAP_METHOD(Glib::ListHandle< Glib::ustring > get_path_list(), gst_registry_get_path_list)
+
+#m4 _CONVERSION(`GList*',`Glib::ListHandle< Glib::RefPtr<Plugin> >',`$2($3, Glib::OWNERSHIP_DEEP)')
+ _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<Plugin> > get_plugin_list(), gst_registry_get_plugin_list)
+
+ _WRAP_METHOD(bool add_plugin(const Glib::RefPtr<Plugin>& plugin), gst_registry_add_plugin)
+ _WRAP_METHOD(void remove_plugin(const Glib::RefPtr<Plugin>& plugin), gst_registry_remove_plugin)
+
+ /** Runs a filter against all plugins in the registry and returns a List with
+ * the results. If the first flag is set, only the first match is returned
+ * (as a list with a single object).
+ *
+ * @param filter the filter to use
+ * @param first only return first match
+ * @return a List of Plugin. MT safe.
+ *
+ */
+ Glib::ListHandle< Glib::RefPtr<Plugin> > get_plugin_list(const Plugin::SlotFilter& filter, bool first);
+
+ /** Runs a filter against all features of the plugins in the registry and
+ * returns a List with the results. If the first flag is set, only the first
+ * match is returned (as a list with a single object).
+ *
+ * @param registry registry to query
+ * @param filter the filter to use
+ * @param first only return first match
+ * @return a List of plugin features. MT safe.
+ */
+ Glib::ListHandle< Glib::RefPtr<PluginFeature> > get_feature_list(const PluginFeature::SlotFilter& filter, bool first);
+
+ _WRAP_METHOD(Glib::RefPtr<Plugin> find_plugin(const Glib::ustring& name), gst_registry_find_plugin)
+ _WRAP_METHOD(Glib::RefPtr<PluginFeature> find_feature(const Glib::ustring& name, GType type), gst_registry_find_feature)
+ _WRAP_METHOD(Glib::RefPtr<PluginFeature> lookup_feature(const Glib::ustring& name), gst_registry_lookup_feature)
+ _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);
+
+ /** 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);
+#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);
+
+ /** Write registry in an XML format at the location given by location.
+ * Directories are automatically created.
+ *
+ * @param location : a filename
+ * @return Returns : TRUE on success.
+ */
+ bool xml_write_cache(const Glib::ustring& location);
+#endif
+
+ _WRAP_METHOD(Glib::RefPtr<Plugin> lookup(const Glib::ustring& filename), gst_registry_lookup)
+ _WRAP_METHOD(void remove_feature(const Glib::RefPtr<PluginFeature>& feature), gst_registry_remove_feature)
+ _WRAP_METHOD(void add_feature(const Glib::RefPtr<PluginFeature>& feature), gst_registry_add_feature)
+ _WRAP_METHOD(static bool check_feature_version(const Glib::ustring& feature_name, guint min_major, guint min_minor, guint min_micro), gst_default_registry_check_feature_version)
+};
+
+} // namespace Gst
+
Modified: gstreamermm/trunk/tools/m4/convert_gst.m4
==============================================================================
--- gstreamermm/trunk/tools/m4/convert_gst.m4 (original)
+++ gstreamermm/trunk/tools/m4/convert_gst.m4 Fri Feb 22 04:06:11 2008
@@ -81,17 +81,20 @@
#PluginFeature
_CONVERSION(`const TypeNameData&',`GstTypeNameData*',`($2)(&($3))')
_CONVERSION(`GstPluginFeature*',`Glib::RefPtr<PluginFeature>',`Glib::wrap($3)')
+_CONVERSION(`const Glib::RefPtr<PluginFeature>&',`GstPluginFeature*',`Glib::unwrap($3)')
_CONVERSION(`Glib::ListHandle< Glib::RefPtr<PluginFeature> >',`GList*',`($3).data()')
#Query
_CONVERSION(`const Glib::RefPtr<Query>&',`GstQuery*', `Glib::unwrap($3)')
+#Registry
+_CONVERSION(`GstRegistry*',`Glib::RefPtr<Registry>', `Glib::wrap($3)')
+
#Structure
_CONVERSION(`Structure&',`GstStructure*',`((GstStructure*)(&($3)))')
_CONVERSION(`GstStructure*',`Structure*',`((Structure*) ($3))')
#URIHandler
-#_CONVERSION(`GstURIHandler*',`const Glib::RefPtr<URIHandler>&',`Glib::wrap($3)')
_CONVERSION(`const Glib::RefPtr<URIHandler>&',`GstURIHandler*',`Glib::unwrap($3)')
#General Conversions
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]