From 95b695f1cf92e169012c7d8c9f7866e08b69e979 Mon Sep 17 00:00:00 2001 From: Eunhye Choi Date: Thu, 18 Apr 2019 18:46:54 +0900 Subject: [PATCH] [0.3.113] change volume function interface - api return invalid parameter error if the right and left value is different. it was checked in mused(libmm-player) before. - change set/get volume function interface by using united volume parameter instead of left and right volume which is not used anymore. Change-Id: Ic3678de5ce8f0a6b8263baf49a20d4de27ee365f --- packaging/capi-media-player.spec | 2 +- src/player.c | 23 ++++++++++++----------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/packaging/capi-media-player.spec b/packaging/capi-media-player.spec index 3485bbd..e963281 100644 --- a/packaging/capi-media-player.spec +++ b/packaging/capi-media-player.spec @@ -1,6 +1,6 @@ Name: capi-media-player Summary: A Media Player API -Version: 0.3.112 +Version: 0.3.113 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/player.c b/src/player.c index c149be1..a87e57d 100644 --- a/src/player.c +++ b/src/player.c @@ -2341,30 +2341,32 @@ int player_set_volume(player_h player, float left, float right) 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"); + + /* not support to set different value into each channel */ + PLAYER_CHECK_CONDITION(left == right, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER"); + int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_SET_VOLUME; player_cli_s *pc = (player_cli_s *)player; char *ret_buf = NULL; - LOGD("ENTER"); + LOGD("ENTER %f", left); PLAYER_SEND_MSG(api, pc, ret_buf, ret, - MUSE_TYPE_DOUBLE, "right", (double)right, - MUSE_TYPE_DOUBLE, "left", (double)left); + MUSE_TYPE_DOUBLE, "volume", (double)left); g_free(ret_buf); return ret; } -int player_get_volume(player_h player, float *pleft, float *pright) +int player_get_volume(player_h player, float *left, float *right) { PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(pleft && pright); + PLAYER_NULL_ARG_CHECK(left && right); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_GET_VOLUME; player_cli_s *pc = (player_cli_s *)player; - double left = -1; - double right = -1; + double volume = 0.0; char *ret_buf = NULL; LOGD("ENTER"); @@ -2374,12 +2376,11 @@ int player_get_volume(player_h player, float *pleft, float *pright) if (ret == PLAYER_ERROR_NONE) { bool ret_val = true; ret_val = _player_get_param_value(ret_buf, - 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) { - *pleft = (float)left; - *pright = (float)right; + *left = (float)volume; + *right = (float)volume; } else { LOGE("failed to get value from msg"); ret = PLAYER_ERROR_INVALID_OPERATION; -- 2.7.4