Git init
[platform/core/multimedia/libmm-player.git] / src / mm_player_ini.c
1 /*
2  * libmm-player
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
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>
8  *
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
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
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.
20  *
21  */
22
23 #ifndef __MM_PLAYER_INI_C__
24 #define __MM_PLAYER_INI_C__
25
26 /* includes here */
27 #include <glib.h>
28 #include <stdlib.h>
29 #include "iniparser.h"
30 #include <mm_player_ini.h>
31 #include "mm_debug.h"
32 #include <mm_error.h>
33 #include <glib/gstdio.h>
34
35 /* global variables here */
36 static mm_player_ini_t g_player_ini;
37
38 /* internal functions, macros here */
39 static gboolean __generate_default_ini(void);
40 static void     __get_string_list(gchar** out_list, gchar* str);
41
42 static void __mm_player_ini_force_setting(void);
43 static void __mm_player_ini_check_ini_status(void);
44
45 /* macro */
46 #define MMPLAYER_INI_GET_STRING( x_item, x_ini, x_default ) \
47 do \
48 { \
49         gchar* str = iniparser_getstring(dict, x_ini, x_default); \
50  \
51         if ( str &&  \
52                 ( strlen( str ) > 1 ) && \
53                 ( strlen( str ) < PLAYER_INI_MAX_STRLEN ) ) \
54         { \
55                 strcpy ( x_item, str ); \
56         } \
57         else \
58         { \
59                 strcpy ( x_item, x_default ); \
60         } \
61 }while(0)
62
63 int 
64 mm_player_ini_load(void)
65 {
66         static gboolean loaded = FALSE;
67         dictionary * dict = NULL;
68         gint idx = 0;
69
70         if ( loaded )
71                 return MM_ERROR_NONE;
72
73         dict = NULL;
74
75         /* disabling ini parsing for launching */
76 #if 1 //debianize
77         /* get player ini status because system will be crashed 
78          * if ini file is corrupted. 
79          */
80         /* FIXIT : the api actually deleting illregular ini. but the function name said it's just checking. */
81         __mm_player_ini_check_ini_status();
82
83         /* first, try to load existing ini file */
84         dict = iniparser_load(MM_PLAYER_INI_DEFAULT_PATH);
85
86         /* if no file exists. create one with set of default values */
87         if ( !dict )
88         {
89                 #if 0
90                 debug_log("No inifile found. player will create default inifile.\n");
91                 if ( FALSE == __generate_default_ini() )
92                 {       
93                         debug_warning("Creating default inifile failed. Player will use default values.\n");
94                 }
95                 else
96                 {
97                         /* load default ini */
98                         dict = iniparser_load(MM_PLAYER_INI_DEFAULT_PATH);      
99                 }
100                 #else
101                 debug_log("No inifile found. \n");
102
103                 return MM_ERROR_FILE_NOT_FOUND;
104                 #endif
105         }
106 #endif
107
108         /* get ini values */
109         memset( &g_player_ini, 0, sizeof(mm_player_ini_t) );
110
111         if ( dict ) /* if dict is available */
112         {
113                 /* general */
114                 g_player_ini.use_decodebin = iniparser_getboolean(dict, "general:use decodebin", DEFAULT_USE_DECODEBIN);
115                 g_player_ini.use_audio_filter = iniparser_getboolean(dict, "features:audio filter", DEFAULT_USE_AUDIO_FILTER);
116                 g_player_ini.use_sink_handler = iniparser_getboolean(dict, "general:use sink handler", DEFAULT_USE_SINK_HANDLER);
117                 g_player_ini.disable_segtrap = iniparser_getboolean(dict, "general:disable segtrap", DEFAULT_DISABLE_SEGTRAP);
118                 g_player_ini.skip_rescan = iniparser_getboolean(dict, "general:skip rescan", DEFAULT_SKIP_RESCAN);
119                 g_player_ini.videosink_element = iniparser_getint(dict, "general:videosink element", DEFAULT_VIDEOSINK);
120                 g_player_ini.generate_dot = iniparser_getboolean(dict, "general:generate dot", DEFAULT_GENERATE_DOT);
121                 g_player_ini.provide_clock= iniparser_getboolean(dict, "general:provide clock", DEFAULT_PROVIDE_CLOCK);
122                 g_player_ini.live_state_change_timeout = iniparser_getint(dict, "general:live state change timeout", DEFAULT_LIVE_STATE_CHANGE_TIMEOUT);
123                 g_player_ini.localplayback_state_change_timeout = iniparser_getint(dict, "general:localplayback state change timeout", DEFAULT_LOCALPLAYBACK_STATE_CHANGE_TIMEOUT);
124                 g_player_ini.eos_delay = iniparser_getint(dict, "general:eos delay", DEFAULT_EOS_DELAY);
125                 g_player_ini.async_start = iniparser_getboolean(dict, "general:async start", DEFAULT_ASYNC_START);
126                 g_player_ini.multiple_codec_supported = iniparser_getboolean(dict, "general:multiple codec supported", DEFAULT_MULTIPLE_CODEC_SUPPORTED);               
127
128                 g_player_ini.delay_before_repeat = iniparser_getint(dict, "general:delay before repeat", DEFAULT_DELAY_BEFORE_REPEAT);
129
130                 MMPLAYER_INI_GET_STRING( g_player_ini.name_of_drmsrc, "general:drmsrc element", DEFAULT_DRMSRC );
131                 MMPLAYER_INI_GET_STRING( g_player_ini.name_of_audiosink, "general:audiosink element", DEFAULT_AUDIOSINK );
132                 MMPLAYER_INI_GET_STRING( g_player_ini.name_of_video_converter, "general:video converter element", DEFAULT_VIDEO_CONVERTER );
133
134                 __get_string_list( (gchar**) g_player_ini.exclude_element_keyword, 
135                         iniparser_getstring(dict, "general:element exclude keyword", DEFAULT_EXCLUDE_KEYWORD));
136
137                 MMPLAYER_INI_GET_STRING( g_player_ini.gst_param[0], "general:gstparam1", DEFAULT_GST_PARAM );
138                 MMPLAYER_INI_GET_STRING( g_player_ini.gst_param[1], "general:gstparam2", DEFAULT_GST_PARAM );
139                 MMPLAYER_INI_GET_STRING( g_player_ini.gst_param[2], "general:gstparam3", DEFAULT_GST_PARAM );
140                 MMPLAYER_INI_GET_STRING( g_player_ini.gst_param[3], "general:gstparam4", DEFAULT_GST_PARAM );
141                 MMPLAYER_INI_GET_STRING( g_player_ini.gst_param[4], "general:gstparam5", DEFAULT_GST_PARAM );
142
143                 /* http streaming */
144                 MMPLAYER_INI_GET_STRING( g_player_ini.name_of_httpsrc, "http streaming:httpsrc element", DEFAULT_HTTPSRC );
145                 MMPLAYER_INI_GET_STRING( g_player_ini.http_temp_template, "http streaming:http temp template", DEFAULT_HTTP_TEMP_TEMPLATE );
146                 g_player_ini.http_use_buffering = iniparser_getboolean(dict, "http streaming:http use buffering", DEFAULT_HTTP_USE_BUFFERING);
147                 g_player_ini.http_buffering_low_limit = iniparser_getint(dict, "http streaming:http buffering low limit", DEFAULT_HTTP_BUFFERING_LOW_LIMIT);
148                 g_player_ini.http_buffering_high_limit = iniparser_getint(dict, "http streaming:http buffering high limit", DEFAULT_HTTP_BUFFERING_HIGH_LIMIT);
149                 g_player_ini.http_max_size_bytes = iniparser_getint(dict, "http streaming:http max size bytes", DEFAULT_HTTP_MAX_SIZE_BYTES);
150                 g_player_ini.http_timeout = iniparser_getint(dict, "http streaming:http timeout", DEFAULT_HTTP_TIMEOUT);
151                 g_player_ini.http_blocksize = iniparser_getint(dict, "http streaming:http blocksize", DEFAULT_HTTP_BLOCKSIZE);
152                 g_player_ini.http_buffering_time = iniparser_getdouble(dict, "http streaming:http buffering time", DEFAULT_HTTP_BUFFERING_TIME);                
153
154                 /* rtsp streaming */
155                 MMPLAYER_INI_GET_STRING( g_player_ini.name_of_rtspsrc, "rtsp streaming:rtspsrc element", DEFAULT_RTSPSRC );
156                 g_player_ini.rtsp_buffering_time = iniparser_getint(dict, "rtsp streaming:rtsp buffering time", DEFAULT_RTSP_BUFFERING);
157                 g_player_ini.rtsp_rebuffering_time = iniparser_getint(dict, "rtsp streaming:rtsp rebuffering time", DEFAULT_RTSP_REBUFFERING);
158                 g_player_ini.rtsp_audio_packet_drop_rate = iniparser_getint(dict, "rtsp streaming:rtsp audio packet drop rate", DEFAULT_RTSP_AUDIO_PACKET_DROP_RATE);
159                 g_player_ini.rtsp_video_packet_drop_rate = iniparser_getint(dict, "rtsp streaming:rtsp video packet drop rate", DEFAULT_RTSP_VIDEO_PACKET_DROP_RATE);
160                 g_player_ini.rtsp_do_typefinding = iniparser_getboolean(dict, "rtsp streaming:rtsp do typefinding", DEFAULT_RTSP_DO_TYPEFINDING);
161                 g_player_ini.rtsp_dump_video_frame = iniparser_getboolean(dict, "rtsp streaming:rtsp dump video frame", DEFAULT_RTSP_DUMP_VIDEO_FRAME);         
162                 g_player_ini.rtsp_dump_audio_frame = iniparser_getboolean(dict, "rtsp streaming:rtsp dump audio frame", DEFAULT_RTSP_DUMP_AUDIO_FRAME);
163                 g_player_ini.rtsp_stack_debug = iniparser_getboolean(dict, "rtsp streaming:rtsp stack debug", DEFAULT_RTSP_STACK_DEBUG);
164                 g_player_ini.rtsp_error_concealment = iniparser_getboolean(dict, "rtsp streaming:rtsp error concealment", DEFAULT_RTSP_ERROR_CONCEALMENT);
165
166                 /* hw accelation */
167                 g_player_ini.use_video_hw_accel = iniparser_getboolean(dict, "hw accelation:use video hw accel", DEFAULT_USE_VIDEO_HW_ACCEL);
168                 
169                 /* priority */
170                 g_player_ini.use_priority_setting = iniparser_getboolean(dict, "priority:use priority setting", DEFAULT_USE_PRIORITY_SETTING);
171                 g_player_ini.demux_priority = iniparser_getint(dict, "priority:demux", DEFAULT_PRIORITY_DEMUX);
172                 g_player_ini.videosink_priority = iniparser_getint(dict, "priority:videosink", DEFAULT_PRIORITY_VIDEO_SINK);
173                 g_player_ini.audiosink_priority = iniparser_getint(dict, "priority:audiosink", DEFAULT_PRIORITY_AUDIO_SINK);
174                 g_player_ini.ringbuffer_priority = iniparser_getint(dict, "priority:ringbuffer", DEFAULT_PRIORITY_RINGBUFFER);
175
176
177                 /* subtitle */
178                 g_player_ini.use_subtitle_setting = iniparser_getboolean(dict, "subtitle:use subtitle setting", DEFAULT_USE_SUBTITLE_SETTING);
179                 MMPLAYER_INI_GET_STRING( g_player_ini.subtitle_uri, "subtitle:subtitle uri", DEFAULT_SUBTITLE_URI );
180                 g_player_ini.subtitle_silent = iniparser_getboolean(dict, "subtitle:use subtitle silent", DEFAULT_SUBTITLE_SILENT);
181         }       
182         else /* if dict is not available just fill the structure with default value */
183         {
184                 debug_warning("failed to load ini. using hardcoded default\n");
185
186                 /* general */
187                 g_player_ini.use_decodebin = DEFAULT_USE_DECODEBIN;
188                 g_player_ini.use_sink_handler = DEFAULT_USE_SINK_HANDLER;
189                 g_player_ini.disable_segtrap = DEFAULT_DISABLE_SEGTRAP;
190                 g_player_ini.use_audio_filter = DEFAULT_USE_AUDIO_FILTER; 
191                 g_player_ini.skip_rescan = DEFAULT_SKIP_RESCAN;
192                 g_player_ini.videosink_element = DEFAULT_VIDEOSINK;
193                 g_player_ini.generate_dot = DEFAULT_GENERATE_DOT;
194                 g_player_ini.provide_clock= DEFAULT_PROVIDE_CLOCK;
195                 g_player_ini.live_state_change_timeout = DEFAULT_LIVE_STATE_CHANGE_TIMEOUT;
196                 g_player_ini.localplayback_state_change_timeout = DEFAULT_LOCALPLAYBACK_STATE_CHANGE_TIMEOUT;           
197                 g_player_ini.eos_delay = DEFAULT_EOS_DELAY;
198                 g_player_ini.multiple_codec_supported = DEFAULT_MULTIPLE_CODEC_SUPPORTED;
199                 g_player_ini.async_start = DEFAULT_ASYNC_START;
200                 g_player_ini.delay_before_repeat = DEFAULT_DELAY_BEFORE_REPEAT;
201
202
203                 strcpy( g_player_ini.name_of_drmsrc, DEFAULT_DRMSRC );
204                 strcpy( g_player_ini.name_of_audiosink, DEFAULT_AUDIOSINK );
205                 strcpy( g_player_ini.name_of_video_converter, DEFAULT_VIDEO_CONVERTER);
206
207                 {
208                         __get_string_list( (gchar**) g_player_ini.exclude_element_keyword, DEFAULT_EXCLUDE_KEYWORD);
209                 }
210
211
212                 strcpy( g_player_ini.gst_param[0], DEFAULT_GST_PARAM );
213                 strcpy( g_player_ini.gst_param[1], DEFAULT_GST_PARAM );
214                 strcpy( g_player_ini.gst_param[2], DEFAULT_GST_PARAM );
215                 strcpy( g_player_ini.gst_param[3], DEFAULT_GST_PARAM );
216                 strcpy( g_player_ini.gst_param[4], DEFAULT_GST_PARAM );
217
218                 /* http streaming */
219                 strcpy( g_player_ini.name_of_httpsrc, DEFAULT_HTTPSRC );
220                 strcpy( g_player_ini.http_temp_template, DEFAULT_HTTP_TEMP_TEMPLATE );
221                 g_player_ini.http_use_buffering = DEFAULT_HTTP_USE_BUFFERING;
222                 g_player_ini.http_buffering_low_limit = DEFAULT_HTTP_BUFFERING_LOW_LIMIT;
223                 g_player_ini.http_buffering_high_limit = DEFAULT_HTTP_BUFFERING_HIGH_LIMIT;
224                 g_player_ini.http_max_size_bytes = DEFAULT_HTTP_MAX_SIZE_BYTES;
225                 g_player_ini.http_timeout = DEFAULT_HTTP_TIMEOUT;
226                 g_player_ini.http_blocksize = DEFAULT_HTTP_BLOCKSIZE;
227                 g_player_ini.http_buffering_time = DEFAULT_HTTP_BUFFERING_TIME;         
228                 
229                 /* rtsp streaming */
230                 strcpy( g_player_ini.name_of_rtspsrc, DEFAULT_RTSPSRC );
231                 g_player_ini.rtsp_buffering_time = DEFAULT_RTSP_BUFFERING;
232                 g_player_ini.rtsp_rebuffering_time = DEFAULT_RTSP_REBUFFERING;
233                 g_player_ini.rtsp_audio_packet_drop_rate = DEFAULT_RTSP_AUDIO_PACKET_DROP_RATE;
234                 g_player_ini.rtsp_video_packet_drop_rate = DEFAULT_RTSP_VIDEO_PACKET_DROP_RATE;
235                 g_player_ini.rtsp_do_typefinding = DEFAULT_RTSP_DO_TYPEFINDING;
236                 g_player_ini.rtsp_dump_video_frame = DEFAULT_RTSP_DUMP_VIDEO_FRAME;     
237                 g_player_ini.rtsp_dump_audio_frame = DEFAULT_RTSP_DUMP_AUDIO_FRAME;
238                 g_player_ini.rtsp_stack_debug = DEFAULT_RTSP_STACK_DEBUG;
239                 g_player_ini.rtsp_error_concealment = DEFAULT_RTSP_ERROR_CONCEALMENT;
240
241                 /* hw accelation */
242                 g_player_ini.use_video_hw_accel = DEFAULT_USE_VIDEO_HW_ACCEL;
243
244                 /* priority  */
245                 g_player_ini.use_priority_setting = DEFAULT_USE_PRIORITY_SETTING;
246                 g_player_ini.demux_priority = DEFAULT_PRIORITY_DEMUX;
247                 g_player_ini.videosink_priority = DEFAULT_PRIORITY_VIDEO_SINK;
248                 g_player_ini.audiosink_priority = DEFAULT_PRIORITY_AUDIO_SINK;
249                 g_player_ini.ringbuffer_priority = DEFAULT_PRIORITY_RINGBUFFER;
250
251                 /* subtitle */
252                 g_player_ini.use_subtitle_setting = DEFAULT_USE_SUBTITLE_SETTING;
253                 strcpy( g_player_ini.subtitle_uri, DEFAULT_SUBTITLE_URI );
254                 g_player_ini.subtitle_silent = DEFAULT_SUBTITLE_SILENT;
255         }
256
257         /* free dict as we got our own structure */
258         iniparser_freedict (dict);
259
260         loaded = TRUE;
261
262         /* The simulator uses a separate ini file. */
263         //__mm_player_ini_force_setting();
264
265
266         /* dump structure */
267         debug_log("player settings -----------------------------------\n");
268
269         /* general */
270         debug_log("use_decodebin : %d\n", g_player_ini.use_decodebin);
271         debug_log("use_audio_filter : %d\n", g_player_ini.use_audio_filter);
272         debug_log("use_sink_handler : %d\n", g_player_ini.use_sink_handler);
273         debug_log("disable_segtrap : %d\n", g_player_ini.disable_segtrap);
274         debug_log("skip rescan : %d\n", g_player_ini.skip_rescan);
275         debug_log("videosink element(0:v4l2sink, 1:ximagesink, 2:xvimagesink, 3:fakesink) : %d\n", g_player_ini.videosink_element);
276         debug_log("generate_dot : %d\n", g_player_ini.generate_dot);
277         debug_log("provide_clock : %d\n", g_player_ini.provide_clock);
278         debug_log("live_state_change_timeout(sec) : %d\n", g_player_ini.live_state_change_timeout);
279         debug_log("localplayback_state_change_timeout(sec) : %d\n", g_player_ini.localplayback_state_change_timeout);   
280         debug_log("eos_delay(msec) : %d\n", g_player_ini.eos_delay);
281         debug_log("delay_before_repeat(msec) : %d\n", g_player_ini.delay_before_repeat);
282         debug_log("name_of_drmsrc : %s\n", g_player_ini.name_of_drmsrc);
283         debug_log("name_of_audiosink : %s\n", g_player_ini.name_of_audiosink);
284         debug_log("name_of_video_converter : %s\n", g_player_ini.name_of_video_converter);
285         debug_log("async_start : %d\n", g_player_ini.async_start);
286         debug_log("multiple_codec_supported : %d\n", g_player_ini.multiple_codec_supported);    
287
288         debug_log("gst_param1 : %s\n", g_player_ini.gst_param[0]);
289         debug_log("gst_param2 : %s\n", g_player_ini.gst_param[1]);
290         debug_log("gst_param3 : %s\n", g_player_ini.gst_param[2]);
291         debug_log("gst_param4 : %s\n", g_player_ini.gst_param[3]);
292         debug_log("gst_param5 : %s\n", g_player_ini.gst_param[4]);
293
294         for ( idx = 0; g_player_ini.exclude_element_keyword[idx][0] != '\0'; idx++ )
295         {
296                 debug_log("exclude_element_keyword [%d] : %s\n", idx, g_player_ini.exclude_element_keyword[idx]);
297         }
298         
299         /* http streaming */
300         debug_log("name_of_httpsrc : %s\n", g_player_ini.name_of_httpsrc);
301         debug_log("http_temp_template : %s \n", g_player_ini.http_temp_template);
302         debug_log("http_use_buffering : %d \n", g_player_ini.http_use_buffering);       
303         debug_log("http_buffering_low_limit : %d \n", g_player_ini.http_buffering_low_limit);
304         debug_log("http_buffering_high_limit : %d \n", g_player_ini.http_buffering_high_limit);
305         debug_log("http_max_size_bytes : %d \n", g_player_ini.http_max_size_bytes);
306         debug_log("http_timeout : %d \n", g_player_ini.http_timeout);
307         debug_log("http_blocksize : %d \n", g_player_ini.http_blocksize);
308         debug_log("http_buffering_time : %f \n", g_player_ini.http_buffering_time);
309         
310         /* rtsp streaming */
311         debug_log("name_of_rtspsrc : %s\n", g_player_ini.name_of_rtspsrc);
312         debug_log("rtsp_buffering_time(msec) : %d\n", g_player_ini.rtsp_buffering_time);
313         debug_log("rtsp_rebuffering_time(msec) : %d\n", g_player_ini.rtsp_rebuffering_time);
314         debug_log("rtsp_audio_packet_drop_rate : %d \n", g_player_ini.rtsp_audio_packet_drop_rate);
315         debug_log("rtsp_video_packet_drop_rate : %d \n", g_player_ini.rtsp_video_packet_drop_rate);
316         debug_log("rtsp_do_typefinding : %d \n", g_player_ini.rtsp_do_typefinding);
317         debug_log("rtsp_dump_video_frame : %d \n", g_player_ini.rtsp_dump_video_frame);
318         debug_log("rtsp_dump_audio_frame : %d \n", g_player_ini.rtsp_dump_audio_frame);
319         debug_log("rtsp_stack_debug : %d \n", g_player_ini.rtsp_stack_debug);
320         debug_log("rtsp_error_concealment : %d \n", g_player_ini.rtsp_error_concealment);
321
322         /* hw accel */
323         debug_log("use_video_hw_accel : %d\n", g_player_ini.use_video_hw_accel);
324
325         /* priority */
326         debug_log("use_priority_setting : %d\n", g_player_ini.use_priority_setting);
327         debug_log("demux_priority : %d\n", g_player_ini.demux_priority);
328         debug_log("audiosink_priority : %d\n", g_player_ini.audiosink_priority);
329         debug_log("videosink_priority : %d\n", g_player_ini.videosink_priority);
330         debug_log("ringbuffer_priority : %d\n", g_player_ini.ringbuffer_priority);
331
332         /* subtitle */
333         debug_log("use_subtitle_setting : %d\n", g_player_ini.use_subtitle_setting);
334         debug_log("subtitle_uri : %s\n", g_player_ini.subtitle_uri);
335         debug_log("subtitle_silent : %d\n", g_player_ini.subtitle_silent);
336         
337         debug_log("---------------------------------------------------\n");     
338
339         return MM_ERROR_NONE;
340 }
341
342
343 static
344 void __mm_player_ini_check_ini_status(void)
345 {
346         struct stat ini_buff;
347         
348         if ( g_stat(MM_PLAYER_INI_DEFAULT_PATH, &ini_buff) < 0 )
349         {
350                 debug_warning("failed to get player ini status\n");
351         }
352         else
353         {
354                 if ( ini_buff.st_size < 5 )
355                 {
356                         debug_warning("player.ini file size=%d, Corrupted! So, Removed\n", (int)ini_buff.st_size);
357                         
358                         g_remove( MM_PLAYER_INI_DEFAULT_PATH );
359                 }
360         }
361 }
362
363 static 
364 void __mm_player_ini_force_setting(void)
365 {
366         /* FIXIT : remove it when all other elements are available on simulator, SDK */
367         
368         #if ! defined(__arm__)
369                 debug_warning("player is running on simulator. force to use ximagesink\n");
370                 g_player_ini.videosink_element = PLAYER_INI_VSINK_XIMAGESINK;
371                 g_player_ini.use_audio_filter = FALSE;
372
373                 strcpy( g_player_ini.name_of_drmsrc, "filesrc" );
374
375                 // Force setting for simulator :+:091218 
376                 strcpy( g_player_ini.name_of_audiosink, "alsasink" );
377
378                 
379 //              __get_string_list( (gchar**) g_player_ini.exclude_element_keyword, "");
380                 
381         #endif
382
383         #if defined(VDF_SDK) || defined (SEC_SDK)
384                 debug_warning("player is running on SDK.\n");
385                 debug_warning("So, it seems like that some plugin values are not same with those\n");
386                 debug_warning("which are written in default ini file.\n");
387
388                 g_player_ini.videosink_element = PLAYER_INI_VSINK_XIMAGESINK;
389                 g_player_ini.use_audio_filter = FALSE;
390
391                 strcpy( g_player_ini.name_of_drmsrc, "filesrc" );
392         #endif
393
394         #if defined(NEW_SOUND) 
395                 strcpy (g_player_ini.name_of_audiosink, "soundsink"); // :+:090707
396         #endif
397
398         /* FIXIT : The HW quality of volans is not better than protector.
399          * So, it can't use same timeout value because state change(resume) is sometimes failed in volans.
400          * Thus, it should be set more than 10sec. 
401          */
402         #if defined(_MM_PROJECT_VOLANS)
403                 g_player_ini.localplayback_state_change_timeout = 10;
404                 debug_log("localplayback_state_change_timeout is set as 30sec by force\n");
405         #endif
406
407         #if 0
408         #if defined(_MM_PROJECT_VOLANS)
409                 debug_warning("player is running on VOLANS\n");
410                 g_player_ini.use_audio_filter = FALSE;          // (+)090702, disabled temporally
411         #endif
412         #endif
413         
414 }
415
416 mm_player_ini_t* 
417 mm_player_ini_get_structure(void)
418 {
419         return &g_player_ini;
420 }
421
422 static 
423 gboolean __generate_default_ini(void)
424 {
425         FILE* fp = NULL;
426         gchar* default_ini = MM_PLAYER_DEFAULT_INI;
427
428
429         /* create new file */
430         fp = fopen(MM_PLAYER_INI_DEFAULT_PATH, "wt");
431
432         if ( !fp )
433         {
434                 return FALSE;
435         }
436
437         /* writing default ini file */
438         if ( strlen(default_ini) != fwrite(default_ini, 1, strlen(default_ini), fp) )
439         {
440                 fclose(fp);
441                 return FALSE;
442         }
443
444         fclose(fp);
445         return TRUE;
446 }
447
448 static 
449 void    __get_string_list(gchar** out_list, gchar* str)
450 {
451         gchar** list = NULL;
452         gchar** walk = NULL;
453         gint i = 0;
454         gchar* strtmp = NULL;
455
456
457         if ( ! str )
458                 return;
459
460         if ( strlen( str ) < 1 )
461                 return;
462
463         strtmp = g_strdup (str);
464
465         /* trimming. it works inplace */
466         g_strstrip( strtmp );
467
468
469         /* split */
470         list = g_strsplit( strtmp, ",", 10 );
471
472         if ( !list )
473         {
474                 if (strtmp)
475                         g_free(strtmp);
476
477                 return;
478         }
479
480         /* copy list */
481         for( walk = list; *walk; walk++ )
482         {
483                 strncpy( g_player_ini.exclude_element_keyword[i], *walk, (PLAYER_INI_MAX_STRLEN - 1) );
484
485                 g_strstrip( g_player_ini.exclude_element_keyword[i] );
486
487                 g_player_ini.exclude_element_keyword[i][PLAYER_INI_MAX_STRLEN - 1] = '\0';
488
489                 i++;
490         }
491
492         /* mark last item to NULL */
493         g_player_ini.exclude_element_keyword[i][0] = '\0';
494
495         g_strfreev( list );
496         if (strtmp)
497                 g_free (strtmp);
498 }
499
500 #endif
501
502
503