[0.6.180] apply tizen naming coding rule
[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
47 /* NOTE : MMPlayer has no initalizing API for library itself
48  * so we cannot decide when those ini values to be released.
49  * this is the reason of all string items are static array.
50  * make it do with malloc when MMPlayerInitialize() API created
51  * before that time, we should be careful with size limitation
52  * of each string item.
53  */
54 enum keyword_type {
55         KEYWORD_EXCLUDE,    // for element exclude keyword
56         KEYWORD_DUMP,       // for dump element keyword
57         KEYWORD_UNSUPPORTED_CODEC, // for un-supported codec
58         KEYWORD_A_SW_CODEC, // for audio sw codec
59         KEYWORD_V_SW_CODEC, // for video sw codec
60         KEYWORD_A_OFFLOAD,  // for audio device type which can support offload
61 };
62
63 typedef struct {
64         /* general */
65         gchar videosink_element_overlay[PLAYER_INI_MAX_STRLEN];
66         gchar videosink_element_fake[PLAYER_INI_MAX_STRLEN];
67         gchar videoconverter_element[PLAYER_INI_MAX_STRLEN];
68         gchar videocodec_element_hw[PLAYER_INI_MAX_STRLEN];
69         gchar videocodec_element_sw[PLAYER_INI_MAX_ELEMENT][PLAYER_INI_MAX_STRLEN];
70         gchar audiocodec_element_hw[PLAYER_INI_MAX_STRLEN];
71         gchar audiocodec_element_sw[PLAYER_INI_MAX_ELEMENT][PLAYER_INI_MAX_STRLEN];
72         gchar audioresampler_element[PLAYER_INI_MAX_STRLEN];
73         gchar audiosink_element[PLAYER_INI_MAX_STRLEN];
74         gchar audio_offload_sink_element[PLAYER_INI_MAX_STRLEN];
75         gchar audio_offload_device_type[PLAYER_INI_MAX_ELEMENT][PLAYER_INI_MAX_STRLEN];
76         gboolean skip_rescan;
77         gboolean generate_dot;
78         gboolean use_system_clock;
79         gint live_state_change_timeout;
80         gint localplayback_state_change_timeout;
81         gint delay_before_repeat;
82         gint eos_delay;
83         gboolean video_playback_supported;
84
85         gchar gst_param[5][PLAYER_INI_MAX_PARAM_STRLEN];
86         gchar exclude_element_keyword[PLAYER_INI_MAX_ELEMENT][PLAYER_INI_MAX_STRLEN];
87         gchar unsupported_codec_keyword[PLAYER_INI_MAX_ELEMENT][PLAYER_INI_MAX_STRLEN];
88         gboolean async_start;
89         gboolean disable_segtrap;
90         gint pcm_buffer_size;
91         gint num_of_video_bo;
92         gint video_bo_timeout;
93
94         /* http streaming */
95         gchar httpsrc_element[PLAYER_INI_MAX_STRLEN];
96         guint http_ring_buffer_size;
97         gint http_timeout;
98
99         /* audio effect */
100         gchar audioeffect_element[PLAYER_INI_MAX_STRLEN];
101         gchar audioeffect_element_custom[PLAYER_INI_MAX_STRLEN];
102
103         /* audio effect preset mode */
104         gboolean use_audio_effect_preset;
105         gboolean audio_effect_preset_list[MM_AUDIO_EFFECT_PRESET_NUM];
106         gboolean audio_effect_preset_earphone_only_list[MM_AUDIO_EFFECT_PRESET_NUM];
107
108         /* audio effect custom mode */
109         gboolean use_audio_effect_custom;
110         gboolean audio_effect_custom_list[MM_AUDIO_EFFECT_CUSTOM_NUM];
111         gboolean audio_effect_custom_earphone_only_list[MM_AUDIO_EFFECT_CUSTOM_NUM];
112         gint audio_effect_custom_eq_band_num;
113         gint audio_effect_custom_eq_band_width[MM_AUDIO_EFFECT_EQ_BAND_NUM_MAX];
114         gint audio_effect_custom_eq_band_freq[MM_AUDIO_EFFECT_EQ_BAND_NUM_MAX];
115         gint audio_effect_custom_ext_num;
116         gint audio_effect_custom_min_level_list[MM_AUDIO_EFFECT_CUSTOM_NUM];
117         gint audio_effect_custom_max_level_list[MM_AUDIO_EFFECT_CUSTOM_NUM];
118
119         /* dump buffer for debug */
120         gchar dump_element_keyword[PLAYER_INI_MAX_ELEMENT][PLAYER_INI_MAX_STRLEN];
121         gchar dump_element_path[PLAYER_INI_MAX_STRLEN];
122         gboolean set_dump_element_flag;
123 } mmplayer_ini_t;
124
125 /* default values if each values are not specified in inifile */
126 /* general */
127 #define DEFAULT_AUDIO_EFFECT_ELEMENT                      ""
128 #define DEFAULT_USE_AUDIO_EFFECT_PRESET                   FALSE
129 #define DEFAULT_AUDIO_EFFECT_PRESET_LIST                  ""
130 #define DEFAULT_AUDIO_EFFECT_PRESET_LIST_EARPHONE_ONLY    ""
131 #define DEFAULT_USE_AUDIO_EFFECT_CUSTOM                   FALSE
132 #define DEFAULT_AUDIO_EFFECT_CUSTOM_LIST                  ""
133 #define DEFAULT_AUDIO_EFFECT_CUSTOM_LIST_EARPHONE_ONLY    ""
134 #define DEFAULT_AUDIO_EFFECT_CUSTOM_EQ_BAND_NUM           0
135 #define DEFAULT_AUDIO_EFFECT_CUSTOM_EQ_BAND_WIDTH         ""
136 #define DEFAULT_AUDIO_EFFECT_CUSTOM_EQ_BAND_FREQ          ""
137 #define DEFAULT_AUDIO_EFFECT_CUSTOM_EQ_MIN                0
138 #define DEFAULT_AUDIO_EFFECT_CUSTOM_EQ_MAX                0
139 #define DEFAULT_AUDIO_EFFECT_CUSTOM_EXT_NUM               0
140 #define DEFAULT_USE_SINK_HANDLER                          TRUE
141 #define DEFAULT_SKIP_RESCAN                               TRUE
142 #define DEFAULT_GENERATE_DOT                              FALSE
143 #define DEFAULT_USE_SYSTEM_CLOCK                          TRUE
144 #define DEFAULT_DELAY_BEFORE_REPEAT                       50 /* msec */
145 #define DEFAULT_EOS_DELAY                                 0 /* msec */
146 #define DEFAULT_VIDEOSINK_OVERLAY                         "tizenwlsink"
147 #define DEFAULT_VIDEOSINK_EVAS                            "evasimagesink"
148 #define DEFAULT_VIDEOSINK_FAKE                            "fakesink"
149 #define DEFAULT_AUDIORESAMPLER                            "audioresample"
150 #define DEFAULT_AUDIOSINK                                 "pulsesink"
151 #define DEFAULT_CODEC_HW                                  ""
152 #define DEFAULT_CODEC_SW                                  ""
153 #define DEFAULT_A_OFFLOAD_DEVICE_TYPE                     ""
154 #define DEFAULT_GST_PARAM                                 ""
155 #define DEFAULT_EXCLUDE_KEYWORD                           ""
156 #define DEFAULT_UNSUPPORTED_CODEC_KEYWORD                 ""
157 #define DEFAULT_ASYNC_START                               TRUE
158 #define DEFAULT_DISABLE_SEGTRAP                           TRUE
159 #define DEFAULT_VIDEO_CONVERTER                           ""
160 #define DEFAULT_VIDEO_PLAYBACK_SUPPORTED                  TRUE
161 #define DEFAULT_LIVE_STATE_CHANGE_TIMEOUT                 30 /* sec */
162 #define DEFAULT_LOCALPLAYBACK_STATE_CHANGE_TIMEOUT        10 /* sec */
163 #define DEFAULT_PCM_BUFFER_SIZE                           51200 /* bytes */
164 #define DEFAULT_NUM_OF_VIDEO_BO                           10
165 #define DEFAULT_TIMEOUT_OF_VIDEO_BO                       10 /* sec */
166 #define DEFAULT_AUDIO_OFFLOAD_SINK                        ""
167
168 /* http streaming */
169 #define DEFAULT_HTTPSRC                                   "souphttpsrc"
170 #define DEFAULT_HTTP_RING_BUFFER_SIZE                     (20*1024*1024) /* bytes : 20MBytes */
171 #define DEFAULT_HTTP_TIMEOUT                              -1        /* infinite retry */
172
173 /* dump buffer for debug */
174 #define DEFAULT_DUMP_ELEMENT_KEYWORD                      ""
175 #define DEFAULT_DUMP_ELEMENT_PATH                         "/tmp/"
176
177 /* NOTE : following content should be same with above default values */
178 /* FIXIT : need smarter way to generate default ini file. */
179 /* FIXIT : finally, it should be an external file */
180 #define MM_PLAYER_DEFAULT_INI \
181 "\
182 [general] \n\
183 \n\
184 disable segtrap = yes ; same effect with --gst-disable-segtrap \n\
185 \n\
186 ; set default video sink but, it can be replaced with others selected by application\n\
187 ; 0:v4l2sink, 1:ximagesink, 2:xvimagesink, 3:fakesink 4:evasimagesink 5:glimagesink\n\
188 videosink element = 2 \n\
189 \n\
190 video converter element = \n\
191 \n\
192 audiosink element = pulsesink \n\
193 \n\
194 ; if yes. gstreamer will not update registry \n\
195 skip rescan = yes \n\
196 \n\
197 delay before repeat = 50 ; msec\n\
198 \n\
199 ; comma separated list of tocken which elemnts has it in it's name will not be used \n\
200 element exclude keyword = \n\
201 \n\
202 ; comma separated list of tocken \n\
203 unsupported codec keyword = \n\
204 \n\
205 async start = yes \n\
206 \n\
207 ; parameters for initializing gstreamer \n\
208 gstparam1 = --gst-debug=2\n\
209 gstparam2 = \n\
210 gstparam3 = \n\
211 gstparam4 = \n\
212 gstparam5 = \n\
213 \n\
214 ; generating dot file representing pipeline state \n\
215 ; export GST_DEBUG_DUMP_DOT_DIR=/tmp/\n\
216 generate dot = no \n\
217 \n\
218 ; parameter is for only video to be determined \n\
219 ; which clock will be used \n\
220 ; if yes, system clock will be used \n\
221 ; apart from this, audiosink is clock provider for audio \n\
222 use system clock = yes \n\
223 \n\
224 ; allowed timeout for changing pipeline state \n\
225 live state change timeout = 30 ; sec \n\
226 localplayback state change timeout = 4 ; sec \n\
227 \n\
228 ; delay in msec for sending EOS \n\
229 eos delay = 150 ; msec \n\
230 \n\
231 \n\
232 [http streaming] \n\
233 \n\
234 httppsrc element = souphttpsrc \n\
235 \n\
236 ; if yes, use file for buffering.\n\
237 ; if no, use memory for buffering.\n\
238 http use file buffer = no\n\
239 \n\
240 ; ring buffer size when use mem buffer \n\
241 http ring buffer size = 20971520 ; 20MBytes \n\
242 \n\
243 http buffering limit = 99 ; percent\n\
244 \n\
245 http max size bytes = 1048576 ; bytes\n\
246 \n\
247 http buffering time = 1.2 \n\
248 \n\
249 http timeout = -1 ; infinite retry \n\
250 \n\
251 "
252
253 int
254 mm_player_ini_load(mmplayer_ini_t *ini);
255
256 int
257 mm_player_audio_effect_ini_load(mmplayer_ini_t *ini);
258
259 #ifdef __cplusplus
260         }
261 #endif
262
263 #endif