Doxygen Book
nnstreamer_plugin_api.h File Reference

Optional/Additional NNStreamer APIs for sub-plugin writers. (Need Gst devel) More...

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

Go to the source code of this file.

Functions

G_BEGIN_DECLS gboolean gst_structure_is_tensor_stream (const GstStructure *structure)
 Check given mimetype is tensor stream. More...
 
media_type gst_structure_get_media_type (const GstStructure *structure)
 Get media type from structure. More...
 
gboolean gst_tensors_config_from_structure (GstTensorsConfig *config, const GstStructure *structure)
 Parse structure and set tensors config (for other/tensors) More...
 
gboolean gst_tensors_config_from_peer (GstPad *pad, GstTensorsConfig *config, gboolean *is_fixed)
 Parse caps from peer pad and set tensors config. More...
 
GstCaps * gst_tensor_caps_from_config (const GstTensorsConfig *config)
 Get tensor caps from tensors config (for other/tensor) More...
 
GstCaps * gst_tensors_caps_from_config (const GstTensorsConfig *config)
 Get caps from tensors config (for other/tensors) More...
 
void gst_tensor_alloc_init (gsize alignment)
 set alignment that default allocator would align to More...
 
gboolean gst_tensor_meta_info_parse_memory (GstTensorMetaInfo *meta, GstMemory *mem)
 Parse memory and fill the tensor meta. More...
 
GstMemory * gst_tensor_meta_info_append_header (GstTensorMetaInfo *meta, GstMemory *mem)
 Append header to memory. More...
 
void gst_tensor_caps_update_dimension (GstCaps *caps, GstCaps *filter)
 Update caps dimension for negotiation. More...
 
gboolean gst_tensor_caps_can_intersect (GstCaps *caps1, GstCaps *caps2)
 Try intersecting @caps1 and @caps2 for tensor stream. More...
 
GstMemory * gst_tensor_buffer_get_nth_memory (GstBuffer *buffer, const guint index)
 Get the nth GstMemory from given buffer. More...
 
gboolean gst_tensor_buffer_append_memory (GstBuffer *buffer, GstMemory *memory, const GstTensorInfo *info)
 Append memory to given buffer. More...
 
guint gst_tensor_buffer_get_count (GstBuffer *buffer)
 Get the number of tensors in the buffer. More...
 

Detailed Description

Optional/Additional NNStreamer APIs for sub-plugin writers. (Need Gst devel)

NNStreamer Common API Header for Plug-Ins Copyright (C) 2019 MyungJoo Ham myung.nosp@m.joo..nosp@m.ham@s.nosp@m.amsu.nosp@m.ng.co.nosp@m.m Copyright (C) 2019 Wook Song wook1.nosp@m.6.so.nosp@m.ng@sa.nosp@m.msun.nosp@m.g.com

Date
24 Jan 2019
See also
https://github.com/nnstreamer/nnstreamer
Author
MyungJoo Ham myung.nosp@m.joo..nosp@m.ham@s.nosp@m.amsu.nosp@m.ng.co.nosp@m.m and Wook Song wook1.nosp@m.6.so.nosp@m.ng@sa.nosp@m.msun.nosp@m.g.com
Bug:
No known bugs except for NYI items

Definition in file nnstreamer_plugin_api.h.

Function Documentation

◆ gst_structure_get_media_type()

media_type gst_structure_get_media_type ( const GstStructure *  structure)

Get media type from structure.

Parameters
structurestructure to be interpreted
Returns
corresponding media type (returns _NNS_MEDIA_INVALID for unsupported type)

Definition at line 1001 of file nnstreamer_plugin_api_impl.c.

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

◆ gst_structure_is_tensor_stream()

G_BEGIN_DECLS gboolean gst_structure_is_tensor_stream ( const GstStructure *  structure)

Check given mimetype is tensor stream.

Parameters
structurestructure to be interpreted
Returns
TRUE if mimetype is tensor stream

Definition at line 984 of file nnstreamer_plugin_api_impl.c.

Here is the caller graph for this function:

◆ gst_tensor_alloc_init()

void gst_tensor_alloc_init ( gsize  alignment)

set alignment that default allocator would align to

Parameters
alignmentbytes of alignment

Definition at line 109 of file tensor_allocator.c.

Here is the call graph for this function:

◆ gst_tensor_buffer_append_memory()

gboolean gst_tensor_buffer_append_memory ( GstBuffer *  buffer,
GstMemory *  memory,
const GstTensorInfo info 
)

Append memory to given buffer.

Parameters
[in/out]buffer GstBuffer to be appended.
[in]memoryGstMemory to append. This function takes ownership of this, even if it returns failure.
[in]infoGstTensorInfo of given memory.
Returns
TRUE if successfully appended, otherwise FALSE.

Free the name string, cause it does not freed by gstreamer.

Todo:
Make custom gst_allocator later?

Definition at line 1666 of file nnstreamer_plugin_api_impl.c.

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

◆ gst_tensor_buffer_get_count()

guint gst_tensor_buffer_get_count ( GstBuffer *  buffer)

Get the number of tensors in the buffer.

Definition at line 1813 of file nnstreamer_plugin_api_impl.c.

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

◆ 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.

Parameters
[in]bufferGstBuffer to be parsed.
[in]indexIndex of GstMemory to be returned.
Returns
GstMemory if found, otherwise NULL (Caller should free returned memory using gst_memory_unref()).

Definition at line 1586 of file nnstreamer_plugin_api_impl.c.

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

◆ gst_tensor_caps_can_intersect()

gboolean gst_tensor_caps_can_intersect ( GstCaps *  caps1,
GstCaps *  caps2 
)

Try intersecting @caps1 and @caps2 for tensor stream.

Parameters
caps1a GstCaps to intersect
caps2a GstCaps to intersect
Returns
TRUE if intersection would be not empty.

Definition at line 1142 of file nnstreamer_plugin_api_impl.c.

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

◆ gst_tensor_caps_from_config()

GstCaps* gst_tensor_caps_from_config ( const GstTensorsConfig config)

Get tensor caps from tensors config (for other/tensor)

Parameters
configtensors config info
Returns
caps for given config

Get tensor caps from tensors config (for other/tensor)

Parameters
configtensors config info
Returns
caps for given config

Definition at line 1395 of file nnstreamer_plugin_api_impl.c.

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

◆ gst_tensor_caps_update_dimension()

void gst_tensor_caps_update_dimension ( GstCaps *  caps,
GstCaps *  filter 
)

Update caps dimension for negotiation.

Parameters
capscaps to compare and update
filtercaps to compare

Update caps dimension for negotiation.

Parameters
capscaps to compare and update
filtercaps to compare

Definition at line 1093 of file nnstreamer_plugin_api_impl.c.

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

◆ gst_tensor_meta_info_append_header()

GstMemory* gst_tensor_meta_info_append_header ( GstTensorMetaInfo meta,
GstMemory *  mem 
)

Append header to memory.

Parameters
[in]metatensor meta structure
[in]mempointer to GstMemory
Returns
Newly allocated GstMemory (Caller should free returned memory using gst_memory_unref())

Definition at line 1544 of file nnstreamer_plugin_api_impl.c.

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

◆ gst_tensor_meta_info_parse_memory()

gboolean gst_tensor_meta_info_parse_memory ( GstTensorMetaInfo meta,
GstMemory *  mem 
)

Parse memory and fill the tensor meta.

Parameters
[out]metatensor meta structure to be filled
[in]mempointer to GstMemory to be parsed
Returns
TRUE if successfully set the meta

Definition at line 1509 of file nnstreamer_plugin_api_impl.c.

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

◆ gst_tensors_caps_from_config()

GstCaps* gst_tensors_caps_from_config ( const GstTensorsConfig config)

Get caps from tensors config (for other/tensors)

Parameters
configtensors config info
Returns
caps for given config

Definition at line 1372 of file nnstreamer_plugin_api_impl.c.

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

◆ gst_tensors_config_from_peer()

gboolean gst_tensors_config_from_peer ( GstPad *  pad,
GstTensorsConfig config,
gboolean *  is_fixed 
)

Parse caps from peer pad and set tensors config.

Parameters
padGstPad to get the capabilities
configtensors config structure to be filled
is_fixedflag to be updated when peer caps is fixed (not mandatory, do nothing when the param is null)
Returns
TRUE if successfully configured from peer

Definition at line 1041 of file nnstreamer_plugin_api_impl.c.

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

◆ gst_tensors_config_from_structure()

gboolean gst_tensors_config_from_structure ( GstTensorsConfig config,
const GstStructure *  structure 
)

Parse structure and set tensors config (for other/tensors)

Parameters
configtensors config structure to be filled
structurestructure to be interpreted
Returns
TRUE if no error

Definition at line 1413 of file nnstreamer_plugin_api_impl.c.

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