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__
29 #include "iniparser.h"
30 #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 ) \
47 gchar* str = iniparser_getstring(x_dict, x_ini, x_default); \
50 ( strlen( str ) > 0 ) && \
51 ( strlen( str ) < PLAYER_INI_MAX_STRLEN ) ) \
53 strcpy ( x_item, str ); \
57 strcpy ( x_item, x_default ); \
61 #define MMPLAYER_INI_GET_COLOR( x_dict, x_item, x_ini, x_default ) \
64 gchar* str = iniparser_getstring(x_dict, x_ini, x_default); \
67 ( strlen( str ) > 0 ) && \
68 ( strlen( str ) < PLAYER_INI_MAX_STRLEN ) ) \
70 x_item = (guint) strtoul(str, NULL, 16); \
74 x_item = (guint) strtoul(x_default, NULL, 16); \
78 /* x_ini is the list of index to set TRUE at x_list[index] */
79 #define MMPLAYER_INI_GET_BOOLEAN_FROM_LIST( x_dict, x_list, x_list_max, x_ini, x_default ) \
83 const char *delimiters = " ,"; \
84 char *usr_ptr = NULL; \
86 gchar temp_arr[PLAYER_INI_MAX_STRLEN] = {0}; \
87 MMPLAYER_INI_GET_STRING( x_dict, temp_arr, x_ini, x_default); \
88 token = strtok_r( temp_arr, delimiters, &usr_ptr ); \
91 index = atoi(token); \
92 if (index < 0 || index > x_list_max -1) \
94 debug_warning("%d is not valid index\n", index); \
98 x_list[index] = TRUE; \
100 token = strtok_r( NULL, delimiters, &usr_ptr ); \
104 /* x_ini is the list of value to be set at x_list[index] */
105 #define MMPLAYER_INI_GET_INT_FROM_LIST( x_dict, x_list, x_list_max, x_ini, x_default ) \
110 const char *delimiters = " ,"; \
111 char *usr_ptr = NULL; \
112 char *token = NULL; \
113 gchar temp_arr[PLAYER_INI_MAX_STRLEN] = {0}; \
114 MMPLAYER_INI_GET_STRING(x_dict, temp_arr, x_ini, x_default); \
115 token = strtok_r( temp_arr, delimiters, &usr_ptr ); \
118 if ( index > x_list_max -1) \
120 debug_error("%d is not valid index\n", index); \
125 value = atoi(token); \
126 x_list[index] = value; \
129 token = strtok_r( NULL, delimiters, &usr_ptr ); \
134 mm_player_ini_load(mm_player_ini_t* ini)
136 dictionary * dict = NULL;
139 __mm_player_ini_check_ini_status();
141 /* first, try to load existing ini file */
142 dict = iniparser_load(MM_PLAYER_INI_DEFAULT_PATH);
144 /* if no file exists. create one with set of default values */
147 #ifdef MM_PLAYER_DEFAULT_INI
148 debug_log("No inifile found. player will create default inifile.\n");
149 if ( FALSE == __generate_default_ini() )
151 debug_warning("Creating default inifile failed. Player will use default values.\n");
155 /* load default ini */
156 dict = iniparser_load(MM_PLAYER_INI_DEFAULT_PATH);
159 debug_log("No ini file found. \n");
160 return MM_ERROR_FILE_NOT_FOUND;
165 memset( ini, 0, sizeof(mm_player_ini_t) );
167 if ( dict ) /* if dict is available */
170 ini->disable_segtrap = iniparser_getboolean(dict, "general:disable segtrap", DEFAULT_DISABLE_SEGTRAP);
171 ini->skip_rescan = iniparser_getboolean(dict, "general:skip rescan", DEFAULT_SKIP_RESCAN);
172 ini->generate_dot = iniparser_getboolean(dict, "general:generate dot", DEFAULT_GENERATE_DOT);
173 ini->use_system_clock = iniparser_getboolean(dict, "general:use system clock", DEFAULT_USE_SYSTEM_CLOCK);
174 ini->live_state_change_timeout = iniparser_getint(dict, "general:live state change timeout", DEFAULT_LIVE_STATE_CHANGE_TIMEOUT);
175 ini->localplayback_state_change_timeout = iniparser_getint(dict, "general:localplayback state change timeout", DEFAULT_LOCALPLAYBACK_STATE_CHANGE_TIMEOUT);
176 ini->eos_delay = iniparser_getint(dict, "general:eos delay", DEFAULT_EOS_DELAY);
177 ini->async_start = iniparser_getboolean(dict, "general:async start", DEFAULT_ASYNC_START);
179 ini->delay_before_repeat = iniparser_getint(dict, "general:delay before repeat", DEFAULT_DELAY_BEFORE_REPEAT);
181 MMPLAYER_INI_GET_STRING(dict, ini->videosink_element_x, "general:videosink element x", DEFAULT_VIDEOSINK_X);
182 MMPLAYER_INI_GET_STRING(dict, ini->videosink_element_evas, "general:videosink element evas", DEFAULT_VIDEOSINK_EVAS);
183 MMPLAYER_INI_GET_STRING(dict, ini->videosink_element_fake, "general:videosink element fake", DEFAULT_VIDEOSINK_FAKE);
184 MMPLAYER_INI_GET_STRING(dict, ini->videosink_element_remote, "general:videosink element remote", DEFAULT_VIDEOSINK_REMOTE);
185 MMPLAYER_INI_GET_STRING(dict, ini->videosrc_element_remote, "general:videosrc element remote", DEFAULT_VIDEOSRC_REMOTE);
186 MMPLAYER_INI_GET_STRING(dict, ini->audioresampler_element, "general:audio resampler element", DEFAULT_AUDIORESAMPLER );
187 MMPLAYER_INI_GET_STRING(dict, ini->audiosink_element, "general:audiosink element", DEFAULT_AUDIOSINK );
188 MMPLAYER_INI_GET_STRING(dict, ini->videoconverter_element, "general:video converter element", DEFAULT_VIDEO_CONVERTER );
190 __get_element_list(ini,
191 iniparser_getstring(dict, "general:element exclude keyword", DEFAULT_EXCLUDE_KEYWORD), KEYWORD_EXCLUDE);
193 MMPLAYER_INI_GET_STRING(dict, ini->gst_param[0], "general:gstparam1", DEFAULT_GST_PARAM );
194 MMPLAYER_INI_GET_STRING(dict, ini->gst_param[1], "general:gstparam2", DEFAULT_GST_PARAM );
195 MMPLAYER_INI_GET_STRING(dict, ini->gst_param[2], "general:gstparam3", DEFAULT_GST_PARAM );
196 MMPLAYER_INI_GET_STRING(dict, ini->gst_param[3], "general:gstparam4", DEFAULT_GST_PARAM );
197 MMPLAYER_INI_GET_STRING(dict, ini->gst_param[4], "general:gstparam5", DEFAULT_GST_PARAM );
200 MMPLAYER_INI_GET_STRING( dict, ini->httpsrc_element, "http streaming:httpsrc element", DEFAULT_HTTPSRC );
201 MMPLAYER_INI_GET_STRING( dict, ini->http_file_buffer_path, "http streaming:http file buffer path", DEFAULT_HTTP_FILE_BUFFER_PATH );
202 ini->http_buffering_limit = iniparser_getdouble(dict, "http streaming:http buffering high limit", DEFAULT_HTTP_BUFFERING_LIMIT);
203 ini->http_max_size_bytes = iniparser_getint(dict, "http streaming:http max size bytes", DEFAULT_HTTP_MAX_SIZE_BYTES);
204 ini->http_buffering_time = iniparser_getdouble(dict, "http streaming:http buffering time", DEFAULT_HTTP_BUFFERING_TIME);
205 ini->http_timeout = iniparser_getint(dict, "http streaming:http timeout", DEFAULT_HTTP_TIMEOUT);
207 /* dump buffer for debug */
208 __get_element_list(ini,
209 iniparser_getstring(dict, "general:dump element keyword", DEFAULT_EXCLUDE_KEYWORD), KEYWORD_DUMP);
211 MMPLAYER_INI_GET_STRING(dict, ini->dump_element_path, "general:dump element path", DEFAULT_DUMP_ELEMENT_PATH);
213 else /* if dict is not available just fill the structure with default value */
215 debug_warning("failed to load ini. using hardcoded default\n");
218 ini->disable_segtrap = DEFAULT_DISABLE_SEGTRAP;
219 ini->skip_rescan = DEFAULT_SKIP_RESCAN;
220 strncpy( ini->videosink_element_x, DEFAULT_VIDEOSINK_X, PLAYER_INI_MAX_STRLEN - 1 );
221 strncpy( ini->videosink_element_evas, DEFAULT_VIDEOSINK_EVAS, PLAYER_INI_MAX_STRLEN - 1 );
222 strncpy( ini->videosink_element_fake, DEFAULT_VIDEOSINK_FAKE, PLAYER_INI_MAX_STRLEN - 1 );
223 ini->generate_dot = DEFAULT_GENERATE_DOT;
224 ini->use_system_clock = DEFAULT_USE_SYSTEM_CLOCK;
225 ini->live_state_change_timeout = DEFAULT_LIVE_STATE_CHANGE_TIMEOUT;
226 ini->localplayback_state_change_timeout = DEFAULT_LOCALPLAYBACK_STATE_CHANGE_TIMEOUT;
227 ini->eos_delay = DEFAULT_EOS_DELAY;
228 ini->async_start = DEFAULT_ASYNC_START;
229 ini->delay_before_repeat = DEFAULT_DELAY_BEFORE_REPEAT;
231 strncpy( ini->audioresampler_element, DEFAULT_AUDIORESAMPLER, PLAYER_INI_MAX_STRLEN -1 );
232 strncpy( ini->audiosink_element, DEFAULT_AUDIOSINK, PLAYER_INI_MAX_STRLEN -1 );
233 strncpy( ini->videoconverter_element, DEFAULT_VIDEO_CONVERTER, PLAYER_INI_MAX_STRLEN -1 );
235 __get_element_list(ini, DEFAULT_EXCLUDE_KEYWORD, KEYWORD_EXCLUDE);
237 strncpy( ini->gst_param[0], DEFAULT_GST_PARAM, PLAYER_INI_MAX_PARAM_STRLEN - 1 );
238 strncpy( ini->gst_param[1], DEFAULT_GST_PARAM, PLAYER_INI_MAX_PARAM_STRLEN - 1 );
239 strncpy( ini->gst_param[2], DEFAULT_GST_PARAM, PLAYER_INI_MAX_PARAM_STRLEN - 1 );
240 strncpy( ini->gst_param[3], DEFAULT_GST_PARAM, PLAYER_INI_MAX_PARAM_STRLEN - 1 );
241 strncpy( ini->gst_param[4], DEFAULT_GST_PARAM, PLAYER_INI_MAX_PARAM_STRLEN - 1 );
244 strncpy( ini->httpsrc_element, DEFAULT_HTTPSRC, PLAYER_INI_MAX_STRLEN - 1 );
245 strncpy( ini->http_file_buffer_path, DEFAULT_HTTP_FILE_BUFFER_PATH, PLAYER_INI_MAX_STRLEN - 1 );
246 ini->http_buffering_limit = DEFAULT_HTTP_BUFFERING_LIMIT;
247 ini->http_max_size_bytes = DEFAULT_HTTP_MAX_SIZE_BYTES;
248 ini->http_buffering_time = DEFAULT_HTTP_BUFFERING_TIME;
249 ini->http_timeout = DEFAULT_HTTP_TIMEOUT;
251 /* dump buffer for debug */
252 __get_element_list(ini, DEFAULT_DUMP_ELEMENT_KEYWORD, KEYWORD_DUMP);
253 strncpy(ini->dump_element_path, DEFAULT_DUMP_ELEMENT_PATH, PLAYER_INI_MAX_STRLEN - 1);
256 /* free dict as we got our own structure */
257 iniparser_freedict (dict);
260 debug_log("player settings -----------------------------------\n");
263 debug_log("disable segtrap : %d\n", ini->disable_segtrap);
264 debug_log("skip rescan : %d\n", ini->skip_rescan);
265 debug_log("videosink element x: %s\n", ini->videosink_element_x);
266 debug_log("videosink element evas: %s\n", ini->videosink_element_evas);
267 debug_log("videosink element fake: %s\n", ini->videosink_element_fake);
268 debug_log("video converter element : %s\n", ini->videoconverter_element);
269 debug_log("audio resampler element : %s\n", ini->audioresampler_element);
270 debug_log("audiosink element : %s\n", ini->audiosink_element);
271 debug_log("generate dot : %d\n", ini->generate_dot);
272 debug_log("use system clock(video only) : %d\n", ini->use_system_clock);
273 debug_log("live state change timeout(sec) : %d\n", ini->live_state_change_timeout);
274 debug_log("localplayback state change timeout(sec) : %d\n", ini->localplayback_state_change_timeout);
275 debug_log("eos_delay(msec) : %d\n", ini->eos_delay);
276 debug_log("delay before repeat(msec) : %d\n", ini->delay_before_repeat);
277 debug_log("async_start : %d\n", ini->async_start);
279 debug_log("gst param1 : %s\n", ini->gst_param[0]);
280 debug_log("gst param2 : %s\n", ini->gst_param[1]);
281 debug_log("gst param3 : %s\n", ini->gst_param[2]);
282 debug_log("gst param4 : %s\n", ini->gst_param[3]);
283 debug_log("gst param5 : %s\n", ini->gst_param[4]);
285 for ( idx = 0; ini->exclude_element_keyword[idx][0] != '\0'; idx++ )
287 debug_log("exclude_element_keyword [%d] : %s\n", idx, ini->exclude_element_keyword[idx]);
290 for ( idx = 0; ini->dump_element_keyword[idx][0] != '\0'; idx++ )
292 debug_log("dump_element_keyword [%d] : %s\n", idx, ini->dump_element_keyword[idx]);
296 debug_log("httpsrc element : %s\n", ini->httpsrc_element);
297 debug_log("http file buffer path : %s \n", ini->http_file_buffer_path);
298 debug_log("http buffering limit : %f \n", ini->http_buffering_limit);
299 debug_log("http max_size bytes : %d \n", ini->http_max_size_bytes);
300 debug_log("http buffering time : %f \n", ini->http_buffering_time);
301 debug_log("http timeout : %d \n", ini->http_timeout);
303 return MM_ERROR_NONE;
307 mm_player_audio_effect_ini_load(mm_player_ini_t* ini)
309 dictionary * dict_audioeffect = NULL;
311 dict_audioeffect = iniparser_load(MM_PLAYER_INI_DEFAULT_AUDIOEFFECT_PATH);
312 if ( !dict_audioeffect )
314 debug_error("No audio effect ini file found. \n");
315 return MM_ERROR_FILE_NOT_FOUND;
318 /* audio effect element name */
319 MMPLAYER_INI_GET_STRING( dict_audioeffect, ini->audioeffect_element, "audio effect:audio effect element", DEFAULT_AUDIO_EFFECT_ELEMENT );
320 if (!ini->audioeffect_element[0])
322 debug_warning("could not parse name of audio effect. \n");
323 iniparser_freedict (dict_audioeffect);
324 /* NOTE : in this case, we are not going to create audio filter element */
325 return MM_ERROR_NONE;
328 /* audio effect (Preset)*/
329 ini->use_audio_effect_preset = iniparser_getboolean(dict_audioeffect, "audio effect:audio effect preset", DEFAULT_USE_AUDIO_EFFECT_PRESET);
330 if (ini->use_audio_effect_preset)
332 MMPLAYER_INI_GET_BOOLEAN_FROM_LIST( dict_audioeffect, ini->audio_effect_preset_list, MM_AUDIO_EFFECT_PRESET_NUM,
333 "audio effect:audio effect preset list", DEFAULT_AUDIO_EFFECT_PRESET_LIST );
334 MMPLAYER_INI_GET_BOOLEAN_FROM_LIST( dict_audioeffect, ini->audio_effect_preset_earphone_only_list, MM_AUDIO_EFFECT_PRESET_NUM,
335 "audio effect:audio effect preset earphone only", DEFAULT_AUDIO_EFFECT_PRESET_LIST_EARPHONE_ONLY );
338 /* audio effect user (EQ / Extension effects) */
339 ini->use_audio_effect_custom = iniparser_getboolean(dict_audioeffect, "audio effect:audio effect custom", DEFAULT_USE_AUDIO_EFFECT_CUSTOM);
340 if (ini->use_audio_effect_custom)
342 MMPLAYER_INI_GET_BOOLEAN_FROM_LIST( dict_audioeffect, ini->audio_effect_custom_list, MM_AUDIO_EFFECT_CUSTOM_NUM,
343 "audio effect:audio effect custom list", DEFAULT_AUDIO_EFFECT_CUSTOM_LIST );
344 MMPLAYER_INI_GET_BOOLEAN_FROM_LIST( dict_audioeffect, ini->audio_effect_custom_earphone_only_list, MM_AUDIO_EFFECT_CUSTOM_NUM,
345 "audio effect:audio effect custom earphone only", DEFAULT_AUDIO_EFFECT_CUSTOM_LIST_EARPHONE_ONLY );
347 /* audio effect custom : EQ */
348 if (ini->audio_effect_custom_list[MM_AUDIO_EFFECT_CUSTOM_EQ])
350 ini->audio_effect_custom_eq_band_num = iniparser_getint(dict_audioeffect, "audio effect:audio effect custom eq band num",
351 DEFAULT_AUDIO_EFFECT_CUSTOM_EQ_BAND_NUM);
352 if (ini->audio_effect_custom_eq_band_num < DEFAULT_AUDIO_EFFECT_CUSTOM_EQ_BAND_NUM ||
353 ini->audio_effect_custom_eq_band_num > MM_AUDIO_EFFECT_EQ_BAND_NUM_MAX)
355 debug_error("audio_effect_custom_eq_band_num(%d) is not valid range(%d - %d), set the value %d",
356 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);
357 ini->audio_effect_custom_eq_band_num = DEFAULT_AUDIO_EFFECT_CUSTOM_EQ_BAND_NUM;
359 iniparser_freedict (dict_audioeffect);
360 return MM_ERROR_PLAYER_INTERNAL;
364 if (ini->audio_effect_custom_eq_band_num)
366 MMPLAYER_INI_GET_INT_FROM_LIST( dict_audioeffect, ini->audio_effect_custom_eq_band_width, MM_AUDIO_EFFECT_EQ_BAND_NUM_MAX,
367 "audio effect:audio effect custom eq band width", DEFAULT_AUDIO_EFFECT_CUSTOM_EQ_BAND_WIDTH );
368 MMPLAYER_INI_GET_INT_FROM_LIST( dict_audioeffect, ini->audio_effect_custom_eq_band_freq, MM_AUDIO_EFFECT_EQ_BAND_NUM_MAX,
369 "audio effect:audio effect custom eq band freq", DEFAULT_AUDIO_EFFECT_CUSTOM_EQ_BAND_FREQ );
374 /* audio effect custom : Extension effects */
375 ini->audio_effect_custom_ext_num = iniparser_getint(dict_audioeffect, "audio effect:audio effect custom ext num",
376 DEFAULT_AUDIO_EFFECT_CUSTOM_EXT_NUM);
378 /* Min/Max value list of EQ / Extension effects */
379 if (ini->audio_effect_custom_eq_band_num || ini->audio_effect_custom_ext_num)
382 MMPLAYER_INI_GET_INT_FROM_LIST( dict_audioeffect, ini->audio_effect_custom_min_level_list, MM_AUDIO_EFFECT_CUSTOM_NUM,
383 "audio effect:audio effect custom min list", DEFAULT_AUDIO_EFFECT_CUSTOM_LIST );
384 MMPLAYER_INI_GET_INT_FROM_LIST( dict_audioeffect, ini->audio_effect_custom_max_level_list, MM_AUDIO_EFFECT_CUSTOM_NUM,
385 "audio effect:audio effect custom max list", DEFAULT_AUDIO_EFFECT_CUSTOM_LIST );
389 /* audio effect element name */
390 MMPLAYER_INI_GET_STRING(dict_audioeffect, ini->audioeffect_element_custom, "audio effect:audio effect element custom", DEFAULT_AUDIO_EFFECT_ELEMENT );
391 if (!ini->audioeffect_element_custom[0])
393 debug_warning("no secondary audio effect \n");
397 debug_log("audioeffect element custom : %s\n", ini->audioeffect_element_custom);
401 debug_log("audioeffect element : %s\n", ini->audioeffect_element);
402 debug_log("audio effect preset mode : %d\n", ini->use_audio_effect_preset);
403 debug_log("audio effect custom mode : %d\n", ini->use_audio_effect_custom);
406 for (i=0; i<MM_AUDIO_EFFECT_PRESET_NUM; i++)
408 debug_log("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]);
410 for (i=0; i<MM_AUDIO_EFFECT_CUSTOM_NUM; i++)
412 debug_log("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]);
414 debug_log("audio_effect_custom : eq_band_num(%d), ext_num(%d)\n", ini->audio_effect_custom_eq_band_num, ini->audio_effect_custom_ext_num );
415 debug_log("audio_effect_custom_EQ : width(Hz) / central frequency(Hz)");
416 for (i=0; i<ini->audio_effect_custom_eq_band_num; i++)
418 debug_log(" EQ band index(%d) : %8d / %8d", i, ini->audio_effect_custom_eq_band_width[i], ini->audio_effect_custom_eq_band_freq[i]);
420 for (i=0; i<MM_AUDIO_EFFECT_CUSTOM_NUM; i++)
422 debug_log("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]);
425 iniparser_freedict (dict_audioeffect);
427 return MM_ERROR_NONE;
432 void __mm_player_ini_check_ini_status(void)
434 struct stat ini_buff;
436 if ( g_stat(MM_PLAYER_INI_DEFAULT_PATH, &ini_buff) < 0 )
438 debug_warning("failed to get player ini status\n");
442 if ( ini_buff.st_size < 5 )
444 debug_warning("player.ini file size=%d, Corrupted! So, Removed\n", (int)ini_buff.st_size);
446 if ( g_remove( MM_PLAYER_INI_DEFAULT_PATH ) == -1)
448 debug_error("failed to delete corrupted ini");
454 #ifdef MM_PLAYER_DEFAULT_INI
456 gboolean __generate_default_ini(void)
459 gchar* default_ini = MM_PLAYER_DEFAULT_INI;
462 /* create new file */
463 fp = fopen(MM_PLAYER_INI_DEFAULT_PATH, "wt");
470 /* writing default ini file */
471 if ( strlen(default_ini) != fwrite(default_ini, 1, strlen(default_ini), fp) )
483 void __get_element_list(mm_player_ini_t* ini, gchar* str, int keyword_type)
488 gchar* strtmp = NULL;
493 if ( strlen( str ) < 1 )
496 strtmp = g_strdup (str);
498 /* trimming. it works inplace */
499 g_strstrip( strtmp );
503 list = g_strsplit( strtmp, ",", 10 );
514 switch (keyword_type)
516 case KEYWORD_EXCLUDE:
518 for( walk = list; *walk; walk++ )
520 strncpy( ini->exclude_element_keyword[i], *walk, (PLAYER_INI_MAX_STRLEN - 1) );
522 g_strstrip( ini->exclude_element_keyword[i] );
524 ini->exclude_element_keyword[i][PLAYER_INI_MAX_STRLEN -1]= '\0';
528 /* mark last item to NULL */
529 ini->exclude_element_keyword[i][0] = '\0';
535 for( walk = list; *walk; walk++ )
537 strncpy( ini->dump_element_keyword[i], *walk, (PLAYER_INI_MAX_STRLEN - 1) );
539 g_strstrip( ini->dump_element_keyword[i] );
541 ini->dump_element_keyword[i][PLAYER_INI_MAX_STRLEN -1]= '\0';
545 /* mark last item to NULL */
546 ini->dump_element_keyword[i][0] = '\0';