Doxygen Book
nnstreamer_subplugin.c File Reference

Subplugin Manager for NNStreamer. More...

#include <glib.h>
#include <gmodule.h>
#include "nnstreamer_log.h"
#include "nnstreamer_subplugin.h"
#include "nnstreamer_conf.h"
#include <nnstreamer_util.h>
Include dependency graph for nnstreamer_subplugin.c:

Go to the source code of this file.

Enumerations

enum  subpluginSearchLogic { NNS_SEARCH_FILENAME, NNS_SEARCH_GETALL, NNS_SEARCH_NO_OP }
 

Functions

static void init_subplugin (void)
 Create handles at the start of library. More...
 
 G_LOCK_DEFINE_STATIC (splock)
 Protects handles and subplugins. More...
 
static void _spdata_destroy (gpointer _data)
 Private function for g_hash_table data destructor, GDestroyNotify. More...
 
static subpluginData_get_subplugin_data (subpluginType type, const gchar *name)
 Internal function to get sub-plugin data. More...
 
static subpluginData_search_subplugin (subpluginType type, const gchar *name, const gchar *path)
 Internal function to scan sub-plugin. More...
 
const void * get_subplugin (subpluginType type, const char *name)
 Public function defined in the header. More...
 
gchar ** get_all_subplugins (subpluginType type)
 Public function defined in the header. More...
 
gboolean register_subplugin (subpluginType type, const char *name, const void *data)
 Public function defined in the header. More...
 
gboolean unregister_subplugin (subpluginType type, const char *name)
 Public function defined in the header. More...
 
static void _close_handle (gpointer data)
 dealloc function for handles More...
 
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. More...
 
GData * subplugin_get_custom_property_desc (subpluginType type, const char *name)
 common interface to get custom property description of a sub-plugin. More...
 
static void fini_subplugin (void)
 Free handles at the start of library. More...
 

Variables

static GPtrArray * handles = NULL
 Array of dynamic loaded handles. More...
 
 subpluginData
 
static GHashTable * subplugins [NNS_SUBPLUGIN_END] = { 0 }
 
static subpluginSearchLogic searchAlgorithm []
 

Detailed Description

Subplugin Manager for NNStreamer.

NNStreamer Subplugin 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
27 Nov 2018
See also
http://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

Definition in file nnstreamer_subplugin.c.

Enumeration Type Documentation

◆ subpluginSearchLogic

Enumerator
NNS_SEARCH_FILENAME 
NNS_SEARCH_GETALL 
NNS_SEARCH_NO_OP 

Definition at line 64 of file nnstreamer_subplugin.c.

Function Documentation

◆ _close_handle()

static void _close_handle ( gpointer  data)
static

dealloc function for handles

Ubuntu 16.04 / GLIBC 2.23 Workaround If we do dlclose at exit() function, it may incur https://bugzilla.redhat.com/show_bug.cgi?id=1264556#c42 , which is a GLIBC bug at 2.23. The corresponding error message is: Inconsistency detected by ld.so: dl-close.c: 811: _dl_close: Assertion ‘map->l_init_called’ failed! Note that Tizen 5.5 / GLIBC 2.24 has the same bug!

Definition at line 305 of file nnstreamer_subplugin.c.

◆ _get_subplugin_data()

static subpluginData* _get_subplugin_data ( subpluginType  type,
const gchar *  name 
)
static

Internal function to get sub-plugin data.

Definition at line 87 of file nnstreamer_subplugin.c.

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

◆ _search_subplugin()

static subpluginData* _search_subplugin ( subpluginType  type,
const gchar *  name,
const gchar *  path 
)
static

Internal function to scan sub-plugin.

Definition at line 108 of file nnstreamer_subplugin.c.

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

◆ _spdata_destroy()

static void _spdata_destroy ( gpointer  _data)
static

Private function for g_hash_table data destructor, GDestroyNotify.

Definition at line 54 of file nnstreamer_subplugin.c.

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

◆ fini_subplugin()

static void fini_subplugin ( void  )
static

Free handles at the start of library.

Internal error (init not called?)

Definition at line 385 of file nnstreamer_subplugin.c.

Here is the call graph for this function:

◆ G_LOCK_DEFINE_STATIC()

G_LOCK_DEFINE_STATIC ( splock  )

Protects handles and subplugins.

◆ get_all_subplugins()

gchar** get_all_subplugins ( subpluginType  type)

Public function defined in the header.

Get the list of registered subplugins.

Definition at line 176 of file nnstreamer_subplugin.c.

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

◆ get_subplugin()

const void* get_subplugin ( subpluginType  type,
const char *  name 
)

Public function defined in the header.

Retrieve the registered data with the subplugin name.

Search and register if found with the conf

Definition at line 141 of file nnstreamer_subplugin.c.

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

◆ init_subplugin()

static void init_subplugin ( void  )
static

Create handles at the start of library.

< The name of subplugin

< subplugin specific data forwarded from the subplugin

< [OPTIONAL] subplugin specific custom property desc list

Internal error (duplicated init call?)

Definition at line 37 of file nnstreamer_subplugin.c.

◆ register_subplugin()

gboolean register_subplugin ( subpluginType  type,
const char *  name,
const void *  data 
)

Public function defined in the header.

Register the subplugin. If duplicated name exists, it is rejected.

Todo:
data out of scope at add

Definition at line 225 of file nnstreamer_subplugin.c.

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

◆ subplugin_get_custom_property_desc()

GData* subplugin_get_custom_property_desc ( subpluginType  type,
const char *  name 
)

common interface to get custom property description of a sub-plugin.

Definition at line 359 of file nnstreamer_subplugin.c.

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

◆ subplugin_set_custom_property_desc()

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.

Definition at line 329 of file nnstreamer_subplugin.c.

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

◆ unregister_subplugin()

gboolean unregister_subplugin ( subpluginType  type,
const char *  name 
)

Public function defined in the header.

Unregister the subplugin.

Definition at line 289 of file nnstreamer_subplugin.c.

Here is the caller graph for this function:

Variable Documentation

◆ handles

GPtrArray* handles = NULL
static

Array of dynamic loaded handles.

Definition at line 35 of file nnstreamer_subplugin.c.

◆ searchAlgorithm

◆ subpluginData

subpluginData

Definition at line 45 of file nnstreamer_subplugin.c.

◆ subplugins

GHashTable* subplugins[NNS_SUBPLUGIN_END] = { 0 }
static

Definition at line 47 of file nnstreamer_subplugin.c.

NNS_SUBPLUGIN_DECODER
@ NNS_SUBPLUGIN_DECODER
Definition: nnstreamer_subplugin.h:42
NNS_IF_CUSTOM
@ NNS_IF_CUSTOM
Definition: nnstreamer_subplugin.h:48
NNS_SUBPLUGIN_FILTER
@ NNS_SUBPLUGIN_FILTER
Definition: nnstreamer_subplugin.h:41
NNS_SEARCH_FILENAME
@ NNS_SEARCH_FILENAME
Definition: nnstreamer_subplugin.c:66
NNS_EASY_CUSTOM_FILTER
@ NNS_EASY_CUSTOM_FILTER
Definition: nnstreamer_subplugin.h:43
NNS_CUSTOM_CONVERTER
@ NNS_CUSTOM_CONVERTER
Definition: nnstreamer_subplugin.h:46
NNS_SUBPLUGIN_TRAINER
@ NNS_SUBPLUGIN_TRAINER
Definition: nnstreamer_subplugin.h:45
NNS_SEARCH_NO_OP
@ NNS_SEARCH_NO_OP
Definition: nnstreamer_subplugin.c:68
NNS_SUBPLUGIN_CONVERTER
@ NNS_SUBPLUGIN_CONVERTER
Definition: nnstreamer_subplugin.h:44
NNS_SEARCH_GETALL
@ NNS_SEARCH_GETALL
Definition: nnstreamer_subplugin.c:67
NNS_CUSTOM_DECODER
@ NNS_CUSTOM_DECODER
Definition: nnstreamer_subplugin.h:47
NNS_SUBPLUGIN_END
@ NNS_SUBPLUGIN_END
Definition: nnstreamer_subplugin.h:50