Move all element registration to common file. (warning about function prototype)
Signed-off-by: Jaeyun Jung <jy1210.jung@samsung.com>
#endif
#include <gst/gst.h>
-#include <gst/gstplugin.h>
-#define NNSTREAMER_PLUGIN(name) \
- extern gboolean G_PASTE(nnstreamer_export_, name) (GstPlugin *plugin)
+#include "tensor_aggregator/tensor_aggregator.h"
+#include "tensor_converter/tensor_converter.h"
+#include "tensor_decoder/tensordec.h"
+#include "tensor_demux/gsttensordemux.h"
+#include "tensor_filter/tensor_filter.h"
+#include "tensor_merge/gsttensormerge.h"
+#include "tensor_mux/gsttensormux.h"
+#include "tensor_reposink/tensor_reposink.h"
+#include "tensor_reposrc/tensor_reposrc.h"
+#include "tensor_sink/tensor_sink.h"
+#include "tensor_source/tensor_src_iio.h"
+#include "tensor_split/gsttensorsplit.h"
+#include "tensor_transform/tensor_transform.h"
-NNSTREAMER_PLUGIN (tensor_converter);
-NNSTREAMER_PLUGIN (tensor_aggregator);
-NNSTREAMER_PLUGIN (tensor_decoder);
-NNSTREAMER_PLUGIN (tensor_demux);
-NNSTREAMER_PLUGIN (tensor_merge);
-NNSTREAMER_PLUGIN (tensor_mux);
-NNSTREAMER_PLUGIN (tensor_sink);
-NNSTREAMER_PLUGIN (tensor_src_iio);
-NNSTREAMER_PLUGIN (tensor_split);
-NNSTREAMER_PLUGIN (tensor_transform);
-NNSTREAMER_PLUGIN (tensor_filter);
-NNSTREAMER_PLUGIN (tensor_reposink);
-NNSTREAMER_PLUGIN (tensor_reposrc);
-
-#define NNSTREAMER_INIT(name, plugin) \
+#define NNSTREAMER_INIT(plugin,name,type) \
do { \
- if (!G_PASTE(nnstreamer_export_, name)(plugin)) \
+ if (!gst_element_register (plugin, "tensor_" # name, GST_RANK_NONE, GST_TYPE_TENSOR_ ## type)) { \
+ GST_ERROR ("Failed to register nnstreamer plugin : tensor_" # name); \
return FALSE; \
- } while (0);
+ } \
+ } while (0)
/**
* @brief Function to initialize all nnstreamer elements
static gboolean
gst_nnstreamer_init (GstPlugin * plugin)
{
- NNSTREAMER_INIT (tensor_converter, plugin);
- NNSTREAMER_INIT (tensor_aggregator, plugin);
- NNSTREAMER_INIT (tensor_decoder, plugin);
- NNSTREAMER_INIT (tensor_demux, plugin);
- NNSTREAMER_INIT (tensor_merge, plugin);
- NNSTREAMER_INIT (tensor_mux, plugin);
- NNSTREAMER_INIT (tensor_sink, plugin);
- NNSTREAMER_INIT (tensor_src_iio, plugin);
- NNSTREAMER_INIT (tensor_split, plugin);
- NNSTREAMER_INIT (tensor_transform, plugin);
- NNSTREAMER_INIT (tensor_filter, plugin);
- NNSTREAMER_INIT (tensor_reposink, plugin);
- NNSTREAMER_INIT (tensor_reposrc, plugin);
-
+ NNSTREAMER_INIT (plugin, aggregator, AGGREGATOR);
+ NNSTREAMER_INIT (plugin, converter, CONVERTER);
+ NNSTREAMER_INIT (plugin, decoder, DECODER);
+ NNSTREAMER_INIT (plugin, demux, DEMUX);
+ NNSTREAMER_INIT (plugin, filter, FILTER);
+ NNSTREAMER_INIT (plugin, merge, MERGE);
+ NNSTREAMER_INIT (plugin, mux, MUX);
+ NNSTREAMER_INIT (plugin, reposink, REPOSINK);
+ NNSTREAMER_INIT (plugin, reposrc, REPOSRC);
+ NNSTREAMER_INIT (plugin, sink, SINK);
+ NNSTREAMER_INIT (plugin, src_iio, SRC_IIO);
+ NNSTREAMER_INIT (plugin, split, SPLIT);
+ NNSTREAMER_INIT (plugin, transform, TRANSFORM);
return TRUE;
}
GObjectClass *object_class;
GstElementClass *element_class;
+ GST_DEBUG_CATEGORY_INIT (gst_tensor_aggregator_debug, "tensor_aggregator", 0,
+ "Element to aggregate tensor stream");
+
object_class = (GObjectClass *) klass;
element_class = (GstElementClass *) klass;
silent_debug_config (&self->out_config, "out-tensor");
return TRUE;
}
-
-/**
- * @brief Function to initialize the plugin.
- *
- * See GstPluginInitFunc() for more details.
- */
-NNSTREAMER_PLUGIN_INIT (tensor_aggregator)
-{
- GST_DEBUG_CATEGORY_INIT (gst_tensor_aggregator_debug, "tensor_aggregator",
- 0, "tensor_aggregator element");
-
- return gst_element_register (plugin, "tensor_aggregator",
- GST_RANK_NONE, GST_TYPE_TENSOR_AGGREGATOR);
-}
gst_caps_new_simple ("other/tensorsave", NULL, NULL), NULL, NULL); \
} while (0)
-#define NNSTREAMER_PLUGIN_INIT(name) \
- gboolean G_PASTE(nnstreamer_export_, name) (GstPlugin * plugin)
-
-
/**
* @brief A function call to decide current timestamp among collected pads based on PTS.
* It will decide current timestamp according to sync option.
GstPadTemplate *pad_template;
GstCaps *pad_caps;
+ GST_DEBUG_CATEGORY_INIT (gst_tensor_converter_debug, "tensor_converter", 0,
+ "Element to convert media stream to tensor stream");
+
object_class = (GObjectClass *) klass;
element_class = (GstElementClass *) klass;
self->tensor_config = config;
return TRUE;
}
-
-/**
- * @brief Function to initialize the plugin.
- *
- * See GstPluginInitFunc() for more details.
- */
-NNSTREAMER_PLUGIN_INIT (tensor_converter)
-{
- GST_DEBUG_CATEGORY_INIT (gst_tensor_converter_debug, "tensor_converter",
- 0, "tensor_converter element");
-
- return gst_element_register (plugin, "tensor_converter",
- GST_RANK_NONE, GST_TYPE_TENSOR_CONVERTER);
-}
GstElementClass *gstelement_class;
GstBaseTransformClass *trans_class;
+ GST_DEBUG_CATEGORY_INIT (gst_tensordec_debug, "tensor_decoder", 0,
+ "Element to convert tensor to media stream");
+
trans_class = (GstBaseTransformClass *) klass;
gstelement_class = (GstElementClass *) trans_class;
gobject_class = (GObjectClass *) gstelement_class;
GST_ERROR_OBJECT (self, "Decoder plugin not yet configured.");
return FALSE;
}
-
-/**
- * @brief entry point to initialize the plug-in
- * initialize the plug-in itself
- * register the element factories and other features
- */
-NNSTREAMER_PLUGIN_INIT (tensor_decoder)
-{
- /**
- * debug category for fltering log messages
- */
- GST_DEBUG_CATEGORY_INIT (gst_tensordec_debug, "tensor_decoder",
- 0, "Element to convert tensor to media stream");
-
- return gst_element_register (plugin, "tensor_decoder", GST_RANK_NONE,
- GST_TYPE_TENSOR_DECODER);
-}
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
+ GST_DEBUG_CATEGORY_INIT (gst_tensor_demux_debug, "tensor_demux", 0,
+ "Element to demux tensors to tensor stream");
+
gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
break;
}
}
-
-/**
- * @brief entry point to initialize the plug-in
- * initialize the plug-in itself
- * register the element factories and other features
- */
-NNSTREAMER_PLUGIN_INIT (tensor_demux)
-{
- /** debug category for fltering log messages
- * exchange the string 'Template tensor_demux' with your description
- */
- GST_DEBUG_CATEGORY_INIT (gst_tensor_demux_debug, "tensor_demux", 0,
- "Tensor Demuxer");
- return gst_element_register (plugin, "tensor_demux",
- GST_RANK_NONE, GST_TYPE_TENSOR_DEMUX);
-}
GstElementClass *gstelement_class;
GstBaseTransformClass *trans_class;
+ GST_DEBUG_CATEGORY_INIT (gst_tensor_filter_debug, "tensor_filter", 0,
+ "Tensor filter to invoke neural network model");
+
trans_class = (GstBaseTransformClass *) klass;
gstelement_class = (GstElementClass *) trans_class;
gobject_class = (GObjectClass *) gstelement_class;
gst_tensor_filter_close_fw (self);
return TRUE;
}
-
-/**
- * @brief entry point to initialize the plug-in
- * initialize the plug-in itself
- * register the element factories and other features
- */
-NNSTREAMER_PLUGIN_INIT (tensor_filter)
-{
- /**
- * debug category for filtering log messages
- */
- GST_DEBUG_CATEGORY_INIT (gst_tensor_filter_debug, "tensor_filter",
- 0, "tensor_filter element");
-
- return gst_element_register (plugin, "tensor_filter", GST_RANK_NONE,
- GST_TYPE_TENSOR_FILTER);
-}
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
+ GST_DEBUG_CATEGORY_INIT (gst_tensor_merge_debug, "tensor_merge", 0,
+ "Element to merge multiple tensor stream to tensor stream");
+
gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
break;
}
}
-
-
-/**
- * @brief entry point to initialize the plug-in
- * initialize the plug-in itself
- * register the element factories and other features
- */
-NNSTREAMER_PLUGIN_INIT (tensor_merge)
-{
- /** debug category for fltering log messages
- * exchange the string 'Template tensor_merge' with your description
- */
- GST_DEBUG_CATEGORY_INIT (gst_tensor_merge_debug, "tensor_merge", 0,
- "Tensor Merger");
- return gst_element_register (plugin, "tensor_merge",
- GST_RANK_NONE, GST_TYPE_TENSOR_MERGE);
-}
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
+ GST_DEBUG_CATEGORY_INIT (gst_tensor_mux_debug, "tensor_mux", 0,
+ "Element to merge tensor stream to tensors stream");
+
gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
break;
}
}
-
-
-/**
- * @brief entry point to initialize the plug-in
- * initialize the plug-in itself
- * register the element factories and other features
- */
-NNSTREAMER_PLUGIN_INIT (tensor_mux)
-{
- /** debug category for fltering log messages
- * exchange the string 'Template tensor_mux' with your description
- */
- GST_DEBUG_CATEGORY_INIT (gst_tensor_mux_debug, "tensor_mux", 0,
- "Tensor Muxer");
- return gst_element_register (plugin, "tensor_mux",
- GST_RANK_NONE, GST_TYPE_TENSOR_MUX);
-}
GObjectClass *gobject_class;
GstElementClass *element_class;
GstBaseSinkClass *basesink_class;
+
+ GST_DEBUG_CATEGORY_INIT (gst_tensor_reposink_debug, "tensor_reposink", 0,
+ "Sink element to handle tensor repository");
+
gobject_class = G_OBJECT_CLASS (klass);
element_class = GST_ELEMENT_CLASS (klass);
basesink_class = GST_BASE_SINK_CLASS (klass);
return caps;
}
-
-
-/**
- * @brief Function to initialize the plugin.
- *
- * See GstPluginInitFunc() for more details.
- */
-NNSTREAMER_PLUGIN_INIT (tensor_reposink)
-{
- GST_DEBUG_CATEGORY_INIT (gst_tensor_reposink_debug, "tensor_reposink",
- 0, "tensor_reposink element");
-
- return gst_element_register (plugin, "tensor_reposink",
- GST_RANK_NONE, GST_TYPE_TENSOR_REPOSINK);
-}
GstPushSrcClass *pushsrc_class = GST_PUSH_SRC_CLASS (klass);
GstBaseSrcClass *basesrc_class = GST_BASE_SRC_CLASS (klass);
+ GST_DEBUG_CATEGORY_INIT (gst_tensor_reposrc_debug, "tensor_reposrc", 0,
+ "Source element to handle tensor repository");
+
gobject_class->set_property = gst_tensor_reposrc_set_property;
gobject_class->get_property = gst_tensor_reposrc_get_property;
return GST_FLOW_OK;
}
-
-/**
- * @brief Function to initialize the plugin.
- *
- * See GstPluginInitFunc() for more details.
- */
-NNSTREAMER_PLUGIN_INIT (tensor_reposrc)
-{
- GST_DEBUG_CATEGORY_INIT (gst_tensor_reposrc_debug, "tensor_reposrc",
- 0, "tensor_reposrc element");
-
- return gst_element_register (plugin, "tensor_reposrc",
- GST_RANK_NONE, GST_TYPE_TENSOR_REPOSRC);
-}
GstElementClass *element_class;
GstBaseSinkClass *bsink_class;
+ GST_DEBUG_CATEGORY_INIT (gst_tensor_sink_debug, "tensor_sink", 0,
+ "Sink element to handle tensor stream");
+
gobject_class = G_OBJECT_CLASS (klass);
element_class = GST_ELEMENT_CLASS (klass);
bsink_class = GST_BASE_SINK_CLASS (klass);
return self->silent;
}
-
-/**
- * @brief Function to initialize the plugin.
- *
- * See GstPluginInitFunc() for more details.
- */
-NNSTREAMER_PLUGIN_INIT (tensor_sink)
-{
- GST_DEBUG_CATEGORY_INIT (gst_tensor_sink_debug, "tensor_sink",
- 0, "tensor_sink element");
-
- return gst_element_register (plugin, "tensor_sink",
- GST_RANK_NONE, GST_TYPE_TENSOR_SINK);
-}
GstElementClass *gstelement_class;
GstBaseSrcClass *bsrc_class;
+ GST_DEBUG_CATEGORY_INIT (gst_tensor_src_iio_debug, "tensor_src_iio", 0,
+ "Source element to handle Linux Industrial I/O sensors as input");
+
gobject_class = G_OBJECT_CLASS (klass);
gstelement_class = GST_ELEMENT_CLASS (klass);
bsrc_class = GST_BASE_SRC_CLASS (klass);
return GST_FLOW_ERROR;
}
-
-/**
- * @brief entry point to initialize the plug-in
- * initialize the plug-in itself
- * register the element factories and other features
- */
-NNSTREAMER_PLUGIN_INIT (tensor_src_iio)
-{
- /**
- * debug category for filtering log messages
- */
- GST_DEBUG_CATEGORY_INIT (gst_tensor_src_iio_debug, "tensor_src_iio",
- 0, "tensor_src_iio element");
-
- return gst_element_register (plugin, "tensor_src_iio", GST_RANK_NONE,
- GST_TYPE_TENSOR_SRC_IIO);
-}
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
+ GST_DEBUG_CATEGORY_INIT (gst_tensor_split_debug, "tensor_split", 0,
+ "Element to split tensors stream to tensor stream");
+
gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
break;
}
}
-
-/**
- * @brief entry point to initialize the plug-in
- * initialize the plug-in itself
- * register the element factories and other features
- */
-NNSTREAMER_PLUGIN_INIT (tensor_split)
-{
- /** debug category for fltering log messages
- * exchange the string 'Template tensor_split' with your description
- */
- GST_DEBUG_CATEGORY_INIT (gst_tensor_split_debug, "tensor_split", 0,
- "Tensor Spliter");
- return gst_element_register (plugin, "tensor_split",
- GST_RANK_NONE, GST_TYPE_TENSOR_SPLIT);
-}
GstElementClass *gstelement_class;
GstBaseTransformClass *trans_class;
+ GST_DEBUG_CATEGORY_INIT (gst_tensor_transform_debug, "tensor_transform", 0,
+ "Element to transforms tensor dimension or type");
+
trans_class = (GstBaseTransformClass *) klass;
gstelement_class = (GstElementClass *) trans_class;
gobject_class = (GObjectClass *) gstelement_class;
*othersize = gst_tensor_info_get_size (&filter->out_config.info);
return TRUE;
}
-
-/**
- * @brief entry point to initialize the plug-in
- * initialize the plug-in itself
- * register the element factories and other features
- */
-NNSTREAMER_PLUGIN_INIT (tensor_transform)
-{
- /**
- * debug category for fltering log messages
- */
- GST_DEBUG_CATEGORY_INIT (gst_tensor_transform_debug, "tensor_transform",
- 0, "tensor_transform element");
-
- return gst_element_register (plugin, "tensor_transform",
- GST_RANK_NONE, GST_TYPE_TENSOR_TRANSFORM);
-}