* limitations under the License.
*
*/
+#include <dlog.h>
#include <mm_error.h>
#include "mm_player_utils.h"
int
-mm_player_get_foreach_present_supported_effect_type(MMHandleType hplayer, MMAudioEffectType effect_type, mmplayer_supported_audio_effect_cb foreach_cb, void *user_data)
+mm_player_get_foreach_present_supported_effect_type(MMHandleType hplayer, mm_audio_effect_type_e effect_type, mmplayer_supported_audio_effect_cb foreach_cb, void *user_data)
{
- mm_player_t *player = NULL;
+ mmplayer_t *player = NULL;
int result = MM_ERROR_NONE;
mm_sound_device_flags_e flags = MM_SOUND_DEVICE_IO_DIRECTION_OUT_FLAG | MM_SOUND_DEVICE_STATE_ACTIVATED_FLAG;
- MMSoundDeviceList_t device_list;
+ MMSoundDeviceList_t device_list = NULL;
MMSoundDevice_t device_h = NULL;
mm_sound_device_type_e device_type;
int i = 0;
MMPLAYER_FENTER();
- return_val_if_fail ( hplayer, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MMPLAYER_RETURN_VAL_IF_FAIL(hplayer, MM_ERROR_PLAYER_NOT_INITIALIZED);
player = MM_PLAYER_CAST(hplayer);
/* get status if speaker is activated */
/* (1) get current device list */
- result = mm_sound_get_current_device_list(flags, &device_list);
-
- if ( result ) {
- debug_error("mm_sound_get_current_device_list() failed [%x]!!", result);
+ result = mm_sound_get_device_list(flags, &device_list);
+ if (result != MM_ERROR_NONE) {
+ LOGE("mm_sound_get_device_list() failed [0x%x]!!", result);
MMPLAYER_FLEAVE();
return result;
}
/* (2) get device handle of device list */
- result = mm_sound_get_next_device (device_list, &device_h);
-
- if ( result ) {
- debug_error("mm_sound_get_next_device() failed [%x]!!", result);
- MMPLAYER_FLEAVE();
- return result;
+ result = mm_sound_get_next_device(device_list, &device_h);
+ if (result != MM_ERROR_NONE) {
+ LOGE("mm_sound_get_next_device() failed [0x%x]!!", result);
+ goto EXIT;
}
/* (3) get device type */
result = mm_sound_get_device_type(device_h, &device_type);
-
- if ( result ) {
- debug_error("mm_sound_get_device_type() failed [%x]!!", result);
- MMPLAYER_FLEAVE();
- return result;
+ if (result != MM_ERROR_NONE) {
+ LOGE("mm_sound_get_device_type() failed [0x%x]!!", result);
+ goto EXIT;
}
- /* preset */
- if (effect_type == MM_AUDIO_EFFECT_TYPE_PRESET)
- {
- for ( i = 0; i < MM_AUDIO_EFFECT_PRESET_NUM; i++ )
- {
- if (player->ini.audio_effect_preset_list[i] )
- {
+ if (effect_type == MM_AUDIO_EFFECT_TYPE_PRESET) {
+ /* preset */
+ for (i = 0; i < MM_AUDIO_EFFECT_PRESET_NUM; i++) {
+ if (player->ini.audio_effect_preset_list[i]) {
if (device_type == MM_SOUND_DEVICE_TYPE_BUILTIN_SPEAKER &&
player->ini.audio_effect_preset_earphone_only_list[i])
- {
continue;
- }
- if (!foreach_cb(effect_type,i, user_data))
- {
- goto CALLBACK_ERROR;
+
+ if (!foreach_cb(effect_type, i, user_data)) {
+ LOGE("foreach callback returned error");
+ result = MM_ERROR_PLAYER_INTERNAL;
+ goto EXIT;
}
}
}
- }
- /* custom */
- else if (effect_type == MM_AUDIO_EFFECT_TYPE_CUSTOM)
- {
- for ( i = 0; i < MM_AUDIO_EFFECT_CUSTOM_NUM; i++ )
- {
- if (player->ini.audio_effect_custom_list[i] )
- {
+ } else if (effect_type == MM_AUDIO_EFFECT_TYPE_CUSTOM) {
+ /* custom */
+ for (i = 0; i < MM_AUDIO_EFFECT_CUSTOM_NUM; i++) {
+ if (player->ini.audio_effect_custom_list[i]) {
if (device_type == MM_SOUND_DEVICE_TYPE_BUILTIN_SPEAKER &&
- player->ini.audio_effect_custom_earphone_only_list[i])
- {
+ player->ini.audio_effect_custom_earphone_only_list[i]) {
continue;
}
- if (!foreach_cb(effect_type,i, user_data))
- {
- goto CALLBACK_ERROR;
+ if (!foreach_cb(effect_type, i, user_data)) {
+ LOGE("foreach callback returned error");
+ result = MM_ERROR_PLAYER_INTERNAL;
+ goto EXIT;
}
}
}
- }
- else
- {
- debug_error("invalid effect type(%d)", effect_type);
+ } else {
+ LOGE("invalid effect type(%d)", effect_type);
result = MM_ERROR_INVALID_ARGUMENT;
}
- MMPLAYER_FLEAVE();
+EXIT:
+ if (device_list)
+ mm_sound_free_device_list(device_list);
- return result;
-
-CALLBACK_ERROR:
- debug_error("foreach callback returned error");
MMPLAYER_FLEAVE();
- return MM_ERROR_PLAYER_INTERNAL;
+ return result;
}
-int
-__mmplayer_set_harmony_effect(mm_player_t *player, GstElement *audio_effect_element)
+static int
+__mmplayer_set_harmony_effect(mmplayer_t *player, GstElement *audio_effect_element)
{
gint *ext_effect_level_list = NULL;
int count = 1; /* start from 1, because of excepting eq index */
MMPLAYER_FENTER();
- return_val_if_fail ( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
- return_val_if_fail ( audio_effect_element, MM_ERROR_INVALID_ARGUMENT );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+ MMPLAYER_RETURN_VAL_IF_FAIL(audio_effect_element, MM_ERROR_INVALID_ARGUMENT);
/* Custom EQ */
- if( player->ini.audio_effect_custom_eq_band_num )
- {
- debug_log("pass custom EQ level list to audio effect plugin");
+ if (player->ini.audio_effect_custom_eq_band_num) {
+ LOGD("pass custom EQ level list to audio effect plugin");
/* set custom-equalizer level list */
g_object_set(audio_effect_element, "custom-eq", player->audio_effect_info.custom_eq_level, NULL);
- }
- else
- {
- debug_warning("no custom EQ");
+ } else {
+ LOGW("no custom EQ");
}
/* Custom Extension effects */
- if( player->ini.audio_effect_custom_ext_num )
- {
- debug_log("pass custom extension level list to audio effect plugin");
+ if (player->ini.audio_effect_custom_ext_num) {
+ LOGD("pass custom extension level list to audio effect plugin");
ext_effect_level_list = player->audio_effect_info.custom_ext_level_for_plugin;
if (!ext_effect_level_list) {
- ext_effect_level_list = (gint*) malloc (sizeof(gint)*player->ini.audio_effect_custom_ext_num);
- if (!ext_effect_level_list)
- {
- debug_error("memory allocation for extension effect list failed");
+ ext_effect_level_list = (gint *)malloc(sizeof(gint) * player->ini.audio_effect_custom_ext_num);
+ if (!ext_effect_level_list) {
+ LOGE("memory allocation for extension effect list failed");
return MM_ERROR_OUT_OF_MEMORY;
- }
- else
- {
- memset (ext_effect_level_list, 0, player->ini.audio_effect_custom_ext_num);
+ } else {
+ memset(ext_effect_level_list, 0, player->ini.audio_effect_custom_ext_num);
/* associate it to player handle */
player->audio_effect_info.custom_ext_level_for_plugin = ext_effect_level_list;
}
}
- while ( count < MM_AUDIO_EFFECT_CUSTOM_NUM )
- {
- if ( player->ini.audio_effect_custom_list[count] )
- {
- ext_effect_level_list[ext_level_index] = player->audio_effect_info.custom_ext_level[count-1];
+ while (count < MM_AUDIO_EFFECT_CUSTOM_NUM) {
+ if (player->ini.audio_effect_custom_list[count]) {
+ ext_effect_level_list[ext_level_index] = player->audio_effect_info.custom_ext_level[count - 1];
ext_level_index++;
if (ext_level_index == player->ini.audio_effect_custom_ext_num)
- {
break;
- }
}
count++;
}
/* set custom-extension effects level list */
g_object_set(audio_effect_element, "custom-ext", ext_effect_level_list, NULL);
- }
- else
- {
- debug_warning("no custom extension effect");
+ } else {
+ LOGW("no custom extension effect");
}
/* order action to audio effect plugin */
g_object_set(audio_effect_element, "filter-action", MM_AUDIO_EFFECT_TYPE_CUSTOM, NULL);
- debug_log("filter-action = %d", MM_AUDIO_EFFECT_TYPE_CUSTOM);
+ LOGD("filter-action = %d", MM_AUDIO_EFFECT_TYPE_CUSTOM);
MMPLAYER_FLEAVE();
}
-gboolean
-__mmplayer_is_earphone_only_effect_type(mm_player_t *player, MMAudioEffectType effect_type, int effect)
+static gboolean
+__mmplayer_is_earphone_only_effect_type(mmplayer_t *player, mm_audio_effect_type_e effect_type, int effect)
{
gboolean result = FALSE;
int i = 0;
MMPLAYER_FENTER();
- return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
- /* preset */
- if (effect_type == MM_AUDIO_EFFECT_TYPE_PRESET)
- {
- if (player->ini.audio_effect_preset_earphone_only_list[effect])
- {
- debug_msg("this preset effect(%d) is only available with earphone", effect);
+ if (effect_type == MM_AUDIO_EFFECT_TYPE_PRESET) {
+ /* preset */
+ if (player->ini.audio_effect_preset_earphone_only_list[effect]) {
+ LOGI("this preset effect(%d) is only available with earphone", effect);
result = TRUE;
}
- }
- /* custom */
- else if (effect_type == MM_AUDIO_EFFECT_TYPE_CUSTOM)
- {
- for (i = 1; i < MM_AUDIO_EFFECT_CUSTOM_NUM; i++) /* it starts from 1(except testing for EQ) */
- {
- if (player->ini.audio_effect_custom_earphone_only_list[i])
- {
+ } else if (effect_type == MM_AUDIO_EFFECT_TYPE_CUSTOM) {
+ /* custom */
+ for (i = 1; i < MM_AUDIO_EFFECT_CUSTOM_NUM; i++) {
+ /* it starts from 1(except testing for EQ) */
+ if (player->ini.audio_effect_custom_earphone_only_list[i]) {
/* check if the earphone only custom effect was set */
- if (player->audio_effect_info.custom_ext_level[i-1])
- {
- debug_msg("this custom effect(%d) is only available with earphone", i);
+ if (player->audio_effect_info.custom_ext_level[i - 1]) {
+ LOGI("this custom effect(%d) is only available with earphone", i);
result = TRUE;
}
}
}
- }
- else
- {
- debug_error("invalid effect type(%d)", effect_type);
+ } else {
+ LOGE("invalid effect type(%d)", effect_type);
}
MMPLAYER_FLEAVE();
return result;
}
-int
-__mmplayer_audio_set_output_type (mm_player_t *player, MMAudioEffectType effect_type, int effect)
+static int
+__mmplayer_audio_set_output_type(mmplayer_t *player, mm_audio_effect_type_e effect_type, int effect)
{
GstElement *audio_effect_element = NULL;
mm_sound_device_flags_e flags = MM_SOUND_DEVICE_ALL_FLAG;
- MMSoundDeviceList_t device_list;
+ MMSoundDeviceList_t device_list = NULL;
MMSoundDevice_t device_h = NULL;
mm_sound_device_type_e device_type;
int output_type = 0;
MMPLAYER_FENTER();
- return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
audio_effect_element = player->pipeline->audiobin[MMPLAYER_A_FILTER].gst;
/* (1) get current device list */
- result = mm_sound_get_current_device_list(flags, &device_list);
-
- if ( result ) {
- debug_error("mm_sound_get_current_device_list() failed [%x]!!", result);
+ result = mm_sound_get_device_list(flags, &device_list);
+ if (result != MM_ERROR_NONE) {
+ LOGE("mm_sound_get_device_list() failed [0x%x]!!", result);
MMPLAYER_FLEAVE();
return result;
}
/* (2) get device handle of device list */
- result = mm_sound_get_next_device (device_list, &device_h);
-
- if ( result ) {
- debug_error("mm_sound_get_next_device() failed [%x]!!", result);
- MMPLAYER_FLEAVE();
- return result;
+ result = mm_sound_get_next_device(device_list, &device_h);
+ if (result != MM_ERROR_NONE) {
+ LOGE("mm_sound_get_next_device() failed [0x%x]!!", result);
+ goto EXIT;
}
/* (3) get device type */
result = mm_sound_get_device_type(device_h, &device_type);
-
- if ( result ) {
- debug_error("mm_sound_get_device_type() failed [%x]!!", result);
- MMPLAYER_FLEAVE();
- return result;
+ if (result != MM_ERROR_NONE) {
+ LOGE("mm_sound_get_device_type() failed [0x%x]!!", result);
+ goto EXIT;
}
/* SPEAKER case */
- if (device_type == MM_SOUND_DEVICE_TYPE_BUILTIN_SPEAKER)
- {
- if ( MM_AUDIO_EFFECT_TYPE_SQUARE != effect_type ) {
- if (__mmplayer_is_earphone_only_effect_type(player, effect_type, effect))
- {
- debug_error("earphone is not equipped, this filter will not be applied");
- MMPLAYER_FLEAVE();
- return MM_ERROR_PLAYER_SOUND_EFFECT_INVALID_STATUS;
+ if (device_type == MM_SOUND_DEVICE_TYPE_BUILTIN_SPEAKER) {
+ if (MM_AUDIO_EFFECT_TYPE_SQUARE != effect_type) {
+ if (__mmplayer_is_earphone_only_effect_type(player, effect_type, effect)) {
+ LOGE("earphone is not equipped, this filter will not be applied");
+ result = MM_ERROR_PLAYER_SOUND_EFFECT_INVALID_STATUS;
+ goto EXIT;
}
}
-
output_type = MM_AUDIO_EFFECT_OUTPUT_SPK;
- }
- else if (device_type == MM_SOUND_DEVICE_TYPE_MIRRORING)
- {
+ } else if (device_type == MM_SOUND_DEVICE_TYPE_MIRRORING) {
output_type = MM_AUDIO_EFFECT_OUTPUT_OTHERS;
- }
- else if (device_type == MM_SOUND_DEVICE_TYPE_HDMI)
- {
+ } else if (device_type == MM_SOUND_DEVICE_TYPE_HDMI) {
output_type = MM_AUDIO_EFFECT_OUTPUT_HDMI;
- }
- else if (device_type == MM_SOUND_DEVICE_TYPE_BLUETOOTH)
- {
+ } else if (device_type == MM_SOUND_DEVICE_TYPE_BLUETOOTH) {
output_type = MM_AUDIO_EFFECT_OUTPUT_BT;
- }
- else if (device_type == MM_SOUND_DEVICE_TYPE_USB_AUDIO)
- {
+ } else if (device_type == MM_SOUND_DEVICE_TYPE_USB_AUDIO) {
output_type = MM_AUDIO_EFFECT_OUTPUT_USB_AUDIO;
- }
- /* Other case, include WIRED_ACCESSORY */
- else
- {
+ } else {
+ /* Other case, include WIRED_ACCESSORY */
output_type = MM_AUDIO_EFFECT_OUTPUT_EAR;
}
- debug_warning("output_type = %d (0:spk,1:ear,2:others)", output_type);
+ LOGW("output_type = %d (0:spk,1:ear,2:others)", output_type);
/* set filter output mode */
g_object_set(audio_effect_element, "filter-output-mode", output_type, NULL);
+EXIT:
+ if (device_list)
+ mm_sound_free_device_list(device_list);
+
+ MMPLAYER_FLEAVE();
return result;
}
-gboolean
-_mmplayer_is_supported_effect_type(mm_player_t* player, MMAudioEffectType effect_type, int effect)
+static gboolean
+__mmplayer_is_supported_effect_type(mmplayer_t *player, mm_audio_effect_type_e effect_type, int effect)
{
gboolean result = TRUE;
mm_sound_device_flags_e flags = MM_SOUND_DEVICE_ALL_FLAG;
- MMSoundDeviceList_t device_list;
+ MMSoundDeviceList_t device_list = NULL;
MMSoundDevice_t device_h = NULL;
mm_sound_device_type_e device_type;
int ret = MM_ERROR_NONE;
/* get status if speaker is activated */
/* (1) get current device list */
- ret = mm_sound_get_current_device_list(flags, &device_list);
- if (ret) {
+ ret = mm_sound_get_device_list(flags, &device_list);
+ if (ret != MM_ERROR_NONE) {
MMPLAYER_FLEAVE();
- debug_error("mm_sound_get_current_device_list() failed [%x]!!", ret);
+ LOGE("mm_sound_get_device_list() failed [0x%x]!!", ret);
return FALSE;
}
/* (2) get device handle of device list */
- ret = mm_sound_get_next_device (device_list, &device_h);
-
- if (ret) {
- debug_error("mm_sound_get_next_device() failed [%x]!!", ret);
- MMPLAYER_FLEAVE();
- return FALSE;
+ ret = mm_sound_get_next_device(device_list, &device_h);
+ if (ret != MM_ERROR_NONE) {
+ LOGE("mm_sound_get_next_device() failed [0x%x]!!", ret);
+ goto EXIT;
}
/* (3) get device type */
ret = mm_sound_get_device_type(device_h, &device_type);
-
- if (ret) {
- debug_error("mm_sound_get_device_type() failed [%x]!!", ret);
- MMPLAYER_FLEAVE();
- return FALSE;
+ if (ret != MM_ERROR_NONE) {
+ LOGE("mm_sound_get_device_type() failed [0x%x]!!", ret);
+ goto EXIT;
}
/* preset */
- if (effect_type == MM_AUDIO_EFFECT_TYPE_PRESET)
- {
- if ( effect < MM_AUDIO_EFFECT_PRESET_AUTO || effect >= MM_AUDIO_EFFECT_PRESET_NUM )
- {
- debug_error("out of range, preset effect(%d)", effect);
+ if (effect_type == MM_AUDIO_EFFECT_TYPE_PRESET) {
+ if (effect < MM_AUDIO_EFFECT_PRESET_AUTO || effect >= MM_AUDIO_EFFECT_PRESET_NUM) {
+ LOGE("out of range, preset effect(%d)", effect);
result = FALSE;
- }
- else
- {
- if (!player->ini.audio_effect_preset_list[effect])
- {
- debug_error("this effect(%d) is not supported", effect);
+ } else {
+ if (!player->ini.audio_effect_preset_list[effect]) {
+ LOGE("this effect(%d) is not supported", effect);
result = FALSE;
- }
- else
- {
+ } else {
if (device_type == MM_SOUND_DEVICE_TYPE_BUILTIN_SPEAKER &&
- player->ini.audio_effect_preset_earphone_only_list[effect])
- {
+ player->ini.audio_effect_preset_earphone_only_list[effect]) {
result = FALSE;
}
}
}
- }
- /* custom */
- else if (effect_type == MM_AUDIO_EFFECT_TYPE_CUSTOM)
- {
- if ( effect < MM_AUDIO_EFFECT_CUSTOM_EQ || effect >= MM_AUDIO_EFFECT_CUSTOM_NUM )
- {
- debug_error("out of range, custom effect(%d)", effect);
+ } else if (effect_type == MM_AUDIO_EFFECT_TYPE_CUSTOM) {
+ /* custom */
+ if (effect < MM_AUDIO_EFFECT_CUSTOM_EQ || effect >= MM_AUDIO_EFFECT_CUSTOM_NUM) {
+ LOGE("out of range, custom effect(%d)", effect);
result = FALSE;
- }
- else
- {
- if (!player->ini.audio_effect_custom_list[effect])
- {
- debug_error("this custom effect(%d) is not supported", effect);
+ } else {
+ if (!player->ini.audio_effect_custom_list[effect]) {
+ LOGE("this custom effect(%d) is not supported", effect);
result = FALSE;
- }
- else
- {
+ } else {
if (device_type == MM_SOUND_DEVICE_TYPE_BUILTIN_SPEAKER &&
player->ini.audio_effect_custom_earphone_only_list[effect])
- {
result = FALSE;
- }
}
}
- }
- else if (effect_type == MM_AUDIO_EFFECT_TYPE_SQUARE)
- {
- if (!player->ini.use_audio_effect_custom)
- {
- debug_error("Square effect is not supported");
+ } else if (effect_type == MM_AUDIO_EFFECT_TYPE_SQUARE) {
+ if (!player->ini.use_audio_effect_custom) {
+ LOGE("Square effect is not supported");
result = FALSE;
}
- }
- else
- {
- debug_error("invalid effect type(%d)", effect_type);
+ } else {
+ LOGE("invalid effect type(%d)", effect_type);
result = FALSE;
}
+EXIT:
+ if (device_list)
+ mm_sound_free_device_list(device_list);
MMPLAYER_FLEAVE();
-
return result;
}
+static int
+__mmplayer_audio_effect_check_condition(mmplayer_t *player, mm_audio_effect_type_e effect_type, int effect)
+{
+ int ret = MM_ERROR_NONE;
+ int enabled = 0;
+ bool available = false;
+
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+
+ mm_attrs_get_int_by_name(player->attrs, MM_PLAYER_AUDIO_OFFLOAD, &enabled);
+ if (enabled) {
+ LOGW("audio offload is enabled.");
+ return MM_ERROR_PLAYER_SOUND_EFFECT_INVALID_STATUS;
+ }
+
+ ret = _mmplayer_is_audio_control_available((MMHandleType)player, MM_PLAYER_AUDIO_CONTROL_OPT_EFFECT, &available);
+ if (ret != MM_ERROR_NONE || !available)
+ return MM_ERROR_PLAYER_SOUND_EFFECT_INVALID_STATUS;
+
+ if (!__mmplayer_is_supported_effect_type(player, effect_type, effect)) {
+ LOGW("not supported effect filter %d %d", effect_type, effect);
+ return MM_ERROR_PLAYER_SOUND_EFFECT_NOT_SUPPORTED_FILTER;
+ }
+
+ return MM_ERROR_NONE;
+}
+
int
-_mmplayer_audio_effect_custom_apply(mm_player_t *player)
+_mmplayer_audio_effect_custom_apply(mmplayer_t *player)
{
GstElement *audio_effect_element = NULL;
int result = MM_ERROR_NONE;
MMPLAYER_FENTER();
- return_val_if_fail( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
/* Music Player can set audio effect value before Audiobin is created. */
- if ( !player->pipeline || !player->pipeline->audiobin || !player->pipeline->audiobin[MMPLAYER_A_FILTER].gst )
- {
- debug_warning("effect element is not created yet.");
-
+ if (!player->pipeline || !player->pipeline->audiobin || !player->pipeline->audiobin[MMPLAYER_A_FILTER].gst) {
+ LOGW("effect element is not created yet.");
player->bypass_audio_effect = FALSE;
/* store audio effect setting in order to apply it when audio effect plugin is created */
player->audio_effect_info.effect_type = MM_AUDIO_EFFECT_TYPE_CUSTOM;
- }
- else
- {
+ } else {
audio_effect_element = player->pipeline->audiobin[MMPLAYER_A_FILTER].gst;
/* get status if speaker is activated */
result = __mmplayer_audio_set_output_type(player, MM_AUDIO_EFFECT_TYPE_CUSTOM, 0);
-
- if ( result != MM_ERROR_NONE) {
- debug_error("failed to set output mode");
+ if (result != MM_ERROR_NONE) {
+ LOGE("failed to set output mode");
MMPLAYER_FLEAVE();
return result;
}
result = __mmplayer_set_harmony_effect(player, audio_effect_element);
- if ( result )
- {
- debug_error("_set_harmony_effect() failed(%x)", result);
+ if (result) {
+ LOGE("_set_harmony_effect() failed(0x%x)", result);
MMPLAYER_FLEAVE();
return result;
}
}
- player->set_mode.rich_audio = TRUE;
+ player->set_mode.rich_audio = true;
MMPLAYER_FLEAVE();
}
int
-_mmplayer_audio_effect_custom_update_level(mm_player_t *player)
+_mmplayer_audio_effect_custom_update_level(mmplayer_t *player)
{
GstElement *audio_effect_element = NULL;
int result = MM_ERROR_NONE;
MMPLAYER_FENTER();
- return_val_if_fail( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
audio_effect_element = player->pipeline->audiobin[MMPLAYER_A_FILTER].gst;
memcpy(player->audio_effect_info.custom_eq_level, custom_eq, sizeof(gint) * player->ini.audio_effect_custom_eq_band_num);
- for (i=0; i<player->ini.audio_effect_custom_eq_band_num;i++)
- {
- debug_log("updated custom-eq [%d] = %d", i, player->audio_effect_info.custom_eq_level[i]);
- }
+ for (i = 0; i < player->ini.audio_effect_custom_eq_band_num; i++)
+ LOGD("updated custom-eq [%d] = %d", i, player->audio_effect_info.custom_eq_level[i]);
/* get custom ext effect */
-
g_object_get(audio_effect_element, "custom-ext", &custom_ext_effect_level_list, NULL);
- while ( count < MM_AUDIO_EFFECT_CUSTOM_NUM )
- {
- if ( player->ini.audio_effect_custom_list[count] )
- {
- player->audio_effect_info.custom_ext_level[count-1]
+ while (count < MM_AUDIO_EFFECT_CUSTOM_NUM) {
+ if (player->ini.audio_effect_custom_list[count]) {
+ player->audio_effect_info.custom_ext_level[count - 1]
= custom_ext_effect_level_list[ext_level_index];
- debug_log("updated custom-ext [%d] = %d", count, player->audio_effect_info.custom_ext_level[count-1]);
+ LOGD("updated custom-ext [%d] = %d", count, player->audio_effect_info.custom_ext_level[count - 1]);
ext_level_index++;
}
count++;
}
-
MMPLAYER_FLEAVE();
return result;
}
mm_player_audio_effect_custom_clear_eq_all(MMHandleType hplayer)
{
int result = MM_ERROR_NONE;
- mm_player_t* player = (mm_player_t*)hplayer;
+ mmplayer_t *player = (mmplayer_t *)hplayer;
MMPLAYER_FENTER();
- return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
/* clear EQ custom effect */
- memset(player->audio_effect_info.custom_eq_level, MM_AUDIO_EFFECT_CUSTOM_LEVEL_INIT, sizeof(int)*MM_AUDIO_EFFECT_EQ_BAND_NUM_MAX);
+ memset(player->audio_effect_info.custom_eq_level, MM_AUDIO_EFFECT_CUSTOM_LEVEL_INIT, sizeof(int) * MM_AUDIO_EFFECT_EQ_BAND_NUM_MAX);
- debug_msg("All the EQ bands clearing success");
+ LOGI("All the EQ bands clearing success");
MMPLAYER_FLEAVE();
{
int i;
int result = MM_ERROR_NONE;
- mm_player_t* player = (mm_player_t*)hplayer;
+ mmplayer_t *player = (mmplayer_t *)hplayer;
MMPLAYER_FENTER();
- return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
/* clear ALL custom effects, except EQ */
- for ( i = 0 ; i < MM_AUDIO_EFFECT_CUSTOM_NUM - 1 ; i++ )
- {
+ for (i = 0 ; i < MM_AUDIO_EFFECT_CUSTOM_NUM - 1 ; i++)
player->audio_effect_info.custom_ext_level[i] = MM_AUDIO_EFFECT_CUSTOM_LEVEL_INIT;
- }
- debug_msg("All the extension effects clearing success");
+ LOGI("All the extension effects clearing success");
MMPLAYER_FLEAVE();
return result;
}
-
int
-mm_player_is_supported_preset_effect_type(MMHandleType hplayer, MMAudioEffectPresetType effect)
+mm_player_is_available_preset_effect(MMHandleType hplayer, mm_audio_effect_preset_type_e effect, bool *available)
{
- mm_player_t* player = (mm_player_t*)hplayer;
- int result = MM_ERROR_NONE;
+ mmplayer_t *player = (mmplayer_t *)hplayer;
MMPLAYER_FENTER();
- return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+ MMPLAYER_RETURN_VAL_IF_FAIL(available, MM_ERROR_INVALID_ARGUMENT);
- if ( !_mmplayer_is_supported_effect_type( player, MM_AUDIO_EFFECT_TYPE_PRESET, effect ) )
- {
- result = MM_ERROR_PLAYER_SOUND_EFFECT_NOT_SUPPORTED_FILTER;
- }
+ if (__mmplayer_audio_effect_check_condition(player, MM_AUDIO_EFFECT_TYPE_PRESET, effect) == MM_ERROR_NONE)
+ *available = true;
+ else
+ *available = false;
MMPLAYER_FLEAVE();
- return result;
+ return MM_ERROR_NONE;
}
-
int
-mm_player_is_supported_custom_effect_type(MMHandleType hplayer, MMAudioEffectCustomType effect)
+mm_player_is_available_custom_effect(MMHandleType hplayer, mm_audio_effect_custom_type_e effect, bool *available)
{
- mm_player_t* player = (mm_player_t*)hplayer;
- int result = MM_ERROR_NONE;
+ mmplayer_t *player = (mmplayer_t *)hplayer;
MMPLAYER_FENTER();
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+ MMPLAYER_RETURN_VAL_IF_FAIL(available, MM_ERROR_INVALID_ARGUMENT);
- return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
-
- if ( !_mmplayer_is_supported_effect_type( player, MM_AUDIO_EFFECT_TYPE_CUSTOM, effect ) )
- {
- result = MM_ERROR_PLAYER_SOUND_EFFECT_NOT_SUPPORTED_FILTER;
- }
+ if (__mmplayer_audio_effect_check_condition(player, MM_AUDIO_EFFECT_TYPE_CUSTOM, effect) == MM_ERROR_NONE)
+ *available = true;
+ else
+ *available = false;
MMPLAYER_FLEAVE();
- return result;
+ return MM_ERROR_NONE;
}
int
mm_player_audio_effect_custom_apply(MMHandleType hplayer)
{
- mm_player_t* player = (mm_player_t*)hplayer;
+ mmplayer_t *player = (mmplayer_t *)hplayer;
int result = MM_ERROR_NONE;
MMPLAYER_FENTER();
- return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
- if (!player->ini.use_audio_effect_custom)
- {
- debug_error("audio effect(custom) is not supported");
+ if (!player->ini.use_audio_effect_custom) {
+ LOGE("audio effect(custom) is not supported");
MMPLAYER_FLEAVE();
return MM_ERROR_NOT_SUPPORT_API;
}
int
-mm_player_audio_effect_bypass (MMHandleType hplayer)
+mm_player_audio_effect_bypass(MMHandleType hplayer)
{
- mm_player_t* player = (mm_player_t*)hplayer;
+ mmplayer_t *player = (mmplayer_t *)hplayer;
int result = MM_ERROR_NONE;
GstElement *audio_effect_element = NULL;
MMPLAYER_FENTER();
- return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
- if ( !player->ini.use_audio_effect_preset && !player->ini.use_audio_effect_custom )
- {
- debug_error("audio effect(preset/custom) is not supported");
+ if (!player->ini.use_audio_effect_preset && !player->ini.use_audio_effect_custom) {
+ LOGE("audio effect(preset/custom) is not supported");
MMPLAYER_FLEAVE();
return MM_ERROR_NOT_SUPPORT_API;
}
- if ( !player->pipeline || !player->pipeline->audiobin || !player->pipeline->audiobin[MMPLAYER_A_FILTER].gst )
- {
- debug_warning("effect element is not created yet.");
- }
- else
- {
+ if (!player->pipeline || !player->pipeline->audiobin || !player->pipeline->audiobin[MMPLAYER_A_FILTER].gst) {
+ LOGW("effect element is not created yet.");
+ } else {
audio_effect_element = player->pipeline->audiobin[MMPLAYER_A_FILTER].gst;
/* order action to audio effect plugin */
g_object_set(audio_effect_element, "filter-action", MM_AUDIO_EFFECT_TYPE_NONE, NULL);
- debug_log("filter-action = %d", MM_AUDIO_EFFECT_TYPE_NONE);
+ LOGD("filter-action = %d", MM_AUDIO_EFFECT_TYPE_NONE);
}
MMPLAYER_FLEAVE();
}
-int
-_mmplayer_audio_effect_custom_set_level_ext(mm_player_t *player, MMAudioEffectCustomType custom_effect_type, int level)
+static int
+__mmplayer_audio_effect_custom_set_level_ext(mmplayer_t *player, mm_audio_effect_custom_type_e custom_effect_type, int level)
{
int effect_level_max = 0;
int effect_level_min = 0;
MMPLAYER_FENTER();
- return_val_if_fail( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
/* check if EQ is supported */
- if ( !_mmplayer_is_supported_effect_type( player, MM_AUDIO_EFFECT_TYPE_CUSTOM, custom_effect_type ) )
- {
+ result = __mmplayer_audio_effect_check_condition(player, MM_AUDIO_EFFECT_TYPE_CUSTOM, custom_effect_type);
+ if (result != MM_ERROR_NONE) {
MMPLAYER_FLEAVE();
- return MM_ERROR_PLAYER_SOUND_EFFECT_NOT_SUPPORTED_FILTER;
+ return result;
}
- while ( count < MM_AUDIO_EFFECT_CUSTOM_NUM )
- {
- if ( player->ini.audio_effect_custom_list[count] )
- {
- if ( count == custom_effect_type )
- {
+ while (count < MM_AUDIO_EFFECT_CUSTOM_NUM) {
+ if (player->ini.audio_effect_custom_list[count]) {
+ if (count == custom_effect_type) {
effect_level_min = player->ini.audio_effect_custom_min_level_list[ext_level_index];
effect_level_max = player->ini.audio_effect_custom_max_level_list[ext_level_index];
- debug_msg("level min value(%d), level max value(%d)", effect_level_min, effect_level_max);
+ LOGI("level min value(%d), level max value(%d)", effect_level_min, effect_level_max);
break;
}
ext_level_index++;
- if (ext_level_index == player->ini.audio_effect_custom_ext_num + 1)
- {
- debug_error("could not find min, max value. maybe effect information in ini file is not proper for audio effect plugin");
+ if (ext_level_index == player->ini.audio_effect_custom_ext_num + 1) {
+ LOGE("could not find min, max value. maybe effect information in ini file is not proper for audio effect plugin");
break;
}
}
count++;
}
- if ( level < effect_level_min || level > effect_level_max )
- {
- debug_error("out of range, level(%d)", level);
+ if (level < effect_level_min || level > effect_level_max) {
+ LOGE("out of range, level(%d)", level);
result = MM_ERROR_INVALID_ARGUMENT;
- }
- else
- {
- player->audio_effect_info.custom_ext_level[custom_effect_type-1] = level;
- debug_msg("set ext[%d] = %d", custom_effect_type-1, level);
+ } else {
+ player->audio_effect_info.custom_ext_level[custom_effect_type - 1] = level;
+ LOGI("set ext[%d] = %d", custom_effect_type-1, level);
}
MMPLAYER_FLEAVE();
return result;
}
-
-int
-_mmplayer_audio_effect_custom_set_level_eq(mm_player_t *player, int index, int level)
+static int
+__mmplayer_audio_effect_custom_set_level_eq(mmplayer_t *player, int index, int level)
{
gint eq_level_max = 0;
gint eq_level_min = 0;
MMPLAYER_FENTER();
- return_val_if_fail( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
/* check if EQ is supported */
- if ( !_mmplayer_is_supported_effect_type( player, MM_AUDIO_EFFECT_TYPE_CUSTOM, MM_AUDIO_EFFECT_CUSTOM_EQ ) )
- {
+ result = __mmplayer_audio_effect_check_condition(player, MM_AUDIO_EFFECT_TYPE_CUSTOM, MM_AUDIO_EFFECT_CUSTOM_EQ);
+ if (result != MM_ERROR_NONE) {
MMPLAYER_FLEAVE();
- return MM_ERROR_PLAYER_SOUND_EFFECT_NOT_SUPPORTED_FILTER;
+ return result;
}
- if ( index < 0 || index > player->ini.audio_effect_custom_eq_band_num - 1 )
- {
- debug_error("out of range, index(%d)", index);
+ if (index < 0 || index > player->ini.audio_effect_custom_eq_band_num - 1) {
+ LOGE("out of range, index(%d)", index);
result = MM_ERROR_INVALID_ARGUMENT;
- }
- else
- {
+ } else {
eq_level_min = player->ini.audio_effect_custom_min_level_list[MM_AUDIO_EFFECT_CUSTOM_EQ];
eq_level_max = player->ini.audio_effect_custom_max_level_list[MM_AUDIO_EFFECT_CUSTOM_EQ];
- debug_msg("EQ level min value(%d), EQ level max value(%d)", eq_level_min, eq_level_max);
+ LOGI("EQ level min value(%d), EQ level max value(%d)", eq_level_min, eq_level_max);
- if ( level < eq_level_min || level > eq_level_max )
- {
- debug_error("out of range, EQ level(%d)", level);
+ if (level < eq_level_min || level > eq_level_max) {
+ LOGE("out of range, EQ level(%d)", level);
result = MM_ERROR_INVALID_ARGUMENT;
- }
- else
- {
+ } else {
player->audio_effect_info.custom_eq_level[index] = level;
- debug_msg("set EQ[%d] = %d", index, level);
+ LOGI("set EQ[%d] = %d", index, level);
}
}
/* NOTE : parameter eq_index is only used for _set_eq_level() */
int
-mm_player_audio_effect_custom_set_level(MMHandleType hplayer, MMAudioEffectCustomType effect_custom_type, int eq_index, int level)
+mm_player_audio_effect_custom_set_level(MMHandleType hplayer, mm_audio_effect_custom_type_e effect_custom_type, int eq_index, int level)
{
- mm_player_t* player = (mm_player_t*)hplayer;
+ mmplayer_t *player = (mmplayer_t *)hplayer;
int result = MM_ERROR_NONE;
MMPLAYER_FENTER();
- return_val_if_fail( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
/* check if this effect type is supported */
- if ( !_mmplayer_is_supported_effect_type( player, MM_AUDIO_EFFECT_TYPE_CUSTOM, effect_custom_type ) )
- {
- result = MM_ERROR_PLAYER_SOUND_EFFECT_NOT_SUPPORTED_FILTER;
+ result = __mmplayer_audio_effect_check_condition(player, MM_AUDIO_EFFECT_TYPE_CUSTOM, effect_custom_type);
+ if (result != MM_ERROR_NONE) {
+ MMPLAYER_FLEAVE();
+ return result;
}
- else
- {
- if (effect_custom_type == MM_AUDIO_EFFECT_CUSTOM_EQ)
- {
- result = _mmplayer_audio_effect_custom_set_level_eq(player, eq_index, level);
- }
- else if (effect_custom_type > MM_AUDIO_EFFECT_CUSTOM_EQ && effect_custom_type < MM_AUDIO_EFFECT_CUSTOM_NUM)
- {
- result = _mmplayer_audio_effect_custom_set_level_ext(player, effect_custom_type, level);
- }
- else
- {
- debug_error("out of range, effect type(%d)", effect_custom_type);
- result = MM_ERROR_INVALID_ARGUMENT;
- }
+
+ if (effect_custom_type == MM_AUDIO_EFFECT_CUSTOM_EQ) {
+ result = __mmplayer_audio_effect_custom_set_level_eq(player, eq_index, level);
+ } else if (effect_custom_type > MM_AUDIO_EFFECT_CUSTOM_EQ && effect_custom_type < MM_AUDIO_EFFECT_CUSTOM_NUM) {
+ result = __mmplayer_audio_effect_custom_set_level_ext(player, effect_custom_type, level);
+ } else {
+ LOGE("out of range, effect type(%d)", effect_custom_type);
+ result = MM_ERROR_INVALID_ARGUMENT;
}
MMPLAYER_FLEAVE();
int
mm_player_audio_effect_custom_get_eq_bands_number(MMHandleType hplayer, int *bands)
{
- mm_player_t* player = (mm_player_t*)hplayer;
+ mmplayer_t *player = (mmplayer_t *)hplayer;
int result = MM_ERROR_NONE;
MMPLAYER_FENTER();
- return_val_if_fail( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
/* check if EQ is supported */
- if ( !_mmplayer_is_supported_effect_type( player, MM_AUDIO_EFFECT_TYPE_CUSTOM, MM_AUDIO_EFFECT_CUSTOM_EQ ) )
- {
+ result = __mmplayer_audio_effect_check_condition(player, MM_AUDIO_EFFECT_TYPE_CUSTOM, MM_AUDIO_EFFECT_CUSTOM_EQ);
+ if (result != MM_ERROR_NONE) {
MMPLAYER_FLEAVE();
- return MM_ERROR_PLAYER_SOUND_EFFECT_NOT_SUPPORTED_FILTER;
+ return result;
}
*bands = player->ini.audio_effect_custom_eq_band_num;
- debug_log("number of custom EQ band = %d", *bands);
+ LOGD("number of custom EQ band = %d", *bands);
MMPLAYER_FLEAVE();
int
mm_player_audio_effect_custom_get_eq_bands_width(MMHandleType hplayer, int band_idx, int *width)
{
- mm_player_t* player = (mm_player_t*)hplayer;
+ mmplayer_t *player = (mmplayer_t *)hplayer;
int result = MM_ERROR_NONE;
unsigned int eq_num = 0;
MMPLAYER_FENTER();
- return_val_if_fail( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
/* check if EQ is supported */
- if ( !_mmplayer_is_supported_effect_type( player, MM_AUDIO_EFFECT_TYPE_CUSTOM, MM_AUDIO_EFFECT_CUSTOM_EQ ) )
- {
+ result = __mmplayer_audio_effect_check_condition(player, MM_AUDIO_EFFECT_TYPE_CUSTOM, MM_AUDIO_EFFECT_CUSTOM_EQ);
+ if (result != MM_ERROR_NONE) {
MMPLAYER_FLEAVE();
- return MM_ERROR_PLAYER_SOUND_EFFECT_NOT_SUPPORTED_FILTER;
+ return result;
}
eq_num = player->ini.audio_effect_custom_eq_band_num;
- if (band_idx < 0 || band_idx > eq_num-1)
- {
- debug_error("out of range, invalid band_idx(%d)", band_idx);
+ if (band_idx < 0 || band_idx > eq_num - 1) {
+ LOGE("out of range, invalid band_idx(%d)", band_idx);
result = MM_ERROR_INVALID_ARGUMENT;
- }
- else
- {
+ } else {
/* set the width of EQ band */
*width = player->ini.audio_effect_custom_eq_band_width[band_idx];
- debug_log("width of band_idx(%d) = %dHz", band_idx, *width);
+ LOGD("width of band_idx(%d) = %dHz", band_idx, *width);
}
MMPLAYER_FLEAVE();
int
mm_player_audio_effect_custom_get_eq_bands_freq(MMHandleType hplayer, int band_idx, int *freq)
{
- mm_player_t* player = (mm_player_t*)hplayer;
+ mmplayer_t *player = (mmplayer_t *)hplayer;
int result = MM_ERROR_NONE;
unsigned int eq_num = 0;
MMPLAYER_FENTER();
- return_val_if_fail( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
/* check if EQ is supported */
- if ( !_mmplayer_is_supported_effect_type( player, MM_AUDIO_EFFECT_TYPE_CUSTOM, MM_AUDIO_EFFECT_CUSTOM_EQ ) )
- {
+ result = __mmplayer_audio_effect_check_condition(player, MM_AUDIO_EFFECT_TYPE_CUSTOM, MM_AUDIO_EFFECT_CUSTOM_EQ);
+ if (result != MM_ERROR_NONE) {
MMPLAYER_FLEAVE();
- return MM_ERROR_PLAYER_SOUND_EFFECT_NOT_SUPPORTED_FILTER;
+ return result;
}
eq_num = player->ini.audio_effect_custom_eq_band_num;
- if (band_idx < 0 || band_idx > eq_num-1)
- {
- debug_error("out of range, invalid band_idx(%d)", band_idx);
+ if (band_idx < 0 || band_idx > eq_num - 1) {
+ LOGE("out of range, invalid band_idx(%d)", band_idx);
result = MM_ERROR_INVALID_ARGUMENT;
- }
- else
- {
+ } else {
/* set the frequency of EQ band */
*freq = player->ini.audio_effect_custom_eq_band_freq[band_idx];
- debug_log("frequency of band_idx(%d) = %dHz", band_idx, *freq);
+ LOGD("frequency of band_idx(%d) = %dHz", band_idx, *freq);
}
MMPLAYER_FLEAVE();
int
-mm_player_audio_effect_custom_get_level(MMHandleType hplayer, MMAudioEffectCustomType type, int eq_index, int *level)
+mm_player_audio_effect_custom_get_level(MMHandleType hplayer, mm_audio_effect_custom_type_e type, int eq_index, int *level)
{
- mm_player_t* player = (mm_player_t*)hplayer;
+ mmplayer_t *player = (mmplayer_t *)hplayer;
int result = MM_ERROR_NONE;
MMPLAYER_FENTER();
- return_val_if_fail( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
- return_val_if_fail( level, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+ MMPLAYER_RETURN_VAL_IF_FAIL(level, MM_ERROR_PLAYER_NOT_INITIALIZED);
/* check if this effect type is supported */
- if ( !_mmplayer_is_supported_effect_type( player, MM_AUDIO_EFFECT_TYPE_CUSTOM, type ) )
- {
+ result = __mmplayer_audio_effect_check_condition(player, MM_AUDIO_EFFECT_TYPE_CUSTOM, type);
+ if (result != MM_ERROR_NONE) {
MMPLAYER_FLEAVE();
- return MM_ERROR_PLAYER_SOUND_EFFECT_NOT_SUPPORTED_FILTER;
+ return result;
}
- if (type == MM_AUDIO_EFFECT_CUSTOM_EQ)
- {
- if ( eq_index < 0 || eq_index > player->ini.audio_effect_custom_eq_band_num - 1 )
- {
- debug_error("out of range, EQ index(%d)", eq_index);
+ if (type == MM_AUDIO_EFFECT_CUSTOM_EQ) {
+ if (eq_index < 0 || eq_index > player->ini.audio_effect_custom_eq_band_num - 1) {
+ LOGE("out of range, EQ index(%d)", eq_index);
result = MM_ERROR_INVALID_ARGUMENT;
- }
- else
- {
+ } else {
*level = player->audio_effect_info.custom_eq_level[eq_index];
- debug_log("EQ index = %d, level = %d", eq_index, *level);
+ LOGD("EQ index = %d, level = %d", eq_index, *level);
}
- }
- else if ( type > MM_AUDIO_EFFECT_CUSTOM_EQ && type < MM_AUDIO_EFFECT_CUSTOM_NUM )
- {
- *level = player->audio_effect_info.custom_ext_level[type-1];
- debug_log("extension effect index = %d, level = %d", type, *level);
- }
- else
- {
- debug_error("out of range, type(%d)", type);
+ } else if (type > MM_AUDIO_EFFECT_CUSTOM_EQ && type < MM_AUDIO_EFFECT_CUSTOM_NUM) {
+ *level = player->audio_effect_info.custom_ext_level[type - 1];
+ LOGD("extension effect index = %d, level = %d", type, *level);
+ } else {
+ LOGE("out of range, type(%d)", type);
result = MM_ERROR_INVALID_ARGUMENT;
}
int
-mm_player_audio_effect_custom_get_level_range(MMHandleType hplayer, MMAudioEffectCustomType type, int *min, int *max)
+mm_player_audio_effect_custom_get_level_range(MMHandleType hplayer, mm_audio_effect_custom_type_e type, int *min, int *max)
{
- mm_player_t* player = (mm_player_t*)hplayer;
+ mmplayer_t *player = (mmplayer_t *)hplayer;
int result = MM_ERROR_NONE;
int count = 1; /* start from 1, because of excepting eq index */
int ext_level_index = 1; /* start from 1, because of excepting eq index */
MMPLAYER_FENTER();
- return_val_if_fail( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
- return_val_if_fail( min, MM_ERROR_PLAYER_NOT_INITIALIZED );
- return_val_if_fail( max, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+ MMPLAYER_RETURN_VAL_IF_FAIL(min, MM_ERROR_PLAYER_NOT_INITIALIZED);
+ MMPLAYER_RETURN_VAL_IF_FAIL(max, MM_ERROR_PLAYER_NOT_INITIALIZED);
/* check if this effect type is supported */
- if ( !_mmplayer_is_supported_effect_type( player, MM_AUDIO_EFFECT_TYPE_CUSTOM, type ) )
- {
+ result = __mmplayer_audio_effect_check_condition(player, MM_AUDIO_EFFECT_TYPE_CUSTOM, type);
+ if (result != MM_ERROR_NONE) {
MMPLAYER_FLEAVE();
- return MM_ERROR_PLAYER_SOUND_EFFECT_NOT_SUPPORTED_FILTER;
+ return result;
}
- if ( type == MM_AUDIO_EFFECT_CUSTOM_EQ )
- {
+ if (type == MM_AUDIO_EFFECT_CUSTOM_EQ) {
*min = player->ini.audio_effect_custom_min_level_list[MM_AUDIO_EFFECT_CUSTOM_EQ];
*max = player->ini.audio_effect_custom_max_level_list[MM_AUDIO_EFFECT_CUSTOM_EQ];
- debug_log("EQ min level = %d, max level = %d", *min, *max);
- }
- else
- {
- while ( count < MM_AUDIO_EFFECT_CUSTOM_NUM )
- {
- if ( player->ini.audio_effect_custom_list[count] )
- {
- if ( count == type )
- {
+ LOGD("EQ min level = %d, max level = %d", *min, *max);
+ } else {
+ while (count < MM_AUDIO_EFFECT_CUSTOM_NUM) {
+ if (player->ini.audio_effect_custom_list[count]) {
+ if (count == type) {
*min = player->ini.audio_effect_custom_min_level_list[ext_level_index];
*max = player->ini.audio_effect_custom_max_level_list[ext_level_index];
- debug_msg("Extension effect(%d) min level = %d, max level = %d", count, *min, *max);
+ LOGI("Extension effect(%d) min level = %d, max level = %d", count, *min, *max);
break;
}
ext_level_index++;
- if ( ext_level_index == player->ini.audio_effect_custom_ext_num + 1 )
- {
- debug_error("could not find min, max value. maybe effect information in ini file is not proper for audio effect plugin");
+ if (ext_level_index == player->ini.audio_effect_custom_ext_num + 1) {
+ LOGE("could not find min, max value. maybe effect information in ini file is not proper for audio effect plugin");
break;
}
}
int
mm_player_audio_effect_custom_set_level_eq_from_list(MMHandleType hplayer, int *level_list, int size)
{
- mm_player_t *player = (mm_player_t*)hplayer;
+ mmplayer_t *player = (mmplayer_t *)hplayer;
gint i = 0;
gint eq_level_min = 0;
gint eq_level_max = 0;
MMPLAYER_FENTER();
- return_val_if_fail( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
/* check if EQ is supported */
- if ( !_mmplayer_is_supported_effect_type( player, MM_AUDIO_EFFECT_TYPE_CUSTOM, MM_AUDIO_EFFECT_CUSTOM_EQ ) )
- {
+ result = __mmplayer_audio_effect_check_condition(player, MM_AUDIO_EFFECT_TYPE_CUSTOM, MM_AUDIO_EFFECT_CUSTOM_EQ);
+ if (result != MM_ERROR_NONE) {
MMPLAYER_FLEAVE();
- return MM_ERROR_PLAYER_SOUND_EFFECT_NOT_SUPPORTED_FILTER;
+ return result;
}
- if ( size != player->ini.audio_effect_custom_eq_band_num )
- {
- debug_error("input size variable(%d) does not match with number of eq band(%d)", size, player->ini.audio_effect_custom_eq_band_num);
+ if (size != player->ini.audio_effect_custom_eq_band_num) {
+ LOGE("input size variable(%d) does not match with number of eq band(%d)", size, player->ini.audio_effect_custom_eq_band_num);
result = MM_ERROR_INVALID_ARGUMENT;
- }
- else
- {
+ } else {
eq_level_min = player->ini.audio_effect_custom_min_level_list[MM_AUDIO_EFFECT_CUSTOM_EQ];
eq_level_max = player->ini.audio_effect_custom_max_level_list[MM_AUDIO_EFFECT_CUSTOM_EQ];
- for ( i = 0 ; i < size ; i++ )
- {
- if ( level_list[i] < eq_level_min || level_list[i] > eq_level_max)
- {
- debug_error("out of range, level[%d]=%d", i, level_list[i]);
+ for (i = 0 ; i < size ; i++) {
+ if (level_list[i] < eq_level_min || level_list[i] > eq_level_max) {
+ LOGE("out of range, level[%d]=%d", i, level_list[i]);
result = MM_ERROR_INVALID_ARGUMENT;
break;
}