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>, YoungHwan An <younghwan_.an@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
22 #ifndef __MM_PLAYER_INI_C__
23 #define __MM_PLAYER_INI_C__
28 #include "iniparser.h"
29 #include <mm_player_ini.h>
32 #include <glib/gstdio.h>
34 /* global variables here */
35 static mm_player_ini_t g_player_ini;
37 /* internal functions, macros here */
38 static gboolean __generate_default_ini(void);
39 static void __get_string_list(gchar** out_list, gchar* str);
40 static void __mm_player_ini_check_ini_status(void);
43 #define MMPLAYER_INI_GET_STRING( x_dict, x_item, x_ini, x_default ) \
46 gchar* str = iniparser_getstring(x_dict, x_ini, x_default); \
49 ( strlen( str ) > 0 ) && \
50 ( strlen( str ) < PLAYER_INI_MAX_STRLEN ) ) \
52 strcpy ( x_item, str ); \
56 strcpy ( x_item, x_default ); \
60 /* x_ini is the list of index to set TRUE at x_list[index] */
61 #define MMPLAYER_INI_GET_BOOLEAN_FROM_LIST( x_dict, x_list, x_list_max, x_ini, x_default ) \
65 const char *delimiters = " ,"; \
66 char *usr_ptr = NULL; \
68 gchar temp_arr[PLAYER_INI_MAX_STRLEN] = {0}; \
69 MMPLAYER_INI_GET_STRING( x_dict, temp_arr, x_ini, x_default); \
70 token = strtok_r( temp_arr, delimiters, &usr_ptr ); \
73 index = atoi(token); \
74 if (index < 0 || index > x_list_max -1) \
76 debug_warning("%d is not valid index\n", index); \
80 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 ) \
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 ); \
100 if ( index > x_list_max -1) \
102 debug_error("%d is not valid index\n", index); \
107 value = atoi(token); \
108 x_list[index] = value; \
111 token = strtok_r( NULL, delimiters, &usr_ptr ); \
116 mm_player_ini_load(void)
118 static gboolean loaded = FALSE;
119 dictionary * dict = NULL;
123 return MM_ERROR_NONE;
125 /* disabling ini parsing for launching */
127 /* get player ini status because system will be crashed
128 * if ini file is corrupted.
130 /* FIXIT : the api actually deleting illregular ini. but the function name said it's just checking. */
131 __mm_player_ini_check_ini_status();
133 /* first, try to load existing ini file */
134 dict = iniparser_load(MM_PLAYER_INI_DEFAULT_PATH);
136 /* if no file exists. create one with set of default values */
140 debug_log("No inifile found. player will create default inifile.\n");
141 if ( FALSE == __generate_default_ini() )
143 debug_warning("Creating default inifile failed. Player will use default values.\n");
147 /* load default ini */
148 dict = iniparser_load(MM_PLAYER_INI_DEFAULT_PATH);
151 debug_log("No inifile found. \n");
153 return MM_ERROR_FILE_NOT_FOUND;
159 memset( &g_player_ini, 0, sizeof(mm_player_ini_t) );
161 if ( dict ) /* if dict is available */
164 g_player_ini.use_decodebin = iniparser_getboolean(dict, "general:use decodebin", DEFAULT_USE_DECODEBIN);
165 g_player_ini.disable_segtrap = iniparser_getboolean(dict, "general:disable segtrap", DEFAULT_DISABLE_SEGTRAP);
166 g_player_ini.skip_rescan = iniparser_getboolean(dict, "general:skip rescan", DEFAULT_SKIP_RESCAN);
167 g_player_ini.generate_dot = iniparser_getboolean(dict, "general:generate dot", DEFAULT_GENERATE_DOT);
168 g_player_ini.provide_clock= iniparser_getboolean(dict, "general:provide clock", DEFAULT_PROVIDE_CLOCK);
169 g_player_ini.live_state_change_timeout = iniparser_getint(dict, "general:live state change timeout", DEFAULT_LIVE_STATE_CHANGE_TIMEOUT);
170 g_player_ini.localplayback_state_change_timeout = iniparser_getint(dict, "general:localplayback state change timeout", DEFAULT_LOCALPLAYBACK_STATE_CHANGE_TIMEOUT);
171 g_player_ini.eos_delay = iniparser_getint(dict, "general:eos delay", DEFAULT_EOS_DELAY);
172 g_player_ini.async_start = iniparser_getboolean(dict, "general:async start", DEFAULT_ASYNC_START);
173 g_player_ini.multiple_codec_supported = iniparser_getboolean(dict, "general:multiple codec supported", DEFAULT_MULTIPLE_CODEC_SUPPORTED);
175 g_player_ini.delay_before_repeat = iniparser_getint(dict, "general:delay before repeat", DEFAULT_DELAY_BEFORE_REPEAT);
177 MMPLAYER_INI_GET_STRING(dict, g_player_ini.videosink_element_x, "general:videosink element x", DEFAULT_VIDEOSINK_X);
178 MMPLAYER_INI_GET_STRING(dict, g_player_ini.videosink_element_evas, "general:videosink element evas", DEFAULT_VIDEOSINK_EVAS);
179 MMPLAYER_INI_GET_STRING(dict, g_player_ini.videosink_element_fake, "general:videosink element fake", DEFAULT_VIDEOSINK_FAKE);
180 MMPLAYER_INI_GET_STRING(dict, g_player_ini.name_of_drmsrc, "general:drmsrc element", DEFAULT_DRMSRC );
181 MMPLAYER_INI_GET_STRING(dict, g_player_ini.name_of_audiosink, "general:audiosink element", DEFAULT_AUDIOSINK );
182 MMPLAYER_INI_GET_STRING(dict, g_player_ini.name_of_video_converter, "general:video converter element", DEFAULT_VIDEO_CONVERTER );
184 __get_string_list( (gchar**) g_player_ini.exclude_element_keyword,
185 iniparser_getstring(dict, "general:element exclude keyword", DEFAULT_EXCLUDE_KEYWORD));
187 MMPLAYER_INI_GET_STRING(dict, g_player_ini.gst_param[0], "general:gstparam1", DEFAULT_GST_PARAM );
188 MMPLAYER_INI_GET_STRING(dict, g_player_ini.gst_param[1], "general:gstparam2", DEFAULT_GST_PARAM );
189 MMPLAYER_INI_GET_STRING(dict, g_player_ini.gst_param[2], "general:gstparam3", DEFAULT_GST_PARAM );
190 MMPLAYER_INI_GET_STRING(dict, g_player_ini.gst_param[3], "general:gstparam4", DEFAULT_GST_PARAM );
191 MMPLAYER_INI_GET_STRING(dict, g_player_ini.gst_param[4], "general:gstparam5", DEFAULT_GST_PARAM );
194 MMPLAYER_INI_GET_STRING( dict, g_player_ini.name_of_httpsrc, "http streaming:httpsrc element", DEFAULT_HTTPSRC );
195 MMPLAYER_INI_GET_STRING( dict, g_player_ini.http_file_buffer_path, "http streaming:http file buffer path", DEFAULT_HTTP_FILE_BUFFER_PATH );
196 g_player_ini.http_buffering_limit = iniparser_getdouble(dict, "http streaming:http buffering high limit", DEFAULT_HTTP_BUFFERING_LIMIT);
197 g_player_ini.http_max_size_bytes = iniparser_getint(dict, "http streaming:http max size bytes", DEFAULT_HTTP_MAX_SIZE_BYTES);
198 g_player_ini.http_buffering_time = iniparser_getdouble(dict, "http streaming:http buffering time", DEFAULT_HTTP_BUFFERING_TIME);
199 g_player_ini.http_timeout = iniparser_getint(dict, "http streaming:http timeout", DEFAULT_HTTP_TIMEOUT);
202 MMPLAYER_INI_GET_STRING( dict, g_player_ini.name_of_rtspsrc, "rtsp streaming:rtspsrc element", DEFAULT_RTSPSRC );
203 g_player_ini.rtsp_buffering_time = iniparser_getint(dict, "rtsp streaming:rtsp buffering time", DEFAULT_RTSP_BUFFERING);
204 g_player_ini.rtsp_rebuffering_time = iniparser_getint(dict, "rtsp streaming:rtsp rebuffering time", DEFAULT_RTSP_REBUFFERING);
205 g_player_ini.rtsp_do_typefinding = iniparser_getboolean(dict, "rtsp streaming:rtsp do typefinding", DEFAULT_RTSP_DO_TYPEFINDING);
206 g_player_ini.rtsp_error_concealment = iniparser_getboolean(dict, "rtsp streaming:rtsp error concealment", DEFAULT_RTSP_ERROR_CONCEALMENT);
208 else /* if dict is not available just fill the structure with default value */
210 debug_warning("failed to load ini. using hardcoded default\n");
213 g_player_ini.use_decodebin = DEFAULT_USE_DECODEBIN;
214 g_player_ini.disable_segtrap = DEFAULT_DISABLE_SEGTRAP;
215 g_player_ini.skip_rescan = DEFAULT_SKIP_RESCAN;
216 strncpy( g_player_ini.videosink_element_x, DEFAULT_VIDEOSINK_X, PLAYER_INI_MAX_STRLEN - 1 );
217 strncpy( g_player_ini.videosink_element_evas, DEFAULT_VIDEOSINK_EVAS, PLAYER_INI_MAX_STRLEN - 1 );
218 strncpy( g_player_ini.videosink_element_fake, DEFAULT_VIDEOSINK_FAKE, PLAYER_INI_MAX_STRLEN - 1 );
219 g_player_ini.generate_dot = DEFAULT_GENERATE_DOT;
220 g_player_ini.provide_clock= DEFAULT_PROVIDE_CLOCK;
221 g_player_ini.live_state_change_timeout = DEFAULT_LIVE_STATE_CHANGE_TIMEOUT;
222 g_player_ini.localplayback_state_change_timeout = DEFAULT_LOCALPLAYBACK_STATE_CHANGE_TIMEOUT;
223 g_player_ini.eos_delay = DEFAULT_EOS_DELAY;
224 g_player_ini.multiple_codec_supported = DEFAULT_MULTIPLE_CODEC_SUPPORTED;
225 g_player_ini.async_start = DEFAULT_ASYNC_START;
226 g_player_ini.delay_before_repeat = DEFAULT_DELAY_BEFORE_REPEAT;
229 strncpy( g_player_ini.name_of_drmsrc, DEFAULT_DRMSRC, PLAYER_INI_MAX_STRLEN - 1 );
230 strncpy( g_player_ini.name_of_audiosink, DEFAULT_AUDIOSINK, PLAYER_INI_MAX_STRLEN -1 );
231 strncpy( g_player_ini.name_of_video_converter, DEFAULT_VIDEO_CONVERTER, PLAYER_INI_MAX_STRLEN -1 );
234 __get_string_list( (gchar**) g_player_ini.exclude_element_keyword, DEFAULT_EXCLUDE_KEYWORD);
238 strncpy( g_player_ini.gst_param[0], DEFAULT_GST_PARAM, PLAYER_INI_MAX_PARAM_STRLEN - 1 );
239 strncpy( g_player_ini.gst_param[1], DEFAULT_GST_PARAM, PLAYER_INI_MAX_PARAM_STRLEN - 1 );
240 strncpy( g_player_ini.gst_param[2], DEFAULT_GST_PARAM, PLAYER_INI_MAX_PARAM_STRLEN - 1 );
241 strncpy( g_player_ini.gst_param[3], DEFAULT_GST_PARAM, PLAYER_INI_MAX_PARAM_STRLEN - 1 );
242 strncpy( g_player_ini.gst_param[4], DEFAULT_GST_PARAM, PLAYER_INI_MAX_PARAM_STRLEN - 1 );
245 strncpy( g_player_ini.name_of_httpsrc, DEFAULT_HTTPSRC, PLAYER_INI_MAX_STRLEN - 1 );
246 strncpy( g_player_ini.http_file_buffer_path, DEFAULT_HTTP_FILE_BUFFER_PATH, PLAYER_INI_MAX_STRLEN - 1 );
247 g_player_ini.http_buffering_limit = DEFAULT_HTTP_BUFFERING_LIMIT;
248 g_player_ini.http_max_size_bytes = DEFAULT_HTTP_MAX_SIZE_BYTES;
249 g_player_ini.http_buffering_time = DEFAULT_HTTP_BUFFERING_TIME;
250 g_player_ini.http_timeout = DEFAULT_HTTP_TIMEOUT;
253 strncpy( g_player_ini.name_of_rtspsrc, DEFAULT_RTSPSRC, PLAYER_INI_MAX_STRLEN - 1 );
254 g_player_ini.rtsp_buffering_time = DEFAULT_RTSP_BUFFERING;
255 g_player_ini.rtsp_rebuffering_time = DEFAULT_RTSP_REBUFFERING;
256 g_player_ini.rtsp_do_typefinding = DEFAULT_RTSP_DO_TYPEFINDING;
257 g_player_ini.rtsp_error_concealment = DEFAULT_RTSP_ERROR_CONCEALMENT;
260 /* free dict as we got our own structure */
261 iniparser_freedict (dict);
266 debug_log("player settings -----------------------------------\n");
269 debug_log("use_decodebin : %d\n", g_player_ini.use_decodebin);
270 debug_log("disable_segtrap : %d\n", g_player_ini.disable_segtrap);
271 debug_log("skip rescan : %d\n", g_player_ini.skip_rescan);
272 debug_log("videosink element x: %s\n", g_player_ini.videosink_element_x);
273 debug_log("videosink element evas: %s\n", g_player_ini.videosink_element_evas);
274 debug_log("videosink element fake: %s\n", g_player_ini.videosink_element_fake);
275 debug_log("generate_dot : %d\n", g_player_ini.generate_dot);
276 debug_log("provide_clock : %d\n", g_player_ini.provide_clock);
277 debug_log("live_state_change_timeout(sec) : %d\n", g_player_ini.live_state_change_timeout);
278 debug_log("localplayback_state_change_timeout(sec) : %d\n", g_player_ini.localplayback_state_change_timeout);
279 debug_log("eos_delay(msec) : %d\n", g_player_ini.eos_delay);
280 debug_log("delay_before_repeat(msec) : %d\n", g_player_ini.delay_before_repeat);
281 debug_log("name_of_drmsrc : %s\n", g_player_ini.name_of_drmsrc);
282 debug_log("name_of_audiosink : %s\n", g_player_ini.name_of_audiosink);
283 debug_log("name_of_video_converter : %s\n", g_player_ini.name_of_video_converter);
284 debug_log("async_start : %d\n", g_player_ini.async_start);
285 debug_log("multiple_codec_supported : %d\n", g_player_ini.multiple_codec_supported);
287 debug_log("gst_param1 : %s\n", g_player_ini.gst_param[0]);
288 debug_log("gst_param2 : %s\n", g_player_ini.gst_param[1]);
289 debug_log("gst_param3 : %s\n", g_player_ini.gst_param[2]);
290 debug_log("gst_param4 : %s\n", g_player_ini.gst_param[3]);
291 debug_log("gst_param5 : %s\n", g_player_ini.gst_param[4]);
293 for ( idx = 0; g_player_ini.exclude_element_keyword[idx][0] != '\0'; idx++ )
295 debug_log("exclude_element_keyword [%d] : %s\n", idx, g_player_ini.exclude_element_keyword[idx]);
299 debug_log("name_of_httpsrc : %s\n", g_player_ini.name_of_httpsrc);
300 debug_log("http_file_buffer_path : %s \n", g_player_ini.http_file_buffer_path);
301 debug_log("http_buffering_limit : %f \n", g_player_ini.http_buffering_limit);
302 debug_log("http_max_size_bytes : %d \n", g_player_ini.http_max_size_bytes);
303 debug_log("http_buffering_time : %f \n", g_player_ini.http_buffering_time);
304 debug_log("http_timeout : %d \n", g_player_ini.http_timeout);
307 debug_log("name_of_rtspsrc : %s\n", g_player_ini.name_of_rtspsrc);
308 debug_log("rtsp_buffering_time(msec) : %d\n", g_player_ini.rtsp_buffering_time);
309 debug_log("rtsp_rebuffering_time(msec) : %d\n", g_player_ini.rtsp_rebuffering_time);
310 debug_log("rtsp_do_typefinding : %d \n", g_player_ini.rtsp_do_typefinding);
311 debug_log("rtsp_error_concealment : %d \n", g_player_ini.rtsp_error_concealment);
313 debug_log("---------------------------------------------------\n");
315 return MM_ERROR_NONE;
320 mm_player_audio_effect_ini_load(void)
322 static gboolean loaded_audioeffect = FALSE;
323 dictionary * dict_audioeffect = NULL;
325 if ( loaded_audioeffect )
326 return MM_ERROR_NONE;
328 dict_audioeffect = iniparser_load(MM_PLAYER_INI_DEFAULT_AUDIOEFFECT_PATH);
329 if ( !dict_audioeffect )
331 debug_warning("No audio effect ini file found. \n");
332 //return MM_ERROR_FILE_NOT_FOUND;
335 /* audio effect element name */
336 MMPLAYER_INI_GET_STRING( dict_audioeffect, g_player_ini.name_of_audio_effect, "audio effect:audio effect element", DEFAULT_AUDIO_EFFECT_ELEMENT );
337 if (!g_player_ini.name_of_audio_effect)
339 debug_error("could not parse name of audio effect. \n");
340 iniparser_freedict (dict_audioeffect);
341 return MM_ERROR_PLAYER_INTERNAL;
344 /* audio effect (Preset)*/
345 g_player_ini.use_audio_effect_preset = iniparser_getboolean(dict_audioeffect, "audio effect:audio effect preset", DEFAULT_USE_AUDIO_EFFECT_PRESET);
346 if (g_player_ini.use_audio_effect_preset)
348 MMPLAYER_INI_GET_BOOLEAN_FROM_LIST( dict_audioeffect, g_player_ini.audio_effect_preset_list, MM_AUDIO_EFFECT_PRESET_NUM,
349 "audio effect:audio effect preset list", DEFAULT_AUDIO_EFFECT_PRESET_LIST );
350 MMPLAYER_INI_GET_BOOLEAN_FROM_LIST( dict_audioeffect, g_player_ini.audio_effect_preset_earphone_only_list, MM_AUDIO_EFFECT_PRESET_NUM,
351 "audio effect:audio effect preset earphone only", DEFAULT_AUDIO_EFFECT_PRESET_LIST_EARPHONE_ONLY );
354 /* audio effect custom (EQ / Extension effects) */
355 g_player_ini.use_audio_effect_custom = iniparser_getboolean(dict_audioeffect, "audio effect:audio effect custom", DEFAULT_USE_AUDIO_EFFECT_CUSTOM);
356 if (g_player_ini.use_audio_effect_custom)
358 MMPLAYER_INI_GET_BOOLEAN_FROM_LIST( dict_audioeffect, g_player_ini.audio_effect_custom_list, MM_AUDIO_EFFECT_CUSTOM_NUM,
359 "audio effect:audio effect custom list", DEFAULT_AUDIO_EFFECT_CUSTOM_LIST );
360 MMPLAYER_INI_GET_BOOLEAN_FROM_LIST( dict_audioeffect, g_player_ini.audio_effect_custom_earphone_only_list, MM_AUDIO_EFFECT_CUSTOM_NUM,
361 "audio effect:audio effect custom earphone only", DEFAULT_AUDIO_EFFECT_CUSTOM_LIST_EARPHONE_ONLY );
363 /* audio effect custom : EQ */
364 if (g_player_ini.audio_effect_custom_list[MM_AUDIO_EFFECT_CUSTOM_EQ])
366 g_player_ini.audio_effect_custom_eq_band_num = iniparser_getint(dict_audioeffect, "audio effect:audio effect custom eq band num",
367 DEFAULT_AUDIO_EFFECT_CUSTOM_EQ_BAND_NUM);
368 if (g_player_ini.audio_effect_custom_eq_band_num < DEFAULT_AUDIO_EFFECT_CUSTOM_EQ_BAND_NUM ||
369 g_player_ini.audio_effect_custom_eq_band_num > MM_AUDIO_EFFECT_EQ_BAND_NUM_MAX)
371 debug_error("audio_effect_custom_eq_band_num(%d) is not valid range(%d - %d), set the value %d",
372 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);
373 g_player_ini.audio_effect_custom_eq_band_num = DEFAULT_AUDIO_EFFECT_CUSTOM_EQ_BAND_NUM;
375 iniparser_freedict (dict_audioeffect);
376 return MM_ERROR_PLAYER_INTERNAL;
380 if (g_player_ini.audio_effect_custom_eq_band_num)
382 MMPLAYER_INI_GET_INT_FROM_LIST( dict_audioeffect, g_player_ini.audio_effect_custom_eq_band_width, MM_AUDIO_EFFECT_EQ_BAND_NUM_MAX,
383 "audio effect:audio effect custom eq band width", DEFAULT_AUDIO_EFFECT_CUSTOM_EQ_BAND_WIDTH );
384 MMPLAYER_INI_GET_INT_FROM_LIST( dict_audioeffect, g_player_ini.audio_effect_custom_eq_band_freq, MM_AUDIO_EFFECT_EQ_BAND_NUM_MAX,
385 "audio effect:audio effect custom eq band freq", DEFAULT_AUDIO_EFFECT_CUSTOM_EQ_BAND_FREQ );
390 /* audio effect custom : Extension effects */
391 g_player_ini.audio_effect_custom_ext_num = iniparser_getint(dict_audioeffect, "audio effect:audio effect custom ext num",
392 DEFAULT_AUDIO_EFFECT_CUSTOM_EXT_NUM);
394 /* Min/Max value list of EQ / Extension effects */
395 if (g_player_ini.audio_effect_custom_eq_band_num || g_player_ini.audio_effect_custom_ext_num)
398 MMPLAYER_INI_GET_INT_FROM_LIST( dict_audioeffect, g_player_ini.audio_effect_custom_min_level_list, MM_AUDIO_EFFECT_CUSTOM_NUM,
399 "audio effect:audio effect custom min list", DEFAULT_AUDIO_EFFECT_CUSTOM_LIST );
400 MMPLAYER_INI_GET_INT_FROM_LIST( dict_audioeffect, g_player_ini.audio_effect_custom_max_level_list, MM_AUDIO_EFFECT_CUSTOM_NUM,
401 "audio effect:audio effect custom max list", DEFAULT_AUDIO_EFFECT_CUSTOM_LIST );
406 debug_log("player audio-effect settings ----------------------\n");
407 debug_log("name_of_audio_effect : %s\n", g_player_ini.name_of_audio_effect);
408 debug_log("use_audio_effect_preset : %d\n", g_player_ini.use_audio_effect_preset);
409 debug_log("use_audio_effect_custom : %d\n", g_player_ini.use_audio_effect_custom);
412 for (i=0; i<MM_AUDIO_EFFECT_PRESET_NUM; i++)
414 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]);
416 for (i=0; i<MM_AUDIO_EFFECT_CUSTOM_NUM; i++)
418 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]);
420 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 );
421 debug_log("audio_effect_custom_EQ : width(Hz) / central frequency(Hz)");
422 for (i=0; i<g_player_ini.audio_effect_custom_eq_band_num; i++)
424 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]);
426 for (i=0; i<MM_AUDIO_EFFECT_CUSTOM_NUM; i++)
428 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]);
431 debug_log("---------------------------------------------------\n");
433 iniparser_freedict (dict_audioeffect);
435 loaded_audioeffect = TRUE;
437 return MM_ERROR_NONE;
443 void __mm_player_ini_check_ini_status(void)
445 struct stat ini_buff;
447 if ( g_stat(MM_PLAYER_INI_DEFAULT_PATH, &ini_buff) < 0 )
449 debug_warning("failed to get player ini status\n");
453 if ( ini_buff.st_size < 5 )
455 debug_warning("player.ini file size=%d, Corrupted! So, Removed\n", (int)ini_buff.st_size);
457 g_remove( MM_PLAYER_INI_DEFAULT_PATH );
463 mm_player_ini_get_structure(void)
465 return &g_player_ini;
469 gboolean __generate_default_ini(void)
472 gchar* default_ini = MM_PLAYER_DEFAULT_INI;
475 /* create new file */
476 fp = fopen(MM_PLAYER_INI_DEFAULT_PATH, "wt");
483 /* writing default ini file */
484 if ( strlen(default_ini) != fwrite(default_ini, 1, strlen(default_ini), fp) )
495 void __get_string_list(gchar** out_list, gchar* str)
500 gchar* strtmp = NULL;
506 if ( strlen( str ) < 1 )
509 strtmp = g_strdup (str);
511 /* trimming. it works inplace */
512 g_strstrip( strtmp );
516 list = g_strsplit( strtmp, ",", 10 );
527 for( walk = list; *walk; walk++ )
529 strncpy( g_player_ini.exclude_element_keyword[i], *walk, (PLAYER_INI_MAX_STRLEN - 1) );
531 g_strstrip( g_player_ini.exclude_element_keyword[i] );
533 g_player_ini.exclude_element_keyword[i][PLAYER_INI_MAX_STRLEN - 1] = '\0';
538 /* mark last item to NULL */
539 g_player_ini.exclude_element_keyword[i][0] = '\0';