Doxygen Book
edge_sink.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: LGPL-2.1-only */
13 #ifdef HAVE_CONFIG_H
14 #include <config.h>
15 #endif
16 
17 #include "edge_sink.h"
18 
19 GST_DEBUG_CATEGORY_STATIC (gst_edgesink_debug);
20 #define GST_CAT_DEFAULT gst_edgesink_debug
21 
25 static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
26  GST_PAD_SINK,
27  GST_PAD_ALWAYS,
28  GST_STATIC_CAPS_ANY);
29 
33 enum
34 {
36 
46 
48 };
49 #define DEFAULT_MQTT_HOST "127.0.0.1"
50 #define DEFAULT_MQTT_PORT 1883
51 
52 #define gst_edgesink_parent_class parent_class
53 G_DEFINE_TYPE (GstEdgeSink, gst_edgesink, GST_TYPE_BASE_SINK);
54 
55 static void gst_edgesink_set_property (GObject * object,
56  guint prop_id, const GValue * value, GParamSpec * pspec);
57 
58 static void gst_edgesink_get_property (GObject * object,
59  guint prop_id, GValue * value, GParamSpec * pspec);
60 
61 static void gst_edgesink_finalize (GObject * object);
62 
63 static gboolean gst_edgesink_start (GstBaseSink * basesink);
64 static gboolean gst_edgesink_stop (GstBaseSink * basesink);
65 static GstFlowReturn gst_edgesink_render (GstBaseSink * basesink,
66  GstBuffer * buffer);
67 static gboolean gst_edgesink_set_caps (GstBaseSink * basesink, GstCaps * caps);
68 
69 static gchar *gst_edgesink_get_host (GstEdgeSink * self);
70 static void gst_edgesink_set_host (GstEdgeSink * self, const gchar * host);
71 
72 static guint16 gst_edgesink_get_port (GstEdgeSink * self);
73 static void gst_edgesink_set_port (GstEdgeSink * self, const guint16 port);
74 
75 static nns_edge_connect_type_e gst_edgesink_get_connect_type (GstEdgeSink *
76  self);
77 static void gst_edgesink_set_connect_type (GstEdgeSink * self,
78  const nns_edge_connect_type_e connect_type);
79 
83 static void
85 {
86  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
87  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
88  GstBaseSinkClass *gstbasesink_class = GST_BASE_SINK_CLASS (klass);
89 
90  gobject_class->set_property = gst_edgesink_set_property;
91  gobject_class->get_property = gst_edgesink_get_property;
92  gobject_class->finalize = gst_edgesink_finalize;
93 
94  g_object_class_install_property (gobject_class, PROP_HOST,
95  g_param_spec_string ("host", "Host",
96  "A self host address to accept connection from edgesrc", DEFAULT_HOST,
97  G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
98  g_object_class_install_property (gobject_class, PROP_PORT,
99  g_param_spec_uint ("port", "Port",
100  "A self port address to accept connection from edgesrc. "
101  "If the port is set to 0 then the available port is allocated. ",
102  0, 65535, DEFAULT_PORT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
103  g_object_class_install_property (gobject_class, PROP_CONNECT_TYPE,
104  g_param_spec_enum ("connect-type", "Connect Type",
105  "The connections type between edgesink and edgesrc.",
107  G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
108  g_object_class_install_property (gobject_class, PROP_DEST_HOST,
109  g_param_spec_string ("dest-host", "Destination Host",
110  "The destination hostname of the broker", DEFAULT_MQTT_HOST,
111  G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
112  g_object_class_install_property (gobject_class, PROP_DEST_PORT,
113  g_param_spec_uint ("dest-port", "Destination Port",
114  "The destination port of the broker", 0,
115  65535, DEFAULT_MQTT_PORT,
116  G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
117  g_object_class_install_property (gobject_class, PROP_TOPIC,
118  g_param_spec_string ("topic", "Topic",
119  "The main topic of the host and option if necessary. "
120  "(topic)/(optional topic for main topic).", "",
121  G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
122  g_object_class_install_property (gobject_class, PROP_WAIT_CONNECTION,
123  g_param_spec_boolean ("wait-connection", "Wait connection to edgesrc",
124  "Wait until edgesink is connected to edgesrc. "
125  "In case of false(default), the buffers entering the edgesink are dropped.",
126  FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
127  g_object_class_install_property (gobject_class, PROP_CONNECTION_TIMEOUT,
128  g_param_spec_uint64 ("connection-timeout",
129  "Timeout for waiting a connection",
130  "The timeout (in milliseconds) for waiting a connection to receiver. "
131  "0 timeout (default) means infinite wait.", 0, G_MAXUINT64, 0,
132  G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
133  g_object_class_install_property (gobject_class, PROP_CUSTOM_LIB,
134  g_param_spec_string ("custom-lib", "Custom connection lib path",
135  "User defined custom connection lib path.",
136  "", G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
137 
138  gst_element_class_add_pad_template (gstelement_class,
139  gst_static_pad_template_get (&sinktemplate));
140 
141  gst_element_class_set_static_metadata (gstelement_class,
142  "EdgeSink", "Sink/Edge",
143  "Publish incoming streams", "Samsung Electronics Co., Ltd.");
144 
145  gstbasesink_class->start = gst_edgesink_start;
146  gstbasesink_class->stop = gst_edgesink_stop;
147  gstbasesink_class->render = gst_edgesink_render;
148  gstbasesink_class->set_caps = gst_edgesink_set_caps;
149 
150  GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT,
151  GST_EDGE_ELEM_NAME_SINK, 0, "Edge sink");
152 }
153 
157 static void
159 {
160  self->host = g_strdup (DEFAULT_HOST);
161  self->port = DEFAULT_PORT;
162  self->dest_host = g_strdup (DEFAULT_HOST);
163  self->dest_port = DEFAULT_PORT;
164  self->topic = NULL;
165  self->connect_type = DEFAULT_CONNECT_TYPE;
166  self->wait_connection = FALSE;
167  self->connection_timeout = 0;
168  self->custom_lib = NULL;
169  self->is_connected = FALSE;
170  g_mutex_init (&self->lock);
171  g_cond_init (&self->cond);
172 }
173 
177 static void
178 gst_edgesink_set_property (GObject * object, guint prop_id,
179  const GValue * value, GParamSpec * pspec)
180 {
181  GstEdgeSink *self = GST_EDGESINK (object);
182 
183  switch (prop_id) {
184  case PROP_HOST:
185  gst_edgesink_set_host (self, g_value_get_string (value));
186  break;
187  case PROP_PORT:
188  gst_edgesink_set_port (self, g_value_get_uint (value));
189  break;
190  case PROP_DEST_HOST:
191  if (!g_value_get_string (value)) {
192  nns_logw ("dest host property cannot be NULL");
193  break;
194  }
195  g_free (self->dest_host);
196  self->dest_host = g_value_dup_string (value);
197  break;
198  case PROP_DEST_PORT:
199  self->dest_port = g_value_get_uint (value);
200  break;
201  case PROP_CONNECT_TYPE:
202  gst_edgesink_set_connect_type (self, g_value_get_enum (value));
203  break;
204  case PROP_TOPIC:
205  if (!g_value_get_string (value)) {
206  nns_logw ("topic property cannot be NULL. Query-hybrid is disabled.");
207  break;
208  }
209  g_free (self->topic);
210  self->topic = g_value_dup_string (value);
211  break;
213  self->wait_connection = g_value_get_boolean (value);
214  break;
216  self->connection_timeout = g_value_get_uint64 (value);
217  break;
218  case PROP_CUSTOM_LIB:
219  g_free (self->custom_lib);
220  self->custom_lib = g_value_dup_string (value);
221  break;
222  default:
223  G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
224  break;
225  }
226 }
227 
231 static void
232 gst_edgesink_get_property (GObject * object, guint prop_id, GValue * value,
233  GParamSpec * pspec)
234 {
235  GstEdgeSink *self = GST_EDGESINK (object);
236 
237  switch (prop_id) {
238  case PROP_HOST:
240  break;
241  case PROP_PORT:
242  g_value_set_uint (value, gst_edgesink_get_port (self));
243  break;
244  case PROP_DEST_HOST:
245  g_value_set_string (value, self->dest_host);
246  break;
247  case PROP_DEST_PORT:
248  g_value_set_uint (value, self->dest_port);
249  break;
250  case PROP_CONNECT_TYPE:
251  g_value_set_enum (value, gst_edgesink_get_connect_type (self));
252  break;
253  case PROP_TOPIC:
254  g_value_set_string (value, self->topic);
255  break;
257  g_value_set_boolean (value, self->wait_connection);
258  break;
260  g_value_set_uint64 (value, self->connection_timeout);
261  break;
262  case PROP_CUSTOM_LIB:
263  g_value_set_string (value, self->custom_lib);
264  break;
265  default:
266  G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
267  break;
268  }
269 }
270 
274 static void
275 gst_edgesink_finalize (GObject * object)
276 {
277  GstEdgeSink *self = GST_EDGESINK (object);
278 
279  g_free (self->host);
280  self->host = NULL;
281 
282  g_free (self->dest_host);
283  self->dest_host = NULL;
284 
285  g_free (self->topic);
286  self->topic = NULL;
287 
288  g_free (self->custom_lib);
289  self->custom_lib = NULL;
290  g_mutex_clear (&self->lock);
291  g_cond_clear (&self->cond);
292 
293  if (self->edge_h) {
294  nns_edge_release_handle (self->edge_h);
295  self->edge_h = NULL;
296  }
297 
298  G_OBJECT_CLASS (parent_class)->finalize (object);
299 }
300 
301 
305 static int
306 _nns_edge_event_cb (nns_edge_event_h event_h, void *user_data)
307 {
308  nns_edge_event_e event_type;
309  int ret = NNS_EDGE_ERROR_NONE;
310 
311  GstEdgeSink *self = GST_EDGESINK (user_data);
312  ret = nns_edge_event_get_type (event_h, &event_type);
313  if (NNS_EDGE_ERROR_NONE != ret) {
314  nns_loge ("Failed to get event type!");
315  return ret;
316  }
317 
318  switch (event_type) {
319  case NNS_EDGE_EVENT_CONNECTION_COMPLETED:
320  {
321  g_mutex_lock (&self->lock);
322  self->is_connected = TRUE;
323  g_cond_broadcast (&self->cond);
324  g_mutex_unlock (&self->lock);
325  break;
326  }
327  default:
328  break;
329  }
330 
331  return ret;
332 }
333 
337 static gboolean
338 gst_edgesink_start (GstBaseSink * basesink)
339 {
340  GstEdgeSink *self = GST_EDGESINK (basesink);
341 
342  int ret;
343  char *port = NULL;
344 
345  if (NNS_EDGE_CONNECT_TYPE_CUSTOM != self->connect_type) {
346  ret = nns_edge_create_handle (NULL, self->connect_type,
347  NNS_EDGE_NODE_TYPE_PUB, &self->edge_h);
348  } else {
349  if (!self->custom_lib) {
350  nns_loge ("Failed to start edgesink. Custom library is not set.");
351  return FALSE;
352  }
353  ret = nns_edge_custom_create_handle (NULL, self->custom_lib,
354  NNS_EDGE_NODE_TYPE_PUB, &self->edge_h);
355  }
356 
357  if (NNS_EDGE_ERROR_NONE != ret) {
358  nns_loge ("Failed to get nnstreamer edge handle.");
359 
360  if (self->edge_h) {
361  nns_edge_release_handle (self->edge_h);
362  self->edge_h = NULL;
363  }
364 
365  return FALSE;
366  }
367 
368  if (self->host)
369  nns_edge_set_info (self->edge_h, "HOST", self->host);
370  if (self->port > 0) {
371  port = g_strdup_printf ("%u", self->port);
372  nns_edge_set_info (self->edge_h, "PORT", port);
373  g_free (port);
374  }
375  if (self->dest_host)
376  nns_edge_set_info (self->edge_h, "DEST_HOST", self->dest_host);
377  if (self->dest_port > 0) {
378  port = g_strdup_printf ("%u", self->dest_port);
379  nns_edge_set_info (self->edge_h, "DEST_PORT", port);
380  g_free (port);
381  }
382  if (self->topic)
383  nns_edge_set_info (self->edge_h, "TOPIC", self->topic);
384 
385  nns_edge_set_event_callback (self->edge_h, _nns_edge_event_cb, self);
386 
387  if (0 != nns_edge_start (self->edge_h)) {
388  nns_loge
389  ("Failed to start NNStreamer-edge. Please check server IP and port");
390  return FALSE;
391  }
392 
393  return TRUE;
394 }
395 
399 static gboolean
401 {
402  gint64 end_time;
403  gboolean connected;
404 
405  if (!sink->wait_connection)
406  return TRUE;
407 
408  if (0 == sink->connection_timeout) {
409  end_time = G_MAXINT64;
410  } else {
411  end_time = g_get_monotonic_time ()
412  + sink->connection_timeout * G_TIME_SPAN_MILLISECOND;
413  }
414 
415  g_mutex_lock (&sink->lock);
416  while (!sink->is_connected) {
417  if (!g_cond_wait_until (&sink->cond, &sink->lock, end_time)) {
418  nns_loge ("Failed to wait connection.");
419  break;
420  }
421  }
422  connected = sink->is_connected;
423  g_mutex_unlock (&sink->lock);
424 
425  return connected;
426 }
427 
431 static gboolean
432 gst_edgesink_stop (GstBaseSink * basesink)
433 {
434  GstEdgeSink *self = GST_EDGESINK (basesink);
435  int ret;
436 
437  ret = nns_edge_stop (self->edge_h);
438  if (NNS_EDGE_ERROR_NONE != ret) {
439  nns_loge ("Failed to stop edge. error code(%d)", ret);
440  return FALSE;
441  }
442 
443  return TRUE;
444 }
445 
449 static GstFlowReturn
450 gst_edgesink_render (GstBaseSink * basesink, GstBuffer * buffer)
451 {
452  GstEdgeSink *self = GST_EDGESINK (basesink);
453  GstCaps *caps;
454  GstStructure *structure;
455  gboolean is_tensor;
456  nns_edge_data_h data_h;
457  guint i, num_mems;
458  int ret;
459  GstMemory *mem[NNS_TENSOR_SIZE_LIMIT];
460  GstMapInfo map[NNS_TENSOR_SIZE_LIMIT];
461 
462  if (!_wait_connection (self)) {
463  nns_loge ("Failed to send buffer.");
464  return GST_FLOW_ERROR;
465  }
466 
467  ret = nns_edge_data_create (&data_h);
468  if (ret != NNS_EDGE_ERROR_NONE) {
469  nns_loge ("Failed to create data handle in edgesink");
470  return GST_FLOW_ERROR;
471  }
472 
473  caps = gst_pad_get_current_caps (GST_BASE_SINK_PAD (basesink));
474  structure = gst_caps_get_structure (caps, 0);
475  is_tensor = gst_structure_is_tensor_stream (structure);
476  gst_caps_unref (caps);
477 
478  if (is_tensor)
479  num_mems = gst_tensor_buffer_get_count (buffer);
480  else
481  num_mems = gst_buffer_n_memory (buffer);
482 
483  for (i = 0; i < num_mems; i++) {
484  if (is_tensor)
485  mem[i] = gst_tensor_buffer_get_nth_memory (buffer, i);
486  else
487  mem[i] = gst_buffer_get_memory (buffer, i);
488 
489  if (!gst_memory_map (mem[i], &map[i], GST_MAP_READ)) {
490  nns_loge ("Cannot map the %uth memory in gst-buffer.", i);
491  gst_memory_unref (mem[i]);
492  num_mems = i;
493  goto done;
494  }
495 
496  ret = nns_edge_data_add (data_h, map[i].data, map[i].size, NULL);
497  if (ret != NNS_EDGE_ERROR_NONE) {
498  nns_loge ("Failed to append %u-th memory into edge data.", i);
499  num_mems = i + 1;
500  goto done;
501  }
502  }
503 
504  ret = nns_edge_send (self->edge_h, data_h);
505  if (ret != NNS_EDGE_ERROR_NONE)
506  nns_loge ("Failed to send edge data, connection lost or internal error.");
507 
508 done:
509  if (data_h)
510  nns_edge_data_destroy (data_h);
511 
512  for (i = 0; i < num_mems; i++) {
513  gst_memory_unmap (mem[i], &map[i]);
514  gst_memory_unref (mem[i]);
515  }
516 
517  return GST_FLOW_OK;
518 }
519 
523 static gboolean
524 gst_edgesink_set_caps (GstBaseSink * basesink, GstCaps * caps)
525 {
526  GstEdgeSink *sink = GST_EDGESINK (basesink);
527  gchar *caps_str, *prev_caps_str, *new_caps_str;
528  int set_rst;
529 
530  caps_str = gst_caps_to_string (caps);
531 
532  nns_edge_get_info (sink->edge_h, "CAPS", &prev_caps_str);
533  if (!prev_caps_str) {
534  prev_caps_str = g_strdup ("");
535  }
536  new_caps_str =
537  g_strdup_printf ("%s@edge_sink_caps@%s", prev_caps_str, caps_str);
538  set_rst = nns_edge_set_info (sink->edge_h, "CAPS", new_caps_str);
539 
540  g_free (prev_caps_str);
541  g_free (new_caps_str);
542  g_free (caps_str);
543 
544  return set_rst == NNS_EDGE_ERROR_NONE;
545 }
546 
550 static gchar *
552 {
553  return self->host;
554 }
555 
559 static void
560 gst_edgesink_set_host (GstEdgeSink * self, const gchar * host)
561 {
562  if (self->host)
563  g_free (self->host);
564  self->host = g_strdup (host);
565 }
566 
570 static guint16
572 {
573  return self->port;
574 }
575 
579 static void
580 gst_edgesink_set_port (GstEdgeSink * self, const guint16 port)
581 {
582  self->port = port;
583 }
584 
588 static nns_edge_connect_type_e
590 {
591  return self->connect_type;
592 }
593 
597 static void
599  const nns_edge_connect_type_e connect_type)
600 {
601  self->connect_type = connect_type;
602 }
gst_edgesink_init
static void gst_edgesink_init(GstEdgeSink *self)
initialize the new element
Definition: edge_sink.c:158
gst_edgesink_finalize
static void gst_edgesink_finalize(GObject *object)
finalize the object
Definition: edge_sink.c:275
PROP_DEST_PORT
@ PROP_DEST_PORT
Definition: edge_sink.c:40
data
svtc_1 data
Definition: gsttensor_if.c:844
NNS_TENSOR_SIZE_LIMIT
#define NNS_TENSOR_SIZE_LIMIT
The number of tensors NNStreamer supports is 256. The max memories of gst-buffer is 16 (See NNS_TENSO...
Definition: tensor_typedef.h:42
FALSE
return FALSE
Definition: gsttensor_transform.c:590
gst_edgesink_render
static GstFlowReturn gst_edgesink_render(GstBaseSink *basesink, GstBuffer *buffer)
render buffer, send buffer
Definition: edge_sink.c:450
GST_DEBUG_CATEGORY_STATIC
GST_DEBUG_CATEGORY_STATIC(gst_edgesink_debug)
_nns_edge_event_cb
static int _nns_edge_event_cb(nns_edge_event_h event_h, void *user_data)
nnstreamer-edge event callback.
Definition: edge_sink.c:306
_GstEdgeSink::edge_h
nns_edge_h edge_h
Definition: edge_sink.h:53
_GstEdgeSink::wait_connection
gboolean wait_connection
Definition: edge_sink.h:54
PROP_WAIT_CONNECTION
@ PROP_WAIT_CONNECTION
Definition: edge_sink.c:43
_GstEdgeSinkClass
GstEdgeSinkClass data structure.
Definition: edge_sink.h:66
PROP_0
@ PROP_0
Definition: edge_sink.c:35
PROP_CUSTOM_LIB
@ PROP_CUSTOM_LIB
Definition: edge_sink.c:45
DEFAULT_MQTT_PORT
#define DEFAULT_MQTT_PORT
Definition: edge_sink.c:50
gst_edgesink_get_property
static void gst_edgesink_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
get property
Definition: edge_sink.c:232
GST_CAT_DEFAULT
#define GST_CAT_DEFAULT
Definition: edge_sink.c:20
_GstEdgeSink
GstEdgeSink data structure.
Definition: edge_sink.h:42
gst_edgesink_set_port
static void gst_edgesink_set_port(GstEdgeSink *self, const guint16 port)
setter for the 'port' property.
Definition: edge_sink.c:580
g_free
g_free(self->option[(opnum) - 1])
opnum: \
DEFAULT_MQTT_HOST
#define DEFAULT_MQTT_HOST
Definition: edge_sink.c:49
g_value_set_string
g_value_set_string(value, self->option[opnum - 1])
opnum: \
PROP_PORT
@ PROP_PORT
Definition: edge_sink.c:38
G_DEFINE_TYPE
G_DEFINE_TYPE(GstEdgeSink, gst_edgesink, GST_TYPE_BASE_SINK)
PROP_CONNECTION_TIMEOUT
@ PROP_CONNECTION_TIMEOUT
Definition: edge_sink.c:44
gst_edgesink_set_property
static void gst_edgesink_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
set property
Definition: edge_sink.c:178
PROP_CONNECT_TYPE
@ PROP_CONNECT_TYPE
Definition: edge_sink.c:41
gst_edgesink_get_port
static guint16 gst_edgesink_get_port(GstEdgeSink *self)
getter for the 'port' property.
Definition: edge_sink.c:571
gst_structure_is_tensor_stream
G_BEGIN_DECLS gboolean gst_structure_is_tensor_stream(const GstStructure *structure)
Check given mimetype is tensor stream.
Definition: nnstreamer_plugin_api_impl.c:984
gst_edgesink_set_connect_type
static void gst_edgesink_set_connect_type(GstEdgeSink *self, const nns_edge_connect_type_e connect_type)
setter for the 'connect_type' property.
Definition: edge_sink.c:598
gst_edgesink_class_init
static void gst_edgesink_class_init(GstEdgeSinkClass *klass)
initialize the class
Definition: edge_sink.c:84
PROP_TOPIC
@ PROP_TOPIC
Definition: edge_sink.c:42
TRUE
return TRUE
Definition: gsttensor_if.c:897
gst_edgesink_start
static gboolean gst_edgesink_start(GstBaseSink *basesink)
start processing of edgesink
Definition: edge_sink.c:338
nns_loge
#define nns_loge
Definition: nnstreamer_log.h:142
DEFAULT_CONNECT_TYPE
#define DEFAULT_CONNECT_TYPE
Definition: edge_common.h:27
_GstEdgeSink::connection_timeout
guint64 connection_timeout
Definition: edge_sink.h:55
_GstEdgeSink::cond
GCond cond
Definition: edge_sink.h:60
PROP_HOST
@ PROP_HOST
Definition: edge_sink.c:37
DEFAULT_HOST
#define DEFAULT_HOST
Definition: edge_common.h:25
_GstEdgeSink::lock
GMutex lock
Definition: edge_sink.h:59
DEFAULT_PORT
#define DEFAULT_PORT
Definition: edge_common.h:26
_GstEdgeSink::is_connected
gboolean is_connected
Definition: edge_sink.h:58
gst_edgesink_get_host
static gchar * gst_edgesink_get_host(GstEdgeSink *self)
getter for the 'host' property.
Definition: edge_sink.c:551
gst_edgesink_stop
static gboolean gst_edgesink_stop(GstBaseSink *basesink)
Stop processing of edgesink.
Definition: edge_sink.c:432
nns_logw
#define nns_logw
Definition: nnstreamer_log.h:141
GST_TYPE_EDGE_CONNECT_TYPE
#define GST_TYPE_EDGE_CONNECT_TYPE
Definition: edge_common.h:28
gst_tensor_buffer_get_nth_memory
GstMemory * gst_tensor_buffer_get_nth_memory(GstBuffer *buffer, const guint index)
Get the nth GstMemory from given buffer.
Definition: nnstreamer_plugin_api_impl.c:1586
GST_EDGE_ELEM_NAME_SINK
#define GST_EDGE_ELEM_NAME_SINK
Definition: edge_common.h:23
gst_tensor_buffer_get_count
guint gst_tensor_buffer_get_count(GstBuffer *buffer)
Get the number of tensors in the buffer.
Definition: nnstreamer_plugin_api_impl.c:1813
sinktemplate
static GstStaticPadTemplate sinktemplate
the capabilities of the inputs.
Definition: edge_sink.c:25
GST_EDGESINK
#define GST_EDGESINK(obj)
Definition: edge_sink.h:27
PROP_DEST_HOST
@ PROP_DEST_HOST
Definition: edge_sink.c:39
_wait_connection
static gboolean _wait_connection(GstEdgeSink *sink)
If wait-connection is enabled, wait for connection until the connection is established or timeout occ...
Definition: edge_sink.c:400
edge_sink.h
Publish incoming streams.
gst_edgesink_set_caps
static gboolean gst_edgesink_set_caps(GstBaseSink *basesink, GstCaps *caps)
An implementation of the set_caps vmethod in GstBaseSinkClass.
Definition: edge_sink.c:524
PROP_LAST
@ PROP_LAST
Definition: edge_sink.c:47
gst_edgesink_get_connect_type
static nns_edge_connect_type_e gst_edgesink_get_connect_type(GstEdgeSink *self)
getter for the 'connect_type' property.
Definition: edge_sink.c:589
gst_edgesink_set_host
static void gst_edgesink_set_host(GstEdgeSink *self, const gchar *host)
setter for the 'host' property.
Definition: edge_sink.c:560