+int
+__mmplayer_audio_set_output_type (mm_player_t *player, MMAudioEffectType effect_type, int effect)
+{
+ GstElement *audio_effect_element = NULL;
+ mm_sound_device_flags_e flags = MM_SOUND_DEVICE_ALL_FLAG;
+ MMSoundDeviceList_t device_list;
+ MMSoundDevice_t device_h = NULL;
+ mm_sound_device_type_e device_type;
+ int output_type = 0;
+ int result = MM_ERROR_NONE;
+
+ MMPLAYER_FENTER();
+
+ 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);
+ 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;
+ }
+
+ /* (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;
+ }
+
+ /* 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;
+ }
+ }
+
+ output_type = MM_AUDIO_EFFECT_OUTPUT_SPK;
+ }
+ 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)
+ {
+ output_type = MM_AUDIO_EFFECT_OUTPUT_HDMI;
+ }
+ 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)
+ {
+ output_type = MM_AUDIO_EFFECT_OUTPUT_USB_AUDIO;
+ }
+ /* Other case, include WIRED_ACCESSORY */
+ else
+ {
+ output_type = MM_AUDIO_EFFECT_OUTPUT_EAR;
+ }
+ debug_warning("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);
+
+ return result;
+}