2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef __TIZEN_MEDIA_VIDEO_UTIL_H__
18 #define __TIZEN_MEDIA_VIDEO_UTIL_H__
20 #include <video_util_type.h>
24 #endif /* __cplusplus */
31 * @addtogroup CAPI_MEDIA_VIDEO_UTIL_MODULE
36 * @deprecated Deprecated since 5.0
37 * @brief Creates a handle to video util.
40 * @details This function creates a handle to video util.
42 * @remarks You must release the @a video util handle using video_util_destroy().\n
43 * http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n
44 * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage.
46 * @param[out] handle A handle to video util
48 * @return @c 0 on success,
49 * otherwise a negative error value
51 * @retval #VIDEO_UTIL_ERROR_NONE Successful
52 * @retval #VIDEO_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
53 * @retval #VIDEO_UTIL_ERROR_OUT_OF_MEMORY Out of memory
54 * @retval #VIDEO_UTIL_ERROR_PERMISSION_DENIED Permission denied
55 * @retval #VIDEO_UTIL_ERROR_NOT_SUPPORTED Not supported
57 * @see video_util_destroy()
60 int video_util_create(video_util_h *handle) TIZEN_DEPRECATED_API;
63 * @deprecated Deprecated since 5.0
64 * @brief Destroys a handle to video util.
67 * @details The function frees all resources related to the video util handle. The video util
68 * handle no longer can be used to perform any operation. A new video util handle
69 * has to be created before the next usage.
71 * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n
72 * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage.\n
74 * @param[in] handle The handle to video util
76 * @return @c 0 on success,
77 * otherwise a negative error value
79 * @retval #VIDEO_UTIL_ERROR_NONE Successful
80 * @retval #VIDEO_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
81 * @retval #VIDEO_UTIL_ERROR_PERMISSION_DENIED Permission denied
82 * @retval #VIDEO_UTIL_ERROR_NOT_SUPPORTED Not supported
84 * @see video_util_create()
87 int video_util_destroy(video_util_h handle) TIZEN_DEPRECATED_API;
90 * @deprecated Deprecated since 5.0
91 * @brief Sets the video util's file path.
94 * @details This function sets the source @a path to transcode.
96 * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n
97 * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage.
99 * @param[in] handle The handle to video util
100 * @param[in] path The source file path
102 * @return @c 0 on success,
103 * otherwise a negative error value
105 * @retval #VIDEO_UTIL_ERROR_NONE Successful
106 * @retval #VIDEO_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
107 * @retval #VIDEO_UTIL_ERROR_OUT_OF_MEMORY Out of memory
108 * @retval #VIDEO_UTIL_ERROR_NOT_SUPPORTED Not supported
110 * @retval #VIDEO_UTIL_ERROR_PERMISSION_DENIED Permission denied
112 * @see video_util_create()
113 * @see video_util_destroy()
115 int video_util_set_file_path(video_util_h handle, const char *path) TIZEN_DEPRECATED_API;
118 * @deprecated Deprecated since 5.0
119 * @brief Sets the video util's accurate mode.
122 * @remarks If you do not set this, the default value is @c false.\n
123 * http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n
124 * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage.
126 * @param[in] handle The handle to video util
127 * @param[in] mode Set @c true if the user can get an accurated frame for given the duration in video_util_start_transcoding(),
128 * otherwise set @c false if user can only get the nearest i-frame
130 * @return @c 0 on success,
131 * otherwise a negative error value
133 * @retval #VIDEO_UTIL_ERROR_NONE Successful
134 * @retval #VIDEO_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
135 * @retval #VIDEO_UTIL_ERROR_PERMISSION_DENIED Permission denied
136 * @retval #VIDEO_UTIL_ERROR_NOT_SUPPORTED Not supported
138 * @see video_util_create()
139 * @see video_util_destroy()
141 int video_util_set_accurate_mode(video_util_h handle, bool mode) TIZEN_DEPRECATED_API;
144 * @deprecated Deprecated since 5.0
145 * @brief Sets the video codec for encoding video stream.
148 * @remarks You can get available list of video codec by using video_util_foreach_supported_video_codec().\n
149 * If you do not set this, the default codec is #VIDEO_UTIL_VIDEO_CODEC_MPEG4.\n
150 * http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n
151 * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage.
153 * @param[in] handle The handle to video util
154 * @param[in] codec The video codec
156 * @return @c 0 on success,
157 * otherwise a negative error value
158 * @retval #VIDEO_UTIL_ERROR_NONE Successful
159 * @retval #VIDEO_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
160 * @retval #VIDEO_UTIL_ERROR_PERMISSION_DENIED Permission denied
161 * @retval #VIDEO_UTIL_ERROR_NOT_SUPPORTED_FORMAT Not supported format
162 * @retval #VIDEO_UTIL_ERROR_NOT_SUPPORTED Not supported
164 * @see video_util_create()
165 * @see video_util_destroy()
166 * @see video_util_foreach_supported_video_codec()
168 int video_util_set_video_codec(video_util_h handle, video_util_video_codec_e codec) TIZEN_DEPRECATED_API;
171 * @deprecated Deprecated since 5.0
172 * @brief Sets the audio codec for encoding audio stream.
175 * @remarks You can get available list of audio codec by using video_util_foreach_supported_audio_codec().\n
176 * If you do not set this, the default codec is #VIDEO_UTIL_AUDIO_CODEC_AAC.\n
177 * http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n
178 * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage.
180 * @param[in] handle The handle to video util
181 * @param[in] codec The audio codec
183 * @return @c 0 on success,
184 * otherwise a negative error value
186 * @retval #VIDEO_UTIL_ERROR_NONE Successful
187 * @retval #VIDEO_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
188 * @retval #VIDEO_UTIL_ERROR_PERMISSION_DENIED Permission denied
189 * @retval #VIDEO_UTIL_ERROR_NOT_SUPPORTED_FORMAT Not supported format
190 * @retval #VIDEO_UTIL_ERROR_NOT_SUPPORTED Not supported
192 * @see video_util_create()
193 * @see video_util_destroy()
194 * @see video_util_foreach_supported_audio_codec()
196 int video_util_set_audio_codec(video_util_h handle, video_util_audio_codec_e codec) TIZEN_DEPRECATED_API;
199 * @deprecated Deprecated since 5.0
200 * @brief Sets the file format for transcoding media stream.
203 * @remarks You can get available list of media formats by using video_util_foreach_supported_file_format().\n
204 * If you do not set this, the default file format is #VIDEO_UTIL_FILE_FORMAT_3GP.\n
205 * http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n
206 * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage.
208 * @param[in] handle The handle to video util
209 * @param[in] format The media file format
211 * @return @c 0 on success,
212 * otherwise a negative error value
214 * @retval #VIDEO_UTIL_ERROR_NONE Successful
215 * @retval #VIDEO_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
216 * @retval #VIDEO_UTIL_ERROR_PERMISSION_DENIED Permission denied
217 * @retval #VIDEO_UTIL_ERROR_NOT_SUPPORTED Not supported
219 * @see video_util_create()
220 * @see video_util_destroy()
221 * @see video_util_foreach_supported_file_format()
223 int video_util_set_file_format(video_util_h handle, video_util_file_format_e format) TIZEN_DEPRECATED_API;
226 * @deprecated Deprecated since 5.0
227 * @brief Sets the resolution(width and height).
230 * @remarks If you do not set, the default resolution is original size.\n
231 * http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n
232 * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage.
234 * @param[in] handle The handle to video util
235 * @param[in] width The media's width \n
236 * If the width is 0, it set original size.(minimum value is 128)
237 * @param[in] height The media's height \n
238 * If the height is 0, it set original size.(minimum value is 96)
240 * @return @c 0 on success,
241 * otherwise a negative error value
243 * @retval #VIDEO_UTIL_ERROR_NONE Successful
244 * @retval #VIDEO_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
245 * @retval #VIDEO_UTIL_ERROR_PERMISSION_DENIED Permission denied
246 * @retval #VIDEO_UTIL_ERROR_NOT_SUPPORTED Not supported
248 * @see video_util_create()
249 * @see video_util_destroy()
251 int video_util_set_resolution(video_util_h handle, int width, int height) TIZEN_DEPRECATED_API;
254 * @deprecated Deprecated since 5.0
255 * @brief Sets the frame rate.
258 * @remarks If fps is set @c 0, the default is original fps from source.\n
259 * http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n
260 * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage.
262 * @param[in] handle The handle to video util
264 * @param[in] fps The frame rate(minimum value is 5, maximum value is 30)
265 * @return @c 0 on success,
266 * otherwise a negative error value
268 * @retval #VIDEO_UTIL_ERROR_NONE Successful
269 * @retval #VIDEO_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
270 * @retval #VIDEO_UTIL_ERROR_PERMISSION_DENIED Permission denied
271 * @retval #VIDEO_UTIL_ERROR_NOT_SUPPORTED Not supported
273 * @see video_util_create()
274 * @see video_util_destroy()
276 int video_util_set_fps(video_util_h handle, int fps) TIZEN_DEPRECATED_API;
279 * @deprecated Deprecated since 5.0
280 * @brief Transcodes the video for given video util handle.
283 * @details This function starts the transcoding from start time and for given duration.\n
284 * #video_util_transcoding_progress_cb() function is called during the video transcoding regularly after some interval.\n
285 * #video_util_transcoding_completed_cb() function is called and the transcoded video will be saved at the given output path when transcoding is finished.
287 * @remarks If there already exists same file in file system, then old file will be overwritten.\n
288 * http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n
289 * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage.
291 * @param[in] handle The handle to video util
292 * @param[in] start The start position to transcode
293 * @param[in] duration The duration in seconds \n
294 * if duration is @c 0, transcoding happens until end of the video.
295 * @param[out] out_path The file path to save
296 * @param[in] progress_cb The callback function to be invoked
297 * @param[in] completed_cb The callback function to be invoked
298 * @param[in] user_data The user data to be passed to the callback function
300 * @return @c 0 on success,
301 * otherwise a negative error value
303 * @retval #VIDEO_UTIL_ERROR_NONE Successful
304 * @retval #VIDEO_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
305 * @retval #VIDEO_UTIL_ERROR_INVALID_OPERATION Invalid operation
306 * @retval #VIDEO_UTIL_ERROR_PERMISSION_DENIED Permission denied
307 * @retval #VIDEO_UTIL_ERROR_NOT_SUPPORTED Not supported
309 * @see video_util_create()
310 * @see video_util_destroy()
311 * @see video_util_transcoding_progress_cb()
312 * @see video_util_transcoding_completed_cb()
313 * @see video_util_get_progress_transcoding()
314 * @see video_util_cancel_transcoding()
316 int video_util_start_transcoding(video_util_h handle, unsigned long start,
317 unsigned long duration, const char *out_path,
318 video_util_transcoding_progress_cb progress_cb,
319 video_util_transcoding_completed_cb completed_cb,
320 void *user_data) TIZEN_DEPRECATED_API;
323 * @deprecated Deprecated since 5.0
324 * @brief Cancels transcoding the video for given video util handle.
327 * @details This function cancels the transcoding for given video util handle.\n.
329 * @remarks If this function is invoked during transcoding, the data transcoded is discard.\n
330 * http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n
331 * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage.
333 * @param[in] handle The handle to video util
335 * @return @c 0 on success,
336 * otherwise a negative error value
338 * @retval #VIDEO_UTIL_ERROR_NONE Successful
339 * @retval #VIDEO_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
340 * @retval #VIDEO_UTIL_ERROR_INVALID_OPERATION Invalid operation
341 * @retval #VIDEO_UTIL_ERROR_PERMISSION_DENIED Permission denied
342 * @retval #VIDEO_UTIL_ERROR_NOT_SUPPORTED Not supported
344 * @see video_util_create()
345 * @see video_util_destroy()
346 * @see video_util_start_transcoding()
348 int video_util_cancel_transcoding(video_util_h handle) TIZEN_DEPRECATED_API;
351 * @deprecated Deprecated since 5.0
352 * @brief Retrieves the current position and duration of the video transcoding.
356 * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n
357 * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage.\n
359 * @param[in] handle The handle to video util
360 * @param[out] current_position Current position of transcoding
361 * @param[out] duration The duration is in seconds.\n
362 If duration is 0, transcoding happens until end of the video
364 * @return @c 0 on success,
365 * otherwise a negative error value
366 * @retval #VIDEO_UTIL_ERROR_NONE Successful
367 * @retval #VIDEO_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
368 * @retval #VIDEO_UTIL_ERROR_PERMISSION_DENIED Permission denied
369 * @retval #VIDEO_UTIL_ERROR_NOT_SUPPORTED Not supported
371 * @pre video_util_start_transcoding().
373 * @see video_util_create()
374 * @see video_util_destroy()
376 int video_util_get_progress_transcoding(video_util_h handle,
377 unsigned long *current_position,
378 unsigned long *duration) TIZEN_DEPRECATED_API;
381 * @deprecated Deprecated since 5.0
382 * @brief Retrieves all supported media formats by invoking a specific callback for each supported media format.
385 * @remarks The callback invocation depends on the codec.\n
386 * http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n
387 * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage.\n
389 * @param[in] handle The handle to video util
390 * @param[in] callback The callback function to invoke
391 * @param[in] user_data The user data to be passed to the callback function
393 * @return @c 0 on success,
394 * otherwise a negative error value
396 * @retval #VIDEO_UTIL_ERROR_NONE Successful
397 * @retval #VIDEO_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
398 * @retval #VIDEO_UTIL_ERROR_PERMISSION_DENIED Permission denied
399 * @retval #VIDEO_UTIL_ERROR_NOT_SUPPORTED_FORMAT Not supported format
400 * @retval #VIDEO_UTIL_ERROR_NOT_SUPPORTED Not supported
401 * @post video_util_supported_file_format_cb() will be invoked.
403 * @see video_util_set_file_format()
404 * @see video_util_supported_file_format_cb()
406 int video_util_foreach_supported_file_format(video_util_h handle,
407 video_util_supported_file_format_cb callback,
408 void *user_data) TIZEN_DEPRECATED_API;
411 * @deprecated Deprecated since 5.0
412 * @brief Retrieves all supported video encoders by invoking a specific callback for each supported video encoder.
415 * @remarks The callback invocation depends on the file format.\n
416 * http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n
417 * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage.\n
419 * @param[in] handle The handle to video util
420 * @param[in] callback The callback function to be invoked
421 * @param[in] user_data The user data to be passed to the callback function
423 * @return @c 0 on success,
424 * otherwise a negative error value
426 * @retval #VIDEO_UTIL_ERROR_NONE Successful
427 * @retval #VIDEO_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
428 * @retval #VIDEO_UTIL_ERROR_PERMISSION_DENIED Permission denied
429 * @retval #VIDEO_UTIL_ERROR_NOT_SUPPORTED_FORMAT Not supported format
430 * @retval #VIDEO_UTIL_ERROR_NOT_SUPPORTED Not supported
431 * @post video_util_supported_video_encoder_cb() will be invoked.
432 * @see video_util_set_video_codec()
433 * @see video_util_supported_video_encoder_cb()
435 int video_util_foreach_supported_video_codec(video_util_h handle,
436 video_util_supported_video_encoder_cb callback,
437 void *user_data) TIZEN_DEPRECATED_API;
440 * @deprecated Deprecated since 5.0
441 * @brief Retrieves all supported audio encoders by invoking a specific callback for each supported audio encoder.
444 * @remarks The callback invocation depends on the file format.\n
445 * http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage.\n
446 * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage.\n
448 * @param[in] handle The handle to video util
449 * @param[in] callback The callback function to be invoked
450 * @param[in] user_data The user data to be passed to the callback function
452 * @return @c 0 on success,
453 * otherwise a negative error value
455 * @retval #VIDEO_UTIL_ERROR_NONE Successful
456 * @retval #VIDEO_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
457 * @retval #VIDEO_UTIL_ERROR_PERMISSION_DENIED Permission denied
458 * @retval #VIDEO_UTIL_ERROR_NOT_SUPPORTED_FORMAT Not supported format
459 * @retval #VIDEO_UTIL_ERROR_NOT_SUPPORTED Not supported
460 * @post video_util_supported_audio_encoder_cb() will be invoked.
461 * @see video_util_supported_audio_encoder_cb()
463 int video_util_foreach_supported_audio_codec(video_util_h handle,
464 video_util_supported_audio_encoder_cb callback,
465 void *user_data) TIZEN_DEPRECATED_API;
473 #endif /* __cplusplus */
475 #endif /* __TIZEN_MEDIA_VIDEO_UTIL_H__ */