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 <mm_player_utils.h>
34 #include <glib/gstdio.h>
36 /* internal functions, macros here */
37 #ifdef MM_PLAYER_DEFAULT_INI
38 static gboolean __generate_default_ini(void);
40 static void __get_element_list(mm_player_ini_t *ini, gchar *str, int keyword_type);
42 static void __mm_player_ini_check_ini_status(void);
45 #define MMPLAYER_INI_GET_STRING(x_dict, x_item, x_ini, x_default) \
47 gchar *str = iniparser_getstring(x_dict, x_ini, x_default); \
49 (strlen(str) > 0) && \
50 (strlen(str) < PLAYER_INI_MAX_STRLEN)) \
51 strncpy(x_item, str, PLAYER_INI_MAX_STRLEN-1); \
53 strncpy(x_item, x_default, PLAYER_INI_MAX_STRLEN-1); \
56 #define MMPLAYER_INI_GET_COLOR(x_dict, x_item, x_ini, x_default) \
58 gchar *str = iniparser_getstring(x_dict, x_ini, x_default); \
60 (strlen(str) > 0) && \
61 (strlen(str) < PLAYER_INI_MAX_STRLEN)) \
62 x_item = (guint) strtoul(str, NULL, 16); \
64 x_item = (guint) strtoul(x_default, NULL, 16); \
67 /* x_ini is the list of index to set TRUE at x_list[index] */
68 #define MMPLAYER_INI_GET_BOOLEAN_FROM_LIST(x_dict, x_list, x_list_max, x_ini, x_default) \
71 const char *delimiters = " ,"; \
72 char *usr_ptr = NULL; \
74 gchar temp_arr[PLAYER_INI_MAX_STRLEN] = {0}; \
75 MMPLAYER_INI_GET_STRING(x_dict, temp_arr, x_ini, x_default); \
76 token = strtok_r(temp_arr, delimiters, &usr_ptr); \
78 index = atoi(token); \
79 if (index < 0 || index > x_list_max -1) \
80 LOGW("%d is not valid index", index); \
82 x_list[index] = TRUE; \
83 token = strtok_r(NULL, delimiters, &usr_ptr); \
87 /* x_ini is the list of value to be set at x_list[index] */
88 #define MMPLAYER_INI_GET_INT_FROM_LIST(x_dict, x_list, x_list_max, x_ini, x_default) \
92 const char *delimiters = " ,"; \
93 char *usr_ptr = NULL; \
95 gchar temp_arr[PLAYER_INI_MAX_STRLEN] = {0, }; \
96 MMPLAYER_INI_GET_STRING(x_dict, temp_arr, x_ini, x_default); \
97 token = strtok_r(temp_arr, delimiters, &usr_ptr); \
99 if (index > x_list_max -1) { \
100 LOGE("%d is not valid index", index); \
103 value = atoi(token); \
104 x_list[index] = value; \
107 token = strtok_r(NULL, delimiters, &usr_ptr); \
112 mm_player_ini_load(mm_player_ini_t *ini)
114 dictionary *dict = NULL;
117 __mm_player_ini_check_ini_status();
119 /* first, try to load existing ini file */
120 dict = iniparser_load(MM_PLAYER_INI_DEFAULT_PATH);
122 /* if no file exists. create one with set of default values */
124 #ifdef MM_PLAYER_DEFAULT_INI
125 LOGD("No inifile found. player will create default inifile.");
126 if (__generate_default_ini() == FALSE)
127 LOGW("Creating default inifile failed. Player will use default values.");
129 dict = iniparser_load(MM_PLAYER_INI_DEFAULT_PATH); /* load default ini */
131 LOGD("No ini file found. ");
132 return MM_ERROR_FILE_NOT_FOUND;
137 memset(ini, 0, sizeof(mm_player_ini_t));
140 /* if dict is available */
142 ini->disable_segtrap = iniparser_getboolean(dict, "general:disable segtrap", DEFAULT_DISABLE_SEGTRAP);
143 ini->skip_rescan = iniparser_getboolean(dict, "general:skip rescan", DEFAULT_SKIP_RESCAN);
144 ini->generate_dot = iniparser_getboolean(dict, "general:generate dot", DEFAULT_GENERATE_DOT);
145 ini->use_system_clock = iniparser_getboolean(dict, "general:use system clock", DEFAULT_USE_SYSTEM_CLOCK);
146 ini->live_state_change_timeout = iniparser_getint(dict, "general:live state change timeout", DEFAULT_LIVE_STATE_CHANGE_TIMEOUT);
147 ini->localplayback_state_change_timeout = iniparser_getint(dict, "general:localplayback state change timeout", DEFAULT_LOCALPLAYBACK_STATE_CHANGE_TIMEOUT);
148 ini->eos_delay = iniparser_getint(dict, "general:eos delay", DEFAULT_EOS_DELAY);
149 ini->async_start = iniparser_getboolean(dict, "general:async start", DEFAULT_ASYNC_START);
150 ini->video_playback_supported = iniparser_getboolean(dict, "general:video playback supported", DEFAULT_VIDEO_PLAYBACK_SUPPORTED);
151 ini->delay_before_repeat = iniparser_getint(dict, "general:delay before repeat", DEFAULT_DELAY_BEFORE_REPEAT);
152 ini->pcm_buffer_size = iniparser_getint(dict, "general:pcm buffer size", DEFAULT_PCM_BUFFER_SIZE);
153 ini->num_of_video_bo = iniparser_getint(dict, "general:video bo max", DEFAULT_NUM_OF_VIDEO_BO);
154 ini->video_bo_timeout = iniparser_getint(dict, "general:video bo timeout", DEFAULT_TIMEOUT_OF_VIDEO_BO);
156 MMPLAYER_INI_GET_STRING(dict, ini->audioresampler_element, "general:audio resampler element", DEFAULT_AUDIORESAMPLER);
157 MMPLAYER_INI_GET_STRING(dict, ini->audiocodec_element_hw, "general:audio codec element hw", DEFAULT_CODEC_HW);
158 MMPLAYER_INI_GET_STRING(dict, ini->audiosink_element, "general:audiosink element", DEFAULT_AUDIOSINK);
160 MMPLAYER_INI_GET_STRING(dict, ini->videosink_element_overlay, "general:videosink element overlay", DEFAULT_VIDEOSINK_OVERLAY);
161 MMPLAYER_INI_GET_STRING(dict, ini->videosink_element_fake, "general:videosink element fake", DEFAULT_VIDEOSINK_FAKE);
162 MMPLAYER_INI_GET_STRING(dict, ini->videocodec_element_hw, "general:video codec element hw", DEFAULT_CODEC_HW);
163 MMPLAYER_INI_GET_STRING(dict, ini->videoconverter_element, "general:video converter element", DEFAULT_VIDEO_CONVERTER);
165 __get_element_list(ini,
166 iniparser_getstring(dict, "general:audio codec element sw", DEFAULT_CODEC_SW), KEYWORD_A_SW_CODEC);
168 __get_element_list(ini,
169 iniparser_getstring(dict, "general:video codec element sw", DEFAULT_CODEC_SW), KEYWORD_V_SW_CODEC);
171 __get_element_list(ini,
172 iniparser_getstring(dict, "general:element exclude keyword", DEFAULT_EXCLUDE_KEYWORD), KEYWORD_EXCLUDE);
174 __get_element_list(ini,
175 iniparser_getstring(dict, "general:unsupported codec keyword", DEFAULT_UNSUPPORTED_CODEC_KEYWORD), KEYWORD_UNSUPPORTED_CODEC);
177 MMPLAYER_INI_GET_STRING(dict, ini->gst_param[0], "general:gstparam1", DEFAULT_GST_PARAM);
178 MMPLAYER_INI_GET_STRING(dict, ini->gst_param[1], "general:gstparam2", DEFAULT_GST_PARAM);
179 MMPLAYER_INI_GET_STRING(dict, ini->gst_param[2], "general:gstparam3", DEFAULT_GST_PARAM);
180 MMPLAYER_INI_GET_STRING(dict, ini->gst_param[3], "general:gstparam4", DEFAULT_GST_PARAM);
181 MMPLAYER_INI_GET_STRING(dict, ini->gst_param[4], "general:gstparam5", DEFAULT_GST_PARAM);
184 MMPLAYER_INI_GET_STRING(dict, ini->httpsrc_element, "http streaming:httpsrc element", DEFAULT_HTTPSRC);
185 ini->http_ring_buffer_size = iniparser_getint(dict, "http streaming:http ring buffer size", DEFAULT_HTTP_RING_BUFFER_SIZE);
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");
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);
223 __get_element_list(ini, DEFAULT_UNSUPPORTED_CODEC_KEYWORD, KEYWORD_UNSUPPORTED_CODEC);
225 strncpy(ini->gst_param[0], DEFAULT_GST_PARAM, PLAYER_INI_MAX_PARAM_STRLEN - 1);
226 strncpy(ini->gst_param[1], DEFAULT_GST_PARAM, PLAYER_INI_MAX_PARAM_STRLEN - 1);
227 strncpy(ini->gst_param[2], DEFAULT_GST_PARAM, PLAYER_INI_MAX_PARAM_STRLEN - 1);
228 strncpy(ini->gst_param[3], DEFAULT_GST_PARAM, PLAYER_INI_MAX_PARAM_STRLEN - 1);
229 strncpy(ini->gst_param[4], DEFAULT_GST_PARAM, PLAYER_INI_MAX_PARAM_STRLEN - 1);
232 strncpy(ini->httpsrc_element, DEFAULT_HTTPSRC, PLAYER_INI_MAX_STRLEN - 1);
233 ini->http_ring_buffer_size = DEFAULT_HTTP_RING_BUFFER_SIZE;
234 ini->http_timeout = DEFAULT_HTTP_TIMEOUT;
236 /* dump buffer for debug */
237 __get_element_list(ini, DEFAULT_DUMP_ELEMENT_KEYWORD, KEYWORD_DUMP);
238 strncpy(ini->dump_element_path, DEFAULT_DUMP_ELEMENT_PATH, PLAYER_INI_MAX_STRLEN - 1);
241 /* free dict as we got our own structure */
242 iniparser_freedict(dict);
245 LOGD("player settings -----------------------------------");
248 LOGD("disable segtrap : %d", ini->disable_segtrap);
249 LOGD("skip rescan : %d", ini->skip_rescan);
250 LOGD("videosink element overlay: %s", ini->videosink_element_overlay);
251 LOGD("videosink element fake: %s", ini->videosink_element_fake);
252 LOGD("video converter element : %s", ini->videoconverter_element);
253 LOGD("video codec element(hw) : %s", ini->videocodec_element_hw);
254 for (idx = 0; ini->videocodec_element_sw[idx][0] != '\0'; idx++)
255 LOGD("video codec element(sw%d) %s", idx, ini->videocodec_element_sw[idx]);
256 LOGD("audio codec element(hw) : %s", ini->audiocodec_element_hw);
257 for (idx = 0; ini->audiocodec_element_sw[idx][0] != '\0'; idx++)
258 LOGD("audio codec element(sw%d) %s", idx, ini->audiocodec_element_sw[idx]);
259 LOGD("audio resampler element : %s", ini->audioresampler_element);
260 LOGD("audiosink element : %s", ini->audiosink_element);
261 LOGD("generate dot : %d", ini->generate_dot);
262 LOGD("use system clock(video only) : %d", ini->use_system_clock);
263 LOGD("live state change timeout(sec) : %d", ini->live_state_change_timeout);
264 LOGD("localplayback state change timeout(sec) : %d", ini->localplayback_state_change_timeout);
265 LOGD("eos_delay(msec) : %d", ini->eos_delay);
266 LOGD("delay before repeat(msec) : %d", ini->delay_before_repeat);
267 LOGD("async_start : %d", ini->async_start);
268 LOGD("video_playback_supported : %d", ini->video_playback_supported);
269 LOGD("pcm buffer size(bytes) : %d", ini->pcm_buffer_size);
270 LOGD("num of video bo : %d", ini->num_of_video_bo);
271 LOGD("video bo timeout : %d", ini->video_bo_timeout);
272 LOGD("gst param1 : %s", ini->gst_param[0]);
273 LOGD("gst param2 : %s", ini->gst_param[1]);
274 LOGD("gst param3 : %s", ini->gst_param[2]);
275 LOGD("gst param4 : %s", ini->gst_param[3]);
276 LOGD("gst param5 : %s", ini->gst_param[4]);
278 for (idx = 0; ini->exclude_element_keyword[idx][0] != '\0'; idx++)
279 LOGD("exclude_element_keyword [%d] : %s", idx, ini->exclude_element_keyword[idx]);
281 for (idx = 0; ini->dump_element_keyword[idx][0] != '\0'; idx++)
282 LOGD("dump_element_keyword [%d] : %s", idx, ini->dump_element_keyword[idx]);
284 for (idx = 0; ini->unsupported_codec_keyword[idx][0] != '\0'; idx++)
285 LOGD("unsupported_codec_keyword [%d] : %s", idx, ini->dump_element_keyword[idx]);
288 LOGD("httpsrc element : %s", ini->httpsrc_element);
289 LOGD("http ring buffer size : %d", ini->http_ring_buffer_size);
290 LOGD("http timeout : %d", ini->http_timeout);
292 return MM_ERROR_NONE;
296 mm_player_audio_effect_ini_load(mm_player_ini_t *ini)
298 dictionary *dict_audioeffect = NULL;
300 dict_audioeffect = iniparser_load(MM_PLAYER_INI_DEFAULT_AUDIOEFFECT_PATH);
301 if (!dict_audioeffect) {
302 LOGE("No audio effect ini file found.");
303 return MM_ERROR_FILE_NOT_FOUND;
306 /* audio effect element name */
307 MMPLAYER_INI_GET_STRING(dict_audioeffect, ini->audioeffect_element, "audio effect:audio effect element", DEFAULT_AUDIO_EFFECT_ELEMENT);
308 if (!ini->audioeffect_element[0]) {
309 LOGW("could not parse name of audio effect.");
310 iniparser_freedict(dict_audioeffect);
311 /* NOTE : in this case, we are not going to create audio filter element */
312 return MM_ERROR_NONE;
315 /* audio effect (Preset)*/
316 ini->use_audio_effect_preset = iniparser_getboolean(dict_audioeffect, "audio effect:audio effect preset", DEFAULT_USE_AUDIO_EFFECT_PRESET);
317 if (ini->use_audio_effect_preset) {
318 MMPLAYER_INI_GET_BOOLEAN_FROM_LIST(dict_audioeffect, ini->audio_effect_preset_list, MM_AUDIO_EFFECT_PRESET_NUM,
319 "audio effect:audio effect preset list", DEFAULT_AUDIO_EFFECT_PRESET_LIST);
320 MMPLAYER_INI_GET_BOOLEAN_FROM_LIST(dict_audioeffect, ini->audio_effect_preset_earphone_only_list, MM_AUDIO_EFFECT_PRESET_NUM,
321 "audio effect:audio effect preset earphone only", DEFAULT_AUDIO_EFFECT_PRESET_LIST_EARPHONE_ONLY);
324 /* audio effect user (EQ / Extension effects) */
325 ini->use_audio_effect_custom = iniparser_getboolean(dict_audioeffect, "audio effect:audio effect custom", DEFAULT_USE_AUDIO_EFFECT_CUSTOM);
326 if (ini->use_audio_effect_custom) {
327 MMPLAYER_INI_GET_BOOLEAN_FROM_LIST(dict_audioeffect, ini->audio_effect_custom_list, MM_AUDIO_EFFECT_CUSTOM_NUM,
328 "audio effect:audio effect custom list", DEFAULT_AUDIO_EFFECT_CUSTOM_LIST);
329 MMPLAYER_INI_GET_BOOLEAN_FROM_LIST(dict_audioeffect, ini->audio_effect_custom_earphone_only_list, MM_AUDIO_EFFECT_CUSTOM_NUM,
330 "audio effect:audio effect custom earphone only", DEFAULT_AUDIO_EFFECT_CUSTOM_LIST_EARPHONE_ONLY);
332 /* audio effect custom : EQ */
333 if (ini->audio_effect_custom_list[MM_AUDIO_EFFECT_CUSTOM_EQ]) {
334 ini->audio_effect_custom_eq_band_num = iniparser_getint(dict_audioeffect, "audio effect:audio effect custom eq band num",
335 DEFAULT_AUDIO_EFFECT_CUSTOM_EQ_BAND_NUM);
336 if (ini->audio_effect_custom_eq_band_num < DEFAULT_AUDIO_EFFECT_CUSTOM_EQ_BAND_NUM ||
337 ini->audio_effect_custom_eq_band_num > MM_AUDIO_EFFECT_EQ_BAND_NUM_MAX) {
338 LOGE("audio_effect_custom_eq_band_num(%d) is not valid range(%d - %d), set the value %d",
339 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);
340 ini->audio_effect_custom_eq_band_num = DEFAULT_AUDIO_EFFECT_CUSTOM_EQ_BAND_NUM;
342 iniparser_freedict(dict_audioeffect);
343 return MM_ERROR_PLAYER_INTERNAL;
345 if (ini->audio_effect_custom_eq_band_num) {
346 MMPLAYER_INI_GET_INT_FROM_LIST(dict_audioeffect, ini->audio_effect_custom_eq_band_width, MM_AUDIO_EFFECT_EQ_BAND_NUM_MAX,
347 "audio effect:audio effect custom eq band width", DEFAULT_AUDIO_EFFECT_CUSTOM_EQ_BAND_WIDTH);
348 MMPLAYER_INI_GET_INT_FROM_LIST(dict_audioeffect, ini->audio_effect_custom_eq_band_freq, MM_AUDIO_EFFECT_EQ_BAND_NUM_MAX,
349 "audio effect:audio effect custom eq band freq", DEFAULT_AUDIO_EFFECT_CUSTOM_EQ_BAND_FREQ);
354 /* audio effect custom : Extension effects */
355 ini->audio_effect_custom_ext_num = iniparser_getint(dict_audioeffect, "audio effect:audio effect custom ext num",
356 DEFAULT_AUDIO_EFFECT_CUSTOM_EXT_NUM);
358 /* Min/Max value list of EQ / Extension effects */
359 if (ini->audio_effect_custom_eq_band_num || ini->audio_effect_custom_ext_num) {
360 MMPLAYER_INI_GET_INT_FROM_LIST(dict_audioeffect, ini->audio_effect_custom_min_level_list, MM_AUDIO_EFFECT_CUSTOM_NUM,
361 "audio effect:audio effect custom min list", DEFAULT_AUDIO_EFFECT_CUSTOM_LIST);
362 MMPLAYER_INI_GET_INT_FROM_LIST(dict_audioeffect, ini->audio_effect_custom_max_level_list, MM_AUDIO_EFFECT_CUSTOM_NUM,
363 "audio effect:audio effect custom max list", DEFAULT_AUDIO_EFFECT_CUSTOM_LIST);
367 /* audio effect element name */
368 MMPLAYER_INI_GET_STRING(dict_audioeffect, ini->audioeffect_element_custom, "audio effect:audio effect element custom", DEFAULT_AUDIO_EFFECT_ELEMENT);
369 if (!ini->audioeffect_element_custom[0])
370 LOGW("no secondary audio effect");
372 LOGD("audioeffect element custom : %s", ini->audioeffect_element_custom);
375 LOGD("audioeffect element : %s", ini->audioeffect_element);
376 LOGD("audio effect preset mode : %d", ini->use_audio_effect_preset);
377 LOGD("audio effect custom mode : %d", ini->use_audio_effect_custom);
380 for (i = 0; i < MM_AUDIO_EFFECT_PRESET_NUM; i++)
381 LOGD("audio_effect_preset_list: %d (is it for earphone only?(%d))", ini->audio_effect_preset_list[i], ini->audio_effect_preset_earphone_only_list[i]);
383 for (i = 0; i < MM_AUDIO_EFFECT_CUSTOM_NUM; i++)
384 LOGD("audio_effect_custom_list : %d (is it for earphone only?(%d))", ini->audio_effect_custom_list[i], ini->audio_effect_custom_earphone_only_list[i]);
385 LOGD("audio_effect_custom : eq_band_num(%d), ext_num(%d)", ini->audio_effect_custom_eq_band_num, ini->audio_effect_custom_ext_num);
386 LOGD("audio_effect_custom_EQ : width(Hz) / central frequency(Hz)");
387 for (i = 0; i < ini->audio_effect_custom_eq_band_num; i++)
388 LOGD(" EQ band index(%d) : %8d / %8d", i, ini->audio_effect_custom_eq_band_width[i], ini->audio_effect_custom_eq_band_freq[i]);
389 for (i = 0; i < MM_AUDIO_EFFECT_CUSTOM_NUM; i++)
390 LOGD("audio_effect_custom_level_min_max(idx:%d) : Min(%d), Max(%d)", i, ini->audio_effect_custom_min_level_list[i], ini->audio_effect_custom_max_level_list[i]);
392 iniparser_freedict(dict_audioeffect);
394 return MM_ERROR_NONE;
399 __mm_player_ini_check_ini_status(void)
401 struct stat ini_buff;
403 if (g_stat(MM_PLAYER_INI_DEFAULT_PATH, &ini_buff) < 0) {
404 LOGW("failed to get player ini status");
406 if (ini_buff.st_size < 5) {
407 LOGW("player.ini file size=%d, Corrupted!So, Removed", (int)ini_buff.st_size);
409 if (g_remove(MM_PLAYER_INI_DEFAULT_PATH) == -1)
410 LOGE("failed to delete corrupted ini");
415 #ifdef MM_PLAYER_DEFAULT_INI
417 __generate_default_ini(void)
420 gchar *default_ini = MM_PLAYER_DEFAULT_INI;
423 /* create new file */
424 fp = fopen(MM_PLAYER_INI_DEFAULT_PATH, "wt");
428 /* writing default ini file */
429 if (strlen(default_ini) != fwrite(default_ini, 1, strlen(default_ini), fp)) {
440 __get_element_list(mm_player_ini_t *ini, gchar *str, int keyword_type)
445 gchar *strtmp = NULL;
453 strtmp = g_strdup(str);
455 /* trimming. it works inplace */
460 list = g_strsplit(strtmp, ",", 10);
463 MMPLAYER_FREEIF(strtmp);
468 switch (keyword_type) {
469 case KEYWORD_EXCLUDE:
471 for (walk = list; *walk; walk++) {
472 strncpy(ini->exclude_element_keyword[i], *walk, (PLAYER_INI_MAX_STRLEN - 1));
473 g_strstrip(ini->exclude_element_keyword[i]);
474 ini->exclude_element_keyword[i][PLAYER_INI_MAX_STRLEN -1] = '\0';
477 /* mark last item to NULL */
478 ini->exclude_element_keyword[i][0] = '\0';
484 for (walk = list; *walk; walk++) {
485 strncpy(ini->dump_element_keyword[i], *walk, (PLAYER_INI_MAX_STRLEN - 1));
486 g_strstrip(ini->dump_element_keyword[i]);
487 ini->dump_element_keyword[i][PLAYER_INI_MAX_STRLEN -1] = '\0';
490 /* mark last item to NULL */
491 ini->dump_element_keyword[i][0] = '\0';
495 case KEYWORD_UNSUPPORTED_CODEC:
497 for (walk = list; *walk; walk++) {
498 strncpy(ini->unsupported_codec_keyword[i], *walk, (PLAYER_INI_MAX_STRLEN - 1));
499 g_strstrip(ini->unsupported_codec_keyword[i]);
500 ini->unsupported_codec_keyword[i][PLAYER_INI_MAX_STRLEN -1] = '\0';
503 /* mark last item to NULL */
504 ini->unsupported_codec_keyword[i][0] = '\0';
507 case KEYWORD_V_SW_CODEC:
509 for (walk = list; *walk; walk++) {
510 strncpy(ini->videocodec_element_sw[i], *walk, (PLAYER_INI_MAX_STRLEN - 1));
511 g_strstrip(ini->videocodec_element_sw[i]);
512 ini->videocodec_element_sw[i][PLAYER_INI_MAX_STRLEN -1] = '\0';
515 /* mark last item to NULL */
516 ini->videocodec_element_sw[i][0] = '\0';
519 case KEYWORD_A_SW_CODEC:
521 for (walk = list; *walk; walk++) {
522 strncpy(ini->audiocodec_element_sw[i], *walk, (PLAYER_INI_MAX_STRLEN - 1));
523 g_strstrip(ini->audiocodec_element_sw[i]);
524 ini->audiocodec_element_sw[i][PLAYER_INI_MAX_STRLEN -1] = '\0';
527 /* mark last item to NULL */
528 ini->audiocodec_element_sw[i][0] = '\0';
537 MMPLAYER_FREEIF(strtmp);