[0.6.184] change mute type
[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  * Enumerations of video colorspace
34  */
35 typedef enum {
36         MM_PLAYER_COLORSPACE_I420 = 0,                  /**< I420 format - planer */
37         MM_PLAYER_COLORSPACE_RGB888,                    /**< RGB888 pixel format */
38         MM_PLAYER_COLORSPACE_NV12_TILED,                /**< Customized color format */
39         MM_PLAYER_COLORSPACE_NV12,
40         MM_PLAYER_COLORSPACE_BGRx,                              /**< BGRx pixel format */
41         MM_PLAYER_COLORSPACE_MAX = 0x7FFFFFFF
42 } mmplayer_video_color_space_e;
43
44 typedef struct {
45         unsigned char *data;                                    /* capture image buffer */
46         int size;                                                               /* capture image size */
47         mmplayer_video_color_space_e fmt;                       /* color space type */
48         unsigned int width;                                             /* width of captured image */
49         unsigned int height;                                    /* height of captured image */
50         unsigned int orientation;                               /* content orientation */
51 } mmplayer_video_capture_t;
52
53 typedef struct {
54         void *data;
55         int data_size;
56         int channel;
57         int bitrate;
58         int depth;
59         bool is_little_endian;
60         guint64 channel_mask;
61 } mmplayer_audio_decoded_data_info_t;
62
63 /**
64  * Video decoded callback function type.
65  *
66  * @param       stream          [in]    Reference pointer to video frame data
67  * @param       stream_size     [in]    Size of video frame data
68  * @param       user_param      [in]    User defined parameter which is passed when set
69  *                                                              video stream callback
70  * @param       width           [in]    width of video frame
71  * @param       height          [in]    height of video frame
72  *
73  * @return      This callback function have to return MM_ERROR_NONE.
74  */
75 typedef bool (*mm_player_video_decoded_callback)(void *stream, void *user_param);
76
77 /**
78  * Audio stream callback function type.
79  *
80  * @param       stream          [in]    Reference pointer to audio frame data
81  * @param       stream_size     [in]    Size of audio frame data
82  * @param       user_param      [in]    User defined parameter which is passed when set
83  *                                                              audio stream callback
84  *
85  * @return      This callback function have to return MM_ERROR_NONE.
86  */
87 typedef bool (*mm_player_video_capture_callback)(void *stream, int stream_size, void *user_param);
88
89 /**
90  * Video frame render error callback function type.
91  *
92  * @param       error_id        [in]    cause of error
93  * @param       user_param      [in]    User defined parameter which is passed when set
94  *                                                              video frame render error callback
95  *
96  * @return      This callback function have to return MM_ERROR_NONE.
97  */
98 typedef bool (*mm_player_video_frame_render_error_callback)(void *error_id, void *user_param);
99
100 /**
101  * Audio stream callback function type.
102  *
103  * @param       stream          [in]    Reference pointer to audio frame data
104  * @param       user_param      [in]    User defined parameter which is passed when set
105  *                                                              audio stream callback
106  *
107  * @return      This callback function have to return MM_ERROR_NONE.
108  */
109 typedef bool (*mm_player_audio_decoded_callback)(mmplayer_audio_decoded_data_info_t *stream, void *user_param);
110 /**
111  * This function is to set play speed for playback.
112  *
113  * @param       player          [in]    Handle of player.
114  * @param       ratio           [in]    Speed for playback.
115  * @param       streaming       [in]    If @c true, rate value can be set even if it is streaming playback.
116  * @return      This function returns zero on success, or negative value with error
117  *                      code
118  * @remark      The current supported range is from -64x to 64x.
119  *              But, the quailty is dependent on codec performance.
120  *              And, the sound is muted under normal speed and more than double speed.
121  * @see
122  * @since
123  */
124 int mm_player_set_play_speed(MMHandleType player, float rate, bool streaming);
125
126 /**
127  * This function set callback function for receiving video stream from player.
128  *
129  * @param       player          [in]    Handle of player.
130  * @param       callback        [in]    Video stream callback function.
131  * @param       user_param      [in]    User parameter.
132  *
133  * @return      This function returns zero on success, or negative value with error
134  *                      code.
135  * @remark
136  * @since
137  */
138 int mm_player_set_video_decoded_callback(MMHandleType player, mm_player_video_decoded_callback callback, void *user_param);
139
140 /**
141  * This function set callback function for receiving audio stream from player.
142  *
143  * @param       player          [in]    Handle of player.
144  * @param       opt             [in]    audio extract option.
145  * @param       callback        [in]    audio stream callback function.
146  * @param       user_param      [in]    User parameter.
147  *
148  * @return      This function returns zero on success, or negative value with error
149  *                      code.
150  * @remark
151  * @see         mm_player_audio_decoded_callback
152  * @since
153  */
154 int mm_player_set_audio_decoded_callback(MMHandleType player, mmplayer_audio_extract_opt_e opt, mm_player_audio_decoded_callback callback, void *user_param);
155
156 /**
157  * This function is to capture video frame.
158  *
159  * @param       player          [in]    Handle of player.
160  *
161  * @return      This function returns zero on success, or negative value with error
162  *                      code.
163  *
164  * @remark      Captured buffer is sent asynchronously through message callback with MM_MESSAGE_VIDEO_CAPTURED.
165  *                      And, application should free the captured buffer directly.
166  * @see         MM_MESSAGE_VIDEO_CAPTURED
167  * @since
168  */
169 int mm_player_do_video_capture(MMHandleType player);
170
171 /**
172  * This function changes the previous videosink plugin for a new one
173  *
174  * @param       player                  [in]    Handle of player.
175  * @param       display_surface_type    [in]    display surface type to set
176  * @param       display_overlay                 [in]    display overlay to set
177  *
178  * @return      This function returns zero on success, or negative value with error
179  *                      code.
180  * @remark
181  * @see
182  * @since
183  */
184 int mm_player_change_videosink(MMHandleType player, MMDisplaySurfaceType display_surface_type, void *display_overlay);
185
186 /**
187         @}
188  */
189
190 #ifdef __cplusplus
191         }
192 #endif
193
194 #endif  /* __MM_PLAYER_INTERNAL_H__ */