API: also add gst_install_plugins_supported() while we're at it (see #470456).

Original commit message from CVS:
* docs/libs/gst-plugins-base-libs-sections.txt:
* gst-libs/gst/pbutils/install-plugins.c:
* gst-libs/gst/pbutils/install-plugins.h:
* tests/check/libs/pbutils.c:
API: also add gst_install_plugins_supported() while we're at it
(see #470456).
This commit is contained in:
Tim-Philipp Müller 2007-08-28 14:58:17 +00:00
parent f344ec6b8a
commit b8f1da91d1
5 changed files with 45 additions and 5 deletions

View file

@ -1,3 +1,12 @@
2007-08-28 Tim-Philipp Müller <tim at centricular dot net>
* docs/libs/gst-plugins-base-libs-sections.txt:
* gst-libs/gst/pbutils/install-plugins.c:
* gst-libs/gst/pbutils/install-plugins.h:
* tests/check/libs/pbutils.c:
API: also add gst_install_plugins_supported() while we're at it
(see #470456).
2007-08-28 Tim-Philipp Müller <tim at centricular dot net>
* docs/libs/gst-plugins-base-libs-sections.txt:

View file

@ -1276,6 +1276,7 @@ gst_install_plugins_async
gst_install_plugins_sync
gst_install_plugins_return_get_name
gst_install_plugins_installation_in_progress
gst_install_plugins_supported
<SUBSECTION>
GstInstallPluginsContext
gst_install_plugins_context_new

View file

@ -722,3 +722,22 @@ gst_install_plugins_installation_in_progress (void)
{
return install_in_progress;
}
/**
* gst_install_plugins_supported:
*
* Checks whether plugin installation is likely to be supported by the
* current environment. This currently only checks whether the helper script
* that is to be provided by the distribution or operating system vendor
* exists.
*
* Returns: TRUE if plugin installation is likely to be supported.
*
* Since: 0.10.15
*/
gboolean
gst_install_plugins_supported (void)
{
return g_file_test (gst_install_plugins_get_helper (),
G_FILE_TEST_IS_EXECUTABLE);
}

View file

@ -131,6 +131,8 @@ const gchar * gst_install_plugins_return_get_name (GstInstallPluginsReturn ret);
gboolean gst_install_plugins_installation_in_progress (void);
gboolean gst_install_plugins_supported (void);
G_END_DECLS
#endif /* __GST_PB_UTILS_INSTALL_PLUGINS_H__ */

View file

@ -72,8 +72,7 @@ GST_START_TEST (test_pb_utils_post_missing_messages)
bus = gst_element_get_bus (pipeline);
/* first, test common assertion failure cases */
ASSERT_CRITICAL (msg = gst_missing_uri_source_message_new (NULL, "http");
);
ASSERT_CRITICAL (msg = gst_missing_uri_source_message_new (NULL, "http"););
ASSERT_CRITICAL (gst_missing_uri_source_message_new (pipeline, NULL));
ASSERT_CRITICAL (gst_missing_uri_sink_message_new (NULL, "http"));
@ -500,9 +499,16 @@ test_pb_utils_install_plugins_do_callout (gchar ** details,
goto done;
}
/* test gst_install_plugins_supported() I */
g_setenv ("GST_INSTALL_PLUGINS_HELPER", "/i/do/not/ex.ist!", 1);
fail_if (gst_install_plugins_supported ());
GST_LOG ("setting GST_INSTALL_PLUGINS_HELPER to '%s'", path);
g_setenv ("GST_INSTALL_PLUGINS_HELPER", path, 1);
/* test gst_install_plugins_supported() II */
fail_unless (gst_install_plugins_supported ());
/* test sync callout */
ret = gst_install_plugins_sync (details, ctx);
fail_unless (ret == GST_INSTALL_PLUGINS_HELPER_MISSING ||
@ -541,11 +547,14 @@ GST_START_TEST (test_pb_utils_install_plugins)
ctx = gst_install_plugins_context_new ();
ASSERT_CRITICAL (ret = gst_install_plugins_sync (NULL, ctx););
ASSERT_CRITICAL (ret = gst_install_plugins_sync (NULL, ctx);
);
ASSERT_CRITICAL (ret =
gst_install_plugins_async (NULL, ctx, result_cb, (gpointer) & marker););
gst_install_plugins_async (NULL, ctx, result_cb, (gpointer) & marker);
);
ASSERT_CRITICAL (ret =
gst_install_plugins_async (details, ctx, NULL, (gpointer) & marker););
gst_install_plugins_async (details, ctx, NULL, (gpointer) & marker);
);
/* make sure the functions return the right error code if the helper does
* not exist */