3ee1c8cc4ddb27a1d10f484b8d6a39c35c939465
[platform/core/api/video-util.git] / include / video_util_type.h
1 /*
2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3 *
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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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.
15 */
16
17 #ifndef __TIZEN_MEDIA_VIDEO_UTIL_TYPE_H__
18 #define __TIZEN_MEDIA_VIDEO_UTIL_TYPE_H__
19
20 #include <tizen.h>
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif /* __cplusplus */
25
26 #ifndef DEPRECATED_API
27 #define DEPRECATED_API __attribute__ ((deprecated))
28 #endif
29
30 #define VIDEO_UTIL_ERROR_CLASS TIZEN_ERROR_VIDEO_UTIL
31 #define TRANSCODER_FEATURE_PATH "http://tizen.org/feature/multimedia.transcoder"
32 /**
33  * @file video_util_type.h
34  */
35
36 /**
37 * @addtogroup CAPI_MEDIA_VIDEO_UTIL_MODULE
38 * @{
39 */
40
41 /**
42  * @ingroup CAPI_MEDIA_VIDEO_UTIL_MODULE
43  * @brief Enumeration for errors of a video util.
44  * @since_tizen 2.3
45  */
46 typedef enum {
47         VIDEO_UTIL_ERROR_NONE = TIZEN_ERROR_NONE,                                                       /**< Successful */
48         VIDEO_UTIL_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER,             /**< Invalid parameter */
49         VIDEO_UTIL_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY,                             /**< Out of memory */
50         VIDEO_UTIL_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION,                     /**< Invalid operation */
51         VIDEO_UTIL_ERROR_BUSY = TIZEN_ERROR_RESOURCE_BUSY,                                              /**< Device or resource busy */
52         VIDEO_UTIL_ERROR_NOT_SUPPORTED_FORMAT = TIZEN_ERROR_VIDEO_UTIL | 0x01,  /**< Not supported format */
53         VIDEO_UTIL_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED,                     /**< Permission denied  */
54         VIDEO_UTIL_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED              /**< Not supported */
55 } video_util_error_e;
56
57 /**
58  * @ingroup CAPI_MEDIA_VIDEO_UTIL_MODULE
59  * @brief Enumeration for video codec.
60  * @since_tizen 2.3
61  */
62 typedef enum {
63         VIDEO_UTIL_VIDEO_CODEC_MPEG4 = 0,       /**< MPEG4 */
64         VIDEO_UTIL_VIDEO_CODEC_H263,            /**< H.263 */
65         VIDEO_UTIL_VIDEO_CODEC_H264,            /**< H.264 */
66         VIDEO_UTIL_VIDEO_CODEC_NONE             /**< No transcoding for video */
67 } video_util_video_codec_e;
68
69 /**
70  * @ingroup CAPI_MEDIA_VIDEO_UTIL_MODULE
71  * @brief Enumeration for audio codec.
72  * @since_tizen 2.3
73  */
74 typedef enum {
75         VIDEO_UTIL_AUDIO_CODEC_AAC = 0,         /**< AAC */
76         VIDEO_UTIL_AUDIO_CODEC_AMRNB,   /**< AMRNB */
77         VIDEO_UTIL_AUDIO_CODEC_NONE             /**< No transcoding for audio */
78 } video_util_audio_codec_e;
79
80 /**
81  * @ingroup CAPI_MEDIA_VIDEO_UTIL_MODULE
82  * @brief Enumeration for formats of a media.
83  * @since_tizen 2.3
84  */
85 typedef enum {
86         VIDEO_UTIL_FILE_FORMAT_3GP = 0,         /**< 3GP */
87         VIDEO_UTIL_FILE_FORMAT_MP4,             /**< MP4 */
88         VIDEO_UTIL_FILE_FORMAT_MAX              /**< MAX */
89 } video_util_file_format_e;
90
91 /**
92  * @ingroup CAPI_MEDIA_VIDEO_UTIL_MODULE
93  * @brief Video util handle.
94  * @since_tizen 2.3
95  */
96 typedef struct video_util_s *video_util_h;
97
98 /**
99  * @ingroup CAPI_MEDIA_VIDEO_UTIL_MODULE
100  * @brief Called regularly during the video transcoding.
101  * @since_tizen 2.3
102  *
103  * @details The interval of callback invocation depends on the framework.
104  *
105  * @param[in] current_position The current position in milliseconds
106  * @param[in] duration The duration in seconds
107  * @param[in] user_data The user data passed from the callback registration function
108  *
109  * @pre This callback function is invoked if you register this callback using video_util_set_progress_transcoding_cb().
110  *
111  * @see video_util_start_transcoding()
112  */
113 typedef void (*video_util_transcoding_progress_cb)(unsigned long current_position, unsigned long duration, void *user_data);
114
115 /**
116  * @ingroup CAPI_MEDIA_VIDEO_UTIL_MODULE
117  * @brief Called when transcoding is finished just before storing in the file.
118  * @since_tizen 2.3
119  *
120  * @param[in] error_code The error code of video util
121  * @param[in] user_data The user data passed from the callback registration function
122  *
123  * @pre video_util_start_transcoding() will invoke this function.
124  */
125 typedef void (*video_util_transcoding_completed_cb)(video_util_error_e error_code, void *user_data);
126
127 /**
128  * @brief Called iteratively to notify you about the supported file formats.
129  * @since_tizen 2.3
130  *
131  * @param[in] format The format of media files
132  * @param[in] user_data The user data passed from the foreach function
133  *
134  * @return @c true to continue with the next iteration of the loop,
135  *               otherwise @c false to break out of the loop
136  *
137  * @pre video_util_foreach_supported_file_format() will invoke this callback.
138  */
139 typedef bool (*video_util_supported_file_format_cb)(video_util_file_format_e format, void *user_data);
140
141 /**
142  * @brief Called iteratively to notify you of supported video codec.
143  * @since_tizen 2.3
144  *
145  * @param[in] format The codec of video
146  * @param[in] user_data The user data passed from the foreach function
147  *
148  * @return @c true to continue with the next iteration of the loop,
149  *               otherwise @c false to break out of the loop
150  *
151  * @pre video_util_foreach_supported_video_codec() will invoke this callback.
152  */
153 typedef bool (*video_util_supported_video_encoder_cb)(video_util_video_codec_e codec, void *user_data);
154
155 /**
156  * @brief Called iteratively to notify you about the supported audio codec.
157  * @since_tizen 2.3
158  *
159  * @param[in] format The codec of audio
160  * @param[in] user_data The user data passed from the foreach function
161  *
162  * @return @c true to continue with the next iteration of the loop,
163  *               otherwise @c false to break out of the loop
164  *
165  * @pre video_util_foreach_supported_audio_codec() will invoke this callback.
166  */
167 typedef bool (*video_util_supported_audio_encoder_cb)(video_util_audio_codec_e codec, void *user_data);
168
169 __attribute__ ((deprecated)) typedef bool (*video_util_progress_transcoding_cb)(video_util_error_e error, unsigned long current_position, unsigned long duration, void *user_data);
170
171 /**
172  * @}
173  */
174
175 #ifdef __cplusplus
176 }
177 #endif /* __cplusplus */
178 #endif /*__TIZEN_MEDIA_VIDEO_UTIL_TYPE_H__*/