From b8f1da91d155a59a4f32f0db6d04204462cdb895 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Tue, 28 Aug 2007 14:58:17 +0000 Subject: [PATCH] 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). --- ChangeLog | 9 +++++++++ docs/libs/gst-plugins-base-libs-sections.txt | 1 + gst-libs/gst/pbutils/install-plugins.c | 19 +++++++++++++++++++ gst-libs/gst/pbutils/install-plugins.h | 2 ++ tests/check/libs/pbutils.c | 19 ++++++++++++++----- 5 files changed, 45 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 12f5957b22..d1087dfdb2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2007-08-28 Tim-Philipp Müller + + * 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 * docs/libs/gst-plugins-base-libs-sections.txt: diff --git a/docs/libs/gst-plugins-base-libs-sections.txt b/docs/libs/gst-plugins-base-libs-sections.txt index ad39354413..501a8d9d41 100644 --- a/docs/libs/gst-plugins-base-libs-sections.txt +++ b/docs/libs/gst-plugins-base-libs-sections.txt @@ -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 GstInstallPluginsContext gst_install_plugins_context_new diff --git a/gst-libs/gst/pbutils/install-plugins.c b/gst-libs/gst/pbutils/install-plugins.c index a5bd65a0d8..0bc79c3054 100644 --- a/gst-libs/gst/pbutils/install-plugins.c +++ b/gst-libs/gst/pbutils/install-plugins.c @@ -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); +} diff --git a/gst-libs/gst/pbutils/install-plugins.h b/gst-libs/gst/pbutils/install-plugins.h index 11f47c204a..5a04fdcb19 100644 --- a/gst-libs/gst/pbutils/install-plugins.h +++ b/gst-libs/gst/pbutils/install-plugins.h @@ -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__ */ diff --git a/tests/check/libs/pbutils.c b/tests/check/libs/pbutils.c index 368bf336e7..36fd7b6d68 100644 --- a/tests/check/libs/pbutils.c +++ b/tests/check/libs/pbutils.c @@ -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 */