to resolve the Prevent issues
[platform/core/multimedia/libmm-player.git] / src / include / mm_player_internal.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_INTERNAL_H__
24 #define __MM_PLAYER_INTERNAL_H__
25
26 #include <mm_types.h>
27
28 #ifdef __cplusplus
29         extern "C" {
30 #endif
31
32 /**
33         @addtogroup PLAYER-INTERNAL
34         @{
35
36         @par
37         <div><table>
38         <tr>
39         <td>PROPERTY</td>
40         <td>TYPE</td>
41         <td>VALID TYPE</td>
42         <td>DEFAULT VALUE</td>
43         </tr>
44         <tr>
45         <td>"display_roi_x"</td>
46         <td>int</td>
47         <td>range</td>
48         <td>0</td>
49         </tr>
50         <tr>
51         <td>"display_roi_y"</td>
52         <td>int</td>
53         <td>range</td>
54         <td>0</td>
55         </tr>
56         <tr>
57         <td>"display_roi_width"</td>
58         <td>int</td>
59         <td>range</td>
60         <td>640</td>
61         </tr>
62         <tr>
63         <td>"display_roi_height"</td>
64         <td>int</td>
65         <td>range</td>
66         <td>480</td>
67         </tr>
68         <tr>
69         <td>"display_method"</td>
70         <td>int</td>
71         <td>range</td>
72         <td>MM_DISPLAY_METHOD_LETTER_BOX</td>
73         </tr>
74         <tr>
75         <td>"sound_volume_type"</td>
76         <td>int</td>
77         <td>range</td>
78         <td>MM_SOUND_VOLUME_TYPE_CALL</td>
79         </tr>
80         <tr>
81         <td>"sound_route"</td>
82         <td>int</td>
83         <td>range</td>
84         <td>MM_AUDIOROUTE_USE_EXTERNAL_SETTING</td>
85         </tr>
86         <tr>
87         <td>"sound_stop_when_unplugged"</td>
88         <td>int</td>
89         <td>range</td>
90         </tr>
91         </table></div>
92
93 */
94
95 /*
96  * Enumerations of video colorspace
97  */
98 typedef enum {
99     MM_PLAYER_COLORSPACE_I420 = 0,              /**< I420 format - planer */
100     MM_PLAYER_COLORSPACE_RGB888,                        /**< RGB888 pixel format */
101     MM_PLAYER_COLORSPACE_NV12_TILED,            /**< Customized color format */
102     MM_PLAYER_COLORSPACE_NV12,
103 }MMPlayerVideoColorspace;
104
105 typedef struct
106 {
107         unsigned char *data;                                    /* capture image buffer */
108         int size;                                                               /* capture image size */
109         MMPlayerVideoColorspace fmt;                    /* color space type */
110         unsigned int width;                                             /* width of captured image */
111         unsigned int height;                                    /* height of captured image */
112         unsigned int orientation;                               /* content orientation */
113 }MMPlayerVideoCapture;
114
115 typedef struct
116 {
117         void *data;
118         int data_size;
119         int channel;
120         int bitrate;
121         int depth;
122         bool is_little_endian;
123         guint64 channel_mask;
124 }MMPlayerAudioStreamDataType;
125
126 /**
127  * Video stream callback function type.
128  *
129  * @param       stream          [in]    Reference pointer to video frame data
130  * @param       stream_size     [in]    Size of video frame data
131  * @param       user_param      [in]    User defined parameter which is passed when set
132  *                                                              video stream callback
133  * @param       width           [in]    width of video frame
134  * @param       height          [in]    height of video frame
135  *
136  * @return      This callback function have to return MM_ERROR_NONE.
137  */
138 typedef bool    (*mm_player_video_stream_callback) (void *stream, void *user_param);
139
140 /**
141  * Audio stream callback function type.
142  *
143  * @param       stream          [in]    Reference pointer to audio frame data
144  * @param       stream_size     [in]    Size of audio frame data
145  * @param       user_param      [in]    User defined parameter which is passed when set
146  *                                                              audio stream callback
147  *
148  * @return      This callback function have to return MM_ERROR_NONE.
149  */
150 typedef bool    (*mm_player_video_capture_callback) (void *stream, int stream_size, void *user_param);
151
152 /**
153  * Video frame render error callback function type.
154  *
155  * @param       error_id        [in]    cause of error
156  * @param       user_param      [in]    User defined parameter which is passed when set
157  *                                                              video frame render error callback
158  *
159  * @return      This callback function have to return MM_ERROR_NONE.
160  */
161 typedef bool    (*mm_player_video_frame_render_error_callback) (void *error_id, void *user_param);
162
163 /**
164  * Audio stream callback function type.
165  *
166  * @param       stream          [in]    Reference pointer to audio frame data
167  * @param       user_param      [in]    User defined parameter which is passed when set
168  *                                                              audio stream callback
169  *
170  * @return      This callback function have to return MM_ERROR_NONE.
171  */
172 typedef bool    (*mm_player_audio_stream_callback_ex) (MMPlayerAudioStreamDataType *stream, void *user_param);
173 /**
174  * This function is to set play speed for playback.
175  *
176  * @param       player          [in]    Handle of player.
177  * @param       ratio           [in]    Speed for playback.
178  *
179  * @return      This function returns zero on success, or negative value with error
180  *                      code
181  * @remark      The current supported range is from -64x to 64x.
182  *              But, the quailty is dependent on codec performance.
183  *              And, the sound is muted under normal speed and more than double speed.
184  * @see
185  * @since
186  */
187 int mm_player_set_play_speed(MMHandleType player, float rate);
188
189 /**
190  * This function set callback function for receiving video stream from player.
191  *
192  * @param       player          [in]    Handle of player.
193  * @param       callback        [in]    Video stream callback function.
194  * @param       user_param      [in]    User parameter.
195  *
196  * @return      This function returns zero on success, or negative value with error
197  *                      code.
198  * @remark
199  * @see         mm_player_video_stream_callback mm_player_set_audio_stream_callback
200  * @since
201  */
202 int mm_player_set_video_stream_callback(MMHandleType player, mm_player_video_stream_callback callback, void *user_param);
203
204 /**
205  * This function set callback function for receiving audio stream from player.
206  *
207  * @param       player          [in]    Handle of player.
208  * @param       sync            [in]    sync Sync on the clock.
209  * @param       callback                [in]    audio stream callback function.
210  * @param       user_param      [in]    User parameter.
211  *
212  * @return      This function returns zero on success, or negative value with error
213  *                      code.
214  * @remark
215  * @see         mm_player_audio_stream_callback_ex
216  * @since
217  */
218 int mm_player_set_audio_stream_callback_ex(MMHandleType player, bool sync, mm_player_audio_stream_callback_ex callback, void *user_param);
219
220 /**
221  * This function set callback function for rendering error information of video render plug-in.
222  *
223  * @param       player          [in]    Handle of player.
224  * @param       callback                [in]    Frame render error callback function.
225  * @param       user_param      [in]    User parameter which is passed to callback function.
226  *
227  * @return      This function returns zero on success, or negative value with error code.
228  * @see
229  * @remark      None
230  * @par Example
231  * @code
232  * @endcode
233  */
234 int mm_player_set_video_frame_render_error_callback(MMHandleType player, mm_player_video_frame_render_error_callback callback, void *user_param);
235
236 /**
237  * This function is to capture video frame.
238  *
239  * @param       player          [in]    Handle of player.
240  *
241  * @return      This function returns zero on success, or negative value with error
242  *                      code.
243  *
244  * @remark      Captured buffer is sent asynchronously through message callback with MM_MESSAGE_VIDEO_CAPTURED.
245  *                      And, application should free the captured buffer directly.
246  * @see         MM_MESSAGE_VIDEO_CAPTURED
247  * @since
248  */
249 int mm_player_do_video_capture(MMHandleType player);
250
251 /**
252  * This function set callback function for putting data into player.
253  *
254  * @param       player          [in]    Handle of player.
255  * @param       buf                     [in]    data to push into player
256  * @param       size                    [in]    buffer size to push
257  *
258  * @return      This function returns zero on success, or negative value with error
259  *                      code.
260  * @remark
261  * @see
262  * @since
263  */
264 int mm_player_push_buffer(MMHandleType player, unsigned char *buf, int size);
265
266 /**
267  * This function changes the previous videosink plugin for a new one
268  *
269  * @param       player                  [in]    Handle of player.
270  * @param       display_surface_type    [in]    display surface type to set
271  * @param       display_overlay                 [in]    display overlay to set
272  *
273  * @return      This function returns zero on success, or negative value with error
274  *                      code.
275  * @remark
276  * @see
277  * @since
278  */
279 int mm_player_change_videosink(MMHandleType player, MMDisplaySurfaceType display_surface_type, void *display_overlay);
280
281 /**
282         @}
283  */
284
285 #ifdef __cplusplus
286         }
287 #endif
288
289 #endif  /* __MM_PLAYER_INTERNAL_H__ */