Doxygen Book
tensor_meta.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 <nnstreamer_util.h>
18 #include "tensor_meta.h"
19 
23 GType
25 {
26  static GType type = 0;
27  static const gchar *tags[] = {
28  NULL
29  };
30 
31  if (g_once_init_enter (&type)) {
32  GType _type;
33  const GstMetaInfo *meta_info = gst_meta_get_info ("GstMetaQuery");
34  if (meta_info) {
35  _type = meta_info->api;
36  } else {
37  _type = gst_meta_api_type_register ("GstMetaQueryAPI", tags);
38  }
39  g_once_init_leave (&type, _type);
40  }
41  return type;
42 }
43 
47 static gboolean
48 gst_meta_query_init (GstMeta * meta, gpointer params, GstBuffer * buffer)
49 {
50  GstMetaQuery *emeta = (GstMetaQuery *) meta;
51  UNUSED (params);
52  UNUSED (buffer);
53  emeta->client_id = 0;
54  return TRUE;
55 }
56 
60 static void
61 gst_meta_query_free (GstMeta * meta, GstBuffer * buffer)
62 {
63  UNUSED (meta);
64  UNUSED (buffer);
65 }
66 
70 static gboolean
71 gst_meta_query_transform (GstBuffer * transbuf, GstMeta * meta,
72  GstBuffer * buffer, GQuark type, gpointer data)
73 {
74  GstMetaQuery *dest_meta = gst_buffer_add_meta_query (transbuf);
75  GstMetaQuery *src_meta = (GstMetaQuery *) meta;
76  UNUSED (buffer);
77  UNUSED (type);
78  UNUSED (data);
79  dest_meta->client_id = src_meta->client_id;
80  return TRUE;
81 }
82 
86 const GstMetaInfo *
88 {
89  static const GstMetaInfo *meta_query_info = NULL;
90 
91  if (g_once_init_enter (&meta_query_info)) {
92  const GstMetaInfo *meta = gst_meta_register (GST_META_QUERY_API_TYPE,
93  "GstMetaQuery", sizeof *meta,
97  g_once_init_leave (&meta_query_info, meta);
98  }
99  return meta_query_info;
100 }
data
svtc_1 data
Definition: gsttensor_if.c:844
GST_META_QUERY_API_TYPE
#define GST_META_QUERY_API_TYPE
Definition: tensor_meta.h:37
GstMetaQuery::client_id
query_client_id_t client_id
Definition: tensor_meta.h:30
gst_meta_query_get_info
const GstMetaInfo * gst_meta_query_get_info(void)
Get meta_query info.
Definition: tensor_meta.c:87
GstMetaQuery
GstMetaQuery meta structure.
Definition: tensor_meta.h:26
tensor_meta.h
Internal tensor meta header for nnstreamer.
gst_meta_query_transform
static gboolean gst_meta_query_transform(GstBuffer *transbuf, GstMeta *meta, GstBuffer *buffer, GQuark type, gpointer data)
tensor_query meta data transform (source to dest)
Definition: tensor_meta.c:71
gst_meta_query_api_get_type
GType gst_meta_query_api_get_type(void)
Define meta_query type to register.
Definition: tensor_meta.c:24
gst_meta_query_free
static void gst_meta_query_free(GstMeta *meta, GstBuffer *buffer)
free meta_query
Definition: tensor_meta.c:61
gst_buffer_add_meta_query
#define gst_buffer_add_meta_query(b)
Definition: tensor_meta.h:46
TRUE
return TRUE
Definition: gsttensor_if.c:897
UNUSED
#define UNUSED(expr)
Definition: mqttcommon.h:19
nnstreamer_util.h
Optional NNStreamer utility functions for sub-plugin writers and users.
gst_meta_query_init
static gboolean gst_meta_query_init(GstMeta *meta, gpointer params, GstBuffer *buffer)
meta_query init
Definition: tensor_meta.c:48
type
svtc_1 type
Definition: gsttensor_if.c:843