1. Use wfdtsdemux instead of tsdemux.
[platform/core/multimedia/libmm-wfd.git] / common / include / mm_wfd_sink_ini.h
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 #ifndef __MM_WFD_SINK_INI_H__
24 #define __MM_WFD_SINK_INI_H__
25
26 #include <glib.h>
27 #include <mmf/wfdconfigmessage.h>
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32
33
34 enum WFDSinkINIProbeFlags
35 {
36         WFD_SINK_INI_PROBE_DEFAULT = 0,
37         WFD_SINK_INI_PROBE_TIMESTAMP = (1 << 0),
38         WFD_SINK_INI_PROBE_BUFFERSIZE = (1 << 1),
39         WFD_SINK_INI_PROBE_CAPS = (1 << 2),
40         WFD_SINK_INI_PROBE_BUFFER_DURATION = (1 << 3),
41 };
42
43 #define MM_WFD_SINK_INI_DEFAULT_PATH    "/usr/etc/mmfw_wfd_sink.ini"
44
45 #define WFD_SINK_INI_MAX_STRLEN 256
46 #define WFD_SINK_INI_MAX_ELEMENT        10
47
48 /* NOTE : MMPlayer has no initalizing API for library itself
49  * so we cannot decide when those ini values to be released.
50  * this is the reason of all string items are static array.
51  * make it do with malloc when MMPlayerInitialize() API created
52  * before that time, we should be careful with size limitation
53  * of each string item.
54  */
55 typedef struct __mm_wfd_sink_ini {
56         /* general */
57         gchar gst_param[5][WFD_SINK_INI_MAX_STRLEN];
58         gboolean generate_dot;
59         gboolean enable_pad_probe;
60         gint state_change_timeout;
61         gboolean set_debug_property;
62         gboolean enable_asm;
63         gint jitter_buffer_latency;
64         gint video_sink_max_lateness;
65         gint sink_ts_offset;
66         gboolean audio_sink_async;
67         gboolean video_sink_async;
68         gboolean enable_retransmission;
69         gboolean enable_reset_basetime;
70         gboolean enable_ts_data_dump;
71         gboolean enable_wfdrtspsrc_pad_probe;
72
73         /* pipeline */
74         gchar name_of_tsdemux[WFD_SINK_INI_MAX_STRLEN];
75         gchar name_of_audio_hdcp[WFD_SINK_INI_MAX_STRLEN];
76         gchar name_of_aac_parser[WFD_SINK_INI_MAX_STRLEN];
77         gchar name_of_aac_decoder[WFD_SINK_INI_MAX_STRLEN];
78         gchar name_of_ac3_parser[WFD_SINK_INI_MAX_STRLEN];
79         gchar name_of_ac3_decoder[WFD_SINK_INI_MAX_STRLEN];
80         gchar name_of_lpcm_converter[WFD_SINK_INI_MAX_STRLEN];
81         gchar name_of_lpcm_filter[WFD_SINK_INI_MAX_STRLEN];
82         gchar name_of_audio_resampler[WFD_SINK_INI_MAX_STRLEN];
83         gchar name_of_audio_volume[WFD_SINK_INI_MAX_STRLEN];
84         gchar name_of_audio_sink[WFD_SINK_INI_MAX_STRLEN];
85
86         gchar name_of_video_hdcp[WFD_SINK_INI_MAX_STRLEN];
87         gchar name_of_video_parser[WFD_SINK_INI_MAX_STRLEN];
88         gchar name_of_video_decoder[WFD_SINK_INI_MAX_STRLEN];
89         gchar name_of_video_sink[WFD_SINK_INI_MAX_STRLEN];
90
91         /* audio parameter for reponse of M3 request */
92         guint audio_codec;
93         guint audio_latency;
94         guint audio_channel;
95         guint audio_sampling_frequency;
96
97         /* video parameter for reponse of M3 request */
98         guint video_codec;
99         guint video_native_resolution;
100         guint video_cea_support;
101         guint video_vesa_support;
102         guint video_hh_support;
103         guint video_profile;
104         guint video_level;
105         guint video_latency;
106         gint video_vertical_resolution;
107         gint video_horizontal_resolution;
108         gint video_minimum_slicing;
109         gint video_slice_enc_param;
110         gint video_framerate_control_support;
111
112         /* hdcp parameter for reponse of M3 request */
113         gint hdcp_content_protection;
114         gint hdcp_port_no;
115 } mm_wfd_sink_ini_t;
116
117
118 /*Default sink ini values*/
119 /* General*/
120 #define DEFAULT_GST_PARAM       ""
121 #define DEFAULT_GENERATE_DOT    FALSE
122 #define DEFAULT_ENABLE_PAD_PROBE        FALSE
123 #define DEFAULT_STATE_CHANGE_TIMEOUT 5 /* sec */
124 #define DEFAULT_SET_DEBUG_PROPERTY      TRUE
125 #define DEFAULT_ENABLE_ASM      FALSE
126 #define DEFAULT_JITTER_BUFFER_LATENCY 10 /* msec */
127 #define DEFAULT_ENABLE_RETRANSMISSION   TRUE
128 #define DEFAULT_ENABLE_RESET_BASETIME   TRUE
129 #define DEFAULT_VIDEO_SINK_MAX_LATENESS 20000000 /* nsec */
130 #define DEFAULT_SINK_TS_OFFSET 150000000 /* nsec */
131 #define DEFAULT_AUDIO_SINK_ASYNC FALSE
132 #define DEFAULT_VIDEO_SINK_ASYNC FALSE
133 #define DEFAULT_ENABLE_TS_DATA_DUMP             FALSE
134 #define DEFAULT_ENABLE_WFDRTSPSRC_PAD_PROBE FALSE
135
136 /* Pipeline */
137 #define DEFAULT_NAME_OF_TSDEMUX ""
138 #define DEFAULT_NAME_OF_AUDIO_HDCP ""
139 #define DEFAULT_NAME_OF_AAC_PARSER ""
140 #define DEFAULT_NAME_OF_AAC_DECODER ""
141 #define DEFAULT_NAME_OF_AC3_PARSER ""
142 #define DEFAULT_NAME_OF_AC3_DECODER ""
143 #define DEFAULT_NAME_OF_LPCM_CONVERTER ""
144 #define DEFAULT_NAME_OF_LPCM_FILTER ""
145 #define DEFAULT_NAME_OF_AUDIO_RESAMPLER ""
146 #define DEFAULT_NAME_OF_AUDIO_VOLUME ""
147 #define DEFAULT_NAME_OF_AUDIO_SPLITTER ""
148 #define DEFAULT_NAME_OF_AUDIO_SINK ""
149 #define DEFAULT_NAME_OF_VIDEO_HDCP ""
150 #define DEFAULT_NAME_OF_VIDEO_PARSER ""
151 #define DEFAULT_NAME_OF_VIDEO_DECODER ""
152 #define DEFAULT_NAME_OF_VIDEO_SINK ""
153
154 /* Audio */
155 #define DEFAULT_AUDIO_CODEC WFD_AUDIO_LPCM | WFD_AUDIO_AAC
156 #define DEFAULT_AUDIO_LATENCY 0x0
157 #define DEFAULT_AUDIO_CHANNELS WFD_CHANNEL_2
158 #define DEFAULT_AUDIO_SAMP_FREQUENCY WFD_FREQ_44100 | WFD_FREQ_48000
159
160 /* Video */
161 #define DEFAULT_VIDEO_CODEC WFD_VIDEO_H264
162 #define DEFAULT_VIDEO_NATIVE_RESOLUTION 0x20
163 /* CEA :  WFD_CEA_640x480P60  | WFD_CEA_720x480P60 |WFD_CEA_720x576P50 |WFD_CEA_1280x720P30 |WFD_CEA_1920x1080P30 |
164         WFD_CEA_1280x720P25 |WFD_CEA_1920x1080P25 |WFD_CEA_1280x720P24 | WFD_CEA_1920x1080P24 */
165 #define DEFAULT_VIDEO_CEA_SUPPORT 0x194ab
166 /* VESA : WFD_VESA_800x600P30  |WFD_VESA_1024x768P30 |WFD_VESA_1152x864P30 | WFD_VESA_1280x768P30        | WFD_VESA_1280x800P30 |
167         WFD_VESA_1360x768P30 | WFD_VESA_1366x768P30 | WFD_VESA_1280x1024P30 |WFD_VESA_1400x1050P30       | WFD_VESA_1440x900P30 |
168         WFD_VESA_1600x900P30 | FD_VESA_1600x1200P30 | WFD_VESA_1680x1024P30 | WFD_VESA_1680x1050P30      | WFD_VESA_1920x1200P30 | */
169 #define DEFAULT_VIDEO_VESA_SUPPORT 0x55555555
170 /* HH : WFD_HH_800x480P30 | WFD_HH_854x480P30 | WFD_HH_864x480P30 | WFD_HH_640x360P30 | WFD_HH_960x540P30 | WFD_HH_848x480P30 */
171 #define DEFAULT_VIDEO_HH_SUPPORT 0x555
172 #define DEFAULT_VIDEO_PROFILE WFD_H264_BASE_PROFILE
173 #define DEFAULT_VIDEO_LEVEL WFD_H264_LEVEL_3_2
174 #define DEFAULT_VIDEO_LATENCY 0x0
175 #define DEFAULT_VIDEO_VERTICAL_RESOLUTION 1080
176 #define DEFAULT_VIDEO_HORIZONTAL_RESOLUTION 1920
177 #define DEFAULT_VIDEO_MIN_SLICESIZE 0
178 #define DEFAULT_VIDEO_SLICE_ENC_PARAM 200
179 #define DEFAULT_VIDEO_FRAMERATE_CONTROL 11
180
181 /* HDCP */
182 #define DEFAULT_HDCP_CONTENT_PROTECTION 0x0
183 #define DEFAULT_HDCP_PORT_NO 0
184
185
186 #define MM_WFD_SINK_DEFAULT_INI \
187 " \
188 [general]\n\
189 ; parameters for initializing gstreamer\n\
190 ; DEFAULT SET(--gst-debug=2, *wfd*:5)\n\
191 gstparam1 = --gst-debug=2, *wfd*:5, *wfdtsdemux:1, *wfdrtpbuffer:1\n\
192 gstparam2 =\n\
193 gstparam3 =\n\
194 gstparam4 =\n\
195 gstparam5 =\n\
196 \n\
197 ; generating dot file representing pipeline state\n\
198 ; do export GST_DEBUG_DUMP_DOT_DIR=[dot file path] in the shell\n\
199 generate dot = no\n\
200 \n\
201 ; enable pad probe\n\
202 enable pad probe = no\n\
203 \n\
204 ; enable wfdrtspsrc inner pad probe\n\
205 enable wfdrtspsrc pad probe = no\n\
206 \n\
207 ; enable ts data dump(/var/tmp/*.ts)\n\
208 enable ts data dump = no\n\
209 \n\
210 ; allowed timeout for changing pipeline state\n\
211 state change timeout = 5 ; sec\n\
212 \n\
213 ; set debug property to wfdrtspsrc plugin for debugging rtsp message\n\
214 set debug property = yes\n\
215 \n\
216 ; for asm function enable = yes, disable = no\n\
217 enable asm = no\n\
218 \n\
219 ; 0: default value set by wfdrtspsrc element, other: user define value.\n\
220 jitter buffer latency=10\n\
221 \n\
222 ; for retransmission request enable = yes, disable = no\n\
223 enable retransmission = yes\n\
224 \n\
225 ; for reset basetime, enable = yes, disable = no\n\
226 enable reset basetime = yes\n\
227 \n\
228 ; Maximum number of nanoseconds that a buffer can be late before it is dropped by videosink(-1 unlimited)\n\
229 video sink max lateness=20000000\n\
230 \n\
231 ; nanoseconds to be added to buffertimestamp by sink elements\n\
232 sink ts offset=150000000\n\
233 \n\
234 ; if no, go asynchronously to PAUSED without preroll \n\
235 audio sink async=no\n\
236 \n\
237 ; if no, go asynchronously to PAUSED without preroll \n\
238 video sink async=no\n\
239 \n\
240 \n\
241 \n\
242 [pipeline]\n\
243 tsdemux element = wfdtsdemux\n\
244 \n\
245 aac parser element = aacparse\n\
246 \n\
247 aac decoder element = avdec_aac\n\
248 \n\
249 ac3 parser element = ac3parse\n\
250 \n\
251 ac3 decoder element =\n\
252 \n\
253 lpcm converter element = audioconvert\n\
254 \n\
255 lpcm filter element = capsfilter\n\
256 \n\
257 audio resampler element = audioconvert\n\
258 \n\
259 audio volume element =\n\
260 \n\
261 audio sink element = pulsesink\n\
262 \n\
263 video parser element = h264parse\n\
264 \n\
265 video decoder element = omxh264dec\n\
266 \n\
267 video sink element = xvimagesink\n\
268 \n\
269 \n\
270 \n\
271 [audio param]\n\
272 ; 0x1: LPCM, 0x2: aac, 0x4: ac3\n\
273 ;default aac and LPCM\n\
274 audio codec=0x3\n\
275 \n\
276 audio latency=0x0\n\
277 \n\
278 ;0x1 : 48000khz, 0x2: 44100khz\n\
279 audio sampling frequency=0x3\n\
280 \n\
281 ; 0x1:2 channels, 0x2:4 channels, 0x4:6channels, 0x8:8channels\n\
282 audio channels=0x1\n\
283 \n\
284 \n\
285 \n\
286 [video param]\n\
287 ; 0: H264CBP 1: H264CHP\n\
288 video codec=0x1\n\
289 \n\
290 video native resolution = 0x20\n\
291 \n\
292 video cea support=0x194ab\n\
293 \n\
294 video vesa support=0x5555555\n\
295 \n\
296 video hh support=0x555\n\
297 \n\
298 ; 0x1:base, 0x2:high\n\
299 video profile=0x1\n\
300 \n\
301 ; 0x1:level_3_1, 0x2:level_3_2, 0x4:level_4, 0x8:level_4_1, 0x10:level_4_2\n\
302 video level=0x2\n\
303 \n\
304 video latency=0x0\n\
305 \n\
306 video vertical resolution=1080\n\
307 \n\
308 video horizontal resolution=1920\n\
309 \n\
310 video minimum slicesize=0\n\
311 \n\
312 video slice encoding params=200\n\
313 \n\
314 video framerate control support=11\n\
315 \n\
316 \n\
317 \n\
318 [hdcp param]\n\
319 ;0x0:none, 0x1:HDCP_2.0, 0x2:HDCP_2.1\n\
320 hdcp content protection=0x0\n\
321 \n\
322 hdcp port no=0\n\
323 \n\
324 "
325
326 int
327 mm_wfd_sink_ini_load(mm_wfd_sink_ini_t *ini);
328
329 int
330 mm_wfd_sink_ini_unload(mm_wfd_sink_ini_t *ini);
331
332 #ifdef __cplusplus
333 }
334 #endif
335
336 #endif