- Element Name is changed.
. tensor_repopush -> tensor_reposink
. tensor_repopop -> tensor_reposrc
- There is hanging bug when reposrc is tryig to get buffer and
reposink set eos signal meanwhile. It is fixed by double check eos
signal during cond wait.
**Self evaluation:**
1. Build test: [X]Passed [ ]Failed [ ]Skipped
2. Run test: [X]Passed [ ]Failed [ ]Skipped
Signed-off-by: jijoong.moon <jijoong.moon@samsung.com>
tensor_split
tensor_transform
tensor_filter
- tensor_repopush
- tensor_repopop
+ tensor_reposink
+ tensor_reposrc
)
ADD_SUBDIRECTORY(nnstreamer_example)
NNSTREAMER_PLUGIN (tensor_split);
NNSTREAMER_PLUGIN (tensor_transform);
NNSTREAMER_PLUGIN (tensor_filter);
-NNSTREAMER_PLUGIN (tensor_repopush);
-NNSTREAMER_PLUGIN (tensor_repopop);
+NNSTREAMER_PLUGIN (tensor_reposink);
+NNSTREAMER_PLUGIN (tensor_reposrc);
#define NNSTREAMER_INIT(name, plugin) \
do { \
NNSTREAMER_INIT (tensor_split, plugin);
NNSTREAMER_INIT (tensor_transform, plugin);
NNSTREAMER_INIT (tensor_filter, plugin);
- NNSTREAMER_INIT (tensor_repopush, plugin);
- NNSTREAMER_INIT (tensor_repopop, plugin);
+ NNSTREAMER_INIT (tensor_reposink, plugin);
+ NNSTREAMER_INIT (tensor_reposrc, plugin);
return TRUE;
}
#include <stdio.h>
#ifndef DBG
-#define DBG FALSE
+#define DBG TRUE
#endif
#define _print_log(...) if (DBG) g_message(__VA_ARGS__)
* @brief add GstTensorData into repo
*/
gboolean
-gst_tensor_repo_add_data (guint myid)
+gst_tensor_repo_add_data (guint nth)
{
gboolean ret = FALSE;
GstTensorData *new;
GST_REPO_LOCK ();
- gpointer *check = g_hash_table_lookup (_repo.hash, GINT_TO_POINTER (myid));
+ gpointer *check = g_hash_table_lookup (_repo.hash, GINT_TO_POINTER (nth));
if (check != NULL) {
return TRUE;
g_cond_init (&new->cond);
g_mutex_init (&new->lock);
- ret = g_hash_table_insert (_repo.hash, GINT_TO_POINTER (myid), new);
+ ret = g_hash_table_insert (_repo.hash, GINT_TO_POINTER (nth), new);
g_assert (ret);
- _print_log ("Successfully added in hash table with key[%d]", myid);
+ _print_log ("Successfully added in hash table with key[%d]", nth);
_repo.num_data++;
GST_REPO_UNLOCK ();
* @brief push GstBuffer into repo
*/
gboolean
-gst_tensor_repo_push_buffer (guint nth, GstBuffer * buffer)
+gst_tensor_repo_set_buffer (guint nth, GstBuffer * buffer)
{
GST_TENSOR_REPO_LOCK (nth);
gboolean
gst_tensor_repo_check_eos (guint nth)
{
- GST_TENSOR_REPO_LOCK (nth);
GstTensorData *data = gst_tensor_repo_get_tensor (nth);
- GST_TENSOR_REPO_UNLOCK (nth);
+ if (data == NULL || data->eos) {
+ _print_log ("check eos done [%s]\n", data->eos ? "TRUE" : "FALSE");
+ }
return data->eos;
}
GST_TENSOR_REPO_LOCK (nth);
GstTensorData *data = gst_tensor_repo_get_tensor (nth);
data->eos = TRUE;
+ if (data->buffer)
+ gst_buffer_unref (data->buffer);
+
+ GST_TENSOR_REPO_SIGNAL (nth);
GST_TENSOR_REPO_UNLOCK (nth);
return data->eos;
}
/**
- * @brief pop GstTensorData from repo
+ * @brief get GstTensorData from repo
*/
GstBuffer *
-gst_tensor_repopop_buffer (guint nth)
+gst_tensor_repo_get_buffer (guint nth)
{
GstTensorData *current_data;
GstBuffer *buf;
+ gboolean eos = FALSE;
current_data = gst_tensor_repo_get_tensor (nth);
-
GST_TENSOR_REPO_LOCK (nth);
- while (!current_data->buffer)
+ while (!current_data->buffer) {
+ if (gst_tensor_repo_check_eos (nth)) {
+ eos = TRUE;
+ break;
+ }
GST_TENSOR_REPO_WAIT (nth);
- buf = gst_buffer_copy_deep (current_data->buffer);
- _print_log ("Popped [ %d ] (size: %lu)\n", nth, gst_buffer_get_size (buf));
+ }
+ if (eos) {
+ _print_log ("Get EOS Signal while waiting\n");
+ buf = NULL;
+ } else {
+ buf = gst_buffer_copy_deep (current_data->buffer);
+ _print_log ("Popped [ %d ] (size: %lu)\n", nth, gst_buffer_get_size (buf));
+ }
current_data->buffer = NULL;
GST_TENSOR_REPO_UNLOCK (nth);
-
return buf;
}
gst_tensor_repo_remove_data (guint nth)
{
gboolean ret;
+ printf ("removeing .... \n");
GST_REPO_LOCK ();
g_mutex_clear (GST_TENSOR_REPO_GET_LOCK (nth));
g_cond_clear (GST_TENSOR_REPO_GET_COND (nth));
* @brief push GstBuffer into repo
*/
gboolean
-gst_tensor_repo_push_buffer (guint nth, GstBuffer * buffer);
+gst_tensor_repo_set_buffer (guint nth, GstBuffer * buffer);
/**
* @brief get EOS
gst_tensor_repo_set_eos(guint nth);
/**
- * @brief pop GstTensorData from repo
+ * @brief Get GstTensorData from repo
*/
GstBuffer *
-gst_tensor_repopop_buffer (guint nth);
+gst_tensor_repo_get_buffer (guint nth);
/**
* @brief remove nth GstTensorData from GstTensorRepo
+++ /dev/null
-ADD_LIBRARY(tensor_repopopOBJ OBJECT tensor_repopop.c )
+++ /dev/null
-ADD_LIBRARY(tensor_repopushOBJ OBJECT tensor_repopush.c)
--- /dev/null
+ADD_LIBRARY(tensor_reposinkOBJ OBJECT tensor_reposink.c)
*/
/**
- * SECTION: element-tensor_repopush
+ * SECTION: element-tensor_reposink
*
- * Push elemnt to handle tensor repo
+ * Set elemnt to handle tensor repo
*
- * @file tensor_repopush.c
+ * @file tensor_reposink.c
* @date 19 Nov 2018
* @brief GStreamer plugin to handle tensor repository
* @see https://github.com/nnsuite/nnstreamer
#include <config.h>
#endif
-#include "tensor_repopush.h"
+#include "tensor_reposink.h"
/**
* @brief tensor repository
extern GstTensorRepo _repo;
-GST_DEBUG_CATEGORY_STATIC (gst_tensor_repopush_debug);
-#define GST_CAT_DEFAULT gst_tensor_repopush_debug
+GST_DEBUG_CATEGORY_STATIC (gst_tensor_reposink_debug);
+#define GST_CAT_DEFAULT gst_tensor_reposink_debug
/**
- * @brief tensor_repopush properties
+ * @brief tensor_reposink properties
*/
enum
{
#define DEFAULT_INDEX 0
/**
- * @brief tensor_repopush sink template
+ * @brief tensor_reposink sink template
*/
static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_TENSOR_CAP_DEFAULT "; " GST_TENSORS_CAP_DEFAULT));
-static void gst_tensor_repopush_set_property (GObject * object, guint prop_id,
+static void gst_tensor_reposink_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
-static void gst_tensor_repopush_get_property (GObject * object, guint prop_id,
+static void gst_tensor_reposink_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
-static void gst_tensor_repopush_dispose (GObject * object);
+static void gst_tensor_reposink_dispose (GObject * object);
-static gboolean gst_tensor_repopush_start (GstBaseSink * sink);
-static gboolean gst_tensor_repopush_stop (GstBaseSink * sink);
-static gboolean gst_tensor_repopush_event (GstBaseSink * sink,
+static gboolean gst_tensor_reposink_start (GstBaseSink * sink);
+static gboolean gst_tensor_reposink_stop (GstBaseSink * sink);
+static gboolean gst_tensor_reposink_event (GstBaseSink * sink,
GstEvent * event);
-static gboolean gst_tensor_repopush_query (GstBaseSink * sink,
+static gboolean gst_tensor_reposink_query (GstBaseSink * sink,
GstQuery * query);
-static GstFlowReturn gst_tensor_repopush_render (GstBaseSink * sink,
+static GstFlowReturn gst_tensor_reposink_render (GstBaseSink * sink,
GstBuffer * buffer);
-static GstFlowReturn gst_tensor_repopush_render_list (GstBaseSink * sink,
+static GstFlowReturn gst_tensor_reposink_render_list (GstBaseSink * sink,
GstBufferList * buffer_list);
-static gboolean gst_tensor_repopush_set_caps (GstBaseSink * sink,
+static gboolean gst_tensor_reposink_set_caps (GstBaseSink * sink,
GstCaps * caps);
-static GstCaps *gst_tensor_repopush_get_caps (GstBaseSink * sink,
+static GstCaps *gst_tensor_reposink_get_caps (GstBaseSink * sink,
GstCaps * filter);
-#define gst_tensor_repopush_parent_class parent_class
-G_DEFINE_TYPE (GstTensorRepoPush, gst_tensor_repopush, GST_TYPE_BASE_SINK);
+#define gst_tensor_reposink_parent_class parent_class
+G_DEFINE_TYPE (GstTensorRepoSink, gst_tensor_reposink, GST_TYPE_BASE_SINK);
/**
- * @brief class initialization of tensor_repopush
+ * @brief class initialization of tensor_reposink
*/
static void
-gst_tensor_repopush_class_init (GstTensorRepoPushClass * klass)
+gst_tensor_reposink_class_init (GstTensorRepoSinkClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *element_class;
element_class = GST_ELEMENT_CLASS (klass);
basesink_class = GST_BASE_SINK_CLASS (klass);
- gobject_class->set_property = gst_tensor_repopush_set_property;
- gobject_class->get_property = gst_tensor_repopush_get_property;
- gobject_class->dispose = gst_tensor_repopush_dispose;
+ gobject_class->set_property = gst_tensor_reposink_set_property;
+ gobject_class->get_property = gst_tensor_reposink_get_property;
+ gobject_class->dispose = gst_tensor_reposink_dispose;
g_object_class_install_property (gobject_class, PROP_SIGNAL_RATE,
g_param_spec_uint ("signal-rate", "Signal rate",
DEFAULT_SILENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
gst_element_class_set_static_metadata (element_class,
- "TensorRepoPush",
- "Push/TensorRepo",
- "Push element to handle tensor repository",
+ "TensorRepoSink",
+ "Set/TensorRepo",
+ "Set element to handle tensor repository",
"Samsung Electronics Co., Ltd.");
gst_element_class_add_static_pad_template (element_class, &sink_template);
- basesink_class->start = GST_DEBUG_FUNCPTR (gst_tensor_repopush_start);
- basesink_class->stop = GST_DEBUG_FUNCPTR (gst_tensor_repopush_stop);
- basesink_class->event = GST_DEBUG_FUNCPTR (gst_tensor_repopush_event);
- basesink_class->query = GST_DEBUG_FUNCPTR (gst_tensor_repopush_query);
- basesink_class->render = GST_DEBUG_FUNCPTR (gst_tensor_repopush_render);
+ basesink_class->start = GST_DEBUG_FUNCPTR (gst_tensor_reposink_start);
+ basesink_class->stop = GST_DEBUG_FUNCPTR (gst_tensor_reposink_stop);
+ basesink_class->event = GST_DEBUG_FUNCPTR (gst_tensor_reposink_event);
+ basesink_class->query = GST_DEBUG_FUNCPTR (gst_tensor_reposink_query);
+ basesink_class->render = GST_DEBUG_FUNCPTR (gst_tensor_reposink_render);
basesink_class->render_list =
- GST_DEBUG_FUNCPTR (gst_tensor_repopush_render_list);
- basesink_class->set_caps = GST_DEBUG_FUNCPTR (gst_tensor_repopush_set_caps);
- basesink_class->get_caps = GST_DEBUG_FUNCPTR (gst_tensor_repopush_get_caps);
+ GST_DEBUG_FUNCPTR (gst_tensor_reposink_render_list);
+ basesink_class->set_caps = GST_DEBUG_FUNCPTR (gst_tensor_reposink_set_caps);
+ basesink_class->get_caps = GST_DEBUG_FUNCPTR (gst_tensor_reposink_get_caps);
}
/**
- * @brief initialization of tensor_repopush
+ * @brief initialization of tensor_reposink
*/
static void
-gst_tensor_repopush_init (GstTensorRepoPush * self)
+gst_tensor_reposink_init (GstTensorRepoSink * self)
{
GstBaseSink *basesink;
basesink = GST_BASE_SINK (self);
* @brief set property vmethod
*/
static void
-gst_tensor_repopush_set_property (GObject * object, guint prop_id,
+gst_tensor_reposink_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
- GstTensorRepoPush *self;
- self = GST_TENSOR_REPOPUSH (object);
+ GstTensorRepoSink *self;
+ self = GST_TENSOR_REPOSINK (object);
switch (prop_id) {
case PROP_SIGNAL_RATE:
* @brief get property vmethod
*/
static void
-gst_tensor_repopush_get_property (GObject * object, guint prop_id,
+gst_tensor_reposink_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec)
{
- GstTensorRepoPush *self;
- self = GST_TENSOR_REPOPUSH (object);
+ GstTensorRepoSink *self;
+ self = GST_TENSOR_REPOSINK (object);
switch (prop_id) {
case PROP_SIGNAL_RATE:
g_value_set_uint (value, self->signal_rate);
* @brief dispose vmethod implementation
*/
static void
-gst_tensor_repopush_dispose (GObject * object)
+gst_tensor_reposink_dispose (GObject * object)
{
- GstTensorRepoPush *self;
- self = GST_TENSOR_REPOPUSH (object);
+ GstTensorRepoSink *self;
+ self = GST_TENSOR_REPOSINK (object);
if (self->in_caps)
gst_caps_unref (self->in_caps);
* @brief start vmethod implementation
*/
static gboolean
-gst_tensor_repopush_start (GstBaseSink * sink)
+gst_tensor_reposink_start (GstBaseSink * sink)
{
return TRUE;
}
* @brief stop vmethod implementation
*/
static gboolean
-gst_tensor_repopush_stop (GstBaseSink * sink)
+gst_tensor_reposink_stop (GstBaseSink * sink)
{
return TRUE;
}
* GstBaseSink method implementation.
*/
static gboolean
-gst_tensor_repopush_event (GstBaseSink * sink, GstEvent * event)
+gst_tensor_reposink_event (GstBaseSink * sink, GstEvent * event)
{
- GstTensorRepoPush *self;
+ GstTensorRepoSink *self;
GstEventType type;
- self = GST_TENSOR_REPOPUSH (sink);
+ self = GST_TENSOR_REPOSINK (sink);
type = GST_EVENT_TYPE (event);
silent_debug ("received event %s", GST_EVENT_TYPE_NAME (event));
default:
break;
}
-
return GST_BASE_SINK_CLASS (parent_class)->event (sink, event);
}
* @brief query vmethod implementation
*/
static gboolean
-gst_tensor_repopush_query (GstBaseSink * sink, GstQuery * query)
+gst_tensor_reposink_query (GstBaseSink * sink, GstQuery * query)
{
+ GstTensorRepoSink *self;
GstQueryType type;
GstFormat format;
+ self = GST_TENSOR_REPOSINK (sink);
type = GST_QUERY_TYPE (query);
switch (type) {
case GST_QUERY_SEEKING:
- /** tensor sink does not support seeking */
gst_query_parse_seeking (query, &format, NULL, NULL, NULL);
gst_query_set_seeking (query, format, FALSE, 0, -1);
return TRUE;
/**
- * @brief push GstBuffer
+ * @brief Push GstBuffer
*/
static void
-gst_tensor_repopush_render_buffer (GstTensorRepoPush * self, GstBuffer * buffer)
+gst_tensor_reposink_render_buffer (GstTensorRepoSink * self, GstBuffer * buffer)
{
GstClockTime now = GST_CLOCK_TIME_NONE;
guint signal_rate;
gboolean notify = FALSE;
- g_return_if_fail (GST_IS_TENSOR_REPOPUSH (self));
+ g_return_if_fail (GST_IS_TENSOR_REPOSINK (self));
signal_rate = self->signal_rate;
if (notify) {
gboolean ret = FALSE;
self->last_render_time = now;
- ret = gst_tensor_repo_push_buffer (self->myid, buffer);
+ ret = gst_tensor_repo_set_buffer (self->myid, buffer);
if (!ret)
GST_ELEMENT_ERROR (self, RESOURCE, WRITE,
- ("Cannot push buffer into repo [key: %d]", self->myid), NULL);
+ ("Cannot Set buffer into repo [key: %d]", self->myid), NULL);
}
}
* @brief render vmethod implementation
*/
static GstFlowReturn
-gst_tensor_repopush_render (GstBaseSink * sink, GstBuffer * buffer)
+gst_tensor_reposink_render (GstBaseSink * sink, GstBuffer * buffer)
{
- GstTensorRepoPush *self;
- self = GST_TENSOR_REPOPUSH (sink);
+ GstTensorRepoSink *self;
+ self = GST_TENSOR_REPOSINK (sink);
- gst_tensor_repopush_render_buffer (self, buffer);
+ gst_tensor_reposink_render_buffer (self, buffer);
return GST_FLOW_OK;
}
* @brief render list vmethod implementation
*/
static GstFlowReturn
-gst_tensor_repopush_render_list (GstBaseSink * sink,
+gst_tensor_reposink_render_list (GstBaseSink * sink,
GstBufferList * buffer_list)
{
- GstTensorRepoPush *self;
+ GstTensorRepoSink *self;
GstBuffer *buffer;
guint i;
guint num_buffers;
- self = GST_TENSOR_REPOPUSH (sink);
+ self = GST_TENSOR_REPOSINK (sink);
num_buffers = gst_buffer_list_length (buffer_list);
for (i = 0; i < num_buffers; i++) {
buffer = gst_buffer_list_get (buffer_list, i);
- gst_tensor_repopush_render_buffer (self, buffer);
+ gst_tensor_reposink_render_buffer (self, buffer);
}
return GST_FLOW_OK;
* @brief set_caps vmethod implementation
*/
static gboolean
-gst_tensor_repopush_set_caps (GstBaseSink * sink, GstCaps * caps)
+gst_tensor_reposink_set_caps (GstBaseSink * sink, GstCaps * caps)
{
- GstTensorRepoPush *self;
+ GstTensorRepoSink *self;
- self = GST_TENSOR_REPOPUSH (sink);
+ self = GST_TENSOR_REPOSINK (sink);
gst_caps_replace (&self->in_caps, caps);
return TRUE;
* @brief get_caps vmethod implementation
*/
static GstCaps *
-gst_tensor_repopush_get_caps (GstBaseSink * sink, GstCaps * filter)
+gst_tensor_reposink_get_caps (GstBaseSink * sink, GstCaps * filter)
{
- GstTensorRepoPush *self;
+ GstTensorRepoSink *self;
GstCaps *caps;
- self = GST_TENSOR_REPOPUSH (sink);
+ self = GST_TENSOR_REPOSINK (sink);
caps = self->in_caps;
*
* See GstPluginInitFunc() for more details.
*/
-NNSTREAMER_PLUGIN_INIT (tensor_repopush)
+NNSTREAMER_PLUGIN_INIT (tensor_reposink)
{
- GST_DEBUG_CATEGORY_INIT (gst_tensor_repopush_debug, "tensor_repopush",
- 0, "tensor_repopush element");
+ GST_DEBUG_CATEGORY_INIT (gst_tensor_reposink_debug, "tensor_reposink",
+ 0, "tensor_reposink element");
- return gst_element_register (plugin, "tensor_repopush",
- GST_RANK_NONE, GST_TYPE_TENSOR_REPOPUSH);
+ return gst_element_register (plugin, "tensor_reposink",
+ GST_RANK_NONE, GST_TYPE_TENSOR_REPOSINK);
}
*/
/**
- * @file tensor_repopush.h
+ * @file tensor_reposink.h
* @date 19 Nov 2018
* @brief GStreamer plugin to handle tensor repository
* @see https://github.com/nnsuite/nnstreamer
* @bug No known bugs except for NYI items
*/
-#ifndef __GST_TENSOR_REPOPUSH_H_
-#define __GST_TENSOR_REPOPUSH_H__
+#ifndef __GST_TENSOR_REPOSINK_H_
+#define __GST_TENSOR_REPOSINK_H__
#include <gst/gst.h>
#include <gst/base/gstbasesink.h>
G_BEGIN_DECLS
-#define GST_TYPE_TENSOR_REPOPUSH \
- (gst_tensor_repopush_get_type())
-#define GST_TENSOR_REPOPUSH(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_TENSOR_REPOPUSH,GstTensorRepoPush))
-#define GST_TENSOR_REPOPUSH_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_TENSOR_REPOPUSH,GstTensorRepoPushClass))
-#define GST_IS_TENSOR_REPOPUSH(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_TENSOR_REPOPUSH))
-#define GST_IS_TENSOR_REPOPUSH_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_TENSOR_REPOPUSH))
-typedef struct _GstTensorRepoPush GstTensorRepoPush;
-typedef struct _GstTensorRepoPushClass GstTensorRepoPushClass;
+#define GST_TYPE_TENSOR_REPOSINK \
+ (gst_tensor_reposink_get_type())
+#define GST_TENSOR_REPOSINK(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_TENSOR_REPOSINK,GstTensorRepoSink))
+#define GST_TENSOR_REPOSINK_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_TENSOR_REPOSINK,GstTensorRepoSinkClass))
+#define GST_IS_TENSOR_REPOSINK(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_TENSOR_REPOSINK))
+#define GST_IS_TENSOR_REPOSINK_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_TENSOR_REPOSINK))
+typedef struct _GstTensorRepoSink GstTensorRepoSink;
+typedef struct _GstTensorRepoSinkClass GstTensorRepoSinkClass;
/**
- * @brief GstTensorRepoPush data structure.
+ * @brief GstTensorRepoSink data structure.
*
- * GstTensorRepoPush inherits GstBaseSink.
+ * GstTensorRepoSink inherits GstBaseSink.
*/
-struct _GstTensorRepoPush
+struct _GstTensorRepoSink
{
GstBaseSink element;
};
/**
- * @brief GstTensorRepoPushClass data structure.
+ * @brief GstTensorRepoSinkClass data structure.
*
- * GstTensorRepoPush inherits GstBaseSink.
+ * GstTensorRepoSink inherits GstBaseSink.
*/
-struct _GstTensorRepoPushClass
+struct _GstTensorRepoSinkClass
{
GstBaseSinkClass parent_class;
};
/**
- * @brief Function to get type of tensor_repopush.
+ * @brief Function to get type of tensor_reposink.
*/
-GType gst_tensor_repopush_get_type (void);
+GType gst_tensor_reposink_get_type (void);
G_END_DECLS
-#endif /** __GST_TENSOR_REPOPUSH_H__ */
+#endif /** __GST_TENSOR_REPOSINK_H__ */
--- /dev/null
+ADD_LIBRARY(tensor_reposrcOBJ OBJECT tensor_reposrc.c )
*/
/**
- * SECTION: element-tensor_repopop
+ * SECTION: element-tensor_reposrc
*
* Pop elemnt to handle tensor repo
*
- * @file tensor_repopop.c
+ * @file tensor_reposrc.c
* @date 19 Nov 2018
* @brief GStreamer plugin to handle tensor repository
* @see https://github.com/nnsuite/nnstreamer
#include <config.h>
#endif
-#include "tensor_repopop.h"
+#include "tensor_reposrc.h"
/**
* @brief Macro for debug mode.
#define silent_debug(...) \
debug_print (DBG, __VA_ARGS__)
-GST_DEBUG_CATEGORY_STATIC (gst_tensor_repopop_debug);
-#define GST_CAT_DEFAULT gst_tensor_repopop_debug
+GST_DEBUG_CATEGORY_STATIC (gst_tensor_reposrc_debug);
+#define GST_CAT_DEFAULT gst_tensor_reposrc_debug
/**
- * @brief tensor_repopop properties
+ * @brief tensor_reposrc properties
*/
enum
{
extern GstTensorRepo _repo;
/**
- * @brief tensor_repopop src template
+ * @brief tensor_reposrc src template
*/
static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_TENSOR_CAP_DEFAULT "; " GST_TENSORS_CAP_DEFAULT));
-static void gst_tensor_repopop_set_property (GObject * object, guint prop_id,
+static void gst_tensor_reposrc_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
-static void gst_tensor_repopop_get_property (GObject * object, guint prop_id,
+static void gst_tensor_reposrc_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
-static void gst_tensor_repopop_dispose (GObject * object);
-static GstCaps *gst_tensor_repopop_getcaps (GstBaseSrc * src, GstCaps * filter);
-static GstFlowReturn gst_tensor_repopop_create (GstPushSrc * src,
+static void gst_tensor_reposrc_dispose (GObject * object);
+static GstCaps *gst_tensor_reposrc_getcaps (GstBaseSrc * src, GstCaps * filter);
+static GstFlowReturn gst_tensor_reposrc_create (GstPushSrc * src,
GstBuffer ** buffer);
-#define gst_tensor_repopop_parent_class parent_class
-G_DEFINE_TYPE (GstTensorRepoPop, gst_tensor_repopop, GST_TYPE_PUSH_SRC);
+#define gst_tensor_reposrc_parent_class parent_class
+G_DEFINE_TYPE (GstTensorRepoSrc, gst_tensor_reposrc, GST_TYPE_PUSH_SRC);
/**
- * @brief class initialization of tensor_repopop
+ * @brief class initialization of tensor_reposrc
*/
static void
-gst_tensor_repopop_class_init (GstTensorRepoPopClass * klass)
+gst_tensor_reposrc_class_init (GstTensorRepoSrcClass * klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
GstPushSrcClass *pushsrc_class = GST_PUSH_SRC_CLASS (klass);
GstBaseSrcClass *basesrc_class = GST_BASE_SRC_CLASS (klass);
- gobject_class->set_property = gst_tensor_repopop_set_property;
- gobject_class->get_property = gst_tensor_repopop_get_property;
+ gobject_class->set_property = gst_tensor_reposrc_set_property;
+ gobject_class->get_property = gst_tensor_reposrc_get_property;
g_object_class_install_property (gobject_class, PROP_CAPS,
g_param_spec_boxed ("caps", "Caps",
0, UINT_MAX, DEFAULT_INDEX,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- gobject_class->dispose = gst_tensor_repopop_dispose;
+ gobject_class->dispose = gst_tensor_reposrc_dispose;
- basesrc_class->get_caps = gst_tensor_repopop_getcaps;
- pushsrc_class->create = gst_tensor_repopop_create;
+ basesrc_class->get_caps = gst_tensor_reposrc_getcaps;
+ pushsrc_class->create = gst_tensor_reposrc_create;
gst_element_class_set_static_metadata (element_class,
- "TensorRepoPop",
+ "TensorRepoSrc",
"Pop/TensorRepo",
"Pop element to handle tensor repository",
"Samsung Electronics Co., Ltd.");
}
/**
- * @brief object initialization of tensor_repopop
+ * @brief object initialization of tensor_reposrc
*/
static void
-gst_tensor_repopop_init (GstTensorRepoPop * self)
+gst_tensor_reposrc_init (GstTensorRepoSrc * self)
{
self->silent = TRUE;
self->ini = FALSE;
}
/**
- * @brief object dispose of tensor_repopop
+ * @brief object dispose of tensor_reposrc
*/
static void
-gst_tensor_repopop_dispose (GObject * object)
+gst_tensor_reposrc_dispose (GObject * object)
{
gboolean ret;
- GstTensorRepoPop *self = GST_TENSOR_REPOPOP (object);
+ GstTensorRepoSrc *self = GST_TENSOR_REPOSRC (object);
ret = gst_tensor_repo_remove_data (self->myid);
if (!ret)
}
/**
- * @brief get cap of tensor_repopop
+ * @brief get cap of tensor_reposrc
*/
static GstCaps *
-gst_tensor_repopop_getcaps (GstBaseSrc * src, GstCaps * filter)
+gst_tensor_reposrc_getcaps (GstBaseSrc * src, GstCaps * filter)
{
GstCaps *cap;
- GstTensorRepoPop *self = GST_TENSOR_REPOPOP (src);
+ GstTensorRepoSrc *self = GST_TENSOR_REPOSRC (src);
GST_DEBUG_OBJECT (self, "returning %" GST_PTR_FORMAT, self->caps);
}
/**
- * @brief set property of tensor_repopop
+ * @brief set property of tensor_reposrc
*/
static void
-gst_tensor_repopop_set_property (GObject * object, guint prop_id,
+gst_tensor_reposrc_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
- GstTensorRepoPop *self = GST_TENSOR_REPOPOP (object);
+ GstTensorRepoSrc *self = GST_TENSOR_REPOSRC (object);
switch (prop_id) {
case PROP_SILENT:
}
/**
- * @brief get property of tensor_repopop
+ * @brief get property of tensor_reposrc
*/
static void
-gst_tensor_repopop_get_property (GObject * object, guint prop_id,
+gst_tensor_reposrc_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec)
{
- GstTensorRepoPop *self = GST_TENSOR_REPOPOP (object);
+ GstTensorRepoSrc *self = GST_TENSOR_REPOSRC (object);
switch (prop_id) {
case PROP_SILENT:
}
/**
- * @brief create func of tensor_repopop
+ * @brief create func of tensor_reposrc
*/
static GstFlowReturn
-gst_tensor_repopop_create (GstPushSrc * src, GstBuffer ** buffer)
+gst_tensor_reposrc_create (GstPushSrc * src, GstBuffer ** buffer)
{
- GstTensorRepoPop *self;
- GstBuffer *buf;
-
- self = GST_TENSOR_REPOPOP (src);
+ GstTensorRepoSrc *self;
+ GstBuffer *buf = NULL;
+ self = GST_TENSOR_REPOSRC (src);
gst_tensor_repo_wait ();
-
- if (gst_tensor_repo_check_eos (self->myid))
+ if (gst_tensor_repo_check_eos (self->myid)) {
return GST_FLOW_EOS;
+ }
if (!self->ini) {
int i;
gst_buffer_memset (buf, 0, 0, size);
self->ini = TRUE;
} else {
- buf = gst_tensor_repopop_buffer (self->myid);
+ buf = gst_tensor_repo_get_buffer (self->myid);
+ if (buf == NULL)
+ return GST_FLOW_EOS;
}
*buffer = buf;
*
* See GstPluginInitFunc() for more details.
*/
-NNSTREAMER_PLUGIN_INIT (tensor_repopop)
+NNSTREAMER_PLUGIN_INIT (tensor_reposrc)
{
- GST_DEBUG_CATEGORY_INIT (gst_tensor_repopop_debug, "tensor_repopop",
- 0, "tensor_repopop element");
+ GST_DEBUG_CATEGORY_INIT (gst_tensor_reposrc_debug, "tensor_reposrc",
+ 0, "tensor_reposrc element");
- return gst_element_register (plugin, "tensor_repopop",
- GST_RANK_NONE, GST_TYPE_TENSOR_REPOPOP);
+ return gst_element_register (plugin, "tensor_reposrc",
+ GST_RANK_NONE, GST_TYPE_TENSOR_REPOSRC);
}
*/
/**
- * @file tensor_repopop.h
+ * @file tensor_reposrc.h
* @date 19 Nov 2018
* @brief GStreamer plugin to handle tensor repository
* @see https://github.com/nnsuite/nnstreamer
* @bug No known bugs except for NYI items
*/
-#ifndef __GST_TENSOR_REPOPOP_H_
-#define __GST_TENSOR_REPOPOP_H__
+#ifndef __GST_TENSOR_REPOSRC_H_
+#define __GST_TENSOR_REPOSRC_H__
#include <gst/gst.h>
#include <gst/base/gstpushsrc.h>
#include <tensor_repo.h>
G_BEGIN_DECLS
-#define GST_TYPE_TENSOR_REPOPOP \
- (gst_tensor_repopop_get_type())
-#define GST_TENSOR_REPOPOP(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_TENSOR_REPOPOP,GstTensorRepoPop))
-#define GST_TENSOR_REPOPOP_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_TENSOR_REPOPOP,GstTensorRepoPopClass))
-#define GST_IS_TENSOR_REPOPOP(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_TENSOR_REPOPOP))
-#define GST_IS_TENSOR_REPOPOP_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_TENSOR_REPOPOP))
-typedef struct _GstTensorRepoPop GstTensorRepoPop;
-typedef struct _GstTensorRepoPopClass GstTensorRepoPopClass;
+#define GST_TYPE_TENSOR_REPOSRC \
+ (gst_tensor_reposrc_get_type())
+#define GST_TENSOR_REPOSRC(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_TENSOR_REPOSRC,GstTensorRepoSrc))
+#define GST_TENSOR_REPOSRC_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_TENSOR_REPOSRC,GstTensorRepoSrcClass))
+#define GST_IS_TENSOR_REPOSRC(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_TENSOR_REPOSRC))
+#define GST_IS_TENSOR_REPOSRC_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_TENSOR_REPOSRC))
+typedef struct _GstTensorRepoSrc GstTensorRepoSrc;
+typedef struct _GstTensorRepoSrcClass GstTensorRepoSrcClass;
/**
- * @brief GstTensorRepoPop data structure.
+ * @brief GstTensorRepoSrc data structure.
*
- * GstTensorRepoPop inherits GstBaseSink.
+ * GstTensorRepoSrc inherits GstBaseSink.
*/
-struct _GstTensorRepoPop
+struct _GstTensorRepoSrc
{
GstPushSrc parent;
GstBaseSink element;
};
/**
- * @brief GstTensorRepoPopClass data structure.
+ * @brief GstTensorRepoSrcClass data structure.
*
- * GstTensorRepoPop inherits GstBaseSink.
+ * GstTensorRepoSrc inherits GstBaseSink.
*/
-struct _GstTensorRepoPopClass
+struct _GstTensorRepoSrcClass
{
GstPushSrcClass parent_class;
};
/**
- * @brief Function to get type of tensor_repopop.
+ * @brief Function to get type of tensor_reposrc.
*/
-GType gst_tensor_repopop_get_type (void);
+GType gst_tensor_reposrc_get_type (void);
G_END_DECLS
-#endif /** __GST_TENSOR_REPOPOP_H__ */
+#endif /** __GST_TENSOR_REPOSRC_H__ */