Go to the documentation of this file.
58 g_datalist_clear (&
data->custom_dlist);
94 g_hash_table_new_full (g_str_hash, g_str_equal,
g_free,
113 g_return_val_if_fail (name != NULL, NULL);
114 g_return_val_if_fail (path != NULL, NULL);
116 module = g_module_open (path, G_MODULE_BIND_LOCAL);
118 if (module == NULL) {
119 ml_loge (
"Cannot open %s(%s) with error %s.", name, path,
127 g_ptr_array_add (
handles, (gpointer) module);
131 (
"nnstreamer_subplugin of %s(%s) is broken. It does not call register_subplugin with its init function.",
133 g_module_close (module);
145 g_return_val_if_fail (name, NULL);
153 for (i = 0; i < ret; i++) {
171 return (spdata != NULL) ? spdata->data : NULL;
184 names = g_string_new (NULL);
189 list = (gchar **) g_hash_table_get_keys_as_array (
subplugins[
type], NULL);
194 name = g_strjoinv (
",", list);
195 g_string_append (names, name);
202 for (i = 0; i < total; i++) {
203 name = info.
names[i];
205 if (!list || !g_strv_contains ((
const gchar *
const *) list, name)) {
207 g_string_append (names,
",");
209 g_string_append (names, name);
216 name = g_string_free (names,
FALSE);
217 list = g_strsplit (name,
",", -1);
229 gchar *sp_name = NULL;
232 g_return_val_if_fail (name,
FALSE);
251 if (g_ascii_strcasecmp (name,
"any") == 0 ||
252 g_ascii_strcasecmp (name,
"auto") == 0) {
253 ml_loge (
"Failed, the name %s is not allowed.", name);
260 ml_logw (
"Subplugin %s is already registered.", name);
265 if (spdata == NULL) {
266 ml_loge (
"Failed to allocate memory for subplugin registration.");
270 spdata->name = g_strdup (name);
272 g_datalist_init (&spdata->custom_dlist);
275 sp_name = g_strdup (name);
280 ml_loge (
"Failed to add subplugin data into the table.");
293 g_return_val_if_fail (name,
FALSE);
317 #if defined(__GLIBC__) && (__GLIBC__ == 2) && (__GLIBC_MINOR__ <= 24)
321 g_module_close ((GModule *)
data);
330 const gchar *
prop, va_list varargs)
334 g_return_if_fail (name != NULL);
338 g_return_if_fail (spdata != NULL);
340 g_datalist_clear (&spdata->custom_dlist);
343 gchar *desc = va_arg (varargs, gchar *);
345 if (G_UNLIKELY (desc == NULL)) {
350 g_datalist_set_data (&spdata->custom_dlist,
prop, desc);
351 prop = va_arg (varargs, gchar *);
363 g_return_val_if_fail (name != NULL, NULL);
368 return spdata->custom_dlist;
g_assert(sizeof(DTYPE_UNSIGNED)==sizeof(DTYPE_SIGNED))
static GPtrArray * handles
Array of dynamic loaded handles.
Subplugin Manager for NNStreamer.
Internal header for conf/env-var management.
GstTensorSrcIIOChannelProperties * prop
DTYPE_UNSIGNED ( .
void subplugin_set_custom_property_desc(subpluginType type, const char *name, const gchar *prop, va_list varargs)
common interface to set custom property description of a sub-plugin.
Internal log util for NNStreamer plugins and native APIs.
static GHashTable * subplugins[NNS_SUBPLUGIN_END]
static subpluginData * _search_subplugin(subpluginType type, const gchar *name, const gchar *path)
Internal function to scan sub-plugin.
@ NNS_SUBPLUGIN_CONVERTER
g_free(self->option[(opnum) - 1])
opnum: \
static void init_subplugin(void)
Create handles at the start of library.
__attribute__((__format__(__printf__, 1, 2)))
overwrites the error message buffer with the new message.
gboolean nnsconf_validate_file(nnsconf_type_path type, const gchar *fullpath)
Public function to validate sub-plugin library is available.
static subpluginData * _get_subplugin_data(subpluginType type, const gchar *name)
Internal function to get sub-plugin data.
gboolean register_subplugin(subpluginType type, const char *name, const void *data)
Public function defined in the header.
gchar ** get_all_subplugins(subpluginType type)
Public function defined in the header.
Optional NNStreamer utility functions for sub-plugin writers and users.
guint nnsconf_get_subplugin_info(nnsconf_type_path type, subplugin_info_s *info)
Public function to get the list of sub-plugins name and path.
G_LOCK_DEFINE_STATIC(splock)
Protects handles and subplugins.
static void _spdata_destroy(gpointer _data)
Private function for g_hash_table data destructor, GDestroyNotify.
GData * subplugin_get_custom_property_desc(subpluginType type, const char *name)
common interface to get custom property description of a sub-plugin.
static subpluginSearchLogic searchAlgorithm[]
const gchar * nnsconf_get_fullpath(const gchar *subpluginname, nnsconf_type_path type)
Public function defined in the header.
const void * get_subplugin(subpluginType type, const char *name)
Public function defined in the header.
gboolean unregister_subplugin(subpluginType type, const char *name)
Public function defined in the header.
static void _close_handle(gpointer data)
dealloc function for handles
static void fini_subplugin(void)
Free handles at the start of library.