Supported S420 for capturing video
[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         MM_PLAYER_COLORSPACE_MAX = 0x7FFFFFFF
104 } MMPlayerVideoColorspace;
105
106 typedef struct {
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         void *data;
117         int data_size;
118         int channel;
119         int bitrate;
120         int depth;
121         bool is_little_endian;
122         guint64 channel_mask;
123 } MMPlayerAudioStreamDataType;
124
125 /**
126  * Video stream callback function type.
127  *
128  * @param       stream          [in]    Reference pointer to video frame data
129  * @param       stream_size     [in]    Size of video frame data
130  * @param       user_param      [in]    User defined parameter which is passed when set
131  *                                                              video stream callback
132  * @param       width           [in]    width of video frame
133  * @param       height          [in]    height of video frame
134  *
135  * @return      This callback function have to return MM_ERROR_NONE.
136  */
137 typedef bool    (*mm_player_video_stream_callback) (void *stream, void *user_param);
138
139 /**
140  * Audio stream callback function type.
141  *
142  * @param       stream          [in]    Reference pointer to audio frame data
143  * @param       stream_size     [in]    Size of audio frame data
144  * @param       user_param      [in]    User defined parameter which is passed when set
145  *                                                              audio stream callback
146  *
147  * @return      This callback function have to return MM_ERROR_NONE.
148  */
149 typedef bool    (*mm_player_video_capture_callback) (void *stream, int stream_size, void *user_param);
150
151 /**
152  * Video frame render error callback function type.
153  *
154  * @param       error_id        [in]    cause of error
155  * @param       user_param      [in]    User defined parameter which is passed when set
156  *                                                              video frame render error callback
157  *
158  * @return      This callback function have to return MM_ERROR_NONE.
159  */
160 typedef bool    (*mm_player_video_frame_render_error_callback) (void *error_id, void *user_param);
161
162 /**
163  * Audio stream callback function type.
164  *
165  * @param       stream          [in]    Reference pointer to audio frame data
166  * @param       user_param      [in]    User defined parameter which is passed when set
167  *                                                              audio stream callback
168  *
169  * @return      This callback function have to return MM_ERROR_NONE.
170  */
171 typedef bool    (*mm_player_audio_stream_callback_ex) (MMPlayerAudioStreamDataType *stream, void *user_param);
172 /**
173  * This function is to set play speed for playback.
174  *
175  * @param       player          [in]    Handle of player.
176  * @param       ratio           [in]    Speed for playback.
177  * @param       streaming       [in]    If @c true, rate value can be set even if it is streaming playback.
178  * @return      This function returns zero on success, or negative value with error
179  *                      code
180  * @remark      The current supported range is from -64x to 64x.
181  *              But, the quailty is dependent on codec performance.
182  *              And, the sound is muted under normal speed and more than double speed.
183  * @see
184  * @since
185  */
186 int mm_player_set_play_speed(MMHandleType player, float rate, bool streaming);
187
188 /**
189  * This function set callback function for receiving video stream from player.
190  *
191  * @param       player          [in]    Handle of player.
192  * @param       callback        [in]    Video stream callback function.
193  * @param       user_param      [in]    User parameter.
194  *
195  * @return      This function returns zero on success, or negative value with error
196  *                      code.
197  * @remark
198  * @see         mm_player_video_stream_callback mm_player_set_audio_stream_callback
199  * @since
200  */
201 int mm_player_set_video_stream_callback(MMHandleType player, mm_player_video_stream_callback callback, void *user_param);
202
203 /**
204  * This function set callback function for receiving audio stream from player.
205  *
206  * @param       player          [in]    Handle of player.
207  * @param       sync            [in]    sync Sync on the clock.
208  * @param       callback                [in]    audio stream callback function.
209  * @param       user_param      [in]    User parameter.
210  *
211  * @return      This function returns zero on success, or negative value with error
212  *                      code.
213  * @remark
214  * @see         mm_player_audio_stream_callback_ex
215  * @since
216  */
217 int mm_player_set_audio_stream_callback_ex(MMHandleType player, bool sync, mm_player_audio_stream_callback_ex callback, void *user_param);
218
219 /**
220  * This function is to capture video frame.
221  *
222  * @param       player          [in]    Handle of player.
223  *
224  * @return      This function returns zero on success, or negative value with error
225  *                      code.
226  *
227  * @remark      Captured buffer is sent asynchronously through message callback with MM_MESSAGE_VIDEO_CAPTURED.
228  *                      And, application should free the captured buffer directly.
229  * @see         MM_MESSAGE_VIDEO_CAPTURED
230  * @since
231  */
232 int mm_player_do_video_capture(MMHandleType player);
233
234 /**
235  * This function changes the previous videosink plugin for a new one
236  *
237  * @param       player                  [in]    Handle of player.
238  * @param       display_surface_type    [in]    display surface type to set
239  * @param       display_overlay                 [in]    display overlay to set
240  *
241  * @return      This function returns zero on success, or negative value with error
242  *                      code.
243  * @remark
244  * @see
245  * @since
246  */
247 int mm_player_change_videosink(MMHandleType player, MMDisplaySurfaceType display_surface_type, void *display_overlay);
248
249 /**
250  * This function is to set pcm spec.
251  *
252  * @param       player          [in]    Handle of player.
253  * @param       samplerate      [in]    Samplerate.
254  * @param       channel         [in]    Channel.
255  *
256  * @return      This function returns zero on success, or negative value with error
257  * @see
258  * @since
259  */
260 int mm_player_set_pcm_spec(MMHandleType player, int samplerate, int channel);
261
262 /**
263         @}
264  */
265
266 #ifdef __cplusplus
267         }
268 #endif
269
270 #endif  /* __MM_PLAYER_INTERNAL_H__ */