* @retval #ML_ERROR_NONE Successful
* @retval #ML_ERROR_INVALID_PARAMETER Fail. The parameter is invalid.
* @retval #ML_ERROR_STREAMS_PIPE Failed to start the pipeline.
- *
+ * @retval #ML_ERROR_NOT_SUPPORTED Fail. The parameter is not available.
*/
int ml_single_open (ml_single_h *single, const char *model, const ml_tensors_info_h input_info, const ml_tensors_info_h output_info, ml_nnfw_type_e nnfw, ml_nnfw_hw_e hw);
g_mutex_lock (&p->lock);
+ /* Before changing the state, remove all callbacks. */
+ p->cb = NULL;
+ g_signal_handler_disconnect (p->bus, p->signal_msg);
+ gst_object_unref (p->bus);
+
+ g_hash_table_remove_all (p->namednodes);
+
/* if it's PLAYING, PAUSE it. */
scret = gst_element_get_state (p->element, &state, NULL, 10 * GST_MSECOND); /* 10ms */
if (scret != GST_STATE_CHANGE_FAILURE && state == GST_STATE_PLAYING) {
g_usleep (50000); /* do 50ms sleep until we have it implemented. Let them complete. And hope they don't call start(). */
g_mutex_lock (&p->lock);
- g_signal_handler_disconnect (p->bus, p->signal_msg);
- gst_object_unref (p->bus);
-
/** Destroy registered callback handles */
g_hash_table_destroy (p->namednodes);
+ p->namednodes = NULL;
/** Stop (NULL State) the pipeline */
scret = gst_element_set_state (p->element, GST_STATE_NULL);
/* 2. Determine hw */
/** @todo Now the param hw is ignored. (Supposed CPU only) Support others later. */
status = ml_check_nnfw_availability (nnfw, hw, &available);
- if (status != ML_ERROR_NONE || !available) {
- ml_loge ("The given nnfw is not available.");
+ if (status != ML_ERROR_NONE)
return status;
+
+ if (!available) {
+ ml_loge ("The given nnfw is not available.");
+ return ML_ERROR_NOT_SUPPORTED;
}
/* 3. Construct a pipeline */