Add structure for R2
[platform/core/multimedia/libmm-wfd.git] / src / mm_wfd_sink_ini.c
1 /*
2  * libmm-wfd
3  *
4  * Copyright (c) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: JongHyuk Choi <jhchoi.choi@samsung.com>, ByungWook Jang <bw.jang@samsung.com>,
7  * Manoj Kumar K <manojkumar.k@samsung.com>, Hyunil Park <hyunil46.park@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 #include <glib.h>
24 #include <glib/gstdio.h>
25 #include <stdlib.h>
26 #include <iniparser.h>
27 #include <mm_error.h>
28
29 #include "mm_wfd_sink_dlog.h"
30 #include "mm_wfd_sink_enum.h"
31 #include "mm_wfd_sink_ini.h"
32
33 /*Default sink ini values*/
34 /* General*/
35 #define DEFAULT_GST_PARAM       ""
36 #define DEFAULT_STATE_CHANGE_TIMEOUT 5 /* sec */
37 #define DEFAULT_ENABLE_RM       TRUE
38 #define DEFAULT_JITTER_BUFFER_LATENCY 10 /* msec */
39 #define DEFAULT_ENABLE_RETRANSMISSION   FALSE
40 #define DEFAULT_ENABLE_RESET_BASETIME   TRUE
41 #define DEFAULT_VIDEO_SINK_MAX_LATENESS 20000000 /* nsec */
42 #define DEFAULT_SINK_TS_OFFSET 150000000 /* nsec */
43 #define DEFAULT_AUDIO_SINK_ASYNC FALSE
44 #define DEFAULT_VIDEO_SINK_ASYNC FALSE
45 #define DEFAULT_USER_AGENT "TIZEN3_0/WFD-SINK"
46
47 /* Debug */
48 #define DEFAULT_GENERATE_DOT    FALSE
49 #define DEFAULT_DUMP_RTSP_MESSAGE       TRUE
50 #define DEFAULT_TRACE_BUFFERS   FALSE
51 #define DEFAULT_TRACE_FIRST_BUFFER   TRUE
52 #define DEFAULT_TRACE_BUFFERS_OF_WFDSRC FALSE
53 #define DEFAULT_DUMP_TS_DATA            FALSE
54 #define DEFAULT_DUMP_RTP_DATA FALSE
55
56 /* Pipeline */
57 #define DEFAULT_NAME_OF_SOURCE "wfdsrc"
58 #define DEFAULT_NAME_OF_TSDEMUX ""
59 #define DEFAULT_NAME_OF_AUDIO_HDCP ""
60 #define DEFAULT_NAME_OF_AAC_PARSER ""
61 #define DEFAULT_NAME_OF_AAC_DECODER ""
62 #define DEFAULT_NAME_OF_AC3_PARSER ""
63 #define DEFAULT_NAME_OF_AC3_DECODER ""
64 #define DEFAULT_NAME_OF_LPCM_CONVERTER ""
65 #define DEFAULT_NAME_OF_LPCM_FILTER ""
66 #define DEFAULT_NAME_OF_AUDIO_RESAMPLER ""
67 #define DEFAULT_NAME_OF_AUDIO_VOLUME ""
68 #define DEFAULT_NAME_OF_AUDIO_SINKBIN_QUEUE ""
69 #define DEFAULT_NAME_OF_AUDIO_SINK ""
70 #define DEFAULT_NAME_OF_VIDEO_HDCP ""
71 #define DEFAULT_NAME_OF_VIDEO_H264_PARSER ""
72 #define DEFAULT_NAME_OF_VIDEO_CAPSSETTER ""
73 #define DEFAULT_NAME_OF_VIDEO_H264_DECODER ""
74 #define DEFAULT_NAME_OF_VIDEO_H265_PARSER ""
75 #define DEFAULT_NAME_OF_VIDEO_H265_DECODER ""
76 #define DEFAULT_NAME_OF_VIDEO_CONVERTER ""
77 #define DEFAULT_NAME_OF_VIDEO_FILTER ""
78 #define DEFAULT_NAME_OF_VIDEO_SINK ""
79 #define DEFAULT_NAME_OF_EVAS_VIDEO_SINK ""
80
81 /* Audio */
82 #define DEFAULT_WFD_AUDIO_CODECS_CODEC WFD_AUDIO_LPCM | WFD_AUDIO_AAC
83 #define DEFAULT_WFD_AUDIO_CODECS_LATENCY 0x0
84 #define DEFAULT_WFD_AUDIO_CODECS_CHANNELS WFD_CHANNEL_2
85 #define DEFAULT_WFD_AUDIO_CODECS_SAMP_FREQUENCY WFD_FREQ_44100 | WFD_FREQ_48000
86
87 /* Video */
88 #define DEFAULT_WFD_VIDEO_FORMATS_CODEC WFD_VIDEO_H264
89 #define DEFAULT_WFD_VIDEO_FORMATS_NATIVE_RESOLUTION 0x20
90 /* CEA :  WFD_CEA_640x480P60  | WFD_CEA_720x480P60 |WFD_CEA_720x576P50 |WFD_CEA_1280x720P30 |
91         WFD_CEA_1280x720P25 | WFD_CEA_1280x720P24 */
92 #define DEFAULT_WFD_VIDEO_FORMATS_CEA_SUPPORT "0x84ab"
93 /* VESA : WFD_VESA_800x600P30 */
94 #define DEFAULT_WFD_VIDEO_FORMATS_VESA_SUPPORT "0x1"
95 /* HH : WFD_HH_800x480P30 | WFD_HH_854x480P30 | WFD_HH_864x480P30 | WFD_HH_640x360P30 | WFD_HH_960x540P30 | WFD_HH_848x480P30 */
96 #define DEFAULT_WFD_VIDEO_FORMATS_HH_SUPPORT "0x555"
97 #define DEFAULT_WFD_VIDEO_FORMATS_PROFILE WFD_H264_BASE_PROFILE
98 #define DEFAULT_WFD_VIDEO_FORMATS_LEVEL WFD_H264_LEVEL_3_2
99 #define DEFAULT_WFD_VIDEO_FORMATS_LATENCY 0x0
100 #define DEFAULT_WFD_VIDEO_FORMATS_VERTICAL_RESOLUTION 720
101 #define DEFAULT_WFD_VIDEO_FORMATS_HORIZONTAL_RESOLUTION 1280
102 #define DEFAULT_WFD_VIDEO_FORMATS_MIN_SLICESIZE 0
103 #define DEFAULT_WFD_VIDEO_FORMATS_SLICE_ENC_PARAM 200
104 #define DEFAULT_WFD_VIDEO_FORMATS_FRAMERATE_CONTROL 11
105
106 /* R2 Video */
107 #define DEFAULT_WFD2_VIDEO_FORMATS_CODEC WFD_VIDEO_H265 | WFD_VIDEO_H264
108 #define DEFAULT_WFD2_VIDEO_FORMATS_NATIVE_RESOLUTION 0x20
109 #define DEFAULT_WFD2_VIDEO_FORMATS_CEA_SUPPORT "0x84ab"
110 #define DEFAULT_WFD2_VIDEO_FORMATS_VESA_SUPPORT "0x1"
111 #define DEFAULT_WFD2_VIDEO_FORMATS_HH_SUPPORT "0x555"
112 #define DEFAULT_WFD2_VIDEO_FORMATS_PROFILE WFD_H265_MAIN_PROFILE
113 #define DEFAULT_WFD2_VIDEO_FORMATS_LEVEL WFD_H265_LEVEL_3_1
114 #define DEFAULT_WFD2_VIDEO_FORMATS_LATENCY 0x0
115 #define DEFAULT_WFD2_VIDEO_FORMATS_VERTICAL_RESOLUTION 720
116 #define DEFAULT_WFD2_VIDEO_FORMATS_HORIZONTAL_RESOLUTION 1280
117 #define DEFAULT_WFD2_VIDEO_FORMATS_MIN_SLICESIZE 0
118 #define DEFAULT_WFD2_VIDEO_FORMATS_SLICE_ENC_PARAM 200
119 #define DEFAULT_WFD2_VIDEO_FORMATS_FRAMERATE_CONTROL 11
120 #define DEFAULT_WFD2_VIDEO_FORMATS_NON_TRANSCODING_SUPPORT 0
121
122 /*R2 Audio*/
123 #define DEFAULT_WFD2_AUDIO_CODECS_CODEC WFD_AUDIO_LPCM | WFD_AUDIO_AAC
124 #define DEFAULT_WFD2_AUDIO_CODECS_LPCM_MODE GST_LPCM_441KH_16B_2C | GST_LPCM_48KH_16B_2C
125 #define DEFAULT_WFD2_AUDIO_CODECS_AAC_MODE GST_AAC_48KH_16B_2C
126 #define DEFAULT_WFD2_AUDIO_CODECS_AC3_MODE GST_AC3_48KH_16B_2C
127
128 /* HDCP */
129 #define DEFAULT_ENABLE_HDCP FALSE
130 #define DEFAULT_WFD_HDCP_CONTENT_PROTECTION 0x0
131 #define DEFAULT_WFD_HDCP_PORT_NO 0
132
133
134 static gboolean loaded = FALSE;
135
136 /* global variables here */
137 #ifdef MM_WFD_SINK_DEFAULT_INI
138 static gboolean __generate_sink_default_ini(void);
139 #endif
140
141 static void __mm_wfd_sink_ini_check_status(const char *path);
142
143 /* macro */
144 #define MM_WFD_SINK_INI_GET_STRING(x_dict, x_item, x_ini, x_default) \
145         do { \
146                 gchar *str = NULL; \
147                 gint length = 0; \
148                 \
149                 str = iniparser_getstring(x_dict, x_ini, (char *)x_default); \
150                 if (str) { \
151                         length = strlen(str); \
152                         if ((length > 1) && (length < WFD_SINK_INI_MAX_STRLEN)) \
153                                 strncpy(x_item, str, WFD_SINK_INI_MAX_STRLEN-1); \
154                         else \
155                                 strncpy(x_item, x_default, WFD_SINK_INI_MAX_STRLEN-1); \
156                 } else { \
157                         strncpy(x_item, x_default, WFD_SINK_INI_MAX_STRLEN-1); \
158                 } \
159         } while (0);
160
161 #ifdef MM_WFD_SINK_DEFAULT_INI
162 static
163 gboolean __generate_sink_default_ini(void)
164 {
165         FILE *fp = NULL;
166         const gchar *default_ini = MM_WFD_SINK_DEFAULT_INI;
167
168
169         /* create new file */
170         fp = fopen(MM_WFD_SINK_INI_DEFAULT_PATH, "wt");
171
172         if (!fp)
173                 return FALSE;
174
175         /* writing default ini file */
176         if (strlen(default_ini) != fwrite(default_ini, 1, strlen(default_ini), fp)) {
177                 fclose(fp);
178                 return FALSE;
179         }
180
181         fclose(fp);
182         return TRUE;
183 }
184 #endif
185
186 int
187 mm_wfd_sink_ini_load(mm_wfd_sink_ini_t *ini, const char *path)
188 {
189         dictionary *dict = NULL;
190         char tempstr[WFD_SINK_INI_MAX_STRLEN] = {0,};
191
192         wfd_sink_debug_fenter();
193
194         __mm_wfd_sink_ini_check_status(path);
195
196         wfd_sink_debug("ini path : %s", path);
197
198         /* first, try to load existing ini file */
199         dict = iniparser_load(path);
200
201         /* if no file exists. create one with set of default values */
202         if (!dict) {
203 #ifdef MM_WFD_SINK_DEFAULT_INI
204                 wfd_sink_debug("No inifile found. create default ini file.");
205                 if (FALSE == __generate_sink_default_ini()) {
206                         wfd_sink_error("Creating default ini file failed. Use default values.");
207                 } else {
208                         /* load default ini */
209                         dict = iniparser_load(MM_WFD_SINK_INI_DEFAULT_PATH);
210                 }
211 #else
212                 wfd_sink_error("No ini file found. ");
213
214                 return MM_ERROR_FILE_NOT_FOUND;
215 #endif
216         }
217
218         /* get ini values */
219         memset(ini, 0, sizeof(mm_wfd_sink_ini_t));
220
221         if (dict) { /* if dict is available */
222                 /* general */
223                 MM_WFD_SINK_INI_GET_STRING(dict, ini->gst_param[0], "general:gstparam1", DEFAULT_GST_PARAM);
224                 MM_WFD_SINK_INI_GET_STRING(dict, ini->gst_param[1], "general:gstparam2", DEFAULT_GST_PARAM);
225                 MM_WFD_SINK_INI_GET_STRING(dict, ini->gst_param[2], "general:gstparam3", DEFAULT_GST_PARAM);
226                 MM_WFD_SINK_INI_GET_STRING(dict, ini->gst_param[3], "general:gstparam4", DEFAULT_GST_PARAM);
227                 MM_WFD_SINK_INI_GET_STRING(dict, ini->gst_param[4], "general:gstparam5", DEFAULT_GST_PARAM);
228                 ini->state_change_timeout = iniparser_getint(dict, "general:state change timeout", DEFAULT_STATE_CHANGE_TIMEOUT);
229                 ini->enable_rm = iniparser_getboolean(dict, "general:enable rm", DEFAULT_ENABLE_RM);
230                 ini->jitter_buffer_latency = iniparser_getint(dict, "general:jitter buffer latency", DEFAULT_JITTER_BUFFER_LATENCY);
231                 ini->enable_retransmission = iniparser_getboolean(dict, "general:enable retransmission", DEFAULT_ENABLE_RETRANSMISSION);
232                 ini->enable_reset_basetime = iniparser_getboolean(dict, "general:enable reset basetime", DEFAULT_ENABLE_RESET_BASETIME);
233                 ini->video_sink_max_lateness = iniparser_getint(dict, "general:video sink max lateness", DEFAULT_VIDEO_SINK_MAX_LATENESS);
234                 ini->sink_ts_offset = iniparser_getint(dict, "general:sink ts offset", DEFAULT_SINK_TS_OFFSET);
235                 ini->audio_sink_async = iniparser_getboolean(dict, "general:audio sink async", DEFAULT_AUDIO_SINK_ASYNC);
236                 ini->video_sink_async = iniparser_getboolean(dict, "general:video sink async", DEFAULT_VIDEO_SINK_ASYNC);
237                 MM_WFD_SINK_INI_GET_STRING(dict, ini->user_agent, "general:user agent", DEFAULT_USER_AGENT);
238
239                 /* debug */
240                 ini->generate_dot = iniparser_getboolean(dict, "debug:generate dot", DEFAULT_GENERATE_DOT);
241                 ini->dump_rtsp_message = iniparser_getboolean(dict, "debug:dump rtsp message", DEFAULT_DUMP_RTSP_MESSAGE);
242                 ini->trace_buffers = iniparser_getboolean(dict, "debug:trace buffers", DEFAULT_TRACE_BUFFERS);
243                 ini->trace_first_buffer = iniparser_getboolean(dict, "debug:trace first buffer", DEFAULT_TRACE_FIRST_BUFFER);
244                 ini->trace_buffers_of_wfdsrc = iniparser_getboolean(dict, "debug:trace buffers of wfdsrc", DEFAULT_TRACE_BUFFERS_OF_WFDSRC);
245                 ini->dump_ts_data = iniparser_getboolean(dict, "debug:dump ts data", DEFAULT_DUMP_TS_DATA);
246                 ini->dump_rtp_data = iniparser_getboolean(dict, "debug:dump rtp data", DEFAULT_DUMP_RTP_DATA);
247
248                 /* pipeline */
249                 MM_WFD_SINK_INI_GET_STRING(dict, ini->name_of_source, "pipeline:wfdsrc element", DEFAULT_NAME_OF_SOURCE);
250                 MM_WFD_SINK_INI_GET_STRING(dict, ini->name_of_tsdemux, "pipeline:tsdemux element", DEFAULT_NAME_OF_TSDEMUX);
251                 MM_WFD_SINK_INI_GET_STRING(dict, ini->name_of_audio_hdcp, "pipeline:audio hdcp element", DEFAULT_NAME_OF_AUDIO_HDCP);
252                 MM_WFD_SINK_INI_GET_STRING(dict, ini->name_of_aac_parser, "pipeline:aac parser element", DEFAULT_NAME_OF_AAC_PARSER);
253                 MM_WFD_SINK_INI_GET_STRING(dict, ini->name_of_aac_decoder, "pipeline:aac decoder element", DEFAULT_NAME_OF_AAC_DECODER);
254                 MM_WFD_SINK_INI_GET_STRING(dict, ini->name_of_ac3_parser, "pipeline:ac3 parser element", DEFAULT_NAME_OF_AC3_PARSER);
255                 MM_WFD_SINK_INI_GET_STRING(dict, ini->name_of_ac3_decoder, "pipeline:ac3 decoder element", DEFAULT_NAME_OF_AC3_DECODER);
256                 MM_WFD_SINK_INI_GET_STRING(dict, ini->name_of_lpcm_converter, "pipeline:lpcm converter element", DEFAULT_NAME_OF_LPCM_CONVERTER);
257                 MM_WFD_SINK_INI_GET_STRING(dict, ini->name_of_lpcm_filter, "pipeline:lpcm filter element", DEFAULT_NAME_OF_LPCM_FILTER);
258                 MM_WFD_SINK_INI_GET_STRING(dict, ini->name_of_audio_resampler, "pipeline:audio resampler element", DEFAULT_NAME_OF_AUDIO_RESAMPLER);
259                 MM_WFD_SINK_INI_GET_STRING(dict, ini->name_of_audio_volume, "pipeline:audio volume element", DEFAULT_NAME_OF_AUDIO_VOLUME);
260                 MM_WFD_SINK_INI_GET_STRING(dict, ini->name_of_audio_sink, "pipeline:audio sink element", DEFAULT_NAME_OF_AUDIO_SINK);
261                 MM_WFD_SINK_INI_GET_STRING(dict, ini->name_of_video_hdcp, "pipeline:video hdcp element", DEFAULT_NAME_OF_VIDEO_HDCP);
262                 MM_WFD_SINK_INI_GET_STRING(dict, ini->name_of_video_h264_parser, "pipeline:video h264 parser element", DEFAULT_NAME_OF_VIDEO_H264_PARSER);
263                 MM_WFD_SINK_INI_GET_STRING(dict, ini->name_of_video_capssetter, "pipeline:video capssetter element", DEFAULT_NAME_OF_VIDEO_CAPSSETTER);
264                 MM_WFD_SINK_INI_GET_STRING(dict, ini->name_of_video_h264_decoder, "pipeline:video h264 decoder element", DEFAULT_NAME_OF_VIDEO_H264_DECODER);
265                 MM_WFD_SINK_INI_GET_STRING(dict, ini->name_of_video_h265_parser, "pipeline:video h265 parser element", DEFAULT_NAME_OF_VIDEO_H265_PARSER);
266                 MM_WFD_SINK_INI_GET_STRING(dict, ini->name_of_video_h265_decoder, "pipeline:video h265 decoder element", DEFAULT_NAME_OF_VIDEO_H265_DECODER);
267                 MM_WFD_SINK_INI_GET_STRING(dict, ini->name_of_video_converter, "pipeline:video converter element", DEFAULT_NAME_OF_VIDEO_CONVERTER);
268                 MM_WFD_SINK_INI_GET_STRING(dict, ini->name_of_video_filter, "pipeline:video filter element", DEFAULT_NAME_OF_VIDEO_FILTER);
269                 MM_WFD_SINK_INI_GET_STRING(dict, ini->name_of_video_sink, "pipeline:video sink element", DEFAULT_NAME_OF_VIDEO_SINK);
270                 MM_WFD_SINK_INI_GET_STRING(dict, ini->name_of_video_evas_sink, "pipeline:video evas sink element", DEFAULT_NAME_OF_EVAS_VIDEO_SINK);
271
272                 /* audio parameter*/
273                 ini->wfd_audio_codecs.audio_codec = iniparser_getint(dict, "wfd audio codecs:audio codec", DEFAULT_WFD_AUDIO_CODECS_CODEC);
274                 ini->wfd_audio_codecs.audio_latency = iniparser_getint(dict, "wfd audio codecs:audio latency", DEFAULT_WFD_AUDIO_CODECS_LATENCY);
275                 ini->wfd_audio_codecs.audio_channel = iniparser_getint(dict, "wfd audio codecs:audio channels", DEFAULT_WFD_AUDIO_CODECS_CHANNELS);
276                 ini->wfd_audio_codecs.audio_sampling_frequency = iniparser_getint(dict, "wfd audio codecs:audio sampling frequency", DEFAULT_WFD_AUDIO_CODECS_SAMP_FREQUENCY);
277
278                 /* video parameter*/
279                 ini->wfd_video_formats.video_codec = iniparser_getint(dict, "wfd video formats:video codec", DEFAULT_WFD_VIDEO_FORMATS_CODEC);
280                 ini->wfd_video_formats.video_native_resolution = iniparser_getint(dict, "wfd video formats:video native resolution", DEFAULT_WFD_VIDEO_FORMATS_NATIVE_RESOLUTION);
281                 memset(tempstr, 0x00, WFD_SINK_INI_MAX_STRLEN);
282                 MM_WFD_SINK_INI_GET_STRING(dict, tempstr, "wfd video formats:video cea support", DEFAULT_WFD_VIDEO_FORMATS_CEA_SUPPORT);
283                 ini->wfd_video_formats.video_cea_support = strtoul(tempstr, NULL, 16);
284                 memset(tempstr, 0x00, WFD_SINK_INI_MAX_STRLEN);
285                 MM_WFD_SINK_INI_GET_STRING(dict, tempstr, "wfd video formats:video vesa support", DEFAULT_WFD_VIDEO_FORMATS_VESA_SUPPORT);
286                 ini->wfd_video_formats.video_vesa_support = strtoul(tempstr, NULL, 16);
287                 memset(tempstr, 0x00, WFD_SINK_INI_MAX_STRLEN);
288                 MM_WFD_SINK_INI_GET_STRING(dict, tempstr, "wfd video formats:video hh support", DEFAULT_WFD_VIDEO_FORMATS_HH_SUPPORT);
289                 ini->wfd_video_formats.video_hh_support = strtoul(tempstr, NULL, 16);
290                 ini->wfd_video_formats.video_profile = iniparser_getint(dict, "wfd video formats:video profile", DEFAULT_WFD_VIDEO_FORMATS_PROFILE);
291                 ini->wfd_video_formats.video_level = iniparser_getint(dict, "wfd video formats:video level", DEFAULT_WFD_VIDEO_FORMATS_LEVEL);
292                 ini->wfd_video_formats.video_latency = iniparser_getint(dict, "wfd video formats:video latency", DEFAULT_WFD_VIDEO_FORMATS_LATENCY);
293                 ini->wfd_video_formats.video_vertical_resolution = iniparser_getint(dict, "wfd video formats:video vertical resolution", DEFAULT_WFD_VIDEO_FORMATS_VERTICAL_RESOLUTION);
294                 ini->wfd_video_formats.video_horizontal_resolution = iniparser_getint(dict, "wfd video formats:video horizontal resolution", DEFAULT_WFD_VIDEO_FORMATS_HORIZONTAL_RESOLUTION);
295                 ini->wfd_video_formats.video_minimum_slicing = iniparser_getint(dict, "wfd video formats:video minimum slicesize", DEFAULT_WFD_VIDEO_FORMATS_MIN_SLICESIZE);
296                 ini->wfd_video_formats.video_slice_enc_param = iniparser_getint(dict, "wfd video formats:video slice encoding params", DEFAULT_WFD_VIDEO_FORMATS_SLICE_ENC_PARAM);
297                 ini->wfd_video_formats.video_framerate_control_support = iniparser_getint(dict, "wfd video formats:video framerate control support", DEFAULT_WFD_VIDEO_FORMATS_FRAMERATE_CONTROL);
298
299                 /* hdcp parameter*/
300                 ini->wfd_content_protection.enable_hdcp = iniparser_getboolean(dict, "wfd hdcp content protection:enable hdcp", DEFAULT_ENABLE_HDCP);
301                 ini->wfd_content_protection.hdcp_content_protection = iniparser_getint(dict, "wfd hdcp content protection:hdcp content protection", DEFAULT_WFD_HDCP_CONTENT_PROTECTION);
302                 ini->wfd_content_protection.hdcp_port_no = iniparser_getint(dict, "wfd hdcp content protection:hdcp port no", DEFAULT_WFD_HDCP_PORT_NO);
303
304                 /* video r2 parameter*/
305                 ini->wfd2_video_formats.video_codec = iniparser_getint(dict, "wfd2 video formats:video codec", DEFAULT_WFD2_VIDEO_FORMATS_CODEC);
306                 ini->wfd2_video_formats.video_native_resolution = iniparser_getint(dict, "wfd2 video formats:video native resolution", DEFAULT_WFD2_VIDEO_FORMATS_NATIVE_RESOLUTION);
307                 memset(tempstr, 0x00, WFD_SINK_INI_MAX_STRLEN);
308                 MM_WFD_SINK_INI_GET_STRING(dict, tempstr, "wfd2 video formats:video cea support", DEFAULT_WFD2_VIDEO_FORMATS_CEA_SUPPORT);
309                 ini->wfd2_video_formats.video_cea_support = strtoul(tempstr, NULL, 16);
310                 memset(tempstr, 0x00, WFD_SINK_INI_MAX_STRLEN);
311                 MM_WFD_SINK_INI_GET_STRING(dict, tempstr, "wfd2 video formats:video vesa support", DEFAULT_WFD2_VIDEO_FORMATS_VESA_SUPPORT);
312                 ini->wfd2_video_formats.video_vesa_support = strtoul(tempstr, NULL, 16);
313                 memset(tempstr, 0x00, WFD_SINK_INI_MAX_STRLEN);
314                 MM_WFD_SINK_INI_GET_STRING(dict, tempstr, "wfd2 video formats:video hh support", DEFAULT_WFD2_VIDEO_FORMATS_HH_SUPPORT);
315                 ini->wfd2_video_formats.video_hh_support = strtoul(tempstr, NULL, 16);
316                 ini->wfd2_video_formats.video_profile = iniparser_getint(dict, "wfd2 video formats:video profile", DEFAULT_WFD2_VIDEO_FORMATS_PROFILE);
317                 ini->wfd2_video_formats.video_level = iniparser_getint(dict, "wfd2 video formats:video level", DEFAULT_WFD2_VIDEO_FORMATS_LEVEL);
318                 ini->wfd2_video_formats.video_latency = iniparser_getint(dict, "wfd2 video formats:video latency", DEFAULT_WFD2_VIDEO_FORMATS_LATENCY);
319                 ini->wfd2_video_formats.video_vertical_resolution = iniparser_getint(dict, "wfd2 video formats:video vertical resolution", DEFAULT_WFD2_VIDEO_FORMATS_VERTICAL_RESOLUTION);
320                 ini->wfd2_video_formats.video_horizontal_resolution = iniparser_getint(dict, "wfd2 video formats:video horizontal resolution", DEFAULT_WFD2_VIDEO_FORMATS_HORIZONTAL_RESOLUTION);
321                 ini->wfd2_video_formats.video_minimum_slicing = iniparser_getint(dict, "wfd2 video formats:video minimum slicesize", DEFAULT_WFD2_VIDEO_FORMATS_MIN_SLICESIZE);
322                 ini->wfd2_video_formats.video_slice_enc_param = iniparser_getint(dict, "wfd2 video formats:video slice encoding params", DEFAULT_WFD2_VIDEO_FORMATS_SLICE_ENC_PARAM);
323                 ini->wfd2_video_formats.video_framerate_control_support = iniparser_getint(dict, "wfd2 video formats:video framerate control support", DEFAULT_WFD2_VIDEO_FORMATS_FRAMERATE_CONTROL);
324                 ini->wfd2_video_formats.video_non_transcoding_support = iniparser_getint(dict, "wfd2 video formats:video non transcoding support", DEFAULT_WFD2_VIDEO_FORMATS_NON_TRANSCODING_SUPPORT);
325
326                 /* audio r2 parameter*/
327                 ini->wfd2_audio_codecs.audio_codec = iniparser_getint(dict, "wfd2 audio codecs:audio codec", DEFAULT_WFD2_AUDIO_CODECS_CODEC);
328                 ini->wfd2_audio_codecs.audio_lpcm_mode = iniparser_getint(dict, "wfd2 audio codecs:audio lpcm mode", DEFAULT_WFD2_AUDIO_CODECS_LPCM_MODE);
329                 ini->wfd2_audio_codecs.audio_aac_mode = iniparser_getint(dict, "wfd2 audio codecs:audio aac mode", DEFAULT_WFD2_AUDIO_CODECS_AAC_MODE);
330                 ini->wfd2_audio_codecs.audio_ac3_mode = iniparser_getint(dict, "wfd2 audio codecs:audio ac3 mode", DEFAULT_WFD2_AUDIO_CODECS_AC3_MODE);
331         } else { /* if dict is not available just fill the structure with default value */
332                 wfd_sink_error("failed to load ini. using hardcoded default");
333
334                 /* general */
335                 strncpy(ini->gst_param[0], DEFAULT_GST_PARAM, WFD_SINK_INI_MAX_STRLEN - 1);
336                 strncpy(ini->gst_param[1], DEFAULT_GST_PARAM, WFD_SINK_INI_MAX_STRLEN - 1);
337                 strncpy(ini->gst_param[2], DEFAULT_GST_PARAM, WFD_SINK_INI_MAX_STRLEN - 1);
338                 strncpy(ini->gst_param[3], DEFAULT_GST_PARAM, WFD_SINK_INI_MAX_STRLEN - 1);
339                 strncpy(ini->gst_param[4], DEFAULT_GST_PARAM, WFD_SINK_INI_MAX_STRLEN - 1);
340                 ini->state_change_timeout = DEFAULT_STATE_CHANGE_TIMEOUT;
341                 ini->enable_rm =  DEFAULT_ENABLE_RM;
342                 ini->jitter_buffer_latency = DEFAULT_JITTER_BUFFER_LATENCY;
343                 ini->enable_retransmission =  DEFAULT_ENABLE_RETRANSMISSION;
344                 ini->enable_reset_basetime =  DEFAULT_ENABLE_RESET_BASETIME;
345                 ini->video_sink_max_lateness = DEFAULT_VIDEO_SINK_MAX_LATENESS;
346                 ini->sink_ts_offset = DEFAULT_SINK_TS_OFFSET;
347                 strncpy(ini->user_agent, DEFAULT_USER_AGENT, WFD_SINK_INI_MAX_STRLEN - 1);
348
349                 /* debug */
350                 ini->generate_dot =  DEFAULT_GENERATE_DOT;
351                 ini->dump_rtsp_message =  DEFAULT_DUMP_RTSP_MESSAGE;
352                 ini->trace_buffers = DEFAULT_TRACE_BUFFERS;
353                 ini->trace_first_buffer = DEFAULT_TRACE_FIRST_BUFFER;
354                 ini->trace_buffers_of_wfdsrc = DEFAULT_TRACE_BUFFERS_OF_WFDSRC;
355                 ini->dump_ts_data = DEFAULT_DUMP_TS_DATA;
356                 ini->dump_rtp_data = DEFAULT_DUMP_RTP_DATA;
357
358                 /* pipeline */
359                 strncpy(ini->name_of_source, DEFAULT_NAME_OF_SOURCE, WFD_SINK_INI_MAX_STRLEN - 1);
360                 strncpy(ini->name_of_tsdemux, DEFAULT_NAME_OF_TSDEMUX, WFD_SINK_INI_MAX_STRLEN - 1);
361                 strncpy(ini->name_of_audio_hdcp, DEFAULT_NAME_OF_AUDIO_HDCP, WFD_SINK_INI_MAX_STRLEN - 1);
362                 strncpy(ini->name_of_aac_parser, DEFAULT_NAME_OF_AAC_PARSER, WFD_SINK_INI_MAX_STRLEN - 1);
363                 strncpy(ini->name_of_aac_decoder, DEFAULT_NAME_OF_AAC_DECODER, WFD_SINK_INI_MAX_STRLEN - 1);
364                 strncpy(ini->name_of_ac3_parser, DEFAULT_NAME_OF_AC3_PARSER, WFD_SINK_INI_MAX_STRLEN - 1);
365                 strncpy(ini->name_of_ac3_decoder, DEFAULT_NAME_OF_AC3_DECODER, WFD_SINK_INI_MAX_STRLEN - 1);
366                 strncpy(ini->name_of_lpcm_converter, DEFAULT_NAME_OF_LPCM_CONVERTER, WFD_SINK_INI_MAX_STRLEN - 1);
367                 strncpy(ini->name_of_lpcm_filter, DEFAULT_NAME_OF_LPCM_FILTER, WFD_SINK_INI_MAX_STRLEN - 1);
368                 strncpy(ini->name_of_audio_resampler, DEFAULT_NAME_OF_AUDIO_RESAMPLER, WFD_SINK_INI_MAX_STRLEN - 1);
369                 strncpy(ini->name_of_audio_volume, DEFAULT_NAME_OF_AUDIO_VOLUME, WFD_SINK_INI_MAX_STRLEN - 1);
370                 strncpy(ini->name_of_audio_sink, DEFAULT_NAME_OF_AUDIO_SINK, WFD_SINK_INI_MAX_STRLEN - 1);
371                 strncpy(ini->name_of_video_hdcp, DEFAULT_NAME_OF_VIDEO_HDCP, WFD_SINK_INI_MAX_STRLEN - 1);
372                 strncpy(ini->name_of_video_h264_parser, DEFAULT_NAME_OF_VIDEO_H264_PARSER, WFD_SINK_INI_MAX_STRLEN - 1);
373                 strncpy(ini->name_of_video_capssetter, DEFAULT_NAME_OF_VIDEO_CAPSSETTER, WFD_SINK_INI_MAX_STRLEN - 1);
374                 strncpy(ini->name_of_video_h264_decoder, DEFAULT_NAME_OF_VIDEO_H264_DECODER, WFD_SINK_INI_MAX_STRLEN - 1);
375                 strncpy(ini->name_of_video_h265_parser, DEFAULT_NAME_OF_VIDEO_H265_PARSER, WFD_SINK_INI_MAX_STRLEN - 1);
376                 strncpy(ini->name_of_video_h265_decoder, DEFAULT_NAME_OF_VIDEO_H265_DECODER, WFD_SINK_INI_MAX_STRLEN - 1);
377                 strncpy(ini->name_of_video_converter, DEFAULT_NAME_OF_VIDEO_CONVERTER, WFD_SINK_INI_MAX_STRLEN - 1);
378                 strncpy(ini->name_of_video_filter, DEFAULT_NAME_OF_VIDEO_FILTER, WFD_SINK_INI_MAX_STRLEN - 1);
379                 strncpy(ini->name_of_video_sink, DEFAULT_NAME_OF_VIDEO_SINK, WFD_SINK_INI_MAX_STRLEN - 1);
380                 strncpy(ini->name_of_video_evas_sink, DEFAULT_NAME_OF_EVAS_VIDEO_SINK, WFD_SINK_INI_MAX_STRLEN - 1);
381
382                 /* audio parameter*/
383                 ini->wfd_audio_codecs.audio_codec = DEFAULT_WFD_AUDIO_CODECS_CODEC;
384                 ini->wfd_audio_codecs.audio_latency = DEFAULT_WFD_AUDIO_CODECS_LATENCY;
385                 ini->wfd_audio_codecs.audio_channel = DEFAULT_WFD_AUDIO_CODECS_CHANNELS;
386                 ini->wfd_audio_codecs.audio_sampling_frequency = DEFAULT_WFD_AUDIO_CODECS_SAMP_FREQUENCY;
387
388                 /* video parameter*/
389                 ini->wfd_video_formats.video_codec = DEFAULT_WFD_VIDEO_FORMATS_CODEC;
390                 ini->wfd_video_formats.video_native_resolution = DEFAULT_WFD_VIDEO_FORMATS_NATIVE_RESOLUTION;
391                 ini->wfd_video_formats.video_cea_support = strtoul(DEFAULT_WFD_VIDEO_FORMATS_CEA_SUPPORT, NULL, 16);
392                 ini->wfd_video_formats.video_vesa_support = strtoul(DEFAULT_WFD_VIDEO_FORMATS_VESA_SUPPORT, NULL, 16);
393                 ini->wfd_video_formats.video_hh_support = strtoul(DEFAULT_WFD_VIDEO_FORMATS_HH_SUPPORT, NULL, 16);
394                 ini->wfd_video_formats.video_profile = DEFAULT_WFD_VIDEO_FORMATS_PROFILE;
395                 ini->wfd_video_formats.video_level = DEFAULT_WFD_VIDEO_FORMATS_LEVEL;
396                 ini->wfd_video_formats.video_latency = DEFAULT_WFD_VIDEO_FORMATS_LATENCY;
397                 ini->wfd_video_formats.video_vertical_resolution = DEFAULT_WFD_VIDEO_FORMATS_VERTICAL_RESOLUTION;
398                 ini->wfd_video_formats.video_horizontal_resolution = DEFAULT_WFD_VIDEO_FORMATS_HORIZONTAL_RESOLUTION;
399                 ini->wfd_video_formats.video_minimum_slicing = DEFAULT_WFD_VIDEO_FORMATS_MIN_SLICESIZE;
400                 ini->wfd_video_formats.video_slice_enc_param = DEFAULT_WFD_VIDEO_FORMATS_SLICE_ENC_PARAM;
401                 ini->wfd_video_formats.video_framerate_control_support = DEFAULT_WFD_VIDEO_FORMATS_FRAMERATE_CONTROL;
402
403                 /* hdcp parameter*/
404                 ini->wfd_content_protection.enable_hdcp = DEFAULT_ENABLE_HDCP;
405                 ini->wfd_content_protection.hdcp_content_protection = DEFAULT_WFD_HDCP_CONTENT_PROTECTION;
406                 ini->wfd_content_protection.hdcp_port_no = DEFAULT_WFD_HDCP_PORT_NO;
407
408                 /* video r2 parameter*/
409                 ini->wfd2_video_formats.video_codec = DEFAULT_WFD2_VIDEO_FORMATS_CODEC;
410                 ini->wfd2_video_formats.video_native_resolution = DEFAULT_WFD2_VIDEO_FORMATS_NATIVE_RESOLUTION;
411                 ini->wfd2_video_formats.video_cea_support = strtoul(DEFAULT_WFD2_VIDEO_FORMATS_CEA_SUPPORT, NULL, 16);
412                 ini->wfd2_video_formats.video_vesa_support = strtoul(DEFAULT_WFD2_VIDEO_FORMATS_VESA_SUPPORT, NULL, 16);
413                 ini->wfd2_video_formats.video_hh_support = strtoul(DEFAULT_WFD2_VIDEO_FORMATS_HH_SUPPORT, NULL, 16);
414                 ini->wfd2_video_formats.video_profile = DEFAULT_WFD2_VIDEO_FORMATS_PROFILE;
415                 ini->wfd2_video_formats.video_level = DEFAULT_WFD2_VIDEO_FORMATS_LEVEL;
416                 ini->wfd2_video_formats.video_latency = DEFAULT_WFD2_VIDEO_FORMATS_LATENCY;
417                 ini->wfd2_video_formats.video_vertical_resolution = DEFAULT_WFD2_VIDEO_FORMATS_VERTICAL_RESOLUTION;
418                 ini->wfd2_video_formats.video_horizontal_resolution = DEFAULT_WFD2_VIDEO_FORMATS_HORIZONTAL_RESOLUTION;
419                 ini->wfd2_video_formats.video_minimum_slicing = DEFAULT_WFD2_VIDEO_FORMATS_MIN_SLICESIZE;
420                 ini->wfd2_video_formats.video_slice_enc_param = DEFAULT_WFD2_VIDEO_FORMATS_SLICE_ENC_PARAM;
421                 ini->wfd2_video_formats.video_framerate_control_support = DEFAULT_WFD2_VIDEO_FORMATS_FRAMERATE_CONTROL;
422                 ini->wfd2_video_formats.video_non_transcoding_support = DEFAULT_WFD2_VIDEO_FORMATS_NON_TRANSCODING_SUPPORT;
423
424                 /* audio r2 parameter*/
425                 ini->wfd2_audio_codecs.audio_codec = DEFAULT_WFD2_AUDIO_CODECS_CODEC;
426                 ini->wfd2_audio_codecs.audio_lpcm_mode = DEFAULT_WFD2_AUDIO_CODECS_LPCM_MODE;
427                 ini->wfd2_audio_codecs.audio_aac_mode = DEFAULT_WFD2_AUDIO_CODECS_AAC_MODE;
428                 ini->wfd2_audio_codecs.audio_ac3_mode = DEFAULT_WFD2_AUDIO_CODECS_AC3_MODE;
429         }
430
431         /* free dict as we got our own structure */
432         iniparser_freedict(dict);
433
434
435         /* dump structure */
436         wfd_sink_debug("Wi-Fi Display Sink Initial Settings-----------------------------------");
437
438         /* general */
439         wfd_sink_debug("gst_param1 : %s", ini->gst_param[0]);
440         wfd_sink_debug("gst_param2 : %s", ini->gst_param[1]);
441         wfd_sink_debug("gst_param3 : %s", ini->gst_param[2]);
442         wfd_sink_debug("gst_param4 : %s", ini->gst_param[3]);
443         wfd_sink_debug("gst_param5 : %s", ini->gst_param[4]);
444         wfd_sink_debug("state_change_timeout(sec) : %d", ini->state_change_timeout);
445         wfd_sink_debug("enable_rm : %d", ini->enable_rm);
446         wfd_sink_debug("jitter_buffer_latency(msec) : %d", ini->jitter_buffer_latency);
447         wfd_sink_debug("enable_retransmission : %d", ini->enable_retransmission);
448         wfd_sink_debug("enable_reset_basetime : %d", ini->enable_reset_basetime);
449         wfd_sink_debug("video_sink_max_lateness(nsec) : %d", ini->video_sink_max_lateness);
450         wfd_sink_debug("sink_ts_offset(nsec) : %d", ini->sink_ts_offset);
451         wfd_sink_debug("audio_sink_async : %d", ini->audio_sink_async);
452         wfd_sink_debug("video_sink_async : %d", ini->video_sink_async);
453         wfd_sink_debug("user_agent : %s\n", ini->user_agent);
454
455         /* debug */
456         wfd_sink_debug("generate_dot : %d", ini->generate_dot);
457         if (ini->generate_dot == TRUE) {
458                 wfd_sink_debug("generate_dot is TRUE, dot file will be stored into /tmp/");
459                 g_setenv("GST_DEBUG_DUMP_DOT_DIR", "/tmp/", FALSE);
460         }
461         wfd_sink_debug("dump_rtsp_message : %d", ini->dump_rtsp_message);
462         wfd_sink_debug("trace_buffers : %d", ini->trace_buffers);
463         wfd_sink_debug("trace_first_buffer : %d", ini->trace_first_buffer);
464         wfd_sink_debug("trace_buffers_of_wfdsrc : %d", ini->trace_buffers_of_wfdsrc);
465         wfd_sink_debug("dump_ts_data : %d", ini->dump_ts_data);
466         wfd_sink_debug("dump_rtp_data : %d", ini->dump_rtp_data);
467
468
469         /* pipeline */
470         wfd_sink_debug("name_of_source : %s", ini->name_of_source);
471         wfd_sink_debug("name_of_tsdemux : %s", ini->name_of_tsdemux);
472         wfd_sink_debug("name_of_audio_hdcp : %s", ini->name_of_audio_hdcp);
473         wfd_sink_debug("name_of_aac_parser : %s", ini->name_of_aac_parser);
474         wfd_sink_debug("name_of_aac_decoder : %s", ini->name_of_aac_decoder);
475         wfd_sink_debug("name_of_ac3_parser : %s", ini->name_of_ac3_parser);
476         wfd_sink_debug("name_of_ac3_decoder : %s", ini->name_of_ac3_decoder);
477         wfd_sink_debug("name_of_lpcm_converter : %s", ini->name_of_lpcm_converter);
478         wfd_sink_debug("name_of_lpcm_filter : %s", ini->name_of_lpcm_filter);
479         wfd_sink_debug("name_of_audio_resampler : %s", ini->name_of_audio_resampler);
480         wfd_sink_debug("name_of_audio_volume : %s", ini->name_of_audio_volume);
481         wfd_sink_debug("name_of_audio_sink : %s", ini->name_of_audio_sink);
482         wfd_sink_debug("name_of_video_hdcp : %s", ini->name_of_video_hdcp);
483         wfd_sink_debug("name_of_video_h264_parser : %s", ini->name_of_video_h264_parser);
484         wfd_sink_debug("name_of_video_capssetter : %s\n", ini->name_of_video_capssetter);
485         wfd_sink_debug("name_of_video_h264_decoder : %s", ini->name_of_video_h264_decoder);
486         wfd_sink_debug("name_of_video_h265_parser : %s", ini->name_of_video_h265_parser);
487         wfd_sink_debug("name_of_video_h265_decoder : %s", ini->name_of_video_h265_decoder);
488         wfd_sink_debug("name_of_video_converter : %s", ini->name_of_video_converter);
489         wfd_sink_debug("name_of_video_filter : %s", ini->name_of_video_filter);
490         wfd_sink_debug("name_of_video_sink : %s", ini->name_of_video_sink);
491         wfd_sink_debug("name_of_video_evas_sink : %s", ini->name_of_video_evas_sink);
492
493         /* audio parameter*/
494         wfd_sink_debug("wfd_audio_codecs.audio_codec : %x", ini->wfd_audio_codecs.audio_codec);
495         wfd_sink_debug("wfd_audio_codecs.audio_latency : %d", ini->wfd_audio_codecs.audio_latency);
496         wfd_sink_debug("wfd_audio_codecs.audio_channel : %x", ini->wfd_audio_codecs.audio_channel);
497         wfd_sink_debug("wfd_audio_codecs.audio_sampling_frequency : %x", ini->wfd_audio_codecs.audio_sampling_frequency);
498
499         /* video parameter*/
500         wfd_sink_debug("wfd_video_formats.video_codec : %x\n", ini->wfd_video_formats.video_codec);
501         wfd_sink_debug("wfd_video_formats.video_native_resolution : %x\n", ini->wfd_video_formats.video_native_resolution);
502         wfd_sink_debug("wfd_video_formats.video_cea_support : %llx\n", ini->wfd_video_formats.video_cea_support);
503         wfd_sink_debug("wfd_video_formats.video_vesa_support : %llx\n", ini->wfd_video_formats.video_vesa_support);
504         wfd_sink_debug("wfd_video_formats.video_hh_support : %llx\n", ini->wfd_video_formats.video_hh_support);
505         wfd_sink_debug("wfd_video_formats.video_profile : %x\n", ini->wfd_video_formats.video_profile);
506         wfd_sink_debug("wfd_video_formats.video_level : %x\n", ini->wfd_video_formats.video_level);
507         wfd_sink_debug("wfd_video_formats.video_latency : %d\n", ini->wfd_video_formats.video_latency);
508         wfd_sink_debug("wfd_video_formats.video_vertical_resolution : %d\n", ini->wfd_video_formats.video_vertical_resolution);
509         wfd_sink_debug("wfd_video_formats.video_horizontal_resolution : %d\n", ini->wfd_video_formats.video_horizontal_resolution);
510         wfd_sink_debug("wfd_video_formats.video_minimum_slicing : %d\n", ini->wfd_video_formats.video_minimum_slicing);
511         wfd_sink_debug("wfd_video_formats.video_slice_enc_param : %d\n", ini->wfd_video_formats.video_slice_enc_param);
512         wfd_sink_debug("wfd_video_formats.video_framerate_control_support : %d\n", ini->wfd_video_formats.video_framerate_control_support);
513
514         /* hdcp parameter*/
515         wfd_sink_debug("wfd_content_protection.enable_hdcp : %d", ini->wfd_content_protection.enable_hdcp);
516         wfd_sink_debug("wfd_content_protection.hdcp_content_protection : %x", ini->wfd_content_protection.hdcp_content_protection);
517         wfd_sink_debug("wfd_content_protection.hdcp_port_no : %d", ini->wfd_content_protection.hdcp_port_no);
518
519         /* video r2 parameter*/
520         wfd_sink_debug("wfd2_video_formats.video_codec : %x\n", ini->wfd2_video_formats.video_codec);
521         wfd_sink_debug("wfd2_video_formats.video_native_resolution : %x\n", ini->wfd2_video_formats.video_native_resolution);
522         wfd_sink_debug("wfd2_video_formats.video_cea_support : %llx\n", ini->wfd2_video_formats.video_cea_support);
523         wfd_sink_debug("wfd2_video_formats.video_vesa_support : %llx\n", ini->wfd2_video_formats.video_vesa_support);
524         wfd_sink_debug("wfd2_video_formats.video_hh_support : %llx\n", ini->wfd2_video_formats.video_hh_support);
525         wfd_sink_debug("wfd2_video_formats.video_profile : %x\n", ini->wfd2_video_formats.video_profile);
526         wfd_sink_debug("wfd2_video_formats.video_level : %x\n", ini->wfd2_video_formats.video_level);
527         wfd_sink_debug("wfd2_video_formats.video_latency : %d\n", ini->wfd2_video_formats.video_latency);
528         wfd_sink_debug("wfd2_video_formats.video_vertical_resolution : %d\n", ini->wfd2_video_formats.video_vertical_resolution);
529         wfd_sink_debug("wfd2_video_formats.video_horizontal_resolution : %d\n", ini->wfd2_video_formats.video_horizontal_resolution);
530         wfd_sink_debug("wfd2_video_formats.video_minimum_slicing : %d\n", ini->wfd2_video_formats.video_minimum_slicing);
531         wfd_sink_debug("wfd2_video_formats.video_slice_enc_param : %d\n", ini->wfd2_video_formats.video_slice_enc_param);
532         wfd_sink_debug("wfd2_video_formats.video_framerate_control_support : %d\n", ini->wfd2_video_formats.video_framerate_control_support);
533
534         /* audio r2 parameter*/
535         wfd_sink_debug("wfd2_audio_codecs.audio_codec : %x\n", ini->wfd2_audio_codecs.audio_codec);
536         wfd_sink_debug("wfd2_audio_codecs.audio_lpcm_mode : %x\n", ini->wfd2_audio_codecs.audio_lpcm_mode);
537         wfd_sink_debug("wfd2_audio_codecs.audio_aac_mode : %x\n", ini->wfd2_audio_codecs.audio_aac_mode);
538         wfd_sink_debug("wfd2_audio_codecs.audio_ac3_mode : %x\n", ini->wfd2_audio_codecs.audio_ac3_mode);
539
540         wfd_sink_debug("---------------------------------------------------");
541
542         loaded = TRUE;
543
544         wfd_sink_debug_fleave();
545
546         return MM_ERROR_NONE;
547 }
548
549
550 static
551 void __mm_wfd_sink_ini_check_status(const char *path)
552 {
553         struct stat ini_buff;
554
555         wfd_sink_return_if_fail(path);
556
557         wfd_sink_debug_fenter();
558
559         if (g_stat(path, &ini_buff) < 0) {
560                 wfd_sink_error("failed to get [%s] ini status", path);
561         } else {
562                 if (ini_buff.st_size < 5) {
563                         wfd_sink_error("%s file size=%d, Corrupted! So, Removed", path, (int)ini_buff.st_size);
564                         g_remove(path);
565                 }
566         }
567
568         wfd_sink_debug_fleave();
569 }
570
571 int
572 mm_wfd_sink_ini_unload(mm_wfd_sink_ini_t *ini)
573 {
574         wfd_sink_debug_fenter();
575
576         loaded = FALSE;
577
578         wfd_sink_debug_fleave();
579
580         return MM_ERROR_NONE;
581 }