[Converter] Define function to find subplugins
authorGichan Jang <gichan2.jang@samsung.com>
Tue, 6 Apr 2021 04:41:39 +0000 (13:41 +0900)
committerjaeyun-jung <39614140+jaeyun-jung@users.noreply.github.com>
Thu, 8 Apr 2021 06:53:28 +0000 (15:53 +0900)
Define function to find converter subplugins.

Signed-off-by: Gichan Jang <gichan2.jang@samsung.com>
gst/nnstreamer/include/nnstreamer_plugin_api_converter.h
gst/nnstreamer/tensor_converter/tensor_converter.c

index a37bbaa..c241c38 100644 (file)
@@ -75,6 +75,15 @@ typedef struct _NNStreamerExternalConverter
 } NNStreamerExternalConverter;
 
 /**
+ * @brief Find converter sub-plugin with the name.
+ * @param[in] name The name of converter sub-plugin.
+ * @return NNStreamerExternalConverter if subplugin is found.
+ *         NULL if not found or the sub-plugin object has an error.
+ */
+extern const NNStreamerExternalConverter *
+nnstreamer_converter_find (const char *name);
+
+/**
  * @brief Converter's sub-plugin should call this function to register itself.
  * @param[in] ex Converter sub-plugin to be registered.
  * @return TRUE if registered. FALSE is failed or duplicated.
index fb948b4..22fefb4 100644 (file)
@@ -308,7 +308,7 @@ gst_tensor_converter_class_init (GstTensorConverterClass * klass)
   /* append sub-plugin template caps */
   total = nnsconf_get_subplugin_info (NNSCONF_PATH_CONVERTERS, &info);
   for (i = 0; i < total; i++) {
-    ex = get_subplugin (NNS_SUBPLUGIN_CONVERTER, info.names[i]);
+    ex = nnstreamer_converter_find (info.names[i]);
     if (ex && ex->query_caps)
       gst_caps_append (pad_caps, ex->query_caps (NULL));
   }
@@ -1886,6 +1886,17 @@ gst_tensor_converter_update_caps (GstTensorConverter * self,
 }
 
 /**
+ * @brief Find converter sub-plugin with the name.
+ * @param[in] name The name of converter sub-plugin.
+ * @return NULL if not found or the sub-plugin object has an error.
+ */
+const NNStreamerExternalConverter *
+nnstreamer_converter_find (const char *name)
+{
+  return get_subplugin (NNS_SUBPLUGIN_CONVERTER, name);
+}
+
+/**
  * @brief Converter's external subplugins should call this at init.
  */
 int
@@ -1917,7 +1928,7 @@ findExternalConverter (const char *media_type)
 
   total = nnsconf_get_subplugin_info (NNSCONF_PATH_CONVERTERS, &info);
   for (i = 0; i < total; i++) {
-    ex = get_subplugin (NNS_SUBPLUGIN_CONVERTER, info.names[i]);
+    ex = nnstreamer_converter_find (info.names[i]);
 
     if (ex && ex->query_caps) {
       caps = ex->query_caps (NULL);