Merge tizen branch into tizen_5.5_devel
[platform/core/multimedia/libmm-player.git] / src / include / mm_player_ini.h
1 /*
2  * libmm-player
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: JongHyuk Choi <jhchoi.choi@samsung.com>, YeJin Cho <cho.yejin@samsung.com>,
7  * Seungbae Shin <seungbae.shin@samsung.com>, YoungHwan An <younghwan_.an@samsung.com>
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  *
21  */
22
23 #ifndef __MM_PLAYER_INI_H__
24 #define __MM_PLAYER_INI_H__
25
26 #include <glib.h>
27 #include <mm_types.h>
28 #include "mm_player_audioeffect.h"
29
30 #ifdef __cplusplus
31         extern "C" {
32 #endif
33
34 #ifdef LOG_TAG
35 #undef LOG_TAG
36 #endif
37 #define LOG_TAG "MM_PLAYER"
38
39 #define MM_PLAYER_INI_DEFAULT_PATH      SYSCONFDIR"/multimedia/mmfw_player.ini" /* SYSCONFDIR is defined at .spec */
40 #define MM_PLAYER_INI_DEFAULT_AUDIOEFFECT_PATH  SYSCONFDIR"/multimedia/mmfw_player_audio_effect.ini" /* SYSCONFDIR is defined at .spec */
41
42 #define PLAYER_INI_MAX_STRLEN       100
43 #define PLAYER_INI_MAX_PARAM_STRLEN 256
44
45 #define PLAYER_INI_MAX_ELEMENT      10
46 #define PLAYER_INI_MAX_DEVICE_TYPE  10
47 #define PLAYER_INI_MAX_SUPPORTED_MEDIA_FORMAT 10 /* @see MAX_SUPPORTED_MEDIA_FORMAT in player_private.h */
48
49 /* NOTE : MMPlayer has no initalizing API for library itself
50  * so we cannot decide when those ini values to be released.
51  * this is the reason of all string items are static array.
52  * make it do with malloc when MMPlayerInitialize() API created
53  * before that time, we should be careful with size limitation
54  * of each string item.
55  */
56 enum keyword_type {
57         KEYWORD_EXCLUDE,    // for element exclude keyword
58         KEYWORD_DUMP,       // for dump element keyword
59         KEYWORD_UNSUPPORTED_CODEC, // for un-supported codec
60         KEYWORD_A_SW_CODEC, // for audio sw codec
61         KEYWORD_V_SW_CODEC, // for video sw codec
62         KEYWORD_A_OFFLOAD_DEVICE_TYPE,  // for audio device type which can support offload
63         KEYWORD_A_OFFLOAD_MEDIA_FORMAT, // supported media format for audio offload
64         KEYWORD_MEDIA_STREAM_IN_FORMAT, // supported media format for external media stream
65 };
66
67 typedef struct {
68         /* general */
69         gchar videosink_element_overlay[PLAYER_INI_MAX_STRLEN];
70         gchar videosink_element_fake[PLAYER_INI_MAX_STRLEN];
71         gchar videoconverter_element[PLAYER_INI_MAX_STRLEN];
72         gchar videocodec_element_hw[PLAYER_INI_MAX_STRLEN];
73         gchar videocodec_element_sw[PLAYER_INI_MAX_ELEMENT][PLAYER_INI_MAX_STRLEN];
74         gchar audiocodec_element_hw[PLAYER_INI_MAX_STRLEN];
75         gchar audiocodec_element_sw[PLAYER_INI_MAX_ELEMENT][PLAYER_INI_MAX_STRLEN];
76         gchar audioresampler_element[PLAYER_INI_MAX_STRLEN];
77         gchar audiosink_element[PLAYER_INI_MAX_STRLEN];
78         gchar audio_offload_sink_element[PLAYER_INI_MAX_STRLEN];
79         gchar audio_offload_device_type[PLAYER_INI_MAX_DEVICE_TYPE][PLAYER_INI_MAX_STRLEN];
80         gchar audio_offload_media_format[PLAYER_INI_MAX_SUPPORTED_MEDIA_FORMAT][PLAYER_INI_MAX_STRLEN];
81         gchar media_stream_input_format[PLAYER_INI_MAX_SUPPORTED_MEDIA_FORMAT][PLAYER_INI_MAX_STRLEN];
82         gboolean skip_rescan;
83         gboolean generate_dot;
84         gboolean use_system_clock;
85         gint live_state_change_timeout;
86         gint localplayback_state_change_timeout;
87         gint delay_before_repeat;
88         gint eos_delay;
89         gboolean video_playback_supported;
90         gboolean use_uridecodebin3; /* experimental feature */
91
92         gchar gst_param[5][PLAYER_INI_MAX_PARAM_STRLEN];
93         gchar exclude_element_keyword[PLAYER_INI_MAX_ELEMENT][PLAYER_INI_MAX_STRLEN];
94         gchar unsupported_codec_keyword[PLAYER_INI_MAX_ELEMENT][PLAYER_INI_MAX_STRLEN];
95         gboolean async_start;
96         gboolean disable_segtrap;
97         gint pcm_buffer_size;
98         gint num_of_video_bo;
99         gint video_bo_timeout;
100
101         /* http streaming */
102         gchar httpsrc_element[PLAYER_INI_MAX_STRLEN];
103         guint http_ring_buffer_size;
104         gint http_timeout;
105
106         /* audio effect */
107         gchar audioeffect_element[PLAYER_INI_MAX_STRLEN];
108         gchar audioeffect_element_custom[PLAYER_INI_MAX_STRLEN];
109
110         /* audio effect preset mode */
111         gboolean use_audio_effect_preset;
112         gboolean audio_effect_preset_list[MM_AUDIO_EFFECT_PRESET_NUM];
113         gboolean audio_effect_preset_earphone_only_list[MM_AUDIO_EFFECT_PRESET_NUM];
114
115         /* audio effect custom mode */
116         gboolean use_audio_effect_custom;
117         gboolean audio_effect_custom_list[MM_AUDIO_EFFECT_CUSTOM_NUM];
118         gboolean audio_effect_custom_earphone_only_list[MM_AUDIO_EFFECT_CUSTOM_NUM];
119         gint audio_effect_custom_eq_band_num;
120         gint audio_effect_custom_eq_band_width[MM_AUDIO_EFFECT_EQ_BAND_NUM_MAX];
121         gint audio_effect_custom_eq_band_freq[MM_AUDIO_EFFECT_EQ_BAND_NUM_MAX];
122         gint audio_effect_custom_ext_num;
123         gint audio_effect_custom_min_level_list[MM_AUDIO_EFFECT_CUSTOM_NUM];
124         gint audio_effect_custom_max_level_list[MM_AUDIO_EFFECT_CUSTOM_NUM];
125
126         /* dump buffer for debug */
127         gchar dump_element_keyword[PLAYER_INI_MAX_ELEMENT][PLAYER_INI_MAX_STRLEN];
128         gchar dump_element_path[PLAYER_INI_MAX_STRLEN];
129         gboolean set_dump_element_flag;
130 } mmplayer_ini_t;
131
132 /* default values if each values are not specified in inifile */
133 /* general */
134 #define DEFAULT_EMPTY_VALUE                               ""
135 #define DEFAULT_AUDIO_EFFECT_ELEMENT                      ""
136 #define DEFAULT_USE_AUDIO_EFFECT_PRESET                   FALSE
137 #define DEFAULT_AUDIO_EFFECT_PRESET_LIST                  ""
138 #define DEFAULT_AUDIO_EFFECT_PRESET_LIST_EARPHONE_ONLY    ""
139 #define DEFAULT_USE_AUDIO_EFFECT_CUSTOM                   FALSE
140 #define DEFAULT_AUDIO_EFFECT_CUSTOM_LIST                  ""
141 #define DEFAULT_AUDIO_EFFECT_CUSTOM_LIST_EARPHONE_ONLY    ""
142 #define DEFAULT_AUDIO_EFFECT_CUSTOM_EQ_BAND_NUM           0
143 #define DEFAULT_AUDIO_EFFECT_CUSTOM_EQ_BAND_WIDTH         ""
144 #define DEFAULT_AUDIO_EFFECT_CUSTOM_EQ_BAND_FREQ          ""
145 #define DEFAULT_AUDIO_EFFECT_CUSTOM_EQ_MIN                0
146 #define DEFAULT_AUDIO_EFFECT_CUSTOM_EQ_MAX                0
147 #define DEFAULT_AUDIO_EFFECT_CUSTOM_EXT_NUM               0
148 #define DEFAULT_USE_SINK_HANDLER                          TRUE
149 #define DEFAULT_SKIP_RESCAN                               TRUE
150 #define DEFAULT_GENERATE_DOT                              FALSE
151 #define DEFAULT_USE_SYSTEM_CLOCK                          TRUE
152 #define DEFAULT_DELAY_BEFORE_REPEAT                       50 /* msec */
153 #define DEFAULT_EOS_DELAY                                 0 /* msec */
154 #define DEFAULT_VIDEOSINK_OVERLAY                         "tizenwlsink"
155 #define DEFAULT_VIDEOSINK_EVAS                            "evasimagesink"
156 #define DEFAULT_VIDEOSINK_FAKE                            "fakesink"
157 #define DEFAULT_AUDIORESAMPLER                            "audioresample"
158 #define DEFAULT_AUDIOSINK                                 "pulsesink"
159 #define DEFAULT_CODEC_HW                                  ""
160 #define DEFAULT_CODEC_SW                                  ""
161 #define DEFAULT_A_OFFLOAD_DEVICE_TYPE                     ""
162 #define DEFAULT_GST_PARAM                                 ""
163 #define DEFAULT_EXCLUDE_KEYWORD                           ""
164 #define DEFAULT_UNSUPPORTED_CODEC_KEYWORD                 ""
165 #define DEFAULT_ASYNC_START                               TRUE
166 #define DEFAULT_DISABLE_SEGTRAP                           TRUE
167 #define DEFAULT_VIDEO_CONVERTER                           ""
168 #define DEFAULT_VIDEO_PLAYBACK_SUPPORTED                  TRUE
169 #define DEFAULT_LIVE_STATE_CHANGE_TIMEOUT                 30 /* sec */
170 #define DEFAULT_LOCALPLAYBACK_STATE_CHANGE_TIMEOUT        10 /* sec */
171 #define DEFAULT_PCM_BUFFER_SIZE                           51200 /* bytes */
172 #define DEFAULT_NUM_OF_VIDEO_BO                           10
173 #define DEFAULT_TIMEOUT_OF_VIDEO_BO                       10 /* sec */
174 #define DEFAULT_AUDIO_OFFLOAD_SINK                        ""
175 #define DEFAULT_USE_URIDECODEBIN3                         FALSE
176
177 /* http streaming */
178 #define DEFAULT_HTTPSRC                                   "souphttpsrc"
179 #define DEFAULT_HTTP_RING_BUFFER_SIZE                     (20*1024*1024) /* bytes : 20MBytes */
180 #define DEFAULT_HTTP_TIMEOUT                              -1        /* infinite retry */
181
182 /* dump buffer for debug */
183 #define DEFAULT_DUMP_ELEMENT_KEYWORD                      ""
184 #define DEFAULT_DUMP_ELEMENT_PATH                         "/tmp/"
185
186 /* NOTE : following content should be same with above default values */
187 /* FIXIT : need smarter way to generate default ini file. */
188 /* FIXIT : finally, it should be an external file */
189 #define MM_PLAYER_DEFAULT_INI \
190 "\
191 [general] \n\
192 \n\
193 disable segtrap = yes ; same effect with --gst-disable-segtrap \n\
194 \n\
195 ; set default video sink but, it can be replaced with others selected by application\n\
196 ; 0:v4l2sink, 1:ximagesink, 2:xvimagesink, 3:fakesink 4:evasimagesink 5:glimagesink\n\
197 videosink element = 2 \n\
198 \n\
199 video converter element = \n\
200 \n\
201 audiosink element = pulsesink \n\
202 \n\
203 ; if yes. gstreamer will not update registry \n\
204 skip rescan = yes \n\
205 \n\
206 delay before repeat = 50 ; msec\n\
207 \n\
208 ; comma separated list of tocken which elemnts has it in it's name will not be used \n\
209 element exclude keyword = \n\
210 \n\
211 ; comma separated list of tocken \n\
212 unsupported codec keyword = \n\
213 \n\
214 async start = yes \n\
215 \n\
216 ; parameters for initializing gstreamer \n\
217 gstparam1 = --gst-debug=2\n\
218 gstparam2 = \n\
219 gstparam3 = \n\
220 gstparam4 = \n\
221 gstparam5 = \n\
222 \n\
223 ; generating dot file representing pipeline state \n\
224 ; export GST_DEBUG_DUMP_DOT_DIR=/tmp/\n\
225 generate dot = no \n\
226 \n\
227 ; parameter is for only video to be determined \n\
228 ; which clock will be used \n\
229 ; if yes, system clock will be used \n\
230 ; apart from this, audiosink is clock provider for audio \n\
231 use system clock = yes \n\
232 \n\
233 ; allowed timeout for changing pipeline state \n\
234 live state change timeout = 30 ; sec \n\
235 localplayback state change timeout = 4 ; sec \n\
236 \n\
237 ; delay in msec for sending EOS \n\
238 eos delay = 150 ; msec \n\
239 \n\
240 \n\
241 [http streaming] \n\
242 \n\
243 httppsrc element = souphttpsrc \n\
244 \n\
245 ; if yes, use file for buffering.\n\
246 ; if no, use memory for buffering.\n\
247 http use file buffer = no\n\
248 \n\
249 ; ring buffer size when use mem buffer \n\
250 http ring buffer size = 20971520 ; 20MBytes \n\
251 \n\
252 http buffering limit = 99 ; percent\n\
253 \n\
254 http max size bytes = 1048576 ; bytes\n\
255 \n\
256 http buffering time = 1.2 \n\
257 \n\
258 http timeout = -1 ; infinite retry \n\
259 \n\
260 "
261
262 int
263 mm_player_ini_load(mmplayer_ini_t *ini);
264
265 int
266 mm_player_audio_effect_ini_load(mmplayer_ini_t *ini);
267
268 #ifdef __cplusplus
269         }
270 #endif
271
272 #endif