Doxygen Book
tensor_query_client.c File Reference

GStreamer plugin to handle tensor query client. More...

#include "nnstreamer_util.h"
#include "tensor_query_client.h"
#include <gio/gio.h>
#include <glib.h>
#include <string.h>
#include "tensor_query_common.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
Include dependency graph for tensor_query_client.c:

Go to the source code of this file.

Macros

#define DBG   (!self->silent)
 Macro for debug mode. More...
 
#define TCP_HIGHEST_PORT   65535
 
#define TCP_DEFAULT_HOST   "localhost"
 
#define TCP_DEFAULT_SRV_SRC_PORT   3000
 
#define TCP_DEFAULT_CLIENT_SRC_PORT   3001
 
#define DEFAULT_CLIENT_TIMEOUT   0
 
#define DEFAULT_SILENT   TRUE
 
#define DEFAULT_MAX_REQUEST   2
 
#define GST_CAT_DEFAULT   gst_tensor_query_client_debug
 
#define gst_tensor_query_client_parent_class   parent_class
 

Enumerations

enum  {
  PROP_0, PROP_HOST, PROP_PORT, PROP_DEST_HOST,
  PROP_DEST_PORT, PROP_CONNECT_TYPE, PROP_TOPIC, PROP_TIMEOUT,
  PROP_SILENT, PROP_MAX_REQUEST
}
 Properties. More...
 

Functions

 GST_DEBUG_CATEGORY_STATIC (gst_tensor_query_client_debug)
 
 G_DEFINE_TYPE (GstTensorQueryClient, gst_tensor_query_client, GST_TYPE_ELEMENT)
 
static void gst_tensor_query_client_finalize (GObject *object)
 finalize the object More...
 
static void gst_tensor_query_client_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
 set property More...
 
static void gst_tensor_query_client_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
 get property More...
 
static gboolean gst_tensor_query_client_sink_event (GstPad *pad, GstObject *parent, GstEvent *event)
 This function handles sink event. More...
 
static gboolean gst_tensor_query_client_sink_query (GstPad *pad, GstObject *parent, GstQuery *query)
 This function handles sink pad query. More...
 
static GstFlowReturn gst_tensor_query_client_chain (GstPad *pad, GstObject *parent, GstBuffer *buf)
 Chain function, this function does the actual processing. More...
 
static GstCaps * gst_tensor_query_client_query_caps (GstTensorQueryClient *self, GstPad *pad, GstCaps *filter)
 Get pad caps for caps negotiation. More...
 
static void gst_tensor_query_client_class_init (GstTensorQueryClientClass *klass)
 initialize the class More...
 
static void gst_tensor_query_client_init (GstTensorQueryClient *self)
 initialize the new element More...
 
static gboolean gst_tensor_query_client_update_caps (GstTensorQueryClient *self, const gchar *caps_str)
 Update src pad caps from tensors config. More...
 
static gchar * _nns_edge_parse_caps (gchar *caps_str, gboolean is_src)
 Parse caps from received event data. More...
 
static int _nns_edge_event_cb (nns_edge_event_h event_h, void *user_data)
 nnstreamer-edge event callback. More...
 
static gboolean gst_tensor_query_client_create_edge_handle (GstTensorQueryClient *self)
 Internal function to create edge handle. More...
 

Variables

static GstStaticPadTemplate sinktemplate
 the capabilities of the inputs. More...
 
static GstStaticPadTemplate srctemplate
 the capabilities of the outputs. More...
 

Detailed Description

GStreamer plugin to handle tensor query client.

Copyright (C) 2021 Samsung Electronics Co., Ltd.

Date
09 Jul 2021
Author
Junhwan Kim jejud.nosp@m.o.ki.nosp@m.m@sam.nosp@m.sung.nosp@m..com
See also
http://github.com/nnstreamer/nnstreamer
Bug:
No known bugs

Definition in file tensor_query_client.c.

Macro Definition Documentation

◆ DBG

#define DBG   (!self->silent)

Macro for debug mode.

Definition at line 32 of file tensor_query_client.c.

◆ DEFAULT_CLIENT_TIMEOUT

#define DEFAULT_CLIENT_TIMEOUT   0

Definition at line 56 of file tensor_query_client.c.

◆ DEFAULT_MAX_REQUEST

#define DEFAULT_MAX_REQUEST   2

Definition at line 58 of file tensor_query_client.c.

◆ DEFAULT_SILENT

#define DEFAULT_SILENT   TRUE

Definition at line 57 of file tensor_query_client.c.

◆ GST_CAT_DEFAULT

#define GST_CAT_DEFAULT   gst_tensor_query_client_debug

Definition at line 61 of file tensor_query_client.c.

◆ gst_tensor_query_client_parent_class

#define gst_tensor_query_client_parent_class   parent_class

Definition at line 79 of file tensor_query_client.c.

◆ TCP_DEFAULT_CLIENT_SRC_PORT

#define TCP_DEFAULT_CLIENT_SRC_PORT   3001

Definition at line 55 of file tensor_query_client.c.

◆ TCP_DEFAULT_HOST

#define TCP_DEFAULT_HOST   "localhost"

Definition at line 53 of file tensor_query_client.c.

◆ TCP_DEFAULT_SRV_SRC_PORT

#define TCP_DEFAULT_SRV_SRC_PORT   3000

Definition at line 54 of file tensor_query_client.c.

◆ TCP_HIGHEST_PORT

#define TCP_HIGHEST_PORT   65535

Definition at line 52 of file tensor_query_client.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Properties.

Enumerator
PROP_0 
PROP_HOST 
PROP_PORT 
PROP_DEST_HOST 
PROP_DEST_PORT 
PROP_CONNECT_TYPE 
PROP_TOPIC 
PROP_TIMEOUT 
PROP_SILENT 
PROP_MAX_REQUEST 

Definition at line 38 of file tensor_query_client.c.

Function Documentation

◆ _nns_edge_event_cb()

static int _nns_edge_event_cb ( nns_edge_event_h  event_h,
void *  user_data 
)
static

nnstreamer-edge event callback.

Server framerate may vary. Let's skip comparing the framerate.

Update client src caps

Definition at line 435 of file tensor_query_client.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _nns_edge_parse_caps()

static gchar* _nns_edge_parse_caps ( gchar *  caps_str,
gboolean  is_src 
)
static

Parse caps from received event data.

Definition at line 400 of file tensor_query_client.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ G_DEFINE_TYPE()

G_DEFINE_TYPE ( GstTensorQueryClient  ,
gst_tensor_query_client  ,
GST_TYPE_ELEMENT   
)

◆ GST_DEBUG_CATEGORY_STATIC()

GST_DEBUG_CATEGORY_STATIC ( gst_tensor_query_client_debug  )

◆ gst_tensor_query_client_chain()

static GstFlowReturn gst_tensor_query_client_chain ( GstPad *  pad,
GstObject *  parent,
GstBuffer *  buf 
)
static

Chain function, this function does the actual processing.

Definition at line 674 of file tensor_query_client.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gst_tensor_query_client_class_init()

static void gst_tensor_query_client_class_init ( GstTensorQueryClientClass klass)
static

initialize the class

install property goes here

Definition at line 101 of file tensor_query_client.c.

Here is the call graph for this function:

◆ gst_tensor_query_client_create_edge_handle()

static gboolean gst_tensor_query_client_create_edge_handle ( GstTensorQueryClient self)
static

Internal function to create edge handle.

Definition at line 521 of file tensor_query_client.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gst_tensor_query_client_finalize()

static void gst_tensor_query_client_finalize ( GObject *  object)
static

finalize the object

Definition at line 213 of file tensor_query_client.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gst_tensor_query_client_get_property()

static void gst_tensor_query_client_get_property ( GObject *  object,
guint  prop_id,
GValue *  value,
GParamSpec *  pspec 
)
static

get property

Definition at line 309 of file tensor_query_client.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gst_tensor_query_client_init()

static void gst_tensor_query_client_init ( GstTensorQueryClient self)
static

initialize the new element

setup sink pad

setup src pad

Definition at line 175 of file tensor_query_client.c.

Here is the call graph for this function:

◆ gst_tensor_query_client_query_caps()

static GstCaps * gst_tensor_query_client_query_caps ( GstTensorQueryClient self,
GstPad *  pad,
GstCaps *  filter 
)
static

Get pad caps for caps negotiation.

pad don't have current caps. use the template caps

Definition at line 784 of file tensor_query_client.c.

Here is the caller graph for this function:

◆ gst_tensor_query_client_set_property()

static void gst_tensor_query_client_set_property ( GObject *  object,
guint  prop_id,
const GValue *  value,
GParamSpec *  pspec 
)
static

set property

Todo:
DO NOT update properties (host, port, ..) while pipeline is running.

Definition at line 250 of file tensor_query_client.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gst_tensor_query_client_sink_event()

static gboolean gst_tensor_query_client_sink_event ( GstPad *  pad,
GstObject *  parent,
GstEvent *  event 
)
static

This function handles sink event.

Definition at line 587 of file tensor_query_client.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gst_tensor_query_client_sink_query()

static gboolean gst_tensor_query_client_sink_query ( GstPad *  pad,
GstObject *  parent,
GstQuery *  query 
)
static

This function handles sink pad query.

Definition at line 623 of file tensor_query_client.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gst_tensor_query_client_update_caps()

static gboolean gst_tensor_query_client_update_caps ( GstTensorQueryClient self,
const gchar *  caps_str 
)
static

Update src pad caps from tensors config.

If pad caps is updated, prepare the tensor information here. It will be used in chain function, to push tensor buffer into src pad.

Don't need to update when the capability is the same.

Definition at line 352 of file tensor_query_client.c.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ sinktemplate

GstStaticPadTemplate sinktemplate
static
Initial value:
= GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS_ANY)

the capabilities of the inputs.

Definition at line 66 of file tensor_query_client.c.

◆ srctemplate

GstStaticPadTemplate srctemplate
static
Initial value:
= GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS_ANY)

the capabilities of the outputs.

Definition at line 74 of file tensor_query_client.c.