[Tizen/Api] change name prefix
authorJaeyun <jy1210.jung@samsung.com>
Wed, 5 Jun 2019 11:31:26 +0000 (20:31 +0900)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Sat, 8 Jun 2019 03:46:08 +0000 (12:46 +0900)
change function name and param prefix to ml

Signed-off-by: Jaeyun Jung <jy1210.jung@samsung.com>
tests/tizen_capi/unittest_tizen_capi.cpp
tizen-api/include/nnstreamer-single.h
tizen-api/include/nnstreamer.h
tizen-api/include/tizen-api-private.h
tizen-api/src/nnstreamer-single.c
tizen-api/src/tizen-api-pipeline.c

index 4404497..e03476c 100644 (file)
 TEST (nnstreamer_capi_construct_destruct, dummy_01)
 {
   const char *pipeline = "videotestsrc num_buffers=2 ! fakesink";
-  nns_pipeline_h handle;
-  int status = nns_pipeline_construct (pipeline, &handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  ml_pipeline_h handle;
+  int status = ml_pipeline_construct (pipeline, &handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
-  status = nns_pipeline_destroy (handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_destroy (handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 }
 
 /**
@@ -33,12 +33,12 @@ TEST (nnstreamer_capi_construct_destruct, dummy_01)
 TEST (nnstreamer_capi_construct_destruct, dummy_02)
 {
   const char *pipeline = "videotestsrc num_buffers=2 ! videoconvert ! videoscale ! video/x-raw,format=RGBx,width=224,height=224 ! tensor_converter ! fakesink";
-  nns_pipeline_h handle;
-  int status = nns_pipeline_construct (pipeline, &handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  ml_pipeline_h handle;
+  int status = ml_pipeline_construct (pipeline, &handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
-  status = nns_pipeline_destroy (handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_destroy (handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 }
 
 /**
@@ -47,12 +47,12 @@ TEST (nnstreamer_capi_construct_destruct, dummy_02)
 TEST (nnstreamer_capi_construct_destruct, dummy_03)
 {
   const char *pipeline = "videotestsrc num_buffers=2 ! videoconvert ! videoscale ! video/x-raw,format=RGBx,width=224,height=224 ! tensor_converter ! valve name=valvex ! tensor_sink name=sinkx";
-  nns_pipeline_h handle;
-  int status = nns_pipeline_construct (pipeline, &handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  ml_pipeline_h handle;
+  int status = ml_pipeline_construct (pipeline, &handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
-  status = nns_pipeline_destroy (handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_destroy (handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 }
 
 /**
@@ -61,9 +61,9 @@ TEST (nnstreamer_capi_construct_destruct, dummy_03)
 TEST (nnstreamer_capi_construct_destruct, failed_01)
 {
   const char *pipeline = "nonexistsrc ! fakesink";
-  nns_pipeline_h handle;
-  int status = nns_pipeline_construct (pipeline, &handle);
-  EXPECT_EQ (status, NNS_ERROR_STREAMS_PIPE);
+  ml_pipeline_h handle;
+  int status = ml_pipeline_construct (pipeline, &handle);
+  EXPECT_EQ (status, ML_ERROR_STREAMS_PIPE);
 }
 
 /**
@@ -72,9 +72,9 @@ TEST (nnstreamer_capi_construct_destruct, failed_01)
 TEST (nnstreamer_capi_construct_destruct, failed_02)
 {
   const char *pipeline = "videotestsrc num_buffers=2 ! audioconvert ! fakesink";
-  nns_pipeline_h handle;
-  int status = nns_pipeline_construct (pipeline, &handle);
-  EXPECT_EQ (status, NNS_ERROR_STREAMS_PIPE);
+  ml_pipeline_h handle;
+  int status = ml_pipeline_construct (pipeline, &handle);
+  EXPECT_EQ (status, ML_ERROR_STREAMS_PIPE);
 }
 
 /**
@@ -83,33 +83,33 @@ TEST (nnstreamer_capi_construct_destruct, failed_02)
 TEST (nnstreamer_capi_playstop, dummy_01)
 {
   const char *pipeline = "videotestsrc is-live=true num-buffers=30 ! videoconvert ! videoscale ! video/x-raw,format=RGBx,width=224,height=224,framerate=60/1 ! tensor_converter ! valve name=valvex ! valve name=valvey ! input-selector name=is01 ! tensor_sink name=sinkx";
-  nns_pipeline_h handle;
-  nns_pipeline_state_e state;
-  int status = nns_pipeline_construct (pipeline, &handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
-
-  status = nns_pipeline_start (handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
-  status = nns_pipeline_get_state (handle, &state);
-  EXPECT_EQ (status, NNS_ERROR_NONE); /* At this moment, it can be READY, PAUSED, or PLAYING */
-  EXPECT_NE (state, NNS_PIPELINE_STATE_UNKNOWN);
-  EXPECT_NE (state, NNS_PIPELINE_STATE_NULL);
+  ml_pipeline_h handle;
+  ml_pipeline_state_e state;
+  int status = ml_pipeline_construct (pipeline, &handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
+
+  status = ml_pipeline_start (handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
+  status = ml_pipeline_get_state (handle, &state);
+  EXPECT_EQ (status, ML_ERROR_NONE); /* At this moment, it can be READY, PAUSED, or PLAYING */
+  EXPECT_NE (state, ML_PIPELINE_STATE_UNKNOWN);
+  EXPECT_NE (state, ML_PIPELINE_STATE_NULL);
 
   g_usleep (50000); /* 50ms. Let a few frames flow. */
-  status = nns_pipeline_get_state (handle, &state);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
-  EXPECT_EQ (state, NNS_PIPELINE_STATE_PLAYING);
+  status = ml_pipeline_get_state (handle, &state);
+  EXPECT_EQ (status, ML_ERROR_NONE);
+  EXPECT_EQ (state, ML_PIPELINE_STATE_PLAYING);
 
-  status = nns_pipeline_stop (handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_stop (handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
   g_usleep (50000); /* 50ms. Let a few frames flow. */
 
-  status = nns_pipeline_get_state (handle, &state);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
-  EXPECT_EQ (state, NNS_PIPELINE_STATE_PAUSED);
+  status = ml_pipeline_get_state (handle, &state);
+  EXPECT_EQ (status, ML_ERROR_NONE);
+  EXPECT_EQ (state, ML_PIPELINE_STATE_PAUSED);
 
-  status = nns_pipeline_destroy (handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_destroy (handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 }
 
 
@@ -119,47 +119,47 @@ TEST (nnstreamer_capi_playstop, dummy_01)
 TEST (nnstreamer_capi_playstop, dummy_02)
 {
   const char *pipeline = "videotestsrc is-live=true num-buffers=30 ! videoconvert ! videoscale ! video/x-raw,format=RGBx,width=224,height=224,framerate=60/1 ! tensor_converter ! valve name=valvex ! valve name=valvey ! input-selector name=is01 ! tensor_sink name=sinkx";
-  nns_pipeline_h handle;
-  nns_pipeline_state_e state;
-  int status = nns_pipeline_construct (pipeline, &handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
-
-  status = nns_pipeline_start (handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
-  status = nns_pipeline_get_state (handle, &state);
-  EXPECT_EQ (status, NNS_ERROR_NONE); /* At this moment, it can be READY, PAUSED, or PLAYING */
-  EXPECT_NE (state, NNS_PIPELINE_STATE_UNKNOWN);
-  EXPECT_NE (state, NNS_PIPELINE_STATE_NULL);
+  ml_pipeline_h handle;
+  ml_pipeline_state_e state;
+  int status = ml_pipeline_construct (pipeline, &handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
+
+  status = ml_pipeline_start (handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
+  status = ml_pipeline_get_state (handle, &state);
+  EXPECT_EQ (status, ML_ERROR_NONE); /* At this moment, it can be READY, PAUSED, or PLAYING */
+  EXPECT_NE (state, ML_PIPELINE_STATE_UNKNOWN);
+  EXPECT_NE (state, ML_PIPELINE_STATE_NULL);
 
   g_usleep (50000); /* 50ms. Let a few frames flow. */
-  status = nns_pipeline_get_state (handle, &state);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
-  EXPECT_EQ (state, NNS_PIPELINE_STATE_PLAYING);
+  status = ml_pipeline_get_state (handle, &state);
+  EXPECT_EQ (status, ML_ERROR_NONE);
+  EXPECT_EQ (state, ML_PIPELINE_STATE_PLAYING);
 
-  status = nns_pipeline_stop (handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_stop (handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
   g_usleep (50000); /* 50ms. Let a few frames flow. */
 
-  status = nns_pipeline_get_state (handle, &state);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
-  EXPECT_EQ (state, NNS_PIPELINE_STATE_PAUSED);
+  status = ml_pipeline_get_state (handle, &state);
+  EXPECT_EQ (status, ML_ERROR_NONE);
+  EXPECT_EQ (state, ML_PIPELINE_STATE_PAUSED);
 
   /* Resume playing */
-  status = nns_pipeline_start (handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
-  EXPECT_NE (state, NNS_PIPELINE_STATE_UNKNOWN);
-  EXPECT_NE (state, NNS_PIPELINE_STATE_NULL);
+  status = ml_pipeline_start (handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
+  EXPECT_NE (state, ML_PIPELINE_STATE_UNKNOWN);
+  EXPECT_NE (state, ML_PIPELINE_STATE_NULL);
 
   g_usleep (50000); /* 50ms. Enough to empty the queue */
-  status = nns_pipeline_stop (handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_stop (handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
-  status = nns_pipeline_get_state (handle, &state);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
-  EXPECT_EQ (state, NNS_PIPELINE_STATE_PAUSED);
+  status = ml_pipeline_get_state (handle, &state);
+  EXPECT_EQ (status, ML_ERROR_NONE);
+  EXPECT_EQ (state, ML_PIPELINE_STATE_PAUSED);
 
-  status = nns_pipeline_destroy (handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_destroy (handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 }
 
 /**
@@ -178,52 +178,52 @@ TEST (nnstreamer_capi_valve, test01)
       file1);
   GStatBuf buf;
 
-  nns_pipeline_h handle;
-  nns_pipeline_state_e state;
-  nns_valve_h valve1;
+  ml_pipeline_h handle;
+  ml_pipeline_state_e state;
+  ml_pipeline_valve_h valve1;
 
-  int status = nns_pipeline_construct (pipeline, &handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  int status = ml_pipeline_construct (pipeline, &handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
   EXPECT_TRUE (dir != NULL);
 
-  status = nns_pipeline_valve_get_handle (handle, "valve1", &valve1);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_valve_get_handle (handle, "valve1", &valve1);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
-  status = nns_pipeline_start (handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_start (handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
-  status = nns_pipeline_valve_control (valve1, 1); /* close */
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_valve_control (valve1, 1); /* close */
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
-  status = nns_pipeline_get_state (handle, &state);
-  EXPECT_EQ (status, NNS_ERROR_NONE); /* At this moment, it can be READY, PAUSED, or PLAYING */
-  EXPECT_NE (state, NNS_PIPELINE_STATE_UNKNOWN);
-  EXPECT_NE (state, NNS_PIPELINE_STATE_NULL);
+  status = ml_pipeline_get_state (handle, &state);
+  EXPECT_EQ (status, ML_ERROR_NONE); /* At this moment, it can be READY, PAUSED, or PLAYING */
+  EXPECT_NE (state, ML_PIPELINE_STATE_UNKNOWN);
+  EXPECT_NE (state, ML_PIPELINE_STATE_NULL);
 
   g_usleep (100000); /* 100ms. Let a few frames flow. */
-  status = nns_pipeline_stop (handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_stop (handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
   status = g_lstat (file1, &buf);
   EXPECT_EQ (status, 0);
   EXPECT_EQ (buf.st_size, 0);
 
-  status = nns_pipeline_start (handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_start (handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
-  status = nns_pipeline_valve_control (valve1, 0); /* open */
-  EXPECT_EQ (status, NNS_ERROR_NONE);
-  status = nns_pipeline_valve_put_handle (valve1); /* release valve handle */
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_valve_control (valve1, 0); /* open */
+  EXPECT_EQ (status, ML_ERROR_NONE);
+  status = ml_pipeline_valve_put_handle (valve1); /* release valve handle */
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
   g_usleep (50000); /* 50ms. Let a few frames flow. */
 
-  status = nns_pipeline_stop (handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_stop (handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
-  status = nns_pipeline_destroy (handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_destroy (handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
   status = g_lstat (file1, &buf);
   EXPECT_EQ (status, 0);
@@ -241,38 +241,38 @@ TEST (nnstreamer_capi_valve, test01)
  */
 TEST (nnstreamer_capi_valve, failure_01)
 {
-  nns_pipeline_h handle;
-  nns_valve_h valvehandle;
+  ml_pipeline_h handle;
+  ml_pipeline_valve_h valve_h;
   gchar *pipeline;
   int status;
 
   pipeline = g_strdup ("videotestsrc num-buffers=3 ! videoconvert ! valve name=valvex ! tensor_converter ! tensor_sink name=sinkx");
 
-  status = nns_pipeline_construct (pipeline, &handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_construct (pipeline, &handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
   /* invalid param : pipe */
-  status = nns_pipeline_valve_get_handle (NULL, "valvex", &valvehandle);
-  EXPECT_EQ (status, NNS_ERROR_INVALID_PARAMETER);
+  status = ml_pipeline_valve_get_handle (NULL, "valvex", &valve_h);
+  EXPECT_EQ (status, ML_ERROR_INVALID_PARAMETER);
 
   /* invalid param : name */
-  status = nns_pipeline_valve_get_handle (handle, NULL, &valvehandle);
-  EXPECT_EQ (status, NNS_ERROR_INVALID_PARAMETER);
+  status = ml_pipeline_valve_get_handle (handle, NULL, &valve_h);
+  EXPECT_EQ (status, ML_ERROR_INVALID_PARAMETER);
 
   /* invalid param : wrong name */
-  status = nns_pipeline_valve_get_handle (handle, "wrongname", &valvehandle);
-  EXPECT_EQ (status, NNS_ERROR_INVALID_PARAMETER);
+  status = ml_pipeline_valve_get_handle (handle, "wrongname", &valve_h);
+  EXPECT_EQ (status, ML_ERROR_INVALID_PARAMETER);
 
   /* invalid param : invalid type */
-  status = nns_pipeline_valve_get_handle (handle, "sinkx", &valvehandle);
-  EXPECT_EQ (status, NNS_ERROR_INVALID_PARAMETER);
+  status = ml_pipeline_valve_get_handle (handle, "sinkx", &valve_h);
+  EXPECT_EQ (status, ML_ERROR_INVALID_PARAMETER);
 
   /* invalid param : handle */
-  status = nns_pipeline_valve_get_handle (handle, "valvex", NULL);
-  EXPECT_EQ (status, NNS_ERROR_INVALID_PARAMETER);
+  status = ml_pipeline_valve_get_handle (handle, "valvex", NULL);
+  EXPECT_EQ (status, ML_ERROR_INVALID_PARAMETER);
 
-  status = nns_pipeline_destroy (handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_destroy (handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
   g_free (pipeline);
 }
@@ -281,8 +281,8 @@ TEST (nnstreamer_capi_valve, failure_01)
  * @brief A tensor-sink callback for sink handle in a pipeline
  */
 static void
-nns_sink_callback_dm01 (const char *buf[], const size_t size[],
-    const nns_tensors_info_s * tensorsinfo, void *pdata)
+test_sink_callback_dm01 (const char *buf[], const size_t size[],
+    const ml_tensors_info_s * tensorsinfo, void *pdata)
 {
   gchar *filepath = (gchar *) pdata;
   FILE *fp = g_fopen (filepath, "a");
@@ -302,8 +302,8 @@ nns_sink_callback_dm01 (const char *buf[], const size_t size[],
  * @brief A tensor-sink callback for sink handle in a pipeline
  */
 static void
-nns_sink_callback_count (const char *buf[], const size_t size[],
-    const nns_tensors_info_s * tensorsinfo, void *pdata)
+test_sink_callback_count (const char *buf[], const size_t size[],
+    const ml_tensors_info_s * tensorsinfo, void *pdata)
 {
   guint *count = (guint *) pdata;
 
@@ -361,41 +361,41 @@ TEST (nnstreamer_capi_sink, dummy_01)
       g_strdup_printf
       ("videotestsrc num-buffers=3 ! videoconvert ! video/x-raw,format=BGRx,width=64,height=48,famerate=60/1 ! tee name=t t. ! queue ! filesink location=\"%s\"  t. ! queue ! tensor_converter ! tensor_sink name=sinkx",
       file1);
-  nns_pipeline_h handle;
-  nns_pipeline_state_e state;
-  nns_sink_h sinkhandle;
-  int status = nns_pipeline_construct (pipeline, &handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  ml_pipeline_h handle;
+  ml_pipeline_state_e state;
+  ml_pipeline_sink_h sinkhandle;
+  int status = ml_pipeline_construct (pipeline, &handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
-  status = nns_pipeline_sink_register (handle, "sinkx", nns_sink_callback_dm01,
+  status = ml_pipeline_sink_register (handle, "sinkx", test_sink_callback_dm01,
       &sinkhandle, file2);
 
-  status = nns_pipeline_start (handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_start (handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
   g_usleep (10000); /* 10ms. Wait a bit. */
-  status = nns_pipeline_get_state (handle, &state);
-  EXPECT_EQ (status, NNS_ERROR_NONE); /* At this moment, it can be READY, PAUSED, or PLAYING */
-  EXPECT_NE (state, NNS_PIPELINE_STATE_UNKNOWN);
-  EXPECT_NE (state, NNS_PIPELINE_STATE_NULL);
+  status = ml_pipeline_get_state (handle, &state);
+  EXPECT_EQ (status, ML_ERROR_NONE); /* At this moment, it can be READY, PAUSED, or PLAYING */
+  EXPECT_NE (state, ML_PIPELINE_STATE_UNKNOWN);
+  EXPECT_NE (state, ML_PIPELINE_STATE_NULL);
 
   g_usleep (100000); /* 100ms. Let a few frames flow. */
-  status = nns_pipeline_get_state (handle, &state);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
-  EXPECT_EQ (state, NNS_PIPELINE_STATE_PLAYING);
+  status = ml_pipeline_get_state (handle, &state);
+  EXPECT_EQ (status, ML_ERROR_NONE);
+  EXPECT_EQ (state, ML_PIPELINE_STATE_PLAYING);
 
-  status = nns_pipeline_stop (handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_stop (handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
   g_usleep (10000); /* 10ms. Wait a bit. */
 
-  status = nns_pipeline_get_state (handle, &state);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
-  EXPECT_EQ (state, NNS_PIPELINE_STATE_PAUSED);
+  status = ml_pipeline_get_state (handle, &state);
+  EXPECT_EQ (status, ML_ERROR_NONE);
+  EXPECT_EQ (state, ML_PIPELINE_STATE_PAUSED);
 
-  status = nns_pipeline_sink_unregister (sinkhandle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_sink_unregister (sinkhandle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
-  status = nns_pipeline_destroy (handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_destroy (handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
   g_free (pipeline);
 
@@ -408,9 +408,9 @@ TEST (nnstreamer_capi_sink, dummy_01)
  */
 TEST (nnstreamer_capi_sink, dummy_02)
 {
-  nns_pipeline_h handle;
-  nns_pipeline_state_e state;
-  nns_sink_h sinkhandle;
+  ml_pipeline_h handle;
+  ml_pipeline_state_e state;
+  ml_pipeline_sink_h sinkhandle;
   gchar *pipeline;
   int status;
   guint *count_sink;
@@ -421,33 +421,33 @@ TEST (nnstreamer_capi_sink, dummy_02)
   count_sink = (guint *) g_malloc (sizeof (guint));
   *count_sink = 0;
 
-  status = nns_pipeline_construct (pipeline, &handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_construct (pipeline, &handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
-  status = nns_pipeline_sink_register (handle, "sinkx", nns_sink_callback_count, &sinkhandle, count_sink);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_sink_register (handle, "sinkx", test_sink_callback_count, &sinkhandle, count_sink);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
-  status = nns_pipeline_start (handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_start (handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
   g_usleep (100000); /* 100ms. Let a few frames flow. */
-  status = nns_pipeline_get_state (handle, &state);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
-  EXPECT_EQ (state, NNS_PIPELINE_STATE_PLAYING);
+  status = ml_pipeline_get_state (handle, &state);
+  EXPECT_EQ (status, ML_ERROR_NONE);
+  EXPECT_EQ (state, ML_PIPELINE_STATE_PLAYING);
 
-  status = nns_pipeline_stop (handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_stop (handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
   g_usleep (10000); /* 10ms. Wait a bit. */
 
-  status = nns_pipeline_get_state (handle, &state);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
-  EXPECT_EQ (state, NNS_PIPELINE_STATE_PAUSED);
+  status = ml_pipeline_get_state (handle, &state);
+  EXPECT_EQ (status, ML_ERROR_NONE);
+  EXPECT_EQ (state, ML_PIPELINE_STATE_PAUSED);
 
-  status = nns_pipeline_sink_unregister (sinkhandle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_sink_unregister (sinkhandle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
-  status = nns_pipeline_destroy (handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_destroy (handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
   EXPECT_TRUE (*count_sink > 0U);
 
@@ -461,8 +461,8 @@ TEST (nnstreamer_capi_sink, dummy_02)
  */
 TEST (nnstreamer_capi_sink, failure_01)
 {
-  nns_pipeline_h handle;
-  nns_sink_h sinkhandle;
+  ml_pipeline_h handle;
+  ml_pipeline_sink_h sinkhandle;
   gchar *pipeline;
   int status;
   guint *count_sink;
@@ -472,49 +472,49 @@ TEST (nnstreamer_capi_sink, failure_01)
   count_sink = (guint *) g_malloc (sizeof (guint));
   *count_sink = 0;
 
-  status = nns_pipeline_construct (pipeline, &handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_construct (pipeline, &handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
   /* invalid param : pipe */
-  status = nns_pipeline_sink_register (NULL, "sinkx", nns_sink_callback_count, &sinkhandle, count_sink);
-  EXPECT_EQ (status, NNS_ERROR_INVALID_PARAMETER);
+  status = ml_pipeline_sink_register (NULL, "sinkx", test_sink_callback_count, &sinkhandle, count_sink);
+  EXPECT_EQ (status, ML_ERROR_INVALID_PARAMETER);
 
   /* invalid param : name */
-  status = nns_pipeline_sink_register (handle, NULL, nns_sink_callback_count, &sinkhandle, count_sink);
-  EXPECT_EQ (status, NNS_ERROR_INVALID_PARAMETER);
+  status = ml_pipeline_sink_register (handle, NULL, test_sink_callback_count, &sinkhandle, count_sink);
+  EXPECT_EQ (status, ML_ERROR_INVALID_PARAMETER);
 
   /* invalid param : wrong name */
-  status = nns_pipeline_sink_register (handle, "wrongname", nns_sink_callback_count, &sinkhandle, count_sink);
-  EXPECT_EQ (status, NNS_ERROR_INVALID_PARAMETER);
+  status = ml_pipeline_sink_register (handle, "wrongname", test_sink_callback_count, &sinkhandle, count_sink);
+  EXPECT_EQ (status, ML_ERROR_INVALID_PARAMETER);
 
   /* invalid param : invalid type */
-  status = nns_pipeline_sink_register (handle, "valvex", nns_sink_callback_count, &sinkhandle, count_sink);
-  EXPECT_EQ (status, NNS_ERROR_INVALID_PARAMETER);
+  status = ml_pipeline_sink_register (handle, "valvex", test_sink_callback_count, &sinkhandle, count_sink);
+  EXPECT_EQ (status, ML_ERROR_INVALID_PARAMETER);
 
   /* invalid param : callback */
-  status = nns_pipeline_sink_register (handle, "sinkx", NULL, &sinkhandle, count_sink);
-  EXPECT_EQ (status, NNS_ERROR_INVALID_PARAMETER);
+  status = ml_pipeline_sink_register (handle, "sinkx", NULL, &sinkhandle, count_sink);
+  EXPECT_EQ (status, ML_ERROR_INVALID_PARAMETER);
 
   /* invalid param : handle */
-  status = nns_pipeline_sink_register (handle, "sinkx", nns_sink_callback_count, NULL, count_sink);
-  EXPECT_EQ (status, NNS_ERROR_INVALID_PARAMETER);
+  status = ml_pipeline_sink_register (handle, "sinkx", test_sink_callback_count, NULL, count_sink);
+  EXPECT_EQ (status, ML_ERROR_INVALID_PARAMETER);
 
-  status = nns_pipeline_sink_register (handle, "sinkx", nns_sink_callback_count, &sinkhandle, count_sink);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_sink_register (handle, "sinkx", test_sink_callback_count, &sinkhandle, count_sink);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
-  status = nns_pipeline_start (handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_start (handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
   g_usleep (100000); /* 100ms. Let a few frames flow. */
 
-  status = nns_pipeline_stop (handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_stop (handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
-  status = nns_pipeline_sink_unregister (sinkhandle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_sink_unregister (sinkhandle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
-  status = nns_pipeline_destroy (handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_destroy (handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
   EXPECT_TRUE (*count_sink > 0U);
 
@@ -539,11 +539,11 @@ TEST (nnstreamer_capi_src, dummy_01)
       g_strdup_printf
       ("appsrc name=srcx ! other/tensor,dimension=4:1:1:1,type=uint8,framerate=0/1 ! filesink location=\"%s\"",
       file1);
-  nns_pipeline_h handle;
-  nns_pipeline_state_e state;
-  nns_src_h srchandle;
-  int status = nns_pipeline_construct (pipeline, &handle);
-  nns_tensors_info_s tensorsinfo;
+  ml_pipeline_h handle;
+  ml_pipeline_state_e state;
+  ml_pipeline_src_h srchandle;
+  int status = ml_pipeline_construct (pipeline, &handle);
+  ml_tensors_info_s tensorsinfo;
 
   int i;
   char *uintarray2[10];
@@ -552,7 +552,7 @@ TEST (nnstreamer_capi_src, dummy_01)
   gsize len;
   const size_t size[1] = { 4 };
 
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  EXPECT_EQ (status, ML_ERROR_NONE);
   EXPECT_TRUE (dir != NULL);
   for (i = 0; i < 10; i++) {
     uia_index[i] = &uintarray[i][0];
@@ -567,49 +567,49 @@ TEST (nnstreamer_capi_src, dummy_01)
     uintarray2[i][1] = i + 2;
     uintarray2[i][2] = i + 1;
     uintarray2[i][3] = i;
-    /* These will be free'ed by gstreamer (NNS_BUF_FREE_BY_NNSTREAMER) */
+    /* These will be free'ed by gstreamer (ML_PIPELINE_BUF_POLICY_AUTO_FREE) */
     /** @todo Check whether gstreamer really deallocates this */
   }
 
-  status = nns_pipeline_start (handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_start (handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
   g_usleep (10000); /* 10ms. Wait a bit. */
-  status = nns_pipeline_get_state (handle, &state);
-  EXPECT_EQ (status, NNS_ERROR_NONE); /* At this moment, it can be READY, PAUSED, or PLAYING */
-  EXPECT_NE (state, NNS_PIPELINE_STATE_UNKNOWN);
-  EXPECT_NE (state, NNS_PIPELINE_STATE_NULL);
+  status = ml_pipeline_get_state (handle, &state);
+  EXPECT_EQ (status, ML_ERROR_NONE); /* At this moment, it can be READY, PAUSED, or PLAYING */
+  EXPECT_NE (state, ML_PIPELINE_STATE_UNKNOWN);
+  EXPECT_NE (state, ML_PIPELINE_STATE_NULL);
 
-  status = nns_pipeline_src_get_handle (handle, "srcx", &tensorsinfo, &srchandle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_src_get_handle (handle, "srcx", &tensorsinfo, &srchandle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
   EXPECT_EQ (tensorsinfo.num_tensors, 1);
-  EXPECT_EQ (tensorsinfo.info[0].type, NNS_TENSOR_TYPE_UINT8);
+  EXPECT_EQ (tensorsinfo.info[0].type, ML_TENSOR_TYPE_UINT8);
   EXPECT_EQ (tensorsinfo.info[0].dimension[0], 4);
   EXPECT_EQ (tensorsinfo.info[0].dimension[1], 1);
   EXPECT_EQ (tensorsinfo.info[0].dimension[2], 1);
   EXPECT_EQ (tensorsinfo.info[0].dimension[3], 1);
 
   tensorsinfo.num_tensors = 1;
-  tensorsinfo.info[0].type = NNS_TENSOR_TYPE_UINT8;
+  tensorsinfo.info[0].type = ML_TENSOR_TYPE_UINT8;
   tensorsinfo.info[0].dimension[0] = 4;
   tensorsinfo.info[0].dimension[1] = 1;
   tensorsinfo.info[0].dimension[2] = 1;
   tensorsinfo.info[0].dimension[3] = 1;
 
-  status = nns_pipeline_src_input_data (srchandle, NNS_BUF_DO_NOT_FREE1,
+  status = ml_pipeline_src_input_data (srchandle, ML_PIPELINE_BUF_POLICY_DO_NOT_FREE,
       &(uia_index[0]), size, 1);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
-  status = nns_pipeline_src_input_data (srchandle, NNS_BUF_DO_NOT_FREE1,
+  EXPECT_EQ (status, ML_ERROR_NONE);
+  status = ml_pipeline_src_input_data (srchandle, ML_PIPELINE_BUF_POLICY_DO_NOT_FREE,
       &(uia_index[0]), size, 1);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
-  status = nns_pipeline_src_put_handle (srchandle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
-  status = nns_pipeline_src_get_handle (handle, "srcx", &tensorsinfo, &srchandle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_src_put_handle (srchandle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
+  status = ml_pipeline_src_get_handle (handle, "srcx", &tensorsinfo, &srchandle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
   EXPECT_EQ (tensorsinfo.num_tensors, 1);
-  EXPECT_EQ (tensorsinfo.info[0].type, NNS_TENSOR_TYPE_UINT8);
+  EXPECT_EQ (tensorsinfo.info[0].type, ML_TENSOR_TYPE_UINT8);
   EXPECT_EQ (tensorsinfo.info[0].dimension[0], 4);
   EXPECT_EQ (tensorsinfo.info[0].dimension[1], 1);
   EXPECT_EQ (tensorsinfo.info[0].dimension[2], 1);
@@ -617,21 +617,21 @@ TEST (nnstreamer_capi_src, dummy_01)
 
 
   for (i = 0; i < 10; i++) {
-    status = nns_pipeline_src_input_data (srchandle, NNS_BUF_DO_NOT_FREE1,
+    status = ml_pipeline_src_input_data (srchandle, ML_PIPELINE_BUF_POLICY_DO_NOT_FREE,
         &(uia_index[i]), size, 1);
-    EXPECT_EQ (status, NNS_ERROR_NONE);
-    status = nns_pipeline_src_input_data (srchandle, NNS_BUF_FREE_BY_NNSTREAMER,
+    EXPECT_EQ (status, ML_ERROR_NONE);
+    status = ml_pipeline_src_input_data (srchandle, ML_PIPELINE_BUF_POLICY_AUTO_FREE,
         &(uintarray2[i]), size, 1);
-    EXPECT_EQ (status, NNS_ERROR_NONE);
+    EXPECT_EQ (status, ML_ERROR_NONE);
   }
 
-  status = nns_pipeline_src_put_handle (srchandle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_src_put_handle (srchandle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
   g_usleep (50000); /* Wait for the pipeline to flush all */
 
-  status = nns_pipeline_destroy (handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_destroy (handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
   g_free (pipeline);
 
@@ -661,11 +661,11 @@ TEST (nnstreamer_capi_src, dummy_01)
 TEST (nnstreamer_capi_src, failure_01)
 {
   int status;
-  nns_tensors_info_s tensorsinfo;
-  nns_src_h srchandle;
+  ml_tensors_info_s tensorsinfo;
+  ml_pipeline_src_h srchandle;
 
-  status = nns_pipeline_src_get_handle (NULL, "dummy", &tensorsinfo, &srchandle);
-  EXPECT_EQ (status, NNS_ERROR_INVALID_PARAMETER);
+  status = ml_pipeline_src_get_handle (NULL, "dummy", &tensorsinfo, &srchandle);
+  EXPECT_EQ (status, ML_ERROR_INVALID_PARAMETER);
 }
 
 /**
@@ -675,85 +675,85 @@ TEST (nnstreamer_capi_src, failure_01)
 TEST (nnstreamer_capi_src, failure_02)
 {
   const char *pipeline = "appsrc is-live=true name=mysource ! valve name=valvex ! filesink";
-  nns_pipeline_h handle;
-  nns_tensors_info_s tensorsinfo;
-  nns_src_h srchandle;
+  ml_pipeline_h handle;
+  ml_tensors_info_s tensorsinfo;
+  ml_pipeline_src_h srchandle;
 
-  int status = nns_pipeline_construct (pipeline, &handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  int status = ml_pipeline_construct (pipeline, &handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
   /* invalid param : pipe */
-  status = nns_pipeline_src_get_handle (NULL, "mysource", &tensorsinfo, &srchandle);
-  EXPECT_EQ (status, NNS_ERROR_INVALID_PARAMETER);
+  status = ml_pipeline_src_get_handle (NULL, "mysource", &tensorsinfo, &srchandle);
+  EXPECT_EQ (status, ML_ERROR_INVALID_PARAMETER);
 
   /* invalid param : name */
-  status = nns_pipeline_src_get_handle (handle, NULL, &tensorsinfo, &srchandle);
-  EXPECT_EQ (status, NNS_ERROR_INVALID_PARAMETER);
+  status = ml_pipeline_src_get_handle (handle, NULL, &tensorsinfo, &srchandle);
+  EXPECT_EQ (status, ML_ERROR_INVALID_PARAMETER);
 
   /* invalid param : wrong name */
-  status = nns_pipeline_src_get_handle (handle, "wrongname", &tensorsinfo, &srchandle);
-  EXPECT_EQ (status, NNS_ERROR_INVALID_PARAMETER);
+  status = ml_pipeline_src_get_handle (handle, "wrongname", &tensorsinfo, &srchandle);
+  EXPECT_EQ (status, ML_ERROR_INVALID_PARAMETER);
 
   /* invalid param : invalid type */
-  status = nns_pipeline_src_get_handle (handle, "valvex", &tensorsinfo, &srchandle);
-  EXPECT_EQ (status, NNS_ERROR_INVALID_PARAMETER);
+  status = ml_pipeline_src_get_handle (handle, "valvex", &tensorsinfo, &srchandle);
+  EXPECT_EQ (status, ML_ERROR_INVALID_PARAMETER);
 
   /* invalid param : info */
-  status = nns_pipeline_src_get_handle (handle, "mysource", NULL, &srchandle);
-  EXPECT_EQ (status, NNS_ERROR_INVALID_PARAMETER);
+  status = ml_pipeline_src_get_handle (handle, "mysource", NULL, &srchandle);
+  EXPECT_EQ (status, ML_ERROR_INVALID_PARAMETER);
 
   /* invalid param : handle */
-  status = nns_pipeline_src_get_handle (handle, "mysource", &tensorsinfo, NULL);
-  EXPECT_EQ (status, NNS_ERROR_INVALID_PARAMETER);
+  status = ml_pipeline_src_get_handle (handle, "mysource", &tensorsinfo, NULL);
+  EXPECT_EQ (status, ML_ERROR_INVALID_PARAMETER);
 
-  status = nns_pipeline_destroy (handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_destroy (handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 }
 
 /**
  * @brief Test NNStreamer pipeline src
- * @detail Failure case when the number of tensors is 0 or bigger than NNS_TENSOR_SIZE_LIMIT;
+ * @detail Failure case when the number of tensors is 0 or bigger than ML_TENSOR_SIZE_LIMIT;
  */
 TEST (nnstreamer_capi_src, failure_03)
 {
-  const int num_tensors = NNS_TENSOR_SIZE_LIMIT + 1;
+  const int num_tensors = ML_TENSOR_SIZE_LIMIT + 1;
   const int num_dims = 4;
 
   const char *pipeline = "appsrc name=srcx ! other/tensor,dimension=4:1:1:1,type=uint8,framerate=0/1 ! tensor_sink";
-  nns_pipeline_h handle;
-  nns_tensors_info_s tensorsinfo;
-  nns_src_h srchandle;
+  ml_pipeline_h handle;
+  ml_tensors_info_s tensorsinfo;
+  ml_pipeline_src_h srchandle;
   const size_t tensor_size[1] = { num_dims };
   char *pbuffer[num_tensors];
 
   for (int i = 0; i < num_tensors; ++i)
     pbuffer[i] = (char *) g_malloc0 (sizeof (char) * num_dims);
 
-  int status = nns_pipeline_construct (pipeline, &handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  int status = ml_pipeline_construct (pipeline, &handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
-  status = nns_pipeline_start (handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_start (handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
-  status = nns_pipeline_src_get_handle (handle, "srcx", &tensorsinfo, &srchandle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_src_get_handle (handle, "srcx", &tensorsinfo, &srchandle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
-  status = nns_pipeline_src_input_data (srchandle, NNS_BUF_DO_NOT_FREE1,
+  status = ml_pipeline_src_input_data (srchandle, ML_PIPELINE_BUF_POLICY_DO_NOT_FREE,
       &(pbuffer[0]), tensor_size, num_tensors);
-  EXPECT_EQ (status, NNS_ERROR_INVALID_PARAMETER);
+  EXPECT_EQ (status, ML_ERROR_INVALID_PARAMETER);
 
-  status = nns_pipeline_src_input_data (srchandle, NNS_BUF_DO_NOT_FREE1,
+  status = ml_pipeline_src_input_data (srchandle, ML_PIPELINE_BUF_POLICY_DO_NOT_FREE,
       &(pbuffer[0]), tensor_size, 0);
-  EXPECT_EQ (status, NNS_ERROR_INVALID_PARAMETER);
+  EXPECT_EQ (status, ML_ERROR_INVALID_PARAMETER);
 
-  status = nns_pipeline_src_put_handle (srchandle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_src_put_handle (srchandle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
-  status = nns_pipeline_stop (handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_stop (handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
-  status = nns_pipeline_destroy (handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_destroy (handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
   for (int i = 0; i < num_tensors; ++i)
     g_free (pbuffer[i]);
@@ -764,10 +764,10 @@ TEST (nnstreamer_capi_src, failure_03)
  */
 TEST (nnstreamer_capi_switch, dummy_01)
 {
-  nns_pipeline_h handle;
-  nns_switch_h switchhandle;
-  nns_sink_h sinkhandle;
-  nns_switch_type_e type;
+  ml_pipeline_h handle;
+  ml_pipeline_switch_h switchhandle;
+  ml_pipeline_sink_h sinkhandle;
+  ml_pipeline_switch_type_e type;
   gchar *pipeline;
   int status;
   guint *count_sink;
@@ -780,15 +780,15 @@ TEST (nnstreamer_capi_switch, dummy_01)
   count_sink = (guint *) g_malloc (sizeof (guint));
   *count_sink = 0;
 
-  status = nns_pipeline_construct (pipeline, &handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_construct (pipeline, &handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
-  status = nns_pipeline_switch_get_handle (handle, "ins", &type, &switchhandle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
-  EXPECT_EQ (type, NNS_SWITCH_INPUT_SELECTOR);
+  status = ml_pipeline_switch_get_handle (handle, "ins", &type, &switchhandle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
+  EXPECT_EQ (type, ML_PIPELINE_SWITCH_INPUT_SELECTOR);
 
-  status = nns_pipeline_switch_nodelist (switchhandle, &node_list);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_switch_nodelist (switchhandle, &node_list);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
   if (node_list) {
     gchar *name = NULL;
@@ -802,28 +802,28 @@ TEST (nnstreamer_capi_switch, dummy_01)
     EXPECT_EQ (idx, 2U);
   }
 
-  status = nns_pipeline_sink_register (handle, "sinkx", nns_sink_callback_count, &sinkhandle, count_sink);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_sink_register (handle, "sinkx", test_sink_callback_count, &sinkhandle, count_sink);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
-  status = nns_pipeline_switch_select (switchhandle, "sink_1");
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_switch_select (switchhandle, "sink_1");
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
-  status = nns_pipeline_start (handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_start (handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
   g_usleep (300000); /* 300ms. Let a few frames flow. */
 
-  status = nns_pipeline_stop (handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_stop (handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
-  status = nns_pipeline_sink_unregister (sinkhandle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_sink_unregister (sinkhandle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
-  status = nns_pipeline_switch_put_handle (switchhandle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_switch_put_handle (switchhandle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
-  status = nns_pipeline_destroy (handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_destroy (handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
   EXPECT_EQ (*count_sink, 3U);
 
@@ -836,10 +836,10 @@ TEST (nnstreamer_capi_switch, dummy_01)
  */
 TEST (nnstreamer_capi_switch, dummy_02)
 {
-  nns_pipeline_h handle;
-  nns_switch_h switchhandle;
-  nns_sink_h sinkhandle0, sinkhandle1;
-  nns_switch_type_e type;
+  ml_pipeline_h handle;
+  ml_pipeline_switch_h switchhandle;
+  ml_pipeline_sink_h sinkhandle0, sinkhandle1;
+  ml_pipeline_switch_type_e type;
   gchar *pipeline;
   int status;
   guint *count_sink0, *count_sink1;
@@ -860,15 +860,15 @@ TEST (nnstreamer_capi_switch, dummy_02)
   count_sink1 = (guint *) g_malloc (sizeof (guint));
   *count_sink1 = 0;
 
-  status = nns_pipeline_construct (pipeline, &handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_construct (pipeline, &handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
-  status = nns_pipeline_switch_get_handle (handle, "outs", &type, &switchhandle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
-  EXPECT_EQ (type, NNS_SWITCH_OUTPUT_SELECTOR);
+  status = ml_pipeline_switch_get_handle (handle, "outs", &type, &switchhandle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
+  EXPECT_EQ (type, ML_PIPELINE_SWITCH_OUTPUT_SELECTOR);
 
-  status = nns_pipeline_switch_nodelist (switchhandle, &node_list);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_switch_nodelist (switchhandle, &node_list);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
   if (node_list) {
     gchar *name = NULL;
@@ -882,34 +882,34 @@ TEST (nnstreamer_capi_switch, dummy_02)
     EXPECT_EQ (idx, 2U);
   }
 
-  status = nns_pipeline_sink_register (handle, "sink0", nns_sink_callback_count, &sinkhandle0, count_sink0);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_sink_register (handle, "sink0", test_sink_callback_count, &sinkhandle0, count_sink0);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
-  status = nns_pipeline_sink_register (handle, "sink1", nns_sink_callback_count, &sinkhandle1, count_sink1);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_sink_register (handle, "sink1", test_sink_callback_count, &sinkhandle1, count_sink1);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
-  status = nns_pipeline_switch_select (switchhandle, "src_1");
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_switch_select (switchhandle, "src_1");
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
-  status = nns_pipeline_start (handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_start (handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
   g_usleep (200000); /* 200ms. Let a few frames flow. */
 
-  status = nns_pipeline_stop (handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_stop (handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
-  status = nns_pipeline_sink_unregister (sinkhandle0);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_sink_unregister (sinkhandle0);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
-  status = nns_pipeline_sink_unregister (sinkhandle1);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_sink_unregister (sinkhandle1);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
-  status = nns_pipeline_switch_put_handle (switchhandle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_switch_put_handle (switchhandle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
-  status = nns_pipeline_destroy (handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_destroy (handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
   EXPECT_EQ (*count_sink0, 0U);
   EXPECT_TRUE (*count_sink1 > 0U);
@@ -925,9 +925,9 @@ TEST (nnstreamer_capi_switch, dummy_02)
  */
 TEST (nnstreamer_capi_switch, failure_01)
 {
-  nns_pipeline_h handle;
-  nns_switch_h switchhandle;
-  nns_switch_type_e type;
+  ml_pipeline_h handle;
+  ml_pipeline_switch_h switchhandle;
+  ml_pipeline_switch_type_e type;
   gchar *pipeline;
   int status;
 
@@ -935,50 +935,50 @@ TEST (nnstreamer_capi_switch, failure_01)
       "videotestsrc is-live=true ! videoconvert ! ins.sink_0 "
       "videotestsrc num-buffers=3 ! videoconvert ! ins.sink_1");
 
-  status = nns_pipeline_construct (pipeline, &handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_construct (pipeline, &handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
   /* invalid param : pipe */
-  status = nns_pipeline_switch_get_handle (NULL, "ins", &type, &switchhandle);
-  EXPECT_EQ (status, NNS_ERROR_INVALID_PARAMETER);
+  status = ml_pipeline_switch_get_handle (NULL, "ins", &type, &switchhandle);
+  EXPECT_EQ (status, ML_ERROR_INVALID_PARAMETER);
 
   /* invalid param : name */
-  status = nns_pipeline_switch_get_handle (handle, NULL, &type, &switchhandle);
-  EXPECT_EQ (status, NNS_ERROR_INVALID_PARAMETER);
+  status = ml_pipeline_switch_get_handle (handle, NULL, &type, &switchhandle);
+  EXPECT_EQ (status, ML_ERROR_INVALID_PARAMETER);
 
   /* invalid param : wrong name */
-  status = nns_pipeline_switch_get_handle (handle, "wrongname", &type, &switchhandle);
-  EXPECT_EQ (status, NNS_ERROR_INVALID_PARAMETER);
+  status = ml_pipeline_switch_get_handle (handle, "wrongname", &type, &switchhandle);
+  EXPECT_EQ (status, ML_ERROR_INVALID_PARAMETER);
 
   /* invalid param : invalid type */
-  status = nns_pipeline_switch_get_handle (handle, "sinkx", &type, &switchhandle);
-  EXPECT_EQ (status, NNS_ERROR_INVALID_PARAMETER);
+  status = ml_pipeline_switch_get_handle (handle, "sinkx", &type, &switchhandle);
+  EXPECT_EQ (status, ML_ERROR_INVALID_PARAMETER);
 
   /* invalid param : handle */
-  status = nns_pipeline_switch_get_handle (handle, "ins", &type, NULL);
-  EXPECT_EQ (status, NNS_ERROR_INVALID_PARAMETER);
+  status = ml_pipeline_switch_get_handle (handle, "ins", &type, NULL);
+  EXPECT_EQ (status, ML_ERROR_INVALID_PARAMETER);
 
   /* succesfully get switch handle if the param type is null */
-  status = nns_pipeline_switch_get_handle (handle, "ins", NULL, &switchhandle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_switch_get_handle (handle, "ins", NULL, &switchhandle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
   /* invalid param : handle */
-  status = nns_pipeline_switch_select (NULL, "invalidpadname");
-  EXPECT_EQ (status, NNS_ERROR_INVALID_PARAMETER);
+  status = ml_pipeline_switch_select (NULL, "invalidpadname");
+  EXPECT_EQ (status, ML_ERROR_INVALID_PARAMETER);
 
   /* invalid param : pad name */
-  status = nns_pipeline_switch_select (switchhandle, NULL);
-  EXPECT_EQ (status, NNS_ERROR_INVALID_PARAMETER);
+  status = ml_pipeline_switch_select (switchhandle, NULL);
+  EXPECT_EQ (status, ML_ERROR_INVALID_PARAMETER);
 
   /* invalid param : wrong pad name */
-  status = nns_pipeline_switch_select (switchhandle, "wrongpadname");
-  EXPECT_EQ (status, NNS_ERROR_INVALID_PARAMETER);
+  status = ml_pipeline_switch_select (switchhandle, "wrongpadname");
+  EXPECT_EQ (status, ML_ERROR_INVALID_PARAMETER);
 
-  status = nns_pipeline_switch_put_handle (switchhandle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_switch_put_handle (switchhandle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
-  status = nns_pipeline_destroy (handle);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  status = ml_pipeline_destroy (handle);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
   g_free (pipeline);
 }
@@ -989,32 +989,32 @@ TEST (nnstreamer_capi_switch, failure_01)
 TEST (nnstreamer_capi_singleshot, invoke_01)
 {
   ml_simpleshot_model_h model;
-  nns_tensors_info_s in_info, out_info;
-  nns_tensors_info_s in_res, out_res;
-  tensor_data *input, *output1, *output2;
+  ml_tensors_info_s in_info, out_info;
+  ml_tensors_info_s in_res, out_res;
+  ml_tensor_data_s *input, *output1, *output2;
   int status;
 
   const gchar *root_path = g_getenv ("NNSTREAMER_BUILD_ROOT_PATH");
   gchar *test_model;
 
-  memset (&in_info, 0, sizeof (nns_tensors_info_s));
-  memset (&out_info, 0, sizeof (nns_tensors_info_s));
-  memset (&in_res, 0, sizeof (nns_tensors_info_s));
-  memset (&out_res, 0, sizeof (nns_tensors_info_s));
+  memset (&in_info, 0, sizeof (ml_tensors_info_s));
+  memset (&out_info, 0, sizeof (ml_tensors_info_s));
+  memset (&in_res, 0, sizeof (ml_tensors_info_s));
+  memset (&out_res, 0, sizeof (ml_tensors_info_s));
 
   ASSERT_TRUE (root_path != NULL);
   test_model = g_build_filename (root_path, "tests", "test_models", "models",
       "mobilenet_v1_1.0_224_quant.tflite", NULL);
 
   in_info.num_tensors = 1;
-  in_info.info[0].type = NNS_TENSOR_TYPE_UINT8;
+  in_info.info[0].type = ML_TENSOR_TYPE_UINT8;
   in_info.info[0].dimension[0] = 3;
   in_info.info[0].dimension[1] = 224;
   in_info.info[0].dimension[2] = 224;
   in_info.info[0].dimension[3] = 1;
 
   out_info.num_tensors = 1;
-  out_info.info[0].type = NNS_TENSOR_TYPE_UINT8;
+  out_info.info[0].type = ML_TENSOR_TYPE_UINT8;
   out_info.info[0].dimension[0] = 1001;
   out_info.info[0].dimension[1] = 1;
   out_info.info[0].dimension[2] = 1;
@@ -1022,11 +1022,11 @@ TEST (nnstreamer_capi_singleshot, invoke_01)
 
   status = ml_model_open (test_model, &model, &in_info, &out_info,
       ML_NNFW_TENSORFLOW_LITE, ML_NNFW_HW_DO_NOT_CARE);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
   /* input tensor in filter */
   status = ml_model_get_input_type (model, &in_res);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
   EXPECT_TRUE (in_info.num_tensors == in_res.num_tensors);
   for (guint idx = 0; idx < in_res.num_tensors; idx++) {
@@ -1039,7 +1039,7 @@ TEST (nnstreamer_capi_singleshot, invoke_01)
 
   /* output tensor in filter */
   status = ml_model_get_output_type (model, &out_res);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
   EXPECT_TRUE (out_info.num_tensors == out_res.num_tensors);
   for (guint idx = 0; idx < out_res.num_tensors; idx++) {
@@ -1069,7 +1069,7 @@ TEST (nnstreamer_capi_singleshot, invoke_01)
   ml_model_free_tensor_data (input);
 
   status = ml_model_close (model);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
   g_free (test_model);
 }
@@ -1081,8 +1081,8 @@ TEST (nnstreamer_capi_singleshot, invoke_01)
 TEST (nnstreamer_capi_singleshot, invoke_02)
 {
   ml_simpleshot_model_h model;
-  nns_tensors_info_s in_info, out_info;
-  tensor_data *input, *output1, *output2;
+  ml_tensors_info_s in_info, out_info;
+  ml_tensor_data_s *input, *output1, *output2;
   int status;
 
   const gchar *root_path = g_getenv ("NNSTREAMER_BUILD_ROOT_PATH");
@@ -1093,14 +1093,14 @@ TEST (nnstreamer_capi_singleshot, invoke_02)
       "mobilenet_v1_1.0_224_quant.tflite", NULL);
 
   in_info.num_tensors = 1;
-  in_info.info[0].type = NNS_TENSOR_TYPE_UINT8;
+  in_info.info[0].type = ML_TENSOR_TYPE_UINT8;
   in_info.info[0].dimension[0] = 3;
   in_info.info[0].dimension[1] = 224;
   in_info.info[0].dimension[2] = 224;
   in_info.info[0].dimension[3] = 1;
 
   out_info.num_tensors = 1;
-  out_info.info[0].type = NNS_TENSOR_TYPE_UINT8;
+  out_info.info[0].type = ML_TENSOR_TYPE_UINT8;
   out_info.info[0].dimension[0] = 1001;
   out_info.info[0].dimension[1] = 1;
   out_info.info[0].dimension[2] = 1;
@@ -1108,7 +1108,7 @@ TEST (nnstreamer_capi_singleshot, invoke_02)
 
   status = ml_model_open (test_model, &model, NULL, NULL,
       ML_NNFW_TENSORFLOW_LITE, ML_NNFW_HW_DO_NOT_CARE);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
   /* generate dummy data */
   input = ml_model_allocate_tensor_data (&in_info);
@@ -1129,7 +1129,7 @@ TEST (nnstreamer_capi_singleshot, invoke_02)
   ml_model_free_tensor_data (input);
 
   status = ml_model_close (model);
-  EXPECT_EQ (status, NNS_ERROR_NONE);
+  EXPECT_EQ (status, ML_ERROR_NONE);
 
   g_free (test_model);
 }
@@ -1141,14 +1141,14 @@ TEST (nnstreamer_capi_singleshot, invoke_02)
 TEST (nnstreamer_capi_singleshot, failure_01)
 {
   ml_simpleshot_model_h model;
-  nns_tensors_info_s in_info, out_info;
+  ml_tensors_info_s in_info, out_info;
   int status;
 
   const gchar *root_path = g_getenv ("NNSTREAMER_BUILD_ROOT_PATH");
   gchar *test_model;
 
-  memset (&in_info, 0, sizeof (nns_tensors_info_s));
-  memset (&out_info, 0, sizeof (nns_tensors_info_s));
+  memset (&in_info, 0, sizeof (ml_tensors_info_s));
+  memset (&out_info, 0, sizeof (ml_tensors_info_s));
 
   ASSERT_TRUE (root_path != NULL);
   test_model = g_build_filename (root_path, "tests", "test_models", "models",
@@ -1157,25 +1157,25 @@ TEST (nnstreamer_capi_singleshot, failure_01)
   /* invalid file path */
   status = ml_model_open ("wrong_file_name", &model, &in_info, &out_info,
       ML_NNFW_TENSORFLOW_LITE, ML_NNFW_HW_DO_NOT_CARE);
-  EXPECT_EQ (status, NNS_ERROR_INVALID_PARAMETER);
+  EXPECT_EQ (status, ML_ERROR_INVALID_PARAMETER);
 
   /* null file path */
   status = ml_model_open (NULL, &model, &in_info, &out_info,
       ML_NNFW_TENSORFLOW_LITE, ML_NNFW_HW_DO_NOT_CARE);
-  EXPECT_EQ (status, NNS_ERROR_INVALID_PARAMETER);
+  EXPECT_EQ (status, ML_ERROR_INVALID_PARAMETER);
 
   /* invalid handle */
   status = ml_model_open (test_model, NULL, &in_info, &out_info,
       ML_NNFW_TENSORFLOW_LITE, ML_NNFW_HW_DO_NOT_CARE);
-  EXPECT_EQ (status, NNS_ERROR_INVALID_PARAMETER);
+  EXPECT_EQ (status, ML_ERROR_INVALID_PARAMETER);
 
   /* invalid input tensor info */
   status = ml_model_open (test_model, &model, &in_info, &out_info,
       ML_NNFW_TENSORFLOW_LITE, ML_NNFW_HW_DO_NOT_CARE);
-  EXPECT_EQ (status, NNS_ERROR_INVALID_PARAMETER);
+  EXPECT_EQ (status, ML_ERROR_INVALID_PARAMETER);
 
   in_info.num_tensors = 1;
-  in_info.info[0].type = NNS_TENSOR_TYPE_UINT8;
+  in_info.info[0].type = ML_TENSOR_TYPE_UINT8;
   in_info.info[0].dimension[0] = 3;
   in_info.info[0].dimension[1] = 224;
   in_info.info[0].dimension[2] = 224;
@@ -1184,10 +1184,10 @@ TEST (nnstreamer_capi_singleshot, failure_01)
   /* invalid output tensor info */
   status = ml_model_open (test_model, &model, &in_info, &out_info,
       ML_NNFW_TENSORFLOW_LITE, ML_NNFW_HW_DO_NOT_CARE);
-  EXPECT_EQ (status, NNS_ERROR_INVALID_PARAMETER);
+  EXPECT_EQ (status, ML_ERROR_INVALID_PARAMETER);
 
   out_info.num_tensors = 1;
-  out_info.info[0].type = NNS_TENSOR_TYPE_UINT8;
+  out_info.info[0].type = ML_TENSOR_TYPE_UINT8;
   out_info.info[0].dimension[0] = 1001;
   out_info.info[0].dimension[1] = 1;
   out_info.info[0].dimension[2] = 1;
@@ -1196,11 +1196,11 @@ TEST (nnstreamer_capi_singleshot, failure_01)
   /* unknown fw type */
   status = ml_model_open (test_model, &model, &in_info, &out_info,
       ML_NNFW_UNKNOWN, ML_NNFW_HW_DO_NOT_CARE);
-  EXPECT_EQ (status, NNS_ERROR_NOT_SUPPORTED);
+  EXPECT_EQ (status, ML_ERROR_NOT_SUPPORTED);
 
   /* invalid handle */
   status = ml_model_close (model);
-  EXPECT_EQ (status, NNS_ERROR_INVALID_PARAMETER);
+  EXPECT_EQ (status, ML_ERROR_INVALID_PARAMETER);
 
   g_free (test_model);
 }
index 87d83b4..2c48a69 100644 (file)
@@ -46,18 +46,6 @@ extern "C" {
  */
 typedef void *ml_simpleshot_model_h;
 
-/* We can handle up to 16 tensors for an input or output frame */
-#define ML_MAX_TENSORS (16)
-/**
- * @brief An instance of input or output frames. GstTensorsInfo is the metadata
- * @since_tizen 5.5
- */
-typedef struct {
-  void *tensor[ML_MAX_TENSORS]; /**< Tensor data. NULL for unused tensors. */
-  size_t size[ML_MAX_TENSORS]; /**< Size of each tensor. */
-  int num_tensors; /**< Number of tensors. > 0 && < ML_MAX_TENSORS. */
-} tensor_data;
-
 /**
  * @brief Types of NNFWs.
  * @since_tizen 5.5
@@ -103,14 +91,14 @@ typedef enum {
  * @param[in] hw Tell the corresponding @nnfw to use a specific hardware.
  *               Set ML_NNFW_HW_DO_NOT_CARE if it does not matter.
  * @return @c 0 on success. otherwise a negative error value
- * @retval #NNS_ERROR_NONE Successful
+ * @retval #ML_ERROR_NONE Successful
  *
  * @detail Even if the model has flexible input data dimensions,
  *         input data frames of an instance of a model should share the
  *         same dimension.
  */
 int ml_model_open (const char *model_path, ml_simpleshot_model_h *model,
-    const nns_tensors_info_s *input_type, const nns_tensors_info_s *output_type,
+    const ml_tensors_info_s *input_type, const ml_tensors_info_s *output_type,
     ml_model_nnfw nnfw, ml_model_hw hw);
 
 /**
@@ -118,8 +106,8 @@ int ml_model_open (const char *model_path, ml_simpleshot_model_h *model,
  * @since_tizen 5.5
  * @param[in] model The model handle to be closed.
  * @return @c 0 on success. otherwise a negative error value
- * @retval #NNS_ERROR_NONE Successful
- * @retval #NNS_ERROR_INVALID_PARAMETER Fail. The parameter is invalid (pipe is NULL?)
+ * @retval #ML_ERROR_NONE Successful
+ * @retval #ML_ERROR_INVALID_PARAMETER Fail. The parameter is invalid (pipe is NULL?)
  */
 int ml_model_close (ml_simpleshot_model_h model);
 
@@ -139,8 +127,8 @@ int ml_model_close (ml_simpleshot_model_h model);
  *         input data frames of an instance of a model should share the
  *         same dimension.
  */
-tensor_data * ml_model_inference (ml_simpleshot_model_h model,
-    const tensor_data *input, tensor_data *output);
+ml_tensor_data_s * ml_model_inference (ml_simpleshot_model_h model,
+    const ml_tensor_data_s *input, ml_tensor_data_s *output);
 
 /*************
  * UTILITIES *
@@ -157,10 +145,10 @@ tensor_data * ml_model_inference (ml_simpleshot_model_h model,
  * @param[in] model The model to be investigated
  * @param[out] input_type The type of input tensor.
  * @return @c 0 on success. otherwise a negative error value
- * @retval #NNS_ERROR_NONE Successful
+ * @retval #ML_ERROR_NONE Successful
  */
 int ml_model_get_input_type (ml_simpleshot_model_h model,
-    nns_tensors_info_s *input_type);
+    ml_tensors_info_s *input_type);
 
 /**
  * @brief Get type (tensor dimension, type, name and so on) of output
@@ -174,10 +162,10 @@ int ml_model_get_input_type (ml_simpleshot_model_h model,
  * @param[in] model The model to be investigated
  * @param[out] output_type The type of output tensor.
  * @return @c 0 on success. otherwise a negative error value
- * @retval #NNS_ERROR_NONE Successful
+ * @retval #ML_ERROR_NONE Successful
  */
 int ml_model_get_output_type (ml_simpleshot_model_h model,
-    nns_tensors_info_s *output_type);
+    ml_tensors_info_s *output_type);
 
 /**
  * @brief Get the byte size of the given tensor type.
@@ -185,7 +173,7 @@ int ml_model_get_output_type (ml_simpleshot_model_h model,
  * @param[in] info The tensor information to be investigated.
  * @return @c >= 0 on success with byte size. otherwise a negative error value
  */
-size_t ml_util_get_tensor_size (const nns_tensor_info_s *info);
+size_t ml_util_get_tensor_size (const ml_tensor_info_s *info);
 
 /**
  * @brief Get the byte size of the given tensors type.
@@ -193,21 +181,21 @@ size_t ml_util_get_tensor_size (const nns_tensor_info_s *info);
  * @param[in] info The tensors information to be investigated.
  * @return @c >= 0 on success with byte size. otherwise a negative error value
  */
-size_t ml_util_get_tensors_size (const nns_tensors_info_s *info);
+size_t ml_util_get_tensors_size (const ml_tensors_info_s *info);
 
 /**
  * @brief Free the tensors type pointer.
  * @since_tizen 5.5
  * @param[in] type the tensors type pointer to be freed.
  */
-void ml_model_free_tensors_info (nns_tensors_info_s *type);
+void ml_model_free_tensors_info (ml_tensors_info_s *type);
 
 /**
  * @brief Free the tensors data pointer.
  * @since_tizen 5.5
  * @param[in] tensor the tensors data pointer to be freed.
  */
-void ml_model_free_tensor_data (tensor_data *tensor);
+void ml_model_free_tensor_data (ml_tensor_data_s *tensor);
 
 /**
  * @brief Allocate a tensor data frame with the given tensors type.
@@ -217,7 +205,7 @@ void ml_model_free_tensor_data (tensor_data *tensor);
  * @retval NULL there is an error. call get_last_result() to get specific
  *         error numbers.
  */
-tensor_data *ml_model_allocate_tensor_data (const nns_tensors_info_s *info);
+ml_tensor_data_s *ml_model_allocate_tensor_data (const ml_tensors_info_s *info);
 
 /**
  * @brief Check the availability of the given execution environments.
@@ -228,7 +216,7 @@ tensor_data *ml_model_allocate_tensor_data (const nns_tensors_info_s *info);
  *               Set ML_NNFW_HW_DO_NOT_CARE to skip checking hardware.
  * @return @c 0 if it's available. 1 if it's not available.
  *            negative value if there is an error.
- * @retval #NNS_ERROR_NONE Successful and the environments are available.
+ * @retval #ML_ERROR_NONE Successful and the environments are available.
  * @retval 1 Successful but the environments are not available.
  */
 int ml_model_check_nnfw (ml_model_nnfw nnfw, ml_model_hw hw);
index 03b153a..20898f4 100644 (file)
@@ -39,120 +39,120 @@ extern "C" {
  * @brief The maximum rank that NNStreamer supports with Tizen APIs.
  * @since_tizen 5.5
  */
-#define NNS_TENSOR_RANK_LIMIT  (4)
+#define ML_TENSOR_RANK_LIMIT  (4)
 
 /**
  * @brief The maximum number of other/tensor instances that other/tensors may have.
  * @since_tizen 5.5
  */
-#define NNS_TENSOR_SIZE_LIMIT  (16)
+#define ML_TENSOR_SIZE_LIMIT  (16)
 
 /**
  * @brief Dimension information that NNStreamer support.
  * @since_tizen 5.5
  */
-typedef unsigned int tensor_dim[NNS_TENSOR_RANK_LIMIT];
+typedef unsigned int ml_tensor_dim[ML_TENSOR_RANK_LIMIT];
 
 /**
  * @brief A handle of an NNStreamer pipeline.
  * @since_tizen 5.5
  */
-typedef void *nns_pipeline_h;
+typedef void *ml_pipeline_h;
 
 /**
  * @brief A handle of a "sink node" of an NNStreamer pipeline.
  * @since_tizen 5.5
  */
-typedef void *nns_sink_h;
+typedef void *ml_pipeline_sink_h;
 
 /**
  * @brief A handle of a "src node" of an NNStreamer pipeline.
  * @since_tizen 5.5
  */
-typedef void *nns_src_h;
+typedef void *ml_pipeline_src_h;
 
 /**
  * @brief A handle of a "switch" of an NNStreamer pipeline.
  * @since_tizen 5.5
  */
-typedef void *nns_switch_h;
+typedef void *ml_pipeline_switch_h;
 
 /**
  * @brief A handle of a "valve node" of an NNStreamer pipeline.
  * @since_tizen 5.5
  */
-typedef void *nns_valve_h;
+typedef void *ml_pipeline_valve_h;
 
 /**
  * @brief Possible data element types of Tensor in NNStreamer.
  * @since_tizen 5.5
  */
-typedef enum _nns_tensor_type_e
+typedef enum _ml_tensor_type_e
 {
-  NNS_TENSOR_TYPE_INT32 = 0,      /**< Integer 32bit */
-  NNS_TENSOR_TYPE_UINT32,         /**< Unsigned integer 32bit */
-  NNS_TENSOR_TYPE_INT16,          /**< Integer 16bit */
-  NNS_TENSOR_TYPE_UINT16,         /**< Unsigned integer 16bit */
-  NNS_TENSOR_TYPE_INT8,           /**< Integer 8bit */
-  NNS_TENSOR_TYPE_UINT8,          /**< Unsigned integer 8bit */
-  NNS_TENSOR_TYPE_FLOAT64,        /**< Float 64bit */
-  NNS_TENSOR_TYPE_FLOAT32,        /**< Float 32bit */
-  NNS_TENSOR_TYPE_INT64,          /**< Integer 64bit */
-  NNS_TENSOR_TYPE_UINT64,         /**< Unsigned integer 64bit */
+  ML_TENSOR_TYPE_INT32 = 0,      /**< Integer 32bit */
+  ML_TENSOR_TYPE_UINT32,         /**< Unsigned integer 32bit */
+  ML_TENSOR_TYPE_INT16,          /**< Integer 16bit */
+  ML_TENSOR_TYPE_UINT16,         /**< Unsigned integer 16bit */
+  ML_TENSOR_TYPE_INT8,           /**< Integer 8bit */
+  ML_TENSOR_TYPE_UINT8,          /**< Unsigned integer 8bit */
+  ML_TENSOR_TYPE_FLOAT64,        /**< Float 64bit */
+  ML_TENSOR_TYPE_FLOAT32,        /**< Float 32bit */
+  ML_TENSOR_TYPE_INT64,          /**< Integer 64bit */
+  ML_TENSOR_TYPE_UINT64,         /**< Unsigned integer 64bit */
   ML_TENSOR_TYPE_UNKNOWN          /**< Unknown type */
-} nns_tensor_type_e;
+} ml_tensor_type_e;
 
 /**
  * @brief Enumeration for the error codes of NNStreamer Pipelines.
  * @since_tizen 5.5
  */
 typedef enum {
-  NNS_ERROR_NONE                               = TIZEN_ERROR_NONE, /**< Success! */
-  NNS_ERROR_INVALID_PARAMETER                  = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
-  NNS_ERROR_NOT_SUPPORTED                      = TIZEN_ERROR_NOT_SUPPORTED, /**< The feature is not supported */
-  NNS_ERROR_STREAMS_PIPE                       = TIZEN_ERROR_STREAMS_PIPE, /**< Cannot create or access GStreamer pipeline. */
-  NNS_ERROR_TRY_AGAIN                          = TIZEN_ERROR_TRY_AGAIN, /**< The pipeline is not ready, yet (not negotiated, yet) */
-} nns_error_e;
+  ML_ERROR_NONE                                = TIZEN_ERROR_NONE, /**< Success! */
+  ML_ERROR_INVALID_PARAMETER                   = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
+  ML_ERROR_NOT_SUPPORTED                       = TIZEN_ERROR_NOT_SUPPORTED, /**< The feature is not supported */
+  ML_ERROR_STREAMS_PIPE                        = TIZEN_ERROR_STREAMS_PIPE, /**< Cannot create or access GStreamer pipeline. */
+  ML_ERROR_TRY_AGAIN                           = TIZEN_ERROR_TRY_AGAIN, /**< The pipeline is not ready, yet (not negotiated, yet) */
+} ml_error_e;
 
 /**
  * @brief Enumeration for buffer deallocation policies.
  * @since_tizen 5.5
  */
 typedef enum {
-  NNS_BUF_FREE_BY_NNSTREAMER,  /**< Default. Application should not deallocate this buffer. NNStreamer will deallocate when the buffer is no more needed */
-  NNS_BUF_DO_NOT_FREE1,                /**< This buffer is not to be freed by NNStreamer (i.e., it's a static object). However, be careful: NNStreamer might be accessing this object after the return of the API call. */
-  NNS_BUF_POLICY_MAX,   /**< Max size of nns_buf_policy_e structure */
-} nns_buf_policy_e;
+  ML_PIPELINE_BUF_POLICY_AUTO_FREE,    /**< Default. Application should not deallocate this buffer. NNStreamer will deallocate when the buffer is no more needed */
+  ML_PIPELINE_BUF_POLICY_DO_NOT_FREE,          /**< This buffer is not to be freed by NNStreamer (i.e., it's a static object). However, be careful: NNStreamer might be accessing this object after the return of the API call. */
+  ML_PIPELINE_BUF_POLICY_MAX,   /**< Max size of ml_pipeline_buf_policy_e structure */
+} ml_pipeline_buf_policy_e;
 
 /**
- * @brief Enumeration for nns pipeline state.
+ * @brief Enumeration for pipeline state.
  * @since_tizen 5.5
  * @detail Refer to https://gstreamer.freedesktop.org/documentation/plugin-development/basics/states.html.
  *         The state diagram of pipeline looks like this, assuming that there are no errors.
  *
  *          [ UNKNOWN ] "new null object"
- *               | "nns_pipeline_construct" starts
+ *               | "ml_pipeline_construct" starts
  *               V
  *          [  NULL   ] <------------------------------------------+
- *               | "nns_pipeline_construct" creates                |
+ *               | "ml_pipeline_construct" creates                |
  *               V                                                 |
  *          [  READY  ]                                            |
- *               | "nns_pipeline_construct' completes              | "nns_pipeline_destroy"
+ *               | "ml_pipeline_construct' completes              | "ml_pipeline_destroy"
  *               V                                                 |
  *          [         ] ------------------------------------------>|
  *          [  PAUSED ] <-------------------+                      |
- *               | "nns_pipeline_start"     | "nns_pipeline_stop"  |
+ *               | "ml_pipeline_start"     | "ml_pipeline_stop"  |
  *               V                          |                      |
  *          [ PLAYING ] --------------------+----------------------+
  *
  */
 typedef enum {
-  NNS_PIPELINE_STATE_UNKNOWN                           = 0, /**< Unknown state. Maybe not constructed? */
-  NNS_PIPELINE_STATE_NULL                              = 1, /**< GST-State "Null" */
-  NNS_PIPELINE_STATE_READY                             = 2, /**< GST-State "Ready" */
-  NNS_PIPELINE_STATE_PAUSED                            = 3, /**< GST-State "Paused" */
-  NNS_PIPELINE_STATE_PLAYING                           = 4, /**< GST-State "Playing" */
-} nns_pipeline_state_e;
+  ML_PIPELINE_STATE_UNKNOWN                            = 0, /**< Unknown state. Maybe not constructed? */
+  ML_PIPELINE_STATE_NULL                               = 1, /**< GST-State "Null" */
+  ML_PIPELINE_STATE_READY                              = 2, /**< GST-State "Ready" */
+  ML_PIPELINE_STATE_PAUSED                             = 3, /**< GST-State "Paused" */
+  ML_PIPELINE_STATE_PLAYING                            = 4, /**< GST-State "Playing" */
+} ml_pipeline_state_e;
 
 /**
  * @brief Enumeration for switch types
@@ -160,9 +160,9 @@ typedef enum {
  * @since_tizen 5.5
  */
 typedef enum {
-  NNS_SWITCH_OUTPUT_SELECTOR                   = 0, /**< GstOutputSelector */
-  NNS_SWITCH_INPUT_SELECTOR                    = 1, /**< GstInputSelector */
-} nns_switch_type_e;
+  ML_PIPELINE_SWITCH_OUTPUT_SELECTOR                   = 0, /**< GstOutputSelector */
+  ML_PIPELINE_SWITCH_INPUT_SELECTOR                    = 1, /**< GstInputSelector */
+} ml_pipeline_switch_type_e;
 
 /**
  * @brief Data structure for Tensor Information.
@@ -170,30 +170,40 @@ typedef enum {
  */
 typedef struct {
   char * name;              /**< Name of each element in the tensor. */
-  nns_tensor_type_e type;   /**< Type of each element in the tensor. */
-  tensor_dim dimension;     /**< Dimension information. */
-} nns_tensor_info_s;
+  ml_tensor_type_e type;   /**< Type of each element in the tensor. */
+  ml_tensor_dim dimension;     /**< Dimension information. */
+} ml_tensor_info_s;
 
 /**
  * @brief Data structure for Tensors Information, which contains multiple tensors.
  * @since_tizen 5.5
  */
 typedef struct {
-  unsigned int num_tensors; /**< The number of tensors */
-  nns_tensor_info_s info[NNS_TENSOR_SIZE_LIMIT];  /**< The list of tensor info */
-} nns_tensors_info_s;
+  unsigned int num_tensors; /**< The number of tensors. */
+  ml_tensor_info_s info[ML_TENSOR_SIZE_LIMIT];  /**< The list of tensor info. */
+} ml_tensors_info_s;
 
 /**
- * @brief Callback for sink (tensor_sink) of nnstreamer pipelines (nnstreamer's output)
+ * @brief An instance of input or output frames. ml_tensors_info_s is the metadata.
+ * @since_tizen 5.5
+ */
+typedef struct {
+  unsigned int num_tensors; /**< The number of tensors. */
+  void *tensor[ML_TENSOR_SIZE_LIMIT]; /**< The list of tensor data. NULL for unused tensors. */
+  size_t size[ML_TENSOR_SIZE_LIMIT]; /**< The size of each tensor. */
+} ml_tensor_data_s;
+
+/**
+ * @brief Callback for sink element of nnstreamer pipelines (pipeline's output)
  * @detail If an application wants to accept data outputs of an nnstreamer stream, use this callback to get data from the stream. Note that the buffer may be deallocated after the return and this is synchronously called. Thus, if you need the data afterwards, copy the data to another buffer and return fast. Do not hold too much time in the callback. It is recommended to use very small tensors at sinks.
  * @since_tizen 5.5
  * @param[in] buf The contents of the tensor output (a single frame. tensor/tensors). Number of buf is determined by tensorsinfo->num_tensors.
- * @param[in] size The size of the buffer. Number of size is determined by tensorsinfo->num_tensors. Note that max num_tensors is 16 (NNS_TENSOR_SIZE_LIMIT).
+ * @param[in] size The size of the buffer. Number of size is determined by tensorsinfo->num_tensors. Note that max num_tensors is 16 (ML_TENSOR_SIZE_LIMIT).
  * @param[in] tensors_info The cardinality, dimension, and type of given tensor/tensors.
  * @param[in,out] pdata User Application's Private Data
  */
-typedef void (*nns_sink_cb)
-(const char *buf[], const size_t size[], const nns_tensors_info_s *tensors_info, void *pdata);
+typedef void (*ml_pipeline_sink_cb)
+(const char *buf[], const size_t size[], const ml_tensors_info_s *tensors_info, void *pdata);
 
 /****************************************************
  ** NNStreamer Pipeline Construction (gst-parse)   **
@@ -202,15 +212,15 @@ typedef void (*nns_sink_cb)
  * @brief Constructs the pipeline (GStreamer + NNStreamer)
  * @detail Uses this function to create a gst_parse_launch compatible NNStreamer pipelines.
  * @since_tizen 5.5
- * @remarks If the function succeeds, @a pipe handle must be released using nns_pipeline_destroy().
+ * @remarks If the function succeeds, @a pipe handle must be released using ml_pipeline_destroy().
  * @param[in] pipeline_description The pipeline description compatible with GStreamer gst_parse_launch(). Refer to GStreamer manual or NNStreamer (github.com/nnsuite/nnstreamer) documentation for examples and the grammar.
  * @param[out] pipe The nnstreamer pipeline handler from the given description
  * @return @c 0 on success. otherwise a negative error value
- * @retval #NNS_ERROR_NONE Successful
- * @retval #NNS_ERROR_STREAMS_PIPE Pipeline construction is failed because of wrong parameter or initialization failure.
- * @retval #NNS_ERROR_INVALID_PARAMETER Given parameter is invalid. (pipe is NULL?)
+ * @retval #ML_ERROR_NONE Successful
+ * @retval #ML_ERROR_STREAMS_PIPE Pipeline construction is failed because of wrong parameter or initialization failure.
+ * @retval #ML_ERROR_INVALID_PARAMETER Given parameter is invalid. (pipe is NULL?)
  */
-int nns_pipeline_construct (const char *pipeline_description, nns_pipeline_h *pipe);
+int ml_pipeline_construct (const char *pipeline_description, ml_pipeline_h *pipe);
 
 /**
  * @brief Destroys the pipeline
@@ -218,11 +228,11 @@ int nns_pipeline_construct (const char *pipeline_description, nns_pipeline_h *pi
  * @since_tizen 5.5
  * @param[in] pipe The pipeline to be destroyed.
  * @return @c 0 on success. otherwise a negative error value
- * @retval #NNS_ERROR_NONE Successful
- * @retval #NNS_ERROR_STREAMS_PIPE Cannot access the pipeline status.
- * @retval #NNS_ERROR_INVALID_PARAMETER The parameter is invalid (pipe is NULL?)
+ * @retval #ML_ERROR_NONE Successful
+ * @retval #ML_ERROR_STREAMS_PIPE Cannot access the pipeline status.
+ * @retval #ML_ERROR_INVALID_PARAMETER The parameter is invalid (pipe is NULL?)
  */
-int nns_pipeline_destroy (nns_pipeline_h pipe);
+int ml_pipeline_destroy (ml_pipeline_h pipe);
 
 /**
  * @brief Gets the state of pipeline
@@ -231,11 +241,11 @@ int nns_pipeline_destroy (nns_pipeline_h pipe);
  * @param[in] pipe The pipeline to be monitored.
  * @param[out] state The pipeline state.
  * @return @c 0 on success. otherwise a negative error value
- * @retval #NNS_ERROR_NONE Successful
- * @retval #NNS_ERROR_INVALID_PARAMETER Given parameter is invalid. (pipe is NULL?)
- * @retval #NNS_ERROR_STREAMS_PIPE Failed to get state from the pipeline.
+ * @retval #ML_ERROR_NONE Successful
+ * @retval #ML_ERROR_INVALID_PARAMETER Given parameter is invalid. (pipe is NULL?)
+ * @retval #ML_ERROR_STREAMS_PIPE Failed to get state from the pipeline.
  */
-int nns_pipeline_get_state (nns_pipeline_h pipe, nns_pipeline_state_e *state);
+int ml_pipeline_get_state (ml_pipeline_h pipe, ml_pipeline_state_e *state);
 
 /****************************************************
  ** NNStreamer Pipeline Start/Stop Control         **
@@ -247,11 +257,11 @@ int nns_pipeline_get_state (nns_pipeline_h pipe, nns_pipeline_state_e *state);
  * @since_tizen 5.5
  * @param[in] pipe The pipeline to be started.
  * @return @c 0 on success. otherwise a negative error value
- * @retval #NNS_ERROR_NONE Successful
- * @retval #NNS_ERROR_STREAMS_PIPE Failed to start.
- * @retval #NNS_ERROR_INVALID_PARAMETER Given parameter is invalid. (pipe is NULL?)
+ * @retval #ML_ERROR_NONE Successful
+ * @retval #ML_ERROR_STREAMS_PIPE Failed to start.
+ * @retval #ML_ERROR_INVALID_PARAMETER Given parameter is invalid. (pipe is NULL?)
  */
-int nns_pipeline_start (nns_pipeline_h pipe);
+int ml_pipeline_start (ml_pipeline_h pipe);
 
 /**
  * @brief Stops the pipeline
@@ -260,11 +270,11 @@ int nns_pipeline_start (nns_pipeline_h pipe);
  * @since_tizen 5.5
  * @param[in] pipe The pipeline to be stopped.
  * @return @c 0 on success. otherwise a negative error value
- * @retval #NNS_ERROR_NONE Successful
- * @retval #NNS_ERROR_STREAMS_PIPE Failed to start.
- * @retval #NNS_ERROR_INVALID_PARAMETER Given parameter is invalid. (pipe is NULL?)
+ * @retval #ML_ERROR_NONE Successful
+ * @retval #ML_ERROR_STREAMS_PIPE Failed to start.
+ * @retval #ML_ERROR_INVALID_PARAMETER Given parameter is invalid. (pipe is NULL?)
  */
-int nns_pipeline_stop (nns_pipeline_h pipe);
+int ml_pipeline_stop (ml_pipeline_h pipe);
 
 /****************************************************
  ** NNStreamer Pipeline Sink/Src Control           **
@@ -272,68 +282,68 @@ int nns_pipeline_stop (nns_pipeline_h pipe);
 /**
  * @brief Registers a callback for sink (tensor_sink) of nnstreamer pipelines.
  * @since_tizen 5.5
- * @remarks If the function succeeds, @a h handle must be unregistered using nns_pipeline_sink_unregister.
+ * @remarks If the function succeeds, @a h handle must be unregistered using ml_pipeline_sink_unregister.
  * @param[in] pipe The pipeline to be attached with a sink node.
- * @param[in] sink_name The name of sink node, described with nns_pipeline_construct().
+ * @param[in] sink_name The name of sink node, described with ml_pipeline_construct().
  * @param[in] cb The function to be called by the sink node.
  * @param[out] h The sink handle.
  * @param[in] pdata Private data for the callback. This value is passed to the callback when it's invoked.
  * @return @c 0 on success. otherwise a negative error value
- * @retval #NNS_ERROR_NONE Successful
- * @retval #NNS_ERROR_STREAMS_PIPE Failed to connect a signal to sink element.
- * @retval #NNS_ERROR_INVALID_PARAMETER Given parameter is invalid. (pipe is NULL, sink_name is not found, or sink_name has an invalid type.)
+ * @retval #ML_ERROR_NONE Successful
+ * @retval #ML_ERROR_STREAMS_PIPE Failed to connect a signal to sink element.
+ * @retval #ML_ERROR_INVALID_PARAMETER Given parameter is invalid. (pipe is NULL, sink_name is not found, or sink_name has an invalid type.)
  */
-int nns_pipeline_sink_register (nns_pipeline_h pipe, const char *sink_name, nns_sink_cb cb, nns_sink_h *h, void *pdata);
+int ml_pipeline_sink_register (ml_pipeline_h pipe, const char *sink_name, ml_pipeline_sink_cb cb, ml_pipeline_sink_h *h, void *pdata);
 
 /**
  * @brief Unregisters a callback for sink (tensor_sink) of nnstreamer pipelines.
  * @since_tizen 5.5
- * @param[in] The nns_sink_handle to be unregistered (destroyed)
+ * @param[in] h The sink handle to be unregistered (destroyed)
  * @return @c 0 on success. otherwise a negative error value
- * @retval #NNS_ERROR_NONE Successful
- * @retval #NNS_ERROR_INVALID_PARAMETER Given parameter is invalid.
+ * @retval #ML_ERROR_NONE Successful
+ * @retval #ML_ERROR_INVALID_PARAMETER Given parameter is invalid.
  */
-int nns_pipeline_sink_unregister (nns_sink_h h);
+int ml_pipeline_sink_unregister (ml_pipeline_sink_h h);
 
 /**
  * @brief Gets a handle to operate as a src node of nnstreamer pipelines.
  * @since_tizen 5.5
- * @remarks If the function succeeds, @a h handle must be released using nns_pipeline_src_put_handle().
+ * @remarks If the function succeeds, @a h handle must be released using ml_pipeline_src_put_handle().
  * @param[in] pipe The pipeline to be attached with a src node.
- * @param[in] src_name The name of src node, described with nns_pipeline_construct().
+ * @param[in] src_name The name of src node, described with ml_pipeline_construct().
  * @param[out] tensors_info The cardinality, dimension, and type of given tensor/tensors.
  * @param[out] h The src handle.
  * @return 0 on success (buf is filled). otherwise a negative error value.
- * @retval #NNS_ERROR_NONE Successful
- * @retval #NNS_ERROR_INVALID_PARAMETER Given parameter is invalid.
- * @retval #NNS_ERROR_STREAMS_PIPE Fail to get SRC element.
+ * @retval #ML_ERROR_NONE Successful
+ * @retval #ML_ERROR_INVALID_PARAMETER Given parameter is invalid.
+ * @retval #ML_ERROR_STREAMS_PIPE Fail to get SRC element.
  */
-int nns_pipeline_src_get_handle (nns_pipeline_h pipe, const char *src_name, nns_tensors_info_s *tensors_info, nns_src_h *h);
+int ml_pipeline_src_get_handle (ml_pipeline_h pipe, const char *src_name, ml_tensors_info_s *tensors_info, ml_pipeline_src_h *h);
 
 /**
  * @brief Closes the given handle of a src node of nnstreamer pipelines.
  * @since_tizen 5.5
  * @param[in] h The src handle to be put (closed).
  * @return 0 on success (buf is filled). otherwise a negative error value.
- * @retval #NNS_ERROR_NONE Successful
- * @retval #NNS_ERROR_INVALID_PARAMETER Given parameter is invalid.
+ * @retval #ML_ERROR_NONE Successful
+ * @retval #ML_ERROR_INVALID_PARAMETER Given parameter is invalid.
  */
-int nns_pipeline_src_put_handle (nns_src_h h);
+int ml_pipeline_src_put_handle (ml_pipeline_src_h h);
 
 /**
  * @brief Puts an input data frame.
- * @param[in] h The nns_src_handle returned by nns_pipeline_gethandle().
+ * @param[in] h The source handle returned by ml_pipeline_src_get_handle().
  * @param[in] policy The policy of buf deallocation.
- * @param[in] buf The input buffers, in the format of tensorsinfo given by nns_pipeline_gethandle()
- * @param[in] size The sizes of input buffers. This must be consistent with the given tensorsinfo, probed by nns_pipeline_src_get_handle().
- * @param[in] num_tensors The number of tensors (number of buf and number of size) for the input frame. This must be consistent with the given tensorinfo, probed by nns_pipeline_src_get_handle(). MAX is 16 (NNS_TENSOR_SIZE_LIMIT).
+ * @param[in] buf The input buffers, in the format of tensorsinfo given by ml_pipeline_gethandle()
+ * @param[in] size The sizes of input buffers. This must be consistent with the given tensorsinfo, probed by ml_pipeline_src_get_handle().
+ * @param[in] num_tensors The number of tensors (number of buf and number of size) for the input frame. This must be consistent with the given tensorinfo, probed by ml_pipeline_src_get_handle(). MAX is 16 (ML_TENSOR_SIZE_LIMIT).
  * @return 0 on success (buf is filled). otherwise a negative error value.
- * @retval #NNS_ERROR_NONE Successful
- * @retval #NNS_ERROR_INVALID_PARAMETER Given parameter is invalid.
- * @retval #NNS_ERROR_STREAMS_PIPE The pipeline has inconsistent padcaps. Not negotiated?
- * @retval #NNS_ERROR_TRY_AGAIN The pipeline is not ready yet.
+ * @retval #ML_ERROR_NONE Successful
+ * @retval #ML_ERROR_INVALID_PARAMETER Given parameter is invalid.
+ * @retval #ML_ERROR_STREAMS_PIPE The pipeline has inconsistent padcaps. Not negotiated?
+ * @retval #ML_ERROR_TRY_AGAIN The pipeline is not ready yet.
  */
-int nns_pipeline_src_input_data (nns_src_h h, nns_buf_policy_e policy, char *buf[], const size_t size[], unsigned int num_tensors);
+int ml_pipeline_src_input_data (ml_pipeline_src_h h, ml_pipeline_buf_policy_e policy, char *buf[], const size_t size[], unsigned int num_tensors);
 
 /****************************************************
  ** NNStreamer Pipeline Switch/Valve Control       **
@@ -343,78 +353,78 @@ int nns_pipeline_src_input_data (nns_src_h h, nns_buf_policy_e policy, char *buf
  * @brief Gets a handle to operate a "GstInputSelector / GstOutputSelector" node of nnstreamer pipelines.
  * @detail Refer to https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-plugins/html/gstreamer-plugins-input-selector.html for input selectors.
  *         Refer to https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-plugins/html/gstreamer-plugins-output-selector.html for output selectors.
- * @remarks If the function succeeds, @a h handle must be released using nns_pipeline_switch_put_handle().
+ * @remarks If the function succeeds, @a h handle must be released using ml_pipeline_switch_put_handle().
  * @param[in] pipe The pipeline to be managed.
  * @param[in] switch_name The name of switch (InputSelector/OutputSelector)
  * @param[out] type The type of the switch. If NULL, it is ignored.
  * @param[out] h The switch handle.
  * @return 0 on success (buf is filled). otherwise a negative error value.
- * @retval #NNS_ERROR_NONE Successful
- * @retval #NNS_ERROR_INVALID_PARAMETER Given parameter is invalid.
+ * @retval #ML_ERROR_NONE Successful
+ * @retval #ML_ERROR_INVALID_PARAMETER Given parameter is invalid.
  */
-int nns_pipeline_switch_get_handle (nns_pipeline_h pipe, const char *switch_name, nns_switch_type_e *type, nns_switch_h *h);
+int ml_pipeline_switch_get_handle (ml_pipeline_h pipe, const char *switch_name, ml_pipeline_switch_type_e *type, ml_pipeline_switch_h *h);
 
 /**
  * @brief Closes the given switch handle.
  * @param[in] h The handle to be closed.
  * @return @c 0 on success. otherwise a negative error value
- * @retval #NNS_ERROR_NONE Successful
- * @retval #NNS_ERROR_INVALID_PARAMETER Given parameter is invalid.
+ * @retval #ML_ERROR_NONE Successful
+ * @retval #ML_ERROR_INVALID_PARAMETER Given parameter is invalid.
  */
-int nns_pipeline_switch_put_handle (nns_switch_h h);
+int ml_pipeline_switch_put_handle (ml_pipeline_switch_h h);
 
 /**
  * @brief Controls the switch with the given handle to select input/output nodes(pads).
- * @param[in] h The switch handle returned by nns_pipeline_switch_get_handle()
- * @param[in] pad_name The name of the chosen pad to be activated. Use nns_pipeline_switch_nodelist to list the available pad names.
+ * @param[in] h The switch handle returned by ml_pipeline_switch_get_handle()
+ * @param[in] pad_name The name of the chosen pad to be activated. Use ml_pipeline_switch_nodelist to list the available pad names.
  * @return @c 0 on success. otherwise a negative error value
- * @retval #NNS_ERROR_NONE Successful
- * @retval #NNS_ERROR_INVALID_PARAMETER Given parameter is invalid.
+ * @retval #ML_ERROR_NONE Successful
+ * @retval #ML_ERROR_INVALID_PARAMETER Given parameter is invalid.
  */
-int nns_pipeline_switch_select (nns_switch_h h, const char *pad_name);
+int ml_pipeline_switch_select (ml_pipeline_switch_h h, const char *pad_name);
 
 /**
  * @brief Gets the pad names of a switch.
- * @param[in] h The switch handle returned by nns_pipeline_switch_get_handle()
+ * @param[in] h The switch handle returned by ml_pipeline_switch_get_handle()
  * @param[out] list NULL terminated array of char*. The caller must free each string (char*) in the list and free the list itself.
  * @return @c 0 on success. otherwise a negative error value
- * @retval #NNS_ERROR_NONE Successful
- * @retval #NNS_ERROR_INVALID_PARAMETER Given parameter is invalid.
- * @retval #NNS_ERROR_STREAMS_PIPE The element is not both input and output switch (Internal data inconsistency).
+ * @retval #ML_ERROR_NONE Successful
+ * @retval #ML_ERROR_INVALID_PARAMETER Given parameter is invalid.
+ * @retval #ML_ERROR_STREAMS_PIPE The element is not both input and output switch (Internal data inconsistency).
  */
-int nns_pipeline_switch_nodelist (nns_switch_h h, char *** list);
+int ml_pipeline_switch_nodelist (ml_pipeline_switch_h h, char *** list);
 
 /**
  * @brief Gets a handle to operate a "GstValve" node of nnstreamer pipelines.
  * @detail Refer to https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-plugins/html/gstreamer-plugins-valve.html for more info.
- * @remarks If the function succeeds, @a h handle must be released using nns_pipeline_valve_put_handle().
+ * @remarks If the function succeeds, @a h handle must be released using ml_pipeline_valve_put_handle().
  * @param[in] pipe The pipeline to be managed.
  * @param[in] valve_name The name of valve (Valve)
  * @param[out] h The valve handle.
  * @return @c 0 on success. otherwise a negative error value
- * @retval #NNS_ERROR_NONE Successful
- * @retval #NNS_ERROR_INVALID_PARAMETER Given parameter is invalid.
+ * @retval #ML_ERROR_NONE Successful
+ * @retval #ML_ERROR_INVALID_PARAMETER Given parameter is invalid.
  */
-int nns_pipeline_valve_get_handle (nns_pipeline_h pipe, const char *valve_name, nns_valve_h *h);
+int ml_pipeline_valve_get_handle (ml_pipeline_h pipe, const char *valve_name, ml_pipeline_valve_h *h);
 
 /**
  * @brief Closes the given valve handle.
  * @param[in] h The handle to be closed.
  * @return @c 0 on success. otherwise a negative error value
- * @retval #NNS_ERROR_NONE Successful
- * @retval #NNS_ERROR_INVALID_PARAMETER Given parameter is invalid.
+ * @retval #ML_ERROR_NONE Successful
+ * @retval #ML_ERROR_INVALID_PARAMETER Given parameter is invalid.
  */
-int nns_pipeline_valve_put_handle (nns_valve_h h);
+int ml_pipeline_valve_put_handle (ml_pipeline_valve_h h);
 
 /**
  * @brief Controls the valve with the given handle.
- * @param[in] h The valve handle returned by nns_pipeline_valve_get_handle()
- * @param[in] valve_drop 1 to close (drop & stop the flow). 0 to open (let the flow pass)
+ * @param[in] h The valve handle returned by ml_pipeline_valve_get_handle()
+ * @param[in] drop 1 to close (drop & stop the flow). 0 to open (let the flow pass)
  * @return @c 0 on success. otherwise a negative error value
- * @retval #NNS_ERROR_NONE Successful
- * @retval #NNS_ERROR_INVALID_PARAMETER Given parameter is invalid.
+ * @retval #ML_ERROR_NONE Successful
+ * @retval #ML_ERROR_INVALID_PARAMETER Given parameter is invalid.
  */
-int nns_pipeline_valve_control (nns_valve_h h, int valve_drop);
+int ml_pipeline_valve_control (ml_pipeline_valve_h h, int drop);
 
 /**
  * @}
index 8f0e3ea..6b2627e 100644 (file)
@@ -52,28 +52,28 @@ extern "C" {
  * @brief Possible controls on elements of a pipeline.
  */
 typedef enum {
-  NNSAPI_UNKNOWN = 0x0,
-  NNSAPI_SINK = 0x1,
-  NNSAPI_APP_SRC = 0x2,
-  NNSAPI_APP_SINK = 0x3,
-  NNSAPI_VALVE = 0x4,
-  NNSAPI_SWITCH_INPUT = 0x8,
-  NNSAPI_SWITCH_OUTPUT = 0x9,
-} elementType;
+  ML_PIPELINE_ELEMENT_UNKNOWN = 0x0,
+  ML_PIPELINE_ELEMENT_SINK = 0x1,
+  ML_PIPELINE_ELEMENT_APP_SRC = 0x2,
+  ML_PIPELINE_ELEMENT_APP_SINK = 0x3,
+  ML_PIPELINE_ELEMENT_VALVE = 0x4,
+  ML_PIPELINE_ELEMENT_SWITCH_INPUT = 0x8,
+  ML_PIPELINE_ELEMENT_SWITCH_OUTPUT = 0x9,
+} ml_pipeline_element_type_e;
 
 /**
  * @brief Internal private representation of pipeline handle.
  */
-typedef struct _nns_pipeline nns_pipeline;
+typedef struct _ml_pipeline ml_pipeline;
 
 /**
  * @brief An element that may be controlled individually in a pipeline.
  */
-typedef struct _element {
+typedef struct _ml_pipeline_element {
   GstElement *element; /**< The Sink/Src/Valve/Switch element */
-  nns_pipeline *pipe; /**< The main pipeline */
+  ml_pipeline *pipe; /**< The main pipeline */
   char *name;
-  elementType type;
+  ml_pipeline_element_type_e type;
   GstPad *src;
   GstPad *sink; /**< Unref this at destroy */
   GstTensorsInfo tensorsinfo;
@@ -84,13 +84,13 @@ typedef struct _element {
   gulong handle_id;
 
   GMutex lock; /**< Lock for internal values */
-} element;
+} ml_pipeline_element;
 
 /**
  * @brief Internal private representation of pipeline handle.
  * @detail This should not be exposed to applications
  */
-struct _nns_pipeline {
+struct _ml_pipeline {
   GstElement *element;    /**< The pipeline itself (GstPipeline) */
   GMutex lock;            /**< Lock for pipeline operations */
   GHashTable *namednodes; /**< hash table of "element"s. */
@@ -100,43 +100,43 @@ struct _nns_pipeline {
  * @brief Internal private representation of sink handle of GstTensorSink
  * @detail This represents a single instance of callback registration. This should not be exposed to applications.
  */
-typedef struct _nns_sink {
-  nns_pipeline *pipe; /**< The pipeline, which is the owner of this nns_sink */
-  element *element;
+typedef struct _ml_pipeline_sink {
+  ml_pipeline *pipe; /**< The pipeline, which is the owner of this ml_pipeline_sink */
+  ml_pipeline_element *element;
   guint32 id;
-  nns_sink_cb cb;
+  ml_pipeline_sink_cb cb;
   void *pdata;
-} nns_sink;
+} ml_pipeline_sink;
 
 /**
  * @brief Internal private representation of src handle of GstAppSrc
  * @detail This represents a single instance of registration. This should not be exposed to applications.
  */
-typedef struct _nns_src {
-  nns_pipeline *pipe;
-  element *element;
+typedef struct _ml_pipeline_src {
+  ml_pipeline *pipe;
+  ml_pipeline_element *element;
   guint32 id;
-} nns_src;
+} ml_pipeline_src;
 
 /**
  * @brief Internal private representation of switch handle (GstInputSelector, GstOutputSelector)
  * @detail This represents a single instance of registration. This should not be exposed to applications.
  */
-typedef struct _nns_switch {
-  nns_pipeline *pipe;
-  element *element;
+typedef struct _ml_pipeline_switch {
+  ml_pipeline *pipe;
+  ml_pipeline_element *element;
   guint32 id;
-} nns_switch;
+} ml_pipeline_switch;
 
 /**
  * @brief Internal private representation of valve handle (GstValve)
  * @detail This represents a single instance of registration. This should not be exposed to applications.
  */
-typedef struct _nns_valve {
-  nns_pipeline *pipe;
-  element *element;
+typedef struct _ml_pipeline_valve {
+  ml_pipeline *pipe;
+  ml_pipeline_element *element;
   guint32 id;
-} nns_valve;
+} ml_pipeline_valve;
 
 #ifdef __cplusplus
 }
index 7f39399..7f6b5f8 100644 (file)
@@ -32,7 +32,7 @@
 
 typedef struct
 {
-  nns_pipeline_h pipe;
+  ml_pipeline_h pipe;
 
   GstElement *src;
   GstElement *sink;
@@ -44,9 +44,9 @@ typedef struct
  * @todo move this function to common
  */
 static int
-ml_util_validate_tensor_info (const nns_tensor_info_s * info)
+ml_util_validate_tensor_info (const ml_tensor_info_s * info)
 {
-  unsigned int i;
+  guint i;
 
   if (!info)
     return FALSE;
@@ -54,7 +54,7 @@ ml_util_validate_tensor_info (const nns_tensor_info_s * info)
   if (info->type < 0 || info->type >= ML_TENSOR_TYPE_UNKNOWN)
     return FALSE;
 
-  for (i = 0; i < NNS_TENSOR_RANK_LIMIT; i++) {
+  for (i = 0; i < ML_TENSOR_RANK_LIMIT; i++) {
     if (info->dimension[i] == 0)
       return FALSE;
   }
@@ -67,9 +67,9 @@ ml_util_validate_tensor_info (const nns_tensor_info_s * info)
  * @todo move this function to common
  */
 static int
-ml_util_validate_tensors_info (const nns_tensors_info_s * info)
+ml_util_validate_tensors_info (const ml_tensors_info_s * info)
 {
-  unsigned int i;
+  guint i;
 
   if (!info || info->num_tensors < 1)
     return FALSE;
@@ -86,7 +86,7 @@ ml_util_validate_tensors_info (const nns_tensors_info_s * info)
  * @brief Get caps from tensors info.
  */
 static GstCaps *
-ml_model_get_caps_from_tensors_info (const nns_tensors_info_s * info)
+ml_model_get_caps_from_tensors_info (const ml_tensors_info_s * info)
 {
   GstCaps *caps;
   GstTensorsConfig config;
@@ -123,21 +123,21 @@ ml_model_get_caps_from_tensors_info (const nns_tensors_info_s * info)
  */
 int
 ml_model_open (const char *model_path, ml_simpleshot_model_h * model,
-    const nns_tensors_info_s * input_type, const nns_tensors_info_s * output_type,
+    const ml_tensors_info_s * input_type, const ml_tensors_info_s * output_type,
     ml_model_nnfw nnfw, ml_model_hw hw)
 {
   ml_simpleshot_model *model_h;
-  nns_pipeline_h pipe;
-  nns_pipeline *pipe_h;
+  ml_pipeline_h pipe;
+  ml_pipeline *pipe_h;
   GstElement *appsrc, *appsink, *filter;
   GstCaps *caps;
-  int ret = NNS_ERROR_NONE;
+  int ret = ML_ERROR_NONE;
   gchar *pipeline_desc = NULL;
 
   /* Validate the params */
   if (!model) {
     dloge ("The given param, model is invalid.");
-    return NNS_ERROR_INVALID_PARAMETER;
+    return ML_ERROR_INVALID_PARAMETER;
   }
 
   /* init null */
@@ -146,17 +146,17 @@ ml_model_open (const char *model_path, ml_simpleshot_model_h * model,
   if (!g_file_test (model_path, G_FILE_TEST_IS_REGULAR)) {
     dloge ("The given param, model path [%s] is invalid.",
         GST_STR_NULL (model_path));
-    return NNS_ERROR_INVALID_PARAMETER;
+    return ML_ERROR_INVALID_PARAMETER;
   }
 
   if (input_type && !ml_util_validate_tensors_info (input_type)) {
     dloge ("The given param, input tensor info is invalid.");
-    return NNS_ERROR_INVALID_PARAMETER;
+    return ML_ERROR_INVALID_PARAMETER;
   }
 
   if (output_type && !ml_util_validate_tensors_info (output_type)) {
     dloge ("The given param, output tensor info is invalid.");
-    return NNS_ERROR_INVALID_PARAMETER;
+    return ML_ERROR_INVALID_PARAMETER;
   }
 
   /* 1. Determine nnfw */
@@ -171,7 +171,7 @@ ml_model_open (const char *model_path, ml_simpleshot_model_h * model,
     case ML_NNFW_TENSORFLOW_LITE:
       if (!g_str_has_suffix (model_path, ".tflite")) {
         dloge ("The given model file [%s] has invalid extension.", model_path);
-        return NNS_ERROR_INVALID_PARAMETER;
+        return ML_ERROR_INVALID_PARAMETER;
       }
 
       pipeline_desc =
@@ -182,22 +182,22 @@ ml_model_open (const char *model_path, ml_simpleshot_model_h * model,
     default:
       /** @todo Add other fw later. */
       dloge ("The given nnfw is not supported.");
-      return NNS_ERROR_NOT_SUPPORTED;
+      return ML_ERROR_NOT_SUPPORTED;
   }
 
   /* 2. Determine hw */
   /** @todo Now the param hw is ignored. (Supposed CPU only) Support others later. */
 
   /* 3. Construct a pipeline */
-  ret = nns_pipeline_construct (pipeline_desc, &pipe);
+  ret = ml_pipeline_construct (pipeline_desc, &pipe);
   g_free (pipeline_desc);
-  if (ret != NNS_ERROR_NONE) {
+  if (ret != ML_ERROR_NONE) {
     /* Failed to construct pipeline. */
     return ret;
   }
 
   /* 4. Allocate */
-  pipe_h = (nns_pipeline *) pipe;
+  pipe_h = (ml_pipeline *) pipe;
   appsrc = gst_bin_get_by_name (GST_BIN (pipe_h->element), "srcx");
   appsink = gst_bin_get_by_name (GST_BIN (pipe_h->element), "sinkx");
   filter = gst_bin_get_by_name (GST_BIN (pipe_h->element), "filterx");
@@ -214,7 +214,7 @@ ml_model_open (const char *model_path, ml_simpleshot_model_h * model,
   if (input_type) {
     caps = ml_model_get_caps_from_tensors_info (input_type);
   } else {
-    nns_tensors_info_s in_info;
+    ml_tensors_info_s in_info;
 
     ml_model_get_input_type (model_h, &in_info);
     if (!ml_util_validate_tensors_info (&in_info)) {
@@ -231,7 +231,7 @@ ml_model_open (const char *model_path, ml_simpleshot_model_h * model,
   if (output_type) {
     caps = ml_model_get_caps_from_tensors_info (output_type);
   } else {
-    nns_tensors_info_s out_info;
+    ml_tensors_info_s out_info;
 
     ml_model_get_output_type (model_h, &out_info);
     if (!ml_util_validate_tensors_info (&out_info)) {
@@ -246,13 +246,13 @@ ml_model_open (const char *model_path, ml_simpleshot_model_h * model,
   gst_caps_unref (caps);
 
   /* 5. Start pipeline */
-  ret = nns_pipeline_start (pipe);
-  if (ret != NNS_ERROR_NONE) {
+  ret = ml_pipeline_start (pipe);
+  if (ret != ML_ERROR_NONE) {
     /* Failed to construct pipeline. */
     goto error;
   }
 
-  return NNS_ERROR_NONE;
+  return ML_ERROR_NONE;
 
 error:
   ml_model_close (pipe);
@@ -270,7 +270,7 @@ ml_model_close (ml_simpleshot_model_h model)
 
   if (!model) {
     dloge ("The given param, model is invalid.");
-    return NNS_ERROR_INVALID_PARAMETER;
+    return ML_ERROR_INVALID_PARAMETER;
   }
 
   model_h = (ml_simpleshot_model *) model;
@@ -290,7 +290,7 @@ ml_model_close (ml_simpleshot_model_h model)
     model_h->filter = NULL;
   }
 
-  ret = nns_pipeline_destroy (model_h->pipe);
+  ret = ml_pipeline_destroy (model_h->pipe);
   g_free (model_h);
   return ret;
 }
@@ -298,13 +298,13 @@ ml_model_close (ml_simpleshot_model_h model)
 /**
  * @brief Invoke the model with the given input data. (more info in nnstreamer-single.h)
  */
-tensor_data *
+ml_tensor_data_s *
 ml_model_inference (ml_simpleshot_model_h model,
-    const tensor_data * input, tensor_data * output)
+    const ml_tensor_data_s * input, ml_tensor_data_s * output)
 {
   ml_simpleshot_model *model_h;
-  nns_tensors_info_s out_info;
-  tensor_data *result;
+  ml_tensors_info_s out_info;
+  ml_tensor_data_s *result;
   GstSample *sample;
   GstBuffer *buffer;
   GstMemory *mem;
@@ -320,7 +320,7 @@ ml_model_inference (ml_simpleshot_model_h model,
   model_h = (ml_simpleshot_model *) model;
 
   status = ml_model_get_output_type (model, &out_info);
-  if (status != NNS_ERROR_NONE)
+  if (status != ML_ERROR_NONE)
     return NULL;
 
   /* Validate output memory and size */
@@ -393,7 +393,7 @@ ml_model_inference (ml_simpleshot_model_h model,
  */
 int
 ml_model_get_input_type (ml_simpleshot_model_h model,
-    nns_tensors_info_s * input_type)
+    ml_tensors_info_s * input_type)
 {
   ml_simpleshot_model *model_h;
   GstTensorsInfo info;
@@ -401,7 +401,7 @@ ml_model_get_input_type (ml_simpleshot_model_h model,
   guint rank;
 
   if (!model || !input_type)
-    return NNS_ERROR_INVALID_PARAMETER;
+    return ML_ERROR_INVALID_PARAMETER;
 
   model_h = (ml_simpleshot_model *) model;
 
@@ -431,7 +431,7 @@ ml_model_get_input_type (ml_simpleshot_model_h model,
   }
   /** @todo Make common structure for tensor config */
   memcpy (input_type, &info, sizeof (GstTensorsInfo));
-  return NNS_ERROR_NONE;
+  return ML_ERROR_NONE;
 }
 
 /**
@@ -439,7 +439,7 @@ ml_model_get_input_type (ml_simpleshot_model_h model,
  */
 int
 ml_model_get_output_type (ml_simpleshot_model_h model,
-    nns_tensors_info_s * output_type)
+    ml_tensors_info_s * output_type)
 {
   ml_simpleshot_model *model_h;
   GstTensorsInfo info;
@@ -447,7 +447,7 @@ ml_model_get_output_type (ml_simpleshot_model_h model,
   guint rank;
 
   if (!model || !output_type)
-    return NNS_ERROR_INVALID_PARAMETER;
+    return ML_ERROR_INVALID_PARAMETER;
 
   model_h = (ml_simpleshot_model *) model;
 
@@ -477,14 +477,14 @@ ml_model_get_output_type (ml_simpleshot_model_h model,
   }
   /** @todo Make common structure for tensor config */
   memcpy (output_type, &info, sizeof (GstTensorsInfo));
-  return NNS_ERROR_NONE;
+  return ML_ERROR_NONE;
 }
 
 /**
  * @brief Get the byte size of the given tensor type. (more info in nnstreamer-single.h)
  */
 size_t
-ml_util_get_tensor_size (const nns_tensor_info_s * info)
+ml_util_get_tensor_size (const ml_tensor_info_s * info)
 {
   size_t tensor_size;
   gint i;
@@ -495,22 +495,22 @@ ml_util_get_tensor_size (const nns_tensor_info_s * info)
   }
 
   switch (info->type) {
-  case NNS_TENSOR_TYPE_INT8:
-  case NNS_TENSOR_TYPE_UINT8:
+  case ML_TENSOR_TYPE_INT8:
+  case ML_TENSOR_TYPE_UINT8:
     tensor_size = 1;
     break;
-  case NNS_TENSOR_TYPE_INT16:
-  case NNS_TENSOR_TYPE_UINT16:
+  case ML_TENSOR_TYPE_INT16:
+  case ML_TENSOR_TYPE_UINT16:
     tensor_size = 2;
     break;
-  case NNS_TENSOR_TYPE_INT32:
-  case NNS_TENSOR_TYPE_UINT32:
-  case NNS_TENSOR_TYPE_FLOAT32:
+  case ML_TENSOR_TYPE_INT32:
+  case ML_TENSOR_TYPE_UINT32:
+  case ML_TENSOR_TYPE_FLOAT32:
     tensor_size = 4;
     break;
-  case NNS_TENSOR_TYPE_FLOAT64:
-  case NNS_TENSOR_TYPE_INT64:
-  case NNS_TENSOR_TYPE_UINT64:
+  case ML_TENSOR_TYPE_FLOAT64:
+  case ML_TENSOR_TYPE_INT64:
+  case ML_TENSOR_TYPE_UINT64:
     tensor_size = 8;
     break;
   default:
@@ -518,7 +518,7 @@ ml_util_get_tensor_size (const nns_tensor_info_s * info)
     return 0;
   }
 
-  for (i = 0; i < NNS_TENSOR_RANK_LIMIT; i++) {
+  for (i = 0; i < ML_TENSOR_RANK_LIMIT; i++) {
     tensor_size *= info->dimension[i];
   }
 
@@ -529,7 +529,7 @@ ml_util_get_tensor_size (const nns_tensor_info_s * info)
  * @brief Get the byte size of the given tensors info. (more info in nnstreamer-single.h)
  */
 size_t
-ml_util_get_tensors_size (const nns_tensors_info_s * info)
+ml_util_get_tensors_size (const ml_tensors_info_s * info)
 {
   size_t tensor_size;
   gint i;
@@ -546,7 +546,7 @@ ml_util_get_tensors_size (const nns_tensors_info_s * info)
  * @brief Free the tensors type pointer. (more info in nnstreamer-single.h)
  */
 void
-ml_model_free_tensors_info (nns_tensors_info_s * type)
+ml_model_free_tensors_info (ml_tensors_info_s * type)
 {
   /** @todo Make common structure for tensor config and use gst_tensors_info_free () */
 }
@@ -555,7 +555,7 @@ ml_model_free_tensors_info (nns_tensors_info_s * type)
  * @brief Free the tensors data pointer. (more info in nnstreamer-single.h)
  */
 void
-ml_model_free_tensor_data (tensor_data * tensor)
+ml_model_free_tensor_data (ml_tensor_data_s * tensor)
 {
   gint i;
 
@@ -579,10 +579,10 @@ ml_model_free_tensor_data (tensor_data * tensor)
 /**
  * @brief Allocate a tensor data frame with the given tensors type. (more info in nnstreamer-single.h)
  */
-tensor_data *
-ml_model_allocate_tensor_data (const nns_tensors_info_s * info)
+ml_tensor_data_s *
+ml_model_allocate_tensor_data (const ml_tensors_info_s * info)
 {
-  tensor_data *data;
+  ml_tensor_data_s *data;
   gint i;
 
   if (!info) {
@@ -590,7 +590,7 @@ ml_model_allocate_tensor_data (const nns_tensors_info_s * info)
     return NULL;
   }
 
-  data = g_new0 (tensor_data, 1);
+  data = g_new0 (ml_tensor_data_s, 1);
   if (!data) {
     dloge ("Failed to allocate the memory block.");
     return NULL;
index 23dee9b..a2c6ee4 100644 (file)
 #include <gst/app/app.h>        /* To push data to pipeline */
 
 #define handle_init(type, name, h) \
-  nns_##type *name= (h); \
-  nns_pipeline *p; \
-  element *elem; \
-  int ret = NNS_ERROR_NONE; \
+  ml_pipeline_##type *name= (h); \
+  ml_pipeline *p; \
+  ml_pipeline_element *elem; \
+  int ret = ML_ERROR_NONE; \
   if (h == NULL) { \
     dloge ("The given handle is invalid"); \
-    return NNS_ERROR_INVALID_PARAMETER; \
+    return ML_ERROR_INVALID_PARAMETER; \
   } \
 \
   p = name->pipe; \
   elem = name->element; \
   if (p == NULL || elem == NULL || p != elem->pipe) { \
     dloge ("The handle appears to be broken."); \
-    return NNS_ERROR_INVALID_PARAMETER; \
+    return ML_ERROR_INVALID_PARAMETER; \
   } \
 \
   g_mutex_lock (&p->lock); \
@@ -54,7 +54,7 @@
 \
   if (NULL == g_list_find (elem->handles, name)) { \
     dloge ("The handle does not exists."); \
-    ret = NNS_ERROR_INVALID_PARAMETER; \
+    ret = ML_ERROR_INVALID_PARAMETER; \
     goto unlock_return; \
   }
 
@@ -67,11 +67,11 @@ unlock_return: \
 /**
  * @brief Internal function to create a refereable element in a pipeline
  */
-static element *
-construct_element (GstElement * e, nns_pipeline * p, const char *name,
-    elementType t)
+static ml_pipeline_element *
+construct_element (GstElement * e, ml_pipeline * p, const char *name,
+    ml_pipeline_element_type_e t)
 {
-  element *ret = g_new0 (element, 1);
+  ml_pipeline_element *ret = g_new0 (ml_pipeline_element, 1);
   ret->element = e;
   ret->pipe = p;
   ret->name = g_strdup (name);
@@ -88,53 +88,53 @@ construct_element (GstElement * e, nns_pipeline * p, const char *name,
 }
 
 /**
- * @brief Internal function to convert GstTensorsInfo into nns_tensors_info_s structure.
+ * @brief Internal function to convert GstTensorsInfo into ml_tensors_info_s structure.
  */
 static int
 get_tensors_info_from_GstTensorsInfo (GstTensorsInfo * gst_tensorsinfo,
-    nns_tensors_info_s * tensors_info)
+    ml_tensors_info_s * tensors_info)
 {
   if (!gst_tensorsinfo) {
     dloge ("GstTensorsInfo should not be NULL!");
-    return NNS_ERROR_INVALID_PARAMETER;
+    return ML_ERROR_INVALID_PARAMETER;
   }
 
   if (!tensors_info) {
-    dloge ("The param nns_tensors_info_s should not be NULL!");
-    return NNS_ERROR_INVALID_PARAMETER;
+    dloge ("The param ml_tensors_info_s should not be NULL!");
+    return ML_ERROR_INVALID_PARAMETER;
   }
 
   /** Currently, the data structures of GstTensorsInfo are
-   * completely same as that of nns_tensors_info_s. */
+   * completely same as that of ml_tensors_info_s. */
   memcpy (tensors_info, gst_tensorsinfo, sizeof (GstTensorsInfo));
 
-  return NNS_ERROR_NONE;
+  return ML_ERROR_NONE;
 }
 
 /**
- * @brief Handle a sink element for registered nns_sink_cb
+ * @brief Handle a sink element for registered ml_pipeline_sink_cb
  */
 static void
 cb_sink_event (GstElement * e, GstBuffer * b, gpointer data)
 {
-  element *elem = data;
+  ml_pipeline_element *elem = data;
 
   /** @todo CRITICAL if the pipeline is being killed, don't proceed! */
 
-  GstMemory *mem[NNS_TENSOR_SIZE_LIMIT];
-  GstMapInfo info[NNS_TENSOR_SIZE_LIMIT];
+  GstMemory *mem[ML_TENSOR_SIZE_LIMIT];
+  GstMapInfo info[ML_TENSOR_SIZE_LIMIT];
   guint i;
   guint num_mems;
   GList *l;
-  const char *buf[NNS_TENSOR_SIZE_LIMIT];
-  size_t size[NNS_TENSOR_SIZE_LIMIT];
+  const char *buf[ML_TENSOR_SIZE_LIMIT];
+  size_t size[ML_TENSOR_SIZE_LIMIT];
   size_t total_size = 0;
 
   num_mems = gst_buffer_n_memory (b);
 
-  if (num_mems > NNS_TENSOR_SIZE_LIMIT) {
+  if (num_mems > ML_TENSOR_SIZE_LIMIT) {
     dloge ("Number of memory chunks in a GstBuffer exceed the limit: %u > %u",
-        num_mems, NNS_TENSOR_SIZE_LIMIT);
+        num_mems, ML_TENSOR_SIZE_LIMIT);
     return;
   }
 
@@ -226,9 +226,9 @@ cb_sink_event (GstElement * e, GstBuffer * b, gpointer data)
 
   /* Iterate e->handles, pass the data to them */
   for (l = elem->handles; l != NULL; l = l->next) {
-    nns_tensors_info_s tensors_info;
-    nns_sink *sink = l->data;
-    nns_sink_cb callback = sink->cb;
+    ml_tensors_info_s tensors_info;
+    ml_pipeline_sink *sink = l->data;
+    ml_pipeline_sink_cb callback = sink->cb;
 
     get_tensors_info_from_GstTensorsInfo (&elem->tensorsinfo, &tensors_info);
 
@@ -247,7 +247,7 @@ cb_sink_event (GstElement * e, GstBuffer * b, gpointer data)
 }
 
 /**
- * @brief Handle a appsink element for registered nns_sink_cb
+ * @brief Handle a appsink element for registered ml_pipeline_sink_cb
  */
 static GstFlowReturn
 cb_appsink_new_sample (GstElement * e, gpointer user_data)
@@ -266,12 +266,13 @@ cb_appsink_new_sample (GstElement * e, gpointer user_data)
 }
 
 /**
- * @brief Private function for nns_pipeline_destroy, cleaning up nodes in namednodes
+ * @brief Private function for ml_pipeline_destroy, cleaning up nodes in namednodes
  */
 static void
 cleanup_node (gpointer data)
 {
-  element *e = data;
+  ml_pipeline_element *e = data;
+
   g_mutex_lock (&e->lock);
   g_free (e->name);
   if (e->src)
@@ -294,17 +295,17 @@ cleanup_node (gpointer data)
  * @brief Construct the pipeline (more info in nnstreamer.h)
  */
 int
-nns_pipeline_construct (const char *pipeline_description, nns_pipeline_h * pipe)
+ml_pipeline_construct (const char *pipeline_description, ml_pipeline_h * pipe)
 {
   GError *err = NULL;
   GstElement *pipeline;
   GstIterator *it = NULL;
-  int ret = NNS_ERROR_NONE;
+  int ret = ML_ERROR_NONE;
 
-  nns_pipeline *pipe_h;
+  ml_pipeline *pipe_h;
 
   if (pipe == NULL)
-    return NNS_ERROR_INVALID_PARAMETER;
+    return ML_ERROR_INVALID_PARAMETER;
 
   /* init null */
   *pipe = NULL;
@@ -316,7 +317,7 @@ nns_pipeline_construct (const char *pipeline_description, nns_pipeline_h * pipe)
     } else {
       dloge ("Cannot initialize GStreamer. Unknown reason.");
     }
-    return NNS_ERROR_STREAMS_PIPE;
+    return ML_ERROR_STREAMS_PIPE;
   }
 
   pipeline = gst_parse_launch (pipeline_description, &err);
@@ -330,10 +331,10 @@ nns_pipeline_construct (const char *pipeline_description, nns_pipeline_h * pipe)
           ("Cannot parse and launch the given pipeline = [%s], unknown reason",
           pipeline_description);
     }
-    return NNS_ERROR_STREAMS_PIPE;
+    return ML_ERROR_STREAMS_PIPE;
   }
 
-  pipe_h = g_new0 (nns_pipeline, 1);
+  pipe_h = g_new0 (ml_pipeline, 1);
   *pipe = pipe_h;
   g_assert (GST_IS_PIPELINE (pipeline));
   pipe_h->element = pipeline;
@@ -364,25 +365,30 @@ nns_pipeline_construct (const char *pipeline_description, nns_pipeline_h * pipe)
             GstElement *elem = GST_ELEMENT (obj);
             name = gst_element_get_name (elem);
             if (name != NULL) {
-              element *e = NULL;
+              ml_pipeline_element *e = NULL;
 
               if (G_TYPE_CHECK_INSTANCE_TYPE (elem,
                       gst_element_factory_get_element_type (tensor_sink))) {
-                e = construct_element (elem, pipe_h, name, NNSAPI_SINK);
+                e = construct_element (elem, pipe_h, name,
+                    ML_PIPELINE_ELEMENT_SINK);
               } else if (G_TYPE_CHECK_INSTANCE_TYPE (elem, GST_TYPE_APP_SRC)) {
-                e = construct_element (elem, pipe_h, name, NNSAPI_APP_SRC);
+                e = construct_element (elem, pipe_h, name,
+                    ML_PIPELINE_ELEMENT_APP_SRC);
               } else if (G_TYPE_CHECK_INSTANCE_TYPE (elem, GST_TYPE_APP_SINK)) {
-                e = construct_element (elem, pipe_h, name, NNSAPI_APP_SINK);
+                e = construct_element (elem, pipe_h, name,
+                    ML_PIPELINE_ELEMENT_APP_SINK);
               } else if (G_TYPE_CHECK_INSTANCE_TYPE (elem,
                       gst_element_factory_get_element_type (valve))) {
-                e = construct_element (elem, pipe_h, name, NNSAPI_VALVE);
+                e = construct_element (elem, pipe_h, name,
+                    ML_PIPELINE_ELEMENT_VALVE);
               } else if (G_TYPE_CHECK_INSTANCE_TYPE (elem,
                       gst_element_factory_get_element_type (inputs))) {
-                e = construct_element (elem, pipe_h, name, NNSAPI_SWITCH_INPUT);
+                e = construct_element (elem, pipe_h, name,
+                    ML_PIPELINE_ELEMENT_SWITCH_INPUT);
               } else if (G_TYPE_CHECK_INSTANCE_TYPE (elem,
                       gst_element_factory_get_element_type (outputs))) {
                 e = construct_element (elem, pipe_h, name,
-                    NNSAPI_SWITCH_OUTPUT);
+                    ML_PIPELINE_ELEMENT_SWITCH_OUTPUT);
               } else {
                 /** @todo CRITICAL HANDLE THIS! */
               }
@@ -421,14 +427,14 @@ nns_pipeline_construct (const char *pipeline_description, nns_pipeline_h * pipe)
  * @brief Destroy the pipeline (more info in nnstreamer.h)
  */
 int
-nns_pipeline_destroy (nns_pipeline_h pipe)
+ml_pipeline_destroy (ml_pipeline_h pipe)
 {
-  nns_pipeline *p = pipe;
+  ml_pipeline *p = pipe;
   GstStateChangeReturn scret;
   GstState state, pending;
 
   if (p == NULL)
-    return NNS_ERROR_INVALID_PARAMETER;
+    return ML_ERROR_INVALID_PARAMETER;
 
   g_mutex_lock (&p->lock);
 
@@ -439,7 +445,7 @@ nns_pipeline_destroy (nns_pipeline_h pipe)
     scret = gst_element_set_state (p->element, GST_STATE_PAUSED);
     if (scret == GST_STATE_CHANGE_FAILURE) {
       g_mutex_unlock (&p->lock);
-      return NNS_ERROR_STREAMS_PIPE;
+      return ML_ERROR_STREAMS_PIPE;
     }
   }
 
@@ -455,7 +461,7 @@ nns_pipeline_destroy (nns_pipeline_h pipe)
   scret = gst_element_set_state (p->element, GST_STATE_NULL);
   if (scret != GST_STATE_CHANGE_SUCCESS) {
     g_mutex_unlock (&p->lock);
-    return NNS_ERROR_STREAMS_PIPE;
+    return ML_ERROR_STREAMS_PIPE;
   }
 
   gst_object_unref (p->element);
@@ -464,34 +470,34 @@ nns_pipeline_destroy (nns_pipeline_h pipe)
   g_mutex_clear (&p->lock);
 
   g_free (p);
-  return NNS_ERROR_NONE;
+  return ML_ERROR_NONE;
 }
 
 /**
  * @brief Get the pipeline state (more info in nnstreamer.h)
  */
 int
-nns_pipeline_get_state (nns_pipeline_h pipe, nns_pipeline_state_e * state)
+ml_pipeline_get_state (ml_pipeline_h pipe, ml_pipeline_state_e * state)
 {
-  nns_pipeline *p = pipe;
+  ml_pipeline *p = pipe;
   GstState _state;
   GstState pending;
   GstStateChangeReturn scret;
 
   if (p == NULL || state == NULL)
-    return NNS_ERROR_INVALID_PARAMETER;
+    return ML_ERROR_INVALID_PARAMETER;
 
-  *state = NNS_PIPELINE_STATE_UNKNOWN;
+  *state = ML_PIPELINE_STATE_UNKNOWN;
 
   g_mutex_lock (&p->lock);
   scret = gst_element_get_state (p->element, &_state, &pending, 100000UL);      /* Do it within 100us! */
   g_mutex_unlock (&p->lock);
 
   if (scret == GST_STATE_CHANGE_FAILURE)
-    return NNS_ERROR_STREAMS_PIPE;
+    return ML_ERROR_STREAMS_PIPE;
 
   *state = _state;
-  return NNS_ERROR_NONE;
+  return ML_ERROR_NONE;
 }
 
 /****************************************************
@@ -501,44 +507,44 @@ nns_pipeline_get_state (nns_pipeline_h pipe, nns_pipeline_state_e * state)
  * @brief Start/Resume the pipeline! (more info in nnstreamer.h)
  */
 int
-nns_pipeline_start (nns_pipeline_h pipe)
+ml_pipeline_start (ml_pipeline_h pipe)
 {
-  nns_pipeline *p = pipe;
+  ml_pipeline *p = pipe;
   GstStateChangeReturn scret;
 
   if (p == NULL)
-    return NNS_ERROR_INVALID_PARAMETER;
+    return ML_ERROR_INVALID_PARAMETER;
 
   g_mutex_lock (&p->lock);
   scret = gst_element_set_state (p->element, GST_STATE_PLAYING);
   g_mutex_unlock (&p->lock);
 
   if (scret == GST_STATE_CHANGE_FAILURE)
-    return NNS_ERROR_STREAMS_PIPE;
+    return ML_ERROR_STREAMS_PIPE;
 
-  return NNS_ERROR_NONE;
+  return ML_ERROR_NONE;
 }
 
 /**
  * @brief Pause the pipeline! (more info in nnstreamer.h)
  */
 int
-nns_pipeline_stop (nns_pipeline_h pipe)
+ml_pipeline_stop (ml_pipeline_h pipe)
 {
-  nns_pipeline *p = pipe;
+  ml_pipeline *p = pipe;
   GstStateChangeReturn scret;
 
   if (p == NULL)
-    return NNS_ERROR_INVALID_PARAMETER;
+    return ML_ERROR_INVALID_PARAMETER;
 
   g_mutex_lock (&p->lock);
   scret = gst_element_set_state (p->element, GST_STATE_PAUSED);
   g_mutex_unlock (&p->lock);
 
   if (scret == GST_STATE_CHANGE_FAILURE)
-    return NNS_ERROR_STREAMS_PIPE;
+    return ML_ERROR_STREAMS_PIPE;
 
-  return NNS_ERROR_NONE;
+  return ML_ERROR_NONE;
 }
 
 /****************************************************
@@ -548,17 +554,17 @@ nns_pipeline_stop (nns_pipeline_h pipe)
  * @brief Register a callback for sink (more info in nnstreamer.h)
  */
 int
-nns_pipeline_sink_register (nns_pipeline_h pipe, const char *sink_name,
-    nns_sink_cb cb, nns_sink_h * h, void *pdata)
+ml_pipeline_sink_register (ml_pipeline_h pipe, const char *sink_name,
+    ml_pipeline_sink_cb cb, ml_pipeline_sink_h * h, void *pdata)
 {
-  element *elem;
-  nns_pipeline *p = pipe;
-  nns_sink *sink;
-  int ret = NNS_ERROR_NONE;
+  ml_pipeline_element *elem;
+  ml_pipeline *p = pipe;
+  ml_pipeline_sink *sink;
+  int ret = ML_ERROR_NONE;
 
   if (h == NULL) {
     dloge ("The argument sink handle is not valid.");
-    return NNS_ERROR_INVALID_PARAMETER;
+    return ML_ERROR_INVALID_PARAMETER;
   }
 
   /* init null */
@@ -566,17 +572,17 @@ nns_pipeline_sink_register (nns_pipeline_h pipe, const char *sink_name,
 
   if (pipe == NULL) {
     dloge ("The first argument, pipeline handle is not valid.");
-    return NNS_ERROR_INVALID_PARAMETER;
+    return ML_ERROR_INVALID_PARAMETER;
   }
 
   if (sink_name == NULL) {
     dloge ("The second argument, sink name is not valid.");
-    return NNS_ERROR_INVALID_PARAMETER;
+    return ML_ERROR_INVALID_PARAMETER;
   }
 
   if (cb == NULL) {
     dloge ("The callback argument, cb, is not valid.");
-    return NNS_ERROR_INVALID_PARAMETER;
+    return ML_ERROR_INVALID_PARAMETER;
   }
 
   g_mutex_lock (&p->lock);
@@ -584,25 +590,26 @@ nns_pipeline_sink_register (nns_pipeline_h pipe, const char *sink_name,
 
   if (elem == NULL) {
     dloge ("There is no element named [%s] in the pipeline.", sink_name);
-    ret = NNS_ERROR_INVALID_PARAMETER;
+    ret = ML_ERROR_INVALID_PARAMETER;
     goto unlock_return;
   }
 
-  if (elem->type != NNSAPI_SINK && elem->type != NNSAPI_APP_SINK) {
+  if (elem->type != ML_PIPELINE_ELEMENT_SINK &&
+      elem->type != ML_PIPELINE_ELEMENT_APP_SINK) {
     dloge ("The element [%s] in the pipeline is not a sink element.",
         sink_name);
-    ret = NNS_ERROR_INVALID_PARAMETER;
+    ret = ML_ERROR_INVALID_PARAMETER;
     goto unlock_return;
   }
 
   if (elem->handle_id > 0) {
     dlogw ("Sink callback is already registered.");
-    ret = NNS_ERROR_NONE;
+    ret = ML_ERROR_NONE;
     goto unlock_return;
   }
 
   /* set callback for new data */
-  if (elem->type == NNSAPI_SINK) {
+  if (elem->type == ML_PIPELINE_ELEMENT_SINK) {
     /* tensor_sink */
     g_object_set (G_OBJECT (elem->element), "emit-signal", (gboolean) TRUE,
         NULL);
@@ -620,11 +627,11 @@ nns_pipeline_sink_register (nns_pipeline_h pipe, const char *sink_name,
 
   if (elem->handle_id == 0) {
     dloge ("Failed to connect a signal to the element [%s].", sink_name);
-    ret = NNS_ERROR_STREAMS_PIPE;
+    ret = ML_ERROR_STREAMS_PIPE;
     goto unlock_return;
   }
 
-  *h = g_new0 (nns_sink, 1);
+  *h = g_new0 (ml_pipeline_sink, 1);
   sink = *h;
 
   sink->pipe = p;
@@ -649,7 +656,7 @@ unlock_return:
  * @brief Unregister a callback for sink (more info in nnstreamer.h)
  */
 int
-nns_pipeline_sink_unregister (nns_sink_h h)
+ml_pipeline_sink_unregister (ml_pipeline_sink_h h)
 {
   handle_init (sink, sink, h);
 
@@ -664,48 +671,48 @@ nns_pipeline_sink_unregister (nns_sink_h h)
 }
 
 /**
- * @brief Implementation of policies decalred by nns_buf_policy_e in nnstreamer.h,
+ * @brief Implementation of policies decalred by ml_pipeline_buf_policy_e in nnstreamer.h,
  *        "Free"
  */
 static void
-nnsbufpolicy_free (gpointer data)
+ml_buf_policy_cb_free (gpointer data)
 {
   g_free (data);
 }
 
 /**
- * @brief Implementation of policies decalred by nns_buf_policy_e in nnstreamer.h.
+ * @brief Implementation of policies decalred by ml_pipeline_buf_policy_e in nnstreamer.h.
  *        "Do Nothing"
  */
 static void
-nnsbufpolicy_nop (gpointer data)
+ml_buf_policy_cb_nop (gpointer data)
 {
   /* DO NOTHING! */
 }
 
 /**
- * @brief Implementation of policies decalred by nns_buf_policy_e in nnstreamer.h.
+ * @brief Implementation of policies decalred by ml_pipeline_buf_policy_e in nnstreamer.h.
  */
-static const GDestroyNotify bufpolicy[NNS_BUF_POLICY_MAX] = {
-  [NNS_BUF_FREE_BY_NNSTREAMER] = nnsbufpolicy_free,
-  [NNS_BUF_DO_NOT_FREE1] = nnsbufpolicy_nop,
+static const GDestroyNotify ml_buf_policy[ML_PIPELINE_BUF_POLICY_MAX] = {
+  [ML_PIPELINE_BUF_POLICY_AUTO_FREE] = ml_buf_policy_cb_free,
+  [ML_PIPELINE_BUF_POLICY_DO_NOT_FREE] = ml_buf_policy_cb_nop,
 };
 
 /**
  * @brief Get a handle to operate a src (more info in nnstreamer.h)
  */
 int
-nns_pipeline_src_get_handle (nns_pipeline_h pipe, const char *src_name,
-    nns_tensors_info_s * tensors_info, nns_src_h * h)
+ml_pipeline_src_get_handle (ml_pipeline_h pipe, const char *src_name,
+    ml_tensors_info_s * tensors_info, ml_pipeline_src_h * h)
 {
-  nns_pipeline *p = pipe;
-  element *elem;
-  nns_src *src;
-  int ret = NNS_ERROR_NONE, i;
+  ml_pipeline *p = pipe;
+  ml_pipeline_element *elem;
+  ml_pipeline_src *src;
+  int ret = ML_ERROR_NONE, i;
 
   if (h == NULL) {
     dloge ("The argument source handle is not valid.");
-    return NNS_ERROR_INVALID_PARAMETER;
+    return ML_ERROR_INVALID_PARAMETER;
   }
 
   /* init null */
@@ -713,12 +720,12 @@ nns_pipeline_src_get_handle (nns_pipeline_h pipe, const char *src_name,
 
   if (pipe == NULL) {
     dloge ("The first argument, pipeline handle is not valid.");
-    return NNS_ERROR_INVALID_PARAMETER;
+    return ML_ERROR_INVALID_PARAMETER;
   }
 
   if (src_name == NULL) {
     dloge ("The second argument, source name is not valid.");
-    return NNS_ERROR_INVALID_PARAMETER;
+    return ML_ERROR_INVALID_PARAMETER;
   }
 
   g_mutex_lock (&p->lock);
@@ -727,14 +734,14 @@ nns_pipeline_src_get_handle (nns_pipeline_h pipe, const char *src_name,
 
   if (elem == NULL) {
     dloge ("There is no element named [%s] in the pipeline.", src_name);
-    ret = NNS_ERROR_INVALID_PARAMETER;
+    ret = ML_ERROR_INVALID_PARAMETER;
     goto unlock_return;
   }
 
-  if (elem->type != NNSAPI_APP_SRC) {
+  if (elem->type != ML_PIPELINE_ELEMENT_APP_SRC) {
     dloge ("The element [%s] in the pipeline is not a source element.",
         src_name);
-    ret = NNS_ERROR_INVALID_PARAMETER;
+    ret = ML_ERROR_INVALID_PARAMETER;
     goto unlock_return;
   }
 
@@ -742,7 +749,7 @@ nns_pipeline_src_get_handle (nns_pipeline_h pipe, const char *src_name,
     elem->src = gst_element_get_static_pad (elem->element, "src");
 
   if (elem->src != NULL) {
-    /** @todo : refactor this along with nns_pipeline_src_input_data */
+    /** @todo : refactor this along with ml_pipeline_src_input_data */
     GstCaps *caps = gst_pad_get_allowed_caps (elem->src);
 
     /** @todo caps may be NULL for prerolling */
@@ -775,15 +782,15 @@ nns_pipeline_src_get_handle (nns_pipeline_h pipe, const char *src_name,
       }
     }
   } else {
-    ret = NNS_ERROR_STREAMS_PIPE;
+    ret = ML_ERROR_STREAMS_PIPE;
     goto unlock_return;
   }
 
   ret = get_tensors_info_from_GstTensorsInfo (&elem->tensorsinfo, tensors_info);
-  if (ret != NNS_ERROR_NONE)
+  if (ret != ML_ERROR_NONE)
     goto unlock_return;
 
-  *h = g_new (nns_src, 1);
+  *h = g_new (ml_pipeline_src, 1);
   src = *h;
 
   src->pipe = p;
@@ -807,7 +814,7 @@ unlock_return:
  * @brief Close a src node (more info in nnstreamer.h)
  */
 int
-nns_pipeline_src_put_handle (nns_src_h h)
+ml_pipeline_src_put_handle (ml_pipeline_src_h h)
 {
   handle_init (src, src, h);
 
@@ -820,8 +827,8 @@ nns_pipeline_src_put_handle (nns_src_h h)
  * @brief Push a data frame to a src (more info in nnstreamer.h)
  */
 int
-nns_pipeline_src_input_data (nns_src_h h,
-    nns_buf_policy_e policy, char *buf[], const size_t size[],
+ml_pipeline_src_input_data (ml_pipeline_src_h h,
+    ml_pipeline_buf_policy_e policy, char *buf[], const size_t size[],
     unsigned int num_tensors)
 {
   /** @todo NYI */
@@ -831,10 +838,10 @@ nns_pipeline_src_input_data (nns_src_h h,
 
   handle_init (src, src, h);
 
-  if (num_tensors < 1 || num_tensors > NNS_TENSOR_SIZE_LIMIT) {
+  if (num_tensors < 1 || num_tensors > ML_TENSOR_SIZE_LIMIT) {
     dloge ("The tensor size if invalid. It should be 1 ~ %u; where it is %u",
-        NNS_TENSOR_SIZE_LIMIT, num_tensors);
-    ret = NNS_ERROR_INVALID_PARAMETER;
+        ML_TENSOR_SIZE_LIMIT, num_tensors);
+    ret = ML_ERROR_INVALID_PARAMETER;
     goto unlock_return;
   }
 
@@ -874,7 +881,7 @@ nns_pipeline_src_input_data (nns_src_h h,
 
           gst_object_unref (elem->src);
           elem->src = NULL;
-          ret = NNS_ERROR_STREAMS_PIPE;
+          ret = ML_ERROR_STREAMS_PIPE;
           goto unlock_return;
         }
 
@@ -888,7 +895,7 @@ nns_pipeline_src_input_data (nns_src_h h,
 
             gst_object_unref (elem->src);
             elem->src = NULL;
-            ret = NNS_ERROR_INVALID_PARAMETER;
+            ret = ML_ERROR_INVALID_PARAMETER;
             goto unlock_return;
           }
 
@@ -901,7 +908,7 @@ nns_pipeline_src_input_data (nns_src_h h,
 
             gst_object_unref (elem->src);
             elem->src = NULL;
-            ret = NNS_ERROR_INVALID_PARAMETER;
+            ret = ML_ERROR_INVALID_PARAMETER;
             goto unlock_return;
           }
         }
@@ -915,17 +922,17 @@ nns_pipeline_src_input_data (nns_src_h h,
 
   if (elem->size == 0) {
     dlogw ("The pipeline is not ready to accept inputs. The input is ignored.");
-    ret = NNS_ERROR_TRY_AGAIN;
+    ret = ML_ERROR_TRY_AGAIN;
     goto unlock_return;
   }
 
   /* Create buffer to be pushed from buf[] */
   buffer = gst_buffer_new_wrapped_full (GST_MEMORY_FLAG_READONLY,
-      buf[0], size[0], 0, size[0], buf[0], bufpolicy[policy]);
+      buf[0], size[0], 0, size[0], buf[0], ml_buf_policy[policy]);
   for (i = 1; i < num_tensors; i++) {
     GstBuffer *addbuffer =
         gst_buffer_new_wrapped_full (GST_MEMORY_FLAG_READONLY, buf[i], size[i],
-        0, size[i], buf[i], bufpolicy[policy]);
+        0, size[i], buf[i], ml_buf_policy[policy]);
     buffer = gst_buffer_append (buffer, addbuffer);
 
     /** @todo Verify that gst_buffer_append lists tensors/gstmem in the correct order */
@@ -936,10 +943,10 @@ nns_pipeline_src_input_data (nns_src_h h,
 
   if (gret == GST_FLOW_FLUSHING) {
     dlogw ("The pipeline is not in PAUSED/PLAYING. The input may be ignored.");
-    ret = NNS_ERROR_TRY_AGAIN;
+    ret = ML_ERROR_TRY_AGAIN;
   } else if (gret == GST_FLOW_EOS) {
     dlogw ("THe pipeline is in EOS state. The input is ignored.");
-    ret = NNS_ERROR_STREAMS_PIPE;
+    ret = ML_ERROR_STREAMS_PIPE;
   }
 
   handle_exit (h);
@@ -953,17 +960,17 @@ nns_pipeline_src_input_data (nns_src_h h,
  * @brief Get a handle to operate a selector (more info in nnstreamer.h)
  */
 int
-nns_pipeline_switch_get_handle (nns_pipeline_h pipe, const char *switch_name,
-    nns_switch_type_e * type, nns_switch_h * h)
+ml_pipeline_switch_get_handle (ml_pipeline_h pipe, const char *switch_name,
+    ml_pipeline_switch_type_e * type, ml_pipeline_switch_h * h)
 {
-  element *elem;
-  nns_pipeline *p = pipe;
-  nns_switch *swtc;
-  int ret = NNS_ERROR_NONE;
+  ml_pipeline_element *elem;
+  ml_pipeline *p = pipe;
+  ml_pipeline_switch *swtc;
+  int ret = ML_ERROR_NONE;
 
   if (h == NULL) {
     dloge ("The argument switch handle is not valid.");
-    return NNS_ERROR_INVALID_PARAMETER;
+    return ML_ERROR_INVALID_PARAMETER;
   }
 
   /* init null */
@@ -971,12 +978,12 @@ nns_pipeline_switch_get_handle (nns_pipeline_h pipe, const char *switch_name,
 
   if (pipe == NULL) {
     dloge ("The first argument, pipeline handle, is not valid.");
-    return NNS_ERROR_INVALID_PARAMETER;
+    return ML_ERROR_INVALID_PARAMETER;
   }
 
   if (switch_name == NULL) {
     dloge ("The second argument, switch name, is not valid.");
-    return NNS_ERROR_INVALID_PARAMETER;
+    return ML_ERROR_INVALID_PARAMETER;
   }
 
   g_mutex_lock (&p->lock);
@@ -985,33 +992,34 @@ nns_pipeline_switch_get_handle (nns_pipeline_h pipe, const char *switch_name,
   if (elem == NULL) {
     dloge ("There is no switch element named [%s] in the pipeline.",
         switch_name);
-    ret = NNS_ERROR_INVALID_PARAMETER;
+    ret = ML_ERROR_INVALID_PARAMETER;
     goto unlock_return;
   }
 
-  if (elem->type != NNSAPI_SWITCH_INPUT && elem->type != NNSAPI_SWITCH_OUTPUT) {
+  if (elem->type != ML_PIPELINE_ELEMENT_SWITCH_INPUT &&
+      elem->type != ML_PIPELINE_ELEMENT_SWITCH_OUTPUT) {
     dloge
         ("There is an element named [%s] in the pipeline, but it is not an input/output switch",
         switch_name);
-    ret = NNS_ERROR_INVALID_PARAMETER;
+    ret = ML_ERROR_INVALID_PARAMETER;
     goto unlock_return;
   }
 
-  *h = g_new0 (nns_switch, 1);
+  *h = g_new0 (ml_pipeline_switch, 1);
   swtc = *h;
 
   swtc->pipe = p;
   swtc->element = elem;
 
   if (type) {
-    if (elem->type == NNSAPI_SWITCH_INPUT)
-      *type = NNS_SWITCH_INPUT_SELECTOR;
-    else if (elem->type == NNSAPI_SWITCH_OUTPUT)
-      *type = NNS_SWITCH_OUTPUT_SELECTOR;
+    if (elem->type == ML_PIPELINE_ELEMENT_SWITCH_INPUT)
+      *type = ML_PIPELINE_SWITCH_INPUT_SELECTOR;
+    else if (elem->type == ML_PIPELINE_ELEMENT_SWITCH_OUTPUT)
+      *type = ML_PIPELINE_SWITCH_OUTPUT_SELECTOR;
     else {
       dloge ("Internal data of switch-handle [%s] is broken. It is fatal.",
           elem->name);
-      ret = NNS_ERROR_INVALID_PARAMETER;
+      ret = ML_ERROR_INVALID_PARAMETER;
       goto unlock_return;
     }
   }
@@ -1033,7 +1041,7 @@ unlock_return:
  * @brief Close the given switch handle (more info in nnstreamer.h)
  */
 int
-nns_pipeline_switch_put_handle (nns_switch_h h)
+ml_pipeline_switch_put_handle (ml_pipeline_switch_h h)
 {
   handle_init (switch, swtc, h);
 
@@ -1046,7 +1054,7 @@ nns_pipeline_switch_put_handle (nns_switch_h h)
  * @brief Control the switch (more info in nnstreamer.h)
  */
 int
-nns_pipeline_switch_select (nns_switch_h h, const char *pad_name)
+ml_pipeline_switch_select (ml_pipeline_switch_h h, const char *pad_name)
 {
   GstPad *active_pad, *new_pad;
   gchar *active_name;
@@ -1055,7 +1063,7 @@ nns_pipeline_switch_select (nns_switch_h h, const char *pad_name)
 
   if (pad_name == NULL) {
     dloge ("The second argument, pad name, is not valid.");
-    ret = NNS_ERROR_INVALID_PARAMETER;
+    ret = ML_ERROR_INVALID_PARAMETER;
     goto unlock_return;
   }
 
@@ -1079,7 +1087,7 @@ nns_pipeline_switch_select (nns_switch_h h, const char *pad_name)
     /* Not Found! */
     dloge ("Cannot find the pad, [%s], from the switch, [%s].",
         pad_name, elem->name);
-    ret = NNS_ERROR_INVALID_PARAMETER;
+    ret = ML_ERROR_INVALID_PARAMETER;
     goto unlock_return;
   }
 
@@ -1095,7 +1103,7 @@ nns_pipeline_switch_select (nns_switch_h h, const char *pad_name)
  * @brief List nodes of a switch (more info in nnstreamer.h)
  */
 int
-nns_pipeline_switch_nodelist (nns_switch_h h, char ***list)
+ml_pipeline_switch_nodelist (ml_pipeline_switch_h h, char ***list)
 {
   GstIterator *it;
   GValue item = G_VALUE_INIT;
@@ -1108,22 +1116,22 @@ nns_pipeline_switch_nodelist (nns_switch_h h, char ***list)
 
   if (list == NULL) {
     dloge ("The second argument, list, is not valid.");
-    ret = NNS_ERROR_INVALID_PARAMETER;
+    ret = ML_ERROR_INVALID_PARAMETER;
     goto unlock_return;
   }
 
   /* init null */
   *list = NULL;
 
-  if (elem->type == NNSAPI_SWITCH_INPUT)
+  if (elem->type == ML_PIPELINE_ELEMENT_SWITCH_INPUT)
     it = gst_element_iterate_sink_pads (elem->element);
-  else if (elem->type == NNSAPI_SWITCH_OUTPUT)
+  else if (elem->type == ML_PIPELINE_ELEMENT_SWITCH_OUTPUT)
     it = gst_element_iterate_src_pads (elem->element);
   else {
     dloge
         ("The element, [%s], is supposed to be input/output switch, but it is not. Internal data structure is broken.",
         elem->name);
-    ret = NNS_ERROR_STREAMS_PIPE;
+    ret = ML_ERROR_STREAMS_PIPE;
     goto unlock_return;
   }
 
@@ -1144,7 +1152,7 @@ nns_pipeline_switch_nodelist (nns_switch_h h, char ***list)
       case GST_ITERATOR_ERROR:
         dloge ("Cannot access the list of pad properly of a switch, [%s].",
             elem->name);
-        ret = NNS_ERROR_STREAMS_PIPE;
+        ret = ML_ERROR_STREAMS_PIPE;
         break;
       case GST_ITERATOR_DONE:
         done = TRUE;
@@ -1153,7 +1161,7 @@ nns_pipeline_switch_nodelist (nns_switch_h h, char ***list)
   }
 
   /* There has been no error with that "while" loop. */
-  if (ret == NNS_ERROR_NONE) {
+  if (ret == ML_ERROR_NONE) {
     int i = 0;
     GList *l;
 
@@ -1170,7 +1178,7 @@ nns_pipeline_switch_nodelist (nns_switch_h h, char ***list)
         dloge
             ("Internal data inconsistency. This could be a bug in nnstreamer. Switch [%s].",
             elem->name);
-        ret = NNS_ERROR_STREAMS_PIPE;
+        ret = ML_ERROR_STREAMS_PIPE;
         goto unlock_return;
       }
     }
@@ -1184,17 +1192,17 @@ nns_pipeline_switch_nodelist (nns_switch_h h, char ***list)
  * @brief Get a handle to operate a Valve (more info in nnstreamer.h)
  */
 int
-nns_pipeline_valve_get_handle (nns_pipeline_h pipe, const char *valve_name,
-    nns_valve_h * h)
+ml_pipeline_valve_get_handle (ml_pipeline_h pipe, const char *valve_name,
+    ml_pipeline_valve_h * h)
 {
-  element *elem;
-  nns_pipeline *p = pipe;
-  nns_valve *valve;
-  int ret = NNS_ERROR_NONE;
+  ml_pipeline_element *elem;
+  ml_pipeline *p = pipe;
+  ml_pipeline_valve *valve;
+  int ret = ML_ERROR_NONE;
 
   if (h == NULL) {
     dloge ("The argument valve handle is not valid.");
-    return NNS_ERROR_INVALID_PARAMETER;
+    return ML_ERROR_INVALID_PARAMETER;
   }
 
   /* init null */
@@ -1202,12 +1210,12 @@ nns_pipeline_valve_get_handle (nns_pipeline_h pipe, const char *valve_name,
 
   if (pipe == NULL) {
     dloge ("The first argument, pipeline handle, is not valid.");
-    return NNS_ERROR_INVALID_PARAMETER;
+    return ML_ERROR_INVALID_PARAMETER;
   }
 
   if (valve_name == NULL) {
     dloge ("The second argument, valve name, is not valid.");
-    return NNS_ERROR_INVALID_PARAMETER;
+    return ML_ERROR_INVALID_PARAMETER;
   }
 
   g_mutex_lock (&p->lock);
@@ -1215,19 +1223,19 @@ nns_pipeline_valve_get_handle (nns_pipeline_h pipe, const char *valve_name,
 
   if (elem == NULL) {
     dloge ("There is no valve element named [%s] in the pipeline.", valve_name);
-    ret = NNS_ERROR_INVALID_PARAMETER;
+    ret = ML_ERROR_INVALID_PARAMETER;
     goto unlock_return;
   }
 
-  if (elem->type != NNSAPI_VALVE) {
+  if (elem->type != ML_PIPELINE_ELEMENT_VALVE) {
     dloge
         ("There is an element named [%s] in the pipeline, but it is not a valve",
         valve_name);
-    ret = NNS_ERROR_INVALID_PARAMETER;
+    ret = ML_ERROR_INVALID_PARAMETER;
     goto unlock_return;
   }
 
-  *h = g_new0 (nns_valve, 1);
+  *h = g_new0 (ml_pipeline_valve, 1);
   valve = *h;
 
   valve->pipe = p;
@@ -1250,7 +1258,7 @@ unlock_return:
  * @brief Close the given valve handle (more info in nnstreamer.h)
  */
 int
-nns_pipeline_valve_put_handle (nns_valve_h h)
+ml_pipeline_valve_put_handle (ml_pipeline_valve_h h)
 {
   handle_init (valve, valve, h);
 
@@ -1263,22 +1271,22 @@ nns_pipeline_valve_put_handle (nns_valve_h h)
  * @brief Control the valve with the given handle (more info in nnstreamer.h)
  */
 int
-nns_pipeline_valve_control (nns_valve_h h, int valve_drop)
+ml_pipeline_valve_control (ml_pipeline_valve_h h, int drop)
 {
-  gboolean drop;
+  gboolean current_val;
   handle_init (valve, valve, h);
 
-  g_object_get (G_OBJECT (elem->element), "drop", &drop, NULL);
+  g_object_get (G_OBJECT (elem->element), "drop", &current_val, NULL);
 
-  if ((valve_drop != 0) == (drop != FALSE)) {
+  if ((drop != 0) == (current_val != FALSE)) {
     /* Nothing to do */
     dlogi ("Valve is called, but there is no effective changes: %d->%d",
-        ! !drop, ! !valve_drop);
+        ! !current_val, ! !drop);
     goto unlock_return;
   }
 
-  g_object_set (G_OBJECT (elem->element), "drop", ! !valve_drop, NULL);
-  dlogi ("Valve is changed: %d->%d", ! !drop, ! !valve_drop);
+  g_object_set (G_OBJECT (elem->element), "drop", ! !drop, NULL);
+  dlogi ("Valve is changed: %d->%d", ! !current_val, ! !drop);
 
   handle_exit (h);
 }