From c3eadb7aae59ea393179d6e4a0d19a6e7e594dcd Mon Sep 17 00:00:00 2001 From: Eunhae Choi Date: Mon, 11 Sep 2017 21:16:00 +0900 Subject: [PATCH] [0.2.105] apply tizen coding convention Change-Id: I695d3ab7fbea56d736763ad986ee58cbb2615241 --- include/mm.h | 3 +- include/mm_attrs.h | 128 +++++++++++----------- include/mm_attrs_private.h | 16 +-- include/mm_debug.h | 10 +- include/mm_message.h | 24 ++--- include/mm_types.h | 82 +++++++------- mm_attrs.c | 258 +++++++++++++++++++++----------------------- mm_attrs_private.c | 81 +++++++------- mm_list_private.c | 6 +- packaging/libmm-common.spec | 2 +- 10 files changed, 294 insertions(+), 316 deletions(-) diff --git a/include/mm.h b/include/mm.h index e4c8a98..81df89d 100644 --- a/include/mm.h +++ b/include/mm.h @@ -19,7 +19,6 @@ * */ - #ifndef __MM_H__ #define __MM_H__ @@ -40,7 +39,7 @@ extern "C" { * @author * @version 1.0 * @brief This file includes all the necessary header files of multimediaframework. - + @mainpage Multimedia Framework @par diff --git a/include/mm_attrs.h b/include/mm_attrs.h index 30ed643..3af9996 100644 --- a/include/mm_attrs.h +++ b/include/mm_attrs.h @@ -36,9 +36,9 @@ @addtogroup COMMON @{ - * @file mm_attrs.h - * @version 1.0 - * @brief This file declares data structures and functions of attribute library. + * @file mm_attrs.h + * @version 1.0 + * @brief This file declares data structures and functions of attribute library. @par This part describes the APIs with respect to Multimedia Attribute Library. @@ -51,14 +51,14 @@ /** * Enumeration for attribute values types. */ -typedef enum{ +typedef enum { MM_ATTRS_TYPE_INVALID = -1, /**< Type is invalid */ MM_ATTRS_TYPE_INT, /**< Integer type attribute */ MM_ATTRS_TYPE_DOUBLE, /**< Double type attribute */ MM_ATTRS_TYPE_STRING, /**< UTF-8 String type attribute */ MM_ATTRS_TYPE_DATA, /**< Pointer type attribute */ MM_ATTRS_TYPE_NUM, /**< Number of attribute type */ -}MMAttrsType; +} MMAttrsType; /** * Enumeration for attribute validation type. @@ -147,9 +147,9 @@ typedef struct { /** * 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 - * @return This function returns MM_ERROR_NONE on success, or negative value with error code. + * @param attr_name [in] attribute name + * @param val [in] integer value to set + * @return This function returns MM_ERROR_NONE on success, or negative value with error code. */ int mm_attrs_set_int_by_name(MMHandleType attrs, const char *attr_name, int val); @@ -190,7 +190,7 @@ int mm_attrs_get_index(MMHandleType attrs, const char *attr_name, int *index); * @param attrs [in] Handle of attributes list * @param attr_name [in] Name of attribute * @param val [out] Value of attribute - * @return This function returns attribute value + * @return This function returns attribute value */ int mm_attrs_get_int_by_name(MMHandleType attrs, const char *attr_name, int *val); @@ -198,9 +198,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 attr_name [in] attribute name * @param string [in] string value to set - * @return This function returns MM_ERROR_NONE on success, or negative value with error code. + * @return This function returns MM_ERROR_NONE on success, or negative value with error code. */ int mm_attrs_set_string_by_name(MMHandleType attrs, const char *attr_name, const char *string); @@ -219,18 +219,18 @@ 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 attr_name [in] attribute name * @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. + * @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 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 */ @@ -240,7 +240,7 @@ 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 id [in] ID of attribute + * @param id [in] ID of attribute * @param attrtype [out] On return contains type of attribute * @return This function returns MM_ERROR_NONE. * @see MMAttrsType @@ -250,9 +250,9 @@ int mm_attrs_get_type(MMHandleType attrs, int id, MMAttrsType *attrtype); /** * This function is to get flags of attribute with given id. - * @param attrs [in] List of attributes + * @param attrs [in] List of attributes * @param id [in] ID of attribute - * @param flags [out] On return contains flags of attribute. + * @param flags [out] On return contains flags of attribute. * @return This function returns MM_ERROR_NONE on success, or negative value with error code. * @see MMAttrsFlag */ @@ -261,10 +261,10 @@ int mm_attrs_get_flags(MMHandleType attrs, int id, int *flags); /** * This function is to get valid value type of attribute with given id. - * @param attrs [in] List of attributes + * @param attrs [in] List of attributes * @param id [in] ID of attribute - * @param type [out] On return contains valid value type of attribute - * @return This function returns MM_ERROR_NONE on success, or negative value with error code. + * @param type [out] On return contains 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 id, int *type); @@ -272,7 +272,7 @@ int mm_attrs_get_valid_type(MMHandleType attrs, int id, int *type); /** * This function is to get valid range of attribute with given id. - * @param attrs [in] List of attributes + * @param attrs [in] List of attributes * @param id [in] ID of attribute * @param min [out] minimum value of the valid range. * @param max [out] maximum value of the valid range. @@ -283,10 +283,10 @@ int mm_attrs_get_valid_range(MMHandleType attrs, int id, int *min, int *max); /** * This function is to get valid array of attribute with given id. - * @param attrs [in] list of attributes + * @param attrs [in] list of attributes * @param id [in] ID of attribute - * @param count [out] number of array - * @param array [out] on return contains valid array of attribute + * @param count [out] number of array + * @param array [out] on return contains valid array of attribute * @return This function returns MM_ERROR_NONE on success, or negative value with error code. */ int mm_attrs_get_valid_array(MMHandleType attrs, int id, int *count, int **array); @@ -294,7 +294,7 @@ int mm_attrs_get_valid_array(MMHandleType attrs, int id, int *count, int **arra /** * This function is to get valid double type range of attribute with given id. - * @param attrs [in] List of attributes + * @param attrs [in] List of attributes * @param id [in] ID of attribute * @param min [out] minimum value of the valid range. * @param max [out] maximum value of the valid range. @@ -305,10 +305,10 @@ int mm_attrs_get_valid_double_range(MMHandleType h, int idx, double *min, double /** * This function is to get valid double type array of attribute with given id. - * @param attrs [in] list of attributes + * @param attrs [in] list of attributes * @param id [in] ID of attribute - * @param count [out] number of array - * @param array [out] on return contains valid array of attribute + * @param count [out] number of array + * @param array [out] on return contains valid array of attribute * @return This function returns MM_ERROR_NONE on success, or negative value with error code. */ int mm_attrs_get_valid_double_array(MMHandleType h, int idx, int *count, double **array); @@ -316,10 +316,10 @@ int mm_attrs_get_valid_double_array(MMHandleType h, int idx, int *count, double /** * This function is to set integer value to attribute with given id. - * @param attrs [in] List of attributes + * @param attrs [in] List of attributes * @param id [in] ID of attribute * @param val [in] integer value to set - * @return This function returns MM_ERROR_NONE on success, or negative value with error code. + * @return This function returns MM_ERROR_NONE on success, or negative value with error code. * @see mm_attrs_get_int */ int mm_attrs_set_int(MMHandleType attrs, int id, int val); @@ -327,11 +327,11 @@ int mm_attrs_set_int(MMHandleType attrs, int id, int val); /** * This function is to get integer value to attribute with given id. - * @param attrs [in] List of attributes + * @param attrs [in] List of attributes * @param id [in] ID of attribute * @param val [out] On return contains 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. + * @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. * @see mm_attrs_get_int */ int mm_attrs_get_int(MMHandleType attrs, int id, int *val); @@ -340,7 +340,7 @@ int mm_attrs_get_int(MMHandleType attrs, int id, int *val); /** * This function is to set double value to attribute with given id. * - * @param attrs [in] List of attributes + * @param attrs [in] List of attributes * @param id [in] ID of attribute * @param val [in] Integer value to set * @@ -355,7 +355,7 @@ int mm_attrs_set_double(MMHandleType attrs, int id, double val); * * @param attrs [in] Handle of attributes list * @param attr_name [in] Name of attribute - * @param val [in] Integer value to set + * @param val [in] Integer value to set * * @return This function returns MM_ERROR_NONE on success, or negative value with error code. */ @@ -366,7 +366,7 @@ int mm_attrs_set_double_by_name(MMHandleType attrs, const char *attr_name, doubl * This function is to get double value to attribute with given id. * * @param attrs [in] List of attributes - * @param id [in] ID of attribute + * @param id [in] ID of attribute * @param attrval [out] On return contains 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 @@ -379,9 +379,9 @@ int mm_attrs_get_double(MMHandleType attrs, int id, double *attrval); * * @param attrs [in] Handle of attributes list * @param attr_name [in] Name of attribute - * @param val [out] Double value to set + * @param val [out] Double value to set * - * @return This function returns attribute value + * @return This function returns attribute value */ int mm_attrs_get_double_by_name(MMHandleType attrs, const char *attr_name, double *val); @@ -389,10 +389,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 id. * @param attrs [in] List of attributes - * @param id [in] ID of attribute + * @param id [in] ID 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. + * @return This function returns MM_ERROR_NONE on success, or negative value with error code. * @see mm_attrs_get_string */ int mm_attrs_set_string(MMHandleType attrs, int id, const char *string, int size); @@ -401,12 +401,12 @@ int mm_attrs_set_string(MMHandleType attrs, int id, const char *string, int size /** * This function is to get string to attribute with given id. * @param attrs [in] List of attributes - * @param id [in] ID of attribute + * @param id [in] ID 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 - * @see mm_attrs_set_string + * @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 + * @see mm_attrs_set_string */ int mm_attrs_get_string(MMHandleType attrs, int id, char **sval, int *size); @@ -414,11 +414,11 @@ int mm_attrs_get_string(MMHandleType attrs, int id, char **sval, int *size); /** * This function is to set pointer to attribute with given id. * @param attrs [in] List of attributes - * @param id [in] ID of attribute + * @param id [in] ID 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. + * @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 id, void *data, int size); @@ -426,10 +426,10 @@ int mm_attrs_set_data(MMHandleType attrs, int id, void *data, int size); /** * This function is to get pointer to attribute with given id. * @param attrs [in] List of attributes - * @param id [in] ID of attribute + * @param id [in] ID 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. + * @return This function returns MM_ERROR_NONE on success, or negative value with error code. * @remarks Application would be responsible for managing/releasing data * @see mm_attrs_set_data */ @@ -440,7 +440,7 @@ int mm_attrs_get_data(MMHandleType attrs, int id, void **data, int *size); * A function to get information of the attribute * * @param attrs [in] List of attributes - * @param id [in] ID of attribute + * @param id [in] ID of attribute * @param array [out] Contains the array of attribute on success, * or NULL pointer on failure. * @param count [out] Count of array @@ -456,7 +456,7 @@ int mm_attrs_get_info(MMHandleType h, int idx, MMAttrsInfo *info); * This function is to get array of attribute with given id. * * @param attrs [in] List of attributes - * @param id [in] ID of attribute + * @param id [in] ID of attribute * @param array [out] Contains the array of attribute on success, * or NULL pointer on failure. * @param count [out] Count of array @@ -470,9 +470,9 @@ int mm_attrs_get_info_by_name(MMHandleType h, const char *attr_name, MMAttrsInfo /** * 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 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 * name/value pairs, followed by %NULL * @@ -486,9 +486,9 @@ int mm_attrs_multiple_set(MMHandleType handle, 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 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 * name/value pairs, followed by %NULL * @@ -503,30 +503,30 @@ int mm_attrs_multiple_get(MMHandleType handle, 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 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 * * @return This function returns MM_ERROR_NONE on success, or negative value with error code. * @remarks Multiple setter of attribute * @see mm_attrs_multiple_set */ -int mm_attrs_set_valist (MMHandleType attrs, char **err_attr_name, const char *attribute_name, va_list var_args); +int mm_attrs_set_valist(MMHandleType attrs, char **err_attr_name, const char *attribute_name, va_list var_args); /** * 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 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 * * @return This function returns MM_ERROR_NONE on success, or negative value with error code. * @remarks Multiple setter of attribute * @see mm_attrs_multiple_get */ -int mm_attrs_get_valist (MMHandleType attrs, char **err_attr_name, const char *attribute_name, va_list var_args); +int mm_attrs_get_valist(MMHandleType attrs, char **err_attr_name, const char *attribute_name, va_list var_args); /** * @} diff --git a/include/mm_attrs_private.h b/include/mm_attrs_private.h index a303168..f3364bb 100644 --- a/include/mm_attrs_private.h +++ b/include/mm_attrs_private.h @@ -47,7 +47,7 @@ enum mmf_value_type { MMF_VALUE_TYPE_INT = MM_ATTRS_TYPE_INT, - MMF_VALUE_TYPE_DOUBLE=MM_ATTRS_TYPE_DOUBLE, + MMF_VALUE_TYPE_DOUBLE = MM_ATTRS_TYPE_DOUBLE, MMF_VALUE_TYPE_STRING = MM_ATTRS_TYPE_STRING, MMF_VALUE_TYPE_DATA = MM_ATTRS_TYPE_DATA, }; @@ -68,9 +68,9 @@ typedef struct mmf_attrs_list mmf_attrs_list_t; typedef struct mmf_attribute_construct_info mmf_attrs_construct_info_t; typedef bool (*mmf_attrs_commit_func_t)(int attr_idx, - const char* attr_name, - const mmf_value_t *value, - void *commit_param); + const char* attr_name, + const mmf_value_t *value, + void *commit_param); struct mmf_value { int type; @@ -222,10 +222,10 @@ int mmf_attribute_set_data(mmf_attribute_t *item, void *data, int size); MMHandleType mmf_attrs_new(int count); MMHandleType mmf_attrs_new_from_data(const char *name, - mmf_attrs_construct_info_t *info, - int count, - mmf_attrs_commit_func_t commit_func, - void *commit_param); + mmf_attrs_construct_info_t *info, + int count, + mmf_attrs_commit_func_t commit_func, + void *commit_param); void mmf_attrs_free(MMHandleType attrs); diff --git a/include/mm_debug.h b/include/mm_debug.h index 17d56c9..818b8ba 100644 --- a/include/mm_debug.h +++ b/include/mm_debug.h @@ -104,11 +104,11 @@ enum { #define debug_warning(fmt, arg...) mm_log_by_owner(MMF_LOG_OWNER, LOG_WARN, fmt, ##arg) #define debug_error(fmt, arg...) mm_log_by_owner(MMF_LOG_OWNER, LOG_ERROR, fmt, ##arg) #define debug_critical(fmt, arg...) mm_log_by_owner(MMF_LOG_OWNER, LOG_FATAL, fmt, ##arg) -#define debug_profile(fmt, arg...) mm_log_by_owner(MMF_LOG_OWNER, LOG_DEBUG," " fmt, ##arg) +#define debug_profile(fmt, arg...) mm_log_by_owner(MMF_LOG_OWNER, LOG_DEBUG, " " fmt, ##arg) #define debug_fenter() mm_log_by_owner(MMF_LOG_OWNER, LOG_DEBUG, " \n") #define debug_fleave() mm_log_by_owner(MMF_LOG_OWNER, LOG_DEBUG, " \n") -#define debug_enter(fmt, arg...) mm_log_by_owner(MMF_LOG_OWNER, LOG_DEBUG," [<---] " fmt, ##arg) -#define debug_leave(fmt, arg...) mm_log_by_owner(MMF_LOG_OWNER, LOG_DEBUG," [--->] " fmt, ##arg) +#define debug_enter(fmt, arg...) mm_log_by_owner(MMF_LOG_OWNER, LOG_DEBUG, " [<---] " fmt, ##arg) +#define debug_leave(fmt, arg...) mm_log_by_owner(MMF_LOG_OWNER, LOG_DEBUG, " [--->] " fmt, ##arg) #define secure_debug_verbose(fmt, arg...) mm_secure_log_by_owner(MMF_LOG_OWNER, LOG_VERBOSE, fmt, ##arg) #define secure_debug_log(fmt, arg...) mm_secure_log_by_owner(MMF_LOG_OWNER, LOG_DEBUG, fmt, ##arg) @@ -119,7 +119,7 @@ enum { #define secure_debug_profile(fmt, arg...) mm_secure_log_by_owner(MMF_LOG_OWNER, LOG_DEBUG, " " fmt, ##arg) #define return_if_fail(expr) \ - if(!(expr)) { \ + if (!(expr)) { \ debug_warning("failed [%s]\n", #expr); \ return; \ } @@ -141,4 +141,4 @@ enum { } #endif -#endif /* __MMF_DEBUG_H__ */ \ No newline at end of file +#endif /* __MMF_DEBUG_H__ */ diff --git a/include/mm_message.h b/include/mm_message.h index c476243..c4d05a5 100644 --- a/include/mm_message.h +++ b/include/mm_message.h @@ -43,12 +43,12 @@ */ enum MMMessageType { /* COMMON */ - MM_MESSAGE_UNKNOWN = 0x00, /**< Unknown message type */ - MM_MESSAGE_ERROR, /**< Error message type */ - MM_MESSAGE_WARNING, /**< Warning message type */ - MM_MESSAGE_STATE_CHANGED, /**< State change message type */ - MM_MESSAGE_STATE_INTERRUPTED, /**< State change by interrupt */ - MM_MESSAGE_READY_TO_RESUME, /**< Ready to resume message type */ + MM_MESSAGE_UNKNOWN = 0x00, /**< Unknown message type */ + MM_MESSAGE_ERROR, /**< Error message type */ + MM_MESSAGE_WARNING, /**< Warning message type */ + MM_MESSAGE_STATE_CHANGED, /**< State change message type */ + MM_MESSAGE_STATE_INTERRUPTED, /**< State change by interrupt */ + MM_MESSAGE_READY_TO_RESUME, /**< Ready to resume message type */ /* PLAYER */ MM_MESSAGE_CONNECTING = 0x100, /**< Connecting message type */ @@ -84,7 +84,7 @@ enum MMMessageType { /* CAMCORDER */ MM_MESSAGE_CAMCORDER_STATE_CHANGED = 0x200, /**< State changed.*/ - MM_MESSAGE_CAMCORDER_STATE_CHANGED_BY_ASM, /**< State change by audio session manager message type */ + MM_MESSAGE_CAMCORDER_STATE_CHANGED_BY_ASM, /**< State change by audio session manager message type */ MM_MESSAGE_CAMCORDER_MAX_SIZE, /**< Maximum size, camcorder waits for user's order (cam_commit/cancel).*/ MM_MESSAGE_CAMCORDER_NO_FREE_SPACE, /**< No free space, camcorder waits for user's order (cam_commit/cancel).*/ MM_MESSAGE_CAMCORDER_TIME_LIMIT, /**< Time limit, camcorder waits for user's order (cam_commit/cancel)*/ @@ -134,7 +134,7 @@ enum MMMessageType { MM_MESSAGE_FILEINFO_RESERVED = 0x700, /**< Reserved message for File Info */ /* STREAM RECORDER */ - MM_MESSAGE_STREAMRECORDER_ERROR = 0x800, + MM_MESSAGE_STREAMRECORDER_ERROR = 0x800, MM_MESSAGE_STREAMRECORDER_CONSUME_COMPLETE, MM_MESSAGE_STREAMRECORDER_STATE_CHANGED, MM_MESSAGE_STREAMRECORDER_MAX_SIZE, /**< Maximum size, streamcorder waits for user's order (commit/cancel) */ @@ -207,7 +207,7 @@ typedef struct { /** * union. */ - int union_type; /**< Type of union. Please refer MMMessageUnionType */ + int union_type; /**< Type of union. Please refer MMMessageUnionType */ union { int code; /**< Error or warning code */ @@ -306,8 +306,8 @@ typedef struct { unsigned long long total; /**< Total time */ unsigned long long filesize; /**< Recording File size (KB). An approximate value. */ unsigned long long remained_time; /**< Remained time (ms). - This is available if time limit is not set or - time limit is bigger than estimated remained time. */ + This is available if time limit is not set or + time limit is bigger than estimated remained time. */ } recording_status; /** @@ -324,7 +324,7 @@ typedef struct { * Video frame capture */ struct { - unsigned int width; /* width of captured image */ + unsigned int width; /* width of captured image */ unsigned int height; /* height of captured image */ unsigned int orientation; /* orientation of captured image */ } captured_frame; diff --git a/include/mm_types.h b/include/mm_types.h index 4d1ca3f..3e4220f 100755 --- a/include/mm_types.h +++ b/include/mm_types.h @@ -29,8 +29,8 @@ */ /** - @addtogroup COMMON - @{ + @addtogroup COMMON + @{ */ #ifndef __MM_TYPES_H__ @@ -273,7 +273,7 @@ enum MMAudioCodecType { MM_AUDIO_CODEC_G729, /**< G729 codec */ MM_AUDIO_CODEC_G729A, /**< G729a codec */ MM_AUDIO_CODEC_G729_1, /**< G729.1 codec */ - MM_AUDIO_CODEC_REAL, /**< Real audio */ + MM_AUDIO_CODEC_REAL, /**< Real audio */ MM_AUDIO_CODEC_AAC_LC, /**< AAC-Low complexity codec */ MM_AUDIO_CODEC_AAC_MAIN, /**< AAC-Main profile codec */ MM_AUDIO_CODEC_AAC_SRS, /**< AAC-Scalable sample rate codec */ @@ -322,37 +322,37 @@ enum MMImageCodecType { * Enumerations of file container format. */ enum MMFileFormatType { - MM_FILE_FORMAT_INVALID = -1,/**< Invalid file format */ - MM_FILE_FORMAT_3GP, /**< 3GP file format */ - MM_FILE_FORMAT_ASF, /**< Advanced Systems File file format */ - MM_FILE_FORMAT_AVI, /**< Audio Video Interleaved file format */ - MM_FILE_FORMAT_MATROSKA, /**< MATROSAK file format */ - MM_FILE_FORMAT_MP4, /**< MP4 file format */ - MM_FILE_FORMAT_OGG, /**< OGG file format */ - MM_FILE_FORMAT_NUT, /**< NUT file format */ - MM_FILE_FORMAT_QT, /**< MOV file format */ - MM_FILE_FORMAT_REAL, /**< RealMedia file format */ - MM_FILE_FORMAT_AMR, /**< AMR file format */ - MM_FILE_FORMAT_AAC, /**< AAC file format */ - MM_FILE_FORMAT_MP3, /**< MP3 file format */ - MM_FILE_FORMAT_AIFF, /**< AIFF file format */ - MM_FILE_FORMAT_AU, /**< Audio file format */ - MM_FILE_FORMAT_WAV, /**< WAV file format */ - MM_FILE_FORMAT_MID, /**< MID file format */ - MM_FILE_FORMAT_MMF, /**< MMF file format */ - MM_FILE_FORMAT_DIVX, /**< DivX file format */ - MM_FILE_FORMAT_FLV, /**< Flash video file format */ - MM_FILE_FORMAT_VOB, /**< DVD-Video Object file format */ - MM_FILE_FORMAT_IMELODY, /**< IMelody file format */ - MM_FILE_FORMAT_WMA, /**< WMA file format */ - MM_FILE_FORMAT_WMV, /**< WMV file format */ - MM_FILE_FORMAT_JPG, /**< JPEG file format */ - MM_FILE_FORMAT_FLAC, /**< FLAC file format */ - MM_FILE_FORMAT_M2TS, /**< MPEG2-Transport Stream file format */ - MM_FILE_FORMAT_M2PS, /**< MPEG2-Program Stream file format */ - MM_FILE_FORMAT_M1VIDEO, /**< MPEG1-Video file format */ - MM_FILE_FORMAT_M1AUDIO, /**< MPEG1-Audio file format */ - MM_FILE_FORMAT_NUM, /**< Number of file format type */ + MM_FILE_FORMAT_INVALID = -1, /**< Invalid file format */ + MM_FILE_FORMAT_3GP, /**< 3GP file format */ + MM_FILE_FORMAT_ASF, /**< Advanced Systems File file format */ + MM_FILE_FORMAT_AVI, /**< Audio Video Interleaved file format */ + MM_FILE_FORMAT_MATROSKA, /**< MATROSAK file format */ + MM_FILE_FORMAT_MP4, /**< MP4 file format */ + MM_FILE_FORMAT_OGG, /**< OGG file format */ + MM_FILE_FORMAT_NUT, /**< NUT file format */ + MM_FILE_FORMAT_QT, /**< MOV file format */ + MM_FILE_FORMAT_REAL, /**< RealMedia file format */ + MM_FILE_FORMAT_AMR, /**< AMR file format */ + MM_FILE_FORMAT_AAC, /**< AAC file format */ + MM_FILE_FORMAT_MP3, /**< MP3 file format */ + MM_FILE_FORMAT_AIFF, /**< AIFF file format */ + MM_FILE_FORMAT_AU, /**< Audio file format */ + MM_FILE_FORMAT_WAV, /**< WAV file format */ + MM_FILE_FORMAT_MID, /**< MID file format */ + MM_FILE_FORMAT_MMF, /**< MMF file format */ + MM_FILE_FORMAT_DIVX, /**< DivX file format */ + MM_FILE_FORMAT_FLV, /**< Flash video file format */ + MM_FILE_FORMAT_VOB, /**< DVD-Video Object file format */ + MM_FILE_FORMAT_IMELODY, /**< IMelody file format */ + MM_FILE_FORMAT_WMA, /**< WMA file format */ + MM_FILE_FORMAT_WMV, /**< WMV file format */ + MM_FILE_FORMAT_JPG, /**< JPEG file format */ + MM_FILE_FORMAT_FLAC, /**< FLAC file format */ + MM_FILE_FORMAT_M2TS, /**< MPEG2-Transport Stream file format */ + MM_FILE_FORMAT_M2PS, /**< MPEG2-Program Stream file format */ + MM_FILE_FORMAT_M1VIDEO, /**< MPEG1-Video file format */ + MM_FILE_FORMAT_M1AUDIO, /**< MPEG1-Audio file format */ + MM_FILE_FORMAT_NUM, /**< Number of file format type */ }; /** @@ -492,7 +492,7 @@ typedef enum { MM_DISPLAY_METHOD_ORIGIN_OR_LETTER, MM_DISPLAY_METHOD_CUSTOM_ROI, MM_DISPLAY_METHOD_NUM -}MMDisplayGeometryMethod; +} MMDisplayGeometryMethod; /* * Enumerations of ROI mode of display geometry method @@ -500,7 +500,7 @@ typedef enum { typedef enum { MM_DISPLAY_METHOD_CUSTOM_ROI_FULL_SCREEN = 0, MM_DISPLAY_METHOD_CUSTOM_ROI_LETER_BOX -}MMDisplayGeometryMethodRoiMode; +} MMDisplayGeometryMethodRoiMode; #define MM_VIDEO_BUFFER_PLANE_MAX 4 /**< Max num of video buffer plane */ @@ -524,8 +524,8 @@ typedef struct { */ typedef struct { MMVideoBufferType type; /**< buffer type - - The field of handle that type indicates should be filled, - and other fields of handle are optional. */ + - The field of handle that type indicates should be filled, + and other fields of handle are optional. */ MMPixelFormatType format; /**< buffer type */ int plane_num; /**< number of planes */ int width[MM_VIDEO_BUFFER_PLANE_MAX]; /**< width of buffer */ @@ -539,9 +539,9 @@ typedef struct { MMVideoBufferHandle handle; /**< handle of buffer */ int is_secured; /**< secured buffer flag. ex) TrustZone memory, user can not access it. */ int flush_request; /**< flush request flag - - If this flag is TRUE, sink element will make copy of last buffer, - and it will return all buffers from src element. - Then, src element can restart without changing pipeline state. */ + - If this flag is TRUE, sink element will make copy of last buffer, + and it will return all buffers from src element. + Then, src element can restart without changing pipeline state. */ MMRectType crop; /**< crop information of buffer */ } MMVideoBuffer; diff --git a/mm_attrs.c b/mm_attrs.c index 95d6727..7a5a834 100644 --- a/mm_attrs.c +++ b/mm_attrs.c @@ -35,7 +35,7 @@ int mm_attrs_get_type(MMHandleType h, int idx, MMAttrsType *attrtype) { mmf_attrs_t *attrs = (mmf_attrs_t *) h; return_val_if_fail(h && idx >= 0 && idx < attrs->count && attrtype, MM_ERROR_COMMON_INVALID_ARGUMENT); - *attrtype=attrs->items[idx].value.type; + *attrtype = attrs->items[idx].value.type; return MM_ERROR_NONE; } @@ -45,7 +45,7 @@ int mm_attrs_get_flags(MMHandleType h, int idx, int *flags) mmf_attrs_t *attrs = (mmf_attrs_t *) h; return_val_if_fail(attrs && idx >= 0 && idx < attrs->count && flags, MM_ERROR_COMMON_INVALID_ARGUMENT); - *flags=attrs->items[idx].flags; + *flags = attrs->items[idx].flags; return MM_ERROR_NONE; } @@ -54,7 +54,7 @@ int mm_attrs_get_valid_type(MMHandleType h, int idx, int *type) { mmf_attrs_t *attrs = (mmf_attrs_t *) h; return_val_if_fail(attrs && idx >= 0 && idx < attrs->count && type, MM_ERROR_COMMON_INVALID_ARGUMENT); - *type=attrs->items[idx].value_spec.type; + *type = attrs->items[idx].value_spec.type; return MM_ERROR_NONE; } @@ -82,7 +82,7 @@ int mm_attrs_get_valid_array(MMHandleType h, int idx, int *count, int **array) return_val_if_fail(attrs && count && idx >= 0 && idx < attrs->count && array, MM_ERROR_COMMON_INVALID_ARGUMENT); if (count) *count = attrs->items[idx].value_spec.spec.int_spec.array.count; - *array=attrs->items[idx].value_spec.spec.int_spec.array.array; + *array = attrs->items[idx].value_spec.spec.int_spec.array.array; return MM_ERROR_NONE; } @@ -133,13 +133,11 @@ int mm_attrs_set_int(MMHandleType h, int idx, int val) mmf_attribute_t *item = &attrs->items[idx]; return_val_if_fail(item, MM_ERROR_COMMON_INVALID_ARGUMENT); - if (!mmf_attribute_check_flags(item, MM_ATTRS_FLAG_WRITABLE)) - { + if (!mmf_attribute_check_flags(item, MM_ATTRS_FLAG_WRITABLE)) { return MM_ERROR_COMMON_INVALID_PERMISSION; } - if (mmf_attribute_validate_int(item, val)) - { + if (mmf_attribute_validate_int(item, val)) { int ret = 0; ret = mmf_attribute_set_int(item, val); @@ -165,9 +163,8 @@ int mm_attrs_get_int(MMHandleType h, int idx, int *val) mmf_attribute_t *item = &attrs->items[idx]; return_val_if_fail(item, MM_ERROR_COMMON_INVALID_ARGUMENT); - if (mmf_attribute_check_flags(item, MM_ATTRS_FLAG_READABLE)) - { - *val=mmf_value_get_int(&attrs->items[idx].value); + if (mmf_attribute_check_flags(item, MM_ATTRS_FLAG_READABLE)) { + *val = mmf_value_get_int(&attrs->items[idx].value); return MM_ERROR_NONE; } @@ -184,12 +181,9 @@ int mm_attrs_set_double(MMHandleType h, int idx, double val) return_val_if_fail(item, MM_ERROR_COMMON_INVALID_ARGUMENT); if (!mmf_attribute_check_flags(item, MM_ATTRS_FLAG_WRITABLE)) - { return MM_ERROR_COMMON_INVALID_PERMISSION; - } - if (mmf_attribute_validate_double(item, val)) - { + if (mmf_attribute_validate_double(item, val)) { int ret = 0; ret = mmf_attribute_set_double(item, val); @@ -215,9 +209,8 @@ int mm_attrs_get_double(MMHandleType h, int idx, double *val) mmf_attribute_t *item = &attrs->items[idx]; return_val_if_fail(item, MM_ERROR_COMMON_INVALID_ARGUMENT); - if (mmf_attribute_check_flags(item, MM_ATTRS_FLAG_READABLE)) - { - *val=mmf_value_get_double(&attrs->items[idx].value); + if (mmf_attribute_check_flags(item, MM_ATTRS_FLAG_READABLE)) { + *val = mmf_value_get_double(&attrs->items[idx].value); return MM_ERROR_NONE; } @@ -236,8 +229,7 @@ int mm_attrs_set_string(MMHandleType h, int idx, const char *string, int size) MM_ATTR_ITEM_WRITE_LOCK(item); - if (mmf_attribute_check_flags(item, MM_ATTRS_FLAG_WRITABLE)) - { + if (mmf_attribute_check_flags(item, MM_ATTRS_FLAG_WRITABLE)) { int ret = 0; ret = mmf_attribute_set_string(item, string, size); @@ -287,8 +279,7 @@ int mm_attrs_set_data(MMHandleType h, int idx, void *data, int size) mmf_attribute_t *item = &attrs->items[idx]; return_val_if_fail(item, MM_ERROR_COMMON_INVALID_ARGUMENT); - if (mmf_attribute_check_flags(item, MM_ATTRS_FLAG_WRITABLE)) - { + if (mmf_attribute_check_flags(item, MM_ATTRS_FLAG_WRITABLE)) { int ret = 0; ret = mmf_attribute_set_data(item, data, size); @@ -302,7 +293,7 @@ int mm_attrs_set_data(MMHandleType h, int idx, void *data, int size) } -int mm_attrs_get_data(MMHandleType h, int idx,void **data, int *size) +int mm_attrs_get_data(MMHandleType h, int idx, void **data, int *size) { mmf_attrs_t *attrs = (mmf_attrs_t *) h; return_val_if_fail(attrs && idx >= 0 && idx < attrs->count && data, MM_ERROR_COMMON_INVALID_ARGUMENT); @@ -311,7 +302,7 @@ int mm_attrs_get_data(MMHandleType h, int idx,void **data, int *size) //mmf_debug(MMF_DEBUG_LOG, "Access denied.\n"); return MM_ERROR_COMMON_INVALID_PERMISSION; } - *data=mmf_value_get_data(&attrs->items[idx].value,size); + *data = mmf_value_get_data(&attrs->items[idx].value, size); return MM_ERROR_NONE; } @@ -350,8 +341,7 @@ int mm_attrs_set_string_by_name(MMHandleType attrs, const char *name, const char if (idx >= 0) { if (string) { size = strlen(string); - } - else { + } else { string = NULL; size = 0; } @@ -431,7 +421,7 @@ int mm_attrs_get_double_by_name(MMHandleType attrs, const char *name, double *va } -int mm_attrs_set_valist (MMHandleType attrs, char **err_attr_name, const char *attribute_name, va_list var_args) +int mm_attrs_set_valist(MMHandleType attrs, char **err_attr_name, const char *attribute_name, va_list var_args) { const char *name = NULL; int ret = MM_ERROR_NONE; @@ -444,14 +434,13 @@ int mm_attrs_set_valist (MMHandleType attrs, char **err_attr_name, const char *a *err_attr_name = NULL; name = attribute_name; - while (name) - { + while (name) { int idx = -1; MMAttrsType attr_type = MM_ATTRS_TYPE_INVALID; //name check - if ((ret = mm_attrs_get_index(attrs, name, &idx)) != MM_ERROR_NONE) - { + if ((ret = mm_attrs_get_index(attrs, name, &idx)) != MM_ERROR_NONE) { + if (err_attr_name) *err_attr_name = strdup(name); @@ -469,47 +458,45 @@ int mm_attrs_set_valist (MMHandleType attrs, char **err_attr_name, const char *a return ret; //cast and set - switch (attr_type) + switch (attr_type) { + case MM_ATTRS_TYPE_INT: { - case MM_ATTRS_TYPE_INT: - { - int val = va_arg ((var_args), int); + int val = va_arg((var_args), int); // mmf_debug(MMF_DEBUG_LOG, "(%s: %d)\n", name, val); - ret = mm_attrs_set_int(attrs, idx, val); - break; - } - case MM_ATTRS_TYPE_DOUBLE: - { - double val = va_arg ((var_args), double); + ret = mm_attrs_set_int(attrs, idx, val); + break; + } + case MM_ATTRS_TYPE_DOUBLE: + { + double val = va_arg((var_args), double); // mmf_debug(MMF_DEBUG_LOG, "(%s: %f)\n", name, val); - ret = mm_attrs_set_double(attrs, idx, val); - break; - } - case MM_ATTRS_TYPE_STRING: - { - char * val = va_arg ((var_args), char*); - int size = va_arg ((var_args), int); + ret = mm_attrs_set_double(attrs, idx, val); + break; + } + case MM_ATTRS_TYPE_STRING: + { + char * val = va_arg((var_args), char*); + int size = va_arg((var_args), int); // mmf_debug(MMF_DEBUG_LOG, "(%s: \'%s\', size: %d)\n", name, val, size); - ret = mm_attrs_set_string(attrs, idx, (const char*)val, size); - break; - } - case MM_ATTRS_TYPE_DATA: - { - void * val = va_arg ((var_args), void*); - int size = va_arg ((var_args), int); + ret = mm_attrs_set_string(attrs, idx, (const char*)val, size); + break; + } + case MM_ATTRS_TYPE_DATA: + { + void * val = va_arg((var_args), void*); + int size = va_arg((var_args), int); // mmf_debug(MMF_DEBUG_LOG, "(%s: %p, size: %d)\n", name, val, size); - ret = mm_attrs_set_data(attrs, idx, val, size); - break; - } - case MM_ATTRS_TYPE_INVALID: - default: - //mmf_debug(MMF_DEBUG_ERROR, "This function doesn't support attribute type(%d, name:%s)\n", attr_type, name); - return MM_ERROR_COMMON_INVALID_ARGUMENT; - break; + ret = mm_attrs_set_data(attrs, idx, val, size); + break; + } + case MM_ATTRS_TYPE_INVALID: + default: + //mmf_debug(MMF_DEBUG_ERROR, "This function doesn't support attribute type(%d, name:%s)\n", attr_type, name); + return MM_ERROR_COMMON_INVALID_ARGUMENT; + break; } - if (ret != MM_ERROR_NONE) - { + if (ret != MM_ERROR_NONE) { if (err_attr_name) *err_attr_name = strdup(name); //mmf_debug(MMF_DEBUG_ERROR, "Setting failure.(name:%s)\n", name); @@ -517,21 +504,21 @@ int mm_attrs_set_valist (MMHandleType attrs, char **err_attr_name, const char *a } //next name - name = va_arg (var_args, char*); + name = va_arg(var_args, char*); } if (mmf_attrs_commit_err(attrs, err_attr_name) == -1) { //mmf_debug(MMF_DEBUG_ERROR, "result of mmf_attrs_commit_err is -1 (name:%s)", name); return MM_ERROR_CAMCORDER_INVALID_ARGUMENT; - } - else + } else { return MM_ERROR_NONE; + } return ret; } -int mm_attrs_get_valist (MMHandleType attrs, char **err_attr_name, const char *attribute_name, va_list var_args) +int mm_attrs_get_valist(MMHandleType attrs, char **err_attr_name, const char *attribute_name, va_list var_args) { const char *name = NULL; int ret = MM_ERROR_NONE; @@ -544,14 +531,12 @@ int mm_attrs_get_valist (MMHandleType attrs, char **err_attr_name, const char *a *err_attr_name = NULL; name = attribute_name; - while (name) - { + while (name) { int idx = -1; MMAttrsType attr_type = MM_ATTRS_TYPE_INVALID; //name check - if ((ret = mm_attrs_get_index(attrs, name, &idx)) != MM_ERROR_NONE) - { + if ((ret = mm_attrs_get_index(attrs, name, &idx)) != MM_ERROR_NONE) { if (err_attr_name) *err_attr_name = strdup(name); @@ -566,49 +551,47 @@ int mm_attrs_get_valist (MMHandleType attrs, char **err_attr_name, const char *a return ret; //cast and set - switch (attr_type) + switch (attr_type) { + case MM_ATTRS_TYPE_INT: { - case MM_ATTRS_TYPE_INT: - { - int * val = va_arg ((var_args), int*); + int * val = va_arg((var_args), int*); // mmf_debug(MMF_DEBUG_LOG, "(%s: %p)\n", name, val); - ret = mm_attrs_get_int(attrs, idx, val); - break; - } - case MM_ATTRS_TYPE_DOUBLE: - { - double * val = va_arg ((var_args), double*); + ret = mm_attrs_get_int(attrs, idx, val); + break; + } + case MM_ATTRS_TYPE_DOUBLE: + { + double * val = va_arg((var_args), double*); // mmf_debug(MMF_DEBUG_LOG, "(%s: %p)\n", name, val); - ret = mm_attrs_get_double(attrs, idx, val); - break; - } - case MM_ATTRS_TYPE_STRING: - { - char ** val = va_arg ((var_args), char**); - int * size = va_arg ((var_args), int*); + ret = mm_attrs_get_double(attrs, idx, val); + break; + } + case MM_ATTRS_TYPE_STRING: + { + char ** val = va_arg((var_args), char**); + int * size = va_arg((var_args), int*); // mmf_debug(MMF_DEBUG_LOG, "(%s: %p, size: %p)\n", name, val, size); - ret = mm_attrs_get_string(attrs, idx, (char**)val, size); - break; - } - case MM_ATTRS_TYPE_DATA: - { - void ** val = va_arg ((var_args), void**); - int * size = va_arg ((var_args), int*); + ret = mm_attrs_get_string(attrs, idx, (char**)val, size); + break; + } + case MM_ATTRS_TYPE_DATA: + { + void ** val = va_arg((var_args), void**); + int * size = va_arg((var_args), int*); // mmf_debug(MMF_DEBUG_LOG, "(%s: %p, size: %p)\n", name, val, size); - ret = mm_attrs_get_data(attrs, idx, val, size); - break; - } - case MM_ATTRS_TYPE_INVALID: - default: + ret = mm_attrs_get_data(attrs, idx, val, size); + break; + } + case MM_ATTRS_TYPE_INVALID: + default: // mmf_debug(MMF_DEBUG_ERROR, "This function doesn't support attribute type(%d, name:%s)\n", attr_type, name); - //if (err_attr_name) - // *err_attr_name = strdup(name); - ret = MM_ERROR_COMMON_INVALID_ARGUMENT; - break; + //if (err_attr_name) + // *err_attr_name = strdup(name); + ret = MM_ERROR_COMMON_INVALID_ARGUMENT; + break; } - if (ret != MM_ERROR_NONE) - { + if (ret != MM_ERROR_NONE) { if (err_attr_name) *err_attr_name = strdup(name); //mmf_debug(MMF_DEBUG_ERROR, "Setting failure.(name:%s)\n", name); @@ -616,7 +599,7 @@ int mm_attrs_get_valist (MMHandleType attrs, char **err_attr_name, const char *a } //next name - name = va_arg (var_args, char*); + name = va_arg(var_args, char*); } return ret; @@ -630,9 +613,9 @@ int mm_attrs_multiple_set(MMHandleType handle, char **err_attr_name, const char return_val_if_fail(attribute_name, MM_ERROR_COMMON_INVALID_ARGUMENT); - va_start (var_args, attribute_name); - ret = mm_attrs_set_valist (handle, err_attr_name, attribute_name, var_args); - va_end (var_args); + va_start(var_args, attribute_name); + ret = mm_attrs_set_valist(handle, err_attr_name, attribute_name, var_args); + va_end(var_args); return ret; } @@ -645,9 +628,9 @@ int mm_attrs_multiple_get(MMHandleType handle, char **err_attr_name, const char return_val_if_fail(attribute_name, MM_ERROR_COMMON_INVALID_ARGUMENT); - va_start (var_args, attribute_name); - ret = mm_attrs_get_valist (handle, err_attr_name, attribute_name, var_args); - va_end (var_args); + va_start(var_args, attribute_name); + ret = mm_attrs_get_valist(handle, err_attr_name, attribute_name, var_args); + va_end(var_args); return ret; } @@ -659,7 +642,7 @@ int mm_attrs_get_info(MMHandleType h, int idx, MMAttrsInfo *info) return_val_if_fail(h, MM_ERROR_COMMON_INVALID_ARGUMENT); return_val_if_fail(info, MM_ERROR_COMMON_INVALID_ARGUMENT); - return_val_if_fail( 0 <= idx && idx < attrs->count, MM_ERROR_COMMON_INVALID_ARGUMENT); + return_val_if_fail(0 <= idx && idx < attrs->count, MM_ERROR_COMMON_INVALID_ARGUMENT); memset(info, 0x00, sizeof(MMAttrsInfo)); @@ -667,33 +650,32 @@ int mm_attrs_get_info(MMHandleType h, int idx, MMAttrsInfo *info) info->flag = attrs->items[idx].flags; info->validity_type = attrs->items[idx].value_spec.type; - switch (info->validity_type) - { - case MM_ATTRS_VALID_TYPE_INT_ARRAY: - info->int_array.array = attrs->items[idx].value_spec.spec.int_spec.array.array; - info->int_array.count = attrs->items[idx].value_spec.spec.int_spec.array.count; - info->int_array.dval = attrs->items[idx].value_spec.spec.int_spec.array.dval; + switch (info->validity_type) { + case MM_ATTRS_VALID_TYPE_INT_ARRAY: + info->int_array.array = attrs->items[idx].value_spec.spec.int_spec.array.array; + info->int_array.count = attrs->items[idx].value_spec.spec.int_spec.array.count; + info->int_array.dval = attrs->items[idx].value_spec.spec.int_spec.array.dval; break; - case MM_ATTRS_VALID_TYPE_INT_RANGE: - info->int_range.min = attrs->items[idx].value_spec.spec.int_spec.range.min; - info->int_range.max = attrs->items[idx].value_spec.spec.int_spec.range.max; - info->int_range.dval = attrs->items[idx].value_spec.spec.int_spec.range.dval; + case MM_ATTRS_VALID_TYPE_INT_RANGE: + info->int_range.min = attrs->items[idx].value_spec.spec.int_spec.range.min; + info->int_range.max = attrs->items[idx].value_spec.spec.int_spec.range.max; + info->int_range.dval = attrs->items[idx].value_spec.spec.int_spec.range.dval; break; - case MM_ATTRS_VALID_TYPE_DOUBLE_ARRAY: - info->double_array.array = attrs->items[idx].value_spec.spec.double_spec.array.array; - info->double_array.count = attrs->items[idx].value_spec.spec.double_spec.array.count; - info->double_array.dval = attrs->items[idx].value_spec.spec.double_spec.array.dval; + case MM_ATTRS_VALID_TYPE_DOUBLE_ARRAY: + info->double_array.array = attrs->items[idx].value_spec.spec.double_spec.array.array; + info->double_array.count = attrs->items[idx].value_spec.spec.double_spec.array.count; + info->double_array.dval = attrs->items[idx].value_spec.spec.double_spec.array.dval; break; - case MM_ATTRS_VALID_TYPE_DOUBLE_RANGE: - info->double_range.min = attrs->items[idx].value_spec.spec.double_spec.range.min; - info->double_range.max = attrs->items[idx].value_spec.spec.double_spec.range.max; - info->double_range.dval = attrs->items[idx].value_spec.spec.double_spec.range.dval; + case MM_ATTRS_VALID_TYPE_DOUBLE_RANGE: + info->double_range.min = attrs->items[idx].value_spec.spec.double_spec.range.min; + info->double_range.max = attrs->items[idx].value_spec.spec.double_spec.range.max; + info->double_range.dval = attrs->items[idx].value_spec.spec.double_spec.range.dval; break; - case MM_ATTRS_VALID_TYPE_NONE: - //mmf_debug(MMF_DEBUG_LOG, "Valid type none.\n"); + case MM_ATTRS_VALID_TYPE_NONE: + //mmf_debug(MMF_DEBUG_LOG, "Valid type none.\n"); break; - case MM_ATTRS_VALID_TYPE_INVALID: - default: + case MM_ATTRS_VALID_TYPE_INVALID: + default: break; } diff --git a/mm_attrs_private.c b/mm_attrs_private.c index e79907e..d243708 100644 --- a/mm_attrs_private.c +++ b/mm_attrs_private.c @@ -92,11 +92,11 @@ int mmf_value_set_double(mmf_value_t *v, double dval) double mmf_value_get_double(mmf_value_t *v) { - return_val_if_fail(v->type == MMF_VALUE_TYPE_DOUBLE, -1); - return v->value.d_val; + return_val_if_fail(v->type == MMF_VALUE_TYPE_DOUBLE, -1); + return v->value.d_val; } -int mmf_value_set_string(mmf_value_t *v, const char *sval,int size) +int mmf_value_set_string(mmf_value_t *v, const char *sval, int size) { return_val_if_fail(v && v->type == MMF_VALUE_TYPE_STRING, -1); if (v->value.s_val != NULL) { @@ -104,36 +104,35 @@ int mmf_value_set_string(mmf_value_t *v, const char *sval,int size) v->value.s_val = NULL; v->size = 0; } - if (sval){ + if (sval) { v->value.s_val = strdup(sval); v->size = size; - } - else{ + } else { v->value.s_val = NULL; v->size = 0; - } + } return 0; } char* mmf_value_get_string(const mmf_value_t *v, int *size) { return_val_if_fail(v && v->type == MMF_VALUE_TYPE_STRING, NULL); - *size=v->size; + *size = v->size; return v->value.s_val; } -int mmf_value_set_data(mmf_value_t *v, void *data,int size) +int mmf_value_set_data(mmf_value_t *v, void *data, int size) { return_val_if_fail(v && v->type == MMF_VALUE_TYPE_DATA, -1); v->value.p_val = data; - v->size=size; + v->size = size; return 0; } -void* mmf_value_get_data(const mmf_value_t *v,int *size) +void* mmf_value_get_data(const mmf_value_t *v, int *size) { return_val_if_fail(v && v->type == MMF_VALUE_TYPE_DATA, NULL); - *size=v->size; + *size = v->size; return v->value.p_val; } @@ -289,7 +288,7 @@ int mmf_value_spec_get_double_array(mmf_value_spec_t *vs, double **array, int *c int mmf_value_spec_clear(mmf_value_spec_t *vs) { return_val_if_fail(vs, -1); - switch(vs->type) { + switch (vs->type) { case MMF_VALUE_SPEC_INT_ARRAY: if (vs->spec.int_spec.array.array) { free(vs->spec.int_spec.array.array); @@ -491,7 +490,7 @@ int mmf_attribute_set_string(mmf_attribute_t *item, const char *string, int size { return_val_if_fail(item, -1); - if (mmf_value_set_string(&item->tmpval, string,size) == 0) { + if (mmf_value_set_string(&item->tmpval, string, size) == 0) { if (string) item->flags |= MM_ATTRS_FLAG_MODIFIED; @@ -504,7 +503,7 @@ int mmf_attribute_set_data(mmf_attribute_t *item, void *data, int size) { return_val_if_fail(item, -1); - if (mmf_value_set_data(&item->tmpval, data,size) == 0) { + if (mmf_value_set_data(&item->tmpval, data, size) == 0) { item->flags |= MM_ATTRS_FLAG_MODIFIED; return 0; } @@ -515,7 +514,7 @@ MMHandleType mmf_attrs_new(int count) { return_val_if_fail(count > 0, 0); mmf_attrs_t *attrs; - attrs = (mmf_attrs_t *) malloc (sizeof(mmf_attrs_t)); + attrs = (mmf_attrs_t *) malloc(sizeof(mmf_attrs_t)); if (attrs == NULL) { debug_error("malloc failed"); @@ -523,13 +522,13 @@ MMHandleType mmf_attrs_new(int count) } attrs->count = count; - attrs->items = (mmf_attribute_t *) malloc (sizeof(mmf_attribute_t) * count); - if(attrs->items == NULL) { - debug_error("Failed to malloc for attrs->items."); - free(attrs); - attrs=NULL; - return 0; - } + attrs->items = (mmf_attribute_t *) malloc(sizeof(mmf_attribute_t) * count); + if (attrs->items == NULL) { + debug_error("Failed to malloc for attrs->items."); + free(attrs); + attrs = NULL; + return 0; + } memset(attrs->items, 0, sizeof(mmf_attribute_t) * count); @@ -537,17 +536,17 @@ MMHandleType mmf_attrs_new(int count) } MMHandleType mmf_attrs_new_from_data(const char *name, - mmf_attrs_construct_info_t *info, - int count, - mmf_attrs_commit_func_t commit_func, - void *commit_param) + mmf_attrs_construct_info_t *info, + int count, + mmf_attrs_commit_func_t commit_func, + void *commit_param) { return_val_if_fail(info && count > 0, 0); MMHandleType h; mmf_attrs_t *attrs; h = mmf_attrs_new(count); - if(!h) { + if (!h) { return 0; } mmf_attrs_init(h, info, count); @@ -595,15 +594,15 @@ int mmf_attrs_init(MMHandleType h, mmf_attrs_construct_info_t *info, int count) pthread_mutex_init(&item->write_lock, NULL); mmf_attribute_init(item, - info[i].name, - info[i].value_type, - info[i].flags); + info[i].name, + info[i].value_type, + info[i].flags); switch (info[i].value_type) { case MMF_VALUE_TYPE_INT: assert(item->value.value.i_val == 0); mmf_value_set_int(&item->value, - (intptr_t)info[i].default_value); + (intptr_t)info[i].default_value); break; case MMF_VALUE_TYPE_DOUBLE: { @@ -619,14 +618,14 @@ int mmf_attrs_init(MMHandleType h, mmf_attrs_construct_info_t *info, int count) size = strlen(info[i].default_value)+1; } mmf_value_set_string(&item->value, - (const char *)info[i].default_value,size); + (const char *)info[i].default_value, size); break; case MMF_VALUE_TYPE_DATA: assert(item->value.value.p_val == NULL); if (info[i].default_value) { size = sizeof(info[i].default_value)+1; } - mmf_value_set_data(&item->value, info[i].default_value,size); + mmf_value_set_data(&item->value, info[i].default_value, size); break; default: //mmf_debug(MMF_DEBUG_LOG, "ERROR: Invalid MMF_VALUE_TYPE\n"); @@ -642,7 +641,7 @@ int mmf_attrs_commit(MMHandleType h) { return_val_if_fail(h, -1); - mmf_attrs_t *attrs = (mmf_attrs_t * )h; + mmf_attrs_t *attrs = (mmf_attrs_t *)h; mmf_attribute_t *item = NULL; int i; int ret = 0; @@ -677,7 +676,7 @@ int mmf_attrs_commit(MMHandleType h) int mmf_attrs_commit_err(MMHandleType h, char **err_attr_name) { - mmf_attrs_t *attrs = (mmf_attrs_t * )h; + mmf_attrs_t *attrs = (mmf_attrs_t *)h; mmf_attribute_t *item = NULL; int i; int ret = 0; @@ -722,7 +721,7 @@ int mmf_attrs_commit_err(MMHandleType h, char **err_attr_name) int mmf_attrs_set_valid_type(MMHandleType h, int idx, int v_type) { return_val_if_fail(h, -1); - return_val_if_fail(idx>=0, -1); + return_val_if_fail(idx >= 0, -1); mmf_attrs_t *attrs = (mmf_attrs_t *) h; return mmf_value_spec_init(&attrs->items[idx].value_spec, v_type); } @@ -730,7 +729,7 @@ int mmf_attrs_set_valid_type(MMHandleType h, int idx, int v_type) int mmf_attrs_set_valid_range(MMHandleType h, int idx, int min, int max, int dval) { return_val_if_fail(h, -1); - return_val_if_fail(idx>=0, -1); + return_val_if_fail(idx >= 0, -1); mmf_attrs_t *attrs = (mmf_attrs_t *) h; mmf_value_spec_clear(&attrs->items[idx].value_spec); assert(attrs->items[idx].value_spec.type == MMF_VALUE_SPEC_INT_RANGE); @@ -740,7 +739,7 @@ int mmf_attrs_set_valid_range(MMHandleType h, int idx, int min, int max, int dva int mmf_attrs_set_valid_array(MMHandleType h, int idx, const int *array, int count, int dval) { return_val_if_fail(h, -1); - return_val_if_fail(idx>=0, -1); + return_val_if_fail(idx >= 0, -1); mmf_attrs_t *attrs = (mmf_attrs_t *) h; mmf_value_spec_clear(&attrs->items[idx].value_spec); assert(attrs->items[idx].value_spec.type == MMF_VALUE_SPEC_INT_ARRAY); @@ -750,7 +749,7 @@ int mmf_attrs_set_valid_array(MMHandleType h, int idx, const int *array, int cou int mmf_attrs_set_valid_double_range(MMHandleType h, int idx, double min, double max, double dval) { return_val_if_fail(h, -1); - return_val_if_fail(idx>=0, -1); + return_val_if_fail(idx >= 0, -1); mmf_attrs_t *attrs = (mmf_attrs_t *) h; mmf_value_spec_clear(&attrs->items[idx].value_spec); assert(attrs->items[idx].value_spec.type == MMF_VALUE_SPEC_DOUBLE_RANGE); @@ -760,7 +759,7 @@ int mmf_attrs_set_valid_double_range(MMHandleType h, int idx, double min, double int mmf_attrs_set_valid_double_array(MMHandleType h, int idx, const double *array, int count, double dval) { return_val_if_fail(h, -1); - return_val_if_fail(idx>=0, -1); + return_val_if_fail(idx >= 0, -1); mmf_attrs_t *attrs = (mmf_attrs_t *) h; mmf_value_spec_clear(&attrs->items[idx].value_spec); assert(attrs->items[idx].value_spec.type == MMF_VALUE_SPEC_DOUBLE_ARRAY); diff --git a/mm_list_private.c b/mm_list_private.c index 1734899..5eaa534 100644 --- a/mm_list_private.c +++ b/mm_list_private.c @@ -65,8 +65,7 @@ int mmf_list_append(void *data) if (list == NULL) { /* first item */ g_list = item; - } - else { + } else { list = g_list; /* move to last */ @@ -93,8 +92,7 @@ int mmf_list_remove(int handle) /* remove handle */ if (prev) { prev->next = list->next; - } - else { + } else { g_list = list->next; } diff --git a/packaging/libmm-common.spec b/packaging/libmm-common.spec index 56a319a..28e20d5 100644 --- a/packaging/libmm-common.spec +++ b/packaging/libmm-common.spec @@ -1,6 +1,6 @@ Name: libmm-common Summary: Multimedia Framework Common Lib -Version: 0.2.104 +Version: 0.2.105 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 -- 2.7.4