Commit 59479d47 authored by Andy Wingo Wingo's avatar Andy Wingo Wingo

gst/gstconfig.h.in: Psych out gtk-doc.

Original commit message from CVS:
2005-09-22  Andy Wingo  <wingo@pobox.com>

* gst/gstconfig.h.in: Psych out gtk-doc.

* docs/gst/gstreamer-sections.txt: Add GST_HAVE_GLIB_2_8.

* check/Makefile.am (check_PROGRAMS): Add gstplugin to the tests.

* tools/gst-inspect.c (print_element_list): Plug some
inconsequential leaks.

* gst/gstregistry.c (gst_registry_get_default): Doc.

* gst/gsttypefindfactory.c (gst_type_find_factory_call_function):
* gst/gstelementfactory.c (gst_element_factory_create):
* gst/gstindexfactory.c (gst_index_factory_create): Update for
refcount changes.

* gst/gstpluginfeature.c (gst_plugin_feature_list_free): Doc.
(gst_plugin_feature_load): Doc, don't eat refs.

* gst/gstplugin.c (gst_plugin_load): Doc, don't eat refs.
(gst_plugin_list_free): Doc.
(gst_plugin_load_file): Doc updates.
parent 54a2e066
2005-09-22 Andy Wingo <wingo@pobox.com>
* gst/gstconfig.h.in: Psych out gtk-doc.
* docs/gst/gstreamer-sections.txt: Add GST_HAVE_GLIB_2_8.
* check/Makefile.am (check_PROGRAMS): Add gstplugin to the tests.
* tools/gst-inspect.c (print_element_list): Plug some
inconsequential leaks.
* gst/gstregistry.c (gst_registry_get_default): Doc.
* check/gst/gstplugin.c:
* gst/gsttypefindfactory.c (gst_type_find_factory_call_function):
* gst/gstelementfactory.c (gst_element_factory_create):
* gst/gstindexfactory.c (gst_index_factory_create): Update for
refcount changes.
* gst/gstpluginfeature.c (gst_plugin_feature_list_free): Doc.
(gst_plugin_feature_load): Doc, don't eat refs.
* gst/gstplugin.c (gst_plugin_load): Doc, don't eat refs.
(gst_plugin_list_free): Doc.
(gst_plugin_load_file): Doc updates.
* gst/gstbuffer.c (gst_buffer_get_caps): Like all our _get
accessors returning refcounted objects, return a ref.
......
......@@ -42,6 +42,7 @@ check_PROGRAMS = \
gst/gstobject \
gst/gstpad \
gst/gstpipeline \
gst/gstplugin \
gst/gstsystemclock \
gst/gststructure \
gst/gsttag \
......
......@@ -69,17 +69,18 @@ GST_START_TEST (test_registry)
for (g = registry->plugins; g; g = g->next) {
GstPlugin *plugin = GST_PLUGIN (g->data);
fail_if (GST_OBJECT (plugin)->refcount != 1,
fail_if (GST_OBJECT_REFCOUNT_VALUE (plugin) != 1,
"Plugin in registry should have refcount of 1");
GST_DEBUG ("refcount %d %s", GST_OBJECT (plugin)->refcount,
GST_DEBUG ("refcount %d %s", GST_OBJECT_REFCOUNT_VALUE (plugin),
plugin->desc.name);
}
for (g = registry->features; g; g = g->next) {
GstPluginFeature *feature = GST_PLUGIN_FEATURE (g->data);
fail_if (GST_OBJECT (feature)->refcount != 1,
fail_if (GST_OBJECT_REFCOUNT_VALUE (feature) != 1,
"Feature in registry should have refcount of 1");
GST_DEBUG ("refcount %d %s", GST_OBJECT (feature)->refcount, feature->name);
GST_DEBUG ("refcount %d %s", GST_OBJECT_REFCOUNT_VALUE (feature),
feature->name);
}
}
......@@ -92,21 +93,20 @@ GST_START_TEST (test_load_gstelements)
unloaded_plugin = gst_default_registry_find_plugin ("gstelements");
fail_if (unloaded_plugin == NULL, "Failed to find gstelements plugin");
fail_if (GST_OBJECT (unloaded_plugin)->refcount != 2,
fail_if (GST_OBJECT_REFCOUNT_VALUE (unloaded_plugin) != 2,
"Refcount of unloaded plugin in registry initially should be 2");
GST_DEBUG ("refcount %d", GST_OBJECT (unloaded_plugin)->refcount);
GST_DEBUG ("refcount %d", GST_OBJECT_REFCOUNT_VALUE (unloaded_plugin));
gst_object_ref (unloaded_plugin);
loaded_plugin = gst_plugin_load (unloaded_plugin);
fail_if (loaded_plugin == NULL, "Failed to load plugin");
if (loaded_plugin != unloaded_plugin) {
fail_if (GST_OBJECT (loaded_plugin)->refcount != 2,
fail_if (GST_OBJECT_REFCOUNT_VALUE (loaded_plugin) != 2,
"Refcount of loaded plugin in registry should be 2");
GST_DEBUG ("refcount %d", GST_OBJECT (loaded_plugin)->refcount);
fail_if (GST_OBJECT (unloaded_plugin)->refcount != 1,
GST_DEBUG ("refcount %d", GST_OBJECT_REFCOUNT_VALUE (loaded_plugin));
fail_if (GST_OBJECT_REFCOUNT_VALUE (unloaded_plugin) != 1,
"Refcount of replaced plugin should be 1");
GST_DEBUG ("refcount %d", GST_OBJECT (unloaded_plugin)->refcount);
GST_DEBUG ("refcount %d", GST_OBJECT_REFCOUNT_VALUE (unloaded_plugin));
}
gst_object_unref (unloaded_plugin);
......@@ -121,17 +121,17 @@ GST_START_TEST (test_registry_get_plugin_list)
GstPlugin *plugin;
plugin = gst_default_registry_find_plugin ("gstelements");
fail_if (GST_OBJECT (plugin)->refcount != 2,
fail_if (GST_OBJECT_REFCOUNT_VALUE (plugin) != 2,
"Refcount of plugin in registry should be 2");
list = gst_registry_get_plugin_list (gst_registry_get_default ());
fail_if (plugin->object.refcount != 3,
fail_if (GST_OBJECT_REFCOUNT_VALUE (plugin) != 3,
"Refcount of plugin in registry+list should be 3");
gst_plugin_list_free (list);
fail_if (GST_OBJECT (plugin)->refcount != 2,
fail_if (GST_OBJECT_REFCOUNT_VALUE (plugin) != 2,
"Refcount of plugin in after list free should be 2");
gst_object_unref (plugin);
......@@ -149,9 +149,9 @@ GST_START_TEST (test_find_feature)
fail_if (strcmp (feature->plugin_name, "gstelements"),
"Expected identity to be from gstelements plugin");
fail_if (GST_OBJECT (feature)->refcount != 2,
fail_if (GST_OBJECT_REFCOUNT_VALUE (feature) != 2,
"Refcount of feature should be 2");
GST_DEBUG ("refcount %d", GST_OBJECT (feature)->refcount);
GST_DEBUG ("refcount %d", GST_OBJECT_REFCOUNT_VALUE (feature));
gst_object_unref (feature);
}
......@@ -165,7 +165,7 @@ GST_START_TEST (test_find_element)
element_factory = gst_element_factory_find ("identity");
fail_if (element_factory == NULL, "Failed to find identity element factory");
fail_if (GST_OBJECT (element_factory)->refcount != 2,
fail_if (GST_OBJECT_REFCOUNT_VALUE (element_factory) != 2,
"Refcount of plugin in registry+feature should be 2");
gst_object_unref (element_factory);
......@@ -200,7 +200,7 @@ GST_START_TEST (test_typefind)
plugin = gst_default_registry_find_plugin ("typefindfunctions");
fail_if (plugin == NULL, "Failed to find typefind functions");
fail_if (plugin->object.refcount != 2,
fail_if (GST_OBJECT_REFCOUNT_VALUE (plugin) != 2,
"Refcount of plugin in registry should be 2");
fail_if (gst_plugin_is_loaded (plugin), "Expected plugin to be unloaded");
......@@ -210,7 +210,7 @@ GST_START_TEST (test_typefind)
fail_if (feature->plugin != plugin,
"Expected identity to be from gstelements plugin");
fail_if (plugin->object.refcount != 3,
fail_if (GST_OBJECT_REFCOUNT_VALUE (plugin) != 3,
"Refcount of plugin in registry+feature should be 3");
gst_type_find_factory_call_function (GST_TYPE_FIND_FACTORY (feature),
......@@ -218,7 +218,7 @@ GST_START_TEST (test_typefind)
gst_object_unref (feature->plugin);
fail_if (plugin->object.refcount != 1,
fail_if (GST_OBJECT_REFCOUNT_VALUE (plugin) != 1,
"Refcount of plugin in after list free should be 1");
gst_object_unref (plugin);
......
......@@ -401,6 +401,7 @@ GST_DISABLE_ENUMTYPES
GST_DISABLE_INDEX
GST_DISABLE_PLUGIN
GST_DISABLE_URI
GST_HAVE_GLIB_2_8
GST_PTR_FORMAT
GST_EXPORT
GST_PLUGIN_EXPORT
......
......@@ -62,6 +62,7 @@
#define GST_DISABLE_INDEX 1
#define GST_DISABLE_PLUGIN 1
#define GST_DISABLE_URI 1
#define GST_HAVE_GLIB_2_8 1
#endif
/***** default padding of structures *****/
......
......@@ -359,15 +359,9 @@ gst_element_factory_create (GstElementFactory * factory, const gchar * name)
GST_ELEMENT_FACTORY (gst_plugin_feature_load (GST_PLUGIN_FEATURE
(factory)));
if (newfactory == NULL) {
/* it could be factory is invalid. with ref-eating functions nothing is
certain! */
GST_WARNING ("loading the plugin for factory %p returned NULL", factory);
GST_WARNING_OBJECT (factory, "loading plugin returned NULL!");
return NULL;
} else if (newfactory != factory) {
/* gst_plugin_feature_load ate the ref we added to the factory */
factory = newfactory;
} else {
/* strip off our extra ref */
gst_object_unref (factory);
factory = newfactory;
}
......
......@@ -179,17 +179,20 @@ gst_index_factory_find (const gchar * name)
GstIndex *
gst_index_factory_create (GstIndexFactory * factory)
{
GstIndexFactory *newfactory;
GstIndex *new = NULL;
g_return_val_if_fail (factory != NULL, NULL);
factory =
newfactory =
GST_INDEX_FACTORY (gst_plugin_feature_load (GST_PLUGIN_FEATURE
(factory)));
if (factory == NULL)
if (newfactory == NULL)
return NULL;
new = GST_INDEX (g_object_new (factory->type, NULL));
new = GST_INDEX (g_object_new (newfactory->type, NULL));
gst_object_unref (newfactory);
return new;
}
......
......@@ -327,7 +327,8 @@ GStaticMutex gst_plugin_loading_mutex = G_STATIC_MUTEX_INIT;
*
* Loads the given plugin and refs it. Caller needs to unref after use.
*
* Returns: a new GstPlugin or NULL, if an error occurred.
* Returns: a reference to the existing loaded GstPlugin, a reference to the
* newly-loaded GstPlugin, or NULL if an error occurred.
*/
GstPlugin *
gst_plugin_load_file (const gchar * filename, GError ** error)
......@@ -351,6 +352,7 @@ gst_plugin_load_file (const gchar * filename, GError ** error)
return plugin;
} else {
gst_object_unref (plugin);
plugin = NULL;
}
}
......@@ -847,6 +849,24 @@ gst_plugin_load_by_name (const gchar * name)
return NULL;
}
/**
* gst_plugin_load:
* @plugin: plugin to load
*
* Loads @plugin. Note that the *return value* is the loaded plugin; @plugin is
* untouched. The normal use pattern of this function goes like this:
*
* <programlisting>
* GstPlugin *loaded_plugin;
* loaded_plugin = gst_plugin_load (plugin);
*
* // presumably, we're no longer interested in the potentially-unloaded plugin
* gst_object_unref (plugin);
* plugin = loaded_plugin;
* </programlisting>
*
* Returns: A reference to a loaded plugin, or NULL on error.
*/
GstPlugin *
gst_plugin_load (GstPlugin * plugin)
{
......@@ -857,19 +877,25 @@ gst_plugin_load (GstPlugin * plugin)
return plugin;
}
newplugin = gst_plugin_load_file (plugin->filename, &error);
if (newplugin == NULL) {
if (!(newplugin = gst_plugin_load_file (plugin->filename, &error)))
goto load_error;
return newplugin;
load_error:
{
GST_WARNING ("load_plugin error: %s\n", error->message);
g_error_free (error);
gst_object_unref (plugin);
return NULL;
}
gst_object_unref (plugin);
return newplugin;
}
/**
* gst_plugin_list_free:
* @list: list of #GstPlugin
*
* Unrefs each member of @list, then frees the list.
*/
void
gst_plugin_list_free (GList * list)
{
......
......@@ -76,10 +76,21 @@ gst_plugin_feature_finalize (GObject * object)
* gst_plugin_feature_load:
* @feature: the plugin feature to check
*
* Check if the plugin containing the feature is loaded,
* if not, the plugin will be loaded.
* Loads the plugin containing @feature if it's not already loaded. @feature is
* unaffected; use the return value instead.
*
* Returns: The new feature
* Normally this function is used like this:
*
* <programlisting>
* GstPluginFeature *loaded_feature;
* loaded_feature = gst_plugin_feature_load (feature);
*
* // presumably, we're no longer interested in the potentially-unloaded feature
* gst_object_unref (feature);
* feature = loaded_feature;
* </programlisting>
*
* Returns: A reference to the loaded feature, or NULL on error.
*/
GstPluginFeature *
gst_plugin_feature_load (GstPluginFeature * feature)
......@@ -112,7 +123,6 @@ gst_plugin_feature_load (GstPluginFeature * feature)
("Loaded plugin containing feature '%s', but feature disappeared.",
feature->name);
}
gst_object_unref (feature);
return real_feature;
}
......@@ -199,6 +209,12 @@ gst_plugin_feature_get_rank (GstPluginFeature * feature)
return feature->rank;
}
/**
* gst_plugin_feature_list_free:
* @list: list of #GstPluginFeature
*
* Unrefs each member of @list, then frees the list.
*/
void
gst_plugin_feature_list_free (GList * list)
{
......
......@@ -200,6 +200,12 @@ gst_registry_finalize (GObject * object)
G_OBJECT_CLASS (parent_class)->finalize (object);
}
/**
* gst_registry_get_default:
*
* Retrieves the default registry. The caller does not own a reference on the
* registry, as it is alive as long as GStreamer is initialized.
*/
GstRegistry *
gst_registry_get_default (void)
{
......
......@@ -224,8 +224,6 @@ gst_type_find_factory_call_function (GstTypeFindFactory * factory,
g_return_if_fail (find->peek != NULL);
g_return_if_fail (find->suggest != NULL);
/* gst_plugin_feature_load will steal our ref */
gst_object_ref (factory);
new_factory =
GST_TYPE_FIND_FACTORY (gst_plugin_feature_load (GST_PLUGIN_FEATURE
(factory)));
......
......@@ -42,6 +42,7 @@ check_PROGRAMS = \
gst/gstobject \
gst/gstpad \
gst/gstpipeline \
gst/gstplugin \
gst/gstsystemclock \
gst/gststructure \
gst/gsttag \
......
......@@ -69,17 +69,18 @@ GST_START_TEST (test_registry)
for (g = registry->plugins; g; g = g->next) {
GstPlugin *plugin = GST_PLUGIN (g->data);
fail_if (GST_OBJECT (plugin)->refcount != 1,
fail_if (GST_OBJECT_REFCOUNT_VALUE (plugin) != 1,
"Plugin in registry should have refcount of 1");
GST_DEBUG ("refcount %d %s", GST_OBJECT (plugin)->refcount,
GST_DEBUG ("refcount %d %s", GST_OBJECT_REFCOUNT_VALUE (plugin),
plugin->desc.name);
}
for (g = registry->features; g; g = g->next) {
GstPluginFeature *feature = GST_PLUGIN_FEATURE (g->data);
fail_if (GST_OBJECT (feature)->refcount != 1,
fail_if (GST_OBJECT_REFCOUNT_VALUE (feature) != 1,
"Feature in registry should have refcount of 1");
GST_DEBUG ("refcount %d %s", GST_OBJECT (feature)->refcount, feature->name);
GST_DEBUG ("refcount %d %s", GST_OBJECT_REFCOUNT_VALUE (feature),
feature->name);
}
}
......@@ -92,21 +93,20 @@ GST_START_TEST (test_load_gstelements)
unloaded_plugin = gst_default_registry_find_plugin ("gstelements");
fail_if (unloaded_plugin == NULL, "Failed to find gstelements plugin");
fail_if (GST_OBJECT (unloaded_plugin)->refcount != 2,
fail_if (GST_OBJECT_REFCOUNT_VALUE (unloaded_plugin) != 2,
"Refcount of unloaded plugin in registry initially should be 2");
GST_DEBUG ("refcount %d", GST_OBJECT (unloaded_plugin)->refcount);
GST_DEBUG ("refcount %d", GST_OBJECT_REFCOUNT_VALUE (unloaded_plugin));
gst_object_ref (unloaded_plugin);
loaded_plugin = gst_plugin_load (unloaded_plugin);
fail_if (loaded_plugin == NULL, "Failed to load plugin");
if (loaded_plugin != unloaded_plugin) {
fail_if (GST_OBJECT (loaded_plugin)->refcount != 2,
fail_if (GST_OBJECT_REFCOUNT_VALUE (loaded_plugin) != 2,
"Refcount of loaded plugin in registry should be 2");
GST_DEBUG ("refcount %d", GST_OBJECT (loaded_plugin)->refcount);
fail_if (GST_OBJECT (unloaded_plugin)->refcount != 1,
GST_DEBUG ("refcount %d", GST_OBJECT_REFCOUNT_VALUE (loaded_plugin));
fail_if (GST_OBJECT_REFCOUNT_VALUE (unloaded_plugin) != 1,
"Refcount of replaced plugin should be 1");
GST_DEBUG ("refcount %d", GST_OBJECT (unloaded_plugin)->refcount);
GST_DEBUG ("refcount %d", GST_OBJECT_REFCOUNT_VALUE (unloaded_plugin));
}
gst_object_unref (unloaded_plugin);
......@@ -121,17 +121,17 @@ GST_START_TEST (test_registry_get_plugin_list)
GstPlugin *plugin;
plugin = gst_default_registry_find_plugin ("gstelements");
fail_if (GST_OBJECT (plugin)->refcount != 2,
fail_if (GST_OBJECT_REFCOUNT_VALUE (plugin) != 2,
"Refcount of plugin in registry should be 2");
list = gst_registry_get_plugin_list (gst_registry_get_default ());
fail_if (plugin->object.refcount != 3,
fail_if (GST_OBJECT_REFCOUNT_VALUE (plugin) != 3,
"Refcount of plugin in registry+list should be 3");
gst_plugin_list_free (list);
fail_if (GST_OBJECT (plugin)->refcount != 2,
fail_if (GST_OBJECT_REFCOUNT_VALUE (plugin) != 2,
"Refcount of plugin in after list free should be 2");
gst_object_unref (plugin);
......@@ -149,9 +149,9 @@ GST_START_TEST (test_find_feature)
fail_if (strcmp (feature->plugin_name, "gstelements"),
"Expected identity to be from gstelements plugin");
fail_if (GST_OBJECT (feature)->refcount != 2,
fail_if (GST_OBJECT_REFCOUNT_VALUE (feature) != 2,
"Refcount of feature should be 2");
GST_DEBUG ("refcount %d", GST_OBJECT (feature)->refcount);
GST_DEBUG ("refcount %d", GST_OBJECT_REFCOUNT_VALUE (feature));
gst_object_unref (feature);
}
......@@ -165,7 +165,7 @@ GST_START_TEST (test_find_element)
element_factory = gst_element_factory_find ("identity");
fail_if (element_factory == NULL, "Failed to find identity element factory");
fail_if (GST_OBJECT (element_factory)->refcount != 2,
fail_if (GST_OBJECT_REFCOUNT_VALUE (element_factory) != 2,
"Refcount of plugin in registry+feature should be 2");
gst_object_unref (element_factory);
......@@ -200,7 +200,7 @@ GST_START_TEST (test_typefind)
plugin = gst_default_registry_find_plugin ("typefindfunctions");
fail_if (plugin == NULL, "Failed to find typefind functions");
fail_if (plugin->object.refcount != 2,
fail_if (GST_OBJECT_REFCOUNT_VALUE (plugin) != 2,
"Refcount of plugin in registry should be 2");
fail_if (gst_plugin_is_loaded (plugin), "Expected plugin to be unloaded");
......@@ -210,7 +210,7 @@ GST_START_TEST (test_typefind)
fail_if (feature->plugin != plugin,
"Expected identity to be from gstelements plugin");
fail_if (plugin->object.refcount != 3,
fail_if (GST_OBJECT_REFCOUNT_VALUE (plugin) != 3,
"Refcount of plugin in registry+feature should be 3");
gst_type_find_factory_call_function (GST_TYPE_FIND_FACTORY (feature),
......@@ -218,7 +218,7 @@ GST_START_TEST (test_typefind)
gst_object_unref (feature->plugin);
fail_if (plugin->object.refcount != 1,
fail_if (GST_OBJECT_REFCOUNT_VALUE (plugin) != 1,
"Refcount of plugin in after list free should be 1");
gst_object_unref (plugin);
......
......@@ -825,17 +825,17 @@ print_children_info (GstElement * element)
static void
print_element_list (gboolean print_all)
{
GList *plugins;
GList *plugins, *orig_plugins;
plugins = gst_default_registry_get_plugin_list ();
orig_plugins = plugins = gst_default_registry_get_plugin_list ();
while (plugins) {
GList *features;
GList *features, *orig_features;
GstPlugin *plugin;
plugin = (GstPlugin *) (plugins->data);
plugins = g_list_next (plugins);
features =
orig_features = features =
gst_registry_get_feature_list_by_plugin (gst_registry_get_default (),
plugin->desc.name);
while (features) {
......@@ -893,7 +893,11 @@ print_element_list (gboolean print_all)
features = g_list_next (features);
}
gst_plugin_feature_list_free (orig_features);
}
gst_plugin_list_free (plugins);
}
static void
......@@ -1064,6 +1068,8 @@ print_element_info (GstElementFactory * factory, gboolean print_names)
print_signal_info (element);
print_children_info (element);
gst_object_unref (factory);
if (_name != "")
g_free (_name);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment