Name: libmm-player
Summary: Multimedia Framework Player Library
-Version: 0.2.6
+Version: 0.2.7
Release: 0
Group: System/Libraries
License: TBD
includelibmmfplayer_HEADERS = include/mm_player.h \
include/mm_player_internal.h \
- include/mm_player_sndeffect.h
+ include/mm_player_audioeffect.h
libmmfplayer_la_SOURCES = mm_player.c \
mm_player_priv.c \
mm_player_capture.c \
mm_player_pd.c \
mm_player_streaming.c \
- mm_player_sndeffect.c
+ mm_player_audioeffect.c
libmmfplayer_la_CFLAGS = -I$(srcdir)/include \
$(MMCOMMON_CFLAGS) \
--- /dev/null
+/*
+ * libmm-player
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: JongHyuk Choi <jhchoi.choi@samsung.com>, YeJin Cho <cho.yejin@samsung.com>,
+ * Seungbae Shin <seungbae.shin@samsung.com>, YoungHwan An <younghwan_.an@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef __MM_PLAYER_AUDIOEFFECT_H__
+#define __MM_PLAYER_AUDIOEFFECT_H__
+
+#include <mm_types.h>
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+#define MM_AUDIO_EFFECT_EQ_BAND_NUM_MAX 10
+#define MM_AUDIO_EFFECT_CUSTOM_LEVEL_INIT 0
+
+/**
+ @addtogroup PLAYER_INTERNAL
+
+*/
+
+/**
+ * Enumerations of Audio Effect Preset Type
+ */
+typedef enum {
+ MM_AUDIO_EFFECT_PRESET_AUTO = 0, /**< Preset type Auto */
+ MM_AUDIO_EFFECT_PRESET_NORMAL, /**< Preset type Normal */
+ MM_AUDIO_EFFECT_PRESET_POP, /**< Preset type Pop */
+ MM_AUDIO_EFFECT_PRESET_ROCK, /**< Preset type Rock */
+ MM_AUDIO_EFFECT_PRESET_DANCE, /**< Preset type Dance */
+ MM_AUDIO_EFFECT_PRESET_JAZZ, /**< Preset type Jazz */
+ MM_AUDIO_EFFECT_PRESET_CLASSIC, /**< Preset type Classic */
+ MM_AUDIO_EFFECT_PRESET_VOCAL, /**< Preset type Vocal */
+ MM_AUDIO_EFFECT_PRESET_BASS_BOOST, /**< Preset type Bass Boost */
+ MM_AUDIO_EFFECT_PRESET_TREBLE_BOOST, /**< Preset type Treble Boost */
+ MM_AUDIO_EFFECT_PRESET_MTHEATER, /**< Preset type MTheater */
+ MM_AUDIO_EFFECT_PRESET_EXT, /**< Preset type Externalization */
+ MM_AUDIO_EFFECT_PRESET_CAFE, /**< Preset type Cafe */
+ MM_AUDIO_EFFECT_PRESET_CONCERT_HALL, /**< Preset type Concert Hall */
+ MM_AUDIO_EFFECT_PRESET_VOICE, /**< Preset type Voice */
+ MM_AUDIO_EFFECT_PRESET_MOVIE, /**< Preset type Movie */
+ MM_AUDIO_EFFECT_PRESET_VIRT51, /**< Preset type Virtual 5.1 */
+ MM_AUDIO_EFFECT_PRESET_HIPHOP, /**< Preset type HipHop */
+ MM_AUDIO_EFFECT_PRESET_RNB, /**< Preset type R&B */
+ MM_AUDIO_EFFECT_PRESET_FLAT, /**< Preset type Flat */
+ MM_AUDIO_EFFECT_PRESET_NUM, /**< Number of Preset type */
+} MMAudioEffectPresetType;
+
+/**
+ * Enumerations of Audio Effect Custom Type
+ */
+typedef enum {
+ MM_AUDIO_EFFECT_CUSTOM_EQ = 0, /**< Custom type Equalizer */
+ MM_AUDIO_EFFECT_CUSTOM_3D, /**< Custom type 3D */
+ MM_AUDIO_EFFECT_CUSTOM_BASS, /**< Custom type Bass */
+ MM_AUDIO_EFFECT_CUSTOM_ROOM_SIZE, /**< Custom type Room Size */
+ MM_AUDIO_EFFECT_CUSTOM_REVERB_LEVEL, /**< Custom type Reverb Level */
+ MM_AUDIO_EFFECT_CUSTOM_CLARITY, /**< Custom type Clarity */
+ MM_AUDIO_EFFECT_CUSTOM_NUM, /**< Number of Custom type */
+} MMAudioEffectCustomType;
+
+/**
+ * Enumerations of Audio Effect Type
+ */
+typedef enum {
+ MM_AUDIO_EFFECT_TYPE_NONE,
+ MM_AUDIO_EFFECT_TYPE_PRESET,
+ MM_AUDIO_EFFECT_TYPE_CUSTOM,
+} MMAudioEffectType;
+
+
+/**
+ * Enumerations of Output Mode
+ */
+typedef enum {
+ MM_AUDIO_EFFECT_OUTPUT_SPK, /**< Speaker out */
+ MM_AUDIO_EFFECT_OUTPUT_EAR /**< Earjack out */
+} MMAudioEffectOutputMode;
+
+
+/**
+ * Structure of AudioEffectInfo
+ */
+typedef struct {
+ MMAudioEffectType effect_type; /**< effect type, (NONE,PRESET,CUSTOM)*/
+ MMAudioEffectPresetType preset; /**< for preset type*/
+ int *custom_ext_level_for_plugin; /**< for custom type, level value list of Extension effects*/
+ int custom_eq_level[MM_AUDIO_EFFECT_EQ_BAND_NUM_MAX]; /**< for custom type, EQ info*/
+ int custom_ext_level[MM_AUDIO_EFFECT_CUSTOM_NUM-1]; /**< for custom type, Extension effect info*/
+} MMAudioEffectInfo;
+
+
+/**
+ * @brief Called to get each supported audio effect.
+ *
+ * @param effect_type [in] Type of effect (preset effect or custom effect).
+ * @param effect [in] Supported audio effect.
+ * @param user_data [in] Pointer of user data.
+ *
+ * @return True to continue with the next iteration of the loop, False to break out of the loop.
+ * @see mm_player_get_foreach_present_supported_effect_type()
+ */
+typedef bool (*mmplayer_supported_audio_effect_cb) (int effect_type, int type, void *user_data);
+
+/**
+ * This function is to get supported effect type.
+ *
+ * @param hplayer [in] Handle of player.
+ * @param effect_type [in] Type of effect.
+ * @param foreach_cb [in] Callback function to be passed the result.
+ * @param user_data [in] Pointer of user data.
+ *
+ * @return This function returns zero on success, or negative value with error code.
+ *
+ * @remark
+ * @see
+ * @since
+ */
+int mm_player_get_foreach_present_supported_effect_type(MMHandleType player, MMAudioEffectType effect_type, mmplayer_supported_audio_effect_cb foreach_cb, void *user_data);
+
+/**
+ * This function is to bypass audio effect.
+ *
+ * @param hplayer [in] Handle of player.
+ *
+ * @return This function returns zero on success, or negative value with error code.
+ *
+ * @remark
+ * @see
+ * @since
+ */
+int mm_player_audio_effect_bypass (MMHandleType hplayer);
+
+/**
+ * This function is to apply preset effect.
+ *
+ * @param hplayer [in] Handle of player.
+ * @param type [in] Preset type effect.
+ *
+ * @return This function returns zero on success, or negative value with error code.
+ *
+ * @remark
+ * @see MMAudioEffectPresetType
+ * @since
+ */
+int mm_player_audio_effect_preset_apply(MMHandleType hplayer, MMAudioEffectPresetType type);
+
+/**
+ * This function is to apply custom effect(Equalizer and Extension effects).
+ *
+ * @param hplayer [in] Handle of player.
+ *
+ * @return This function returns zero on success, or negative value with error code.
+ *
+ * @remark
+ * @see
+ * @since
+ */
+int mm_player_audio_effect_custom_apply(MMHandleType hplayer);
+
+/**
+ * This function is to clear Equalizer custom effect.
+ *
+ * @param hplayer [in] Handle of player.
+ *
+ * @return This function returns zero on success, or negative value with error code.
+ *
+ * @remark
+ * @see
+ * @since
+ */
+int mm_player_audio_effect_custom_clear_eq_all(MMHandleType hplayer);
+
+/**
+ * This function is to clear Extension custom effects.
+ *
+ * @param hplayer [in] Handle of player.
+ *
+ * @return This function returns zero on success, or negative value with error code.
+ *
+ * @remark
+ * @see
+ * @since
+ */
+int mm_player_audio_effect_custom_clear_ext_all(MMHandleType hplayer);
+
+/**
+ * This function is to get the number of equalizer bands.
+ *
+ * @param hplayer [in] Handle of player.
+ * @param bands [out] The number of bands.
+ *
+ * @return This function returns zero on success, or negative value with error code.
+ *
+ * @remark
+ * @see
+ * @since
+ */
+int mm_player_audio_effect_custom_get_eq_bands_number(MMHandleType hplayer, int *bands);
+
+/**
+ * This function is to get width of equalizer band of each index.
+ *
+ * @param hplayer [in] Handle of player.
+ * @param band_idx [in] Index of band.
+ * @param width [out] Value of width.
+ *
+ * @return This function returns zero on success, or negative value with error code.
+ *
+ * @remark
+ * @see
+ * @since
+ */
+int mm_player_audio_effect_custom_get_eq_bands_width(MMHandleType hplayer, int band_idx, int *width);
+
+/**
+ * This function is to get frequency of equalizer band of each index.
+ *
+ * @param hplayer [in] Handle of player.
+ * @param band_idx [in] Index of band.
+ * @param freq [out] Value of frequency.
+ *
+ * @return This function returns zero on success, or negative value with error code.
+ *
+ * @remark
+ * @see
+ * @since
+ */
+int mm_player_audio_effect_custom_get_eq_bands_freq(MMHandleType hplayer, int band_idx, int *freq);
+
+/**
+ * This function is to get the level of the custom effect.
+ *
+ * @param hplayer [in] Handle of player.
+ * @param type [in] Custom type effect.
+ * @param eq_index [in] Equalizer band index. This parameter is available only when the type is MM_AUDIO_EFFECT_CUSTOM_EQ.
+ * @param level [out] The level of the custom effect.
+ *
+ * @return This function returns zero on success, or negative value with error code.
+ *
+ * @remark
+ * @see MMAudioEffectCustomType
+ * @since
+ */
+int mm_player_audio_effect_custom_get_level(MMHandleType hplayer, MMAudioEffectCustomType type, int eq_index, int *level);
+
+/**
+ * This function is to get range of the level of the custom effect.
+ *
+ * @param hplayer [in] Handle of player.
+ * @param type [in] Custom type effect.
+ * @param min [out] Minimal value of level.
+ * @param max [out] Maximum value of level.
+ *
+ * @return This function returns zero on success, or negative value with error code.
+ *
+ * @remark
+ * @see MMAudioEffectCustomType
+ * @since
+ */
+int mm_player_audio_effect_custom_get_level_range(MMHandleType hplayer, MMAudioEffectCustomType type, int *min, int *max);
+
+/**
+ * This function is to set the level of the custom effect.
+ *
+ * @param hplayer [in] Handle of player.
+ * @param type [in] Custom type effect.
+ * @param eq_index [in] Equalizer band index. This parameter is available only when the type is MM_AUDIO_EFFECT_CUSTOM_EQ.
+ * @param level [in] The level of the custom effect.
+ *
+ * @return This function returns zero on success, or negative value with error code.
+ *
+ * @remark
+ * @see MMAudioEffectCustomType
+ * @since
+ */
+int mm_player_audio_effect_custom_set_level(MMHandleType hplayer, MMAudioEffectCustomType effect_custom_type, int eq_index, int level);
+
+/**
+ * This function is to set the bands level of equalizer custom effect using input list.
+ *
+ * @param hplayer [in] Handle of player.
+ * @param level_list [in] list of bands level of equalizer custom audio_effect want to set.
+ * @param size [in] size of level_list.
+ *
+ * @return This function returns zero on success, or negative value with error code.
+ *
+ * @remark
+ * @see
+ * @since
+ */
+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
+ */
+int mm_player_is_supported_preset_effect_type(MMHandleType hplayer, MMAudioEffectPresetType effect);
+
+/**
+ * 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
+ */
+int mm_player_is_supported_custom_effect_type(MMHandleType hplayer, MMAudioEffectCustomType effect);
+
+/**
+ @}
+ */
+
+#ifdef __cplusplus
+ }
+#endif
+
+#endif /* __MM_PLAYER_AUDIOEFFECT_H__ */
#include <glib.h>
#include <mm_types.h>
-#include "mm_player_sndeffect.h"
+#include "mm_player_audioeffect.h"
#ifdef __cplusplus
extern "C" {
#define MM_PLAYER_INI_DEFAULT_PATH "/usr/etc/mmfw_player.ini"
+#define MM_PLAYER_INI_DEFAULT_AUDIOEFFECT_PATH "/usr/etc/mmfw_player_audio_effect.ini"
#define PLAYER_INI() mm_player_ini_get_structure()
gboolean async_start;
gboolean disable_segtrap;
- /* audio filter */
- gboolean use_audio_filter_preset;
- gboolean audio_filter_preset_list[MM_AUDIO_FILTER_PRESET_NUM];
- gboolean audio_filter_preset_earphone_only_list[MM_AUDIO_FILTER_PRESET_NUM];
+ /* audio effect */
+ gchar name_of_audio_effect[PLAYER_INI_MAX_STRLEN];
- gboolean use_audio_filter_custom;
- gboolean audio_filter_custom_list[MM_AUDIO_FILTER_CUSTOM_NUM];
- gboolean audio_filter_custom_earphone_only_list[MM_AUDIO_FILTER_CUSTOM_NUM];
- gint audio_filter_custom_eq_num;
- gint audio_filter_custom_ext_num;
- gint audio_filter_custom_min_level_list[MM_AUDIO_FILTER_CUSTOM_NUM];
- gint audio_filter_custom_max_level_list[MM_AUDIO_FILTER_CUSTOM_NUM];
+ gboolean use_audio_effect_preset;
+ gboolean audio_effect_preset_list[MM_AUDIO_EFFECT_PRESET_NUM];
+ gboolean audio_effect_preset_earphone_only_list[MM_AUDIO_EFFECT_PRESET_NUM];
+
+ gboolean use_audio_effect_custom;
+ gboolean audio_effect_custom_list[MM_AUDIO_EFFECT_CUSTOM_NUM];
+ gboolean audio_effect_custom_earphone_only_list[MM_AUDIO_EFFECT_CUSTOM_NUM];
+ gint audio_effect_custom_eq_band_num;
+ gint audio_effect_custom_eq_band_width[MM_AUDIO_EFFECT_EQ_BAND_NUM_MAX];
+ gint audio_effect_custom_eq_band_freq[MM_AUDIO_EFFECT_EQ_BAND_NUM_MAX];
+ gint audio_effect_custom_ext_num;
+ gint audio_effect_custom_min_level_list[MM_AUDIO_EFFECT_CUSTOM_NUM];
+ gint audio_effect_custom_max_level_list[MM_AUDIO_EFFECT_CUSTOM_NUM];
/* http streaming */
gchar name_of_httpsrc[PLAYER_INI_MAX_STRLEN]; // @
/* default values if each values are not specified in inifile */
/* general */
#define DEFAULT_USE_DECODEBIN FALSE
-#define DEFAULT_USE_AUDIO_FILTER_PRESET FALSE
-#define DEFAULT_AUDIO_FILTER_PRESET_LIST ""
-#define DEFAULT_AUDIO_FILTER_PRESET_LIST_EARPHONE_ONLY ""
-#define DEFAULT_USE_AUDIO_FILTER_CUSTOM FALSE
-#define DEFAULT_AUDIO_FILTER_CUSTOM_LIST ""
-#define DEFAULT_AUDIO_FILTER_CUSTOM_LIST_EARPHONE_ONLY ""
-#define DEFAULT_AUDIO_FILTER_CUSTOM_EQ_NUM 0
-#define DEFAULT_AUDIO_FILTER_CUSTOM_EQ_MIN 0
-#define DEFAULT_AUDIO_FILTER_CUSTOM_EQ_MAX 0
-#define DEFAULT_AUDIO_FILTER_CUSTOM_EXT_NUM 0
+#define DEFAULT_AUDIO_EFFECT_ELEMENT ""
+#define DEFAULT_USE_AUDIO_EFFECT_PRESET FALSE
+#define DEFAULT_AUDIO_EFFECT_PRESET_LIST ""
+#define DEFAULT_AUDIO_EFFECT_PRESET_LIST_EARPHONE_ONLY ""
+#define DEFAULT_USE_AUDIO_EFFECT_CUSTOM FALSE
+#define DEFAULT_AUDIO_EFFECT_CUSTOM_LIST ""
+#define DEFAULT_AUDIO_EFFECT_CUSTOM_LIST_EARPHONE_ONLY ""
+#define DEFAULT_AUDIO_EFFECT_CUSTOM_EQ_BAND_NUM 0
+#define DEFAULT_AUDIO_EFFECT_CUSTOM_EQ_BAND_WIDTH ""
+#define DEFAULT_AUDIO_EFFECT_CUSTOM_EQ_BAND_FREQ ""
+#define DEFAULT_AUDIO_EFFECT_CUSTOM_EQ_MIN 0
+#define DEFAULT_AUDIO_EFFECT_CUSTOM_EQ_MAX 0
+#define DEFAULT_AUDIO_EFFECT_CUSTOM_EXT_NUM 0
#define DEFAULT_USE_SINK_HANDLER TRUE
#define DEFAULT_SKIP_RESCAN TRUE
#define DEFAULT_GENERATE_DOT FALSE
#include "mm_player.h"
#include "mm_player_internal.h"
-#include "mm_player_sndeffect.h"
+#include "mm_player_audioeffect.h"
#include "mm_message.h"
#include "mm_player_utils.h"
#include "mm_player_asm.h"
/* video stream caps parsed by demuxer */
GstCaps* v_stream_caps;
- /* audio filter infomation */
- MMAudioFilterInfo audio_filter_info;
- gboolean bypass_sound_effect;
+ /* audio effect infomation */
+ MMAudioEffectInfo audio_effect_info;
+ gboolean bypass_audio_effect;
gulong audio_cb_probe_id;
+++ /dev/null
-/*
- * libmm-player
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: JongHyuk Choi <jhchoi.choi@samsung.com>, YeJin Cho <cho.yejin@samsung.com>, YoungHwan An <younghwan_.an@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#ifndef __MM_PLAYER_SNDEFFECT_H__
-#define __MM_PLAYER_SNDEFFECT_H__
-
-#include <mm_types.h>
-
-#ifdef __cplusplus
- extern "C" {
-#endif
-
-#define MM_AUDIO_FILTER_EQ_BAND_MAX 8
-#define MM_AUDIO_FILTER_CUSTOM_LEVEL_INIT 0
-
-/**
- @addtogroup PLAYER_INTERNAL
-
-*/
-
-/**
- * Enumerations of Preset Filter Type
- */
-typedef enum {
- MM_AUDIO_FILTER_PRESET_AUTO = 0, /**< Filter Preset type Auto */
- MM_AUDIO_FILTER_PRESET_NORMAL, /**< Filter Preset type Normal */
- MM_AUDIO_FILTER_PRESET_POP, /**< Filter Preset type Pop */
- MM_AUDIO_FILTER_PRESET_ROCK, /**< Filter Preset type Rock */
- MM_AUDIO_FILTER_PRESET_DANCE, /**< Filter Preset type Dance */
- MM_AUDIO_FILTER_PRESET_JAZZ, /**< Filter Preset type Jazz */
- MM_AUDIO_FILTER_PRESET_CLASSIC, /**< Filter Preset type Classic */
- MM_AUDIO_FILTER_PRESET_VOCAL, /**< Filter Preset type Vocal */
- MM_AUDIO_FILTER_PRESET_BASS_BOOST, /**< Filter Preset type Bass Boost */
- MM_AUDIO_FILTER_PRESET_TREBLE_BOOST, /**< Filter Preset type Treble Boost */
- MM_AUDIO_FILTER_PRESET_MTHEATER, /**< Filter Preset type MTheater */
- MM_AUDIO_FILTER_PRESET_EXT, /**< Filter Preset type Externalization */
- MM_AUDIO_FILTER_PRESET_CAFE, /**< Filter Preset type Cafe */
- MM_AUDIO_FILTER_PRESET_CONCERT_HALL, /**< Filter Preset type Concert Hall */
- MM_AUDIO_FILTER_PRESET_VOICE, /**< Filter Preset type Voice */
- MM_AUDIO_FILTER_PRESET_MOVIE, /**< Filter Preset type Movie */
- MM_AUDIO_FILTER_PRESET_VIRT51, /**< Filter Preset type Virtual 5.1 */
- MM_AUDIO_FILTER_PRESET_NUM, /**< Number of Filter Preset type */
-} MMAudioFilterPresetType;
-
-/**
- * Enumerations of Custom Filter Type
- */
-typedef enum {
- MM_AUDIO_FILTER_CUSTOM_EQ = 0, /**< Filter Custom type Equalizer */
- MM_AUDIO_FILTER_CUSTOM_3D, /**< Filter Custom type 3D */
- MM_AUDIO_FILTER_CUSTOM_BASS, /**< Filter Custom type Bass */
- MM_AUDIO_FILTER_CUSTOM_ROOM_SIZE, /**< Filter Custom type Room Size */
- MM_AUDIO_FILTER_CUSTOM_REVERB_LEVEL, /**< Filter Custom type Reverb Level */
- MM_AUDIO_FILTER_CUSTOM_CLARITY, /**< Filter Custom type Clarity */
- MM_AUDIO_FILTER_CUSTOM_NUM, /**< Number of Filter Custom type */
-} MMAudioFilterCustomType;
-
-/**
- * Enumerations of Filter Type
- */
-typedef enum {
- MM_AUDIO_FILTER_TYPE_NONE,
- MM_AUDIO_FILTER_TYPE_PRESET,
- MM_AUDIO_FILTER_TYPE_CUSTOM,
-} MMAudioFilterType;
-
-
-/**
- * Enumerations of Output Mode
- */
-typedef enum {
- MM_AUDIO_FILTER_OUTPUT_SPK, /**< Speaker out */
- MM_AUDIO_FILTER_OUTPUT_EAR /**< Earjack out */
-} MMAudioFilterOutputMode;
-
-
-/**
- * Structure of FilterInfo
- */
-typedef struct {
- MMAudioFilterType filter_type; /**< Filter type, (NONE,PRESET,CUSTOM)*/
- MMAudioFilterPresetType preset; /**< for preset type*/
- int *custom_ext_level_for_plugin; /**< for custom type, level value list of extension filters*/
- int custom_eq_level[MM_AUDIO_FILTER_EQ_BAND_MAX]; /**< for custom type, EQ info*/
- int custom_ext_level[MM_AUDIO_FILTER_CUSTOM_NUM-1]; /**< for custom type, extension filter info*/
-} MMAudioFilterInfo;
-
-
-/**
- * @brief Called to get each supported sound filter.
- *
- * @param filter_type [in] Type of filter (preset filter or custom filter).
- * @param filter [in] Supported sound filter.
- * @param user_data [in] Pointer of user data.
- *
- * @return True to continue with the next iteration of the loop, False to break outsp of the loop.
- * @see mm_player_get_foreach_present_supported_filter_type()
- */
-typedef bool (*mmplayer_supported_sound_filter_cb) (int filter_type, int type, void *user_data);
-
-/**
- * This function is to get supported filter type.
- *
- * @param hplayer [in] Handle of player.
- * @param filter_type [in] Type of filter.
- * @param foreach_cb [in] Callback function to be passed the result.
- * @param user_data [in] Pointer of user data.
- *
- * @return This function returns zero on success, or negative value with error code.
- *
- * @remark
- * @see
- * @since
- */
-int mm_player_get_foreach_present_supported_filter_type(MMHandleType player, MMAudioFilterType filter_type, mmplayer_supported_sound_filter_cb foreach_cb, void *user_data);
-
-/**
- * This function is to bypass sound effect.
- *
- * @param hplayer [in] Handle of player.
- *
- * @return This function returns zero on success, or negative value with error code.
- *
- * @remark
- * @see
- * @since
- */
-int mm_player_sound_filter_bypass (MMHandleType hplayer);
-
-/**
- * This function is to apply preset filter.
- *
- * @param hplayer [in] Handle of player.
- * @param type [in] Preset type filter.
- *
- * @return This function returns zero on success, or negative value with error code.
- *
- * @remark
- * @see MMAudioFilterPresetType
- * @since
- */
-int mm_player_sound_filter_preset_apply(MMHandleType hplayer, MMAudioFilterPresetType type);
-
-/**
- * This function is to apply custom filter(Equalizer and Extension filters).
- *
- * @param hplayer [in] Handle of player.
- *
- * @return This function returns zero on success, or negative value with error code.
- *
- * @remark
- * @see
- * @since
- */
-int mm_player_sound_filter_custom_apply(MMHandleType hplayer);
-
-/**
- * This function is to clear Equalizer custom filter.
- *
- * @param hplayer [in] Handle of player.
- *
- * @return This function returns zero on success, or negative value with error code.
- *
- * @remark
- * @see
- * @since
- */
-int mm_player_sound_filter_custom_clear_eq_all(MMHandleType hplayer);
-
-/**
- * This function is to clear Extension custom filters.
- *
- * @param hplayer [in] Handle of player.
- *
- * @return This function returns zero on success, or negative value with error code.
- *
- * @remark
- * @see
- * @since
- */
-int mm_player_sound_filter_custom_clear_ext_all(MMHandleType hplayer);
-
-/**
- * This function is to get the number of equalizer bands.
- *
- * @param hplayer [in] Handle of player.
- * @param bands [out] The number of bands.
- *
- * @return This function returns zero on success, or negative value with error code.
- *
- * @remark
- * @see
- * @since
- */
-int mm_player_sound_filter_custom_get_eq_bands_number(MMHandleType hplayer, int *bands);
-
-/**
- * This function is to get the level of the custom filter.
- *
- * @param hplayer [in] Handle of player.
- * @param type [in] Custom type filter.
- * @param eq_index [in] Equalizer band index. This parameter is available only when the type is MM_AUDIO_FILTER_CUSTOM_EQ.
- * @param level [out] The level of the custom filter.
- *
- * @return This function returns zero on success, or negative value with error code.
- *
- * @remark
- * @see MMAudioFilterCustomType
- * @since
- */
-int mm_player_sound_filter_custom_get_level(MMHandleType hplayer, MMAudioFilterCustomType type, int eq_index, int *level);
-
-/**
- * This function is to get range of the level of the custom filter.
- *
- * @param hplayer [in] Handle of player.
- * @param type [in] Custom type filter.
- * @param min [out] Minimal value of level.
- * @param max [out] Maximum value of level.
- *
- * @return This function returns zero on success, or negative value with error code.
- *
- * @remark
- * @see MMAudioFilterCustomType
- * @since
- */
-int mm_player_sound_filter_custom_get_level_range(MMHandleType hplayer, MMAudioFilterCustomType type, int *min, int *max);
-
-/**
- * This function is to set the level of the custom filter.
- *
- * @param hplayer [in] Handle of player.
- * @param type [in] Custom type filter.
- * @param eq_index [in] Equalizer band index. This parameter is available only when the type is MM_AUDIO_FILTER_CUSTOM_EQ.
- * @param level [in] The level of the custom filter.
- *
- * @return This function returns zero on success, or negative value with error code.
- *
- * @remark
- * @see MMAudioFilterCustomType
- * @since
- */
-int mm_player_sound_filter_custom_set_level(MMHandleType hplayer, MMAudioFilterCustomType filter_custom_type, int eq_index, int level);
-
-/**
- * This function is to set the bands level of equalizer custom filter using input list.
- *
- * @param hplayer [in] Handle of player.
- * @param level_list [in] list of bands level of equalizer custom filter want to set.
- * @param size [in] size of level_list.
- *
- * @return This function returns zero on success, or negative value with error code.
- *
- * @remark
- * @see
- * @since
- */
-int mm_player_sound_filter_custom_set_level_eq_from_list(MMHandleType hplayer, int *level_list, int size);
-
-/**
- * This function is to decide if the preset type filter is supported or not
- *
- * @param hplayer [in] Handle of player.
- * @param filter [in] Preset type filter.
- *
- * @return This function returns zero on success, or negative value with error code.
- *
- * @remark
- * @see
- * @since
- */
-int mm_player_is_supported_preset_filter_type(MMHandleType hplayer, MMAudioFilterPresetType filter);
-
-/**
- * This function is to decide if the custom type filter is supported or not
- *
- * @param hplayer [in] Handle of player.
- * @param filter [in] Custom type filter.
- *
- * @return This function returns zero on success, or negative value with error code.
- *
- * @remark
- * @see
- * @since
- */
-int mm_player_is_supported_custom_filter_type(MMHandleType hplayer, MMAudioFilterCustomType filter);
-
-/**
- @}
- */
-
-#ifdef __cplusplus
- }
-#endif
-
-#endif /* __MM_PLAYER_SNDEFFECT_H__ */
__ta__("mm_player_ini_load",
result = mm_player_ini_load();
)
+ if(result != MM_ERROR_NONE)
+ return result;
+ __ta__("mm_player_audio_effect_ini_load",
+ result = mm_player_audio_effect_ini_load();
+ )
if(result != MM_ERROR_NONE)
- return MM_ERROR_PLAYER_INTERNAL;
+ return result;
/* alloc player structure */
new_player = g_malloc(sizeof(mm_player_t));
event_type = ASM_EVENT_ALARM;
break;
- case MM_SOUND_VOLUME_TYPE_EMERGENCY:
+ case MM_SESSION_TYPE_EMERGENCY:
event_type = ASM_EVENT_EMERGENCY;
break;
--- /dev/null
+/*
+ * libmm-player
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: JongHyuk Choi <jhchoi.choi@samsung.com>,YeJin Cho <cho.yejin@samsung.com>, YoungHwan An <younghwan_.an@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+#include <mm_error.h>
+
+#include "mm_player_audioeffect.h"
+#include "mm_player_ini.h"
+#include "mm_player_priv.h"
+#include <mm_sound.h>
+
+
+int
+mm_player_get_foreach_present_supported_effect_type(MMHandleType player, MMAudioEffectType effect_type, mmplayer_supported_audio_effect_cb foreach_cb, void *user_data)
+{
+ int result = MM_ERROR_NONE;
+ mm_sound_device_in device_in;
+ mm_sound_device_out device_out;
+ int i = 0;
+
+ debug_fenter();
+
+ return_val_if_fail ( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+
+ /* get status if speaker is activated */
+ result = mm_sound_get_active_device(&device_in, &device_out);
+ if ( result ) {
+ debug_fleave();
+ debug_error("mm_sound_get_active_device() failed [%x]!!", result);
+ return result;
+ }
+
+ /* 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 (device_out == MM_SOUND_DEVICE_OUT_SPEAKER &&
+ PLAYER_INI()->audio_effect_preset_earphone_only_list[i])
+ {
+ continue;
+ }
+ if (!foreach_cb(effect_type,i, user_data))
+ {
+ goto CALLBACK_ERROR;
+ }
+ }
+ }
+ }
+ /* 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] )
+ {
+ if (device_out == MM_SOUND_DEVICE_OUT_SPEAKER &&
+ PLAYER_INI()->audio_effect_custom_earphone_only_list[i])
+ {
+ continue;
+ }
+ if (!foreach_cb(effect_type,i, user_data))
+ {
+ goto CALLBACK_ERROR;
+ }
+ }
+ }
+ }
+ else
+ {
+ debug_error("invalid effect type(%d)", effect_type);
+ result = MM_ERROR_INVALID_ARGUMENT;
+ }
+
+ debug_fleave();
+
+ return result;
+
+CALLBACK_ERROR:
+ debug_error("foreach callback returned error");
+ debug_fleave();
+ return MM_ERROR_PLAYER_INTERNAL;
+}
+
+
+int
+__mmplayer_set_harmony_effect(mm_player_t *player, GstElement *audio_effect_element)
+{
+ gint *ext_effect_level_list = NULL;
+ int count = 1; /* start from 1, because of excepting eq index */
+ int ext_level_index = 0;
+ int result = MM_ERROR_NONE;
+
+ debug_fenter();
+
+ return_val_if_fail ( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ 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");
+ /* 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");
+ }
+
+ /* Custom Extension effects */
+ if( PLAYER_INI()->audio_effect_custom_ext_num )
+ {
+ debug_log("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");
+ return MM_ERROR_OUT_OF_MEMORY;
+ }
+ else
+ {
+ memset (ext_effect_level_list, 0, PLAYER_INI()->audio_effect_custom_ext_num);
+ }
+ }
+
+ 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");
+ }
+
+ /* 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);
+
+ debug_fleave();
+
+ return result;
+}
+
+
+gboolean
+__mmplayer_is_earphone_only_effect_type(mm_player_t *player, MMAudioEffectType effect_type, int effect)
+{
+ gboolean result = FALSE;
+ int i = 0;
+
+ debug_fenter();
+
+ 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);
+ 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])
+ {
+ /* 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);
+ result = TRUE;
+ }
+ }
+ }
+ }
+ else
+ {
+ debug_error("invalid effect type(%d)", effect_type);
+ }
+
+ debug_fleave();
+
+ return result;
+}
+
+
+gboolean
+_mmplayer_is_supported_effect_type(MMAudioEffectType effect_type, int effect)
+{
+ gboolean result = TRUE;
+ mm_sound_device_in device_in;
+ mm_sound_device_out device_out;
+ int ret = MM_ERROR_NONE;
+
+ debug_fenter();
+
+ /* get status if speaker is activated */
+ ret = mm_sound_get_active_device(&device_in, &device_out);
+ if ( ret ) {
+ debug_fleave();
+ debug_error("mm_sound_get_active_device() failed [%x]!!", ret);
+ result = FALSE;
+ }
+ else
+ {
+ /* 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);
+ result = FALSE;
+ }
+ if (!PLAYER_INI()->audio_effect_preset_list[effect])
+ {
+ debug_error("this effect(%d) is not supported", effect);
+ result = FALSE;
+ }
+ else
+ {
+ if (device_out == MM_SOUND_DEVICE_OUT_SPEAKER &&
+ 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);
+ result = FALSE;
+ }
+ if (!PLAYER_INI()->audio_effect_custom_list[effect])
+ {
+ debug_error("this custom effect(%d) is not supported", effect);
+ result = FALSE;
+ }
+ else
+ {
+ if (device_out == MM_SOUND_DEVICE_OUT_SPEAKER &&
+ PLAYER_INI()->audio_effect_custom_earphone_only_list[effect])
+ {
+ result = FALSE;
+ }
+ }
+ }
+ else
+ {
+ debug_error("invalid effect type(%d)", effect_type);
+ result = FALSE;
+ }
+ }
+
+ debug_fleave();
+
+ return result;
+}
+
+
+int
+_mmplayer_audio_effect_preset_apply(mm_player_t *player, MMAudioEffectPresetType effect_type)
+{
+ GstElement *audio_effect_element = NULL;
+ int result = MM_ERROR_NONE;
+ int output_type = 0;
+ mm_sound_device_in device_in;
+ mm_sound_device_out device_out;
+
+ debug_fenter();
+
+ 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 )
+ {
+ debug_warning("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_PRESET;
+ player->audio_effect_info.preset = effect_type;
+ }
+ else
+ {
+ return_val_if_fail( player->pipeline->audiobin, MM_ERROR_PLAYER_NOT_INITIALIZED );
+
+ audio_effect_element = player->pipeline->audiobin[MMPLAYER_A_FILTER].gst;
+
+ /* get status if speaker is activated */
+ result = mm_sound_get_active_device(&device_in, &device_out);
+ if ( result ) {
+ debug_error("mm_sound_get_active_device() failed [%x]!!", result);
+ debug_fleave();
+ return result;
+ }
+
+ /* SPEAKER case */
+ if (device_out == MM_SOUND_DEVICE_OUT_SPEAKER)
+ {
+ output_type = MM_AUDIO_EFFECT_OUTPUT_SPK;
+ if (__mmplayer_is_earphone_only_effect_type(player, MM_AUDIO_EFFECT_TYPE_PRESET, effect_type))
+ {
+ debug_error("earphone is not equipped, this filter will not be applied");
+ debug_fleave();
+ return MM_ERROR_PLAYER_SOUND_EFFECT_INVALID_STATUS;
+ }
+ }
+ /* Other case, include WIRED_ACCESSORY, BLUETOOTH, DOCK */
+ else
+ {
+ output_type = MM_AUDIO_EFFECT_OUTPUT_EAR;
+ }
+
+ /* set filter output mode as SPEAKER or EARPHONE */
+ g_object_set(audio_effect_element, "filter-output-mode", output_type, NULL);
+ debug_log("filter-output-mode = %d (0:spk,1:ear)", output_type);
+
+ if (effect_type == MM_AUDIO_EFFECT_PRESET_AUTO) {
+ /* TODO: Add codes about auto selecting preset mode according to ID3 tag */
+ /* set effect preset mode */
+ g_object_set(audio_effect_element, "preset-mode", 0, NULL); /* forced set to 0(normal) temporarily */
+ debug_log("preset-mode = %d", effect_type);
+
+ } else {
+ /* set effect preset mode */
+ g_object_set(audio_effect_element, "preset-mode", effect_type-1, NULL); /* effect_type-1, because of _PRESET_AUTO in MSL/CAPI which does not exist in soundAlive plugin */
+ debug_log("preset-mode = %d", effect_type);
+ }
+
+ /* order action to audio effect plugin */
+ g_object_set(audio_effect_element, "filter-action", MM_AUDIO_EFFECT_TYPE_PRESET, NULL);
+ debug_log("filter-action = %d", MM_AUDIO_EFFECT_TYPE_PRESET);
+
+ }
+
+ debug_fleave();
+
+ return result;
+}
+
+
+int
+_mmplayer_audio_effect_custom_apply(mm_player_t *player)
+{
+ GstElement *audio_effect_element = NULL;
+ int result = MM_ERROR_NONE;
+
+ debug_fenter();
+
+ 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 )
+ {
+ debug_warning("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
+ {
+ int output_type = 0;
+ mm_sound_device_in device_in;
+ mm_sound_device_out device_out;
+
+ return_val_if_fail( player->pipeline->audiobin, MM_ERROR_PLAYER_NOT_INITIALIZED );
+
+ audio_effect_element = player->pipeline->audiobin[MMPLAYER_A_FILTER].gst;
+
+ /* get status if speaker is activated */
+ result = mm_sound_get_active_device(&device_in, &device_out);
+ if ( result ) {
+ debug_error("mm_sound_get_active_device() failed [%x]!!", result);
+ debug_fleave();
+ return result;
+ }
+
+ /* SPEAKER case */
+ if (device_out == MM_SOUND_DEVICE_OUT_SPEAKER)
+ {
+ output_type = MM_AUDIO_EFFECT_OUTPUT_SPK;
+ if (__mmplayer_is_earphone_only_effect_type(player, MM_AUDIO_EFFECT_TYPE_CUSTOM, 0))
+ {
+ debug_error("earphone is not equipped, some custom effect should operate with earphone");
+ debug_fleave();
+ return MM_ERROR_PLAYER_SOUND_EFFECT_INVALID_STATUS;
+ }
+ }
+ /* Other case, include WIRED_ACCESSORY, BLUETOOTH, DOCK */
+ else
+ {
+ output_type = MM_AUDIO_EFFECT_OUTPUT_EAR;
+ }
+
+ /* set filter output mode as SPEAKER or EARPHONE */
+ g_object_set(audio_effect_element, "filter-output-mode", output_type, NULL);
+ debug_log("filter-output-mode = %d (0:spk,1:ear)", output_type);
+
+ result = __mmplayer_set_harmony_effect(player, audio_effect_element);
+ if ( result )
+ {
+ debug_error("_set_harmony_effect() failed(%x)", result);
+ debug_fleave();
+ return result;
+ }
+ }
+
+ debug_fleave();
+
+ return result;
+}
+
+
+int
+mm_player_audio_effect_custom_clear_eq_all(MMHandleType hplayer)
+{
+ int result = MM_ERROR_NONE;
+ mm_player_t* player = (mm_player_t*)hplayer;
+
+ debug_fenter();
+
+ 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);
+
+ debug_msg("All the EQ bands clearing success");
+
+ debug_fleave();
+
+ return result;
+}
+
+
+int
+mm_player_audio_effect_custom_clear_ext_all(MMHandleType hplayer)
+{
+ int i;
+ int result = MM_ERROR_NONE;
+ mm_player_t* player = (mm_player_t*)hplayer;
+
+ debug_fenter();
+
+ 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++ )
+ {
+ player->audio_effect_info.custom_ext_level[i] = MM_AUDIO_EFFECT_CUSTOM_LEVEL_INIT;
+ }
+
+ debug_msg("All the extension effects clearing success");
+
+ debug_fleave();
+
+ return result;
+}
+
+
+int
+mm_player_is_supported_preset_effect_type(MMHandleType hplayer, MMAudioEffectPresetType effect)
+{
+ mm_player_t* player = (mm_player_t*)hplayer;
+ int result = MM_ERROR_NONE;
+
+ debug_fenter();
+
+ return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+
+ if ( !_mmplayer_is_supported_effect_type( MM_AUDIO_EFFECT_TYPE_PRESET, effect ) )
+ {
+ result = MM_ERROR_PLAYER_SOUND_EFFECT_NOT_SUPPORTED_FILTER;
+ }
+
+ debug_fleave();
+
+ return result;
+}
+
+
+int
+mm_player_is_supported_custom_effect_type(MMHandleType hplayer, MMAudioEffectCustomType effect)
+{
+ mm_player_t* player = (mm_player_t*)hplayer;
+ int result = MM_ERROR_NONE;
+
+ debug_fenter();
+
+ return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+
+ if ( !_mmplayer_is_supported_effect_type( MM_AUDIO_EFFECT_TYPE_CUSTOM, effect ) )
+ {
+ result = MM_ERROR_PLAYER_SOUND_EFFECT_NOT_SUPPORTED_FILTER;
+ }
+
+ debug_fleave();
+
+ return result;
+}
+
+
+int
+mm_player_audio_effect_preset_apply(MMHandleType hplayer, MMAudioEffectPresetType type)
+{
+ mm_player_t* player = (mm_player_t*)hplayer;
+ int result = MM_ERROR_NONE;
+
+ debug_fenter();
+
+ return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+
+ if (!PLAYER_INI()->use_audio_effect_preset)
+ {
+ debug_error("audio effect(preset) is not supported", type);
+ debug_fleave();
+ return MM_ERROR_NOT_SUPPORT_API;
+ }
+
+ if (type < MM_AUDIO_EFFECT_PRESET_AUTO || type >= MM_AUDIO_EFFECT_PRESET_NUM)
+ {
+ debug_error("out of range, type(%d)", type);
+ debug_fleave();
+ return MM_ERROR_INVALID_ARGUMENT;
+ }
+
+ /* check if this effect type is supported */
+ if ( !_mmplayer_is_supported_effect_type( MM_AUDIO_EFFECT_TYPE_PRESET, type ) )
+ {
+ debug_fleave();
+ return MM_ERROR_PLAYER_SOUND_EFFECT_NOT_SUPPORTED_FILTER;
+ }
+
+ result = _mmplayer_audio_effect_preset_apply(player, type);
+
+ debug_fleave();
+
+ return result;
+}
+
+
+int
+mm_player_audio_effect_custom_apply(MMHandleType hplayer)
+{
+ mm_player_t* player = (mm_player_t*)hplayer;
+ int result = MM_ERROR_NONE;
+
+ debug_fenter();
+
+ 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");
+ debug_fleave();
+ return MM_ERROR_NOT_SUPPORT_API;
+ }
+
+ result = _mmplayer_audio_effect_custom_apply(player);
+
+ debug_fleave();
+
+ return result;
+}
+
+
+int
+mm_player_audio_effect_bypass (MMHandleType hplayer)
+{
+ mm_player_t* player = (mm_player_t*)hplayer;
+ int result = MM_ERROR_NONE;
+ GstElement *audio_effect_element = NULL;
+
+ debug_fenter();
+
+ 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");
+ debug_fleave();
+ return MM_ERROR_NOT_SUPPORT_API;
+ }
+ if ( !player->pipeline || !player->pipeline->audiobin )
+ {
+ debug_warning("effect element is not created yet.");
+ }
+ else
+ {
+ return_val_if_fail( player->pipeline->audiobin, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ 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);
+ }
+
+ debug_fleave();
+
+ return result;
+}
+
+
+int
+_mmplayer_audio_effect_custom_set_level_ext(mm_player_t *player, MMAudioEffectCustomType custom_effect_type, int level)
+{
+ int effect_level_max = 0;
+ int effect_level_min = 0;
+ int count = 1; /* start from 1, because of excepting eq index */
+ int ext_level_index = 1; /* start from 1, because of excepting eq index */
+ int result = MM_ERROR_NONE;
+
+ debug_fenter();
+
+ return_val_if_fail( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+
+ /* check if EQ is supported */
+ if ( !_mmplayer_is_supported_effect_type( MM_AUDIO_EFFECT_TYPE_CUSTOM, custom_effect_type ) )
+ {
+ debug_fleave();
+ return MM_ERROR_PLAYER_SOUND_EFFECT_NOT_SUPPORTED_FILTER;
+ }
+
+ 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);
+ 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");
+ break;
+ }
+ }
+ count++;
+ }
+
+ if ( level < effect_level_min || level > effect_level_max )
+ {
+ debug_error("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);
+ }
+
+ debug_fleave();
+
+ return result;
+}
+
+
+int
+_mmplayer_audio_effect_custom_set_level_eq(mm_player_t *player, int index, int level)
+{
+ gint eq_level_max = 0;
+ gint eq_level_min = 0;
+ int result = MM_ERROR_NONE;
+
+ debug_fenter();
+
+ return_val_if_fail( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+
+ /* check if EQ is supported */
+ if ( !_mmplayer_is_supported_effect_type( MM_AUDIO_EFFECT_TYPE_CUSTOM, MM_AUDIO_EFFECT_CUSTOM_EQ ) )
+ {
+ debug_fleave();
+ return MM_ERROR_PLAYER_SOUND_EFFECT_NOT_SUPPORTED_FILTER;
+ }
+
+ if ( index < 0 || index > PLAYER_INI()->audio_effect_custom_eq_band_num - 1 )
+ {
+ debug_error("out of range, index(%d)", index);
+ result = MM_ERROR_INVALID_ARGUMENT;
+ }
+ 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);
+
+ if ( level < eq_level_min || level > eq_level_max )
+ {
+ debug_error("out of range, EQ level(%d)", level);
+ result = MM_ERROR_INVALID_ARGUMENT;
+ }
+ else
+ {
+ player->audio_effect_info.custom_eq_level[index] = level;
+ debug_msg("set EQ[%d] = %d", index, level);
+ }
+ }
+
+ debug_fleave();
+
+ return result;
+}
+
+
+/* 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_t* player = (mm_player_t*)hplayer;
+ int result = MM_ERROR_NONE;
+
+ debug_fenter();
+
+ return_val_if_fail( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+
+ /* check if this effect type is supported */
+ if ( !_mmplayer_is_supported_effect_type( MM_AUDIO_EFFECT_TYPE_CUSTOM, effect_custom_type ) )
+ {
+ result = MM_ERROR_PLAYER_SOUND_EFFECT_NOT_SUPPORTED_FILTER;
+ }
+ 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;
+ }
+ }
+
+ debug_fleave();
+
+ return result;
+}
+
+
+int
+mm_player_audio_effect_custom_get_eq_bands_number(MMHandleType hplayer, int *bands)
+{
+ mm_player_t* player = (mm_player_t*)hplayer;
+ int result = MM_ERROR_NONE;
+
+ debug_fenter();
+
+ return_val_if_fail( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+
+ /* check if EQ is supported */
+ if ( !_mmplayer_is_supported_effect_type( MM_AUDIO_EFFECT_TYPE_CUSTOM, MM_AUDIO_EFFECT_CUSTOM_EQ ) )
+ {
+ debug_fleave();
+ return MM_ERROR_PLAYER_SOUND_EFFECT_NOT_SUPPORTED_FILTER;
+ }
+
+ *bands = PLAYER_INI()->audio_effect_custom_eq_band_num;
+ debug_log("number of custom EQ band = %d", *bands);
+
+ debug_fleave();
+
+ return result;
+}
+
+
+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;
+ int result = MM_ERROR_NONE;
+ unsigned int eq_num = 0;
+
+ debug_fenter();
+
+ return_val_if_fail( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+
+ /* check if EQ is supported */
+ if ( !_mmplayer_is_supported_effect_type( MM_AUDIO_EFFECT_TYPE_CUSTOM, MM_AUDIO_EFFECT_CUSTOM_EQ ) )
+ {
+ debug_fleave();
+ return MM_ERROR_PLAYER_SOUND_EFFECT_NOT_SUPPORTED_FILTER;
+ }
+
+ return_val_if_fail( player->pipeline, MM_ERROR_PLAYER_NOT_INITIALIZED );
+
+ 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);
+ result = MM_ERROR_PLAYER_INTERNAL;
+ }
+ 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);
+ }
+
+ debug_fleave();
+
+ return result;
+}
+
+
+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;
+ int result = MM_ERROR_NONE;
+ unsigned int eq_num = 0;
+
+ debug_fenter();
+
+ return_val_if_fail( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+
+ /* check if EQ is supported */
+ if ( !_mmplayer_is_supported_effect_type( MM_AUDIO_EFFECT_TYPE_CUSTOM, MM_AUDIO_EFFECT_CUSTOM_EQ ) )
+ {
+ debug_fleave();
+ return MM_ERROR_PLAYER_SOUND_EFFECT_NOT_SUPPORTED_FILTER;
+ }
+
+ return_val_if_fail( player->pipeline, MM_ERROR_PLAYER_NOT_INITIALIZED );
+
+ 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);
+ result = MM_ERROR_PLAYER_INTERNAL;
+ }
+ 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);
+ }
+
+ debug_fleave();
+
+ return result;
+}
+
+
+int
+mm_player_audio_effect_custom_get_level(MMHandleType hplayer, MMAudioEffectCustomType type, int eq_index, int *level)
+{
+ mm_player_t* player = (mm_player_t*)hplayer;
+ int result = MM_ERROR_NONE;
+
+ debug_fenter();
+
+ return_val_if_fail( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+ return_val_if_fail( level, MM_ERROR_PLAYER_NOT_INITIALIZED );
+
+ /* check if this effect type is supported */
+ if ( !_mmplayer_is_supported_effect_type( MM_AUDIO_EFFECT_TYPE_CUSTOM, type ) )
+ {
+ debug_fleave();
+ return MM_ERROR_PLAYER_SOUND_EFFECT_NOT_SUPPORTED_FILTER;
+ }
+
+ 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);
+ result = MM_ERROR_INVALID_ARGUMENT;
+ }
+ else
+ {
+ *level = player->audio_effect_info.custom_eq_level[eq_index];
+ debug_log("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);
+ result = MM_ERROR_INVALID_ARGUMENT;
+ }
+
+ debug_fleave();
+
+ return result;
+}
+
+
+int
+mm_player_audio_effect_custom_get_level_range(MMHandleType hplayer, MMAudioEffectCustomType type, int *min, int *max)
+{
+ mm_player_t* player = (mm_player_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 */
+
+ debug_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 );
+
+ /* check if this effect type is supported */
+ if ( !_mmplayer_is_supported_effect_type( MM_AUDIO_EFFECT_TYPE_CUSTOM, type ) )
+ {
+ debug_fleave();
+ return MM_ERROR_PLAYER_SOUND_EFFECT_NOT_SUPPORTED_FILTER;
+ }
+
+ 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 )
+ {
+ *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);
+ 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");
+ break;
+ }
+ }
+ count++;
+ }
+ }
+
+ debug_fleave();
+
+ return result;
+}
+
+
+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;
+ gint i = 0;
+ gint eq_level_min = 0;
+ gint eq_level_max = 0;
+ int result = MM_ERROR_NONE;
+
+ debug_fenter();
+
+ return_val_if_fail( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
+
+ /* check if EQ is supported */
+ if ( !_mmplayer_is_supported_effect_type( MM_AUDIO_EFFECT_TYPE_CUSTOM, MM_AUDIO_EFFECT_CUSTOM_EQ ) )
+ {
+ debug_fleave();
+ return MM_ERROR_PLAYER_SOUND_EFFECT_NOT_SUPPORTED_FILTER;
+ }
+
+ 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);
+ result = MM_ERROR_INVALID_ARGUMENT;
+ }
+ 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]);
+ result = MM_ERROR_INVALID_ARGUMENT;
+ break;
+ }
+ player->audio_effect_info.custom_eq_level[i] = level_list[i];
+ }
+ }
+ debug_fleave();
+
+ return result;
+}
static gboolean __generate_default_ini(void);
static void __get_string_list(gchar** out_list, gchar* str);
static void __mm_player_ini_check_ini_status(void);
-//static void __mm_player_ini_force_setting(void);
/* macro */
-#define MMPLAYER_INI_GET_STRING( x_item, x_ini, x_default ) \
+#define MMPLAYER_INI_GET_STRING( x_dict, x_item, x_ini, x_default ) \
do \
{ \
- gchar* str = iniparser_getstring(dict, x_ini, x_default); \
+ gchar* str = iniparser_getstring(x_dict, x_ini, x_default); \
\
if ( str && \
( strlen( str ) > 0 ) && \
}while(0)
/* x_ini is the list of index to set TRUE at x_list[index] */
-#define MMPLAYER_INI_GET_BOOLEAN_FROM_LIST( x_list, x_list_max, x_ini, x_default ) \
+#define MMPLAYER_INI_GET_BOOLEAN_FROM_LIST( x_dict, x_list, x_list_max, x_ini, x_default ) \
do \
{ \
int index = 0; \
char *usr_ptr = NULL; \
char *token = NULL; \
gchar temp_arr[PLAYER_INI_MAX_STRLEN] = {0}; \
- MMPLAYER_INI_GET_STRING(temp_arr, x_ini, x_default); \
+ MMPLAYER_INI_GET_STRING( x_dict, temp_arr, x_ini, x_default); \
token = strtok_r( temp_arr, delimiters, &usr_ptr ); \
while (token) \
{ \
}while(0)
/* x_ini is the list of value to be set at x_list[index] */
-#define MMPLAYER_INI_GET_INT_FROM_LIST( x_list, x_list_max, x_ini, x_default ) \
+#define MMPLAYER_INI_GET_INT_FROM_LIST( x_dict, x_list, x_list_max, x_ini, x_default ) \
do \
{ \
int index = 0; \
char *usr_ptr = NULL; \
char *token = NULL; \
gchar temp_arr[PLAYER_INI_MAX_STRLEN] = {0}; \
- MMPLAYER_INI_GET_STRING(temp_arr, x_ini, x_default); \
+ MMPLAYER_INI_GET_STRING(x_dict, temp_arr, x_ini, x_default); \
token = strtok_r( temp_arr, delimiters, &usr_ptr ); \
while (token) \
{ \
if ( loaded )
return MM_ERROR_NONE;
- dict = NULL;
-
/* disabling ini parsing for launching */
#if 1 //debianize
/* get player ini status because system will be crashed
g_player_ini.delay_before_repeat = iniparser_getint(dict, "general:delay before repeat", DEFAULT_DELAY_BEFORE_REPEAT);
- MMPLAYER_INI_GET_STRING( g_player_ini.videosink_element_x, "general:videosink element x", DEFAULT_VIDEOSINK_X);
- MMPLAYER_INI_GET_STRING( g_player_ini.videosink_element_evas, "general:videosink element evas", DEFAULT_VIDEOSINK_EVAS);
- MMPLAYER_INI_GET_STRING( g_player_ini.videosink_element_fake, "general:videosink element fake", DEFAULT_VIDEOSINK_FAKE);
- MMPLAYER_INI_GET_STRING( g_player_ini.name_of_drmsrc, "general:drmsrc element", DEFAULT_DRMSRC );
- MMPLAYER_INI_GET_STRING( g_player_ini.name_of_audiosink, "general:audiosink element", DEFAULT_AUDIOSINK );
- MMPLAYER_INI_GET_STRING( g_player_ini.name_of_video_converter, "general:video converter element", DEFAULT_VIDEO_CONVERTER );
+ MMPLAYER_INI_GET_STRING(dict, g_player_ini.videosink_element_x, "general:videosink element x", DEFAULT_VIDEOSINK_X);
+ MMPLAYER_INI_GET_STRING(dict, g_player_ini.videosink_element_evas, "general:videosink element evas", DEFAULT_VIDEOSINK_EVAS);
+ MMPLAYER_INI_GET_STRING(dict, g_player_ini.videosink_element_fake, "general:videosink element fake", DEFAULT_VIDEOSINK_FAKE);
+ MMPLAYER_INI_GET_STRING(dict, g_player_ini.name_of_drmsrc, "general:drmsrc element", DEFAULT_DRMSRC );
+ MMPLAYER_INI_GET_STRING(dict, g_player_ini.name_of_audiosink, "general:audiosink element", DEFAULT_AUDIOSINK );
+ MMPLAYER_INI_GET_STRING(dict, g_player_ini.name_of_video_converter, "general:video converter element", DEFAULT_VIDEO_CONVERTER );
__get_string_list( (gchar**) g_player_ini.exclude_element_keyword,
iniparser_getstring(dict, "general:element exclude keyword", DEFAULT_EXCLUDE_KEYWORD));
- MMPLAYER_INI_GET_STRING( g_player_ini.gst_param[0], "general:gstparam1", DEFAULT_GST_PARAM );
- MMPLAYER_INI_GET_STRING( g_player_ini.gst_param[1], "general:gstparam2", DEFAULT_GST_PARAM );
- MMPLAYER_INI_GET_STRING( g_player_ini.gst_param[2], "general:gstparam3", DEFAULT_GST_PARAM );
- MMPLAYER_INI_GET_STRING( g_player_ini.gst_param[3], "general:gstparam4", DEFAULT_GST_PARAM );
- MMPLAYER_INI_GET_STRING( g_player_ini.gst_param[4], "general:gstparam5", DEFAULT_GST_PARAM );
-
- /* audio filter (Preset)*/
- g_player_ini.use_audio_filter_preset = iniparser_getboolean(dict, "sound effect:audio filter preset", DEFAULT_USE_AUDIO_FILTER_PRESET);
- if (g_player_ini.use_audio_filter_preset)
- {
- MMPLAYER_INI_GET_BOOLEAN_FROM_LIST( g_player_ini.audio_filter_preset_list, MM_AUDIO_FILTER_PRESET_NUM,
- "sound effect:audio filter preset list", DEFAULT_AUDIO_FILTER_PRESET_LIST );
- MMPLAYER_INI_GET_BOOLEAN_FROM_LIST( g_player_ini.audio_filter_preset_earphone_only_list, MM_AUDIO_FILTER_PRESET_NUM,
- "sound effect:audio filter preset earphone only", DEFAULT_AUDIO_FILTER_PRESET_LIST_EARPHONE_ONLY );
- }
- /* for audio filter custom (EQ / Extension filters) */
- g_player_ini.use_audio_filter_custom = iniparser_getboolean(dict, "sound effect:audio filter custom", DEFAULT_USE_AUDIO_FILTER_CUSTOM);
- if (g_player_ini.use_audio_filter_custom)
- {
- MMPLAYER_INI_GET_BOOLEAN_FROM_LIST( g_player_ini.audio_filter_custom_list, MM_AUDIO_FILTER_CUSTOM_NUM,
- "sound effect:audio filter custom list", DEFAULT_AUDIO_FILTER_CUSTOM_LIST );
- MMPLAYER_INI_GET_BOOLEAN_FROM_LIST( g_player_ini.audio_filter_custom_earphone_only_list, MM_AUDIO_FILTER_CUSTOM_NUM,
- "sound effect:audio filter custom earphone only", DEFAULT_AUDIO_FILTER_CUSTOM_LIST_EARPHONE_ONLY );
- /* for audio filter custom : EQ */
- if (g_player_ini.audio_filter_custom_list[MM_AUDIO_FILTER_CUSTOM_EQ])
- {
- g_player_ini.audio_filter_custom_eq_num = iniparser_getint(dict, "sound effect:audio filter eq num",
- DEFAULT_AUDIO_FILTER_CUSTOM_EQ_NUM);
- if (g_player_ini.audio_filter_custom_eq_num < DEFAULT_AUDIO_FILTER_CUSTOM_EQ_NUM || g_player_ini.audio_filter_custom_eq_num > MM_AUDIO_FILTER_EQ_BAND_MAX)
- {
- debug_error("audio_filter_custom_eq_num(%d) is not valid range(%d - %d), set the value %d",
- g_player_ini.audio_filter_custom_eq_num, DEFAULT_AUDIO_FILTER_CUSTOM_EQ_NUM, MM_AUDIO_FILTER_EQ_BAND_MAX, DEFAULT_AUDIO_FILTER_CUSTOM_EQ_NUM);
- g_player_ini.audio_filter_custom_eq_num = DEFAULT_AUDIO_FILTER_CUSTOM_EQ_NUM;
- }
- }
- /* for audio filter custom : extension filters */
- g_player_ini.audio_filter_custom_ext_num = iniparser_getint(dict, "sound effect:audio filter ext num",
- DEFAULT_AUDIO_FILTER_CUSTOM_EXT_NUM);
- if (g_player_ini.audio_filter_custom_ext_num > 0)
- {
- MMPLAYER_INI_GET_INT_FROM_LIST( g_player_ini.audio_filter_custom_min_level_list, MM_AUDIO_FILTER_CUSTOM_NUM,
- "sound effect:audio filter custom min list", DEFAULT_AUDIO_FILTER_CUSTOM_LIST );
- MMPLAYER_INI_GET_INT_FROM_LIST( g_player_ini.audio_filter_custom_max_level_list, MM_AUDIO_FILTER_CUSTOM_NUM,
- "sound effect:audio filter custom max list", DEFAULT_AUDIO_FILTER_CUSTOM_LIST );
- }
- }
-#if 0
- int i;
- for (i=0; i<MM_AUDIO_FILTER_PRESET_NUM; i++)
- {
- debug_log("audio_filter_preset_list: %d (is it for earphone only?(%d))\n", g_player_ini.audio_filter_preset_list[i], g_player_ini.audio_filter_preset_earphone_only_list[i]);
- }
- for (i=0; i<MM_AUDIO_FILTER_CUSTOM_NUM; i++)
- {
- debug_log("audio_filter_custom_list : %d (is it for earphone only?(%d))\n", g_player_ini.audio_filter_custom_list[i], g_player_ini.audio_filter_custom_earphone_only_list[i]);
- }
- debug_log("audio_filter_custom : eq_num(%d), ext_num(%d)\n", g_player_ini.audio_filter_custom_eq_num, g_player_ini.audio_filter_custom_ext_num )
- for (i=0; i<MM_AUDIO_FILTER_CUSTOM_NUM; i++)
- {
- debug_log("aaudio_filter_custom_level_min_max_list : min(%d), max(%d)\n", g_player_ini.audio_filter_custom_min_level_list[i], g_player_ini.audio_filter_custom_max_level_list[i]);
- }
-#endif
+ MMPLAYER_INI_GET_STRING(dict, g_player_ini.gst_param[0], "general:gstparam1", DEFAULT_GST_PARAM );
+ MMPLAYER_INI_GET_STRING(dict, g_player_ini.gst_param[1], "general:gstparam2", DEFAULT_GST_PARAM );
+ MMPLAYER_INI_GET_STRING(dict, g_player_ini.gst_param[2], "general:gstparam3", DEFAULT_GST_PARAM );
+ MMPLAYER_INI_GET_STRING(dict, g_player_ini.gst_param[3], "general:gstparam4", DEFAULT_GST_PARAM );
+ MMPLAYER_INI_GET_STRING(dict, g_player_ini.gst_param[4], "general:gstparam5", DEFAULT_GST_PARAM );
/* http streaming */
- MMPLAYER_INI_GET_STRING( g_player_ini.name_of_httpsrc, "http streaming:httpsrc element", DEFAULT_HTTPSRC );
- MMPLAYER_INI_GET_STRING( g_player_ini.http_file_buffer_path, "http streaming:http file buffer path", DEFAULT_HTTP_FILE_BUFFER_PATH );
+ MMPLAYER_INI_GET_STRING( dict, g_player_ini.name_of_httpsrc, "http streaming:httpsrc element", DEFAULT_HTTPSRC );
+ MMPLAYER_INI_GET_STRING( dict, g_player_ini.http_file_buffer_path, "http streaming:http file buffer path", DEFAULT_HTTP_FILE_BUFFER_PATH );
g_player_ini.http_buffering_limit = iniparser_getdouble(dict, "http streaming:http buffering high limit", DEFAULT_HTTP_BUFFERING_LIMIT);
g_player_ini.http_max_size_bytes = iniparser_getint(dict, "http streaming:http max size bytes", DEFAULT_HTTP_MAX_SIZE_BYTES);
g_player_ini.http_buffering_time = iniparser_getdouble(dict, "http streaming:http buffering time", DEFAULT_HTTP_BUFFERING_TIME);
g_player_ini.http_timeout = iniparser_getint(dict, "http streaming:http timeout", DEFAULT_HTTP_TIMEOUT);
/* rtsp streaming */
- MMPLAYER_INI_GET_STRING( g_player_ini.name_of_rtspsrc, "rtsp streaming:rtspsrc element", DEFAULT_RTSPSRC );
+ MMPLAYER_INI_GET_STRING( dict, g_player_ini.name_of_rtspsrc, "rtsp streaming:rtspsrc element", DEFAULT_RTSPSRC );
g_player_ini.rtsp_buffering_time = iniparser_getint(dict, "rtsp streaming:rtsp buffering time", DEFAULT_RTSP_BUFFERING);
g_player_ini.rtsp_rebuffering_time = iniparser_getint(dict, "rtsp streaming:rtsp rebuffering time", DEFAULT_RTSP_REBUFFERING);
g_player_ini.rtsp_do_typefinding = iniparser_getboolean(dict, "rtsp streaming:rtsp do typefinding", DEFAULT_RTSP_DO_TYPEFINDING);
/* general */
g_player_ini.use_decodebin = DEFAULT_USE_DECODEBIN;
g_player_ini.disable_segtrap = DEFAULT_DISABLE_SEGTRAP;
- g_player_ini.use_audio_filter_preset = DEFAULT_USE_AUDIO_FILTER_PRESET;
- g_player_ini.use_audio_filter_custom = DEFAULT_USE_AUDIO_FILTER_CUSTOM;
g_player_ini.skip_rescan = DEFAULT_SKIP_RESCAN;
strncpy( g_player_ini.videosink_element_x, DEFAULT_VIDEOSINK_X, PLAYER_INI_MAX_STRLEN - 1 );
strncpy( g_player_ini.videosink_element_evas, DEFAULT_VIDEOSINK_EVAS, PLAYER_INI_MAX_STRLEN - 1 );
loaded = TRUE;
- /* The simulator uses a separate ini file. */
- //__mm_player_ini_force_setting();
-
-
/* dump structure */
debug_log("player settings -----------------------------------\n");
/* general */
debug_log("use_decodebin : %d\n", g_player_ini.use_decodebin);
- debug_log("use_audio_filter_preset : %d\n", g_player_ini.use_audio_filter_preset);
- debug_log("use_audio_filter_custom : %d\n", g_player_ini.use_audio_filter_custom);
debug_log("disable_segtrap : %d\n", g_player_ini.disable_segtrap);
debug_log("skip rescan : %d\n", g_player_ini.skip_rescan);
debug_log("videosink element x: %s\n", g_player_ini.videosink_element_x);
}
+int
+mm_player_audio_effect_ini_load(void)
+{
+ static gboolean loaded_audioeffect = FALSE;
+ dictionary * dict_audioeffect = NULL;
+
+ if ( loaded_audioeffect )
+ return MM_ERROR_NONE;
+
+ dict_audioeffect = iniparser_load(MM_PLAYER_INI_DEFAULT_AUDIOEFFECT_PATH);
+ if ( !dict_audioeffect )
+ {
+ debug_warning("No audio effect ini file found. \n");
+ //return MM_ERROR_FILE_NOT_FOUND;
+ }
+
+ /* audio effect element name */
+ MMPLAYER_INI_GET_STRING( dict_audioeffect, g_player_ini.name_of_audio_effect, "audio effect:audio effect element", DEFAULT_AUDIO_EFFECT_ELEMENT );
+ if (!g_player_ini.name_of_audio_effect)
+ {
+ debug_error("could not parse name of audio effect. \n");
+ iniparser_freedict (dict_audioeffect);
+ return MM_ERROR_PLAYER_INTERNAL;
+ }
+
+ /* audio effect (Preset)*/
+ g_player_ini.use_audio_effect_preset = iniparser_getboolean(dict_audioeffect, "audio effect:audio effect preset", DEFAULT_USE_AUDIO_EFFECT_PRESET);
+ if (g_player_ini.use_audio_effect_preset)
+ {
+ MMPLAYER_INI_GET_BOOLEAN_FROM_LIST( dict_audioeffect, g_player_ini.audio_effect_preset_list, MM_AUDIO_EFFECT_PRESET_NUM,
+ "audio effect:audio effect preset list", DEFAULT_AUDIO_EFFECT_PRESET_LIST );
+ MMPLAYER_INI_GET_BOOLEAN_FROM_LIST( dict_audioeffect, g_player_ini.audio_effect_preset_earphone_only_list, MM_AUDIO_EFFECT_PRESET_NUM,
+ "audio effect:audio effect preset earphone only", DEFAULT_AUDIO_EFFECT_PRESET_LIST_EARPHONE_ONLY );
+ }
+
+ /* audio effect custom (EQ / Extension effects) */
+ g_player_ini.use_audio_effect_custom = iniparser_getboolean(dict_audioeffect, "audio effect:audio effect custom", DEFAULT_USE_AUDIO_EFFECT_CUSTOM);
+ if (g_player_ini.use_audio_effect_custom)
+ {
+ MMPLAYER_INI_GET_BOOLEAN_FROM_LIST( dict_audioeffect, g_player_ini.audio_effect_custom_list, MM_AUDIO_EFFECT_CUSTOM_NUM,
+ "audio effect:audio effect custom list", DEFAULT_AUDIO_EFFECT_CUSTOM_LIST );
+ MMPLAYER_INI_GET_BOOLEAN_FROM_LIST( dict_audioeffect, g_player_ini.audio_effect_custom_earphone_only_list, MM_AUDIO_EFFECT_CUSTOM_NUM,
+ "audio effect:audio effect custom earphone only", DEFAULT_AUDIO_EFFECT_CUSTOM_LIST_EARPHONE_ONLY );
+
+ /* audio effect custom : EQ */
+ if (g_player_ini.audio_effect_custom_list[MM_AUDIO_EFFECT_CUSTOM_EQ])
+ {
+ g_player_ini.audio_effect_custom_eq_band_num = iniparser_getint(dict_audioeffect, "audio effect:audio effect custom eq band num",
+ DEFAULT_AUDIO_EFFECT_CUSTOM_EQ_BAND_NUM);
+ if (g_player_ini.audio_effect_custom_eq_band_num < DEFAULT_AUDIO_EFFECT_CUSTOM_EQ_BAND_NUM ||
+ g_player_ini.audio_effect_custom_eq_band_num > MM_AUDIO_EFFECT_EQ_BAND_NUM_MAX)
+ {
+ debug_error("audio_effect_custom_eq_band_num(%d) is not valid range(%d - %d), set the value %d",
+ g_player_ini.audio_effect_custom_eq_band_num, DEFAULT_AUDIO_EFFECT_CUSTOM_EQ_BAND_NUM, MM_AUDIO_EFFECT_EQ_BAND_NUM_MAX, DEFAULT_AUDIO_EFFECT_CUSTOM_EQ_BAND_NUM);
+ g_player_ini.audio_effect_custom_eq_band_num = DEFAULT_AUDIO_EFFECT_CUSTOM_EQ_BAND_NUM;
+
+ iniparser_freedict (dict_audioeffect);
+ return MM_ERROR_PLAYER_INTERNAL;
+ }
+ else
+ {
+ if (g_player_ini.audio_effect_custom_eq_band_num)
+ {
+ MMPLAYER_INI_GET_INT_FROM_LIST( dict_audioeffect, g_player_ini.audio_effect_custom_eq_band_width, MM_AUDIO_EFFECT_EQ_BAND_NUM_MAX,
+ "audio effect:audio effect custom eq band width", DEFAULT_AUDIO_EFFECT_CUSTOM_EQ_BAND_WIDTH );
+ MMPLAYER_INI_GET_INT_FROM_LIST( dict_audioeffect, g_player_ini.audio_effect_custom_eq_band_freq, MM_AUDIO_EFFECT_EQ_BAND_NUM_MAX,
+ "audio effect:audio effect custom eq band freq", DEFAULT_AUDIO_EFFECT_CUSTOM_EQ_BAND_FREQ );
+ }
+ }
+ }
+
+ /* audio effect custom : Extension effects */
+ g_player_ini.audio_effect_custom_ext_num = iniparser_getint(dict_audioeffect, "audio effect:audio effect custom ext num",
+ DEFAULT_AUDIO_EFFECT_CUSTOM_EXT_NUM);
+
+ /* Min/Max value list of EQ / Extension effects */
+ if (g_player_ini.audio_effect_custom_eq_band_num || g_player_ini.audio_effect_custom_ext_num)
+ {
+
+ MMPLAYER_INI_GET_INT_FROM_LIST( dict_audioeffect, g_player_ini.audio_effect_custom_min_level_list, MM_AUDIO_EFFECT_CUSTOM_NUM,
+ "audio effect:audio effect custom min list", DEFAULT_AUDIO_EFFECT_CUSTOM_LIST );
+ MMPLAYER_INI_GET_INT_FROM_LIST( dict_audioeffect, g_player_ini.audio_effect_custom_max_level_list, MM_AUDIO_EFFECT_CUSTOM_NUM,
+ "audio effect:audio effect custom max list", DEFAULT_AUDIO_EFFECT_CUSTOM_LIST );
+ }
+ }
+
+ /* dump structure */
+ debug_log("player audio-effect settings ----------------------\n");
+ debug_log("name_of_audio_effect : %s\n", g_player_ini.name_of_audio_effect);
+ debug_log("use_audio_effect_preset : %d\n", g_player_ini.use_audio_effect_preset);
+ debug_log("use_audio_effect_custom : %d\n", g_player_ini.use_audio_effect_custom);
+#if 0
+ int i;
+ for (i=0; i<MM_AUDIO_EFFECT_PRESET_NUM; i++)
+ {
+ debug_log("audio_effect_preset_list: %d (is it for earphone only?(%d))\n", g_player_ini.audio_effect_preset_list[i], g_player_ini.audio_effect_preset_earphone_only_list[i]);
+ }
+ for (i=0; i<MM_AUDIO_EFFECT_CUSTOM_NUM; i++)
+ {
+ debug_log("audio_effect_custom_list : %d (is it for earphone only?(%d))\n", g_player_ini.audio_effect_custom_list[i], g_player_ini.audio_effect_custom_earphone_only_list[i]);
+ }
+ debug_log("audio_effect_custom : eq_band_num(%d), ext_num(%d)\n", g_player_ini.audio_effect_custom_eq_band_num, g_player_ini.audio_effect_custom_ext_num );
+ debug_log("audio_effect_custom_EQ : width(Hz) / central frequency(Hz)");
+ for (i=0; i<g_player_ini.audio_effect_custom_eq_band_num; i++)
+ {
+ debug_log(" EQ band index(%d) : %8d / %8d", i, g_player_ini.audio_effect_custom_eq_band_width[i], g_player_ini.audio_effect_custom_eq_band_freq[i]);
+ }
+ for (i=0; i<MM_AUDIO_EFFECT_CUSTOM_NUM; i++)
+ {
+ debug_log("audio_effect_custom_level_min_max(idx:%d) : Min(%d), Max(%d)\n", i, g_player_ini.audio_effect_custom_min_level_list[i], g_player_ini.audio_effect_custom_max_level_list[i]);
+ }
+#endif
+ debug_log("---------------------------------------------------\n");
+
+ iniparser_freedict (dict_audioeffect);
+
+ loaded_audioeffect = TRUE;
+
+ return MM_ERROR_NONE;
+
+}
+
+
static
void __mm_player_ini_check_ini_status(void)
{
}
}
-#if 0
-static
-void __mm_player_ini_force_setting(void)
-{
- //TODO:IF NEEDED
-}
-#endif
-
mm_player_ini_t*
mm_player_ini_get_structure(void)
{
{
void *pixmap_id_cb = NULL;
void *pixmap_id_cb_user_data = NULL;
- int zoom = 0;
- int degree = 0;
int display_method = 0;
- int roi_x = 0;
- int roi_y = 0;
- int roi_w = 0;
- int roi_h = 0;
- int force_aspect_ratio = 0;
gboolean visible = TRUE;
/* if xvimagesink */
/**
* AUDIO PIPELINE
- * - Local playback : audioconvert !volume ! capsfilter ! dnse ! audiosink
+ * - Local playback : audioconvert !volume ! capsfilter ! audioeq ! audiosink
* - Streaming : audioconvert !volume ! audiosink
* - PCM extraction : audioconvert ! audioresample ! capsfilter ! fakesink
*/
gst_caps_unref( caps );
- /* audio filter. if enabled */
- if ( PLAYER_INI()->use_audio_filter_preset || PLAYER_INI()->use_audio_filter_custom )
+ /* audio effect element. if audio effect is enabled */
+ if ( PLAYER_INI()->use_audio_effect_preset || PLAYER_INI()->use_audio_effect_custom )
{
- MMPLAYER_CREATE_ELEMENT(audiobin, MMPLAYER_A_FILTER, "soundalive", "audiofilter", TRUE);
+ MMPLAYER_CREATE_ELEMENT(audiobin, MMPLAYER_A_FILTER, PLAYER_INI()->name_of_audio_effect, "audiofilter", TRUE);
}
/* create audio sink */
gst_object_unref(pad);
- if ( !player->bypass_sound_effect && (PLAYER_INI()->use_audio_filter_preset || PLAYER_INI()->use_audio_filter_custom) )
+ if ( !player->bypass_audio_effect && (PLAYER_INI()->use_audio_effect_preset || PLAYER_INI()->use_audio_effect_custom) )
{
- if ( player->audio_filter_info.filter_type == MM_AUDIO_FILTER_TYPE_PRESET )
+ if ( player->audio_effect_info.effect_type == MM_AUDIO_EFFECT_TYPE_PRESET )
{
- if (!_mmplayer_sound_filter_preset_apply(player, player->audio_filter_info.preset))
+ if (!_mmplayer_audio_effect_preset_apply(player, player->audio_effect_info.preset))
{
- debug_msg("apply sound effect(preset:%d) setting success\n",player->audio_filter_info.preset);
+ debug_msg("apply audio effect(preset:%d) setting success\n",player->audio_effect_info.preset);
}
}
- else if ( player->audio_filter_info.filter_type == MM_AUDIO_FILTER_TYPE_CUSTOM )
+ else if ( player->audio_effect_info.effect_type == MM_AUDIO_EFFECT_TYPE_CUSTOM )
{
- if (!_mmplayer_sound_filter_custom_apply(player))
+ if (!_mmplayer_audio_effect_custom_apply(player))
{
- debug_msg("apply sound effect(custom) setting success\n");
+ debug_msg("apply audio effect(custom) setting success\n");
}
}
}
player->pd_file_save_path = NULL;
}
- /* give default value of sound effect setting */
- player->bypass_sound_effect = TRUE;
+ /* give default value of audio effect setting */
+ player->bypass_audio_effect = TRUE;
player->sound.volume = MM_VOLUME_FACTOR_DEFAULT;
player->playback_rate = DEFAULT_PLAYBACK_RATE;
player->no_more_pad = TRUE;
if (player->type)
debug_log("meida type %s found, probability %d%% / %d\n", player->type, probability, gst_caps_get_size(caps));
- /* midi type should be stored because it will be used to set audio gain in avsysauiosink */
+ /* midi type should be stored because it will be used to set audio gain in avsysaudiosink */
if ( __mmplayer_is_midi_type(player->type))
{
player->profile.play_mode = MM_PLAYER_MODE_MIDI;
}
else if (__mmplayer_is_amr_type(player->type))
{
- player->bypass_sound_effect = FALSE;
- if ( (PLAYER_INI()->use_audio_filter_preset || PLAYER_INI()->use_audio_filter_custom) )
+ player->bypass_audio_effect = FALSE;
+ if ( (PLAYER_INI()->use_audio_effect_preset || PLAYER_INI()->use_audio_effect_custom) )
{
- if ( player->audio_filter_info.filter_type == MM_AUDIO_FILTER_TYPE_PRESET )
+ if ( player->audio_effect_info.effect_type == MM_AUDIO_EFFECT_TYPE_PRESET )
{
- if (!_mmplayer_sound_filter_preset_apply(player, player->audio_filter_info.preset))
+ if (!_mmplayer_audio_effect_preset_apply(player, player->audio_effect_info.preset))
{
- debug_msg("apply sound effect(preset:%d) setting success\n",player->audio_filter_info.preset);
+ debug_msg("apply audio effect(preset:%d) setting success\n",player->audio_effect_info.preset);
}
}
- else if ( player->audio_filter_info.filter_type == MM_AUDIO_FILTER_TYPE_CUSTOM )
+ else if ( player->audio_effect_info.effect_type == MM_AUDIO_EFFECT_TYPE_CUSTOM )
{
- if (!_mmplayer_sound_filter_custom_apply(player))
+ if (!_mmplayer_audio_effect_custom_apply(player))
{
- debug_msg("apply sound effect(custom) setting success\n");
+ debug_msg("apply audio effect(custom) setting success\n");
}
}
}
MMPLAYER_FREEIF(player->album_art);
- /* free memory related to sound effect */
- if(player->audio_filter_info.custom_ext_level_for_plugin)
+ /* free memory related to audio effect */
+ if(player->audio_effect_info.custom_ext_level_for_plugin)
{
- free(player->audio_filter_info.custom_ext_level_for_plugin);
+ free(player->audio_effect_info.custom_ext_level_for_plugin);
}
debug_fleave();
+++ /dev/null
-/*
- * libmm-player
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: JongHyuk Choi <jhchoi.choi@samsung.com>, YeJin Cho <cho.yejin@samsung.com>, YoungHwan An <younghwan_.an@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-#include <mm_error.h>
-
-#include "mm_player_sndeffect.h"
-#include "mm_player_ini.h"
-#include "mm_player_priv.h"
-#include <mm_sound.h>
-
-
-int
-mm_player_get_foreach_present_supported_filter_type(MMHandleType player, MMAudioFilterType filter_type, mmplayer_supported_sound_filter_cb foreach_cb, void *user_data)
-{
- debug_fenter();
- int result = MM_ERROR_NONE;
- mm_sound_device_in device_in;
- mm_sound_device_out device_out;
- int i = 0;
-
- return_val_if_fail ( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
-
- /* get status if speaker is activated */
- result = mm_sound_get_active_device(&device_in, &device_out);
- if ( result ) {
- debug_error("mm_sound_get_active_device() failed [%x]!!", result);
- return result;
- }
-
- /* preset */
- if (filter_type == MM_AUDIO_FILTER_TYPE_PRESET)
- {
- for ( i = 0; i < MM_AUDIO_FILTER_PRESET_NUM; i++ )
- {
- if (PLAYER_INI()->audio_filter_preset_list[i] )
- {
- if (device_out == MM_SOUND_DEVICE_OUT_SPEAKER &&
- PLAYER_INI()->audio_filter_preset_earphone_only_list[i])
- {
- continue;
- }
- if (!foreach_cb(filter_type,i, user_data))
- {
- goto CALLBACK_ERROR;
- }
- }
- }
- }
- /* custom */
- else if (filter_type == MM_AUDIO_FILTER_TYPE_CUSTOM)
- {
- for ( i = 0; i < MM_AUDIO_FILTER_CUSTOM_NUM; i++ )
- {
- if (PLAYER_INI()->audio_filter_custom_list[i] )
- {
- if (device_out == MM_SOUND_DEVICE_OUT_SPEAKER &&
- PLAYER_INI()->audio_filter_custom_earphone_only_list[i])
- {
- continue;
- }
- if (!foreach_cb(filter_type,i, user_data))
- {
- goto CALLBACK_ERROR;
- }
- }
- }
- }
- else
- {
- debug_error("invalid filter type(%d)", filter_type);
- result = MM_ERROR_INVALID_ARGUMENT;
- }
-
- return result;
-
-CALLBACK_ERROR:
- debug_error("foreach cb returned error");
- return MM_ERROR_PLAYER_INTERNAL;
-}
-
-
-int
-__mmplayer_set_harmony_filter(mm_player_t *player, GstElement *filter_element)
-{
- debug_fenter();
- gint *ext_filter_level_list = NULL;
- int count = 1; /* start from 1, because of excepting eq index */
- int ext_level_index = 0;
- int result = MM_ERROR_NONE;
- return_val_if_fail ( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
- return_val_if_fail ( filter_element, MM_ERROR_INVALID_ARGUMENT );
-
- /* Custom EQ */
- if( PLAYER_INI()->audio_filter_custom_eq_num )
- {
- debug_log("pass custom EQ level list to sound effect plugin");
- /* set custom-equalizer level list */
- g_object_set(filter_element, "custom-eq", player->audio_filter_info.custom_eq_level, NULL);
- }
- else
- {
- debug_warning("no custom EQ");
- }
-
- /* Custom Extension filters */
- if( PLAYER_INI()->audio_filter_custom_ext_num )
- {
- debug_log("pass custom extension level list to sound effect plugin");
- ext_filter_level_list = player->audio_filter_info.custom_ext_level_for_plugin;
- if (!ext_filter_level_list) {
- ext_filter_level_list = (gint*) malloc (sizeof(gint)*PLAYER_INI()->audio_filter_custom_ext_num);
- if (!ext_filter_level_list)
- {
- debug_error("memory allocation for extension filter list failed");
- return MM_ERROR_OUT_OF_MEMORY;
- }
- else
- {
- memset (ext_filter_level_list, 0, PLAYER_INI()->audio_filter_custom_ext_num);
- }
- }
-
- while ( count < MM_AUDIO_FILTER_CUSTOM_NUM )
- {
- if ( PLAYER_INI()->audio_filter_custom_list[count] )
- {
- ext_filter_level_list[ext_level_index] = player->audio_filter_info.custom_ext_level[count-1];
- ext_level_index++;
- if (ext_level_index == PLAYER_INI()->audio_filter_custom_ext_num)
- {
- break;
- }
- }
- count++;
- }
-
- /* set custom-extension filters level list */
- g_object_set(filter_element, "custom-ext", ext_filter_level_list, NULL);
- }
- else
- {
- debug_warning("no custom extension fliter");
- }
-
- /* order action to sound effect plugin */
- g_object_set(filter_element, "filter-action", MM_AUDIO_FILTER_TYPE_CUSTOM, NULL);
- debug_log("filter-action = %d", MM_AUDIO_FILTER_TYPE_CUSTOM);
-
- debug_fleave();
-
- return result;
-}
-
-
-gboolean
-__mmplayer_is_earphone_only_filter_type(mm_player_t *player, MMAudioFilterType filter_type, int filter)
-{
- gboolean result = FALSE;
- int i = 0;
- debug_fenter();
-
- return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
-
- /* preset */
- if (filter_type == MM_AUDIO_FILTER_TYPE_PRESET)
- {
- if (PLAYER_INI()->audio_filter_preset_earphone_only_list[filter])
- {
- debug_msg("this preset filter(%d) is only available with earphone", filter);
- result = TRUE;
- }
- }
- /* custom */
- else if (filter_type == MM_AUDIO_FILTER_TYPE_CUSTOM)
- {
- for (i = 1; i < MM_AUDIO_FILTER_CUSTOM_NUM; i++) /* it starts from 1(except testing for EQ) */
- {
- if (PLAYER_INI()->audio_filter_custom_earphone_only_list[i])
- {
- /* check if the earphone only custom filter was set */
- if (player->audio_filter_info.custom_ext_level[i-1])
- {
- debug_msg("this custom filter(%d) is only available with earphone", i);
- result = TRUE;
- }
- }
- }
- }
- else
- {
- debug_error("invalid filter type(%d)", filter_type);
- }
-
- return result;
-}
-
-
-gboolean
-_mmplayer_is_supported_filter_type(MMAudioFilterType filter_type, int filter)
-{
- gboolean result = TRUE;
-
- debug_fenter();
-
- /* preset */
- if (filter_type == MM_AUDIO_FILTER_TYPE_PRESET)
- {
- if ( filter < MM_AUDIO_FILTER_PRESET_AUTO || filter >= MM_AUDIO_FILTER_PRESET_NUM )
- {
- debug_error("out of range, preset filter(%d)", filter);
- result = FALSE;
- }
- if (!PLAYER_INI()->audio_filter_preset_list[filter])
- {
- debug_error("this filter(%d) is not supported", filter);
- result = FALSE;
- }
- }
- /* custom */
- else if (filter_type == MM_AUDIO_FILTER_TYPE_CUSTOM)
- {
- if ( filter < MM_AUDIO_FILTER_CUSTOM_EQ || filter >= MM_AUDIO_FILTER_CUSTOM_NUM )
- {
- debug_error("out of range, custom filter(%d)", filter);
- result = FALSE;
- }
- if (!PLAYER_INI()->audio_filter_custom_list[filter])
- {
- debug_error("this custom filter(%d) is not supported", filter);
- result = FALSE;
- }
- }
- else
- {
- debug_error("invalid filter type(%d)", filter_type);
- result = FALSE;
- }
-
- return result;
-}
-
-
-int
-_mmplayer_sound_filter_preset_apply(mm_player_t *player, MMAudioFilterPresetType filter_type)
-{
- GstElement *filter_element = NULL;
- int result = MM_ERROR_NONE;
- int output_type = 0;
- mm_sound_device_in device_in;
- mm_sound_device_out device_out;
-
- debug_fenter();
-
- return_val_if_fail( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
-
- /* Music Player can set sound effect value before Audiobin is created. */
- if ( !player->pipeline || !player->pipeline->audiobin )
- {
- debug_warning("filter element is not created yet.");
-
- player->bypass_sound_effect = FALSE;
-
- /* store sound effect setting in order to apply it when audio filter is created */
- player->audio_filter_info.filter_type = MM_AUDIO_FILTER_TYPE_PRESET;
- player->audio_filter_info.preset = filter_type;
- }
- else
- {
- return_val_if_fail( player->pipeline->audiobin, MM_ERROR_PLAYER_NOT_INITIALIZED );
-
- filter_element = player->pipeline->audiobin[MMPLAYER_A_FILTER].gst;
-
- /* get status if speaker is activated */
- result = mm_sound_get_active_device(&device_in, &device_out);
- if ( result ) {
- debug_error("mm_sound_get_active_device() failed [%x]!!", result);
- return result;
- }
-
- /* SPEAKER case */
- if (device_out == MM_SOUND_DEVICE_OUT_SPEAKER)
- {
- output_type = MM_AUDIO_FILTER_OUTPUT_SPK;
- if (__mmplayer_is_earphone_only_filter_type(player, MM_AUDIO_FILTER_TYPE_PRESET, filter_type))
- {
- debug_error("earphone is not equipped, this filter will not be applied");
- return MM_ERROR_PLAYER_SOUND_EFFECT_INVALID_STATUS;
- }
- }
- /* Other case, include WIRED_ACCESSORY, BLUETOOTH, DOCK */
- else
- {
- output_type = MM_AUDIO_FILTER_OUTPUT_EAR;
- }
-
- /* set filter output mode as SPEAKER or EARPHONE */
- g_object_set(filter_element, "filter-output-mode", output_type, NULL);
- debug_log("filter-output-mode = %d (0:spk,1:ear)", output_type);
-
- if (filter_type == MM_AUDIO_FILTER_PRESET_AUTO) {
- /* TODO: Add codes about auto selecting preset mode according to ID3 tag */
- /* set filter preset mode */
- g_object_set(filter_element, "preset-mode", 0, NULL); /* forced set to 0(normal) temporarily */
- debug_log("preset-mode = %d", filter_type);
-
- } else {
- /* set filter preset mode */
- g_object_set(filter_element, "preset-mode", filter_type-1, NULL); /* filter_type-1, because of _PRESET_AUTO in MSL/CAPI which does not exist in soundAlive plugin */
- debug_log("preset-mode = %d", filter_type);
- }
-
- /* order action to sound effect plugin */
- g_object_set(filter_element, "filter-action", MM_AUDIO_FILTER_TYPE_PRESET, NULL);
- debug_log("filter-action = %d", MM_AUDIO_FILTER_TYPE_PRESET);
-
- }
- debug_fleave();
-
- return result;
-}
-
-
-int
-_mmplayer_sound_filter_custom_apply(mm_player_t *player)
-{
- GstElement *filter_element = NULL;
- int result = MM_ERROR_NONE;
-
- debug_fenter();
-
- return_val_if_fail( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
-
- /* Music Player can set sound effect value before Audiobin is created. */
- if ( !player->pipeline || !player->pipeline->audiobin )
- {
- debug_warning("filter element is not created yet.");
-
- player->bypass_sound_effect = FALSE;
-
- /* store sound effect setting in order to apply it when audio filter is created */
- player->audio_filter_info.filter_type = MM_AUDIO_FILTER_TYPE_CUSTOM;
- }
- else
- {
- int output_type = 0;
- mm_sound_device_in device_in;
- mm_sound_device_out device_out;
-
- return_val_if_fail( player->pipeline->audiobin, MM_ERROR_PLAYER_NOT_INITIALIZED );
-
- filter_element = player->pipeline->audiobin[MMPLAYER_A_FILTER].gst;
-
- /* get status if speaker is activated */
- result = mm_sound_get_active_device(&device_in, &device_out);
- if ( result ) {
- debug_error("mm_sound_get_active_device() failed [%x]!!", result);
- return result;
- }
-
- /* SPEAKER case */
- if (device_out == MM_SOUND_DEVICE_OUT_SPEAKER)
- {
- output_type = MM_AUDIO_FILTER_OUTPUT_SPK;
- if (__mmplayer_is_earphone_only_filter_type(player, MM_AUDIO_FILTER_TYPE_CUSTOM, 0))
- {
- debug_error("earphone is not equipped, some custom filter should operate with earphone");
- return MM_ERROR_PLAYER_SOUND_EFFECT_INVALID_STATUS;
- }
- }
- /* Other case, include WIRED_ACCESSORY, BLUETOOTH, DOCK */
- else
- {
- output_type = MM_AUDIO_FILTER_OUTPUT_EAR;
- }
-
- /* set filter output mode as SPEAKER or EARPHONE */
- g_object_set(filter_element, "filter-output-mode", output_type, NULL);
- debug_log("filter output mode = %d(0:spk,1:ear)", output_type);
-
- result = __mmplayer_set_harmony_filter(player, filter_element);
- if ( result )
- {
- debug_error("_set_harmony_filter() failed(%x)", result);
- return result;
- }
- }
- debug_fleave();
-
- return result;
-}
-
-
-int
-mm_player_sound_filter_custom_clear_eq_all(MMHandleType hplayer)
-{
- int result = MM_ERROR_NONE;
- mm_player_t* player = (mm_player_t*)hplayer;
- debug_fenter();
-
- return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
-
- /* clear EQ custom filter */
- memset(player->audio_filter_info.custom_eq_level, MM_AUDIO_FILTER_CUSTOM_LEVEL_INIT, sizeof(int)*MM_AUDIO_FILTER_EQ_BAND_MAX);
-
- debug_msg("All the EQ bands clearing success");
-
- return result;
-}
-
-
-int
-mm_player_sound_filter_custom_clear_ext_all(MMHandleType hplayer)
-{
- int i;
- int result = MM_ERROR_NONE;
- mm_player_t* player = (mm_player_t*)hplayer;
- debug_fenter();
-
- return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
-
- /* clear ALL custom filters, except EQ */
- for ( i = 0 ; i < MM_AUDIO_FILTER_CUSTOM_NUM - 1 ; i++ )
- {
- player->audio_filter_info.custom_ext_level[i] = MM_AUDIO_FILTER_CUSTOM_LEVEL_INIT;
- }
-
- debug_msg("All the extension filters clearing success");
-
- return result;
-}
-
-
-int
-mm_player_is_supported_preset_filter_type(MMHandleType hplayer, MMAudioFilterPresetType filter)
-{
- mm_player_t* player = (mm_player_t*)hplayer;
- int result = MM_ERROR_NONE;
- debug_fenter();
-
- return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
-
- if ( !_mmplayer_is_supported_filter_type( MM_AUDIO_FILTER_TYPE_PRESET, filter ) )
- {
- result = MM_ERROR_PLAYER_SOUND_EFFECT_NOT_SUPPORTED_FILTER;
- }
-
- return result;
-}
-
-
-int
-mm_player_is_supported_custom_filter_type(MMHandleType hplayer, MMAudioFilterCustomType filter)
-{
- mm_player_t* player = (mm_player_t*)hplayer;
- int result = MM_ERROR_NONE;
- debug_fenter();
-
- return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
-
- if ( !_mmplayer_is_supported_filter_type( MM_AUDIO_FILTER_TYPE_CUSTOM, filter ) )
- {
- result = MM_ERROR_PLAYER_SOUND_EFFECT_NOT_SUPPORTED_FILTER;
- }
-
- return result;
-}
-
-
-int
-mm_player_sound_filter_preset_apply(MMHandleType hplayer, MMAudioFilterPresetType type)
-{
- mm_player_t* player = (mm_player_t*)hplayer;
- int result = MM_ERROR_NONE;
- debug_fenter();
-
- return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
-
- if (!PLAYER_INI()->use_audio_filter_preset)
- {
- debug_error("sound filter(preset) is not suppported", type);
- return MM_ERROR_NOT_SUPPORT_API;
- }
-
- if (type < MM_AUDIO_FILTER_PRESET_AUTO || type >= MM_AUDIO_FILTER_PRESET_NUM)
- {
- debug_error("out of range, type(%d)", type);
- return MM_ERROR_INVALID_ARGUMENT;
- }
-
- /* check if this filter type is supported */
- if ( !_mmplayer_is_supported_filter_type( MM_AUDIO_FILTER_TYPE_PRESET, type ) )
- {
- return MM_ERROR_PLAYER_SOUND_EFFECT_NOT_SUPPORTED_FILTER;
- }
-
- result = _mmplayer_sound_filter_preset_apply(player, type);
-
- return result;
-}
-
-
-int
-mm_player_sound_filter_custom_apply(MMHandleType hplayer)
-{
- mm_player_t* player = (mm_player_t*)hplayer;
- int result = MM_ERROR_NONE;
- debug_fenter();
-
- return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
-
- if (!PLAYER_INI()->use_audio_filter_custom)
- {
- debug_error("sound filter(custom) is not suppported");
- return MM_ERROR_NOT_SUPPORT_API;
- }
-
- result = _mmplayer_sound_filter_custom_apply(player);
-
- return result;
-}
-
-
-int
-mm_player_sound_filter_bypass (MMHandleType hplayer)
-{
- mm_player_t* player = (mm_player_t*)hplayer;
- int result = MM_ERROR_NONE;
- GstElement *filter_element = NULL;
- debug_fenter();
-
- return_val_if_fail(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
-
- if ( !PLAYER_INI()->use_audio_filter_preset && !PLAYER_INI()->use_audio_filter_custom )
- {
- debug_error("sound filter(preset/custom) is not suppported");
- return MM_ERROR_NOT_SUPPORT_API;
- }
- if ( !player->pipeline || !player->pipeline->audiobin )
- {
- debug_warning("filter element is not created yet.");
- }
- else
- {
- return_val_if_fail( player->pipeline->audiobin, MM_ERROR_PLAYER_NOT_INITIALIZED );
- filter_element = player->pipeline->audiobin[MMPLAYER_A_FILTER].gst;
-
- /* order action to sound effect plugin */
- g_object_set(filter_element, "filter-action", MM_AUDIO_FILTER_TYPE_NONE, NULL);
- debug_log("filter-action = %d", MM_AUDIO_FILTER_TYPE_NONE);
- }
-
- debug_fleave();
- return result;
-}
-
-
-int
-_mmplayer_sound_filter_custom_set_level_ext(mm_player_t *player, MMAudioFilterCustomType custom_filter_type, int level)
-{
- int filter_level_max = 0;
- int filter_level_min = 0;
- int count = 1; /* start from 1, because of excepting eq index */
- int ext_level_index = 1; /* start from 1, because of excepting eq index */
- int result = MM_ERROR_NONE;
-
- debug_fenter();
-
- return_val_if_fail( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
-
- /* check if EQ is supported */
- if ( !_mmplayer_is_supported_filter_type( MM_AUDIO_FILTER_TYPE_CUSTOM, custom_filter_type ) )
- {
- return MM_ERROR_PLAYER_SOUND_EFFECT_NOT_SUPPORTED_FILTER;
- }
-
- while ( count < MM_AUDIO_FILTER_CUSTOM_NUM )
- {
- if ( PLAYER_INI()->audio_filter_custom_list[count] )
- {
- if ( count == custom_filter_type )
- {
- filter_level_min = PLAYER_INI()->audio_filter_custom_min_level_list[ext_level_index];
- filter_level_max = PLAYER_INI()->audio_filter_custom_max_level_list[ext_level_index];
- debug_msg("level min value(%d), level max value(%d)", filter_level_min, filter_level_max);
- break;
- }
- ext_level_index++;
- if (ext_level_index == PLAYER_INI()->audio_filter_custom_ext_num + 1)
- {
- debug_error("could not find min, max value. maybe filter information in ini file is not proper for sound effect plugin");
- break;
- }
- }
- count++;
- }
-
- if ( level < filter_level_min || level > filter_level_max )
- {
- debug_error("out of range, level(%d)", level);
- result = MM_ERROR_INVALID_ARGUMENT;
- }
- else
- {
- player->audio_filter_info.custom_ext_level[custom_filter_type-1] = level;
- debug_msg("set ext[%d] = %d", custom_filter_type-1, level);
- }
-
- debug_fleave();
- return result;
-}
-
-
-int
-_mmplayer_sound_filter_custom_set_level_eq(mm_player_t *player, int index, int level)
-{
- gint eq_level_max = 0;
- gint eq_level_min = 0;
- int result = MM_ERROR_NONE;
- debug_fenter();
-
- return_val_if_fail( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
-
- /* check if EQ is supported */
- if ( !_mmplayer_is_supported_filter_type( MM_AUDIO_FILTER_TYPE_CUSTOM, MM_AUDIO_FILTER_CUSTOM_EQ ) )
- {
- return MM_ERROR_PLAYER_SOUND_EFFECT_NOT_SUPPORTED_FILTER;
- }
-
- if ( index < 0 || index > PLAYER_INI()->audio_filter_custom_eq_num - 1 )
- {
- debug_error("out of range, index(%d)", index);
- result = MM_ERROR_INVALID_ARGUMENT;
- }
- else
- {
- eq_level_min = PLAYER_INI()->audio_filter_custom_min_level_list[MM_AUDIO_FILTER_CUSTOM_EQ];
- eq_level_max = PLAYER_INI()->audio_filter_custom_max_level_list[MM_AUDIO_FILTER_CUSTOM_EQ];
- debug_msg("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);
- result = MM_ERROR_INVALID_ARGUMENT;
- }
- else
- {
- player->audio_filter_info.custom_eq_level[index] = level;
- debug_msg("set EQ[%d] = %d", index, level);
- }
- }
- debug_fleave();
-
- return result;
-}
-
-
-/* NOTE : parameter eq_index is only used for _set_eq_level() */
-int
-mm_player_sound_filter_custom_set_level(MMHandleType hplayer, MMAudioFilterCustomType filter_custom_type, int eq_index, int level)
-{
- mm_player_t* player = (mm_player_t*)hplayer;
- int result = MM_ERROR_NONE;
- debug_fenter();
-
- return_val_if_fail( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
-
- /* check if this filter type is supported */
- if ( !_mmplayer_is_supported_filter_type( MM_AUDIO_FILTER_TYPE_CUSTOM, filter_custom_type ) )
- {
- return MM_ERROR_PLAYER_SOUND_EFFECT_NOT_SUPPORTED_FILTER;
- }
-
- if (filter_custom_type == MM_AUDIO_FILTER_CUSTOM_EQ)
- {
- result = _mmplayer_sound_filter_custom_set_level_eq(player, eq_index, level);
- }
- else if (filter_custom_type > MM_AUDIO_FILTER_CUSTOM_EQ || filter_custom_type < MM_AUDIO_FILTER_CUSTOM_NUM)
- {
- result = _mmplayer_sound_filter_custom_set_level_ext(player, filter_custom_type, level);
- }
- else
- {
- debug_error("out of range, filter type(%d)", filter_custom_type);
- result = MM_ERROR_INVALID_ARGUMENT;
- }
- return result;
-}
-
-
-int
-mm_player_sound_filter_custom_get_eq_bands_number(MMHandleType hplayer, int *bands)
-{
- mm_player_t* player = (mm_player_t*)hplayer;
- int result = MM_ERROR_NONE;
- debug_fenter();
-
- return_val_if_fail( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
-
- /* check if EQ is supported */
- if ( !_mmplayer_is_supported_filter_type( MM_AUDIO_FILTER_TYPE_CUSTOM, MM_AUDIO_FILTER_CUSTOM_EQ ) )
- {
- return MM_ERROR_PLAYER_SOUND_EFFECT_NOT_SUPPORTED_FILTER;
- }
-
- *bands = PLAYER_INI()->audio_filter_custom_eq_num;
- debug_log("number of custom eq band = %d", *bands);
-
- debug_fleave();
-
- return result;
-}
-
-
-int
-mm_player_sound_filter_custom_get_level(MMHandleType hplayer, MMAudioFilterCustomType type, int eq_index, int *level)
-{
- mm_player_t* player = (mm_player_t*)hplayer;
- int result = MM_ERROR_NONE;
-
- debug_fenter();
-
- return_val_if_fail( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
- return_val_if_fail( level, MM_ERROR_PLAYER_NOT_INITIALIZED );
-
- /* check if this filter type is supported */
- if ( !_mmplayer_is_supported_filter_type( MM_AUDIO_FILTER_TYPE_CUSTOM, type ) )
- {
- return MM_ERROR_PLAYER_SOUND_EFFECT_NOT_SUPPORTED_FILTER;
- }
-
- if (type == MM_AUDIO_FILTER_CUSTOM_EQ)
- {
- if ( eq_index < 0 || eq_index > PLAYER_INI()->audio_filter_custom_eq_num - 1 )
- {
- debug_error("out of range, eq index(%d)", eq_index);
- result = MM_ERROR_INVALID_ARGUMENT;
- }
- else
- {
- *level = player->audio_filter_info.custom_eq_level[eq_index];
- debug_log("EQ index = %d, level = %d", eq_index, *level);
- }
- }
- else if ( type > MM_AUDIO_FILTER_CUSTOM_EQ && type < MM_AUDIO_FILTER_CUSTOM_NUM )
- {
- *level = player->audio_filter_info.custom_ext_level[type-1];
- debug_log("extention filter index = %d, level = %d", type, *level);
- }
- else
- {
- debug_error("out of range, type(%d)", type);
- result = MM_ERROR_INVALID_ARGUMENT;
- }
-
- debug_fleave();
-
- return result;
-}
-
-
-int
-mm_player_sound_filter_custom_get_level_range(MMHandleType hplayer, MMAudioFilterCustomType type, int *min, int *max)
-{
- mm_player_t* player = (mm_player_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 */
-
- debug_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 );
-
- /* check if this filter type is supported */
- if ( !_mmplayer_is_supported_filter_type( MM_AUDIO_FILTER_TYPE_CUSTOM, type ) )
- {
- return MM_ERROR_PLAYER_SOUND_EFFECT_NOT_SUPPORTED_FILTER;
- }
-
- if ( type == MM_AUDIO_FILTER_CUSTOM_EQ )
- {
- *min = PLAYER_INI()->audio_filter_custom_min_level_list[MM_AUDIO_FILTER_CUSTOM_EQ];
- *max = PLAYER_INI()->audio_filter_custom_max_level_list[MM_AUDIO_FILTER_CUSTOM_EQ];
- debug_log("EQ min level = %d, max level = %d", *min, *max);
- }
- else
- {
- while ( count < MM_AUDIO_FILTER_CUSTOM_NUM )
- {
- if ( PLAYER_INI()->audio_filter_custom_list[count] )
- {
- if ( count == type )
- {
- *min = PLAYER_INI()->audio_filter_custom_min_level_list[ext_level_index];
- *max = PLAYER_INI()->audio_filter_custom_max_level_list[ext_level_index];
- debug_msg("Extension filter(%d) min level = %d, max level = %d", count, *min, *max);
- break;
- }
- ext_level_index++;
- if ( ext_level_index == PLAYER_INI()->audio_filter_custom_ext_num + 1 )
- {
- debug_error("could not find min, max value. maybe filter information in ini file is not proper for sound effect plugin");
- break;
- }
- }
- count++;
- }
- }
-
- debug_fleave();
-
- return result;
-}
-
-
-int
-mm_player_sound_filter_custom_set_level_eq_from_list(MMHandleType hplayer, int *level_list, int size)
-{
- mm_player_t *player = (mm_player_t*)hplayer;
- gint i = 0;
- gint eq_level_min = 0;
- gint eq_level_max = 0;
- int result = MM_ERROR_NONE;
-
- debug_fenter();
-
- return_val_if_fail( player, MM_ERROR_PLAYER_NOT_INITIALIZED );
-
- /* check if EQ is supported */
- if ( !_mmplayer_is_supported_filter_type( MM_AUDIO_FILTER_TYPE_CUSTOM, MM_AUDIO_FILTER_CUSTOM_EQ ) )
- {
- return MM_ERROR_PLAYER_SOUND_EFFECT_NOT_SUPPORTED_FILTER;
- }
-
- if ( size != PLAYER_INI()->audio_filter_custom_eq_num )
- {
- debug_error("input size variable(%d) does not match with number of eq band(%d)", size, PLAYER_INI()->audio_filter_custom_eq_num);
- result = MM_ERROR_INVALID_ARGUMENT;
- }
- else
- {
- eq_level_min = PLAYER_INI()->audio_filter_custom_min_level_list[MM_AUDIO_FILTER_CUSTOM_EQ];
- eq_level_max = PLAYER_INI()->audio_filter_custom_max_level_list[MM_AUDIO_FILTER_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]);
- result = MM_ERROR_INVALID_ARGUMENT;
- break;
- }
- player->audio_filter_info.custom_eq_level[i] = level_list[i];
- }
- }
- debug_fleave();
-
- return result;
-}