#include <gst/gstbuffer.h>
#include <gst/app/app.h> /* To push data to pipeline */
+#define DLOG_TAG "nnstreamer-capi-pipeline"
+
/**
* @brief Internal function to create a refereable element in a pipeline
*/
num_mems = gst_buffer_n_memory (b);
if (num_mems > NNS_TENSOR_SIZE_LIMIT) {
- dlog_print (DLOG_ERROR, "nnstreamer-capi-pipeline",
+ dlog_print (DLOG_ERROR, DLOG_TAG,
"Number of memory chunks in a GstBuffer exceed the limit: %u > %u",
num_mems, NNS_TENSOR_SIZE_LIMIT);
return;
elem->size = 0;
if (elem->tensorsinfo.num_tensors != num_mems) {
- dlog_print (DLOG_ERROR, "nnstreamer-capi-pipeline",
+ dlog_print (DLOG_ERROR, DLOG_TAG,
"The sink event of [%s] cannot be handled because the tensor type mismatches.",
elem->name);
gst_caps_unref (caps);
size_t sz = gst_tensor_info_get_size (&elem->tensorsinfo.info[i]);
if (sz != size[i]) {
- dlog_print (DLOG_ERROR, "nnstreamer-capi-pipeline",
+ dlog_print (DLOG_ERROR, DLOG_TAG,
"The sink event of [%s] cannot be handled because the tensor dimension mismatches.",
elem->name);
gst_caps_unref (caps);
/* Get the data! */
if (gst_buffer_get_size (b) != total_size ||
(elem->size > 0 && total_size != elem->size)) {
- dlog_print (DLOG_ERROR, "nnstreamer-capi-pipeline",
+ dlog_print (DLOG_ERROR, DLOG_TAG,
"The buffersize mismatches. All the three values must be the same: %zu, %zu, %zu",
total_size, elem->size, gst_buffer_get_size (b));
g_mutex_unlock (&elem->lock);
if (FALSE == gst_init_check (NULL, NULL, &err)) {
if (err) {
- dlog_print (DLOG_ERROR, "nnstreamer-capi-pipeline",
+ dlog_print (DLOG_ERROR, DLOG_TAG,
"Gstreamer has the following error: %s", err->message);
g_error_free (err);
} else {
- dlog_print (DLOG_ERROR, "nnstreamer-capi-pipeline",
+ dlog_print (DLOG_ERROR, DLOG_TAG,
"Cannot initialize gstreamer. Unknown reason.");
}
return NNS_ERROR_PIPELINE_FAIL;
pipeline = gst_parse_launch (pipeline_description, &err);
if (pipeline == NULL) {
if (err) {
- dlog_print (DLOG_ERROR, "nnstreamer-capi-pipeline",
+ dlog_print (DLOG_ERROR, DLOG_TAG,
"Cannot parse and launch the given pipeline = [%s], %s",
pipeline_description, err->message);
g_error_free (err);
} else {
- dlog_print (DLOG_ERROR, "nnstreamer-capi-pipeline",
+ dlog_print (DLOG_ERROR, DLOG_TAG,
"Cannot parse and launch the given pipeline = [%s], unknown reason",
pipeline_description);
}
break;
case GST_ITERATOR_RESYNC:
case GST_ITERATOR_ERROR:
- dlog_print (DLOG_WARN, "nnstreamer-capi-pipeline",
+ dlog_print (DLOG_WARN, DLOG_TAG,
"There is an error or a resync-event while inspecting a pipeline. However, we can still execute the pipeline.");
case GST_ITERATOR_DONE:
done = TRUE;
int ret = NNS_ERROR_NONE;
if (pipe == NULL) {
- dlog_print (DLOG_ERROR, "nnstreamer-capi-pipeline",
+ dlog_print (DLOG_ERROR, DLOG_TAG,
"The first argument, pipeline handle is not valid.");
return NNS_ERROR_INVALID_PARAMETER;
}
if (cb == NULL) {
- dlog_print (DLOG_ERROR, "nnstreamer-capi-pipeline",
+ dlog_print (DLOG_ERROR, DLOG_TAG,
"The callback argument, cb, is not valid.");
return NNS_ERROR_INVALID_PARAMETER;
}
elem = g_hash_table_lookup (p->namednodes, sinkname);
if (elem == NULL) {
- dlog_print (DLOG_ERROR, "nnstreamer-capi-pipeline",
+ dlog_print (DLOG_ERROR, DLOG_TAG,
"There is no element named [%s] in the pipeline.", sinkname);
ret = NNS_ERROR_INVALID_PARAMETER;
goto unlock_return;
}
if (elem->type != NNSAPI_SINK) {
- dlog_print (DLOG_ERROR, "nnstreamer-capi-pipeline",
+ dlog_print (DLOG_ERROR, DLOG_TAG,
"The element [%s] in the pipeline is not a tensor_sink.", sinkname);
ret = NNS_ERROR_INVALID_PARAMETER;
goto unlock_return;
int ret = NNS_ERROR_NONE;
if (h == NULL) {
- dlog_print (DLOG_ERROR, "nnstreamer-capi-pipeline",
+ dlog_print (DLOG_ERROR, DLOG_TAG,
"The handle to be unregistered is invalid");
return NNS_ERROR_INVALID_PARAMETER;
}
elem = sink->element;
if (p == NULL || elem == NULL || p != elem->pipe) {
- dlog_print (DLOG_ERROR, "nnstreamer-capi-pipeline",
- "The handle appears to be broken.");
+ dlog_print (DLOG_ERROR, DLOG_TAG, "The handle appears to be broken.");
return NNS_ERROR_INVALID_PARAMETER;
}
g_mutex_lock (&elem->lock);
if (NULL == g_list_find (elem->handles, sink)) {
- dlog_print (DLOG_ERROR, "nnstreamer-capi-pipeline",
- "The handle does not exists.");
+ dlog_print (DLOG_ERROR, DLOG_TAG, "The handle does not exists.");
ret = NNS_ERROR_INVALID_PARAMETER;
goto unlock_return;
}
int ret = NNS_ERROR_NONE;
if (pipe == NULL) {
- dlog_print (DLOG_ERROR, "nnstreamer-capi-pipeline",
+ dlog_print (DLOG_ERROR, DLOG_TAG,
"The first argument, pipeline handle is not valid.");
return NNS_ERROR_INVALID_PARAMETER;
}
elem = g_hash_table_lookup (p->namednodes, srcname);
if (elem == NULL) {
- dlog_print (DLOG_ERROR, "nnstreamer-capi-pipeline",
+ dlog_print (DLOG_ERROR, DLOG_TAG,
"There is no element named [%s] in the pipeline.", srcname);
ret = NNS_ERROR_INVALID_PARAMETER;
goto unlock_return;
}
if (elem->type != NNSAPI_SRC) {
- dlog_print (DLOG_ERROR, "nnstreamer-capi-pipeline",
+ dlog_print (DLOG_ERROR, DLOG_TAG,
"The element [%s] in the pipeline is not a tensor_src.", srcname);
ret = NNS_ERROR_INVALID_PARAMETER;
goto unlock_return;
int ret = NNS_ERROR_NONE;
if (h == NULL) {
- dlog_print (DLOG_ERROR, "nnstreamer-capi-pieline",
- "The handle to be put is invalid");
+ dlog_print (DLOG_ERROR, DLOG_TAG, "The handle to be put is invalid");
return NNS_ERROR_INVALID_PARAMETER;
}
elem = src->element;
if (p == NULL || elem == NULL || p != elem->pipe) {
- dlog_print (DLOG_ERROR, "nnstreamer-capi-pipeline",
- "The handle appears to be broken.");
+ dlog_print (DLOG_ERROR, DLOG_TAG, "The handle appears to be broken.");
return NNS_ERROR_INVALID_PARAMETER;
}
g_mutex_lock (&elem->lock);
if (NULL == g_list_find (elem->handles, src)) {
- dlog_print (DLOG_ERROR, "nnstreamer-capi-pipeline",
- "The handle does not exists.");
+ dlog_print (DLOG_ERROR, DLOG_TAG, "The handle does not exists.");
ret = NNS_ERROR_INVALID_PARAMETER;
goto unlock_return;
}
unsigned int i;
if (h == NULL) {
- dlog_print (DLOG_ERROR, "nnstreamer-capi-pieline",
- "The handle to be put is invalid");
+ dlog_print (DLOG_ERROR, DLOG_TAG, "The handle to be put is invalid");
return NNS_ERROR_INVALID_PARAMETER;
}
if (num_tensors < 1 || num_tensors > NNS_TENSOR_SIZE_LIMIT) {
- dlog_print (DLOG_ERROR, "nnstreamer-capi-pieline",
+ dlog_print (DLOG_ERROR, DLOG_TAG,
"The tensor size if invalid. It should be 1 ~ %u; where it is %u",
NNS_TENSOR_SIZE_LIMIT, num_tensors);
return NNS_ERROR_INVALID_PARAMETER;
elem = src->element;
if (p == NULL || elem == NULL || p != elem->pipe) {
- dlog_print (DLOG_ERROR, "nnstreamer-capi-pipeline",
- "The handle appears to be broken.");
+ dlog_print (DLOG_ERROR, DLOG_TAG, "The handle appears to be broken.");
return NNS_ERROR_INVALID_PARAMETER;
}
elem->size = 0;
if (elem->tensorsinfo.num_tensors != num_tensors) {
- dlog_print (DLOG_ERROR, "nnstreamer-capi-pipeline",
+ dlog_print (DLOG_ERROR, DLOG_TAG,
"The src push of [%s] cannot be handled because the number of tensors in a frame mismatches. %u != %u",
elem->name, elem->tensorsinfo.num_tensors, num_tensors);
gst_caps_unref (caps);
size_t sz = gst_tensor_info_get_size (&elem->tensorsinfo.info[i]);
if (sz != size[i]) {
- dlog_print (DLOG_ERROR, "nnstreamer-capi-pipeline",
+ dlog_print (DLOG_ERROR, DLOG_TAG,
"The sink event of [%s] cannot be handled because the tensor dimension mismatches.",
elem->name);
gst_caps_unref (caps);
elem->size += sz;
if (sz != size[i]) {
- dlog_print (DLOG_ERROR, "nnstreamer-capi-pipeline",
+ dlog_print (DLOG_ERROR, DLOG_TAG,
"The given input tensor size (%d'th, %zu bytes) mismatches the source pad (%zu bytes)",
i, size[i], sz);
gst_caps_unref (caps);
}
if (elem->size == 0) {
- dlog_print (DLOG_WARN, "nnstreamer-capi-pipeline",
+ dlog_print (DLOG_WARN, DLOG_TAG,
"The pipeline is not ready to accept inputs. The input is ignored.");
ret = NNS_ERROR_TRY_AGAIN;
goto unlock_return;
gret = gst_app_src_push_buffer (GST_APP_SRC (elem->element), buffer);
if (gret == GST_FLOW_FLUSHING) {
- dlog_print (DLOG_WARN, "nnstreamer-capi-pipeline",
+ dlog_print (DLOG_WARN, DLOG_TAG,
"The pipeline is not in PAUSED/PLAYING. The input may be ignored.");
ret = NNS_ERROR_TRY_AGAIN;
} else if (gret == GST_FLOW_EOS) {
- dlog_print (DLOG_WARN, "nnstreamer-capi-pipeline",
+ dlog_print (DLOG_WARN, DLOG_TAG,
"THe pipeline is in EOS state. The input is ignored.");
ret = NNS_ERROR_PIPELINE_FAIL;
}
int ret = NNS_ERROR_NONE;
if (pipe == NULL) {
- dlog_print (DLOG_ERROR, "nnstreamer-capi-pipeline",
+ dlog_print (DLOG_ERROR, DLOG_TAG,
"The first argument, pipeline handle, is not valid.");
return NNS_ERROR_INVALID_PARAMETER;
}
if (switchname == NULL) {
- dlog_print (DLOG_ERROR, "nnstreamer-capi-pipeline",
+ dlog_print (DLOG_ERROR, DLOG_TAG,
"The second argument, switchname, is not valid.");
return NNS_ERROR_INVALID_PARAMETER;
}
elem = g_hash_table_lookup (p->namednodes, switchname);
if (elem == NULL) {
- dlog_print (DLOG_ERROR, "nnstreamer-capi-pipeline",
+ dlog_print (DLOG_ERROR, DLOG_TAG,
"There is no switch element named [%s] in the pipeline.", switchname);
ret = NNS_ERROR_INVALID_PARAMETER;
goto unlock_return;
}
if (elem->type != NNSAPI_SWITCH_INPUT && elem->type != NNSAPI_SWITCH_OUTPUT) {
- dlog_print (DLOG_ERROR, "nnstreamer-capi-pipeline",
+ dlog_print (DLOG_ERROR, DLOG_TAG,
"There is an element named [%s] in the pipeline, but it is not an input/output switch",
switchname);
ret = NNS_ERROR_INVALID_PARAMETER;
else if (elem->type == NNSAPI_SWITCH_OUTPUT)
*type = NNS_SWITCH_OUTPUTSELECTOR;
else {
- dlog_print (DLOG_ERROR, "nnstreamer-capi-pipeline",
+ dlog_print (DLOG_ERROR, DLOG_TAG,
"Internal data of switch-handle [%s] is broken. It is fatal.",
elem->name);
ret = NNS_ERROR_INVALID_PARAMETER;
element *elem; \
int ret = NNS_ERROR_NONE; \
if (h == NULL) { \
- dlog_print (DLOG_ERROR, "nnstreamer-capi-pipeline", \
+ dlog_print (DLOG_ERROR, DLOG_TAG, \
"The handle to be unregistered is invalid"); \
return NNS_ERROR_INVALID_PARAMETER; \
} \
p = name->pipe; \
elem = name->element; \
if (p == NULL || elem == NULL || p != elem->pipe) { \
- dlog_print (DLOG_ERROR, "nnstreamer-capi-pipeline", \
+ dlog_print (DLOG_ERROR, DLOG_TAG, \
"The handle appears to be broken."); \
return NNS_ERROR_INVALID_PARAMETER; \
} \
g_mutex_lock (&elem->lock); \
\
if (NULL == g_list_find (elem->handles, name)) { \
- dlog_print (DLOG_ERROR, "nnstreamer-capi-pipeline", \
+ dlog_print (DLOG_ERROR, DLOG_TAG, \
"The handle does not exists."); \
ret = NNS_ERROR_INVALID_PARAMETER; \
goto unlock_return; \
active_name = gst_pad_get_name (active_pad);
if (!g_strcmp0 (padname, active_name)) {
- dlog_print (DLOG_INFO, "nnstreamer-capi-pipeline",
+ dlog_print (DLOG_INFO, DLOG_TAG,
"Switch is called, but there is no effective changes: %s->%s.",
active_name, padname);
g_free (active_name);
new_pad = gst_element_get_static_pad (elem->element, padname);
if (new_pad == NULL) {
/* Not Found! */
- dlog_print (DLOG_ERROR, "nnstreamer-capi-pipeline",
+ dlog_print (DLOG_ERROR, DLOG_TAG,
"Cannot find the pad, [%s], from the switch, [%s].",
padname, elem->name);
ret = NNS_ERROR_INVALID_PARAMETER;
g_object_set (G_OBJECT (elem->element), "active-pad", new_pad, NULL);
gst_object_unref (new_pad);
- dlog_print (DLOG_INFO, "nnstreamer-capi-pipeline",
+ dlog_print (DLOG_INFO, DLOG_TAG,
"Switched to [%s] successfully at switch [%s].", padname, elem->name);
handle_exit (h);
else if (elem->type == NNSAPI_SWITCH_OUTPUT)
it = gst_element_iterate_src_pads (elem->element);
else {
- dlog_print (DLOG_ERROR, "nnstreamer-capi-pipeline",
+ dlog_print (DLOG_ERROR, DLOG_TAG,
"The element, [%s], is supposed to be input/output switch, but it is not. Internal data structure is broken.",
elem->name);
ret = NNS_ERROR_PIPELINE_FAIL;
gst_iterator_resync (it);
break;
case GST_ITERATOR_ERROR:
- dlog_print (DLOG_ERROR, "nnstreamer-capi-pipeline",
+ dlog_print (DLOG_ERROR, DLOG_TAG,
"Cannot access the list of pad properly of a switch, [%s].",
elem->name);
ret = NNS_ERROR_PIPELINE_FAIL;
g_list_free_full (dllist, g_free); /* This frees all strings as well */
g_free (list);
- dlog_print (DLOG_ERROR, "nnstreamer-capi-pipeline",
+ dlog_print (DLOG_ERROR, DLOG_TAG,
"Internal data inconsistency. This could be a bug in nnstreamer. Switch [%s].",
elem->name);
ret = NNS_ERROR_PIPELINE_FAIL;
int ret = NNS_ERROR_NONE;
if (pipe == NULL) {
- dlog_print (DLOG_ERROR, "nnstreamer-capi-pipeline",
+ dlog_print (DLOG_ERROR, DLOG_TAG,
"The first argument, pipeline handle, is not valid.");
return NNS_ERROR_INVALID_PARAMETER;
}
if (valvename == NULL) {
- dlog_print (DLOG_ERROR, "nnstreamer-capi-pipeline",
+ dlog_print (DLOG_ERROR, DLOG_TAG,
"The second argument, valvename, is not valid.");
return NNS_ERROR_INVALID_PARAMETER;
}
elem = g_hash_table_lookup (p->namednodes, valvename);
if (elem == NULL) {
- dlog_print (DLOG_ERROR, "nnstreamer-capi-pipeline",
+ dlog_print (DLOG_ERROR, DLOG_TAG,
"There is no valve element named [%s] in the pipeline.", valvename);
ret = NNS_ERROR_INVALID_PARAMETER;
goto unlock_return;
}
if (elem->type != NNSAPI_VALVE) {
- dlog_print (DLOG_ERROR, "nnstreamer-capi-pipeline",
+ dlog_print (DLOG_ERROR, DLOG_TAG,
"There is an element named [%s] in the pipeline, but it is not a valve",
valvename);
ret = NNS_ERROR_INVALID_PARAMETER;
if ((valve_drop != 0) == (drop != FALSE)) {
/* Nothing to do */
- dlog_print (DLOG_INFO, "nnstreamer-capi-pipeline",
+ dlog_print (DLOG_INFO, DLOG_TAG,
"Valve is called, but there is no effective changes: %d->%d",
! !drop, ! !valve_drop);
goto unlock_return;
}
g_object_set (G_OBJECT (elem->element), "drop", ! !valve_drop, NULL);
- dlog_print (DLOG_INFO, "nnstreamer-capi-pipeline",
+ dlog_print (DLOG_INFO, DLOG_TAG,
"Valve is changed: %d->%d", ! !drop, ! !valve_drop);
handle_exit (h);