Doxygen Book
tensor_query_serversrc.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 <tensor_typedef.h>
18 #include <tensor_common.h>
19 #include "tensor_query_serversrc.h"
20 #include "tensor_query_common.h"
21 #include "nnstreamer_util.h"
22 
23 GST_DEBUG_CATEGORY_STATIC (gst_tensor_query_serversrc_debug);
24 #define GST_CAT_DEFAULT gst_tensor_query_serversrc_debug
25 
26 #define DEFAULT_PORT_SRC 3000
27 #define DEFAULT_IS_LIVE TRUE
28 #define DEFAULT_MQTT_HOST "127.0.0.1"
29 #define DEFAULT_MQTT_PORT 1883
30 #define DEFAULT_DATA_POP_TIMEOUT 100000U
31 
35 static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
36  GST_PAD_SRC,
37  GST_PAD_ALWAYS,
38  GST_STATIC_CAPS_ANY);
39 
43 enum
44 {
55 };
56 
57 #define gst_tensor_query_serversrc_parent_class parent_class
58 G_DEFINE_TYPE (GstTensorQueryServerSrc, gst_tensor_query_serversrc,
59  GST_TYPE_PUSH_SRC);
60 
61 static GstStateChangeReturn gst_tensor_query_serversrc_change_state (GstElement
62  * element, GstStateChange transition);
63 static void gst_tensor_query_serversrc_set_property (GObject * object,
64  guint prop_id, const GValue * value, GParamSpec * pspec);
65 static void gst_tensor_query_serversrc_get_property (GObject * object,
66  guint prop_id, GValue * value, GParamSpec * pspec);
67 static void gst_tensor_query_serversrc_finalize (GObject * object);
68 static GstFlowReturn gst_tensor_query_serversrc_create (GstPushSrc * psrc,
69  GstBuffer ** buf);
70 static gboolean gst_tensor_query_serversrc_set_caps (GstBaseSrc * bsrc,
71  GstCaps * caps);
72 
76 static void
78 {
79  GObjectClass *gobject_class;
80  GstElementClass *gstelement_class;
81  GstBaseSrcClass *gstbasesrc_class;
82  GstPushSrcClass *gstpushsrc_class;
83 
84  gstpushsrc_class = (GstPushSrcClass *) klass;
85  gstbasesrc_class = (GstBaseSrcClass *) gstpushsrc_class;
86  gstelement_class = (GstElementClass *) gstbasesrc_class;
87  gobject_class = (GObjectClass *) gstelement_class;
88 
89  gobject_class->set_property = gst_tensor_query_serversrc_set_property;
90  gobject_class->get_property = gst_tensor_query_serversrc_get_property;
91  gobject_class->finalize = gst_tensor_query_serversrc_finalize;
92  gstelement_class->change_state = gst_tensor_query_serversrc_change_state;
93  gstpushsrc_class->create = gst_tensor_query_serversrc_create;
94 
95  g_object_class_install_property (gobject_class, PROP_HOST,
96  g_param_spec_string ("host", "Host", "The hostname to listen as",
97  DEFAULT_HOST, 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  "The port to listen to (0=random available port)", 0,
101  65535, DEFAULT_PORT_SRC, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
102  g_object_class_install_property (gobject_class, PROP_DEST_HOST,
103  g_param_spec_string ("dest-host", "Destination Host",
104  "The destination hostname to connect", DEFAULT_MQTT_HOST,
105  G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
106  g_object_class_install_property (gobject_class, PROP_DEST_PORT,
107  g_param_spec_uint ("dest-port", "Destination Port",
108  "The destination port to connect to (0=random available port)", 0,
109  65535, DEFAULT_MQTT_PORT,
110  G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
111  g_object_class_install_property (gobject_class, PROP_CONNECT_TYPE,
112  g_param_spec_enum ("connect-type", "Connect Type", "The connection type.",
114  G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
115  g_object_class_install_property (gobject_class, PROP_TIMEOUT,
116  g_param_spec_uint ("timeout", "Timeout",
117  "The timeout as seconds to maintain connection", 0, 3600,
119  G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
120  g_object_class_install_property (gobject_class, PROP_TOPIC,
121  g_param_spec_string ("topic", "Topic",
122  "The main topic of the host and option if necessary. "
123  "(topic)/(optional topic for main topic).", "",
124  G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
125  g_object_class_install_property (gobject_class, PROP_ID,
126  g_param_spec_uint ("id", "ID", "ID for distinguishing query servers.", 0,
127  G_MAXUINT, DEFAULT_SERVER_ID,
128  G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
129  g_object_class_install_property (gobject_class, PROP_IS_LIVE,
130  g_param_spec_boolean ("is-live", "Is Live",
131  "Synchronize the incoming buffers' timestamp with the current running time",
132  DEFAULT_IS_LIVE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
133 
134  gst_element_class_add_pad_template (gstelement_class,
135  gst_static_pad_template_get (&srctemplate));
136 
137  gst_element_class_set_static_metadata (gstelement_class,
138  "TensorQueryServerSrc", "Source/Tensor/Query",
139  "Receive tensor data as a server over the network",
140  "Samsung Electronics Co., Ltd.");
141 
142  GST_DEBUG_CATEGORY_INIT (gst_tensor_query_serversrc_debug,
143  "tensor_query_serversrc", 0, "Tensor Query Server Source");
144 }
145 
149 static void
151 {
152  src->host = g_strdup (DEFAULT_HOST);
153  src->port = DEFAULT_PORT_SRC;
154  src->dest_host = g_strdup (DEFAULT_MQTT_HOST);
158  src->topic = NULL;
159  src->src_id = DEFAULT_SERVER_ID;
160  src->configured = FALSE;
161  src->msg_queue = g_async_queue_new ();
162  src->playing = FALSE;
163 
164  gst_base_src_set_format (GST_BASE_SRC (src), GST_FORMAT_TIME);
166  gst_base_src_set_do_timestamp (GST_BASE_SRC (src), TRUE);
168  gst_base_src_set_live (GST_BASE_SRC (src), DEFAULT_IS_LIVE);
169 }
170 
174 static void
176 {
178  nns_edge_data_h data_h;
179 
180  g_free (src->host);
181  src->host = NULL;
182  g_free (src->dest_host);
183  src->dest_host = NULL;
184  g_free (src->topic);
185  src->topic = NULL;
186 
187  while ((data_h = g_async_queue_try_pop (src->msg_queue))) {
188  nns_edge_data_destroy (data_h);
189  }
190  g_async_queue_unref (src->msg_queue);
191 
192  G_OBJECT_CLASS (parent_class)->finalize (object);
193 }
194 
198 static int
199 _nns_edge_event_cb (nns_edge_event_h event_h, void *user_data)
200 {
201  nns_edge_event_e event_type;
202  int ret = NNS_EDGE_ERROR_NONE;
203 
205  ret = nns_edge_event_get_type (event_h, &event_type);
206  if (NNS_EDGE_ERROR_NONE != ret) {
207  nns_loge ("Failed to get event type!");
208  return ret;
209  }
210 
211  switch (event_type) {
212  case NNS_EDGE_EVENT_NEW_DATA_RECEIVED:
213  {
214  nns_edge_data_h data;
215 
216  ret = nns_edge_event_parse_new_data (event_h, &data);
217  if (NNS_EDGE_ERROR_NONE != ret) {
218  nns_loge ("Failed to parse new data received from new data event");
219  return ret;
220  }
221  g_async_queue_push (src->msg_queue, data);
222  break;
223  }
224  default:
225  break;
226  }
227 
228  return ret;
229 }
230 
234 static gboolean
236 {
237  gboolean ret = FALSE;
238 
241 
242  if (!ret)
243  nns_loge ("Failed to get server information from query server.");
244 
245  return ret;
246 }
247 
251 static gboolean
253  nns_edge_connect_type_e connect_type)
254 {
255  GstTensorQueryEdgeInfo edge_info = { 0 };
256  gboolean ret;
257 
258  edge_info.host = src->host;
259  edge_info.port = src->port;
260  edge_info.dest_host = src->dest_host;
261  edge_info.dest_port = src->dest_port;
262  edge_info.topic = src->topic;
263  edge_info.cb = _nns_edge_event_cb;
264  edge_info.pdata = src;
265 
266  ret = gst_tensor_query_server_prepare (src->src_id, connect_type, &edge_info);
267 
268  return ret;
269 }
270 
274 static GstStateChangeReturn
276  GstStateChange transition)
277 {
279  GstBaseSrc *bsrc = GST_BASE_SRC (element);
280  GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
281  GstCaps *caps;
282 
283  switch (transition) {
284  case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
286  nns_loge ("Failed to change state from PAUSED to PLAYING.");
287  return GST_STATE_CHANGE_FAILURE;
288  }
289 
290  caps = gst_pad_peer_query_caps (GST_BASE_SRC_PAD (bsrc), NULL);
292  gst_caps_unref (caps);
293 
294  src->playing = TRUE;
295  break;
296  case GST_STATE_CHANGE_READY_TO_PAUSED:
298  nns_loge ("Failed to change state from READY to PAUSED.");
299  return GST_STATE_CHANGE_FAILURE;
300  }
301  break;
302  default:
303  break;
304  }
305 
306  ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
307  if (ret == GST_STATE_CHANGE_FAILURE) {
308  nns_loge ("Failed to change state");
309  return ret;
310  }
311 
312  switch (transition) {
313  case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
314  src->playing = FALSE;
316  break;
317  case GST_STATE_CHANGE_PAUSED_TO_READY:
319  break;
320  default:
321  break;
322  }
323 
324  return ret;
325 }
326 
330 static void
331 gst_tensor_query_serversrc_set_property (GObject * object, guint prop_id,
332  const GValue * value, GParamSpec * pspec)
333 {
335 
336  switch (prop_id) {
337  case PROP_HOST:
338  if (!g_value_get_string (value)) {
339  nns_logw ("host property cannot be NULL");
340  break;
341  }
342  g_free (serversrc->host);
343  serversrc->host = g_value_dup_string (value);
344  break;
345  case PROP_PORT:
346  serversrc->port = g_value_get_uint (value);
347  break;
348  case PROP_DEST_HOST:
349  if (!g_value_get_string (value)) {
350  nns_logw ("host property cannot be NULL");
351  break;
352  }
353  g_free (serversrc->dest_host);
354  serversrc->dest_host = g_value_dup_string (value);
355  break;
356  case PROP_DEST_PORT:
357  serversrc->dest_port = g_value_get_uint (value);
358  break;
359  case PROP_CONNECT_TYPE:
360  serversrc->connect_type = g_value_get_enum (value);
361  break;
362  case PROP_TIMEOUT:
363  serversrc->timeout = g_value_get_uint (value);
364  break;
365  case PROP_TOPIC:
366  if (!g_value_get_string (value)) {
367  nns_logw ("topic property cannot be NULL. Query-hybrid is disabled.");
368  break;
369  }
370  g_free (serversrc->topic);
371  serversrc->topic = g_value_dup_string (value);
372  break;
373  case PROP_ID:
374  serversrc->src_id = g_value_get_uint (value);
375  break;
376  case PROP_IS_LIVE:
377  gst_base_src_set_live (GST_BASE_SRC (serversrc),
378  g_value_get_boolean (value));
379  break;
380  default:
381  G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
382  break;
383  }
384 }
385 
389 static void
390 gst_tensor_query_serversrc_get_property (GObject * object, guint prop_id,
391  GValue * value, GParamSpec * pspec)
392 {
394 
395  switch (prop_id) {
396  case PROP_HOST:
397  g_value_set_string (value, serversrc->host);
398  break;
399  case PROP_PORT:
400  g_value_set_uint (value, serversrc->port);
401  break;
402  case PROP_DEST_HOST:
403  g_value_set_string (value, serversrc->dest_host);
404  break;
405  case PROP_DEST_PORT:
406  g_value_set_uint (value, serversrc->dest_port);
407  break;
408  case PROP_CONNECT_TYPE:
409  g_value_set_enum (value, serversrc->connect_type);
410  break;
411  case PROP_TIMEOUT:
412  g_value_set_uint (value, serversrc->timeout);
413  break;
414  case PROP_TOPIC:
415  g_value_set_string (value, serversrc->topic);
416  break;
417  case PROP_ID:
418  g_value_set_uint (value, serversrc->src_id);
419  break;
420  case PROP_IS_LIVE:
421  g_value_set_boolean (value,
422  gst_base_src_is_live (GST_BASE_SRC (serversrc)));
423  break;
424  default:
425  G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
426  break;
427  }
428 }
429 
433 static GstBuffer *
435 {
436  nns_edge_data_h data_h = NULL;
437  GstBuffer *buffer = NULL;
438  guint i, num_data;
439  GstMetaQuery *meta_query;
440  int ret;
441 
442  while (src->playing && !data_h) {
443  data_h = g_async_queue_timeout_pop (src->msg_queue,
445  }
446 
447  if (!data_h) {
448  nns_loge ("Failed to get message from the server message queue.");
449  return NULL;
450  }
451 
452  ret = nns_edge_data_get_count (data_h, &num_data);
453  if (ret != NNS_EDGE_ERROR_NONE || num_data == 0) {
454  nns_loge ("Failed to get the number of memories of the edge data.");
455  goto done;
456  }
457 
458  buffer = gst_buffer_new ();
459  for (i = 0; i < num_data; i++) {
460  void *data = NULL;
461  nns_size_t data_len = 0;
462  gpointer new_data;
463 
464  nns_edge_data_get (data_h, i, &data, &data_len);
465  new_data = _g_memdup (data, data_len);
466 
467  gst_buffer_append_memory (buffer,
468  gst_memory_new_wrapped (0, new_data, data_len, 0, data_len, new_data,
469  g_free));
470  }
471 
472  meta_query = gst_buffer_add_meta_query (buffer);
473  if (meta_query) {
474  char *val;
475 
476  ret = nns_edge_data_get_info (data_h, "client_id", &val);
477  if (NNS_EDGE_ERROR_NONE != ret) {
478  gst_buffer_unref (buffer);
479  buffer = NULL;
480  } else {
481  meta_query->client_id = g_ascii_strtoll (val, NULL, 10);
482  g_free (val);
483  }
484  }
485 
486 done:
487  nns_edge_data_destroy (data_h);
488  return buffer;
489 }
490 
494 static GstFlowReturn
495 gst_tensor_query_serversrc_create (GstPushSrc * psrc, GstBuffer ** outbuf)
496 {
498  GstBaseSrc *bsrc = GST_BASE_SRC (psrc);
499  GstStateChangeReturn sret;
500  GstState state = GST_STATE_NULL;
501 
502  if (!src->configured) {
503  GstCaps *caps = gst_pad_peer_query_caps (GST_BASE_SRC_PAD (bsrc), NULL);
504  if (gst_caps_is_fixed (caps)) {
505  gst_base_src_set_caps (bsrc, caps);
506  }
507 
509 
510  gst_caps_unref (caps);
511  src->configured = TRUE;
512  }
513 
515  if (*outbuf == NULL) {
516  sret = gst_element_get_state (GST_ELEMENT (psrc), &state, NULL, 0);
517  if (sret != GST_STATE_CHANGE_SUCCESS || state != GST_STATE_PLAYING) {
518  nns_logw ("Failed to get buffer for query server, not in PLAYING state.");
519  return GST_FLOW_FLUSHING;
520  }
521 
522  nns_loge ("Failed to get buffer to push to the tensor query serversrc.");
523  return GST_FLOW_ERROR;
524  }
525 
526  return GST_FLOW_OK;
527 }
528 
532 static gboolean
533 gst_tensor_query_serversrc_set_caps (GstBaseSrc * bsrc, GstCaps * caps)
534 {
536  gchar *caps_str, *new_caps_str;
537 
538  caps_str = gst_caps_to_string (caps);
539 
540  new_caps_str = g_strdup_printf ("@query_server_src_caps@%s", caps_str);
541  gst_tensor_query_server_set_caps (src->src_id, new_caps_str);
542 
543  g_free (new_caps_str);
544  g_free (caps_str);
545 
546  return TRUE;
547 }
gst_tensor_query_server_add_data
gboolean gst_tensor_query_server_add_data(const guint id)
Add nnstreamer edge server handle into hash table.
Definition: tensor_query_server.c:77
GstTensorQueryEdgeInfo::host
gchar * host
Definition: tensor_query_server.h:30
PROP_TOPIC
@ PROP_TOPIC
Definition: tensor_query_serversrc.c:52
_GstTensorQueryServerSrc::configured
gboolean configured
Definition: tensor_query_serversrc.h:43
DEFAULT_MQTT_PORT
#define DEFAULT_MQTT_PORT
Definition: tensor_query_serversrc.c:29
_nns_edge_event_cb
static int _nns_edge_event_cb(nns_edge_event_h event_h, void *user_data)
nnstreamer-edge event callback.
Definition: tensor_query_serversrc.c:199
PROP_ID
@ PROP_ID
Definition: tensor_query_serversrc.c:53
PROP_PORT
@ PROP_PORT
Definition: tensor_query_serversrc.c:47
data
svtc_1 data
Definition: gsttensor_if.c:844
GstTensorQueryEdgeInfo::cb
nns_edge_event_cb cb
Definition: tensor_query_server.h:37
_GstTensorQueryServerSrc::host
gchar * host
Definition: tensor_query_serversrc.h:45
tensor_query_serversrc.h
GStreamer plugin to handle tensor query_server src.
FALSE
return FALSE
Definition: gsttensor_transform.c:590
GstTensorQueryEdgeInfo
Internal data structure for nns-edge info to prepare edge connection.
Definition: tensor_query_server.h:28
PROP_DEST_HOST
@ PROP_DEST_HOST
Definition: tensor_query_serversrc.c:48
_gst_tensor_query_serversrc_playing
static gboolean _gst_tensor_query_serversrc_playing(GstTensorQueryServerSrc *src, nns_edge_connect_type_e connect_type)
start processing of query_serversrc, setting up the server
Definition: tensor_query_serversrc.c:252
_GstTensorQueryServerSrcClass
GstTensorQueryServerSrcClass data structure.
Definition: tensor_query_serversrc.h:62
_gst_tensor_query_serversrc_start
static gboolean _gst_tensor_query_serversrc_start(GstTensorQueryServerSrc *src)
start processing of query_serversrc, setting up the server
Definition: tensor_query_serversrc.c:235
DEFAULT_SERVER_ID
#define DEFAULT_SERVER_ID
Definition: tensor_query_server.h:22
GstMetaQuery::client_id
query_client_id_t client_id
Definition: tensor_meta.h:30
PROP_TIMEOUT
@ PROP_TIMEOUT
Definition: tensor_query_serversrc.c:51
_GstTensorQueryServerSrc::dest_port
guint16 dest_port
Definition: tensor_query_serversrc.h:48
PROP_0
@ PROP_0
Definition: tensor_query_serversrc.c:45
GstMetaQuery
GstMetaQuery meta structure.
Definition: tensor_meta.h:26
GST_TENSOR_QUERY_SERVERSRC
#define GST_TENSOR_QUERY_SERVERSRC(obj)
Definition: tensor_query_serversrc.h:24
DEFAULT_PORT_SRC
#define DEFAULT_PORT_SRC
Definition: tensor_query_serversrc.c:26
gst_tensor_query_serversrc_set_property
static void gst_tensor_query_serversrc_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
set property of query_serversrc
Definition: tensor_query_serversrc.c:331
_GstTensorQueryServerSrc
GstTensorQueryServerSrc data structure.
Definition: tensor_query_serversrc.h:39
GST_TYPE_QUERY_CONNECT_TYPE
#define GST_TYPE_QUERY_CONNECT_TYPE
Definition: tensor_query_common.h:35
g_free
g_free(self->option[(opnum) - 1])
opnum: \
gst_tensor_query_serversrc_set_caps
static gboolean gst_tensor_query_serversrc_set_caps(GstBaseSrc *bsrc, GstCaps *caps)
An implementation of the set_caps vmethod in GstBaseSrcClass.
Definition: tensor_query_serversrc.c:533
_GstTensorQueryServerSrc::src_id
guint src_id
Definition: tensor_query_serversrc.h:42
g_value_set_string
g_value_set_string(value, self->option[opnum - 1])
opnum: \
_g_memdup
#define _g_memdup(data, size)
g_memdup() function replaced by g_memdup2() in glib version >= 2.68
Definition: nnstreamer_util.h:31
G_DEFINE_TYPE
G_DEFINE_TYPE(GstTensorQueryServerSrc, gst_tensor_query_serversrc, GST_TYPE_PUSH_SRC)
gst_tensor_query_serversrc_finalize
static void gst_tensor_query_serversrc_finalize(GObject *object)
finalize the query_serversrc object
Definition: tensor_query_serversrc.c:175
_GstTensorQueryServerSrc::timeout
guint timeout
Definition: tensor_query_serversrc.h:49
PROP_CONNECT_TYPE
@ PROP_CONNECT_TYPE
Definition: tensor_query_serversrc.c:50
GstTensorQueryEdgeInfo::dest_host
gchar * dest_host
Definition: tensor_query_server.h:32
_GstTensorQueryServerSrc::connect_type
nns_edge_connect_type_e connect_type
Definition: tensor_query_serversrc.h:54
gst_tensor_query_serversrc_create
static GstFlowReturn gst_tensor_query_serversrc_create(GstPushSrc *psrc, GstBuffer **buf)
create query_serversrc, wait on socket and receive data
Definition: tensor_query_serversrc.c:495
_GstTensorQueryServerSrc::port
guint16 port
Definition: tensor_query_serversrc.h:46
gst_buffer_add_meta_query
#define gst_buffer_add_meta_query(b)
Definition: tensor_meta.h:46
QUERY_DEFAULT_TIMEOUT_SEC
#define QUERY_DEFAULT_TIMEOUT_SEC
Default timeout, in seconds.
Definition: tensor_query_common.h:28
gst_tensor_query_serversrc_get_property
static void gst_tensor_query_serversrc_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
get property of query_serversrc
Definition: tensor_query_serversrc.c:390
srctemplate
static GstStaticPadTemplate srctemplate
the capabilities of the outputs
Definition: tensor_query_serversrc.c:35
gst_tensor_query_serversrc_change_state
static GstStateChangeReturn gst_tensor_query_serversrc_change_state(GstElement *element, GstStateChange transition)
Change state of query server src.
Definition: tensor_query_serversrc.c:275
TRUE
return TRUE
Definition: gsttensor_if.c:897
gst_tensor_query_serversrc_class_init
static void gst_tensor_query_serversrc_class_init(GstTensorQueryServerSrcClass *klass)
initialize the query_serversrc class
Definition: tensor_query_serversrc.c:77
nns_loge
#define nns_loge
Definition: nnstreamer_log.h:142
tensor_typedef.h
Common header file for NNStreamer, the GStreamer plugin for neural networks.
gst_tensor_query_server_remove_data
void gst_tensor_query_server_remove_data(const guint id)
Remove GstTensorQueryServer.
Definition: tensor_query_server.c:280
DEFAULT_IS_LIVE
#define DEFAULT_IS_LIVE
Definition: tensor_query_serversrc.c:27
DEFAULT_CONNECT_TYPE
#define DEFAULT_CONNECT_TYPE
Definition: edge_common.h:27
nnstreamer_util.h
Optional NNStreamer utility functions for sub-plugin writers and users.
PROP_IS_LIVE
@ PROP_IS_LIVE
Definition: tensor_query_serversrc.c:54
_gst_tensor_query_serversrc_get_buffer
static GstBuffer * _gst_tensor_query_serversrc_get_buffer(GstTensorQueryServerSrc *src)
Get buffer from message queue.
Definition: tensor_query_serversrc.c:434
GstTensorQueryEdgeInfo::port
guint16 port
Definition: tensor_query_server.h:31
DEFAULT_HOST
#define DEFAULT_HOST
Definition: edge_common.h:25
DEFAULT_MQTT_HOST
#define DEFAULT_MQTT_HOST
Definition: tensor_query_serversrc.c:28
gst_tensor_query_serversrc_init
static void gst_tensor_query_serversrc_init(GstTensorQueryServerSrc *src)
initialize the new query_serversrc element
Definition: tensor_query_serversrc.c:150
tensor_common.h
Common header file for NNStreamer, the GStreamer plugin for neural networks.
gst_tensor_query_server_wait_sink
gboolean gst_tensor_query_server_wait_sink(const guint id)
Wait until the sink is configured and get server info handle.
Definition: tensor_query_server.c:292
PROP_HOST
@ PROP_HOST
Definition: tensor_query_serversrc.c:46
GstTensorQueryEdgeInfo::dest_port
guint16 dest_port
Definition: tensor_query_server.h:33
nns_logw
#define nns_logw
Definition: nnstreamer_log.h:141
gst_tensor_query_server_release_edge_handle
void gst_tensor_query_server_release_edge_handle(const guint id)
Release nnstreamer edge handle of query server.
Definition: tensor_query_server.c:258
_GstTensorQueryServerSrc::topic
gchar * topic
Definition: tensor_query_serversrc.h:52
PROP_DEST_PORT
@ PROP_DEST_PORT
Definition: tensor_query_serversrc.c:49
GST_DEBUG_CATEGORY_STATIC
GST_DEBUG_CATEGORY_STATIC(gst_tensor_query_serversrc_debug)
_GstTensorQueryServerSrc::playing
gboolean playing
Definition: tensor_query_serversrc.h:56
GstTensorQueryEdgeInfo::pdata
void * pdata
Definition: tensor_query_server.h:38
DEFAULT_DATA_POP_TIMEOUT
#define DEFAULT_DATA_POP_TIMEOUT
Definition: tensor_query_serversrc.c:30
gst_tensor_query_server_prepare
gboolean gst_tensor_query_server_prepare(const guint id, nns_edge_connect_type_e connect_type, GstTensorQueryEdgeInfo *edge_info)
Prepare edge connection and its handle.
Definition: tensor_query_server.c:114
_GstTensorQueryServerSrc::msg_queue
GAsyncQueue * msg_queue
Definition: tensor_query_serversrc.h:55
GstTensorQueryEdgeInfo::topic
gchar * topic
Definition: tensor_query_server.h:34
gst_tensor_query_server_set_caps
void gst_tensor_query_server_set_caps(const guint id, const gchar *caps_str)
set query server caps.
Definition: tensor_query_server.c:342
_GstTensorQueryServerSrc::dest_host
gchar * dest_host
Definition: tensor_query_serversrc.h:47
tensor_query_common.h
Utility functions for tensor query.