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