From 9d3c0bcbccb7a245875268fec18db282ecb43bc7 Mon Sep 17 00:00:00 2001 From: Sangjung Woo Date: Thu, 11 Jun 2020 10:58:56 +0900 Subject: [PATCH] [Filter/Custom/Easy] Add unregister function This patch newly adds 'NNS_custom_easy_unregister()' function to remove registered function so that pipeline itself can be reused without changing custom model name. Signed-off-by: Sangjung Woo --- gst/nnstreamer/include/tensor_filter_custom_easy.h | 7 +++++++ gst/nnstreamer/tensor_filter/tensor_filter_custom_easy.c | 10 ++++++++++ 2 files changed, 17 insertions(+) diff --git a/gst/nnstreamer/include/tensor_filter_custom_easy.h b/gst/nnstreamer/include/tensor_filter_custom_easy.h index 3f1de9b..01c46a9 100644 --- a/gst/nnstreamer/include/tensor_filter_custom_easy.h +++ b/gst/nnstreamer/include/tensor_filter_custom_easy.h @@ -63,5 +63,12 @@ extern int NNS_custom_easy_register (const char * modelname, NNS_custom_invoke func, void *data, const GstTensorsInfo * in_info, const GstTensorsInfo * out_info); +/** + * @brief Unregister the custom-easy tensor function. + * @param[in] modelname The registered name of custom-easy tensor function. + * @return 0 if success, non-zero if error + */ +extern int NNS_custom_easy_unregister (const char * modelname); + G_END_DECLS #endif /*__NNS_TENSOR_FILTER_CUSTOM_EASY_H__*/ diff --git a/gst/nnstreamer/tensor_filter/tensor_filter_custom_easy.c b/gst/nnstreamer/tensor_filter/tensor_filter_custom_easy.c index 1e4b6c8..fdbf665 100644 --- a/gst/nnstreamer/tensor_filter/tensor_filter_custom_easy.c +++ b/gst/nnstreamer/tensor_filter/tensor_filter_custom_easy.c @@ -85,6 +85,16 @@ NNS_custom_easy_register (const char *modelname, } /** + * @brief Unregister the custom-easy tensor function. + * @return 0 if success. -EINVAL if invalid model name. + */ +int +NNS_custom_easy_unregister (const char *modelname) +{ + return unregister_subplugin (NNS_EASY_CUSTOM_FILTER, modelname) ? 0 : -EINVAL; +} + +/** * @brief Callback required by tensor_filter subplugin */ static int -- 2.7.4