install-plugins.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. /* GStreamer base utils library plugin install support for applications
  2. * Copyright (C) 2007 Tim-Philipp Müller <tim centricular net>
  3. * Copyright (C) 2006 Ryan Lortie <desrt desrt ca>
  4. *
  5. * This library is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU Library General Public
  7. * License as published by the Free Software Foundation; either
  8. * version 2 of the License, or (at your option) any later version.
  9. *
  10. * This library is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * Library General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Library General Public
  16. * License along with this library; if not, write to the
  17. * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
  18. * Boston, MA 02110-1301, USA.
  19. */
  20. #ifndef __GST_PB_UTILS_INSTALL_PLUGINS_H__
  21. #define __GST_PB_UTILS_INSTALL_PLUGINS_H__
  22. #include <glib-object.h>
  23. G_BEGIN_DECLS
  24. /*
  25. * functions for use by applications to initiate installation of missing plugins
  26. */
  27. /**
  28. * GstInstallPluginsReturn:
  29. * @GST_INSTALL_PLUGINS_SUCCESS: all of the requested plugins could be
  30. * installed
  31. * @GST_INSTALL_PLUGINS_NOT_FOUND: no appropriate installation candidate for
  32. * any of the requested plugins could be found. Only return this if nothing
  33. * has been installed. Return #GST_INSTALL_PLUGINS_PARTIAL_SUCCESS if
  34. * some (but not all) of the requested plugins could be installed.
  35. * @GST_INSTALL_PLUGINS_ERROR: an error occured during the installation. If
  36. * this happens, the user has already seen an error message and another
  37. * one should not be displayed
  38. * @GST_INSTALL_PLUGINS_CRASHED: the installer had an unclean exit code
  39. * (ie. death by signal)
  40. * @GST_INSTALL_PLUGINS_PARTIAL_SUCCESS: some of the requested plugins could
  41. * be installed, but not all
  42. * @GST_INSTALL_PLUGINS_USER_ABORT: the user has aborted the installation
  43. * @GST_INSTALL_PLUGINS_INVALID: the helper returned an invalid status code
  44. * @GST_INSTALL_PLUGINS_STARTED_OK: returned by gst_install_plugins_async() to
  45. * indicate that everything went fine so far and the provided callback
  46. * will be called with the result of the installation later
  47. * @GST_INSTALL_PLUGINS_INTERNAL_FAILURE: some internal failure has
  48. * occured when trying to start the installer
  49. * @GST_INSTALL_PLUGINS_HELPER_MISSING: the helper script to call the
  50. * actual installer is not installed
  51. * @GST_INSTALL_PLUGINS_INSTALL_IN_PROGRESS: a previously-started plugin
  52. * installation is still in progress, try again later
  53. *
  54. * Result codes returned by gst_install_plugins_async() and
  55. * gst_install_plugins_sync(), and also the result code passed to the
  56. * #GstInstallPluginsResultFunc specified with gst_install_plugins_async().
  57. *
  58. * These codes indicate success or failure of starting an external installer
  59. * program and to what extent the requested plugins could be installed.
  60. */
  61. typedef enum {
  62. /* Return codes from the installer. Returned by gst_install_plugins_sync(),
  63. * or passed as result code to your #GstInstallPluginsResultFunc */
  64. GST_INSTALL_PLUGINS_SUCCESS = 0,
  65. GST_INSTALL_PLUGINS_NOT_FOUND = 1,
  66. GST_INSTALL_PLUGINS_ERROR = 2,
  67. GST_INSTALL_PLUGINS_PARTIAL_SUCCESS = 3,
  68. GST_INSTALL_PLUGINS_USER_ABORT = 4,
  69. /* Returned by gst_install_plugins_sync(), or passed as result code to your
  70. * #GstInstallPluginsResultFunc */
  71. GST_INSTALL_PLUGINS_CRASHED = 100,
  72. GST_INSTALL_PLUGINS_INVALID,
  73. /* Return codes from starting the external helper, may be returned by both
  74. * gst_install_plugins_sync() and gst_install_plugins_async(), but should
  75. * never be seen by a #GstInstallPluginsResultFunc */
  76. GST_INSTALL_PLUGINS_STARTED_OK = 200,
  77. GST_INSTALL_PLUGINS_INTERNAL_FAILURE,
  78. GST_INSTALL_PLUGINS_HELPER_MISSING,
  79. GST_INSTALL_PLUGINS_INSTALL_IN_PROGRESS
  80. } GstInstallPluginsReturn;
  81. /**
  82. * GstInstallPluginsContext:
  83. *
  84. * Opaque context structure for the plugin installation. Use the provided
  85. * API to set details on it.
  86. */
  87. #define GST_TYPE_INSTALL_PLUGINS_CONTEXT (gst_install_plugins_context_get_type())
  88. typedef struct _GstInstallPluginsContext GstInstallPluginsContext;
  89. GstInstallPluginsContext * gst_install_plugins_context_new (void);
  90. void gst_install_plugins_context_free (GstInstallPluginsContext * ctx);
  91. void gst_install_plugins_context_set_xid (GstInstallPluginsContext * ctx,
  92. guint xid);
  93. GType gst_install_plugins_context_get_type (void);
  94. /**
  95. * GstInstallPluginsResultFunc:
  96. * @result: whether the installation of the requested plugins succeeded or not
  97. * @user_data: the user data passed to gst_install_plugins_async()
  98. *
  99. * The prototype of the callback function that will be called once the
  100. * external plugin installer program has returned. You only need to provide
  101. * a callback function if you are using the asynchronous interface.
  102. */
  103. typedef void (*GstInstallPluginsResultFunc) (GstInstallPluginsReturn result,
  104. gpointer user_data);
  105. GstInstallPluginsReturn gst_install_plugins_async (const gchar * const * details,
  106. GstInstallPluginsContext * ctx,
  107. GstInstallPluginsResultFunc func,
  108. gpointer user_data);
  109. GstInstallPluginsReturn gst_install_plugins_sync (const gchar * const * details,
  110. GstInstallPluginsContext * ctx);
  111. const gchar * gst_install_plugins_return_get_name (GstInstallPluginsReturn ret);
  112. gboolean gst_install_plugins_installation_in_progress (void);
  113. gboolean gst_install_plugins_supported (void);
  114. G_END_DECLS
  115. #endif /* __GST_PB_UTILS_INSTALL_PLUGINS_H__ */