[0.2.103] support audio pitch control 29/201229/3
authorEunhye Choi <eunhae1.choi@samsung.com>
Mon, 11 Mar 2019 11:19:24 +0000 (20:19 +0900)
committerEunhye Choi <eunhae1.choi@samsung.com>
Wed, 13 Mar 2019 10:24:50 +0000 (19:24 +0900)
Change-Id: I25357ac28129f99e076b6f695392c4854141abd2

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

index a7b669d..b4169f8 100644 (file)
@@ -2116,6 +2116,12 @@ int legacy_player_is_replaygain_enabled(player_h player, bool *enabled);
 int legacy_player_set_audio_offload_enabled(player_h player, bool enabled);
 int legacy_player_is_audio_offload_enabled(player_h player, bool *enabled);
 
+/* audio pitch */
+int legacy_player_set_pitch_enabled(player_h player, bool enabled);
+int legacy_player_is_pitch_enabled(player_h player, bool *enabled);
+int legacy_player_set_pitch_value(player_h player, float pitch);
+int legacy_player_get_pitch_value(player_h player, float *pitch);
+
 /**
  * @}
  */
index e2c5541..f081ecb 100644 (file)
@@ -2963,3 +2963,83 @@ int legacy_player_is_audio_offload_enabled(player_h player, bool *enabled)
        LOGD("get audio offload %d", *enabled);
        return PLAYER_ERROR_NONE;
 }
+
+int legacy_player_set_pitch_enabled(player_h player, bool enabled)
+{
+       player_s *handle = (player_s *)player;
+       int ret = MM_ERROR_NONE;
+       PLAYER_INSTANCE_CHECK(player);
+       PLAYER_STATE_CHECK(handle, PLAYER_STATE_IDLE);
+
+       LOGD("set pitch control %d", enabled);
+       ret = mm_player_set_attribute(handle->mm_handle, NULL, MM_PLAYER_PITCH_CONTROL, (int)enabled, (char *)NULL);
+
+       if (ret != MM_ERROR_NONE)
+               return __player_convert_error_code(ret, (char *)__FUNCTION__);
+
+       return PLAYER_ERROR_NONE;
+}
+
+int legacy_player_is_pitch_enabled(player_h player, bool *enabled)
+{
+       player_s *handle = (player_s *)player;
+       int ret = MM_ERROR_NONE;
+       int val = 0;
+       PLAYER_INSTANCE_CHECK(player);
+       PLAYER_NULL_ARG_CHECK(enabled);
+
+       if (!__player_state_validate(handle, PLAYER_STATE_IDLE)) {
+               LOGE("PLAYER_ERROR_INVALID_STATE : current state - %d", handle->state);
+               return PLAYER_ERROR_INVALID_STATE;
+       }
+
+       ret = mm_player_get_attribute(handle->mm_handle, NULL, MM_PLAYER_PITCH_CONTROL, &val, (char *)NULL);
+       if (ret != MM_ERROR_NONE)
+               return __player_convert_error_code(ret, (char *)__FUNCTION__);
+
+       *enabled = (bool)val;
+       LOGD("get pitch control %d", *enabled);
+       return PLAYER_ERROR_NONE;
+}
+
+int legacy_player_set_pitch_value(player_h player, float pitch)
+{
+       player_s *handle = (player_s *)player;
+       int ret = MM_ERROR_NONE;
+       PLAYER_INSTANCE_CHECK(player);
+
+       if (!__player_state_validate(handle, PLAYER_STATE_IDLE)) {
+               LOGE("PLAYER_ERROR_INVALID_STATE : current state - %d", handle->state);
+               return PLAYER_ERROR_INVALID_STATE;
+       }
+
+       LOGD("set pitch value %1.3f", pitch);
+       ret = mm_player_set_attribute(handle->mm_handle, NULL, MM_PLAYER_PITCH_VALUE, (double)pitch, (char *)NULL);
+       if (ret != MM_ERROR_NONE)
+               return __player_convert_error_code(ret, (char *)__FUNCTION__);
+
+       return PLAYER_ERROR_NONE;
+}
+
+int legacy_player_get_pitch_value(player_h player, float *pitch)
+{
+       player_s *handle = (player_s *)player;
+       int ret = MM_ERROR_NONE;
+       double value = 0.0;
+       PLAYER_INSTANCE_CHECK(player);
+       PLAYER_NULL_ARG_CHECK(pitch);
+
+       if (!__player_state_validate(handle, PLAYER_STATE_IDLE)) {
+               LOGE("PLAYER_ERROR_INVALID_STATE : current state - %d", handle->state);
+               return PLAYER_ERROR_INVALID_STATE;
+       }
+
+       ret = mm_player_get_attribute(handle->mm_handle, NULL, MM_PLAYER_PITCH_VALUE, &value, (char *)NULL);
+       if (ret != MM_ERROR_NONE)
+               return __player_convert_error_code(ret, (char *)__FUNCTION__);
+
+       *pitch = (float)value;
+       LOGD("get pitch value %1.3f", *pitch);
+
+       return PLAYER_ERROR_NONE;
+}
index 533c553..73bd1c6 100644 (file)
@@ -100,3 +100,7 @@ set_replaygain_enabled
 is_replaygain_enabled
 set_audio_offload_enabled
 is_audio_offload_enabled
+set_pitch_enabled
+is_pitch_enabled
+set_pitch_value
+get_pitch_value
index 22d5ee5..a2a8f63 100644 (file)
@@ -3561,3 +3561,67 @@ int player_disp_is_audio_offload_enabled(muse_module_h module)
 
        return ret;
 }
+
+int player_disp_set_pitch_enabled(muse_module_h module)
+{
+       int ret = PLAYER_ERROR_NONE;
+       muse_player_api_e api = MUSE_PLAYER_API_SET_PITCH_ENABLED;
+       muse_player_handle_s *muse_player = NULL;
+       int val = 0;
+       muse_player = (muse_player_handle_s *)muse_server_ipc_get_handle(module);
+       player_msg_get(val, muse_server_module_get_msg(module));
+
+       ret = legacy_player_set_pitch_enabled(muse_player->player_handle, (bool)val);
+
+       PLAYER_RETURN_MSG(api, ret, module);
+
+       return ret;
+}
+
+int player_disp_is_pitch_enabled(muse_module_h module)
+{
+       int ret = PLAYER_ERROR_NONE;
+       muse_player_api_e api = MUSE_PLAYER_API_IS_PITCH_ENABLED;
+       muse_player_handle_s *muse_player = NULL;
+       bool val = false;
+
+       muse_player = (muse_player_handle_s *)muse_server_ipc_get_handle(module);
+
+       ret = legacy_player_is_pitch_enabled(muse_player->player_handle, &val);
+
+       PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "val", (int)val);
+
+       return ret;
+}
+
+int player_disp_set_pitch_value(muse_module_h module)
+{
+       int ret = PLAYER_ERROR_NONE;
+       muse_player_api_e api = MUSE_PLAYER_API_SET_PITCH_VALUE;
+       muse_player_handle_s *muse_player = NULL;
+       double pitch = 0.0;
+       muse_player = (muse_player_handle_s *)muse_server_ipc_get_handle(module);
+       player_msg_get_type(pitch, muse_server_module_get_msg(module), DOUBLE);
+
+       ret = legacy_player_set_pitch_value(muse_player->player_handle, (float)pitch);
+
+       PLAYER_RETURN_MSG(api, ret, module);
+
+       return ret;
+}
+
+int player_disp_get_pitch_value(muse_module_h module)
+{
+       int ret = PLAYER_ERROR_NONE;
+       muse_player_api_e api = MUSE_PLAYER_API_GET_PITCH_VALUE;
+       muse_player_handle_s *muse_player = NULL;
+       float pitch = 0.0;
+
+       muse_player = (muse_player_handle_s *)muse_server_ipc_get_handle(module);
+
+       ret = legacy_player_get_pitch_value(muse_player->player_handle, &pitch);
+
+       PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_DOUBLE, "pitch", (double)pitch);
+
+       return ret;
+}
index 881e564..f1ac0ab 100644 (file)
@@ -1,6 +1,6 @@
 Name:       mmsvc-player
 Summary:    A Media Player module for muse server
-Version:    0.2.102
+Version:    0.2.103
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0