if (data == NULL) {
/* Search and register if found with the conf */
const gchar *fullpath = nnsconf_get_fullpath (name, type);
- char *dlsym_error;
- nnstreamer_subplugin_data *nsdata;
if (fullpath == NULL)
goto error; /* No Such Thing !!! */
/* If a subplugin's constructor has called register_subplugin, skip the rest */
data = g_hash_table_lookup (table, name);
- if (data != NULL)
- goto registered;
-
- nsdata = (nnstreamer_subplugin_data *)
- dlsym (handle, "nnstreamer_subplugin");
- dlsym_error = dlerror ();
-
- if (NULL == nsdata) {
- GST_ERROR ("nnstreamer_subplugin does not exists in %s (%s)", name,
- fullpath);
- goto error_handle;
- }
- if (dlsym_error) {
- GST_ERROR ("Loading nnstreamer_subplugin in %s (%s) incurs: %s", name,
- fullpath, dlsym_error);
- goto error_handle;
- }
-
- if (nsdata->checker != NNS_SUBPLUGIN_CHECKER) {
- GST_ERROR ("nnstreamer_subplugin of %s (%s) is broken (first bytes)",
- name, fullpath);
- goto error_handle;
- }
-
- if (nsdata->type != type) {
- GST_ERROR ("nnstreamer_subplugin of %s (%s) is broken (type mismatch)",
- name, fullpath);
- goto error_handle;
- }
-
- if (g_strcmp0 (nsdata->name, name)) {
- GST_ERROR ("nnstreamer_subplugin of %s (%s) is broken (name mismatch)",
+ if (data == NULL) {
+ GST_ERROR
+ ("nnstreamer_subplugin of %s (%s) is broken. It does not call register_subplugin with its init function.",
name, fullpath);
goto error_handle;
}
-
- g_assert (TRUE == register_subplugin (type, name, nsdata->data));
- g_assert ((data = g_hash_table_lookup (table, name)) != NULL);
- data->handle = handle;
}
-registered:
G_UNLOCK (splock);
return data->data;
* This fils it to be packaged as "devel" package for NN developers. (subplugin writers)
*
* @note Any independent subplugin (existing as an independent .so)
- * should have an exported variable "nnstreamer_subplugin",
- * whose type is nnstreamer_subplugin_data.
- * A built-in subplugin (existing in libnnstreamer.so) does not
- * need this.
+ * should call register_subplugin () (or its wrapper) with the
+ * subplugin's constructor function.
*/
#ifndef __GST_NNSTREAMER_SUBPLUGIN_H__
#define __GST_NNSTREAMER_SUBPLUGIN_H__
#define NNS_SUBPLUGIN_CHECKER (0xdeadbeef)
/**
- * @brief Any independent shared object subplugin must export this as
- * "nnstreamer_subplugin"
- */
-typedef struct {
- uint32_t checker; /**< This MUST be 0xdeadbeef (NNS_SUBPLUGIN_CHECKER) */
- subpluginType type; /**< The subplugin type */
- const char *name; /**< The name of subplugin. The resulting .so file should be ${prefix}${name}.so */
- void *data; /**< Subplugin specific data (usually funcptr callbacks), forwarded to subplugin's corresponding handler */
-} nnstreamer_subplugin_data;
-
-/**
* @brief Retrieve the resigered data with the subplugin name.
* @param[in] type Subplugin Type
* @param[in] name Subplugin Name. The filename should be libnnstreamer_${type}_${name}.so