From 62487d23412e2b9a248f0bb0c61d813636c3a99a Mon Sep 17 00:00:00 2001 From: Eunhye Choi Date: Thu, 19 Sep 2019 16:57:56 +0900 Subject: [PATCH] [0.6.204] add the default codec type configuration - add the default codec type configuration via ini setting - some audio functions become optional in case the HW audio codec is selected. : audio effect, replaygain, pitch, pcm exporting Change-Id: Ibd5f42646155606b5c6e8ca59825313dd05d47bb --- packaging/libmm-player.spec | 2 +- src/include/mm_player.h | 18 +++++- src/include/mm_player_audioeffect.h | 26 ++------ src/include/mm_player_ini.h | 92 +++------------------------- src/include/mm_player_priv.h | 3 +- src/mm_player.c | 16 ++++- src/mm_player_attrs.c | 28 ++++++--- src/mm_player_audioeffect.c | 117 ++++++++++++++++++++++++------------ src/mm_player_ini.c | 83 ++++++++----------------- src/mm_player_priv.c | 92 ++++++++++++++++++++++++---- 10 files changed, 249 insertions(+), 228 deletions(-) diff --git a/packaging/libmm-player.spec b/packaging/libmm-player.spec index 2bb97b0..94c15dc 100644 --- a/packaging/libmm-player.spec +++ b/packaging/libmm-player.spec @@ -1,6 +1,6 @@ Name: libmm-player Summary: Multimedia Framework Player Library -Version: 0.6.203 +Version: 0.6.204 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 diff --git a/src/include/mm_player.h b/src/include/mm_player.h index 2906bf0..1b5afa4 100644 --- a/src/include/mm_player.h +++ b/src/include/mm_player.h @@ -407,10 +407,17 @@ typedef enum { } mmplayer_stream_type_e; typedef enum { - MM_PLAYER_CODEC_TYPE_DEFAULT = 0, /**< codec is selected by the priority */ MM_PLAYER_CODEC_TYPE_HW, /**< HW codec can only be selected */ MM_PLAYER_CODEC_TYPE_SW, /**< SW codec can only be selected */ -} mmplayer_video_codec_type_e; + MM_PLAYER_CODEC_TYPE_DEFAULT, /**< codec is selected by the priority */ +} mmplayer_codec_type_e; + +typedef enum { + MM_PLAYER_AUDIO_CONTROL_OPT_EFFECT, + MM_PLAYER_AUDIO_CONTROL_OPT_REPLAYGAIN, + MM_PLAYER_AUDIO_CONTROL_OPT_PITCH, + MM_PLAYER_AUDIO_CONTROL_OPT_PCM_EXPORTING, +} mmplayer_audio_control_opt_e; typedef enum { MM_PLAYER_AUDIO_EXTRACT_DEFAULT = 0x00, /**< Sync with the playback clock and multichannel audio stream */ @@ -1385,7 +1392,7 @@ int mm_player_360_get_field_of_view(MMHandleType player, int *horizontal_degrees /** * This function is to set codec type */ -int mm_player_set_codec_type(MMHandleType player, mmplayer_stream_type_e stream_type, mmplayer_video_codec_type_e codec_type); +int mm_player_set_codec_type(MMHandleType player, mmplayer_stream_type_e stream_type, mmplayer_codec_type_e codec_type); /** * These functions are to apply the replaygain @@ -1494,6 +1501,11 @@ int mm_player_set_client_pid(MMHandleType player, int pid); int mm_player_audio_offload_is_activated(MMHandleType player, bool *activated); /** + * This function checks whether the controlling audio with opt is available or not. + */ +int mm_player_is_audio_control_available(MMHandleType player, mmplayer_audio_control_opt_e opt, bool *available); + +/** @} */ diff --git a/src/include/mm_player_audioeffect.h b/src/include/mm_player_audioeffect.h index dab1c1f..4920e71 100644 --- a/src/include/mm_player_audioeffect.h +++ b/src/include/mm_player_audioeffect.h @@ -313,32 +313,14 @@ int mm_player_audio_effect_custom_set_level(MMHandleType hplayer, mm_audio_effec int mm_player_audio_effect_custom_set_level_eq_from_list(MMHandleType hplayer, int *level_list, int size); /** - * This function is to decide if the preset type effect is supported or not - * - * @param hplayer [in] Handle of player. - * @param effect [in] Preset type effect. - * - * @return This function returns zero on success, or negative value with error code. - * - * @remark - * @see - * @since + * This function is to check whether the setting preset type effect is available or not */ -int mm_player_is_supported_preset_effect_type(MMHandleType hplayer, mm_audio_effect_preset_type_e effect); +int mm_player_is_available_preset_effect(MMHandleType hplayer, mm_audio_effect_preset_type_e effect, bool *available); /** - * This function is to decide if the custom type effect is supported or not - * - * @param hplayer [in] Handle of player. - * @param effect [in] Custom type effect. - * - * @return This function returns zero on success, or negative value with error code. - * - * @remark - * @see - * @since + * This function is to check whether the setting custom type effect is available or not */ -int mm_player_is_supported_custom_effect_type(MMHandleType hplayer, mm_audio_effect_custom_type_e effect); +int mm_player_is_available_custom_effect(MMHandleType hplayer, mm_audio_effect_custom_type_e effect, bool *available); /** @} diff --git a/src/include/mm_player_ini.h b/src/include/mm_player_ini.h index 8f97576..b75744b 100644 --- a/src/include/mm_player_ini.h +++ b/src/include/mm_player_ini.h @@ -71,8 +71,10 @@ typedef struct { gchar videoconverter_element[PLAYER_INI_MAX_STRLEN]; gchar videocodec_element_hw[PLAYER_INI_MAX_STRLEN]; gchar videocodec_element_sw[PLAYER_INI_MAX_ELEMENT][PLAYER_INI_MAX_STRLEN]; + gchar videocodec_default_type[PLAYER_INI_MAX_STRLEN]; gchar audiocodec_element_hw[PLAYER_INI_MAX_STRLEN]; gchar audiocodec_element_sw[PLAYER_INI_MAX_ELEMENT][PLAYER_INI_MAX_STRLEN]; + gchar audiocodec_default_type[PLAYER_INI_MAX_STRLEN]; gchar audioresampler_element[PLAYER_INI_MAX_STRLEN]; gchar audiosink_element[PLAYER_INI_MAX_STRLEN]; gchar audio_offload_sink_element[PLAYER_INI_MAX_STRLEN]; @@ -86,16 +88,18 @@ typedef struct { gint localplayback_state_change_timeout; gint delay_before_repeat; gint eos_delay; - gboolean video_playback_supported; gchar gst_param[5][PLAYER_INI_MAX_PARAM_STRLEN]; gchar exclude_element_keyword[PLAYER_INI_MAX_ELEMENT][PLAYER_INI_MAX_STRLEN]; gchar unsupported_codec_keyword[PLAYER_INI_MAX_ELEMENT][PLAYER_INI_MAX_STRLEN]; - gboolean async_start; gboolean disable_segtrap; gint pcm_buffer_size; gint num_of_video_bo; gint video_bo_timeout; + gboolean support_audio_effect; + gboolean support_pcm_exporting; + gboolean support_pitch_control; + gboolean support_replaygain_control; /* http streaming */ gchar httpsrc_element[PLAYER_INI_MAX_STRLEN]; @@ -155,22 +159,22 @@ typedef struct { #define DEFAULT_VIDEOSINK_FAKE "fakesink" #define DEFAULT_AUDIORESAMPLER "audioresample" #define DEFAULT_AUDIOSINK "pulsesink" -#define DEFAULT_CODEC_HW "" -#define DEFAULT_CODEC_SW "" #define DEFAULT_A_OFFLOAD_DEVICE_TYPE "" #define DEFAULT_GST_PARAM "" #define DEFAULT_EXCLUDE_KEYWORD "" #define DEFAULT_UNSUPPORTED_CODEC_KEYWORD "" -#define DEFAULT_ASYNC_START TRUE #define DEFAULT_DISABLE_SEGTRAP TRUE #define DEFAULT_VIDEO_CONVERTER "" -#define DEFAULT_VIDEO_PLAYBACK_SUPPORTED TRUE #define DEFAULT_LIVE_STATE_CHANGE_TIMEOUT 30 /* sec */ #define DEFAULT_LOCALPLAYBACK_STATE_CHANGE_TIMEOUT 10 /* sec */ #define DEFAULT_PCM_BUFFER_SIZE 51200 /* bytes */ #define DEFAULT_NUM_OF_VIDEO_BO 10 #define DEFAULT_TIMEOUT_OF_VIDEO_BO 10 /* sec */ #define DEFAULT_AUDIO_OFFLOAD_SINK "" +#define DEFAULT_SUPPORT_AUDIO_EFFECT FALSE /* with HW audio codec */ +#define DEFAULT_SUPPORT_PCM_EXPORTING FALSE /* with HW audio codec */ +#define DEFAULT_SUPPORT_PITCH_CONTROL FALSE /* with HW audio codec */ +#define DEFAULT_SUPPORT_REPLAYGAIN_CONTROL FALSE /* with HW audio codec */ /* http streaming */ #define DEFAULT_HTTPSRC "souphttpsrc" @@ -181,82 +185,6 @@ typedef struct { #define DEFAULT_DUMP_ELEMENT_KEYWORD "" #define DEFAULT_DUMP_ELEMENT_PATH "/tmp/" -/* NOTE : following content should be same with above default values */ -/* FIXIT : need smarter way to generate default ini file. */ -/* FIXIT : finally, it should be an external file */ -#define MM_PLAYER_DEFAULT_INI \ -"\ -[general] \n\ -\n\ -disable segtrap = yes ; same effect with --gst-disable-segtrap \n\ -\n\ -; set default video sink but, it can be replaced with others selected by application\n\ -; 0:v4l2sink, 1:ximagesink, 2:xvimagesink, 3:fakesink 4:evasimagesink 5:glimagesink\n\ -videosink element = 2 \n\ -\n\ -video converter element = \n\ -\n\ -audiosink element = pulsesink \n\ -\n\ -; if yes. gstreamer will not update registry \n\ -skip rescan = yes \n\ -\n\ -delay before repeat = 50 ; msec\n\ -\n\ -; comma separated list of tocken which elemnts has it in it's name will not be used \n\ -element exclude keyword = \n\ -\n\ -; comma separated list of tocken \n\ -unsupported codec keyword = \n\ -\n\ -async start = yes \n\ -\n\ -; parameters for initializing gstreamer \n\ -gstparam1 = --gst-debug=2\n\ -gstparam2 = \n\ -gstparam3 = \n\ -gstparam4 = \n\ -gstparam5 = \n\ -\n\ -; generating dot file representing pipeline state \n\ -; export GST_DEBUG_DUMP_DOT_DIR=/tmp/\n\ -generate dot = no \n\ -\n\ -; parameter is for only video to be determined \n\ -; which clock will be used \n\ -; if yes, system clock will be used \n\ -; apart from this, audiosink is clock provider for audio \n\ -use system clock = yes \n\ -\n\ -; allowed timeout for changing pipeline state \n\ -live state change timeout = 30 ; sec \n\ -localplayback state change timeout = 4 ; sec \n\ -\n\ -; delay in msec for sending EOS \n\ -eos delay = 150 ; msec \n\ -\n\ -\n\ -[http streaming] \n\ -\n\ -httppsrc element = souphttpsrc \n\ -\n\ -; if yes, use file for buffering.\n\ -; if no, use memory for buffering.\n\ -http use file buffer = no\n\ -\n\ -; ring buffer size when use mem buffer \n\ -http ring buffer size = 20971520 ; 20MBytes \n\ -\n\ -http buffering limit = 99 ; percent\n\ -\n\ -http max size bytes = 1048576 ; bytes\n\ -\n\ -http buffering time = 1.2 \n\ -\n\ -http timeout = -1 ; infinite retry \n\ -\n\ -" - int mm_player_ini_load(mmplayer_ini_t *ini); diff --git a/src/include/mm_player_priv.h b/src/include/mm_player_priv.h index abf45a6..c74063f 100644 --- a/src/include/mm_player_priv.h +++ b/src/include/mm_player_priv.h @@ -857,12 +857,13 @@ int _mmplayer_get_max_adaptive_variant_limit(MMHandleType hplayer, int *bandwidt int _mmplayer_set_audio_only(MMHandleType hplayer, bool audio_only); int _mmplayer_get_audio_only(MMHandleType hplayer, bool *paudio_only); int _mmplayer_get_streaming_buffering_time(MMHandleType hplayer, int *prebuffer_ms, int *rebuffer_ms); -int _mmplayer_set_codec_type(MMHandleType hplayer, mmplayer_stream_type_e stream_type, mmplayer_video_codec_type_e codec_type); +int _mmplayer_set_codec_type(MMHandleType hplayer, mmplayer_stream_type_e stream_type, mmplayer_codec_type_e codec_type); int _mmplayer_set_replaygain_enabled(MMHandleType hplayer, bool enabled); int _mmplayer_is_replaygain_enabled(MMHandleType hplayer, bool *enabled); int _mmplayer_set_video_roi_area(MMHandleType hplayer, double scale_x, double scale_y, double scale_width, double scale_height); int _mmplayer_get_video_roi_area(MMHandleType hplayer, double *scale_x, double *scale_y, double *scale_width, double *scale_height); int _mmplayer_audio_offload_is_activated(MMHandleType hplayer, bool *activated); +int _mmplayer_is_audio_control_available(MMHandleType hplayer, mmplayer_audio_control_opt_e opt, bool *available); /* internal */ void _mmplayer_bus_msg_thread_destroy(MMHandleType hplayer); diff --git a/src/mm_player.c b/src/mm_player.c index 980275e..4134c2f 100644 --- a/src/mm_player.c +++ b/src/mm_player.c @@ -1157,7 +1157,7 @@ int mm_player_360_get_field_of_view(MMHandleType player, int *horizontal_degrees return result; } -int mm_player_set_codec_type(MMHandleType player, mmplayer_stream_type_e stream_type, mmplayer_video_codec_type_e codec_type) +int mm_player_set_codec_type(MMHandleType player, mmplayer_stream_type_e stream_type, mmplayer_codec_type_e codec_type) { int result = MM_ERROR_NONE; @@ -1263,3 +1263,17 @@ int mm_player_audio_offload_is_activated(MMHandleType player, bool *activated) return result; } + +int mm_player_is_audio_control_available(MMHandleType player, mmplayer_audio_control_opt_e opt, bool *available) +{ + int result = MM_ERROR_NONE; + + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_RETURN_VAL_IF_FAIL(available, MM_ERROR_INVALID_ARGUMENT); + + MMPLAYER_CMD_LOCK(player); + result = _mmplayer_is_audio_control_available(player, opt, available); + MMPLAYER_CMD_UNLOCK(player); + + return result; +} \ No newline at end of file diff --git a/src/mm_player_attrs.c b/src/mm_player_attrs.c index d76ccfc..55adff7 100644 --- a/src/mm_player_attrs.c +++ b/src/mm_player_attrs.c @@ -127,7 +127,7 @@ static bool __mmplayer_commit_audio_pitch_value(MMHandleType handle, int attr_id static int __mmplayer_get_array_count(MMHandleType handle, int type) { - mmplayer_t *player = (mmplayer_t *)handle; + mmplayer_t *player = MM_PLAYER_CAST(handle); int count = 0; int i = 0; @@ -144,10 +144,9 @@ static int __mmplayer_get_array_count(MMHandleType handle, int type) static media_format_mimetype_e __mmplayer_get_supported_format_mimetype(MMHandleType handle, int type, int i) { - char *name = NULL; + mmplayer_t *player = MM_PLAYER_CAST(handle); media_format_mimetype_e format = MEDIA_FORMAT_MAX; - - mmplayer_t *player = (mmplayer_t *)handle; + char *name = NULL; if (type == KEYWORD_A_OFFLOAD_MEDIA_FORMAT) { name = player->ini.audio_offload_media_format[i]; @@ -240,6 +239,16 @@ static int __mmplayer_get_available_format(MMHandleType handle, int type, int ** return total_count; } +static int __mmplayer_get_default_audio_codec_type(MMHandleType handle) +{ + mmplayer_t *player = MM_PLAYER_CAST(handle); + + if (!strcmp(player->ini.audiocodec_default_type, "hw")) + return MM_PLAYER_CODEC_TYPE_HW; + else + return MM_PLAYER_CODEC_TYPE_SW; +} + static int __mmplayer_set_ini_to_valid_info(MMHandleType handle) { mmplayer_t *player = MM_PLAYER_CAST(handle); @@ -260,6 +269,9 @@ static int __mmplayer_set_ini_to_valid_info(MMHandleType handle) player->default_attrs[MMPLAYER_ATTRS_MEDIA_STREAM_INPUT_FORMAT].validity_value_2.count = total_count; } + /* default audio codec type */ + player->default_attrs[MMPLAYER_ATTRS_AUDIO_CODEC_TYPE].default_value.value_int = __mmplayer_get_default_audio_codec_type(handle); + return MM_ERROR_NONE; } @@ -1058,8 +1070,8 @@ MMHandleType _mmplayer_construct_attribute(MMHandleType handle) MM_ATTRS_FLAG_RW, {(void *)MM_PLAYER_CODEC_TYPE_DEFAULT}, MM_ATTRS_VALID_TYPE_INT_RANGE, - {.int_min = MM_PLAYER_CODEC_TYPE_DEFAULT}, - {.int_max = MM_PLAYER_CODEC_TYPE_SW}, + {.int_min = MM_PLAYER_CODEC_TYPE_HW}, + {.int_max = MM_PLAYER_CODEC_TYPE_DEFAULT}, NULL, }, { @@ -1067,9 +1079,9 @@ MMHandleType _mmplayer_construct_attribute(MMHandleType handle) (char *)"audio_codec_type", MM_ATTRS_TYPE_INT, MM_ATTRS_FLAG_RW, - {(void *)MM_PLAYER_CODEC_TYPE_DEFAULT}, + {(void *)MM_PLAYER_CODEC_TYPE_SW}, MM_ATTRS_VALID_TYPE_INT_RANGE, - {.int_min = MM_PLAYER_CODEC_TYPE_DEFAULT}, + {.int_min = MM_PLAYER_CODEC_TYPE_HW}, {.int_max = MM_PLAYER_CODEC_TYPE_SW}, NULL, }, diff --git a/src/mm_player_audioeffect.c b/src/mm_player_audioeffect.c index 809e096..ea50869 100644 --- a/src/mm_player_audioeffect.c +++ b/src/mm_player_audioeffect.c @@ -372,6 +372,33 @@ EXIT: 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(mmplayer_t *player) { @@ -500,42 +527,43 @@ mm_player_audio_effect_custom_clear_ext_all(MMHandleType hplayer) return result; } - int -mm_player_is_supported_preset_effect_type(MMHandleType hplayer, mm_audio_effect_preset_type_e effect) +mm_player_is_available_preset_effect(MMHandleType hplayer, mm_audio_effect_preset_type_e effect, bool *available) { mmplayer_t *player = (mmplayer_t *)hplayer; - int result = MM_ERROR_NONE; MMPLAYER_FENTER(); 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, mm_audio_effect_custom_type_e effect) +mm_player_is_available_custom_effect(MMHandleType hplayer, mm_audio_effect_custom_type_e effect, bool *available) { mmplayer_t *player = (mmplayer_t *)hplayer; - int result = MM_ERROR_NONE; MMPLAYER_FENTER(); - 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_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 @@ -608,9 +636,10 @@ __mmplayer_audio_effect_custom_set_level_ext(mmplayer_t *player, mm_audio_effect 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) { @@ -643,7 +672,6 @@ __mmplayer_audio_effect_custom_set_level_ext(mmplayer_t *player, mm_audio_effect return result; } - static int __mmplayer_audio_effect_custom_set_level_eq(mmplayer_t *player, int index, int level) { @@ -656,9 +684,10 @@ __mmplayer_audio_effect_custom_set_level_eq(mmplayer_t *player, int index, int l 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) { @@ -696,17 +725,19 @@ mm_player_audio_effect_custom_set_level(MMHandleType hplayer, mm_audio_effect_cu 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; + } + + 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 { - 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; - } + LOGE("out of range, effect type(%d)", effect_custom_type); + result = MM_ERROR_INVALID_ARGUMENT; } MMPLAYER_FLEAVE(); @@ -726,9 +757,10 @@ mm_player_audio_effect_custom_get_eq_bands_number(MMHandleType hplayer, int *ban 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; @@ -752,9 +784,10 @@ mm_player_audio_effect_custom_get_eq_bands_width(MMHandleType hplayer, int band_ 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; @@ -785,9 +818,10 @@ mm_player_audio_effect_custom_get_eq_bands_freq(MMHandleType hplayer, int band_i 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; @@ -818,9 +852,10 @@ mm_player_audio_effect_custom_get_level(MMHandleType hplayer, mm_audio_effect_cu 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) { @@ -860,9 +895,10 @@ mm_player_audio_effect_custom_get_level_range(MMHandleType hplayer, mm_audio_eff 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) { @@ -908,9 +944,10 @@ mm_player_audio_effect_custom_set_level_eq_from_list(MMHandleType hplayer, int * 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) { diff --git a/src/mm_player_ini.c b/src/mm_player_ini.c index 6ae73a5..b4a5101 100644 --- a/src/mm_player_ini.c +++ b/src/mm_player_ini.c @@ -34,9 +34,6 @@ #include /* internal functions, macros here */ -#ifdef MM_PLAYER_DEFAULT_INI -static gboolean __generate_default_ini(void); -#endif static void __get_element_list(mmplayer_ini_t *ini, gchar *str, int keyword_type); static void __mm_player_ini_check_ini_status(void); @@ -119,20 +116,6 @@ mm_player_ini_load(mmplayer_ini_t *ini) /* first, try to load existing ini file */ dict = iniparser_load(MM_PLAYER_INI_DEFAULT_PATH); - /* if no file exists. create one with set of default values */ - if (!dict) { -#ifdef MM_PLAYER_DEFAULT_INI - LOGD("No inifile found. player will create default inifile."); - if (__generate_default_ini() == FALSE) - LOGW("Creating default inifile failed. Player will use default values."); - else - dict = iniparser_load(MM_PLAYER_INI_DEFAULT_PATH); /* load default ini */ -#else - LOGD("No ini file found. "); - return MM_ERROR_FILE_NOT_FOUND; -#endif - } - /* get ini values */ memset(ini, 0, sizeof(mmplayer_ini_t)); @@ -146,28 +129,33 @@ mm_player_ini_load(mmplayer_ini_t *ini) ini->live_state_change_timeout = iniparser_getint(dict, "general:live state change timeout", DEFAULT_LIVE_STATE_CHANGE_TIMEOUT); ini->localplayback_state_change_timeout = iniparser_getint(dict, "general:localplayback state change timeout", DEFAULT_LOCALPLAYBACK_STATE_CHANGE_TIMEOUT); ini->eos_delay = iniparser_getint(dict, "general:eos delay", DEFAULT_EOS_DELAY); - ini->async_start = iniparser_getboolean(dict, "general:async start", DEFAULT_ASYNC_START); - ini->video_playback_supported = iniparser_getboolean(dict, "general:video playback supported", DEFAULT_VIDEO_PLAYBACK_SUPPORTED); ini->delay_before_repeat = iniparser_getint(dict, "general:delay before repeat", DEFAULT_DELAY_BEFORE_REPEAT); ini->pcm_buffer_size = iniparser_getint(dict, "general:pcm buffer size", DEFAULT_PCM_BUFFER_SIZE); ini->num_of_video_bo = iniparser_getint(dict, "general:video bo max", DEFAULT_NUM_OF_VIDEO_BO); ini->video_bo_timeout = iniparser_getint(dict, "general:video bo timeout", DEFAULT_TIMEOUT_OF_VIDEO_BO); + ini->support_audio_effect = iniparser_getboolean(dict, "general:support audio effect", DEFAULT_SUPPORT_AUDIO_EFFECT); + ini->support_pcm_exporting = iniparser_getboolean(dict, "general:support pcm exporting", DEFAULT_SUPPORT_PCM_EXPORTING); + ini->support_pitch_control = iniparser_getboolean(dict, "general:use pitch control", DEFAULT_SUPPORT_PITCH_CONTROL); + ini->support_replaygain_control = iniparser_getboolean(dict, "general:use replaygain control", DEFAULT_SUPPORT_REPLAYGAIN_CONTROL); MMPLAYER_INI_GET_STRING(dict, ini->audioresampler_element, "general:audio resampler element", DEFAULT_AUDIORESAMPLER); - MMPLAYER_INI_GET_STRING(dict, ini->audiocodec_element_hw, "general:audio codec element hw", DEFAULT_CODEC_HW); + MMPLAYER_INI_GET_STRING(dict, ini->audiocodec_element_hw, "general:audio codec element hw", DEFAULT_EMPTY_VALUE); + MMPLAYER_INI_GET_STRING(dict, ini->audiocodec_default_type, "general:audio codec default type", DEFAULT_EMPTY_VALUE); + MMPLAYER_INI_GET_STRING(dict, ini->videocodec_element_hw, "general:video codec element hw", DEFAULT_EMPTY_VALUE); + MMPLAYER_INI_GET_STRING(dict, ini->videocodec_default_type, "general:video codec default type", DEFAULT_EMPTY_VALUE); + MMPLAYER_INI_GET_STRING(dict, ini->audiosink_element, "general:audiosink element", DEFAULT_AUDIOSINK); MMPLAYER_INI_GET_STRING(dict, ini->audio_offload_sink_element, "general:audio offload sink element", DEFAULT_AUDIO_OFFLOAD_SINK); + MMPLAYER_INI_GET_STRING(dict, ini->videoconverter_element, "general:video converter element", DEFAULT_VIDEO_CONVERTER); MMPLAYER_INI_GET_STRING(dict, ini->videosink_element_overlay, "general:videosink element overlay", DEFAULT_VIDEOSINK_OVERLAY); MMPLAYER_INI_GET_STRING(dict, ini->videosink_element_fake, "general:videosink element fake", DEFAULT_VIDEOSINK_FAKE); - MMPLAYER_INI_GET_STRING(dict, ini->videocodec_element_hw, "general:video codec element hw", DEFAULT_CODEC_HW); - MMPLAYER_INI_GET_STRING(dict, ini->videoconverter_element, "general:video converter element", DEFAULT_VIDEO_CONVERTER); __get_element_list(ini, - iniparser_getstring(dict, "general:audio codec element sw", DEFAULT_CODEC_SW), KEYWORD_A_SW_CODEC); + iniparser_getstring(dict, "general:audio codec element sw", DEFAULT_EMPTY_VALUE), KEYWORD_A_SW_CODEC); __get_element_list(ini, - iniparser_getstring(dict, "general:video codec element sw", DEFAULT_CODEC_SW), KEYWORD_V_SW_CODEC); + iniparser_getstring(dict, "general:video codec element sw", DEFAULT_EMPTY_VALUE), KEYWORD_V_SW_CODEC); __get_element_list(ini, iniparser_getstring(dict, "general:element exclude keyword", DEFAULT_EXCLUDE_KEYWORD), KEYWORD_EXCLUDE); @@ -207,29 +195,34 @@ mm_player_ini_load(mmplayer_ini_t *ini) /* general */ ini->disable_segtrap = DEFAULT_DISABLE_SEGTRAP; ini->skip_rescan = DEFAULT_SKIP_RESCAN; - strncpy(ini->videosink_element_overlay, DEFAULT_VIDEOSINK_OVERLAY, PLAYER_INI_MAX_STRLEN - 1); - strncpy(ini->videosink_element_fake, DEFAULT_VIDEOSINK_FAKE, PLAYER_INI_MAX_STRLEN - 1); ini->generate_dot = DEFAULT_GENERATE_DOT; ini->use_system_clock = DEFAULT_USE_SYSTEM_CLOCK; ini->live_state_change_timeout = DEFAULT_LIVE_STATE_CHANGE_TIMEOUT; ini->localplayback_state_change_timeout = DEFAULT_LOCALPLAYBACK_STATE_CHANGE_TIMEOUT; ini->eos_delay = DEFAULT_EOS_DELAY; - ini->async_start = DEFAULT_ASYNC_START; ini->delay_before_repeat = DEFAULT_DELAY_BEFORE_REPEAT; - ini->video_playback_supported = DEFAULT_VIDEO_PLAYBACK_SUPPORTED; ini->pcm_buffer_size = DEFAULT_PCM_BUFFER_SIZE; ini->num_of_video_bo = DEFAULT_NUM_OF_VIDEO_BO; ini->video_bo_timeout = DEFAULT_TIMEOUT_OF_VIDEO_BO; + ini->support_audio_effect = DEFAULT_SUPPORT_AUDIO_EFFECT; + ini->support_pcm_exporting = DEFAULT_SUPPORT_PCM_EXPORTING; + ini->support_pitch_control = DEFAULT_SUPPORT_PITCH_CONTROL; + ini->support_replaygain_control = DEFAULT_SUPPORT_REPLAYGAIN_CONTROL; strncpy(ini->audioresampler_element, DEFAULT_AUDIORESAMPLER, PLAYER_INI_MAX_STRLEN - 1); + strncpy(ini->audiocodec_element_hw, DEFAULT_EMPTY_VALUE, PLAYER_INI_MAX_STRLEN - 1); + strncpy(ini->audiocodec_default_type, DEFAULT_EMPTY_VALUE, PLAYER_INI_MAX_STRLEN - 1); + strncpy(ini->videocodec_element_hw, DEFAULT_EMPTY_VALUE, PLAYER_INI_MAX_STRLEN - 1); + strncpy(ini->videocodec_default_type, DEFAULT_EMPTY_VALUE, PLAYER_INI_MAX_STRLEN - 1); + strncpy(ini->audiosink_element, DEFAULT_AUDIOSINK, PLAYER_INI_MAX_STRLEN - 1); strncpy(ini->audio_offload_sink_element, DEFAULT_AUDIO_OFFLOAD_SINK, PLAYER_INI_MAX_STRLEN - 1); - strncpy(ini->audiocodec_element_hw, DEFAULT_CODEC_HW, PLAYER_INI_MAX_STRLEN - 1); - strncpy(ini->videocodec_element_hw, DEFAULT_CODEC_HW, PLAYER_INI_MAX_STRLEN - 1); strncpy(ini->videoconverter_element, DEFAULT_VIDEO_CONVERTER, PLAYER_INI_MAX_STRLEN - 1); + strncpy(ini->videosink_element_overlay, DEFAULT_VIDEOSINK_OVERLAY, PLAYER_INI_MAX_STRLEN - 1); + strncpy(ini->videosink_element_fake, DEFAULT_VIDEOSINK_FAKE, PLAYER_INI_MAX_STRLEN - 1); - __get_element_list(ini, DEFAULT_CODEC_SW, KEYWORD_A_SW_CODEC); - __get_element_list(ini, DEFAULT_CODEC_SW, KEYWORD_V_SW_CODEC); + __get_element_list(ini, DEFAULT_EMPTY_VALUE, KEYWORD_A_SW_CODEC); + __get_element_list(ini, DEFAULT_EMPTY_VALUE, KEYWORD_V_SW_CODEC); __get_element_list(ini, DEFAULT_A_OFFLOAD_DEVICE_TYPE, KEYWORD_A_OFFLOAD_DEVICE_TYPE); __get_element_list(ini, DEFAULT_EMPTY_VALUE, KEYWORD_A_OFFLOAD_MEDIA_FORMAT); __get_element_list(ini, DEFAULT_EMPTY_VALUE, KEYWORD_MEDIA_STREAM_IN_FORMAT); @@ -285,8 +278,6 @@ mm_player_ini_load(mmplayer_ini_t *ini) LOGD("localplayback state change timeout(sec) : %d", ini->localplayback_state_change_timeout); LOGD("eos_delay(msec) : %d", ini->eos_delay); LOGD("delay before repeat(msec) : %d", ini->delay_before_repeat); - LOGD("async_start : %d", ini->async_start); - LOGD("video_playback_supported : %d", ini->video_playback_supported); LOGD("pcm buffer size(bytes) : %d", ini->pcm_buffer_size); LOGD("num of video bo : %d", ini->num_of_video_bo); LOGD("video bo timeout : %d", ini->video_bo_timeout); @@ -433,30 +424,6 @@ __mm_player_ini_check_ini_status(void) } } -#ifdef MM_PLAYER_DEFAULT_INI -static gboolean -__generate_default_ini(void) -{ - FILE *fp = NULL; - gchar *default_ini = MM_PLAYER_DEFAULT_INI; - - - /* create new file */ - fp = fopen(MM_PLAYER_INI_DEFAULT_PATH, "wt"); - if (!fp) - return FALSE; - - /* writing default ini file */ - if (strlen(default_ini) != fwrite(default_ini, 1, strlen(default_ini), fp)) { - fclose(fp); - return FALSE; - } - - fclose(fp); - return TRUE; -} -#endif - static void __get_element_list(mmplayer_ini_t *ini, gchar *str, int keyword_type) { diff --git a/src/mm_player_priv.c b/src/mm_player_priv.c index 80da1be..08c11fb 100644 --- a/src/mm_player_priv.c +++ b/src/mm_player_priv.c @@ -6234,8 +6234,7 @@ __mmplayer_pipeline_complete(GstElement *decodebin, gpointer data) LOGD("[handle: %p] pipeline has completely constructed", player); - if ((player->ini.async_start) && - (player->msg_posted == FALSE) && + if ((player->msg_posted == FALSE) && (player->cmd >= MMPLAYER_COMMAND_START)) __mmplayer_handle_missed_plugin(player); @@ -6698,13 +6697,6 @@ __mmplayer_gst_decode_autoplug_continue(GstElement *bin, GstPad *pad, "content_audio_codec", "mobile-xmf", strlen("mobile-xmf"), NULL); MMPLAYER_FREEIF(caps_str); - } else if (g_str_has_prefix(mime, "video") && !player->ini.video_playback_supported) { - MMMessageParamType msg_param; - memset(&msg_param, 0, sizeof(MMMessageParamType)); - msg_param.code = MM_ERROR_NOT_SUPPORT_API; - MMPLAYER_POST_MSG(player, MM_MESSAGE_ERROR, &msg_param); - LOGD("video file is not supported on this device"); - ret = FALSE; } else if (g_str_has_prefix(mime, "video") && player->videodec_linked) { LOGD("already video linked"); ret = FALSE; @@ -6968,6 +6960,10 @@ __mmplayer_check_codec_info(mmplayer_t *player, const char *klass, GstCaps *caps goto DONE; } + /* FIXME: If HW audio decoder is selected, related resource have to be acquired here. + And need to consider the multi-track audio content. + There is no HW audio decoder in public. */ + mm_attrs_get_int_by_name(player->attrs, "audio_codec_type", &codec_type); LOGD("audio codec type: %d", codec_type); @@ -8515,7 +8511,7 @@ _mmplayer_get_streaming_buffering_time(MMHandleType hplayer, int *prebuffer_ms, } int -_mmplayer_set_codec_type(MMHandleType hplayer, mmplayer_stream_type_e stream_type, mmplayer_video_codec_type_e codec_type) +_mmplayer_set_codec_type(MMHandleType hplayer, mmplayer_stream_type_e stream_type, mmplayer_codec_type_e codec_type) { #define IDX_FIRST_SW_CODEC 0 mmplayer_t *player = (mmplayer_t *)hplayer; @@ -8532,7 +8528,10 @@ _mmplayer_set_codec_type(MMHandleType hplayer, mmplayer_stream_type_e stream_typ case MM_PLAYER_STREAM_TYPE_AUDIO: /* to support audio codec selection, codec info have to be added in ini file as below. audio codec element hw = xxxx - audio codec element sw = avdec */ + audio codec element sw = avdec + and in case of audio hw codec is supported and selected, + audio filter elements should be applied depending on the hw capabilities. + */ if (((codec_type == MM_PLAYER_CODEC_TYPE_HW) && (!strcmp(player->ini.audiocodec_element_hw, ""))) || ((codec_type == MM_PLAYER_CODEC_TYPE_SW) && @@ -8703,7 +8702,7 @@ _mmplayer_get_video_roi_area(MMHandleType hplayer, double *scale_x, double *scal int _mmplayer_set_client_pid(MMHandleType hplayer, int pid) { - mmplayer_t* player = (mmplayer_t*)hplayer; + mmplayer_t *player = (mmplayer_t *)hplayer; MMPLAYER_FENTER(); @@ -8718,6 +8717,75 @@ _mmplayer_set_client_pid(MMHandleType hplayer, int pid) return MM_ERROR_NONE; } +int +_mmplayer_is_audio_control_available(MMHandleType hplayer, mmplayer_audio_control_opt_e opt, bool *available) +{ + mmplayer_t *player = (mmplayer_t *)hplayer; + mmplayer_codec_type_e codec_type = MM_PLAYER_CODEC_TYPE_DEFAULT; + enum audio_element_id elem_id = MMPLAYER_A_NUM; + + MMPLAYER_FENTER(); + + MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED); + MMPLAYER_RETURN_VAL_IF_FAIL(available, MM_ERROR_INVALID_ARGUMENT); + + *available = true; + mm_attrs_get_int_by_name(player->attrs, MM_PLAYER_AUDIO_CODEC_TYPE, (int *)&codec_type); + + LOGD("current state %d, codec_type %d", MMPLAYER_CURRENT_STATE(player), codec_type); + + if (codec_type == MM_PLAYER_CODEC_TYPE_SW) + return MM_ERROR_NONE; + + /* in case of audio codec default type is HW */ + switch(opt) { + case MM_PLAYER_AUDIO_CONTROL_OPT_EFFECT: + if (player->ini.support_audio_effect) + return MM_ERROR_NONE; + elem_id = MMPLAYER_A_FILTER; + break; + case MM_PLAYER_AUDIO_CONTROL_OPT_REPLAYGAIN: + if (player->ini.support_replaygain_control) + return MM_ERROR_NONE; + elem_id = MMPLAYER_A_RGVOL; + break; + case MM_PLAYER_AUDIO_CONTROL_OPT_PITCH: + if (player->ini.support_pitch_control) + return MM_ERROR_NONE; + elem_id = MMPLAYER_A_PITCH; + break; + case MM_PLAYER_AUDIO_CONTROL_OPT_PCM_EXPORTING: + if (player->ini.support_audio_effect) + return MM_ERROR_NONE; + break; + /* default case handling is not required */ + } + + if (MMPLAYER_CURRENT_STATE(player) < MM_PLAYER_STATE_READY) { + LOGW("audio control option [%d] is not available", opt); + *available = false; + } else { + /* setting pcm exporting option is allowed before READY state */ + if (opt == MM_PLAYER_AUDIO_CONTROL_OPT_PCM_EXPORTING) + return MM_ERROR_PLAYER_INVALID_STATE; + + /* check whether the audio filter exist or not after READY state, + because the sw codec could be added during auto-plugging in some cases */ + if (!player->pipeline || + !player->pipeline->audiobin || + !player->pipeline->audiobin[elem_id].gst) { + LOGW("there is no audio elem [%d]", elem_id); + *available = false; + } + } + + LOGD("audio control opt %d, available %d", opt, *available); + + MMPLAYER_FLEAVE(); + + return MM_ERROR_NONE; +} + static gboolean __mmplayer_update_duration_value(mmplayer_t *player) { -- 2.7.4