Doxygen Book
tensor_if.h File Reference

NNStreamer APIs for tensor_if custom condition. More...

#include <glib.h>
#include <gst/gst.h>
#include "tensor_typedef.h"
Include dependency graph for tensor_if.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int nnstreamer_if_custom_register (const gchar *name, tensor_if_custom func, void *data)
 Register the custom callback function. More...
 
int nnstreamer_if_custom_unregister (const gchar *name)
 Unregister the custom callback function. More...
 

Variables

G_BEGIN_DECLS typedef gboolean(* tensor_if_custom )(const GstTensorsInfo *info, const GstTensorMemory *input, void *user_data, gboolean *result)
 Calls the user defined conditions function. More...
 

Detailed Description

NNStreamer APIs for tensor_if custom condition.

GStreamer/NNStreamer Tensor-IF Copyright (C) 2020 Gichan Jang gicha.nosp@m.n2.j.nosp@m.ang@s.nosp@m.amsu.nosp@m.ng.co.nosp@m.m

Date
28 Oct 2020
See also
https://github.com/nnstreamer/nnstreamer
Author
Gichan Jang gicha.nosp@m.n2.j.nosp@m.ang@s.nosp@m.amsu.nosp@m.ng.co.nosp@m.m
Bug:
No known bugs except for NYI items

Definition in file tensor_if.h.

Function Documentation

◆ nnstreamer_if_custom_register()

int nnstreamer_if_custom_register ( const gchar *  name,
tensor_if_custom  func,
void *  data 
)

Register the custom callback function.

Parameters
[in]nameThe name of tensor_if custom callback function.
[in]funcThe custom condition function body
[in/out]data The internal data for the function
Returns
0 if success. -ERRNO if error.
Note
GstElementtensor_if_h can be get with gst_bin_get_by_name from the pipeline. e.g.,) pipeline description: ... ! tensor_if name=tif (... properties ...) ! ... GstElement *tensor_if_h = gst_bin_get_by_name (GST_BIN (pipeline), "tif");

Register the custom callback function.

Returns
0 if success. -ERRNO if error.

Definition at line 1023 of file gsttensor_if.c.

Here is the call graph for this function:

◆ nnstreamer_if_custom_unregister()

int nnstreamer_if_custom_unregister ( const gchar *  name)

Unregister the custom callback function.

Parameters
[in]nameThe registered name of tensor_if custom callback function.
Returns
0 if success. -ERRNO if error.

Unregister the custom callback function.

Returns
0 if success. -ERRNO if error.

Definition at line 1049 of file gsttensor_if.c.

Here is the call graph for this function:

Variable Documentation

◆ tensor_if_custom

G_BEGIN_DECLS typedef gboolean(* tensor_if_custom) (const GstTensorsInfo *info, const GstTensorMemory *input, void *user_data, gboolean *result)

Calls the user defined conditions function.

SECTION:element-tensor_if

How To for NNdevelopers:

Define the function in the app.

  1. Define struct, "tensor_if_custom", with the functions defined.
  2. Register the struct with "nnstreamer_if_custom_register" API.
  3. Construct the nnstreamer pipeline and execute it in the app.

Usage example of the tensor_if custom condition

// Define custom callback function describing the condition
gboolean tensor_if_custom_cb (const GstTensorsInfo *info,
const GstTensorMemory * input, gboolean * result) {
// Describe the conditions and pass the results
}
...
// Register custom callback function describing the condition
nnstreamer_if_custom_register ("tifx", tensor_if_custom_cb, NULL);
...
// Use the condition in a pipeline.
// E.g., Pipeline of " ... ! tensor_if compared-value=CUSTOM compared-value-option=tifx then=TENSORPICK then-option=0 else=TENSORPICK else-option=1 ! ... "
...
// After everything is done.
Parameters
[in]infoinput tensors info
[in]inputmemory containing input tensor data
[in]user_dataprivate data for the callback
[out]resultresult of the user defined condition
Returns
TRUE if there is no error.

Definition at line 63 of file tensor_if.h.

result
case tensor_data_s gboolean * result
Definition: gsttensor_if.c:839
GstTensorsInfo
Internal meta data exchange format for a other/tensors instance.
Definition: tensor_typedef.h:273
nnstreamer_if_custom_unregister
int nnstreamer_if_custom_unregister(const gchar *name)
Unregisters a callback for tensor_if custom condition.
Definition: gsttensor_if.c:1049
GstTensorMemory
The unit of each data tensors. It will be used as an input/output tensor of other/tensors.
Definition: tensor_typedef.h:252