Doxygen Book
nnstreamer_conf.h File Reference

Internal header for conf/env-var management. More...

#include <glib.h>
Include dependency graph for nnstreamer_conf.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  subplugin_info_s
 

Macros

#define NNSTREAMER_SYS_ROOT_PATH_PREFIX   "/"
 
#define NNSTREAMER_SO_FILE_EXTENSION   ".so"
 
#define NNSTREAMER_DEFAULT_CONF_FILE   "/etc/nnstreamer.ini"
 
#define NNSTREAMER_CONF_FILE   NNSTREAMER_DEFAULT_CONF_FILE
 
#define NNSTREAMER_ENVVAR_CONF_FILE   "NNSTREAMER_CONF"
 

Enumerations

enum  nnsconf_type_path {
  NNSCONF_PATH_FILTERS = 0, NNSCONF_PATH_DECODERS, NNSCONF_PATH_CUSTOM_FILTERS, NNSCONF_PATH_EASY_CUSTOM_FILTERS,
  NNSCONF_PATH_CONVERTERS, NNSCONF_PATH_TRAINERS, NNSCONF_PATH_END
}
 

Functions

gboolean nnsconf_loadconf (gboolean force_reload)
 Load the .ini file. More...
 
const gchar * nnsconf_get_fullpath (const gchar *subpluginname, nnsconf_type_path type)
 Get the configured paths for the type with sub-plugin name. More...
 
gboolean nnsconf_validate_file (nnsconf_type_path type, const gchar *fullpath)
 Public function to validate sub-plugin library is available. More...
 
const gchar * nnsconf_get_subplugin_name_prefix (nnsconf_type_path type)
 Get sub-plugin's name prefix. More...
 
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. More...
 
gchar * nnsconf_get_custom_value_string (const gchar *group, const gchar *key)
 Get the custom configuration value from .ini and envvar. @detail For predefined configurations defined in this header, use the given enum for faster configuration processing. For custom configurations not defined in this header, you may use this API to access your own custom configurations. Configuration values may be loaded only once during runtime, thus, if the values are changed in run-time, the changes are not guaranteed to be reflected. The ENVVAR is supposed to be NNSTREAMER_${group}_${key}, which has higher priority than the .ini configuration. Be careful not to use special characters in group name ([, ], _). More...
 
gboolean nnsconf_get_custom_value_bool (const gchar *group, const gchar *key, gboolean def)
 Get the custom configuration value from .ini and envvar. @detail For predefined configurations defined in this header, use the given enum for faster configuration processing. For custom configurations not defined in this header, you may use this API to access your own custom configurations. Configuration values may be loaded only once during runtime, thus, if the values are changed in run-time, the changes are not guaranteed to be reflected. The ENVVAR is supposed to be NNSTREAMER_${group}_${key}, which has higher priority than the .ini configuration. Be careful not to use special characters in group name ([, ], _). More...
 
void nnsconf_dump (gchar *str, gulong size)
 NNStreamer configuration dump as string. More...
 
void nnsconf_subplugin_dump (gchar *str, gulong size)
 Print out the information of registered sub-plugins. More...
 

Detailed Description

Internal header for conf/env-var management.

NNStreamer Configurations / Environmental Variable Manager. Copyright (C) 2018 MyungJoo Ham myung.nosp@m.joo..nosp@m.ham@s.nosp@m.amsu.nosp@m.ng.co.nosp@m.m

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; version 2.1 of the License.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details.

Date
26 Nov 2018
See also
https://github.com/nnstreamer/nnstreamer
Author
MyungJoo Ham myung.nosp@m.joo..nosp@m.ham@s.nosp@m.amsu.nosp@m.ng.co.nosp@m.m
Bug:
No known bugs except for NYI items

If there are duplicated configurations for the same element, the one with higher priority may override (if it cannot be stacked up),

  • (Highest) Environmental variables
  • The configuration file (default: /etc/nnstreamer.ini)
  • (Lowest) Internal hardcoded values.

Do not export this to devel package. This is an internal header.

Definition in file nnstreamer_conf.h.

Macro Definition Documentation

◆ NNSTREAMER_CONF_FILE

#define NNSTREAMER_CONF_FILE   NNSTREAMER_DEFAULT_CONF_FILE

Definition at line 59 of file nnstreamer_conf.h.

◆ NNSTREAMER_DEFAULT_CONF_FILE

#define NNSTREAMER_DEFAULT_CONF_FILE   "/etc/nnstreamer.ini"

Definition at line 57 of file nnstreamer_conf.h.

◆ NNSTREAMER_ENVVAR_CONF_FILE

#define NNSTREAMER_ENVVAR_CONF_FILE   "NNSTREAMER_CONF"

Definition at line 61 of file nnstreamer_conf.h.

◆ NNSTREAMER_SO_FILE_EXTENSION

#define NNSTREAMER_SO_FILE_EXTENSION   ".so"

Hard-coded system-dependent file extension string of shared (dynamic loadable) object

Definition at line 53 of file nnstreamer_conf.h.

◆ NNSTREAMER_SYS_ROOT_PATH_PREFIX

#define NNSTREAMER_SYS_ROOT_PATH_PREFIX   "/"

Definition at line 43 of file nnstreamer_conf.h.

Enumeration Type Documentation

◆ nnsconf_type_path

Enumerator
NNSCONF_PATH_FILTERS 
NNSCONF_PATH_DECODERS 
NNSCONF_PATH_CUSTOM_FILTERS 
NNSCONF_PATH_EASY_CUSTOM_FILTERS 
NNSCONF_PATH_CONVERTERS 
NNSCONF_PATH_TRAINERS 
NNSCONF_PATH_END 

Definition at line 63 of file nnstreamer_conf.h.

Function Documentation

◆ nnsconf_dump()

void nnsconf_dump ( gchar *  str,
gulong  size 
)

NNStreamer configuration dump as string.

Parameters
[out]strPreallocated string for the output (dump).
[in]sizeThe size of given str.

NNStreamer configuration dump as string.

Todo:
Add more configuration values to dump.

Definition at line 628 of file nnstreamer_conf.c.

Here is the call graph for this function:

◆ nnsconf_get_custom_value_bool()

gboolean nnsconf_get_custom_value_bool ( const gchar *  group,
const gchar *  key,
gboolean  def 
)

Get the custom configuration value from .ini and envvar. @detail For predefined configurations defined in this header, use the given enum for faster configuration processing. For custom configurations not defined in this header, you may use this API to access your own custom configurations. Configuration values may be loaded only once during runtime, thus, if the values are changed in run-time, the changes are not guaranteed to be reflected. The ENVVAR is supposed to be NNSTREAMER_${group}_${key}, which has higher priority than the .ini configuration. Be careful not to use special characters in group name ([, ], _).

Parameters
[in]groupThe group name, [group], in .ini file.
[in]keyThe key name, key = value, in .ini file.
[in]defThe default return value in case there is no value available.
Returns
The value interpreted as TRUE/FALSE.

Get the custom configuration value from .ini and envvar. @detail For predefined configurations defined in this header, use the given enum for faster configuration processing. For custom configurations not defined in this header, you may use this API to access your own custom configurations. Configuration values may be loaded only once during runtime, thus, if the values are changed in run-time, the changes are not guaranteed to be reflected. The ENVVAR is supposed to be NNSTREAMER_${group}_${key}, which has higher priority than the .ini configuration. Be careful not to use special characters in group name ([, ], _).

Note
This function is included in nnstreamer internal header for native APIs. When changing the declaration, you should update the internal header (nnstreamer_internal.h).

Definition at line 609 of file nnstreamer_conf.c.

◆ nnsconf_get_custom_value_string()

gchar* nnsconf_get_custom_value_string ( const gchar *  group,
const gchar *  key 
)

Get the custom configuration value from .ini and envvar. @detail For predefined configurations defined in this header, use the given enum for faster configuration processing. For custom configurations not defined in this header, you may use this API to access your own custom configurations. Configuration values may be loaded only once during runtime, thus, if the values are changed in run-time, the changes are not guaranteed to be reflected. The ENVVAR is supposed to be NNSTREAMER_${group}_${key}, which has higher priority than the .ini configuration. Be careful not to use special characters in group name ([, ], _).

Parameters
[in]groupThe group name, [group], in .ini file.
[in]keyThe key name, key = value, in .ini file.
Returns
The newly allocated string. A caller must free it. NULL if it's not available.

Get the custom configuration value from .ini and envvar. @detail For predefined configurations defined in this header, use the given enum for faster configuration processing. For custom configurations not defined in this header, you may use this API to access your own custom configurations. Configuration values may be loaded only once during runtime, thus, if the values are changed in run-time, the changes are not guaranteed to be reflected. The ENVVAR is supposed to be NNSTREAMER_${group}_${key}, which has higher priority than the .ini configuration. Be careful not to use special characters in group name ([, ], _).

Note
This function is included in nnstreamer internal header for native APIs. When changing the declaration, you should update the internal header (nnstreamer_internal.h).

Internal lib error? out-of-memory?

Definition at line 557 of file nnstreamer_conf.c.

◆ nnsconf_get_fullpath()

const gchar* nnsconf_get_fullpath ( const gchar *  subpluginname,
nnsconf_type_path  type 
)

Get the configured paths for the type with sub-plugin name.

Parameters
[in]Thesubplugin name except for the prefix and postfix (.so) to find
[in]typeThe type (FILTERS/DECODERS/CUSTOM_FILTERS)
Returns
The full path to the file. Caller MUST NOT modify this. Returns NULL if we cannot find the file.

This is mainly supposed to be used by CUSTOM_FILTERS

Get the configured paths for the type with sub-plugin name.

Definition at line 483 of file nnstreamer_conf.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nnsconf_get_subplugin_info()

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.

Parameters
[in]typeThe type (FILTERS/DECODERS/CUSTOM_FILTERS)
[out]infoThe data structure which contains the name and full path of sub-plugins
Returns
total number of sub-plugins for given type
Note
DO NOT free sub-plugins info
Returns
total number of sub-plugins for given type
Note
DO NOT free sub-plugins info

Definition at line 528 of file nnstreamer_conf.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nnsconf_get_subplugin_name_prefix()

const gchar* nnsconf_get_subplugin_name_prefix ( nnsconf_type_path  type)

Get sub-plugin's name prefix.

Parameters
[in]typeThe type (FILTERS/DECODERS/CUSTOM_FILTERS)
Returns
Predefined prefix string for given type.

Definition at line 516 of file nnstreamer_conf.c.

◆ nnsconf_loadconf()

gboolean nnsconf_loadconf ( gboolean  force_reload)

Load the .ini file.

Parameters
[in]force_reloadTRUE if you want to clean up and load conf again.
Returns
TRUE if successful or skipped. FALSE if error reading something.

Load the .ini file.

if it's not Tizen, configuration from env-var has a higher priority

Priority of reading a conf file 1) read from NNSTREAMER_CONF_FILE 2) read from NNSTREAMER_DEFAULT_CONF_FILE 3) read from env-var

default value of 'sysconfdir' in meson is 'etc'

Internal lib error? out-of-memory?

Internal lib error? out-of-memory?

Failed to get the configuration. Note that Android API does not use the configuration.

Definition at line 342 of file nnstreamer_conf.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nnsconf_subplugin_dump()

void nnsconf_subplugin_dump ( gchar *  str,
gulong  size 
)

Print out the information of registered sub-plugins.

Definition at line 695 of file nnstreamer_conf.c.

Here is the call graph for this function:

◆ nnsconf_validate_file()

gboolean nnsconf_validate_file ( nnsconf_type_path  type,
const gchar *  fullpath 
)

Public function to validate sub-plugin library is available.

Parameters
[in]typeThe type (FILTERS/DECODERS/CUSTOM_FILTERS)
[in]fullpathThe full path to the file.
Returns
True if the file is regular and can be added to the list.

Definition at line 503 of file nnstreamer_conf.c.

Here is the call graph for this function:
Here is the caller graph for this function: