#include <stdio.h>
#ifndef DBG
-#define DBG TRUE
+#define DBG FALSE
#endif
#define _print_log(...) if (DBG) g_message(__VA_ARGS__)
GstTensorRepo _repo = {.num_data = 0,.initialized = FALSE };
/**
- * @brief getter to get nth GstTensorData
+ * @brief getter to get nth GstTensorRepoData
*/
-GstTensorData *
-gst_tensor_repo_get_tensor (guint nth)
+GstTensorRepoData *
+gst_tensor_repo_get_repodata (guint nth)
{
- GstTensorData *data;
+ GstTensorRepoData *data;
gpointer *p = g_hash_table_lookup (_repo.hash, GINT_TO_POINTER (nth));
- data = (GstTensorData *) p;
+ data = (GstTensorRepoData *) p;
g_return_val_if_fail (data != NULL, NULL);
return data;
}
/**
- * @brief add GstTensorData into repo
+ * @brief add GstTensorRepoData into repo
*/
gboolean
-gst_tensor_repo_add_data (guint nth)
+gst_tensor_repo_add_repodata (guint nth)
{
gboolean ret = FALSE;
- GstTensorData *new;
+ GstTensorRepoData *new;
GST_REPO_LOCK ();
gpointer *check = g_hash_table_lookup (_repo.hash, GINT_TO_POINTER (nth));
return TRUE;
}
- new = g_new (GstTensorData, 1);
+ new = g_new (GstTensorRepoData, 1);
new->eos = FALSE;
new->buffer = NULL;
g_cond_init (&new->cond);
{
GST_TENSOR_REPO_LOCK (nth);
- GstTensorData *data = gst_tensor_repo_get_tensor (nth);
+ GstTensorRepoData *data = gst_tensor_repo_get_repodata (nth);
g_return_val_if_fail (data != NULL, FALSE);
data->buffer = buffer;
gboolean
gst_tensor_repo_check_eos (guint nth)
{
- GstTensorData *data = gst_tensor_repo_get_tensor (nth);
+ GstTensorRepoData *data = gst_tensor_repo_get_repodata (nth);
if (data == NULL || data->eos) {
_print_log ("check eos done [%s]\n", data->eos ? "TRUE" : "FALSE");
}
gst_tensor_repo_set_eos (guint nth)
{
GST_TENSOR_REPO_LOCK (nth);
- GstTensorData *data = gst_tensor_repo_get_tensor (nth);
+ GstTensorRepoData *data = gst_tensor_repo_get_repodata (nth);
data->eos = TRUE;
if (data->buffer)
gst_buffer_unref (data->buffer);
/**
- * @brief get GstTensorData from repo
+ * @brief get GstTensorRepoData from repo
*/
GstBuffer *
gst_tensor_repo_get_buffer (guint nth)
{
- GstTensorData *current_data;
+ GstTensorRepoData *current_data;
GstBuffer *buf;
gboolean eos = FALSE;
- current_data = gst_tensor_repo_get_tensor (nth);
+ current_data = gst_tensor_repo_get_repodata (nth);
GST_TENSOR_REPO_LOCK (nth);
while (!current_data->buffer) {
if (gst_tensor_repo_check_eos (nth)) {
}
/**
- * @brief remove nth GstTensorData from GstTensorRepo
+ * @brief remove nth GstTensorRepoData from GstTensorRepo
*/
gboolean
-gst_tensor_repo_remove_data (guint nth)
+gst_tensor_repo_remove_repodata (guint nth)
{
gboolean ret;
printf ("removeing .... \n");
/**
* @brief GstTensorRepo internal data structure.
*
- * GstTensorRepo has GSlist of GstTensorData.
+ * GstTensorRepo has GSlist of GstTensorRepoData.
*
*/
GCond cond;
GMutex lock;
gboolean eos;
-} GstTensorData;
+} GstTensorRepoData;
/**
* @brief GstTensorRepo data structure.
} GstTensorRepo;
/**
- * @brief getter to get nth GstTensorData
+ * @brief getter to get nth GstTensorRepoData
*/
-GstTensorData *
-gst_tensor_repo_get_tensor (guint nth);
+GstTensorRepoData *
+gst_tensor_repo_get_repodata (guint nth);
/**
- * @brief add GstTensorData into repo
+ * @brief add GstTensorRepoData into repo
*/
/* guint */
gboolean
-gst_tensor_repo_add_data (guint myid);
+gst_tensor_repo_add_repodata (guint myid);
/**
* @brief push GstBuffer into repo
gst_tensor_repo_set_eos(guint nth);
/**
- * @brief Get GstTensorData from repo
+ * @brief Get GstTensorRepoData from repo
*/
GstBuffer *
gst_tensor_repo_get_buffer (guint nth);
/**
- * @brief remove nth GstTensorData from GstTensorRepo
+ * @brief remove nth GstTensorRepoData from GstTensorRepo
*/
gboolean
-gst_tensor_repo_remove_data (guint nth);
+gst_tensor_repo_remove_repodata (guint nth);
/**
* @brief GstTensorRepo initialization
/**
* @brief Macro for Lock & Cond
*/
-#define GST_TENSOR_REPO_GET_LOCK(id) (&((GstTensorData*)(gst_tensor_repo_get_tensor(id)))->lock)
-#define GST_TENSOR_REPO_GET_COND(id) (&((GstTensorData*)(gst_tensor_repo_get_tensor(id)))->cond)
+#define GST_TENSOR_REPO_GET_LOCK(id) (&((GstTensorRepoData*)(gst_tensor_repo_get_repodata(id)))->lock)
+#define GST_TENSOR_REPO_GET_COND(id) (&((GstTensorRepoData*)(gst_tensor_repo_get_repodata(id)))->cond)
#define GST_TENSOR_REPO_LOCK(id) (g_mutex_lock(GST_TENSOR_REPO_GET_LOCK(id)))
#define GST_TENSOR_REPO_UNLOCK(id) (g_mutex_unlock(GST_TENSOR_REPO_GET_LOCK(id)))
#define GST_TENSOR_REPO_WAIT(id) (g_cond_wait(GST_TENSOR_REPO_GET_COND(id), GST_TENSOR_REPO_GET_LOCK(id)))