validate: Add a way to check whether Validate is initialized

Summary:
API:

  gst_validate_is_initialized

Depends on D207

Reviewers: Mathieu_Du

Differential Revision: http://phabricator.freedesktop.org/D208
This commit is contained in:
Thibault Saunier 2015-05-26 13:58:15 +02:00
parent ba0ab132f9
commit 2c6993b2bd
2 changed files with 15 additions and 0 deletions

View file

@ -52,6 +52,7 @@ static GMutex _gst_validate_registry_mutex;
static GstRegistry *_gst_validate_registry_default = NULL; static GstRegistry *_gst_validate_registry_default = NULL;
static GList *core_config = NULL; static GList *core_config = NULL;
static gboolean validate_initialized = FALSE;
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32
BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved); BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved);
@ -241,6 +242,10 @@ gst_validate_init_plugins (void)
void void
gst_validate_init (void) gst_validate_init (void)
{ {
if (validate_initialized) {
return;
}
GST_DEBUG_CATEGORY_INIT (gstvalidate_debug, "validate", 0, GST_DEBUG_CATEGORY_INIT (gstvalidate_debug, "validate", 0,
"Validation library"); "Validation library");
@ -253,6 +258,8 @@ gst_validate_init (void)
/* Ensure we load overrides before any use of a monitor */ /* Ensure we load overrides before any use of a monitor */
gst_validate_override_registry_preload (); gst_validate_override_registry_preload ();
validate_initialized = TRUE;
gst_validate_init_plugins (); gst_validate_init_plugins ();
} }
@ -261,4 +268,11 @@ gst_validate_deinit (void)
{ {
_free_plugin_config (core_config); _free_plugin_config (core_config);
core_config = NULL; core_config = NULL;
validate_initialized = FALSE;
}
gboolean
gst_validate_is_initialized (void)
{
return validate_initialized;
} }

View file

@ -18,5 +18,6 @@
void gst_validate_init (void); void gst_validate_init (void);
void gst_validate_deinit (void); void gst_validate_deinit (void);
GList * gst_validate_plugin_get_config (GstPlugin * plugin); GList * gst_validate_plugin_get_config (GstPlugin * plugin);
gboolean gst_validate_is_initialized (void);
#endif /* _GST_VALIDATE_H */ #endif /* _GST_VALIDATE_H */