a4002c63cffc57f1db68b6098af70f5c7f99c0d8
[platform/core/multimedia/libmm-transcode.git] / transcode / include / mm_transcode.h
1 /*
2  * libmm-transcode
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: YoungHun Kim <yh8004.kim@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21
22 #ifndef __MM_TRANSCODE_H__
23 #define __MM_TRANSCODE_H__
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29 #include <mm_types.h>
30 typedef bool (*mm_transcode_completed_callback)(int error, void *user_parm);
31 typedef bool (*mm_transcode_progress_callback)(unsigned long current_position, unsigned long real_duration, void *user_parm);
32 typedef bool (*mm_transcode_support_type_callback)(int encoder_type, void *user_parm);
33
34
35 /**
36  * Video Container Formats
37  */
38 typedef enum {
39         /* 3gp */
40         MM_CONTAINER_3GP = 0x00,
41         MM_CONTAINER_MP4,
42         MM_CONTAINER_NUM,
43 } mm_containerformat_e;
44
45 /**
46  * Video Encoder
47  */
48 typedef enum {
49         MM_VIDEOENCODER_MPEG4 = 0x00,
50         MM_VIDEOENCODER_H263,
51         MM_VIDEOENCODER_H264,
52         MM_VIDEOENCODER_NO_USE,
53         MM_VIDEOENCODER_NUM,
54 } mm_videoencoder_e;
55
56 /**
57  * Audio Encorder
58  */
59 typedef enum {
60         MM_AUDIOENCODER_AAC = 0x00,
61         MM_AUDIOENCODER_AMR,
62         MM_AUDIOENCODER_NO_USE,
63         MM_AUDIOENCODER_NUM,
64 } mm_audioencoder_e;
65
66 /**
67  * Video Seek Mode
68  */
69 typedef enum {
70         /* 3GP */
71         MM_SEEK_INACCURATE = 0x00,
72         MM_SEEK_ACCURATE,
73         MM_SEEK_NUM,
74 } mm_seek_mode_e;
75
76
77 /**
78  *
79  * @remark      Transcode Handle Creation
80  *
81  * @param       MMHandle                [in]                    MMHandleType pointer
82
83  * @return      This function returns transcode processor result value
84  *              if the result is 0, then handle creation succeed
85  *              else if the result is -1, then handle creation failed
86  */
87 int
88 mm_transcode_create(MMHandleType* MMHandle);
89
90
91
92
93 /**
94  *
95  * @remark      Video Transcode Pipeline
96  *
97  * @param       MMHandle                                                [in]                    MMHandleType
98  * @param       in_Filename                                             [in]                    Input Video File pointer
99  * @param       containerformat                                 [in]                    Container format (3GP/MP4)
100  * @param       videoencoder                                            [in]                    Videoencoder (avenc_h263p/avenc_mpeg4/savsenc_mp4/savsenc_h264)
101  * @param       audioencoder                                            [in]                    Audioencoder (amr/aac)
102
103  * @return      This function returns transcode processor result value
104  *              if the result is 0, then you can use output_Filename pointer(char** value)
105  *              else if the result is -1, then do not execute when the colopsapce converter is not supported
106  */
107 int
108 mm_transcode_prepare(MMHandleType MMHandle, const char *in_Filename, mm_containerformat_e containerformat,
109         mm_videoencoder_e videoencoder, mm_audioencoder_e audioencoder);
110
111
112
113
114 /**
115  *
116  * @remark      Video Transcode Pipeline
117  *
118  * @param       MMHandle                                                [in]                    MMHandleType
119  * @param       resolution_width                                        [in]                    Video Resolution Width
120  * @param       resolution_height                                       [in]                    Video Resolution Height
121  * @param       fps_value                                                       [in]                    Video Framerate
122  * @param       start_position                                          [in]                    Start Position (msec)
123  * @param       duration                                                        [in]                    Seek Duration (msec, If the value is 0, you transcode the original file totally)
124  * @param       seek_mode                                               [in]                    Seek Mode (Accurate / Inaccurate)
125  * @param       out_Filename                                            [in]                    Output Video File pointer
126  * @param       progress_callback                                       [in]                    Progress_callback
127  * @param       completed_callback                              [in]                    Completed_callback
128  * @param       user_param                                              [in]                    User parameter which is received from user when callback function was set
129
130
131  * @return      This function returns transcode processor result value
132  *              if the result is 0, then you can use output_Filename pointer(char** value)
133  *              else if the result is -1, then do not execute when the colopsapce converter is not supported
134  */
135 int
136 mm_transcode(MMHandleType MMHandle, unsigned int resolution_width, unsigned int resolution_height, unsigned int fps_value, unsigned long start_position, unsigned long duration,
137         mm_seek_mode_e seek_mode, const char *out_Filename, mm_transcode_progress_callback progress_callback, mm_transcode_completed_callback completed_callback, void *user_param);
138
139
140
141
142 /**
143  *
144  * @remark      Video Transcode Pipeline
145  *
146  * @param       MMHandle                                                [in]                    MMHandleType
147  * @param       is_busy                                                 [in/out]                If transcode is executing or not
148
149  * @return      This function returns transcode processor result value
150  *              if the result is 0, then it means that trascode is executing now
151  *              else if the result is -1, then you can call mm_transcode_prepare for new input file
152  */
153 int
154 mm_transcode_is_busy(MMHandleType MMHandle, bool *is_busy);
155
156
157
158
159 /**
160  *
161  * @remark      Transcode Handle Cancel
162  *
163  * @param       MMHandle                [in]                    MMHandleType
164
165  * @return      This function returns transcode processor result value
166  *              if the result is 0, then handle destory succeed
167  *              else if the result is -1, then handle destory failed
168  */
169 int
170 mm_transcode_cancel(MMHandleType MMHandle);
171
172
173
174
175 /**
176  *
177  * @remark      Transcode Handle Destory
178  *
179  * @param       MMHandle                [in]                    MMHandleType
180
181  * @return      This function returns transcode processor result value
182  *              if the result is 0, then handle destory succeed
183  *              else if the result is -1, then handle destory failed
184  */
185 int
186 mm_transcode_destroy(MMHandleType MMHandle);
187
188
189
190
191 /**
192  *
193  * @remark      Transcode Handle Destory
194  *
195  * @param       MMHandle                [in]                            MMHandleType
196  * @param»     containerformat [in/out]                        Container format
197  * @param»     videoencoder»  [in/out]                        Videoencoder
198  * @param»     audioencoder»  [in/out]                        Audioencoder
199  * @param»     current_pos             [in/out]»                      Current Position
200  * @param»     duration                        [in/out]                        Duration
201  * @param»     resolution_width»      [in/out]                        Real Resolution Width
202  * @param»     resolution_height       [in/out]                        Real Resolution Height
203
204  * @return      This function returns transcode processor result value
205  *              if the result is 0, then transcode get attribute succeed
206  *              else if the result is -1, then transcode get attribute failed
207  */
208 int
209 mm_transcode_get_attrs(MMHandleType MMHandle, mm_containerformat_e *containerformat, mm_videoencoder_e *videoencoder,
210         mm_audioencoder_e *audioencoder, unsigned long *current_pos, unsigned long *duration, unsigned int *resolution_width, unsigned int *resolution_height);
211
212 int
213 mm_transcode_get_supported_container_format(mm_transcode_support_type_callback type_callback, void *user_param);
214
215 int
216 mm_transcode_get_supported_video_encoder(mm_transcode_support_type_callback type_callback, void *user_param);
217
218 int
219 mm_transcode_get_supported_audio_encoder(mm_transcode_support_type_callback type_callback, void *user_param);
220
221 #ifdef __cplusplus__
222 };
223 #endif
224
225 #endif  /*__MM_TRANSCODE_H__*/