Merge branch 'tizen_3.0' into tizen 24/99124/1
authorGilbok Lee <gilbok.lee@samsung.com>
Tue, 22 Nov 2016 03:50:03 +0000 (12:50 +0900)
committerGilbok Lee <gilbok.lee@samsung.com>
Tue, 22 Nov 2016 03:50:08 +0000 (12:50 +0900)
Change-Id: I3d05bb41d2b61dc6b75e8b2881b23465d7c88552

packaging/libmm-radio.spec
src/include/mm_radio.h
src/include/mm_radio_priv.h
src/include/mm_radio_utils.h
src/mm_radio_priv_hal.c
src/radio_hal_interface.c

index ae6750e..12f7388 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       libmm-radio
 Summary:    Multimedia Framework Radio Library
-Version:    0.2.12
+Version:    0.2.13
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0
index 00052f6..e9d617e 100644 (file)
@@ -91,7 +91,7 @@ typedef enum {
  *
  * @return     This function returns zero on success, or negative value with errors
  * @pre                None
- * @post       MM_RADIO_STATE_NULL
+ * @post       MM_RADIO_STATE_NULL
  * @remark     None
  * @see                mm_radio_destroy mm_radio_realize mm_radio_unrealize mm_radio_start mm_radio_stop
  * @par                Example
@@ -311,7 +311,7 @@ int mm_radio_create(MMHandleType *hradio);
  *
  * @return     This function returns zero on success, or negative value with errors
  * @pre                Application can use this API at any state.
- * @post       None
+ * @post       None
  * @remark     None
  * @see                mm_radio_create mm_radio_realize mm_radio_unrealize mm_radio_start mm_radio_stop
  * @par                Example
@@ -530,7 +530,7 @@ int mm_radio_destroy(MMHandleType hradio);
  *
  * @return     This function returns zero on success, or negative value with errors
  * @pre                MM_RADIO_STATE_NULL
- * @post       MM_RADIO_STATE_READY
+ * @post       MM_RADIO_STATE_READY
  * @remark     None
  * @see                mm_radio_create mm_radio_destroy mm_radio_unrealize mm_radio_start mm_radio_stop
  * @par                Example
@@ -750,7 +750,7 @@ int mm_radio_realize(MMHandleType hradio);
  *
  * @return     This function returns zero on success, or negative value with errors
  * @pre                MM_RADIO_STATE_READY
- * @post       MM_RADIO_STATE_NULL
+ * @post       MM_RADIO_STATE_NULL
  * @remark     None
  * @see                mm_radio_create mm_radio_destroy mm_radio_realize mm_radio_start mm_radio_stop
  * @par                Example
@@ -971,7 +971,7 @@ int mm_radio_unrealize(MMHandleType hradio);
  *
  * @return     This function returns zero on success, or negative value with errors
  * @pre                None
- * @post       None
+ * @post       None
  * @remark     None
  * @see
  * @par                Example
@@ -1191,7 +1191,7 @@ int mm_radio_set_message_callback(MMHandleType hradio, MMMessageCallback callbac
  *
  * @return     This function returns zero on success, or negative value with errors
  * @pre                None
- * @post       None
+ * @post       None
  * @remark     None
  * @see
  * @par                Example
@@ -1410,7 +1410,7 @@ int mm_radio_get_state(MMHandleType hradio, MMRadioStateType *state);
  *
  * @return     This function returns zero on success, or negative value with errors
  * @pre                MM_RADIO_STATE_READY
- * @post       MM_RADIO_STATE_PLAYING
+ * @post       MM_RADIO_STATE_PLAYING
  * @remark     None
  * @see                mm_radio_create mm_radio_destroy mm_radio_realize mm_radio_unrealize mm_radio_stop
  * @par        Example
@@ -1630,7 +1630,7 @@ int mm_radio_start(MMHandleType hradio);
  *
  * @return     This function returns zero on success, or negative value with errors
  * @pre                MM_RADIO_STATE_PLAYING
- * @post       MM_RADIO_STATE_READY
+ * @post       MM_RADIO_STATE_READY
  * @remark     None
  * @see                mm_radio_create mm_radio_destroy mm_radio_realize mm_radio_unrealize mm_radio_start
  * @par        Example
@@ -1858,7 +1858,7 @@ int mm_radio_stop(MMHandleType hradio);
  *
  * @return     This function returns zero on success, or negative value with errors
  * @pre                MM_RADIO_STATE_PLAYING
- * @post       MM_RADIO_STATE_PLAYING
+ * @post       MM_RADIO_STATE_PLAYING
  * @remark     None
  * @see                MM_MESSAGE_RADIO_SEEK_START MM_MESSAGE_RADIO_SEEK_FINISH
  * @par                Example
@@ -2079,7 +2079,7 @@ int mm_radio_seek(MMHandleType hradio, MMRadioSeekDirectionType direction);
  *
  * @return     This function returns zero on success, or negative value with errors
  * @pre                MM_RADIO_STATE_READY, MM_RADIO_STATE_PLAYING
- * @post       MM_RADIO_STATE_READY, MM_RADIO_STATE_PLAYING
+ * @post       MM_RADIO_STATE_READY, MM_RADIO_STATE_PLAYING
  * @remark     None
  * @see                mm_radio_get_frequency
  * @par                Example
@@ -2300,7 +2300,7 @@ int mm_radio_set_frequency(MMHandleType hradio, int freq);
  *
  * @return     This function returns zero on success, or negative value with errors
  * @pre                MM_RADIO_STATE_READY, MM_RADIO_STATE_PLAYING
- * @post       MM_RADIO_STATE_READY, MM_RADIO_STATE_PLAYING
+ * @post       MM_RADIO_STATE_READY, MM_RADIO_STATE_PLAYING
  * @remark     None
  * @see                mm_radio_set_frequency
  * @par                Example
@@ -2523,7 +2523,7 @@ int mm_radio_get_frequency(MMHandleType hradio, int *pFreq);
  *
  * @return     This function returns zero on success, or negative value with errors
  * @pre                MM_RADIO_STATE_READY
- * @post               MM_RADIO_STATE_SCANNING
+ * @post       MM_RADIO_STATE_SCANNING
  * @remark     None
  * @see                mm_radio_scan_stop
  * @par                Example
@@ -2744,7 +2744,7 @@ int mm_radio_scan_start(MMHandleType hradio);
  *
  * @return     This function returns zero on success, or negative value with errors
  * @pre                MM_RADIO_STATE_SCANNING
- * @post       MM_RADIO_STATE_READY
+ * @post       MM_RADIO_STATE_READY
  * @remark     None
  * @see                mm_radio_scan_start
  * @par                Example
@@ -2965,7 +2965,7 @@ int mm_radio_scan_stop(MMHandleType hradio);
  *
  * @return     This function returns zero on success, or negative value with errors
  * @pre                None
- * @post       None
+ * @post       None
  * @remark     None
  * @see
  * @par                Example
@@ -3194,7 +3194,7 @@ int mm_radio_set_mute(MMHandleType hradio, bool muted);
  *
  * @return     This function returns zero on success, or negative value with errors
  * @pre                None
- * @post       None
+ * @post       None
  * @remark     None
  * @see
  * @par                Example
@@ -3424,7 +3424,7 @@ int mm_radio_get_signal_strength(MMHandleType hradio, int *value);
  *
  * @return     This function returns zero on success, or negative value with errors
  * @pre                None
- * @post       None
+ * @post       None
  * @remark     None
  * @see mm_radio_get_region_frequency_range()
  */
@@ -3439,8 +3439,8 @@ int mm_radio_get_region_type(MMHandleType hradio, MMRadioRegionType *type);
  *
  * @return     This function returns zero on success, or negative value with errors
  * @pre                None
- * @post       None
- * @remark      The unit of frequency is KHz.
+ * @post       None
+ * @remark     The unit of frequency is KHz.
  * @see mm_radio_get_region_type()
  */
 int mm_radio_get_region_frequency_range(MMHandleType hradio, unsigned int *min, unsigned int *max);
@@ -3453,7 +3453,7 @@ int mm_radio_get_region_frequency_range(MMHandleType hradio, unsigned int *min,
  *
  * @return     This function returns zero on success, or negative value with errors
  * @pre                None
- * @post       None
+ * @post       None
  * @see mm_radio_get_region_type()
  */
 int mm_radio_get_channel_spacing(MMHandleType hradio, int *channel_spacing);
index 7b773a2..9e1eb3f 100644 (file)
@@ -102,9 +102,9 @@ typedef enum {
 typedef enum {
        MM_RADIO_FREQ_NONE                              = 0,
        /* min band types */
-       MM_RADIO_FREQ_MIN_76100_KHZ             = 76100,
-       MM_RADIO_FREQ_MIN_87500_KHZ             = 87500,
-       MM_RADIO_FREQ_MIN_88100_KHZ             = 88100,
+       MM_RADIO_FREQ_MIN_76100_KHZ             = 76100,
+       MM_RADIO_FREQ_MIN_87500_KHZ             = 87500,
+       MM_RADIO_FREQ_MIN_88100_KHZ             = 88100,
        /* max band types */
        MM_RADIO_FREQ_MAX_89900_KHZ             = 89900,
        MM_RADIO_FREQ_MAX_108000_KHZ    = 108000,
@@ -217,9 +217,9 @@ int _mmradio_start_scan(mm_radio_t *radio);
 int _mmradio_stop_scan(mm_radio_t *radio);
 int _mm_radio_get_signal_strength(mm_radio_t *radio, int *strength);
 #ifdef USE_GST_PIPELINE
-int _mmradio_realize_pipeline( mm_radio_t *radio);
+int _mmradio_realize_pipeline(mm_radio_t *radio);
 int _mmradio_start_pipeline(mm_radio_t *radio);
-int _mmradio_stop_pipeline( mm_radio_t *radio);
+int _mmradio_stop_pipeline(mm_radio_t *radio);
 int _mmradio_destroy_pipeline(mm_radio_t *radio);
 #endif
 int _mmradio_apply_region(mm_radio_t *radio, MMRadioRegionType region, bool update);
index 35e8dc7..d368a60 100644 (file)
 
 #define MMRADIO_MAX_INT        (2147483647)
 
-#define MMRADIO_FREEIF(x) \
-if ( x ) \
-       free( x ); \
-x = NULL;
-
-#define MMRADIO_CHECK_INSTANCE( x_radio ) \
-if ( ! x_radio ) \
-{ \
-       debug_error("radio instance is NULL\n"); \
-       return MM_ERROR_RADIO_NOT_INITIALIZED; \
-}
-
-#define MMRADIO_CHECK_ARG( x_radio ) \
-if ( ! x_radio ) \
-{ \
-       debug_error("argument is NULL\n"); \
-       return MM_ERROR_COMMON_INVALID_ARGUMENT; \
-}
-
-
-#define MMRADIO_CHECK_INSTANCE_RETURN_VOID( x_radio ) \
-if ( ! x_radio ) \
-{ \
-       debug_error("radio instance is NULL\n"); \
-       return; \
-}
-
-#define MMRADIO_CHECK_DEVICE_STATE( x_radio ) \
-if ( x_radio->radio_fd < 0 ) \
-{ \
-       debug_error("not available radio device\n"); \
-       return MM_ERROR_RADIO_NOT_INITIALIZED;\
-}
+#define MMRADIO_FREEIF(x)      \
+do {                                           \
+       if (x) {                                \
+               free(x);                        \
+               x = NULL;                       \
+       }                                               \
+} while (0)
+
+#define MMRADIO_CHECK_INSTANCE(x_radio)                                \
+do {                                                                                           \
+       if (!x_radio) {                                                                 \
+               debug_error("radio instance is NULL\n");        \
+               return MM_ERROR_RADIO_NOT_INITIALIZED;          \
+       }                                                                                               \
+} while (0)
+
+#define MMRADIO_CHECK_ARG(x_radio)                                     \
+do {                                                                                           \
+       if (!x_radio) {                                                                 \
+               debug_error("argument is NULL\n");                      \
+               return MM_ERROR_COMMON_INVALID_ARGUMENT;        \
+       }                                                                                               \
+} while (0)
+
+
+#define MMRADIO_CHECK_INSTANCE_RETURN_VOID(x_radio)    \
+do {                                                                                           \
+       if (!x_radio) {                                                                 \
+               debug_error("radio instance is NULL\n");        \
+               return;                                                                         \
+       }                                                                                               \
+} while (0)
+
+#define MMRADIO_CHECK_DEVICE_STATE(x_radio)                            \
+do {                                                                                                   \
+       if (x_radio->radio_fd < 0) {                                            \
+               debug_error("not available radio device\n");    \
+               return MM_ERROR_RADIO_NOT_INITIALIZED;                  \
+       }                                                                                                       \
+} while (0)
 
 /* command locking for multithreading */
 #define MMRADIO_CMD_LOCK(x_radio)              pthread_mutex_lock(&((mm_radio_t *)x_radio)->cmd_lock)
@@ -91,40 +98,43 @@ if ( x_radio->radio_fd < 0 ) \
 #define MMRADIO_VOLUME_UNLOCK(x_radio)         pthread_mutex_unlock(&((mm_radio_t *)x_radio)->volume_lock)
 
 /* message posting */
-#define MMRADIO_POST_MSG( x_radio, x_msgtype, x_msg_param ) \
-debug_log("posting %s to application\n", #x_msgtype); \
-__mmradio_post_message(x_radio, x_msgtype, x_msg_param);
+#define MMRADIO_POST_MSG(x_radio, x_msgtype, x_msg_param)              \
+do {                                                                                                                   \
+       debug_log("posting %s to application\n", #x_msgtype);           \
+       __mmradio_post_message(x_radio, x_msgtype, x_msg_param);        \
+} while (0)
 
 /* setting radio state */
-#define MMRADIO_SET_STATE( x_radio, x_state ) \
-debug_log("setting mm-radio state to %d\n", x_state); \
-__mmradio_set_state(x_radio, x_state);
+#define MMRADIO_SET_STATE(x_radio, x_state)                                    \
+do {                                                                                                           \
+       debug_log("setting mm-radio state to %d\n", x_state);   \
+       __mmradio_set_state(x_radio, x_state);                                  \
+} while (0)
 
 /* state */
-#define MMRADIO_CHECK_STATE_RETURN_IF_FAIL( x_radio, x_command ) \
-debug_log("checking radio state before doing %s\n", #x_command); \
-switch ( __mmradio_check_state(x_radio, x_command) ) \
-{ \
-       case MM_ERROR_RADIO_INVALID_STATE: \
-               return MM_ERROR_RADIO_INVALID_STATE; \
-       break; \
-       /* NOTE : for robustness of mmfw. we won't treat it as an error */ \
-       case MM_ERROR_RADIO_NO_OP: \
-               return MM_ERROR_NONE; \
-       break; \
-       default: \
-       break; \
-}
-
-#define MMRADIO_CHECK_RETURN_IF_FAIL( x_ret, x_msg ) \
-do \
-{ \
-       if( x_ret < 0 ) \
-       { \
-               debug_error("%s error\n", x_msg);\
-               return x_ret; \
-       } \
-} while( 0 ) ;
+#define MMRADIO_CHECK_STATE_RETURN_IF_FAIL(x_radio, x_command)                 \
+do {                                                                                                                                   \
+       debug_log("checking radio state before doing %s\n", #x_command);        \
+       switch (__mmradio_check_state(x_radio, x_command)) {                            \
+       case MM_ERROR_RADIO_INVALID_STATE:                                                                      \
+               return MM_ERROR_RADIO_INVALID_STATE;                                                    \
+               break;                                                                                                                  \
+       /* NOTE : for robustness of mmfw. we won't treat it as an error */      \
+       case MM_ERROR_RADIO_NO_OP:                                                                                      \
+               return MM_ERROR_NONE;                                                                                   \
+               break;                                                                                                                  \
+       default:                                                                                                                        \
+               break;                                                                                                                  \
+       }                                                                                                                                       \
+} while (0)
+
+#define MMRADIO_CHECK_RETURN_IF_FAIL(x_ret, x_msg)             \
+do {                                                                                                   \
+       if (x_ret < 0) {                                                                        \
+               debug_error("%s error\n", x_msg);                               \
+               return x_ret;                                                                   \
+       }                                                                                                       \
+} while (0);
 
 #endif
 
index 109e6dc..d02de91 100644 (file)
@@ -1569,9 +1569,8 @@ int _mmradio_get_volume(mm_radio_t *radio, float *pVolume)
                total_volume, radio->max_media_volume, radio->media_volume, volume);
 
        /* update volume in handle */
-       if (fabs(radio->local_volume - volume) >= FLT_EPSILON) {
+       if (fabs(radio->local_volume - volume) >= FLT_EPSILON)
                radio->local_volume = volume;
-       }
 
        *pVolume = (float)radio->local_volume;
        MMRADIO_VOLUME_UNLOCK(radio);
index adc1bf2..8fb5cdd 100644 (file)
@@ -52,7 +52,7 @@ static int __convert_error_code(int code, char *func_name)
                msg = "MM_ERROR_RADIO_NO_FREE_SPACE";
                break;
        case RADIO_ERROR_PERMISSION_DENIED:
-       case RADIO_ERROR_DEVICE_NOT_PREPARED :
+       case RADIO_ERROR_DEVICE_NOT_PREPARED:
                ret = MM_ERROR_RADIO_PERMISSION_DENIED;
                msg = "MM_ERROR_RADIO_PERMISSION_DENIED";
                break;
@@ -87,14 +87,14 @@ int radio_hal_interface_init(mm_radio_hal_interface **handle)
        int ret = MM_ERROR_NONE;
        h = (mm_radio_hal_interface *)malloc(sizeof(mm_radio_hal_interface));
 
-       if(!h) {
+       if (!h) {
                MMRADIO_LOG_ERROR("cannot allocate memory for radio_hal interface");
                return MM_ERROR_RADIO_NO_FREE_SPACE;
        }
 
        h->dl_handle = dlopen(LIB_TIZEN_RADIO, RTLD_NOW);
 
-       if(h->dl_handle) {
+       if (h->dl_handle) {
                h->intf.init = dlsym(h->dl_handle, "radio_init");
                h->intf.deinit = dlsym(h->dl_handle, "radio_deinit");
                h->intf.prepare = dlsym(h->dl_handle, "radio_prepare");