[0.2.116] mm_attrs: Export API set located in mm_attrs_private.h
[platform/core/multimedia/libmm-common.git] / include / mm_attrs.h
index 2f8b070..5d146e1 100644 (file)
@@ -86,7 +86,7 @@ typedef enum {
 
 
 /**
- * Validity structure
+ * Validity structure.
  */
 typedef struct {
        MMAttrsType type;
@@ -137,6 +137,42 @@ typedef struct {
        };
 } MMAttrsInfo;
 
+/**
+ * Value structure.
+ */
+typedef struct {
+       MMAttrsType type;
+       int size;
+       union {
+               int i_val;
+               double d_val;
+               char *s_val;
+               void *p_val;
+       } value;
+} MMAttrsValue;
+
+/**
+ * Construction information structure.
+ */
+typedef struct {
+       char *name;
+       MMAttrsType value_type;
+       int flags;
+       void *default_value;
+} MMAttrsConstructInfo;
+
+/**
+ * Attributes commit callback function type.
+ *
+ * @param      index   [in]    Index of attribute
+ * @param      name    [in]    Name of attribute
+ * @param      value   [in]    Value of attribute
+ * @param      user_param      [in]    User parameter
+ *
+ * @return     This callback function should return true on success, or false on failure.
+ * @see                mm_attrs_new
+ */
+typedef bool (*mm_attrs_commit_callback) (int index, const char *name, const MMAttrsValue *value, void *user_param);
 
 #if     __GNUC__ >= 4
 #define __NULL_TERMINATED __attribute__((__sentinel__))
@@ -145,11 +181,64 @@ typedef struct {
 #endif
 
 /**
+ * This function is to create handle of attributes list and register the commit callback.
+ *
+ * @param      info    [in]    Attributes construction information
+ * @param      count   [in]    The number of attributes
+ * @param      name    [in]    Name of the attributes list (optional, this can be NULL)
+ * @param      callback        [in]    Commit callback (optional, this can be NULL)
+ * @param      user_param      [in]    User param of the commit callback (optional, this can be NULL)
+ * @param      attrs   [out]   Handle of attributes list
+ *
+ * @return     This function returns MM_ERROR_NONE on success, or negative value with error code.
+ * @see        mm_attrs_commit_all
+ * @see        mm_attrs_commit
+ * @see        mm_attrs_free
+ */
+int mm_attrs_new(MMAttrsConstructInfo *info, int count, const char *name,
+                                                               mm_attrs_commit_callback callback, void *user_param, MMHandleType *attrs);
+
+
+/**
+ * This function releases resources and destroy the attributes handle created by mm_attrs_new.
+ *
+ * @param      attrs   [in]    Handle of attributes list
+ * @see                mm_attrs_new
+ */
+void mm_attrs_free(MMHandleType attrs);
+
+
+/**
+ * This function is to commit all the attributes.
+ *
+ * @param      attrs   [in]    Handle of attributes list
+ *
+ * @return     This function returns MM_ERROR_NONE on success, or negative value with error code.
+ * @see                mm_attrs_new
+ * @see                mm_attrs_commit
+ */
+int mm_attrs_commit_all(MMHandleType attrs);
+
+
+/**
+ * This function is to commit the attribute.
+ *
+ * @param      attrs   [in]    Handle of attributes list
+ * @param      index   [in]    Index of attribute
+ *
+ * @return     This function returns MM_ERROR_NONE on success, or negative value with error code.
+ * @see                mm_attrs_new
+ * @see                mm_attrs_commit_all
+ */
+int mm_attrs_commit(MMHandleType attrs, int index);
+
+
+/**
  * This function is to set the integer value to the attribute by name.
  *
- * @param      attrs           [in] MMAttrs handle
- * @param      attr_name       [in] attribute name
- * @param      val                     [in] integer value to set
+ * @param      attrs           [in]    Handle of attributes list
+ * @param      attr_name       [in]    Name of attribute
+ * @param      val                     [in]    Integer value to set
  *
  * @return     This function returns MM_ERROR_NONE on success, or negative value with error code.
  */
@@ -171,7 +260,7 @@ int mm_attrs_get_size(MMHandleType attrs, int *size);
  * This function is to get the name of attribute at the given index.
  *
  * @param      attrs           [in]    Handle of attributes list
- * @param      index           [in]    Index of the attribute
+ * @param      index           [in]    Index of attribute
  * @param      name            [out]   Name of attribute
  *
  * @return     This function returns the name of attribute on success, or NULL
@@ -208,9 +297,9 @@ int mm_attrs_get_int_by_name(MMHandleType attrs, const char *attr_name, int *val
 /**
  * This function is to set the string to attribute by name.
  *
- * @param      attrs           [in] MMAttrs handle
- * @param      attr_name       [in] attribute name
- * @param      string          [in] string value to set
+ * @param      attrs           [in]    MMAttrs handle
+ * @param      attr_name       [in]    Name of attribute
+ * @param      string          [in]    String value to set
  *
  * @return     This function returns MM_ERROR_NONE on success, or negative value with error code.
  */
@@ -233,21 +322,22 @@ int mm_attrs_get_string_by_name(MMHandleType attrs, const char *attr_name, char
 /**
  * This function is to set the data to the attribute by name.
  *
- * @param      attrs           [in] MMAttrs handle
- * @param      attr_name       [in] attribute name
- * @param      data            [in] data pointer to set
- * @param      size            [in] data size to set
+ * @param      attrs           [in]    Handle of attributes list
+ * @param      attr_name       [in]    Name of attribute
+ * @param      data            [in]    Data pointer to set
+ * @param      size            [in]    Data size to set
  *
  * @return     This function returns MM_ERROR_NONE on success, or negative value with error code.
  */
 int mm_attrs_set_data_by_name(MMHandleType attrs, const char *attr_name, void *data, int size);
 
+
 /**
  * This function is to get the data from the attribute by name.
  *
  * @param      attrs           [in]    Handle of attributes list
  * @param      attr_name       [in]    Name of attribute
- * @param      data            [out] data pointer to set
+ * @param      data            [out]   Data pointer to set
  *
  * @return     This function returns user defined value on success, or NULL
  *                     on failure
@@ -258,9 +348,9 @@ int mm_attrs_get_data_by_name(MMHandleType attrs, const char *attr_name, void **
 /**
  * This function is to retrieve type of attribute.
  *
- * @param      attrs           [in] List of attributes
- * @param      index           [in] Index of attribute
- * @param      attrtype        [out] On return contains type of attribute
+ * @param      attrs           [in]    List of attributes
+ * @param      index           [in]    Index of attribute
+ * @param      attrtype        [out]   Type of attribute
  *
  * @return     This function returns MM_ERROR_NONE.
  * @see                MMAttrsType
@@ -271,9 +361,9 @@ int mm_attrs_get_type(MMHandleType attrs, int index, MMAttrsType *attrtype);
 /**
  * This function is to get flags of attribute with given index.
  *
- * @param      attrs   [in] List of attributes
- * @param      index   [in] Index of attribute
- * @param      flags   [out] On return contains flags of attribute.
+ * @param      attrs   [in]    List of attributes
+ * @param      index   [in]    Index of attribute
+ * @param      flags   [out]   Flags of attribute
  *
  * @return     This function returns MM_ERROR_NONE on success, or negative value with error code.
  * @see                MMAttrsFlag
@@ -284,23 +374,23 @@ int mm_attrs_get_flags(MMHandleType attrs, int index, int *flags);
 /**
  * This function is to get valid value type of attribute with given index.
  *
- * @param      attrs   [in] List of attributes
- * @param      index   [in] Index of attribute
- * @param      type    [out] On return contains valid value type of attribute
+ * @param      attrs   [in]    List of attributes
+ * @param      index   [in]    Index of attribute
+ * @param      type    [out]   Valid value type of attribute
  *
  * @return     This function returns MM_ERROR_NONE on success, or negative value with error code.
  * @see                MMAttrsType
  */
-int mm_attrs_get_valid_type(MMHandleType attrs, int index, int *type);
+int mm_attrs_get_valid_type(MMHandleType attrs, int index, MMAttrsValidType *type);
 
 
 /**
  * This function is to get valid range of attribute with given index.
  *
- * @param      attrs   [in] List of attributes
- * @param      index   [in] Index of attribute
- * @param      min             [out] minimum value of the valid range
- * @param      max             [out] maximum value of the valid range
+ * @param      attrs   [in]    List of attributes
+ * @param      index   [in]    Index of attribute
+ * @param      min             [out]   Minimum value of the valid range
+ * @param      max             [out]   Maximum value of the valid range
  *
  * @return     This function returns MM_ERROR_NONE on success, or negative value with error code.
  */
@@ -310,10 +400,10 @@ int mm_attrs_get_valid_range(MMHandleType attrs, int index, int *min, int *max);
 /**
  * This function is to get valid array of attribute with given index.
  *
- * @param      attrs   [in] list of attributes
- * @param      index   [in] Index of attribute
- * @param      count   [out] number of array
- * @param      array   [out] on return contains valid array of attribute
+ * @param      attrs   [in]    List of attributes
+ * @param      index   [in]    Index of attribute
+ * @param      count   [out]   The number of array
+ * @param      array   [out]   Valid array of attribute
  *
  * @return     This function returns MM_ERROR_NONE on success, or negative value with error code.
  */
@@ -323,9 +413,9 @@ int mm_attrs_get_valid_array(MMHandleType attrs, int index, int *count,  int **a
 /**
  * This function is to set integer value to attribute with given index.
  *
- * @param      attrs   [in] List of attributes
- * @param      index   [in] Index of attribute
- * @param      val             [in] integer value to set
+ * @param      attrs   [in]    List of attributes
+ * @param      index   [in]    Index of attribute
+ * @param      val             [in]    Integer value to set
  *
  * @return     This function returns MM_ERROR_NONE on success, or negative value with error code.
  * @see                mm_attrs_get_int
@@ -336,9 +426,9 @@ int mm_attrs_set_int(MMHandleType attrs, int index, int val);
 /**
  * This function is to get integer value to attribute with given index.
  *
- * @param      attrs   [in] List of attributes
- * @param      index   [in] Index of attribute
- * @param      val             [out] On return contains integer value of attribute
+ * @param      attrs   [in]    List of attributes
+ * @param      index   [in]    Index of attribute
+ * @param      val             [out]   Integer value of attribute
  *
  * @return     This function returns MM_ERROR_NONE on success, or negative value with error code.
  * @remarks    If type of attributes is not an integer type, the value which is returned by this function is meaningless.
@@ -377,7 +467,7 @@ int mm_attrs_set_double_by_name(MMHandleType attrs, const char *attr_name, doubl
  *
  * @param      attrs           [in]    List of attributes
  * @param      index           [in]    Index of attribute
- * @param      attrval         [out]   On return contains double value of attribute on success, or invalid value.
+ * @param      attrval         [out]   Double value of attribute on success, or invalid value
  *
  * @return     This function returns MM_ERROR_NONE on success, or negative value with error code.
  * @see                mm_attrs_set_double
@@ -400,10 +490,10 @@ int mm_attrs_get_double_by_name(MMHandleType attrs, const char *attr_name, doubl
 /**
  * This function is to set string to attribute with given index.
  *
- * @param      attrs           [in] List of attributes
- * @param      index           [in] Index of attribute
- * @param      string          [in] String to set
- * @param      size            [in] length of string to set
+ * @param      attrs           [in]    Handle of attributes list
+ * @param      index           [in]    Index of attribute
+ * @param      string          [in]    String to set
+ * @param      size            [in]    Length of string to set
  *
  * @return     This function returns MM_ERROR_NONE on success, or negative value with error code.
  * @see                mm_attrs_get_string
@@ -414,10 +504,10 @@ int mm_attrs_set_string(MMHandleType attrs, int index, const char *string, int s
 /**
  * This function is to get string to attribute with given index.
  *
- * @param      attrs           [in] List of attributes
- * @param      index           [in] Index of attribute
- * @param      sval            [in] Placeholder to output string buffer
- * @param      size            [in] The field contains number of characters filled in the buffer
+ * @param      attrs           [in]    Handle of attributes list
+ * @param      index           [in]    Index of attribute
+ * @param      sval            [in]    Placeholder to output string buffer
+ * @param      size            [in]    The field contains number of characters filled in the buffer
  *
  * @return     This function returns MM_ERROR_NONE on success, or negative value with error code.
  * @remarks    Application would be responsible for managing/releasing the string
@@ -429,24 +519,25 @@ int mm_attrs_get_string(MMHandleType attrs, int index, char **sval, int *size);
 /**
  * This function is to set pointer to attribute with given index.
  *
- * @param      attrs           [in] List of attributes
- * @param      index           [in] Index of attribute
- * @param      data            [in] data to set
- * @param      size            [in] Length of input data
- * @return     This function returns MM_ERROR_NONE on success, or negative value with error code.
+ * @param      attrs           [in]    Handle of attributes list
+ * @param      index           [in]    Index of attribute
+ * @param      data            [in]    Data to set
+ * @param      size            [in]    Length of input data
  *
+ * @return     This function returns MM_ERROR_NONE on success, or negative value with error code.
  * @remarks    Data type is the reference to memory which is allocated by user. The allocated memory must be freed by user.
  * @see                mm_attrs_get_data
  */
 int mm_attrs_set_data(MMHandleType attrs, int index, void *data,  int size);
 
+
 /**
  * This function is to get pointer to attribute with given index.
  *
- * @param      attrs           [in] List of attributes
- * @param      index           [in] Index of attribute
- * @param      data            [out] Placeholder to output data buffer
- * @param      size            [out] The field contains number of bytes filled in the buffer
+ * @param      attrs           [in]    Handle of attributes list
+ * @param      index           [in]    Index of attribute
+ * @param      data            [out]   Placeholder to output data buffer
+ * @param      size            [out]   The field contains number of bytes filled in the buffer
  *
  * @return     This function returns MM_ERROR_NONE on success, or negative value with error code.
  * @remarks    Application would be responsible for managing/releasing data
@@ -458,7 +549,7 @@ int mm_attrs_get_data(MMHandleType attrs, int index, void **data, int *size);
 /**
  * A function to get  information of the attribute
  *
- * @param      attrs           [in]    List of attributes
+ * @param      attrs           [in]    Handle of attributes list
  * @param      index           [in]    Index of attribute
  * @param      info            [out]   Information of the attribute
  *
@@ -470,7 +561,7 @@ int mm_attrs_get_info(MMHandleType attrs, int index, MMAttrsInfo *info);
 /**
  * This function is to get array of attribute with given name.
  *
- * @param      attrs           [in]    List of attributes
+ * @param      attrs           [in]    Handle of attributes list
  * @param      attr_name       [in]    Name of attribute
  * @param      info            [out]   Information of the attribute
  *
@@ -478,13 +569,14 @@ int mm_attrs_get_info(MMHandleType attrs, int index, MMAttrsInfo *info);
  */
 int mm_attrs_get_info_by_name(MMHandleType attrs, const char *attr_name, MMAttrsInfo *info);
 
+
 /**
  * Sets properties on an object.
  *
- * @param      attrs                           [in]    List of attributes
- * @param      err_attr_name           [out]   the name of attributes that occurs error. Free this variable after use.
- * @param      attribute_name          [in]    name of the first property to set
- * @param      ...                                     [in]    value for the first property, followed optionally by more
+ * @param      attrs                           [in]    Handle of attributes list
+ * @param      err_attr_name           [out]   Name of attributes that occurs error. Free this variable after use
+ * @param      attribute_name          [in]    Name of the first property to set
+ * @param      ...                                     [in]    Value for the first property, followed optionally by more
  *  name/value pairs, followed by %NULL
  *
  * @return     This function returns MM_ERROR_NONE on success, or negative value with error code.
@@ -497,10 +589,10 @@ int mm_attrs_multiple_set(MMHandleType attrs,  char **err_attr_name, const char
 /**
  * Gets properties on an object.
  *
- * @param      attrs                           [in]    List of attributes
- * @param      err_attr_name           [out]   the name of attributes that occurs error. Free this variable after use.
- * @param      attribute_name          [in]    name of the first property to set
- * @param      ...                                     [in]    value for the first property, followed optionally by more
+ * @param      attrs                           [in]    Handle of attributes list
+ * @param      err_attr_name           [out]   Name of attributes that occurs error. Free this variable after use
+ * @param      attribute_name          [in]    Name of the first property to set
+ * @param      ...                                     [in]    Value for the first property, followed optionally by more
  *  name/value pairs, followed by %NULL
  *
  * @return     This function returns MM_ERROR_NONE on success, or negative value with error code.
@@ -513,10 +605,10 @@ int mm_attrs_multiple_get(MMHandleType attrs,  char **err_attr_name, const char
 /**
  * Sets properties on an object with va_list param.
  *
- * @param      attrs                                   [in]    List of attributes
- * @param      err_attr_name                   [out]   the name of attributes that occurs error. Free this variable after use.
- * @param      attribute_name                  [in]    name of the first property to set
- * @param      var_args                                [in]    variable arguments
+ * @param      attrs                                   [in]    Handle of attributes list
+ * @param      err_attr_name                   [out]   Name of attributes that occurs error. Free this variable after use
+ * @param      attribute_name                  [in]    Name of the first property to set
+ * @param      var_args                                [in]    Variable arguments
  *
  * @return     This function returns MM_ERROR_NONE on success, or negative value with error code.
  * @remarks    Multiple setter of attribute
@@ -528,10 +620,10 @@ int mm_attrs_set_valist(MMHandleType attrs, char **err_attr_name, const char *at
 /**
  * Gets properties on an object with va_list param.
  *
- * @param      attrs                                   [in]    List of attributes
- * @param      err_attr_name                   [out]   the name of attributes that occurs error. Free this variable after use.
- * @param      attribute_name                  [in]    name of the first property to set
- * @param      var_args                                [in]    variable arguments
+ * @param      attrs                                   [in]    Handle of attributes list
+ * @param      err_attr_name                   [out]   Name of attributes that occurs error. Free this variable after use
+ * @param      attribute_name                  [in]    Name of the first property to set
+ * @param      var_args                                [in]    Variable arguments
  *
  * @return     This function returns MM_ERROR_NONE on success, or negative value with error code.
  * @remarks    Multiple setter of attribute
@@ -539,6 +631,121 @@ int mm_attrs_set_valist(MMHandleType attrs, char **err_attr_name, const char *at
  */
 int mm_attrs_get_valist(MMHandleType attrs, char **err_attr_name, const char *attribute_name, va_list var_args);
 
+
+/**
+ * This function is to set the valid attribute type.
+ *
+ * @param      attrs   [in]    Handle of attributes list
+ * @param      index   [in]    Index of attribute
+ * @param      type    [in]    Type of attribute
+ *
+ * @return     This function returns MM_ERROR_NONE on success, or negative value with error code.
+ */
+int mm_attrs_set_valid_type(MMHandleType attrs, int index, MMAttrsValidType type);
+
+
+/**
+ * This function is to set the valid integer range to the attribute.
+ *
+ * @param      attrs   [in]    Handle of attributes list
+ * @param      index   [in]    Index of attribute
+ * @param      min             [in]    Minimum value of the valid range
+ * @param      max             [in]    Maximum value of the valid range
+ * @param      dval    [in]    Default value
+ *
+ * @return     This function returns MM_ERROR_NONE on success, or negative value with error code.
+ */
+int mm_attrs_set_valid_range(MMHandleType attrs, int index, int min, int max, int dval);
+
+
+/**
+ * This function is to set the valid integer array to the attribute.
+ *
+ * @param      attrs   [in]    Handle of attributes list
+ * @param      index   [in]    Index of attribute
+ * @param      array   [in]    Array contains integer values to set
+ * @param      count   [in]    The number of items in array
+ * @param      dval    [in]    Default value
+ *
+ * @return     This function returns MM_ERROR_NONE on success, or negative value with error code.
+ */
+int mm_attrs_set_valid_array(MMHandleType attrs, int index, const int *array, int count, int dval);
+
+
+/**
+ * This function is to set the valid double range to the attribute.
+ *
+ * @param      attrs   [in]    Handle of attributes list
+ * @param      index   [in]    Index of attribute
+ * @param      min             [in]    Minimum value of the valid range
+ * @param      max             [in]    Maximum value of the valid range
+ * @param      dval    [in]    Default value
+ *
+ * @return     This function returns MM_ERROR_NONE on success, or negative value with error code.
+ */
+int mm_attrs_set_valid_double_range(MMHandleType attrs, int index, double min, double max, double dval);
+
+
+/**
+ * This function is to set the valid double array to the attribute.
+ *
+ * @param      attrs   [in]    Handle of attributes list
+ * @param      index   [in]    Index of attribute
+ * @param      array   [in]    Array contains double values to set
+ * @param      count   [in]    The number of items in array
+ * @param      dval    [in]    Default value
+ *
+ * @return     This function returns MM_ERROR_NONE on success, or negative value with error code.
+ */
+int mm_attrs_set_valid_double_array(MMHandleType attrs, int index, const double *array, int count, double dval);
+
+
+/**
+ * This function is to check whether the attribute is modified
+ *
+ * @param      attrs   [in]    Handle of attributes list
+ * @param      index   [in]    Index of attribute
+ * @param      modified        [out]   Modified or not (true = modified, false = not modified)
+ *
+ * @return     This function returns MM_ERROR_NONE on success, or negative value with error code.
+ */
+int mm_attrs_is_modified(MMHandleType attrs, int index, bool *modified);
+
+
+/**
+ * This function is to set the attribute to modified
+ *
+ * @param      attrs   [in]    Handle of attributes list
+ * @param      index   [in]    Index of attribute
+ *
+ * @return     This function returns MM_ERROR_NONE on success, or negative value with error code.
+ */
+int mm_attrs_set_modified(MMHandleType attrs, int index);
+
+
+/**
+ * This function is to set the attribute to read-only
+ *
+ * @param      attrs   [in]    Handle of attributes list
+ * @param      index   [in]    Index of attribute
+ *
+ * @return     This function returns MM_ERROR_NONE on success, or negative value with error code.
+ */
+int mm_attrs_set_readonly(MMHandleType attrs, int index);
+
+
+/**
+ * This function is to set the attribute to disabled
+ *
+ * @param      attrs   [in]    Handle of attributes list
+ * @param      index   [in]    Index of attribute
+ *
+ * @return     This function returns MM_ERROR_NONE on success, or negative value with error code.
+ */
+int mm_attrs_set_disabled(MMHandleType attrs, int index);
+
+
+
 /**
  * @}
  */