[0.2.109] change volume function interface 88/203988/1 accepted/tizen/unified/20190423.113320 submit/tizen/20190419.043449 submit/tizen/20190419.043508
authorEunhye Choi <eunhae1.choi@samsung.com>
Thu, 18 Apr 2019 09:45:13 +0000 (18:45 +0900)
committerEunhye Choi <eunhae1.choi@samsung.com>
Thu, 18 Apr 2019 09:45:15 +0000 (18:45 +0900)
- change set/get volume function interface
  by using united volume parameter instead of
  left and right volume which is not used anymore.

Change-Id: I11895b1574a7d4776b4704660dec19b42bbe4ec9

legacy/include/legacy_player.h
legacy/src/legacy_player.c
muse/src/muse_player.c
packaging/mmsvc-player.spec

index ff30979..ef100f2 100644 (file)
@@ -500,8 +500,7 @@ int  legacy_player_get_state(legacy_player_h player, player_state_e *state);
  *          Finally, it does not support to set other value into each channel currently.
  *
  * @param[in]   player The handle to the media player
- * @param[in]   left The left volume scalar
- * @param[in]   right The right volume scalar
+ * @param[in]   volume The volume scalar
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #PLAYER_ERROR_NONE Successful
@@ -509,18 +508,17 @@ int  legacy_player_get_state(legacy_player_h player, player_state_e *state);
  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
  * @see legacy_player_get_volume()
  */
-int legacy_player_set_volume(legacy_player_h player, float left, float right);
+int legacy_player_set_volume(legacy_player_h player, float volume);
 
 /**
  * @brief Gets the player's current volume factor.
  * @since_tizen 2.3
- * @details The range of @a left and @a right is from @c 0 to @c 1.0, inclusive (1.0 = 100%).
+ * @details The range of @a volume is from @c 0 to @c 1.0, inclusive (1.0 = 100%).
  *          This function gets the player volume, not the system volume.
  *          To get the system volume, use the @ref CAPI_MEDIA_SOUND_MANAGER_MODULE API.
  *
  * @param[in]   player The handle to the media player
- * @param[out]  left The current left volume scalar
- * @param[out]  right The current right volume scalar
+ * @param[out]  volume The current volume scalar
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #PLAYER_ERROR_NONE Successful
@@ -528,7 +526,7 @@ int legacy_player_set_volume(legacy_player_h player, float left, float right);
  * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
  * @see legacy_player_set_volume()
  */
-int legacy_player_get_volume(legacy_player_h player, float *left, float *right);
+int legacy_player_get_volume(legacy_player_h player, float *volume);
 
 /**
  * @brief Sets the player's sound manager stream information.
index 034ddaf..d0c1059 100644 (file)
@@ -972,40 +972,32 @@ int legacy_player_get_state(legacy_player_h player, player_state_e *state)
        return PLAYER_ERROR_NONE;
 }
 
-int legacy_player_set_volume(legacy_player_h player, float left, float right)
+int legacy_player_set_volume(legacy_player_h player, float volume)
 {
        legacy_player_t *handle = (legacy_player_t *)player;
-       mmplayer_volume_type_t vol;
        int ret = MM_ERROR_NONE;
        PLAYER_INSTANCE_CHECK(player);
-       PLAYER_CHECK_CONDITION(left >= 0 && left <= 1.0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
-       PLAYER_CHECK_CONDITION(right >= 0 && right <= 1.0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
+       PLAYER_CHECK_CONDITION(volume >= 0 && volume <= 1.0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
 
-       vol.level[MM_VOLUME_CHANNEL_LEFT] = left;
-       vol.level[MM_VOLUME_CHANNEL_RIGHT] = right;
-       ret = mm_player_set_volume(handle->mm_handle, &vol);
+       ret = mm_player_set_volume(handle->mm_handle, volume);
        if (ret != MM_ERROR_NONE)
                return __player_convert_error_code(ret, (char *)__FUNCTION__);
 
        return PLAYER_ERROR_NONE;
 }
 
-int legacy_player_get_volume(legacy_player_h player, float *left, float *right)
+int legacy_player_get_volume(legacy_player_h player, float *volume)
 {
        legacy_player_t *handle = (legacy_player_t *)player;
-       mmplayer_volume_type_t vol;
        int ret = MM_ERROR_NONE;
        PLAYER_INSTANCE_CHECK(player);
-       PLAYER_NULL_ARG_CHECK(left);
-       PLAYER_NULL_ARG_CHECK(right);
+       PLAYER_NULL_ARG_CHECK(volume);
 
-       ret = mm_player_get_volume(handle->mm_handle, &vol);
+       ret = mm_player_get_volume(handle->mm_handle, volume);
        if (ret != MM_ERROR_NONE) {
                return __player_convert_error_code(ret, (char *)__FUNCTION__);
        }
 
-       *left = vol.level[MM_VOLUME_CHANNEL_LEFT];
-       *right = vol.level[MM_VOLUME_CHANNEL_RIGHT];
        return PLAYER_ERROR_NONE;
 }
 
@@ -1248,17 +1240,14 @@ int legacy_player_set_mute(legacy_player_h player, bool muted)
 int legacy_player_is_muted(legacy_player_h player, bool *muted)
 {
        legacy_player_t *handle = (legacy_player_t *)player;
-       int _mute;
        int ret = MM_ERROR_NONE;
        PLAYER_INSTANCE_CHECK(player);
        PLAYER_NULL_ARG_CHECK(muted);
 
-       ret = mm_player_get_mute(handle->mm_handle, &_mute);
+       ret = mm_player_get_mute(handle->mm_handle, muted);
        if (ret != MM_ERROR_NONE)
                return __player_convert_error_code(ret, (char *)__FUNCTION__);
 
-       *muted = (bool)_mute;
-
        return PLAYER_ERROR_NONE;
 }
 
index 3b0c4c2..f2b556b 100644 (file)
@@ -1646,16 +1646,15 @@ int player_disp_set_volume(muse_module_h module)
        int ret = PLAYER_ERROR_NONE;
        muse_player_api_e api = MUSE_PLAYER_API_SET_VOLUME;
        muse_player_handle_t *muse_player = NULL;
-       double left, right;
+       double volume = 0.0;
        bool ret_val = true;
 
        ret_val = _player_disp_get_param_value(muse_server_module_get_msg(module),
-                                                               MUSE_TYPE_DOUBLE, "left", (void *)&left,
-                                                               MUSE_TYPE_DOUBLE, "right", (void *)&right,
+                                                               MUSE_TYPE_DOUBLE, "volume", (void *)&volume,
                                                                INVALID_MUSE_TYPE_VALUE);
        if (ret_val) {
                muse_player = (muse_player_handle_t *)muse_server_ipc_get_handle(module);
-               ret = legacy_player_set_volume(muse_player->player_handle, (float)left, (float)right);
+               ret = legacy_player_set_volume(muse_player->player_handle, (float)volume);
        } else {
                ret = PLAYER_ERROR_INVALID_OPERATION;
        }
@@ -1669,13 +1668,13 @@ int player_disp_get_volume(muse_module_h module)
        int ret = PLAYER_ERROR_NONE;
        muse_player_api_e api = MUSE_PLAYER_API_GET_VOLUME;
        muse_player_handle_t *muse_player = NULL;
-       float left, right;
+       float volume = 0.0;
 
        muse_player = (muse_player_handle_t *)muse_server_ipc_get_handle(module);
 
-       ret = legacy_player_get_volume(muse_player->player_handle, &left, &right);
+       ret = legacy_player_get_volume(muse_player->player_handle, &volume);
 
-       PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_DOUBLE, "left", (double)left, MUSE_TYPE_DOUBLE, "right", (double)right);
+       PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_DOUBLE, "volume", (double)volume);
 
        return ret;
 }
index f52f0c0..f87b5cb 100644 (file)
@@ -1,6 +1,6 @@
 Name:       mmsvc-player
 Summary:    A Media Player module for muse server
-Version:    0.2.108
+Version:    0.2.109
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0