[C-API] Modify element-wise control functions
authorSangjung Woo <sangjung.woo@samsung.com>
Fri, 24 Jul 2020 05:44:10 +0000 (14:44 +0900)
committerjaeyun-jung <39614140+jaeyun-jung@users.noreply.github.com>
Thu, 30 Jul 2020 05:50:12 +0000 (14:50 +0900)
To comply with Tizen API Design Guideline, this patch use single
key-value pair for ml_pipeline_element_set_property and
ml_pipeline_element_get_property function.

Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
api/capi/include/nnstreamer.h
api/capi/src/nnstreamer-capi-pipeline.c

index 1d008aa..ad39553 100644 (file)
@@ -26,6 +26,7 @@
 
 #include <stddef.h>
 #include <stdbool.h>
+#include <stdint.h>
 #include "ml-api-common.h"
 
 #ifdef __cplusplus
@@ -113,7 +114,7 @@ typedef void *ml_pipeline_switch_h;
 typedef void *ml_pipeline_valve_h;
 
 /**
- * @brief A handle of a common element (i.e. All GstElement except AppSrc, AppSink, TensorSink, Selector and Valve) of an NNStreamer pipeline
+ * @brief A handle of a common element (i.e. All GstElement except AppSrc, AppSink, TensorSink, Selector and Valve) of an NNStreamer pipeline.
  * @since_tizen 6.0
  */
 typedef void *ml_pipeline_element_h;
@@ -600,156 +601,293 @@ int ml_pipeline_valve_set_open (ml_pipeline_valve_h valve_handle, bool open);
 /**
  * @brief Gets an element handle in NNStreamer pipelines to control its properties.
  * @since_tizen 6.0
- * @remarks If the function succeeds, @a elm_h handle must be released using ml_pipeline_element_release_handle().
+ * @remarks If the function succeeds, @a elem_h handle must be released using ml_pipeline_element_release_handle().
  * @param[in] pipe The pipeline to be managed.
  * @param[in] element_name The name of element to control.
- * @param[out] elm_h The element handle.
+ * @param[out] elem_h The element handle.
  * @return @c 0 on success. Otherwise a negative error value.
- * @retval #ML_ERROR_NONE Successful
+ * @retval #ML_ERROR_NONE Successful.
  * @retval #ML_ERROR_NOT_SUPPORTED Not supported.
  * @retval #ML_ERROR_INVALID_PARAMETER Given parameter is invalid.
  * @retval #ML_ERROR_OUT_OF_MEMORY Failed to allocate required memory.
- */
-int ml_pipeline_element_get_handle (ml_pipeline_h pipe, const char *element_name, ml_pipeline_element_h *elm_h);
-
-/**
- * @brief Releases the given element handle.
- * @since_tizen 6.0
- * @param[in] elm_h The handle to be released.
- * @return @c 0 on success. Otherwise a negative error value.
- * @retval #ML_ERROR_NONE Successful
- * @retval #ML_ERROR_NOT_SUPPORTED Not supported.
- * @retval #ML_ERROR_INVALID_PARAMETER Given parameter is invalid.
- */
-int ml_pipeline_element_release_handle (ml_pipeline_element_h elm_h);
-
-/**
- * @brief Sets element properties in NNStreamer pipelines.
- * @since_tizen 6.0
- * @remarks This function supports a varying number of name/value pairs, finished by NULL.
- * @remarks If one of given property name does not exist, all properties are not set.
- * @param[in] elm_h The target element handle.
- * @param[in] first_property_name The name of first property to set.
- * @param[in] ... A varying number of name/value pairs, finished by NULL.
- * @return @c 0 on success. Otherwise a negative error value.
- * @retval #ML_ERROR_NONE Successful
- * @retval #ML_ERROR_NOT_SUPPORTED Not supported.
- * @retval #ML_ERROR_INVALID_PARAMETER Given parameter is invalid or given property name does not exist.
  *
  * Here is an example of the usage:
  * @code
- * ml_pipeline_h handle;
- * ml_pipeline_element_h elem_h;
+ * ml_pipeline_h handle = nullptr;
+ * ml_pipeline_element_h demux_h = nullptr;
  * gchar *pipeline;
- * gchar *ret_mode = NULL;
- * gboolean ret_silent;
+ * gchar *ret_tensorpick;
  * int status;
  *
- * // Pipeline description
  * pipeline = g_strdup("videotestsrc ! video/x-raw,format=RGB,width=640,height=480 ! videorate max-rate=1 ! " \
- * "tensor_converter ! tensor_mux name=mux ! tensor_demux ! tensor_sink");
+ *    "tensor_converter ! tensor_mux ! tensor_demux name=demux ! tensor_sink");
  *
+ * // Construct a pipeline
  * status = ml_pipeline_construct (pipeline, NULL, NULL, &handle);
  * if (status != ML_ERROR_NONE) {
- *   // handle error case
- *   goto error;
+ *  // handle error case
+ *  goto error;
  * }
  *
  * // Get the handle of target element
- * status = ml_pipeline_element_get_handle (handle, "mux", &elem_h);
+ * status = ml_pipeline_element_get_handle (handle, "demux", &demux_h);
  * if (status != ML_ERROR_NONE) {
- *   // handle error case
- *   goto error;
+ *  // handle error case
+ *  goto error;
  * }
  *
- * // Set single property of target element
- * status = ml_pipeline_element_set_property(elem_h, "sync_mode", "slowest", NULL);
+ * // Set the string value of given element's property
+ * status = ml_pipeline_element_set_property_string (demux_h, "tensorpick", "1,2");
  * if (status != ML_ERROR_NONE) {
- *   // handle error case
- *   goto error;
+ *  // handle error case
+ *  goto error;
  * }
  *
- * // Set multiple properties of target element
- * status = ml_pipeline_element_set_property(elem_h, "sync_mode", "nosync",
- *   "silent", TRUE, NULL);
+ * // Get the string value of given element's property
+ * status = ml_pipeline_element_get_property_string (demux_h, "tensorpick", &ret_tensorpick);
  * if (status != ML_ERROR_NONE) {
- *   // handle error case
- *   goto error;
+ *  // handle error case
+ *  goto error;
+ * }
+ * // check the property value of given element
+ * if (!g_str_equal (ret_tensorpick, "1,2")) {
+ *  // handle error case
+ *  goto error;
  * }
  *
  * error:
- * ml_pipeline_element_release_handle (elem_h);
- * ml_pipeline_destroy (handle);
+ *  ml_pipeline_element_release_handle (demux_h);
+ *  ml_pipeline_destroy (handle);
  * g_free(pipeline);
  * @endcode
  */
-int ml_pipeline_element_set_property (ml_pipeline_element_h elm_h, const char *first_property_name, ...);
+int ml_pipeline_element_get_handle (ml_pipeline_h pipe, const char *element_name, ml_pipeline_element_h *elem_h);
 
 /**
- * @brief Gets element properties in NNStreamer pipelines.
+ * @brief Releases the given element handle.
  * @since_tizen 6.0
- * @remarks This function supports a varying number of name/return location pairs, finished by NULL.
- * @remarks If one of given property name does not exist, error code returns without fetching any properties.
- * @remarks The callers is responsible for freeing the allocated memory by calling g_free().
- * @param[in] elm_h The target element handle.
- * @param[in] first_property_name The name of first property to get.
- * @param[in] ... A varying number of name/return location pairs, finished by NULL.
+ * @param[in] elem_h The handle to be released.
  * @return @c 0 on success. Otherwise a negative error value.
- * @retval #ML_ERROR_NONE Successful
+ * @retval #ML_ERROR_NONE Successful.
  * @retval #ML_ERROR_NOT_SUPPORTED Not supported.
- * @retval #ML_ERROR_INVALID_PARAMETER Given parameter is invalid or given property name does not exist.
- *
- * Here is an example of the usage:
- * @code
- * ml_pipeline_h handle;
- * ml_pipeline_element_h elem_h;
- * gchar *pipeline;
- * gchar *ret_mode = NULL;
- * gboolean ret_silent;
- * int status;
- *
- * // Pipeline description
- * pipeline = g_strdup("videotestsrc ! video/x-raw,format=RGB,width=640,height=480 ! videorate max-rate=1 ! " \
- * "tensor_converter ! tensor_mux name=mux ! tensor_demux ! tensor_sink");
- *
- * status = ml_pipeline_construct (pipeline, NULL, NULL, &handle);
- * if (status != ML_ERROR_NONE) {
- *   // handle error case
- *   goto error;
- * }
- *
- * // Get the handle of target element
- * status = ml_pipeline_element_get_handle (handle, "mux", &elem_h);
- * if (status != ML_ERROR_NONE) {
- *   // handle error case
- *   goto error;
- * }
- *
- * // Get single property of target element
- * status = ml_pipeline_element_get_property (elem_h, "sync_mode", &ret_mode, NULL);
- * if (status != ML_ERROR_NONE) {
- *   // handle error case
- *   goto error;
- * }
- * g_assert_true (g_strcmp0 ("slowest", ret_mode) == 0);
- * g_free (ret_mode);
- *
- * // Get multiple properties of target element
- * status = ml_pipeline_element_get_property (elem_h, "sync_mode", &ret_mode,
- *   "silent", &ret_silent, NULL);
- * if (status != ML_ERROR_NONE) {
- *   // handle error case
- *   goto error;
- * }
- * g_free (ret_mode);
- *
- * error:
- * ml_pipeline_element_release_handle (elem_h);
- * ml_pipeline_destroy (handle);
- * g_free(pipeline);
- * @endcode
+ * @retval #ML_ERROR_INVALID_PARAMETER Given parameter is invalid.
+ */
+int ml_pipeline_element_release_handle (ml_pipeline_element_h elem_h);
+
+/**
+ * @brief Sets the boolean value of element's property in NNStreamer pipelines.
+ * @since_tizen 6.0
+ * @param[in] elem_h The target element handle.
+ * @param[in] property_name The name of the property.
+ * @param[in] value The boolean value to be set.
+ * @return @c 0 on success. Otherwise a negative error value.
+ * @retval #ML_ERROR_NONE Successful.
+ * @retval #ML_ERROR_NOT_SUPPORTED Not supported.
+ * @retval #ML_ERROR_INVALID_PARAMETER Given property name does not exist or the type is not boolean.
+ */
+int ml_pipeline_element_set_property_bool (ml_pipeline_element_h elem_h, const char *property_name, const int32_t value);
+
+/**
+ * @brief Sets the string value of element's property in NNStreamer pipelines.
+ * @since_tizen 6.0
+ * @param[in] elem_h The target element handle.
+ * @param[in] property_name The name of the property.
+ * @param[in] value The string value to be set.
+ * @return @c 0 on success. Otherwise a negative error value.
+ * @retval #ML_ERROR_NONE Successful.
+ * @retval #ML_ERROR_NOT_SUPPORTED Not supported.
+ * @retval #ML_ERROR_INVALID_PARAMETER Given property name does not exist or the type is not string.
+ */
+int ml_pipeline_element_set_property_string (ml_pipeline_element_h elem_h, const char *property_name, const char *value);
+
+/**
+ * @brief Sets the integer value of element's property in NNStreamer pipelines.
+ * @since_tizen 6.0
+ * @param[in] elem_h The target element handle.
+ * @param[in] property_name The name of the property.
+ * @param[in] value The integer value to be set.
+ * @retval #ML_ERROR_NONE Successful.
+ * @retval #ML_ERROR_NOT_SUPPORTED Not supported.
+ * @retval #ML_ERROR_INVALID_PARAMETER Given property name does not exist or the type is not integer.
+ */
+int ml_pipeline_element_set_property_int32 (ml_pipeline_element_h elem_h, const char *property_name, const int32_t value);
+
+/**
+ * @brief Sets the integer 64bit value of element's property in NNStreamer pipelines.
+ * @since_tizen 6.0
+ * @remarks This function supports both Integer64 and Long.
+ * @param[in] elem_h The target element handle.
+ * @param[in] property_name The name of the property.
+ * @param[in] value The integer value to be set.
+ * @retval #ML_ERROR_NONE Successful.
+ * @retval #ML_ERROR_NOT_SUPPORTED Not supported.
+ * @retval #ML_ERROR_INVALID_PARAMETER Given property name does not exist or the type is not integer.
+ */
+int ml_pipeline_element_set_property_int64 (ml_pipeline_element_h elem_h, const char *property_name, const int64_t value);
+
+/**
+ * @brief Sets the unsigned integer value of element's property in NNStreamer pipelines.
+ * @since_tizen 6.0
+ * @param[in] elem_h The target element handle.
+ * @param[in] property_name The name of the property.
+ * @param[in] value The unsigned integer value to be set.
+ * @return @c 0 on success. Otherwise a negative error value.
+ * @retval #ML_ERROR_NONE Successful.
+ * @retval #ML_ERROR_NOT_SUPPORTED Not supported.
+ * @retval #ML_ERROR_INVALID_PARAMETER Given property name does not exist or the type is not unsigned integer.
+ */
+int ml_pipeline_element_set_property_uint32 (ml_pipeline_element_h elem_h, const char *property_name, const uint32_t value);
+
+/**
+ * @brief Sets the unsigned integer 64bit value of element's property in NNStreamer pipelines.
+ * @since_tizen 6.0
+ * @remarks This function supports both Unsigned Integer64 and Unsigned Long.
+ * @param[in] elem_h The target element handle.
+ * @param[in] property_name The name of the property.
+ * @param[in] value The unsigned integer 64bit value to be set.
+ * @return @c 0 on success. Otherwise a negative error value.
+ * @retval #ML_ERROR_NONE Successful.
+ * @retval #ML_ERROR_NOT_SUPPORTED Not supported.
+ * @retval #ML_ERROR_INVALID_PARAMETER Given property name does not exist or the type is not unsigned integer.
+ */
+int ml_pipeline_element_set_property_uint64 (ml_pipeline_element_h elem_h, const char *property_name, const uint64_t value);
+
+/**
+ * @brief Sets the floating point value of element's property in NNStreamer pipelines.
+ * @since_tizen 6.0
+ * @remarks This function supports all types of floating point values such as Double and Float.
+ * @param[in] elem_h The target element handle.
+ * @param[in] property_name The name of the property.
+ * @param[in] value The floating point integer value to be set.
+ * @return @c 0 on success. Otherwise a negative error value.
+ * @retval #ML_ERROR_NONE Successful.
+ * @retval #ML_ERROR_NOT_SUPPORTED Not supported.
+ * @retval #ML_ERROR_INVALID_PARAMETER Given property name does not exist or the type is not floating point number.
+ */
+int ml_pipeline_element_set_property_double (ml_pipeline_element_h elem_h, const char *property_name, const double value);
+
+/**
+ * @brief Sets the enumeration value of element's property in NNStreamer pipelines.
+ * @since_tizen 6.0
+ * @remarks Enumeration value is set as an unsigned integer value and developers can get this information using gst-inspect tool.
+ * @param[in] elem_h The target element handle.
+ * @param[in] property_name The name of the property.
+ * @param[in] value The unsigned integer value to be set, which is corresponding to Enumeration value.
+ * @return @c 0 on success. Otherwise a negative error value.
+ * @retval #ML_ERROR_NONE Successful.
+ * @retval #ML_ERROR_NOT_SUPPORTED Not supported.
+ * @retval #ML_ERROR_INVALID_PARAMETER Given property name does not exist or the type is not unsigned integer.
+ */
+int ml_pipeline_element_set_property_enum (ml_pipeline_element_h elem_h, const char *property_name, const uint32_t value);
+
+/**
+ * @brief Gets the boolean value of element's property in NNStreamer pipelines.
+ * @since_tizen 6.0
+ * @param[in] elem_h The target element handle.
+ * @param[in] property_name The name of the property.
+ * @param[out] value The boolean value of given property.
+ * @return @c 0 on success. Otherwise a negative error value.
+ * @retval #ML_ERROR_NONE Successful.
+ * @retval #ML_ERROR_NOT_SUPPORTED Not supported.
+ * @retval #ML_ERROR_INVALID_PARAMETER Given property name does not exist or the third parameter is NULL.
+ */
+int ml_pipeline_element_get_property_bool (ml_pipeline_element_h elem_h, const char *property_name, int32_t *value);
+
+/**
+ * @brief Gets the string value of element's property in NNStreamer pipelines.
+ * @since_tizen 6.0
+ * @param[in] elem_h The target element handle.
+ * @param[in] property_name The name of the property.
+ * @param[out] value The string value of given property.
+ * @return @c 0 on success. Otherwise a negative error value.
+ * @retval #ML_ERROR_NONE Successful.
+ * @retval #ML_ERROR_NOT_SUPPORTED Not supported.
+ * @retval #ML_ERROR_INVALID_PARAMETER Given property name does not exist or the third parameter is NULL.
+ */
+int ml_pipeline_element_get_property_string (ml_pipeline_element_h elem_h, const char *property_name, char **value);
+
+/**
+ * @brief Gets the integer value of element's property in NNStreamer pipelines.
+ * @since_tizen 6.0
+ * @param[in] elem_h The target element handle.
+ * @param[in] property_name The name of the property.
+ * @param[out] value The integer value of given property.
+ * @return @c 0 on success. Otherwise a negative error value.
+ * @retval #ML_ERROR_NONE Successful.
+ * @retval #ML_ERROR_NOT_SUPPORTED Not supported.
+ * @retval #ML_ERROR_INVALID_PARAMETER Given property name does not exist or the third parameter is NULL.
+ */
+int ml_pipeline_element_get_property_int32 (ml_pipeline_element_h elem_h, const char *property_name, int32_t *value);
+
+/**
+ * @brief Gets the integer 64bit value of element's property in NNStreamer pipelines.
+ * @since_tizen 6.0
+ * @remarks This function supports both Integer64 and Long.
+ * @param[in] elem_h The target element handle.
+ * @param[in] property_name The name of the property.
+ * @param[out] value The integer 64bit value of given property.
+ * @return @c 0 on success. Otherwise a negative error value.
+ * @retval #ML_ERROR_NONE Successful.
+ * @retval #ML_ERROR_NOT_SUPPORTED Not supported.
+ * @retval #ML_ERROR_INVALID_PARAMETER Given property name does not exist or the third parameter is NULL.
+ */
+int ml_pipeline_element_get_property_int64 (ml_pipeline_element_h elem_h, const char *property_name, int64_t *value);
+
+
+/**
+ * @brief Gets the unsigned integer value of element's property in NNStreamer pipelines.
+ * @since_tizen 6.0
+ * @param[in] elem_h The target element handle.
+ * @param[in] property_name The name of the property.
+ * @param[out] value The unsigned integer value of given property.
+ * @return @c 0 on success. Otherwise a negative error value.
+ * @retval #ML_ERROR_NONE Successful.
+ * @retval #ML_ERROR_NOT_SUPPORTED Not supported.
+ * @retval #ML_ERROR_INVALID_PARAMETER Given property name does not exist or the third parameter is NULL.
+ */
+int ml_pipeline_element_get_property_uint32 (ml_pipeline_element_h elem_h, const char *property_name, uint32_t *value);
+
+/**
+ * @brief Gets the unsigned integer 64bit value of element's property in NNStreamer pipelines.
+ * @since_tizen 6.0
+ * @remarks This function supports both Unsigned Integer64 and Unsigned Long.
+ * @param[in] elem_h The target element handle.
+ * @param[in] property_name The name of the property.
+ * @param[out] value The unsigned integer 64bit value of given property.
+ * @return @c 0 on success. Otherwise a negative error value.
+ * @retval #ML_ERROR_NONE Successful.
+ * @retval #ML_ERROR_NOT_SUPPORTED Not supported.
+ * @retval #ML_ERROR_INVALID_PARAMETER Given property name does not exist or the third parameter is NULL.
+ */
+int ml_pipeline_element_get_property_uint64 (ml_pipeline_element_h elem_h, const char *property_name, uint64_t *value);
+
+/**
+ * @brief Gets the floating point value of element's property in NNStreamer pipelines.
+ * @since_tizen 6.0
+ * @remarks This function supports all types of floating point values such as Double and Float.
+ * @param[in] elem_h The target element handle.
+ * @param[in] property_name The name of the property.
+ * @param[out] value The floating point value of given property.
+ * @return @c 0 on success. Otherwise a negative error value.
+ * @retval #ML_ERROR_NONE Successful.
+ * @retval #ML_ERROR_NOT_SUPPORTED Not supported.
+ * @retval #ML_ERROR_INVALID_PARAMETER Given property name does not exist or the third parameter is NULL.
+ */
+int ml_pipeline_element_get_property_double (ml_pipeline_element_h elem_h, const char *property_name, double *value);
+
+/**
+ * @brief Gets the enumeration value of element's property in NNStreamer pipelines.
+ * @since_tizen 6.0
+ * @remarks Enumeration value is get as an unsigned integer value and developers can get this information using gst-inspect tool.
+ * @param[in] elem_h The target element handle.
+ * @param[in] property_name The name of the property.
+ * @param[out] value The unsigned integer value of given property, which is corresponding to Enumeration value.
+ * @return @c 0 on success. Otherwise a negative error value.
+ * @retval #ML_ERROR_NONE Successful.
+ * @retval #ML_ERROR_NOT_SUPPORTED Not supported.
+ * @retval #ML_ERROR_INVALID_PARAMETER Given property name does not exist or the third parameter is NULL.
  */
-int ml_pipeline_element_get_property (ml_pipeline_element_h elm_h, const char *first_property_name, ...);
+int ml_pipeline_element_get_property_enum (ml_pipeline_element_h elem_h, const char *property_name, uint32_t *value);
 
 /****************************************************
  ** NNStreamer Utilities                           **
index 43e16a4..e923d20 100644 (file)
@@ -1592,7 +1592,7 @@ ml_pipeline_valve_set_open (ml_pipeline_valve_h h, bool open)
  */
 int
 ml_pipeline_element_get_handle (ml_pipeline_h pipe, const char *element_name,
-    ml_pipeline_element_h *elm_h)
+    ml_pipeline_element_h *elem_h)
 {
   int ret = ML_ERROR_NONE;
   ml_pipeline_element *elem;
@@ -1610,11 +1610,11 @@ ml_pipeline_element_get_handle (ml_pipeline_h pipe, const char *element_name,
     return ML_ERROR_INVALID_PARAMETER;
   }
 
-  if (elm_h == NULL) {
+  if (elem_h == NULL) {
     ml_loge ("The argument element handle is not valid.");
     return ML_ERROR_INVALID_PARAMETER;
   }
-  *elm_h = NULL;
+  *elem_h = NULL;
 
   g_mutex_lock (&p->lock);
 
@@ -1646,7 +1646,7 @@ ml_pipeline_element_get_handle (ml_pipeline_h pipe, const char *element_name,
     goto unlock_return;
   }
 
-  common_elem = *elm_h = g_new0(ml_pipeline_common_elem, 1);
+  common_elem = *elem_h = g_new0(ml_pipeline_common_elem, 1);
   if (common_elem == NULL) {
     ml_loge ("Failed to allocate the internal handler for %s.", element_name);
     ret = ML_ERROR_OUT_OF_MEMORY;
@@ -1671,103 +1671,271 @@ unlock_return:
  * @brief Releases the given element handle.
  */
 int
-ml_pipeline_element_release_handle (ml_pipeline_element_h elm_h)
+ml_pipeline_element_release_handle (ml_pipeline_element_h elem_h)
 {
-  handle_init (common_elem, elm_h);
+  handle_init (common_elem, elem_h);
 
   elem->handles = g_list_remove (elem->handles, common_elem);
   g_free (common_elem);
 
-  handle_exit (elm_h);
+  handle_exit (elem_h);
 }
 
 /**
- * @brief Sets element properties in NNStreamer pipelines.
+ * @brief Check property existence and its type.
  */
-int ml_pipeline_element_set_property (ml_pipeline_element_h elm_h,
-    const char *first_property_name, ...)
+static bool
+ml_pipeline_element_check_property (GObjectClass *class, const char *property_name, const GType type)
 {
-  va_list args_check;
-  va_list args;
-  const char *name;
+  GParamSpec *pspec = NULL;
 
-  handle_init (common_elem, elm_h);
+  /* Check property existence */
+  pspec = g_object_class_find_property (class, property_name);
+  if (pspec == NULL) {
+    ml_loge ("The property name [%s] does not exist.", property_name);
+    return FALSE;
+  }
+
+  /* Compare property's type with given type */
+  if (!((pspec->value_type == type) ||
+    (type == G_TYPE_ENUM && G_TYPE_IS_ENUM (pspec->value_type)) ||
+    (type == G_TYPE_INT64 && pspec->value_type == G_TYPE_LONG) ||
+    (type == G_TYPE_UINT64 && pspec->value_type == G_TYPE_ULONG) ||
+    (type == G_TYPE_DOUBLE && pspec->value_type == G_TYPE_FLOAT))) {
+    ml_loge ("The type of property name [%s] is '%s'", property_name, g_type_name(pspec->value_type));
+    return FALSE;
+  }
+  return TRUE;
+}
 
-  /* Check input parameter */
-  if (first_property_name == NULL) {
-    ml_loge ("The second argument, first property name is not valid.");
+/**
+ * @brief Sets the value of given element's property in NNStreamer pipelines.
+ */
+static int
+ml_pipeline_element_set_property (ml_pipeline_element_h elem_h,
+  const char *property_name, gpointer value, GType type)
+{
+  handle_init (common_elem, elem_h);
+
+  /* Check the input parameter */
+  if (property_name == NULL) {
+    ml_loge ("The second argument, property name is not valid.");
     ret = ML_ERROR_INVALID_PARAMETER;
     goto unlock_return;
   }
 
-  /* Check property existence */
-  va_start (args_check, first_property_name);
-  va_copy (args, args_check);
-
-  name = first_property_name;
-  while (name) {
-    if (g_object_class_find_property (G_OBJECT_GET_CLASS (elem->element), name) == NULL) {
-      ml_loge ("The property name [%s] does not exist.", name);
-      ret = ML_ERROR_INVALID_PARAMETER;
-      va_end (args_check);
-      va_end (args);
-      goto unlock_return;
-    }
-    /* The value: skipped */
-    va_arg (args_check, gchar*);
-    name = va_arg (args_check, gchar*);
+  /* Check property existence & its type */
+  if (!ml_pipeline_element_check_property (G_OBJECT_GET_CLASS (elem->element), property_name, type)) {
+    ret = ML_ERROR_INVALID_PARAMETER;
+    goto unlock_return;
   }
-  va_end (args_check);
 
-  g_object_set_valist (G_OBJECT (elem->element), first_property_name, args);
-  va_end (args);
+  /* Set property */
+  if (type == G_TYPE_DOUBLE || type == G_TYPE_FLOAT) {
+    g_object_set (G_OBJECT (elem->element), property_name, *(double *)value, NULL);
+  } else if (type == G_TYPE_INT64) {
+    g_object_set (G_OBJECT (elem->element), property_name, *(int64_t *)value, NULL);
+  } else if (type == G_TYPE_UINT64) {
+    g_object_set (G_OBJECT (elem->element), property_name, *(uint64_t *)value, NULL);
+  } else {
+    g_object_set (G_OBJECT (elem->element), property_name, value, NULL);
+  }
 
-  handle_exit (elm_h);
+  handle_exit (elem_h);
 }
 
 /**
- * @brief Gets element properties in NNStreamer pipelines.
+ * @brief Gets the value of given element's property in NNStreamer pipelines.
  */
-int ml_pipeline_element_get_property (ml_pipeline_element_h elm_h,
-    const char *first_property_name, ...)
+static int
+ml_pipeline_element_get_property (ml_pipeline_element_h elem_h,
+       const char *property_name, GType type, gpointer pvalue)
 {
-  va_list args_check;
-  va_list args;
-  const char *name;
+  handle_init (common_elem, elem_h);
 
-  handle_init (common_elem, elm_h);
-
-  /* Check input parameter */
-  if (first_property_name == NULL) {
-    ml_loge ("The second argument, first property name is not valid.");
+  /* Check the input parameter */
+  if (property_name == NULL) {
+    ml_loge ("The second argument, property_name is not valid.");
     ret = ML_ERROR_INVALID_PARAMETER;
     goto unlock_return;
   }
 
-  /* Check property existence */
-  va_start (args_check, first_property_name);
-  va_copy (args, args_check);
+  if (pvalue == NULL) {
+    ml_loge ("The third argument, value is not valid.");
+    ret = ML_ERROR_INVALID_PARAMETER;
+    goto unlock_return;
+  }
 
-  name = first_property_name;
-  while (name) {
-    if (g_object_class_find_property (G_OBJECT_GET_CLASS (elem->element), name) == NULL) {
-      ml_loge ("The property name [%s] does not exist.", name);
-      ret = ML_ERROR_INVALID_PARAMETER;
-      va_end (args_check);
-      va_end (args);
-      goto unlock_return;
-    }
-    /* The value location: skiped */
-    va_arg (args_check, gchar*);
-    name = va_arg (args_check, gchar*);
+  /* Check property existence & its type */
+  if (!ml_pipeline_element_check_property (G_OBJECT_GET_CLASS (elem->element), property_name, type)) {
+    ret = ML_ERROR_INVALID_PARAMETER;
+    goto unlock_return;
   }
-  va_end (args_check);
 
   /* Get property */
-  g_object_get_valist (G_OBJECT (elem->element), first_property_name, args);
-  va_end (args);
+  g_object_get (G_OBJECT (elem->element), property_name, pvalue, NULL);
+
+  handle_exit (elem_h);
+}
 
-  handle_exit (elm_h);
+/**
+ * @brief Sets the boolean value of element's property in NNStreamer pipelines.
+ */
+int
+ml_pipeline_element_set_property_bool (ml_pipeline_element_h elem_h,
+  const char *property_name, const int32_t value)
+{
+  return ml_pipeline_element_set_property (elem_h, property_name, GINT_TO_POINTER(value), G_TYPE_BOOLEAN);
+}
+
+/**
+ * @brief Sets the string value of element's property in NNStreamer pipelines.
+ */
+int
+ml_pipeline_element_set_property_string (ml_pipeline_element_h elem_h,
+  const char *property_name, const char *value)
+{
+  return ml_pipeline_element_set_property (elem_h, property_name, (gpointer)value, G_TYPE_STRING);
+}
+
+/**
+ * @brief Sets the integer value of element's property in NNStreamer pipelines.
+ */
+int
+ml_pipeline_element_set_property_int32 (ml_pipeline_element_h elem_h,
+  const char *property_name, const int32_t value)
+{
+  return ml_pipeline_element_set_property (elem_h, property_name, GINT_TO_POINTER(value), G_TYPE_INT);
+}
+
+/**
+ * @brief Sets the integer 64bit value of element's property in NNStreamer pipelines.
+ */
+int
+ml_pipeline_element_set_property_int64 (ml_pipeline_element_h elem_h,
+  const char *property_name, const int64_t value)
+{
+  return ml_pipeline_element_set_property (elem_h, property_name, (gpointer)&value, G_TYPE_INT64);
+}
+
+/**
+ * @brief Sets the unsigned integer value of element's property in NNStreamer pipelines.
+ */
+int
+ml_pipeline_element_set_property_uint32 (ml_pipeline_element_h elem_h,
+  const char *property_name, const uint32_t value)
+{
+  return ml_pipeline_element_set_property (elem_h, property_name, GUINT_TO_POINTER(value), G_TYPE_UINT);
+}
+
+/**
+ * @brief Sets the unsigned integer 64bit value of element's property in NNStreamer pipelines.
+ */
+int
+ml_pipeline_element_set_property_uint64 (ml_pipeline_element_h elem_h,
+  const char *property_name, const uint64_t value)
+{
+  return ml_pipeline_element_set_property (elem_h, property_name, (gpointer)&value, G_TYPE_UINT64);
+}
+
+/**
+ * @brief Sets the floating point value of element's property in NNStreamer pipelines.
+ */
+int
+ml_pipeline_element_set_property_double (ml_pipeline_element_h elem_h,
+  const char *property_name, const double value)
+{
+  return ml_pipeline_element_set_property (elem_h, property_name, (gpointer)&value, G_TYPE_DOUBLE);
+}
+
+/**
+ * @brief Sets the enumeration value of element's property in NNStreamer pipelines.
+ */
+int
+ml_pipeline_element_set_property_enum (ml_pipeline_element_h elem_h,
+  const char *property_name, const uint32_t value)
+{
+  return ml_pipeline_element_set_property (elem_h, property_name, GUINT_TO_POINTER(value), G_TYPE_ENUM);
+}
+
+/**
+ * @brief Gets the boolean value of element's property in NNStreamer pipelines.
+ */
+int
+ml_pipeline_element_get_property_bool (ml_pipeline_element_h elem_h,
+  const char *property_name, int32_t *value)
+{
+  return ml_pipeline_element_get_property (elem_h, property_name, G_TYPE_BOOLEAN, (gpointer)value);
+}
+
+/**
+ * @brief Gets the string value of element's property in NNStreamer pipelines.
+ */
+int
+ml_pipeline_element_get_property_string (ml_pipeline_element_h elem_h,
+  const char *property_name, char **value)
+{
+  return ml_pipeline_element_get_property (elem_h, property_name, G_TYPE_STRING, (gpointer)value);
+}
+
+/**
+ * @brief Gets the integer value of element's property in NNStreamer pipelines.
+ */
+int
+ml_pipeline_element_get_property_int32 (ml_pipeline_element_h elem_h,
+  const char *property_name, int32_t *value)
+{
+  return ml_pipeline_element_get_property (elem_h, property_name, G_TYPE_INT, (gpointer)value);
+}
+
+/**
+ * @brief Gets the integer 64bit value of element's property in NNStreamer pipelines.
+ */
+int
+ml_pipeline_element_get_property_int64 (ml_pipeline_element_h elem_h,
+  const char *property_name, int64_t *value)
+{
+  return ml_pipeline_element_get_property (elem_h, property_name, G_TYPE_INT64, (gpointer)value);
+}
+
+/**
+ * @brief Gets the unsigned integer value of element's property in NNStreamer pipelines.
+ */
+int
+ml_pipeline_element_get_property_uint32 (ml_pipeline_element_h elem_h,
+  const char *property_name, uint32_t *value)
+{
+  return ml_pipeline_element_get_property (elem_h, property_name, G_TYPE_UINT, (gpointer)value);
+}
+
+/**
+ * @brief Gets the unsigned integer 64bit value of element's property in NNStreamer pipelines.
+ */
+int
+ml_pipeline_element_get_property_uint64 (ml_pipeline_element_h elem_h,
+  const char *property_name, uint64_t *value)
+{
+  return ml_pipeline_element_get_property (elem_h, property_name, G_TYPE_UINT64, (gpointer)value);
+}
+
+/**
+ * @brief Gets the floating point value of element's property in NNStreamer pipelines.
+ */
+int
+ml_pipeline_element_get_property_double (ml_pipeline_element_h elem_h,
+  const char *property_name, double *value)
+{
+  return ml_pipeline_element_get_property (elem_h, property_name, G_TYPE_DOUBLE, (gpointer)value);
+}
+
+/**
+ * @brief Gets the enumeration value of element's property in NNStreamer pipelines.
+ */
+int
+ml_pipeline_element_get_property_enum (ml_pipeline_element_h elem_h,
+  const char *property_name, uint32_t *value)
+{
+  return ml_pipeline_element_get_property (elem_h, property_name, G_TYPE_ENUM, (gpointer)value);
 }
 
 /**