[0.3.113] change volume function interface 95/203995/3 accepted/tizen/unified/20190423.113323 submit/tizen/20190419.043449
authorEunhye Choi <eunhae1.choi@samsung.com>
Thu, 18 Apr 2019 09:46:54 +0000 (18:46 +0900)
committerEunhye Choi <eunhae1.choi@samsung.com>
Fri, 19 Apr 2019 04:13:34 +0000 (13:13 +0900)
- 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
src/player.c

index 3485bbd..e963281 100644 (file)
@@ -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
index c149be1..a87e57d 100644 (file)
@@ -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;