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