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