* $ sudo apt install libprotobuf-dev libprotobuf-lite17 libprotobuf17 protobuf-compiler17
*/
-#include <nnstreamer_plugin_api.h>
#include <nnstreamer_log.h>
+#include <nnstreamer_plugin_api.h>
+#include "nnstreamer_protobuf.h"
#include "nnstreamer.pb.h" /* Generated by `protoc` */
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-namespace nnstreamer {
-namespace protobuf {
-
/** @brief tensordec-plugin's GstTensorDecoderDef callback */
GstFlowReturn
gst_tensor_decoder_protobuf (const GstTensorsConfig * config,
GstMapInfo out_info;
GstMemory *out_mem;
size_t size, outbuf_size;
- Tensors tensors;
- Tensors::frame_rate *fr = NULL;
+ nnstreamer::protobuf::Tensors tensors;
+ nnstreamer::protobuf::Tensors::frame_rate *fr = NULL;
const unsigned int num_tensors = config->info.num_tensors;
if (NULL == outbuf) {
fr->set_rate_d (config->rate_d);
for (unsigned int i = 0; i < num_tensors; ++i) {
- Tensor *tensor = tensors.add_tensor ();
+ nnstreamer::protobuf::Tensor *tensor = tensors.add_tensor ();
gchar *name = NULL;
name = config->info.info[i].name;
tensor->set_name (name);
}
- tensor->set_type ((Tensor::Tensor_type)
+ tensor->set_type ((nnstreamer::protobuf::Tensor::Tensor_type)
config->info.info[i].type);
for (int j = 0; j < NNS_TENSOR_RANK_LIMIT; ++j) {
gst_tensor_converter_protobuf (GstBuffer * in_buf, gsize * frame_size,
guint * frames_in, GstTensorsConfig * config)
{
- Tensors tensors;
- Tensors::frame_rate * fr = NULL;
+ nnstreamer::protobuf::Tensors tensors;
+ nnstreamer::protobuf::Tensors::frame_rate * fr = NULL;
GstMemory *in_mem, *out_mem;
GstMapInfo in_info;
GstBuffer *out_buf;
out_buf = gst_buffer_new ();
for (guint i = 0; i < config->info.num_tensors; i++) {
- const Tensor *tensor = &tensors.tensor (i);
+ const nnstreamer::protobuf::Tensor *tensor = &tensors.tensor (i);
config->info.info[i].name = g_strdup (tensor->name ().c_str ());
config->info.info[i].type = (tensor_type) tensor->type ();
for (guint j = 0; j < NNS_TENSOR_RANK_LIMIT; j++) {
return out_buf;
}
-
-}; /* Namespace protobuf */
-}; /* Namespace nnstreamer */
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
* @bug No known bugs except for NYI items
*
*/
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
+
+#ifndef __NNS_PROTOBUF_UTIL_H__
+#define __NNS_PROTOBUF_UTIL_H__
+
+#include <nnstreamer_plugin_api.h>
/**
* @brief Default static capability for Protocol Buffers
gst_tensor_converter_protobuf (GstBuffer * in_buf, gsize * frame_size,
guint * frames_in, GstTensorsConfig * config);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+#endif /* __NNS_PROTOBUF_UTIL_H__ */
GST_TENSORS_CAP_WITH_NUM(GST_TENSOR_NUM_TENSORS_RANGE)
/**
- * @brief Default static capability for Protocol Buffers
- * protobuf converter will convert this capability to other/tensor(s)
- * @todo Move this definition to proper header file
- */
-#define GST_PROTOBUF_TENSOR_CAP_DEFAULT \
- "other/protobuf-tensor, " \
- "framerate = " GST_TENSOR_RATE_RANGE
-/**
* @brief Default static capability for flatbuffers
* Flatbuf converter will convert this capability to other/tensor(s)
* @todo Move this definition to proper header file