tensor-repo is not a common header and can be built only in repo directory.
Move files about tensor-repo into tensor_repo directory and clean up sources.
Signed-off-by: Jaeyun Jung <jy1210.jung@samsung.com>
'nnstreamer.c',
'nnstreamer_conf.c',
'nnstreamer_subplugin.c',
- 'tensor_common.c',
- 'tensor_repo.c'
+ 'tensor_common.c'
]
foreach s : nnst_common_sources
'tensor_split',
'tensor_transform',
'tensor_filter',
- 'tensor_reposrc',
- 'tensor_reposink'
+ 'tensor_repo'
]
foreach p : nnst_plugins
#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_repo/tensor_reposink.h"
+#include "tensor_repo/tensor_reposrc.h"
#include "tensor_sink/tensor_sink.h"
#include "tensor_source/tensor_src_iio.h"
#include "tensor_split/gsttensorsplit.h"
-tensor_reposrc_sources = [
+tensor_repo_sources = [
+ 'tensor_repo.c',
+ 'tensor_reposink.c',
'tensor_reposrc.c'
]
-foreach s : tensor_reposrc_sources
+foreach s : tensor_repo_sources
nnstreamer_sources += join_paths(meson.current_source_dir(), s)
endforeach
static GstCaps *gst_tensor_reposink_get_caps (GstBaseSink * sink,
GstCaps * filter);
-
#define gst_tensor_reposink_parent_class parent_class
G_DEFINE_TYPE (GstTensorRepoSink, gst_tensor_reposink, GST_TYPE_BASE_SINK);
gst_tensor_reposink_init (GstTensorRepoSink * self)
{
GstBaseSink *basesink;
+
basesink = GST_BASE_SINK (self);
gst_tensor_repo_init ();
const GValue * value, GParamSpec * pspec)
{
GstTensorRepoSink *self;
+
self = GST_TENSOR_REPOSINK (object);
switch (prop_id) {
case PROP_SLOT:
self->o_myid = self->myid;
self->myid = g_value_get_uint (value);
+
gst_tensor_repo_add_repodata (self->myid, TRUE);
+
if (!self->set_startid) {
self->o_myid = self->myid;
self->set_startid = TRUE;
}
+
if (self->o_myid != self->myid)
gst_tensor_repo_set_changed (self->o_myid, self->myid, TRUE);
-
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
GValue * value, GParamSpec * pspec)
{
GstTensorRepoSink *self;
+
self = GST_TENSOR_REPOSINK (object);
+
switch (prop_id) {
case PROP_SIGNAL_RATE:
g_value_set_uint (value, self->signal_rate);
gst_tensor_reposink_dispose (GObject * object)
{
GstTensorRepoSink *self;
+
self = GST_TENSOR_REPOSINK (object);
+
if (self->in_caps)
gst_caps_unref (self->in_caps);
case GST_EVENT_EOS:
gst_tensor_repo_set_eos (self->myid);
break;
-
default:
break;
}
+
return GST_BASE_SINK_CLASS (parent_class)->event (sink, event);
}
type = GST_QUERY_TYPE (query);
GST_DEBUG_OBJECT (self, "received query %s", GST_QUERY_TYPE_NAME (query));
+
switch (type) {
case GST_QUERY_SEEKING:
gst_query_parse_seeking (query, &format, NULL, NULL, NULL);
gst_query_set_seeking (query, format, FALSE, 0, -1);
return TRUE;
-
default:
break;
}
return GST_BASE_SINK_CLASS (parent_class)->query (sink, query);
}
-
/**
* @brief Push GstBuffer
*/
if (signal_rate) {
GstClock *clock;
GstClockTime render_time;
+
clock = gst_element_get_clock (GST_ELEMENT (self));
if (clock) {
now = gst_clock_get_time (clock);
render_time = (1000 / signal_rate) * GST_MSECOND + self->last_render_time;
+
if (!GST_CLOCK_TIME_IS_VALID (self->last_render_time) ||
- GST_CLOCK_DIFF (now, render_time) <= 0)
+ GST_CLOCK_DIFF (now, render_time) <= 0) {
notify = TRUE;
+ }
+
gst_object_unref (clock);
}
} else {
}
if (notify) {
- gboolean ret = FALSE;
self->last_render_time = now;
- ret =
- gst_tensor_repo_set_buffer (self->myid, self->o_myid, buffer,
- self->in_caps);
- if (!ret)
+
+ if (!gst_tensor_repo_set_buffer (self->myid, self->o_myid, buffer,
+ self->in_caps)) {
GST_ELEMENT_ERROR (self, RESOURCE, WRITE,
("Cannot Set buffer into repo [key: %d]", self->myid), NULL);
+ }
}
}
gst_tensor_reposink_render (GstBaseSink * sink, GstBuffer * buffer)
{
GstTensorRepoSink *self;
- self = GST_TENSOR_REPOSINK (sink);
+ self = GST_TENSOR_REPOSINK (sink);
gst_tensor_reposink_render_buffer (self, buffer);
return GST_FLOW_OK;
self = GST_TENSOR_REPOSINK (sink);
gst_caps_replace (&self->in_caps, caps);
+ /* debug print caps */
if (!self->silent) {
+ GstStructure *structure;
+ gchar *str;
guint caps_size, i;
caps_size = gst_caps_get_size (caps);
GST_DEBUG_OBJECT (self, "set caps, size is %d", caps_size);
for (i = 0; i < caps_size; i++) {
- GstStructure *structure = gst_caps_get_structure (caps, i);
- gchar *str = gst_structure_to_string (structure);
+ structure = gst_caps_get_structure (caps, i);
+ str = gst_structure_to_string (structure);
GST_DEBUG_OBJECT (self, "[%d] %s", i, str);
g_free (str);
gobject_class->set_property = gst_tensor_reposrc_set_property;
gobject_class->get_property = gst_tensor_reposrc_get_property;
+ gobject_class->dispose = gst_tensor_reposrc_dispose;
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_reposrc_dispose;
-
basesrc_class->get_caps = gst_tensor_reposrc_getcaps;
pushsrc_class->create = gst_tensor_reposrc_create;
static void
gst_tensor_reposrc_dispose (GObject * object)
{
- gboolean ret;
GstTensorRepoSrc *self = GST_TENSOR_REPOSRC (object);
- ret = gst_tensor_repo_remove_repodata (self->myid);
- if (!ret)
+ if (!gst_tensor_repo_remove_repodata (self->myid))
GST_ELEMENT_ERROR (self, RESOURCE, WRITE,
("Cannot remove [key: %d] in repo", self->myid), NULL);
static GstCaps *
gst_tensor_reposrc_getcaps (GstBaseSrc * src, GstCaps * filter)
{
- GstCaps *cap, *check, *result;
GstTensorRepoSrc *self = GST_TENSOR_REPOSRC (src);
+ GstCaps *cap, *check, *result;
GstStructure *st = NULL;
GST_DEBUG_OBJECT (self, "returning %" GST_PTR_FORMAT, self->caps);
if (self->caps) {
if (filter) {
- cap =
- gst_caps_intersect_full (filter, self->caps,
+ cap = gst_caps_intersect_full (filter, self->caps,
GST_CAPS_INTERSECT_FIRST);
} else
cap = gst_caps_ref (self->caps);
gst_tensor_reposrc_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
-
GstTensorRepoSrc *self = GST_TENSOR_REPOSRC (object);
switch (prop_id) {
self->o_myid = self->myid;
self->set_startid = TRUE;
}
+
if (self->o_myid != self->myid)
gst_tensor_repo_set_changed (self->o_myid, self->myid, FALSE);
-
break;
case PROP_CAPS:
{
self->fps_d = -1;
}
self->negotiation = FALSE;
- }
break;
+ }
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
gst_tensor_reposrc_gen_dummy_buffer (GstTensorRepoSrc * self)
{
GstBuffer *buf = NULL;
- int i;
- guint num_tensors = self->config.info.num_tensors;
+ GstMemory *mem;
+ GstMapInfo info;
+ guint i, num_tensors;
gsize size = 0;
+
buf = gst_buffer_new ();
+ num_tensors = self->config.info.num_tensors;
+
for (i = 0; i < num_tensors; i++) {
- GstMemory *mem;
- GstMapInfo info;
size = gst_tensor_info_get_size (&self->config.info.info[i]);
mem = gst_allocator_alloc (NULL, size, NULL);
+
gst_memory_map (mem, &info, GST_MAP_WRITE);
memset (info.data, 0, size);
gst_memory_unmap (mem, &info);
+
gst_buffer_append_memory (buf, mem);
}
+
return buf;
}
while (!buf && !eos) {
buf = gst_tensor_repo_get_buffer (self->myid, self->o_myid, &eos, &newid);
}
+
if (eos)
return GST_FLOW_EOS;
if (!gst_caps_can_intersect (self->caps, meta->caps)) {
GST_ELEMENT_ERROR (GST_ELEMENT (self), CORE, NEGOTIATION,
("Negotiation Failed! : repo_sink & repos_src"), (NULL));
+
if (!gst_buffer_remove_meta (buf, (GstMeta *) meta)) {
GST_ELEMENT_ERROR (GST_ELEMENT (self), RESOURCE, WRITE,
("Cannot remove meta from buffer!"), (NULL));
}
+
gst_buffer_unref (buf);
gst_tensor_repo_set_eos (self->myid);
return GST_FLOW_EOS;
}
self->negotiation = TRUE;
-
}
+
gst_buffer_remove_meta (buf, (GstMeta *) meta);
}
*buffer = buf;
-
return GST_FLOW_OK;
}
+++ /dev/null
-tensor_reposink_sources = [
- 'tensor_reposink.c'
-]
-
-foreach s : tensor_reposink_sources
- nnstreamer_sources += join_paths(meson.current_source_dir(), s)
-endforeach
$(NNSTREAMER_GST_HOME)/nnstreamer.c \
$(NNSTREAMER_GST_HOME)/nnstreamer_conf.c \
$(NNSTREAMER_GST_HOME)/nnstreamer_subplugin.c \
- $(NNSTREAMER_GST_HOME)/tensor_common.c \
- $(NNSTREAMER_GST_HOME)/tensor_repo.c
+ $(NNSTREAMER_GST_HOME)/tensor_common.c
# nnstreamer plugins
NNSTREAMER_PLUGINS_SRCS := \
$(NNSTREAMER_GST_HOME)/tensor_filter/tensor_filter_custom.c \
$(NNSTREAMER_GST_HOME)/tensor_merge/gsttensormerge.c \
$(NNSTREAMER_GST_HOME)/tensor_mux/gsttensormux.c \
- $(NNSTREAMER_GST_HOME)/tensor_reposink/tensor_reposink.c \
- $(NNSTREAMER_GST_HOME)/tensor_reposrc/tensor_reposrc.c \
+ $(NNSTREAMER_GST_HOME)/tensor_repo/tensor_repo.c \
+ $(NNSTREAMER_GST_HOME)/tensor_repo/tensor_reposink.c \
+ $(NNSTREAMER_GST_HOME)/tensor_repo/tensor_reposrc.c \
$(NNSTREAMER_GST_HOME)/tensor_sink/tensor_sink.c \
$(NNSTREAMER_GST_HOME)/tensor_source/tensor_src_iio.c \
$(NNSTREAMER_GST_HOME)/tensor_split/gsttensorsplit.c \