int player_get_video_roi_area(player_h player, double *x_scale, double *y_scale, double *w_scale, double *h_scale);
/**
+ * @brief Sets the audio pitch control status.
+ * @since_tizen 5.5
+ * @remarks This function is used for audio content only.
+ * @remarks Enabling pitch control could increase the CPU usage on some devices.
+ * @param[in] player The handle to the media player
+ * @param[in] enabled The new audio pitch control status (default: false)
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @pre The player state must be #PLAYER_STATE_IDLE.
+ * @see player_pitch_is_enabled()
+ * @see player_pitch_set_value()
+ * @see player_pitch_get_value()
+ */
+int player_pitch_set_enabled(player_h player, bool enabled);
+
+/**
+ * @brief Gets the audio pitch control status.
+ * @since_tizen 5.5
+ * @remarks This function is used for audio content only.
+ * @param[in] player The handle to the media player
+ * @param[out] enabled The audio pitch control status (default: false)
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @see player_pitch_set_enabled()
+ * @see player_pitch_set_value()
+ * @see player_pitch_get_value()
+ */
+int player_pitch_is_enabled(player_h player, bool *enabled);
+
+/**
+ * @brief Sets the audio pitch value.
+ * @since_tizen 5.5
+ * @remarks This function is used for audio content only.
+ * @param[in] player The handle to the media player
+ * @param[in] value The audio stream pitch value \n
+ * Valid range is 0.5~2. Default value is 1.
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @pre The pitch control must be enabled by calling player_pitch_set_enabled() function.
+ * @see player_pitch_set_enabled()
+ * @see player_pitch_is_enabled()
+ * @see player_pitch_get_value()
+ */
+int player_pitch_set_value(player_h player, float value);
+
+/**
+ * @brief Gets the audio pitch value.
+ * @since_tizen 5.5
+ * @remarks This function is used for audio content only.
+ * @param[in] player The handle to the media player
+ * @param[out] value The audio stream pitch value \n
+ * Valid range is 0.5~2. Default value is 1.
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #PLAYER_ERROR_NONE Successful
+ * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
+ * @see player_pitch_set_enabled()
+ * @see player_pitch_is_enabled()
+ * @see player_pitch_set_value()
+ */
+int player_pitch_get_value(player_h player, float *value);
+
+/**
* @}
*/
LOGD("LEAVE 0x%X", ret);
return ret;
-
}
int player_360_set_field_of_view(player_h player, int horizontal_degrees, int vertical_degrees)
g_free(ret_buf);
return ret;
}
+
+int player_pitch_set_enabled(player_h player, bool enabled)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ int ret = PLAYER_ERROR_NONE;
+ muse_player_api_e api = MUSE_PLAYER_API_PITCH_SET_ENABLED;
+ player_cli_s *pc = (player_cli_s *)player;
+ char *ret_buf = NULL;
+ int val = (int)enabled;
+
+ LOGD("ENTER");
+
+ PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_INT, "val", val);
+ g_free(ret_buf);
+ return ret;
+}
+
+int player_pitch_is_enabled(player_h player, bool *enabled)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(enabled);
+ int ret = PLAYER_ERROR_NONE;
+ muse_player_api_e api = MUSE_PLAYER_API_PITCH_IS_ENABLED;
+ player_cli_s *pc = (player_cli_s *)player;
+ char *ret_buf = NULL;
+ int val = -1;
+
+ LOGD("ENTER");
+
+ PLAYER_SEND_MSG(api, pc, ret_buf, ret);
+ if (ret == PLAYER_ERROR_NONE) {
+ player_msg_get(val, ret_buf);
+ *enabled = (bool)val;
+ }
+
+ g_free(ret_buf);
+ return ret;
+}
+
+int player_pitch_set_value(player_h player, float value)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_CHECK_CONDITION(value >= 0.5 && value <= 2.0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
+
+ int ret = PLAYER_ERROR_NONE;
+ muse_player_api_e api = MUSE_PLAYER_API_PITCH_SET_VALUE;
+ player_cli_s *pc = (player_cli_s *)player;
+ char *ret_buf = NULL;
+
+ LOGD("ENTER %1.3f", value);
+
+ PLAYER_SEND_MSG(api, pc, ret_buf, ret, MUSE_TYPE_DOUBLE, "pitch", (double)value);
+ g_free(ret_buf);
+
+ LOGD("LEAVE 0x%X", ret);
+ return ret;
+}
+
+int player_pitch_get_value(player_h player, float *value)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ PLAYER_NULL_ARG_CHECK(value);
+ int ret = PLAYER_ERROR_NONE;
+ muse_player_api_e api = MUSE_PLAYER_API_PITCH_GET_VALUE;
+ player_cli_s *pc = (player_cli_s *)player;
+ double pitch = 0.0;
+ char *ret_buf = NULL;
+
+ LOGD("ENTER");
+
+ PLAYER_SEND_MSG(api, pc, ret_buf, ret);
+
+ if (ret == PLAYER_ERROR_NONE) {
+ if (player_msg_get_type(pitch, ret_buf, DOUBLE)) {
+ *value = (float)pitch;
+ } else {
+ LOGE("failed to get pitch value");
+ ret = PLAYER_ERROR_INVALID_OPERATION;
+ }
+ }
+
+ g_free(ret_buf);
+
+ LOGD("LEAVE 0x%X", ret);
+ return ret;
+}
CURRENT_STATUS_VIDEO_CODEC_TYPE,
CURRENT_STATUS_REPLAYGAIN_ENABLE,
CURRENT_STATUS_AUDIO_OFFLOAD,
+ CURRENT_STATUS_PITCH_CONTROL,
+ CURRENT_STATUS_PITCH_VALUE,
};
#define MAX_HANDLE 20
strncpy(g_subtitle_uri, subtitle_filename, len);
g_print("subtitle uri is set to %s\n", g_subtitle_uri);
player_set_subtitle_path(g_player[0], g_subtitle_uri);
+ player_set_subtitle_updated_cb(g_player[0], subtitle_updated_cb, (void *)g_player[0]);
}
static void set_track(int type, int index)
g_print("failed to set audio offload\n");
}
+static void pitch_set_enabled(bool enabled)
+{
+ bool is_enabled = false;
+ player_pitch_is_enabled(g_player[0], &is_enabled);
+
+ g_print("pitch enabled %d -> %d \n", is_enabled, enabled);
+ if (player_pitch_set_enabled(g_player[0], enabled) != PLAYER_ERROR_NONE)
+ g_print("failed to pitch_set_enabled\n");
+}
+
+static void pitch_set_value(float level)
+{
+ float curr = 0.0;
+ player_pitch_get_value(g_player[0], &curr);
+
+ g_print("pitch level %1.3f -> %1.3f \n", curr, level);
+ if (player_pitch_set_value(g_player[0], level) != PLAYER_ERROR_NONE)
+ g_print("failed to set pitch value\n");
+}
+
#ifdef USE_EVENT_HANDLER
static void event_handler_cb(enum libinput_event_type ev_t, int x, int y, void *data, float e[3])
{
get_buffering_position();
} else if (strncmp(cmd, "ol", 2) == 0) {
g_menu_state = CURRENT_STATUS_AUDIO_OFFLOAD;
+ } else if (strncmp(cmd, "pc", 2) == 0) {
+ g_menu_state = CURRENT_STATUS_PITCH_CONTROL;
+ } else if (strncmp(cmd, "pv", 2) == 0) {
+ g_menu_state = CURRENT_STATUS_PITCH_VALUE;
} else {
g_print("unknown menu \n");
}
g_print("[Replaygain] rgs. Set Replaygain\t\t");
g_print("rgg. Get replaygain\n");
g_print("[Offload] ol. Set audio offload\n");
+ g_print("[pitch] pc. enable pitch control\t");
+ g_print("pv. Set pitch value\n");
g_print("[etc] sp. Set Progressive Download\t");
g_print("gp. Get Progressive Download status\t");
g_print("mp. memory playback\n");
g_print("*** input replaygain value.(0:disable, 1: enable) \n");
} else if (g_menu_state == CURRENT_STATUS_AUDIO_OFFLOAD) {
g_print("*** input audio offload value.(0:disable, 1: enable) \n");
+ } else if (g_menu_state == CURRENT_STATUS_PITCH_CONTROL) {
+ g_print("*** input pitch control value.(0:disable, 1: enable) \n");
+ } else if (g_menu_state == CURRENT_STATUS_PITCH_VALUE) {
+ g_print("*** input pitch value.(0.5 ~ 2) \n");
} else {
g_print("*** unknown status.\n");
quit_program();
reset_menu_state();
}
break;
+ case CURRENT_STATUS_PITCH_CONTROL:
+ {
+ value1 = atoi(cmd);
+ pitch_set_enabled(value1);
+ reset_menu_state();
+ }
+ break;
+ case CURRENT_STATUS_PITCH_VALUE:
+ {
+ fval = atof(cmd);
+ pitch_set_value(fval);
+ reset_menu_state();
+ }
+ break;
}
g_timeout_add(100, timeout_menu_display, 0);