39 #define NNSTREAMER_PREFIX_DECODER "libnnstreamer_decoder_"
40 #define NNSTREAMER_PREFIX_FILTER "libnnstreamer_filter_"
41 #define NNSTREAMER_PREFIX_CUSTOMFILTERS ""
42 #define NNSTREAMER_PREFIX_CONVERTER "libnnstreamer_converter_"
43 #define NNSTREAMER_PREFIX_TRAINER "libnnstreamer_trainer_"
121 if (strval[0] ==
'1' || strval[0] ==
't' || strval[0] ==
'T' ||
122 strval[0] ==
'y' || strval[0] ==
'Y' ||
123 g_ascii_strncasecmp (
"on", strval, 2) == 0) {
125 }
else if (strval[0] ==
'0' || strval[0] ==
'f' || strval[0] ==
'F' ||
126 strval[0] ==
'n' || strval[0] ==
'N' ||
127 g_ascii_strncasecmp (
"of", strval, 2) == 0) {
149 const gchar *tmp = g_getenv (name);
151 return g_strdup (tmp);
161 if (!fullpath || !g_file_test (fullpath, G_FILE_TEST_IS_REGULAR))
184 GSList ** listN, guint * counter)
191 gsize prefix, extension, len;
193 if ((gdir = g_dir_open (dir, 0U, NULL)) == NULL)
199 while (NULL != (entry = g_dir_read_name (gdir))) {
203 fullpath = g_build_filename (dir, entry, NULL);
206 basename = g_path_get_basename (entry);
207 len = strlen (basename) - prefix - extension;
208 name = g_strndup (basename + prefix, len);
210 *listF = g_slist_prepend (*listF, fullpath);
211 *listN = g_slist_prepend (*listN, name);
212 *counter = *counter + 1;
234 ml_loge (
"Failed to get sub-plugins, unknown sub-plugin type.");
239 ml_loge (
"Configuration file is not loaded.");
283 GSList *lstF = NULL, *lstN = NULL;
292 if (searchpath[j] && !g_strcmp0 (searchpath[i], searchpath[j])) {
302 lstF = g_slist_reverse (lstF);
303 lstN = g_slist_reverse (lstN);
305 *fullpath_vstr = g_malloc0_n (counter + 1,
sizeof (gchar *));
307 *name_vstr = g_malloc0_n (counter + 1,
sizeof (gchar *));
310 vstrF.
vstr = *fullpath_vstr;
311 vstrN.
vstr = *name_vstr;
312 vstrF.
size = counter;
313 vstrN.
size = counter;
329 g_key_file_get_string (key_file,
"filter",
"filters", NULL);
331 g_key_file_get_string (key_file,
"decoder",
"decoders", NULL);
333 g_key_file_get_string (key_file,
"filter",
"customfilters", NULL);
335 g_key_file_get_string (key_file,
"converter",
"converters", NULL);
337 g_key_file_get_string (key_file,
"trainer",
"trainer", NULL);
345 GKeyFile *key_file = NULL;
390 conf.
conffile = g_build_path (G_DIR_SEPARATOR_S, root_path_prefix,
394 if (!g_file_test (
conf.
conffile, G_FILE_TEST_IS_REGULAR)) {
409 key_file = g_key_file_new ();
413 if (g_key_file_load_from_file (key_file,
conf.
conffile, G_KEY_FILE_NONE,
417 value = g_key_file_get_string (key_file,
"common",
"enable_envvar", NULL);
422 g_key_file_get_string (key_file,
"common",
"enable_symlink", NULL);
427 g_key_file_get_string (key_file,
"common",
"extra_config_path", NULL);
432 g_key_file_free (key_file);
437 key_file = g_key_file_new ();
441 G_KEY_FILE_NONE, NULL)) {
445 g_key_file_free (key_file);
448 (
"Cannot find config file '%s'. You should set a valid path to load extra configuration.",
457 ml_logw (
"Failed to load the configuration, no config file found.");
491 for (i = 0; i < total; i++) {
492 if (g_strcmp0 (info.
names[i], subpluginname) == 0)
493 return info.
paths[i];
530 gchar **vstr, **vstrFull;
532 g_return_val_if_fail (info != NULL, 0);
541 info->
paths = vstrFull;
543 return g_strv_length (vstr);
559 gchar *hashkey = g_strdup_printf (
"[%s]%s", group, key);
566 g_hash_table_new_full (g_str_hash, g_str_equal,
g_free,
g_free);
573 gchar *envkey = g_strdup_printf (
"NNSTREAMER_%s_%s", group, key);
581 g_autoptr (GKeyFile) key_file = g_key_file_new ();
585 if (g_key_file_load_from_file (key_file,
conf.
conffile, G_KEY_FILE_NONE,
587 value = g_key_file_get_string (key_file, group, key, NULL);
600 return g_strdup (value);
622 #define STR_BOOL(x) ((x) ? "TRUE" : "FALSE")
637 len = g_snprintf (cur, _size,
638 "Configuration Loaded: %s\n"
639 "Configuration file path: %s\n"
640 " Candidates: envvar(NNSTREAMER_CONF): %s\n"
641 " build-config: %s\n"
644 " Enable envvar: %s\n"
645 " Enable sym-linked subplugins: %s\n"
647 " Filter paths from .ini: %s\n"
653 "Not available (Tizen)",
667 g_printerr (
"Config dump is too large. The results show partially.\n");
687 " - %s: %s\n", g_quark_to_string (key_id), (gchar *)
data);
701 static const char *dump_list_str[] = {
702 "Filter",
"Decoder",
"Conterver",
"Trainer"
718 "\n[%s]\n", dump_list_str[i]);
723 for (j = 0; j < ret; j++) {
726 gchar *sname = info.
names[j];
741 " - No custom property found\n");
751 g_printerr (
"Config dump is too large. The results show partially.\n");