4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: JongHyuk Choi <jhchoi.choi@samsung.com>, YeJin Cho <cho.yejin@samsung.com>,
7 * Seungbae Shin <seungbae.shin@samsung.com>, YoungHwan An <younghwan_.an@samsung.com>
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
23 #ifndef __MM_PLAYER_INI_C__
24 #define __MM_PLAYER_INI_C__
30 #include "iniparser.h"
31 #include <mm_player_ini.h>
33 #include <glib/gstdio.h>
35 /* internal functions, macros here */
36 #ifdef MM_PLAYER_DEFAULT_INI
37 static gboolean __generate_default_ini(void);
39 static void __get_element_list(mm_player_ini_t* ini, gchar* str, int keyword_type);
41 static void __mm_player_ini_check_ini_status(void);
44 #define MMPLAYER_INI_GET_STRING(x_dict, x_item, x_ini, x_default) \
46 gchar* str = iniparser_getstring(x_dict, x_ini, x_default); \
48 (strlen(str) > 0) && \
49 (strlen(str) < PLAYER_INI_MAX_STRLEN)) \
50 strncpy(x_item, str, PLAYER_INI_MAX_STRLEN-1); \
52 strncpy(x_item, x_default, PLAYER_INI_MAX_STRLEN-1); \
55 #define MMPLAYER_INI_GET_COLOR(x_dict, x_item, x_ini, x_default) \
57 gchar* str = iniparser_getstring(x_dict, x_ini, x_default); \
59 (strlen(str) > 0) && \
60 (strlen(str) < PLAYER_INI_MAX_STRLEN)) \
61 x_item = (guint) strtoul(str, NULL, 16); \
63 x_item = (guint) strtoul(x_default, NULL, 16); \
66 /* x_ini is the list of index to set TRUE at x_list[index] */
67 #define MMPLAYER_INI_GET_BOOLEAN_FROM_LIST(x_dict, x_list, x_list_max, x_ini, x_default) \
70 const char *delimiters = " ,"; \
71 char *usr_ptr = NULL; \
73 gchar temp_arr[PLAYER_INI_MAX_STRLEN] = {0}; \
74 MMPLAYER_INI_GET_STRING(x_dict, temp_arr, x_ini, x_default); \
75 token = strtok_r(temp_arr, delimiters, &usr_ptr); \
77 index = atoi(token); \
78 if (index < 0 || index > x_list_max -1) \
79 LOGW("%d is not valid index\n", index); \
81 x_list[index] = TRUE; \
82 token = strtok_r(NULL, delimiters, &usr_ptr); \
86 /* x_ini is the list of value to be set at x_list[index] */
87 #define MMPLAYER_INI_GET_INT_FROM_LIST(x_dict, x_list, x_list_max, x_ini, x_default) \
91 const char *delimiters = " ,"; \
92 char *usr_ptr = NULL; \
94 gchar temp_arr[PLAYER_INI_MAX_STRLEN] = {0}; \
95 MMPLAYER_INI_GET_STRING(x_dict, temp_arr, x_ini, x_default); \
96 token = strtok_r(temp_arr, delimiters, &usr_ptr); \
98 if (index > x_list_max -1) { \
99 LOGE("%d is not valid index\n", index); \
102 value = atoi(token); \
103 x_list[index] = value; \
106 token = strtok_r(NULL, delimiters, &usr_ptr); \
111 mm_player_ini_load(mm_player_ini_t* ini)
113 dictionary * dict = NULL;
116 __mm_player_ini_check_ini_status();
118 /* first, try to load existing ini file */
119 dict = iniparser_load(MM_PLAYER_INI_DEFAULT_PATH);
121 /* if no file exists. create one with set of default values */
123 #ifdef MM_PLAYER_DEFAULT_INI
124 LOGD("No inifile found. player will create default inifile.\n");
125 if (FALSE == __generate_default_ini())
126 LOGW("Creating default inifile failed. Player will use default values.\n");
128 dict = iniparser_load(MM_PLAYER_INI_DEFAULT_PATH); /* load default ini */
130 LOGD("No ini file found. \n");
131 return MM_ERROR_FILE_NOT_FOUND;
136 memset(ini, 0, sizeof(mm_player_ini_t));
139 /* if dict is available */
141 ini->disable_segtrap = iniparser_getboolean(dict, "general:disable segtrap", DEFAULT_DISABLE_SEGTRAP);
142 ini->skip_rescan = iniparser_getboolean(dict, "general:skip rescan", DEFAULT_SKIP_RESCAN);
143 ini->generate_dot = iniparser_getboolean(dict, "general:generate dot", DEFAULT_GENERATE_DOT);
144 ini->use_system_clock = iniparser_getboolean(dict, "general:use system clock", DEFAULT_USE_SYSTEM_CLOCK);
145 ini->live_state_change_timeout = iniparser_getint(dict, "general:live state change timeout", DEFAULT_LIVE_STATE_CHANGE_TIMEOUT);
146 ini->localplayback_state_change_timeout = iniparser_getint(dict, "general:localplayback state change timeout", DEFAULT_LOCALPLAYBACK_STATE_CHANGE_TIMEOUT);
147 ini->eos_delay = iniparser_getint(dict, "general:eos delay", DEFAULT_EOS_DELAY);
148 ini->async_start = iniparser_getboolean(dict, "general:async start", DEFAULT_ASYNC_START);
149 ini->video_playback_supported = iniparser_getboolean(dict, "general:video playback supported", DEFAULT_VIDEO_PLAYBACK_SUPPORTED);
150 ini->delay_before_repeat = iniparser_getint(dict, "general:delay before repeat", DEFAULT_DELAY_BEFORE_REPEAT);
151 ini->pcm_buffer_size = iniparser_getint(dict, "general:pcm buffer size", DEFAULT_PCM_BUFFER_SIZE);
152 ini->num_of_video_bo = iniparser_getint(dict, "general:video bo max", DEFAULT_NUM_OF_VIDEO_BO);
153 ini->video_bo_timeout = iniparser_getint(dict, "general:video bo timeout", DEFAULT_TIMEOUT_OF_VIDEO_BO);
155 MMPLAYER_INI_GET_STRING(dict, ini->audioresampler_element, "general:audio resampler element", DEFAULT_AUDIORESAMPLER);
156 MMPLAYER_INI_GET_STRING(dict, ini->audiocodec_element_hw, "general:audio codec element hw", DEFAULT_CODEC_HW);
157 MMPLAYER_INI_GET_STRING(dict, ini->audiosink_element, "general:audiosink element", DEFAULT_AUDIOSINK);
159 MMPLAYER_INI_GET_STRING(dict, ini->videosink_element_overlay, "general:videosink element overlay", DEFAULT_VIDEOSINK_OVERLAY);
160 MMPLAYER_INI_GET_STRING(dict, ini->videosink_element_fake, "general:videosink element fake", DEFAULT_VIDEOSINK_FAKE);
161 MMPLAYER_INI_GET_STRING(dict, ini->videocodec_element_hw, "general:video codec element hw", DEFAULT_CODEC_HW);
162 MMPLAYER_INI_GET_STRING(dict, ini->videoconverter_element, "general:video converter element", DEFAULT_VIDEO_CONVERTER);
164 __get_element_list(ini,
165 iniparser_getstring(dict, "general:audio codec element sw", DEFAULT_CODEC_SW), KEYWORD_A_SW_CODEC);
167 __get_element_list(ini,
168 iniparser_getstring(dict, "general:video codec element sw", DEFAULT_CODEC_SW), KEYWORD_V_SW_CODEC);
170 __get_element_list(ini,
171 iniparser_getstring(dict, "general:element exclude keyword", DEFAULT_EXCLUDE_KEYWORD), KEYWORD_EXCLUDE);
173 MMPLAYER_INI_GET_STRING(dict, ini->gst_param[0], "general:gstparam1", DEFAULT_GST_PARAM);
174 MMPLAYER_INI_GET_STRING(dict, ini->gst_param[1], "general:gstparam2", DEFAULT_GST_PARAM);
175 MMPLAYER_INI_GET_STRING(dict, ini->gst_param[2], "general:gstparam3", DEFAULT_GST_PARAM);
176 MMPLAYER_INI_GET_STRING(dict, ini->gst_param[3], "general:gstparam4", DEFAULT_GST_PARAM);
177 MMPLAYER_INI_GET_STRING(dict, ini->gst_param[4], "general:gstparam5", DEFAULT_GST_PARAM);
180 MMPLAYER_INI_GET_STRING(dict, ini->httpsrc_element, "http streaming:httpsrc element", DEFAULT_HTTPSRC);
181 ini->http_use_file_buffer = iniparser_getboolean(dict, "http streaming:http use file buffer", DEFAULT_HTTP_USE_FILE_BUFFER);
182 ini->http_ring_buffer_size = iniparser_getint(dict, "http streaming:http ring buffer size", DEFAULT_HTTP_RING_BUFFER_SIZE);
183 ini->http_buffering_limit = iniparser_getdouble(dict, "http streaming:http buffering high limit", DEFAULT_HTTP_BUFFERING_LIMIT);
184 ini->http_max_size_bytes = iniparser_getint(dict, "http streaming:http max size bytes", DEFAULT_HTTP_MAX_SIZE_BYTES);
185 ini->http_buffering_time = (gint)(iniparser_getdouble(dict, "http streaming:http buffering time", DEFAULT_HTTP_BUFFERING_TIME) * 1000);
186 ini->http_timeout = iniparser_getint(dict, "http streaming:http timeout", DEFAULT_HTTP_TIMEOUT);
188 /* dump buffer for debug */
189 __get_element_list(ini,
190 iniparser_getstring(dict, "general:dump element keyword", DEFAULT_EXCLUDE_KEYWORD), KEYWORD_DUMP);
192 MMPLAYER_INI_GET_STRING(dict, ini->dump_element_path, "general:dump element path", DEFAULT_DUMP_ELEMENT_PATH);
194 /* if dict is not available just fill the structure with default value */
195 LOGW("failed to load ini. using hardcoded default\n");
198 ini->disable_segtrap = DEFAULT_DISABLE_SEGTRAP;
199 ini->skip_rescan = DEFAULT_SKIP_RESCAN;
200 strncpy(ini->videosink_element_overlay, DEFAULT_VIDEOSINK_OVERLAY, PLAYER_INI_MAX_STRLEN - 1);
201 strncpy(ini->videosink_element_fake, DEFAULT_VIDEOSINK_FAKE, PLAYER_INI_MAX_STRLEN - 1);
202 ini->generate_dot = DEFAULT_GENERATE_DOT;
203 ini->use_system_clock = DEFAULT_USE_SYSTEM_CLOCK;
204 ini->live_state_change_timeout = DEFAULT_LIVE_STATE_CHANGE_TIMEOUT;
205 ini->localplayback_state_change_timeout = DEFAULT_LOCALPLAYBACK_STATE_CHANGE_TIMEOUT;
206 ini->eos_delay = DEFAULT_EOS_DELAY;
207 ini->async_start = DEFAULT_ASYNC_START;
208 ini->delay_before_repeat = DEFAULT_DELAY_BEFORE_REPEAT;
209 ini->video_playback_supported = DEFAULT_VIDEO_PLAYBACK_SUPPORTED;
210 ini->pcm_buffer_size = DEFAULT_PCM_BUFFER_SIZE;
211 ini->num_of_video_bo = DEFAULT_NUM_OF_VIDEO_BO;
212 ini->video_bo_timeout = DEFAULT_TIMEOUT_OF_VIDEO_BO;
214 strncpy(ini->audioresampler_element, DEFAULT_AUDIORESAMPLER, PLAYER_INI_MAX_STRLEN -1);
215 strncpy(ini->audiosink_element, DEFAULT_AUDIOSINK, PLAYER_INI_MAX_STRLEN -1);
216 strncpy(ini->audiocodec_element_hw, DEFAULT_CODEC_HW, PLAYER_INI_MAX_STRLEN - 1);
217 strncpy(ini->videocodec_element_hw, DEFAULT_CODEC_HW, PLAYER_INI_MAX_STRLEN - 1);
218 strncpy(ini->videoconverter_element, DEFAULT_VIDEO_CONVERTER, PLAYER_INI_MAX_STRLEN -1);
220 __get_element_list(ini, DEFAULT_CODEC_SW, KEYWORD_A_SW_CODEC);
221 __get_element_list(ini, DEFAULT_CODEC_SW, KEYWORD_V_SW_CODEC);
222 __get_element_list(ini, DEFAULT_EXCLUDE_KEYWORD, KEYWORD_EXCLUDE);
224 strncpy(ini->gst_param[0], DEFAULT_GST_PARAM, PLAYER_INI_MAX_PARAM_STRLEN - 1);
225 strncpy(ini->gst_param[1], DEFAULT_GST_PARAM, PLAYER_INI_MAX_PARAM_STRLEN - 1);
226 strncpy(ini->gst_param[2], DEFAULT_GST_PARAM, PLAYER_INI_MAX_PARAM_STRLEN - 1);
227 strncpy(ini->gst_param[3], DEFAULT_GST_PARAM, PLAYER_INI_MAX_PARAM_STRLEN - 1);
228 strncpy(ini->gst_param[4], DEFAULT_GST_PARAM, PLAYER_INI_MAX_PARAM_STRLEN - 1);
231 strncpy(ini->httpsrc_element, DEFAULT_HTTPSRC, PLAYER_INI_MAX_STRLEN - 1);
232 ini->http_buffering_limit = DEFAULT_HTTP_BUFFERING_LIMIT;
233 ini->http_use_file_buffer = DEFAULT_HTTP_USE_FILE_BUFFER;
234 ini->http_ring_buffer_size = DEFAULT_HTTP_RING_BUFFER_SIZE;
235 ini->http_max_size_bytes = DEFAULT_HTTP_MAX_SIZE_BYTES;
236 ini->http_buffering_time = (gint)(DEFAULT_HTTP_BUFFERING_TIME*1000);
237 ini->http_timeout = DEFAULT_HTTP_TIMEOUT;
239 /* dump buffer for debug */
240 __get_element_list(ini, DEFAULT_DUMP_ELEMENT_KEYWORD, KEYWORD_DUMP);
241 strncpy(ini->dump_element_path, DEFAULT_DUMP_ELEMENT_PATH, PLAYER_INI_MAX_STRLEN - 1);
244 /* free dict as we got our own structure */
245 iniparser_freedict(dict);
248 LOGD("player settings -----------------------------------\n");
251 LOGD("disable segtrap : %d\n", ini->disable_segtrap);
252 LOGD("skip rescan : %d\n", ini->skip_rescan);
253 LOGD("videosink element overlay: %s\n", ini->videosink_element_overlay);
254 LOGD("videosink element fake: %s\n", ini->videosink_element_fake);
255 LOGD("video converter element : %s\n", ini->videoconverter_element);
256 LOGD("video codec element(hw) : %s\n", ini->videocodec_element_hw);
257 for (idx = 0; ini->videocodec_element_sw[idx][0] != '\0'; idx++)
258 LOGD("video codec element(sw%d) %s\n", idx, ini->videocodec_element_sw[idx]);
259 LOGD("audio codec element(hw) : %s\n", ini->audiocodec_element_hw);
260 for (idx = 0; ini->audiocodec_element_sw[idx][0] != '\0'; idx++)
261 LOGD("audio codec element(sw%d) %s\n", idx, ini->audiocodec_element_sw[idx]);
262 LOGD("audio resampler element : %s\n", ini->audioresampler_element);
263 LOGD("audiosink element : %s\n", ini->audiosink_element);
264 LOGD("generate dot : %d\n", ini->generate_dot);
265 LOGD("use system clock(video only) : %d\n", ini->use_system_clock);
266 LOGD("live state change timeout(sec) : %d\n", ini->live_state_change_timeout);
267 LOGD("localplayback state change timeout(sec) : %d\n", ini->localplayback_state_change_timeout);
268 LOGD("eos_delay(msec) : %d\n", ini->eos_delay);
269 LOGD("delay before repeat(msec) : %d\n", ini->delay_before_repeat);
270 LOGD("async_start : %d\n", ini->async_start);
271 LOGD("video_playback_supported : %d\n", ini->video_playback_supported);
272 LOGD("pcm buffer size(bytes) : %d\n", ini->pcm_buffer_size);
273 LOGD("num of video bo : %d\n", ini->num_of_video_bo);
274 LOGD("video bo timeout : %d\n", ini->video_bo_timeout);
275 LOGD("gst param1 : %s\n", ini->gst_param[0]);
276 LOGD("gst param2 : %s\n", ini->gst_param[1]);
277 LOGD("gst param3 : %s\n", ini->gst_param[2]);
278 LOGD("gst param4 : %s\n", ini->gst_param[3]);
279 LOGD("gst param5 : %s\n", ini->gst_param[4]);
281 for (idx = 0; ini->exclude_element_keyword[idx][0] != '\0'; idx++)
282 LOGD("exclude_element_keyword [%d] : %s\n", idx, ini->exclude_element_keyword[idx]);
284 for (idx = 0; ini->dump_element_keyword[idx][0] != '\0'; idx++)
285 LOGD("dump_element_keyword [%d] : %s\n", idx, ini->dump_element_keyword[idx]);
288 LOGD("httpsrc element : %s\n", ini->httpsrc_element);
289 LOGD("http buffering limit : %f \n", ini->http_buffering_limit);
290 LOGD("http use file buffer : %d \n", ini->http_use_file_buffer);
291 LOGD("http ring buffer size : %d \n", ini->http_ring_buffer_size);
292 LOGD("http max_size bytes : %d \n", ini->http_max_size_bytes);
293 LOGD("http buffering time : %d \n", ini->http_buffering_time);
294 LOGD("http timeout : %d \n", ini->http_timeout);
296 return MM_ERROR_NONE;
300 mm_player_audio_effect_ini_load(mm_player_ini_t* ini)
302 dictionary * dict_audioeffect = NULL;
304 dict_audioeffect = iniparser_load(MM_PLAYER_INI_DEFAULT_AUDIOEFFECT_PATH);
305 if (!dict_audioeffect) {
306 LOGE("No audio effect ini file found. \n");
307 return MM_ERROR_FILE_NOT_FOUND;
310 /* audio effect element name */
311 MMPLAYER_INI_GET_STRING(dict_audioeffect, ini->audioeffect_element, "audio effect:audio effect element", DEFAULT_AUDIO_EFFECT_ELEMENT);
312 if (!ini->audioeffect_element[0]) {
313 LOGW("could not parse name of audio effect. \n");
314 iniparser_freedict(dict_audioeffect);
315 /* NOTE : in this case, we are not going to create audio filter element */
316 return MM_ERROR_NONE;
319 /* audio effect (Preset)*/
320 ini->use_audio_effect_preset = iniparser_getboolean(dict_audioeffect, "audio effect:audio effect preset", DEFAULT_USE_AUDIO_EFFECT_PRESET);
321 if (ini->use_audio_effect_preset) {
322 MMPLAYER_INI_GET_BOOLEAN_FROM_LIST(dict_audioeffect, ini->audio_effect_preset_list, MM_AUDIO_EFFECT_PRESET_NUM,
323 "audio effect:audio effect preset list", DEFAULT_AUDIO_EFFECT_PRESET_LIST);
324 MMPLAYER_INI_GET_BOOLEAN_FROM_LIST(dict_audioeffect, ini->audio_effect_preset_earphone_only_list, MM_AUDIO_EFFECT_PRESET_NUM,
325 "audio effect:audio effect preset earphone only", DEFAULT_AUDIO_EFFECT_PRESET_LIST_EARPHONE_ONLY);
328 /* audio effect user (EQ / Extension effects) */
329 ini->use_audio_effect_custom = iniparser_getboolean(dict_audioeffect, "audio effect:audio effect custom", DEFAULT_USE_AUDIO_EFFECT_CUSTOM);
330 if (ini->use_audio_effect_custom) {
331 MMPLAYER_INI_GET_BOOLEAN_FROM_LIST(dict_audioeffect, ini->audio_effect_custom_list, MM_AUDIO_EFFECT_CUSTOM_NUM,
332 "audio effect:audio effect custom list", DEFAULT_AUDIO_EFFECT_CUSTOM_LIST);
333 MMPLAYER_INI_GET_BOOLEAN_FROM_LIST(dict_audioeffect, ini->audio_effect_custom_earphone_only_list, MM_AUDIO_EFFECT_CUSTOM_NUM,
334 "audio effect:audio effect custom earphone only", DEFAULT_AUDIO_EFFECT_CUSTOM_LIST_EARPHONE_ONLY);
336 /* audio effect custom : EQ */
337 if (ini->audio_effect_custom_list[MM_AUDIO_EFFECT_CUSTOM_EQ]) {
338 ini->audio_effect_custom_eq_band_num = iniparser_getint(dict_audioeffect, "audio effect:audio effect custom eq band num",
339 DEFAULT_AUDIO_EFFECT_CUSTOM_EQ_BAND_NUM);
340 if (ini->audio_effect_custom_eq_band_num < DEFAULT_AUDIO_EFFECT_CUSTOM_EQ_BAND_NUM ||
341 ini->audio_effect_custom_eq_band_num > MM_AUDIO_EFFECT_EQ_BAND_NUM_MAX) {
342 LOGE("audio_effect_custom_eq_band_num(%d) is not valid range(%d - %d), set the value %d",
343 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);
344 ini->audio_effect_custom_eq_band_num = DEFAULT_AUDIO_EFFECT_CUSTOM_EQ_BAND_NUM;
346 iniparser_freedict(dict_audioeffect);
347 return MM_ERROR_PLAYER_INTERNAL;
349 if (ini->audio_effect_custom_eq_band_num) {
350 MMPLAYER_INI_GET_INT_FROM_LIST(dict_audioeffect, ini->audio_effect_custom_eq_band_width, MM_AUDIO_EFFECT_EQ_BAND_NUM_MAX,
351 "audio effect:audio effect custom eq band width", DEFAULT_AUDIO_EFFECT_CUSTOM_EQ_BAND_WIDTH);
352 MMPLAYER_INI_GET_INT_FROM_LIST(dict_audioeffect, ini->audio_effect_custom_eq_band_freq, MM_AUDIO_EFFECT_EQ_BAND_NUM_MAX,
353 "audio effect:audio effect custom eq band freq", DEFAULT_AUDIO_EFFECT_CUSTOM_EQ_BAND_FREQ);
358 /* audio effect custom : Extension effects */
359 ini->audio_effect_custom_ext_num = iniparser_getint(dict_audioeffect, "audio effect:audio effect custom ext num",
360 DEFAULT_AUDIO_EFFECT_CUSTOM_EXT_NUM);
362 /* Min/Max value list of EQ / Extension effects */
363 if (ini->audio_effect_custom_eq_band_num || ini->audio_effect_custom_ext_num) {
364 MMPLAYER_INI_GET_INT_FROM_LIST(dict_audioeffect, ini->audio_effect_custom_min_level_list, MM_AUDIO_EFFECT_CUSTOM_NUM,
365 "audio effect:audio effect custom min list", DEFAULT_AUDIO_EFFECT_CUSTOM_LIST);
366 MMPLAYER_INI_GET_INT_FROM_LIST(dict_audioeffect, ini->audio_effect_custom_max_level_list, MM_AUDIO_EFFECT_CUSTOM_NUM,
367 "audio effect:audio effect custom max list", DEFAULT_AUDIO_EFFECT_CUSTOM_LIST);
371 /* audio effect element name */
372 MMPLAYER_INI_GET_STRING(dict_audioeffect, ini->audioeffect_element_custom, "audio effect:audio effect element custom", DEFAULT_AUDIO_EFFECT_ELEMENT);
373 if (!ini->audioeffect_element_custom[0])
374 LOGW("no secondary audio effect \n");
376 LOGD("audioeffect element custom : %s\n", ini->audioeffect_element_custom);
379 LOGD("audioeffect element : %s\n", ini->audioeffect_element);
380 LOGD("audio effect preset mode : %d\n", ini->use_audio_effect_preset);
381 LOGD("audio effect custom mode : %d\n", ini->use_audio_effect_custom);
384 for (i = 0; i < MM_AUDIO_EFFECT_PRESET_NUM; i++)
385 LOGD("audio_effect_preset_list: %d (is it for earphone only?(%d))\n", ini->audio_effect_preset_list[i], ini->audio_effect_preset_earphone_only_list[i]);
387 for (i = 0; i < MM_AUDIO_EFFECT_CUSTOM_NUM; i++)
388 LOGD("audio_effect_custom_list : %d (is it for earphone only?(%d))\n", ini->audio_effect_custom_list[i], ini->audio_effect_custom_earphone_only_list[i]);
389 LOGD("audio_effect_custom : eq_band_num(%d), ext_num(%d)\n", ini->audio_effect_custom_eq_band_num, ini->audio_effect_custom_ext_num);
390 LOGD("audio_effect_custom_EQ : width(Hz) / central frequency(Hz)");
391 for (i = 0; i < ini->audio_effect_custom_eq_band_num; i++)
392 LOGD(" EQ band index(%d) : %8d / %8d", i, ini->audio_effect_custom_eq_band_width[i], ini->audio_effect_custom_eq_band_freq[i]);
393 for (i = 0; i < MM_AUDIO_EFFECT_CUSTOM_NUM; i++)
394 LOGD("audio_effect_custom_level_min_max(idx:%d) : Min(%d), Max(%d)\n", i, ini->audio_effect_custom_min_level_list[i], ini->audio_effect_custom_max_level_list[i]);
396 iniparser_freedict(dict_audioeffect);
398 return MM_ERROR_NONE;
403 void __mm_player_ini_check_ini_status(void)
405 struct stat ini_buff;
407 if (g_stat(MM_PLAYER_INI_DEFAULT_PATH, &ini_buff) < 0) {
408 LOGW("failed to get player ini status\n");
410 if (ini_buff.st_size < 5) {
411 LOGW("player.ini file size=%d, Corrupted!So, Removed\n", (int)ini_buff.st_size);
413 if (g_remove(MM_PLAYER_INI_DEFAULT_PATH) == -1)
414 LOGE("failed to delete corrupted ini");
419 #ifdef MM_PLAYER_DEFAULT_INI
421 gboolean __generate_default_ini(void)
424 gchar* default_ini = MM_PLAYER_DEFAULT_INI;
427 /* create new file */
428 fp = fopen(MM_PLAYER_INI_DEFAULT_PATH, "wt");
433 /* writing default ini file */
434 if (strlen(default_ini) != fwrite(default_ini, 1, strlen(default_ini), fp)) {
445 void __get_element_list(mm_player_ini_t* ini, gchar* str, int keyword_type)
450 gchar* strtmp = NULL;
458 strtmp = g_strdup(str);
460 /* trimming. it works inplace */
465 list = g_strsplit(strtmp, ",", 10);
475 switch (keyword_type) {
476 case KEYWORD_EXCLUDE:
478 for (walk = list; *walk; walk++) {
479 strncpy(ini->exclude_element_keyword[i], *walk, (PLAYER_INI_MAX_STRLEN - 1));
481 g_strstrip(ini->exclude_element_keyword[i]);
483 ini->exclude_element_keyword[i][PLAYER_INI_MAX_STRLEN -1] = '\0';
487 /* mark last item to NULL */
488 ini->exclude_element_keyword[i][0] = '\0';
494 for (walk = list; *walk; walk++) {
495 strncpy(ini->dump_element_keyword[i], *walk, (PLAYER_INI_MAX_STRLEN - 1));
497 g_strstrip(ini->dump_element_keyword[i]);
499 ini->dump_element_keyword[i][PLAYER_INI_MAX_STRLEN -1] = '\0';
503 /* mark last item to NULL */
504 ini->dump_element_keyword[i][0] = '\0';
508 case KEYWORD_V_SW_CODEC:
510 for (walk = list; *walk; walk++) {
511 strncpy(ini->videocodec_element_sw[i], *walk, (PLAYER_INI_MAX_STRLEN - 1));
513 g_strstrip(ini->videocodec_element_sw[i]);
515 ini->videocodec_element_sw[i][PLAYER_INI_MAX_STRLEN -1] = '\0';
519 /* mark last item to NULL */
520 ini->videocodec_element_sw[i][0] = '\0';
523 case KEYWORD_A_SW_CODEC:
525 for (walk = list; *walk; walk++) {
526 strncpy(ini->audiocodec_element_sw[i], *walk, (PLAYER_INI_MAX_STRLEN - 1));
528 g_strstrip(ini->audiocodec_element_sw[i]);
530 ini->audiocodec_element_sw[i][PLAYER_INI_MAX_STRLEN -1] = '\0';
534 /* mark last item to NULL */
535 ini->audiocodec_element_sw[i][0] = '\0';