return NULL;
}
-static int __lplayer_audio_offload_is_enabled(legacy_player_h player, int *enabled)
+static bool __lplayer_is_offload_precondition_valid(legacy_player_h player)
{
int ret = MM_ERROR_NONE;
+ int enabled = 0;
legacy_player_t *handle = (legacy_player_t *)player;
- ret = mm_player_get_attribute(handle->mm_handle, NULL, MM_PLAYER_AUDIO_OFFLOAD, enabled, (char *)NULL);
+ ret = mm_player_get_attribute(handle->mm_handle, NULL, MM_PLAYER_AUDIO_OFFLOAD, &enabled, (char *)NULL);
if (ret != MM_ERROR_NONE) {
- LOGE("failed to get offload status");
- return _lplayer_convert_error_code(ret, (char *)__FUNCTION__);
+ LOGE("failed to get offload status 0x%X", ret);
+ return false;
}
- LOGD("offload enabled : %d", *enabled);
- return PLAYER_ERROR_NONE;
+ LOGD("offload status %d", enabled);
+ return (enabled) ? (false) : (true);
}
/*
{
legacy_player_t *handle = (legacy_player_t *)player;
int ret = MM_ERROR_NONE;
- int enabled = 0;
PLAYER_INSTANCE_CHECK(player);
- if ((__lplayer_audio_offload_is_enabled(player, &enabled) != PLAYER_ERROR_NONE)
- || (enabled))
+ if (!__lplayer_is_offload_precondition_valid(player))
return PLAYER_ERROR_INVALID_OPERATION;
ret = mm_player_set_attribute(handle->mm_handle, NULL, "sound_latency_mode", latency_mode, (char *)NULL);
{
legacy_player_t *handle = (legacy_player_t *)player;
int ret = MM_ERROR_NONE;
- int enabled = 0;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(latency_mode);
- if ((__lplayer_audio_offload_is_enabled(player, &enabled) != PLAYER_ERROR_NONE)
- || (enabled))
+ if (!__lplayer_is_offload_precondition_valid(player))
return PLAYER_ERROR_INVALID_OPERATION;
ret = mm_player_get_attribute(handle->mm_handle, NULL, "sound_latency_mode", latency_mode, (char *)NULL);
{
legacy_player_t *handle = (legacy_player_t *)player;
int ret = MM_ERROR_NONE;
- int enabled = 0;
LOGI("<ENTER: rate %0.1f>", rate);
PLAYER_INSTANCE_CHECK(player);
PLAYER_CHECK_CONDITION(rate >= -5.0 && rate <= 5.0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
- if ((__lplayer_audio_offload_is_enabled(player, &enabled) != PLAYER_ERROR_NONE)
- || (enabled))
+ if (!__lplayer_is_offload_precondition_valid(player))
return PLAYER_ERROR_INVALID_OPERATION;
if (!_lplayer_state_validate(handle, PLAYER_STATE_READY)) {
{
legacy_player_t *handle = (legacy_player_t *)player;
int ret = MM_ERROR_NONE;
- int enabled = 0;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(count);
- if ((__lplayer_audio_offload_is_enabled(player, &enabled) != PLAYER_ERROR_NONE)
- || (enabled))
+ if (!__lplayer_is_offload_precondition_valid(player))
return PLAYER_ERROR_INVALID_OPERATION;
ret = mm_player_audio_effect_custom_get_eq_bands_number(handle->mm_handle, count);
{
legacy_player_t *handle = (legacy_player_t *)player;
int ret = MM_ERROR_NONE;
- int enabled = 0;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(band_levels);
- if ((__lplayer_audio_offload_is_enabled(player, &enabled) != PLAYER_ERROR_NONE)
- || (enabled))
+ if (!__lplayer_is_offload_precondition_valid(player))
return PLAYER_ERROR_INVALID_OPERATION;
ret = mm_player_audio_effect_custom_set_level_eq_from_list(handle->mm_handle, band_levels, length);
{
legacy_player_t *handle = (legacy_player_t *)player;
int ret = MM_ERROR_NONE;
- int enabled = 0;
PLAYER_INSTANCE_CHECK(player);
- if ((__lplayer_audio_offload_is_enabled(player, &enabled) != PLAYER_ERROR_NONE)
- || (enabled))
+ if (!__lplayer_is_offload_precondition_valid(player))
return PLAYER_ERROR_INVALID_OPERATION;
ret = mm_player_audio_effect_custom_set_level(handle->mm_handle, MM_AUDIO_EFFECT_CUSTOM_EQ, index, level);
{
legacy_player_t *handle = (legacy_player_t *)player;
int ret = MM_ERROR_NONE;
- int enabled = 0;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(level);
- if ((__lplayer_audio_offload_is_enabled(player, &enabled) != PLAYER_ERROR_NONE)
- || (enabled))
+ if (!__lplayer_is_offload_precondition_valid(player))
return PLAYER_ERROR_INVALID_OPERATION;
ret = mm_player_audio_effect_custom_get_level(handle->mm_handle, MM_AUDIO_EFFECT_CUSTOM_EQ, index, level);
{
legacy_player_t *handle = (legacy_player_t *)player;
int ret = MM_ERROR_NONE;
- int enabled = 0;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(min && max);
- if ((__lplayer_audio_offload_is_enabled(player, &enabled) != PLAYER_ERROR_NONE)
- || (enabled))
+ if (!__lplayer_is_offload_precondition_valid(player))
return PLAYER_ERROR_INVALID_OPERATION;
ret = mm_player_audio_effect_custom_get_level_range(handle->mm_handle, MM_AUDIO_EFFECT_CUSTOM_EQ, min, max);
{
legacy_player_t *handle = (legacy_player_t *)player;
int ret = MM_ERROR_NONE;
- int enabled = 0;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(frequency);
- if ((__lplayer_audio_offload_is_enabled(player, &enabled) != PLAYER_ERROR_NONE)
- || (enabled))
+ if (!__lplayer_is_offload_precondition_valid(player))
return PLAYER_ERROR_INVALID_OPERATION;
ret = mm_player_audio_effect_custom_get_eq_bands_freq(handle->mm_handle, index, frequency);
{
legacy_player_t *handle = (legacy_player_t *)player;
int ret = MM_ERROR_NONE;
- int enabled = 0;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(range);
- if ((__lplayer_audio_offload_is_enabled(player, &enabled) != PLAYER_ERROR_NONE)
- || (enabled))
+ if (!__lplayer_is_offload_precondition_valid(player))
return PLAYER_ERROR_INVALID_OPERATION;
ret = mm_player_audio_effect_custom_get_eq_bands_width(handle->mm_handle, index, range);
{
legacy_player_t *handle = (legacy_player_t *)player;
int ret = MM_ERROR_NONE;
- int enabled = 0;
PLAYER_INSTANCE_CHECK(player);
- if ((__lplayer_audio_offload_is_enabled(player, &enabled) != PLAYER_ERROR_NONE)
- || (enabled))
+ if (!__lplayer_is_offload_precondition_valid(player))
return PLAYER_ERROR_INVALID_OPERATION;
ret = mm_player_audio_effect_custom_clear_eq_all(handle->mm_handle);
{
legacy_player_t *handle = (legacy_player_t *)player;
int ret = MM_ERROR_NONE;
- int enabled = 0;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(available);
- if ((__lplayer_audio_offload_is_enabled(player, &enabled) != PLAYER_ERROR_NONE)
- || (enabled))
+ if (!__lplayer_is_offload_precondition_valid(player))
return PLAYER_ERROR_INVALID_OPERATION;
if (!_lplayer_state_validate(handle, PLAYER_STATE_IDLE)) {
legacy_player_t *handle = (legacy_player_t *)player;
int ret = MM_ERROR_NONE;
const char *audio_pcm_format = __lplayer_convert_audio_pcm_mime_to_str(mimetype);
- int enabled = 0;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(callback);
- if ((__lplayer_audio_offload_is_enabled(player, &enabled) != PLAYER_ERROR_NONE)
- || (enabled))
+ if (!__lplayer_is_offload_precondition_valid(player))
return PLAYER_ERROR_INVALID_OPERATION;
PLAYER_STATE_CHECK(handle, PLAYER_STATE_IDLE);
legacy_player_t *handle = (legacy_player_t *)player;
int ret = MM_ERROR_NONE;
mmplayer_track_type_e track_type = 0;
- int enabled = 0;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(count);
- if ((__lplayer_audio_offload_is_enabled(player, &enabled) != PLAYER_ERROR_NONE)
- || (enabled))
+ if (!__lplayer_is_offload_precondition_valid(player))
return PLAYER_ERROR_INVALID_OPERATION;
if (!_lplayer_state_validate(handle, PLAYER_STATE_READY)) {
legacy_player_t *handle = (legacy_player_t *)player;
int ret = MM_ERROR_NONE;
mmplayer_track_type_e track_type = 0;
- int enabled = 0;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(index);
- if ((__lplayer_audio_offload_is_enabled(player, &enabled) != PLAYER_ERROR_NONE)
- || (enabled))
+ if (!__lplayer_is_offload_precondition_valid(player))
return PLAYER_ERROR_INVALID_OPERATION;
if (!_lplayer_state_validate(handle, PLAYER_STATE_READY)) {
legacy_player_t *handle = (legacy_player_t *)player;
int ret = MM_ERROR_NONE;
mmplayer_track_type_e track_type = 0;
- int enabled = 0;
LPLAYER_FENTER();
PLAYER_INSTANCE_CHECK(player);
PLAYER_CHECK_CONDITION(index >= 0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
- if ((__lplayer_audio_offload_is_enabled(player, &enabled) != PLAYER_ERROR_NONE)
- || (enabled))
+ if (!__lplayer_is_offload_precondition_valid(player))
return PLAYER_ERROR_INVALID_OPERATION;
if (!_lplayer_state_validate(handle, PLAYER_STATE_READY)) {
legacy_player_t *handle = (legacy_player_t *)player;
int ret = MM_ERROR_NONE;
mmplayer_track_type_e track_type = 0;
- int enabled = 0;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(code && len);
- if ((__lplayer_audio_offload_is_enabled(player, &enabled) != PLAYER_ERROR_NONE)
- || (enabled))
+ if (!__lplayer_is_offload_precondition_valid(player))
return PLAYER_ERROR_INVALID_OPERATION;
if (!_lplayer_state_validate(handle, PLAYER_STATE_READY)) {
MMDisplaySurfaceType surface_type = __lplayer_convert_display_type(type);
PLAYER_INSTANCE_CHECK(player);
+ PLAYER_RANGE_ARG_CHECK(type, PLAYER_DISPLAY_TYPE_OVERLAY, PLAYER_DISPLAY_TYPE_NONE);
+
if (!_lplayer_state_validate(handle, PLAYER_STATE_IDLE)) {
LOGE("PLAYER_ERROR_INVALID_STATE : current state - %d", handle->state);
return PLAYER_ERROR_INVALID_STATE;
if (strncmp(stream_type, "media", strlen("media"))) {
int enabled = 0;
- if (__lplayer_audio_offload_is_enabled(player, &enabled) != PLAYER_ERROR_NONE)
- return PLAYER_ERROR_INVALID_OPERATION;
+ ret = mm_player_get_attribute(handle->mm_handle, NULL, MM_PLAYER_AUDIO_OFFLOAD, &enabled, (char *)NULL);
+ if (ret != MM_ERROR_NONE)
+ return _lplayer_convert_error_code(ret, (char *)__FUNCTION__);
if (enabled) {
LOGW("audio offload will be disabled to support sound stream type: %s", stream_type);
{
legacy_player_t *handle = (legacy_player_t *)player;
int ret = MM_ERROR_NONE;
- int offload_enabled = 0;
PLAYER_INSTANCE_CHECK(player);
- if ((__lplayer_audio_offload_is_enabled(player, &offload_enabled) != PLAYER_ERROR_NONE)
- || (offload_enabled))
+ if (!__lplayer_is_offload_precondition_valid(player))
return PLAYER_ERROR_INVALID_OPERATION;
if (!_lplayer_state_validate(handle, PLAYER_STATE_IDLE)) {
legacy_player_t *handle = (legacy_player_t *)player;
int ret = MM_ERROR_NONE;
bool replaygain_enabled = false;
- int offload_enabled = 0;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(enabled);
- if ((__lplayer_audio_offload_is_enabled(player, &offload_enabled) != PLAYER_ERROR_NONE)
- || (offload_enabled))
+ if (!__lplayer_is_offload_precondition_valid(player))
return PLAYER_ERROR_INVALID_OPERATION;
if (!_lplayer_state_validate(handle, PLAYER_STATE_IDLE)) {
{
legacy_player_t *handle = (legacy_player_t *)player;
int ret = MM_ERROR_NONE;
- int offload_enabled = 0;
PLAYER_INSTANCE_CHECK(player);
- if ((__lplayer_audio_offload_is_enabled(player, &offload_enabled) != PLAYER_ERROR_NONE)
- || (offload_enabled))
+ if (!__lplayer_is_offload_precondition_valid(player))
return PLAYER_ERROR_INVALID_OPERATION;
PLAYER_STATE_CHECK(handle, PLAYER_STATE_IDLE);
legacy_player_t *handle = (legacy_player_t *)player;
int ret = MM_ERROR_NONE;
int val = 0;
- int offload_enabled = 0;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(enabled);
- if ((__lplayer_audio_offload_is_enabled(player, &offload_enabled) != PLAYER_ERROR_NONE)
- || (offload_enabled))
+ if (!__lplayer_is_offload_precondition_valid(player))
return PLAYER_ERROR_INVALID_OPERATION;
if (!_lplayer_state_validate(handle, PLAYER_STATE_IDLE)) {
legacy_player_t *handle = (legacy_player_t *)player;
int ret = MM_ERROR_NONE;
int pitch_enabled = 0;
- int offload_enabled = 0;
PLAYER_INSTANCE_CHECK(player);
- if ((__lplayer_audio_offload_is_enabled(player, &offload_enabled) != PLAYER_ERROR_NONE)
- || (offload_enabled))
+ if (!__lplayer_is_offload_precondition_valid(player))
return PLAYER_ERROR_INVALID_OPERATION;
if (!_lplayer_state_validate(handle, PLAYER_STATE_IDLE)) {
legacy_player_t *handle = (legacy_player_t *)player;
int ret = MM_ERROR_NONE;
double value = 0.0;
- int enabled = 0;
PLAYER_INSTANCE_CHECK(player);
PLAYER_NULL_ARG_CHECK(pitch);
- if ((__lplayer_audio_offload_is_enabled(player, &enabled) != PLAYER_ERROR_NONE)
- || (enabled))
+ if (!__lplayer_is_offload_precondition_valid(player))
return PLAYER_ERROR_INVALID_OPERATION;
if (!_lplayer_state_validate(handle, PLAYER_STATE_IDLE)) {