[Release version 0.2.21] Add new API to support sound stream information set
[platform/core/api/recorder.git] / include / recorder.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_MULTIMEDIA_RECORDER_H__
18 #define __TIZEN_MULTIMEDIA_RECORDER_H__
19 #include <tizen.h>
20 #include <camera.h>
21 #include <audio_io.h>
22 #include <sound_manager.h>
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28 #define RECORDER_ERROR_CLASS        TIZEN_ERROR_RECORDER | 0x10
29
30 /**
31  * @file recorder.h
32  * @brief This file contains the Recorder API.
33  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
34  */
35
36 /**
37  * @addtogroup CAPI_MEDIA_RECORDER_MODULE
38  * @{
39  */
40
41 /**
42  * @brief The Media recorder handle.
43  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
44  */
45 typedef struct recorder_s *recorder_h;
46
47 /**
48  * @brief Enumeration for error code of the media recorder.
49  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
50  */
51 typedef enum {
52         RECORDER_ERROR_NONE                  = TIZEN_ERROR_NONE,                /**< Successful */
53         RECORDER_ERROR_INVALID_PARAMETER     = TIZEN_ERROR_INVALID_PARAMETER,   /**< Invalid parameter */
54         RECORDER_ERROR_INVALID_STATE         = RECORDER_ERROR_CLASS | 0x02,     /**< Invalid state */
55         RECORDER_ERROR_OUT_OF_MEMORY         = TIZEN_ERROR_OUT_OF_MEMORY ,      /**< Out of memory */
56         RECORDER_ERROR_DEVICE                = RECORDER_ERROR_CLASS | 0x04,     /**< Device error */
57         RECORDER_ERROR_INVALID_OPERATION     = TIZEN_ERROR_INVALID_OPERATION,   /**< Internal error */
58         RECORDER_ERROR_SOUND_POLICY          = RECORDER_ERROR_CLASS | 0x06,     /**< Blocked by Audio Session Manager (Deprecated since 3.0) */
59         RECORDER_ERROR_SECURITY_RESTRICTED   = RECORDER_ERROR_CLASS | 0x07,     /**< Restricted by security system policy */
60         RECORDER_ERROR_SOUND_POLICY_BY_CALL  = RECORDER_ERROR_CLASS | 0x08,     /**< Blocked by Audio Session Manager - CALL (Deprecated since 3.0) */
61         RECORDER_ERROR_SOUND_POLICY_BY_ALARM = RECORDER_ERROR_CLASS | 0x09,     /**< Blocked by Audio Session Manager - ALARM (Deprecated since 3.0) */
62         RECORDER_ERROR_ESD                   = RECORDER_ERROR_CLASS | 0x0a,     /**< ESD situation */
63         RECORDER_ERROR_OUT_OF_STORAGE        = RECORDER_ERROR_CLASS | 0x0b,     /**< Out of storage */
64         RECORDER_ERROR_PERMISSION_DENIED     = TIZEN_ERROR_PERMISSION_DENIED,   /**< The access to the resources can not be granted */
65         RECORDER_ERROR_NOT_SUPPORTED         = TIZEN_ERROR_NOT_SUPPORTED,       /**< The feature is not supported */
66         RECORDER_ERROR_RESOURCE_CONFLICT     = RECORDER_ERROR_CLASS | 0x0c,     /**< Blocked by resource conflict (Since 3.0) */
67 } recorder_error_e;
68
69 /**
70  * @brief Enumeration for recorder states.
71  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
72  */
73 typedef enum {
74         RECORDER_STATE_NONE,      /**< Recorder is not created */
75         RECORDER_STATE_CREATED,   /**< Recorder is created, but not prepared */
76         RECORDER_STATE_READY,     /**< Recorder is ready to record \n In case of video recorder, preview display will be shown */
77         RECORDER_STATE_RECORDING, /**< Recorder is recording media */
78         RECORDER_STATE_PAUSED,    /**< Recorder is paused while recording media */
79 } recorder_state_e;
80
81 /**
82  * @brief Enumeration for the recording limit.
83  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
84  */
85 typedef enum {
86         RECORDER_RECORDING_LIMIT_TIME,        /**< Time limit (second) of recording file */
87         RECORDER_RECORDING_LIMIT_SIZE,        /**< Size limit (kilo bytes [KB]) of recording file */
88         RECORDER_RECORDING_LIMIT_FREE_SPACE,  /**< No free space in storage */
89 } recorder_recording_limit_type_e;
90
91 /**
92  * @brief Enumeration for the file container format.
93  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
94  */
95 typedef enum {
96         RECORDER_FILE_FORMAT_3GP,    /**< 3GP file format */
97         RECORDER_FILE_FORMAT_MP4,    /**< MP4 file format */
98         RECORDER_FILE_FORMAT_AMR,    /**< AMR file format */
99         RECORDER_FILE_FORMAT_ADTS,   /**< ADTS file format */
100         RECORDER_FILE_FORMAT_WAV,    /**< WAV file format */
101         RECORDER_FILE_FORMAT_OGG,    /**< OGG file format */
102         RECORDER_FILE_FORMAT_M2TS    /**< MPEG2-TransportStream file format (Since 3.0) */
103 } recorder_file_format_e;
104
105 /**
106  * @brief Enumeration for the audio codec.
107  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
108  */
109 typedef enum {
110         RECORDER_AUDIO_CODEC_DISABLE = -1, /**< Disable audio track */
111         RECORDER_AUDIO_CODEC_AMR = 0,      /**< AMR codec */
112         RECORDER_AUDIO_CODEC_AAC,          /**< AAC codec */
113         RECORDER_AUDIO_CODEC_VORBIS,       /**< Vorbis codec */
114         RECORDER_AUDIO_CODEC_PCM           /**< PCM codec */
115 } recorder_audio_codec_e;
116
117 /**
118  * @brief Enumeration for the video codec.
119  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
120  */
121 typedef enum {
122         RECORDER_VIDEO_CODEC_H263,    /**< H263 codec */
123         RECORDER_VIDEO_CODEC_H264,    /**< H264 codec */
124         RECORDER_VIDEO_CODEC_MPEG4,   /**< MPEG4 codec */
125         RECORDER_VIDEO_CODEC_THEORA   /**< Theora codec */
126 } recorder_video_codec_e;
127
128 /**
129  * @brief Enumeration for audio capture devices.
130  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
131  */
132 typedef enum {
133         RECORDER_AUDIO_DEVICE_MIC,      /**< Mic device */
134         RECORDER_AUDIO_DEVICE_MODEM,    /**< Modem */
135 } recorder_audio_device_e;
136
137 /**
138  * @brief Enumeration for the recorder rotation type.
139  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
140  */
141 typedef enum {
142         RECORDER_ROTATION_NONE, /**< No rotation */
143         RECORDER_ROTATION_90,   /**< 90 degree rotation */
144         RECORDER_ROTATION_180,  /**< 180 degree rotation */
145         RECORDER_ROTATION_270,  /**< 270 degree rotation */
146 } recorder_rotation_e;
147
148 /**
149  * @brief Enumeration for the recorder policy.
150  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
151  */
152 typedef enum {
153         RECORDER_POLICY_NONE = 0,               /**< None */
154         RECORDER_POLICY_SOUND,                  /**< Sound policy (Deprecated since 3.0) */
155         RECORDER_POLICY_SOUND_BY_CALL,          /**< Sound policy by CALL (Deprecated since 3.0) */
156         RECORDER_POLICY_SOUND_BY_ALARM,         /**< Sound policy by ALARM (Deprecated since 3.0) */
157         RECORDER_POLICY_SECURITY,               /**< Security policy */
158         RECORDER_POLICY_RESOURCE_CONFLICT       /**< Resource conflict (Since 3.0) */
159 } recorder_policy_e;
160
161 /**
162  * @}
163 */
164
165 /**
166  * @addtogroup CAPI_MEDIA_RECORDER_MODULE
167  * @{
168  */
169
170 /**
171  * @brief Called when limitation error occurs while recording.
172  * @details The callback function is possible to receive three types of limits: time, size and no-space.
173  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
174  * @remarks After being called, recording data is discarded and not written in the recording file. Also the state of recorder is not changed.
175  * @param[in] type The imitation type
176  * @param[in] user_data The user data passed from the callback registration function
177  * @pre You have to register a callback using recorder_set_recording_limit_reached_cb().
178  * @see recorder_set_recording_status_cb()
179  * @see recorder_set_recording_limit_reached_cb()
180  * @see recorder_unset_recording_limit_reached_cb()
181  */
182 typedef void (*recorder_recording_limit_reached_cb)(recorder_recording_limit_type_e type, void *user_data);
183
184 /**
185  * @brief Called to indicate the recording status.
186  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
187  * @remarks This callback function is repeatedly invoked during the #RECORDER_STATE_RECORDING state.
188  * @param[in] elapsed_time  The time of the recording (milliseconds)
189  * @param[in] file_size     The size of the recording file (KB)
190  * @param[in] user_data     The user data passed from the callback registration function
191  * @pre recorder_start() will invoke this callback if you register it using recorder_set_recording_status_cb().
192  * @see recorder_set_recording_status_cb()
193  * @see recorder_unset_recording_status_cb()
194  * @see recorder_start()
195  */
196 typedef void (*recorder_recording_status_cb)(unsigned long long elapsed_time, unsigned long long file_size, void *user_data);
197
198 /**
199  * @brief Called when the record state is changed.
200  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
201  * @param[in] previous  The previous state of the recorder
202  * @param[in] current   The current state of the recorder
203  * @param[in] by_policy     @c true if the state is changed by policy, otherwise @c false if the state is not changed
204  * @param[in] user_data The user data passed from the callback registration function
205  * @pre This function is required to register a callback using recorder_set_state_changed_cb().
206  * @see recorder_set_state_changed_cb()
207  * @see recorder_prepare()
208  * @see recorder_unprepare()
209  * @see recorder_start()
210  * @see recorder_pause()
211  * @see recorder_commit()
212  * @see recorder_cancel()
213  */
214 typedef void (*recorder_state_changed_cb)(recorder_state_e previous , recorder_state_e current , bool by_policy, void *user_data);
215
216 /**
217  * @brief Called when the recorder is interrupted by a policy.
218  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
219  * @param[in] policy        The policy that is interrupting the recorder
220  * @param[in] previous      The previous state of the recorder
221  * @param[in] current       The current state of the recorder
222  * @param[in] user_data     The user data passed from the callback registration function
223  * @see recorder_set_interrupted_cb()
224  */
225 typedef void (*recorder_interrupted_cb)(recorder_policy_e policy, recorder_state_e previous, recorder_state_e current, void *user_data);
226
227 /**
228  * @brief Called when audio stream data was being delivered just before storing in the recorded file.
229  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
230  * @remarks The callback function holds the same buffer that will be recorded. \n
231  *          So if the user changes the buffer, the result file will contain the buffer.
232  * @remarks The callback is called via internal thread of Frameworks, therefore do not invoke UI API, recorder_unprepare(), recorder_commit() and recorder_cancel() in callback.
233  * @param[in] stream The audio stream data
234  * @param[in] size The size of the stream data
235  * @param[in] format The audio format
236  * @param[in] channel The number of the channel
237  * @param[in] timestamp The timestamp of the stream buffer (in msec)
238  * @param[in] user_data The user data passed from the callback registration function
239  * @see recorder_set_audio_stream_cb()
240  */
241 typedef void (*recorder_audio_stream_cb)(void* stream, int size, audio_sample_type_e format, int channel, unsigned int timestamp, void *user_data);
242
243 /**
244  * @brief Called once for each supported video resolution.
245  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
246  * @param[in] width         The video image width
247  * @param[in] height        The video image height
248  * @param[in] user_data     The user data passed from the foreach function
249  * @return    @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop
250  * @pre recorder_foreach_supported_video_resolution() will invoke this callback.
251  * @see recorder_foreach_supported_video_resolution()
252  */
253 typedef bool (*recorder_supported_video_resolution_cb)(int width, int height, void *user_data);
254
255 /**
256  * @brief Called when the error occurred.
257  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
258  * @remarks This callback informs about the critical error situation. \n
259  *          When being invoked, user should release the resource and terminate the application. \n
260  *          This error code will be reported.
261  *          #RECORDER_ERROR_DEVICE \n
262  *          #RECORDER_ERROR_INVALID_OPERATION \n
263  *          #RECORDER_ERROR_OUT_OF_MEMORY.
264  * @param[in] error          The error code
265  * @param[in] current_state  The current state of the recorder
266  * @param[in] user_data      The user data passed from the callback registration function
267  * @pre This callback function is invoked if you register this callback using recorder_set_error_cb().
268  * @see recorder_set_error_cb()
269  * @see recorder_unset_error_cb()
270  */
271 typedef void (*recorder_error_cb)(recorder_error_e error, recorder_state_e current_state, void *user_data);
272
273  /**
274  * @}
275 */
276
277 /**
278  * @addtogroup CAPI_MEDIA_RECORDER_CAPABILITY_MODULE
279  * @{
280  */
281
282 /**
283  * @brief Called iteratively to notify about the supported file formats.
284  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
285  * @param[in] format   The format of recording files
286  * @param[in] user_data The user data passed from the foreach function
287  * @return @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop
288  * @pre recorder_foreach_supported_file_format() will invoke this callback.
289  * @see recorder_foreach_supported_file_format()
290  */
291 typedef bool (*recorder_supported_file_format_cb)(recorder_file_format_e format, void *user_data);
292
293 /**
294  * @brief Called iteratively to notify about the supported audio encoders.
295  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
296  * @param[in] codec     The codec of audio encoder
297  * @param[in] user_data The user data passed from the foreach function
298  * @return @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop
299  * @pre recorder_foreach_supported_audio_encoder() will invoke this callback.
300  * @see recorder_foreach_supported_audio_encoder()
301  */
302 typedef bool (*recorder_supported_audio_encoder_cb)(recorder_audio_codec_e codec, void *user_data);
303
304 /**
305  * @brief Called iteratively to notify about the supported video encoders.
306  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
307  * @param[in] codec     The codec of video encoder
308  * @param[in] user_data The user data passed from the foreach function
309  * @return @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop
310  * @pre recorder_foreach_supported_video_encoder() will invoke this callback.
311  * @see recorder_foreach_supported_video_encoder()
312  */
313 typedef bool (*recorder_supported_video_encoder_cb)(recorder_video_codec_e codec, void *user_data);
314
315 /**
316  * @}
317 */
318
319 /**
320  * @addtogroup CAPI_MEDIA_RECORDER_MODULE
321  * @{
322  */
323
324 /**
325  * @brief Creates a recorder handle to record a video.
326  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
327  * @privlevel public
328  * @privilege %http://tizen.org/privilege/recorder
329  * @remarks You must release @a recorder using recorder_destroy(). \n
330  * The @a camera handle also could be used for capturing images. \n
331  * If the camera state was #CAMERA_STATE_CREATED, the preview format will be changed to the recommended preview format for recording.
332  * @remarks The created recorder state will be different according to camera state : \n
333  * #CAMERA_STATE_CREATED -> #RECORDER_STATE_CREATED\n
334  * #CAMERA_STATE_PREVIEW -> #RECORDER_STATE_READY\n
335  * #CAMERA_STATE_CAPTURED -> #RECORDER_STATE_READY
336  * @param[in]   camera  The handle to the camera
337  * @param[out]  recorder        A handle to the recorder
338  * @return @c 0 on success, otherwise a negative error value
339  * @retval #RECORDER_ERROR_NONE Successful
340  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
341  * @retval #RECORDER_ERROR_OUT_OF_MEMORY Out of memory
342  * @retval #RECORDER_ERROR_SOUND_POLICY Sound policy error
343  * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation
344  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
345  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
346  * @see camera_create()
347  * @see camera_stop_preview()
348  * @see recorder_destroy()
349  */
350 int recorder_create_videorecorder(camera_h camera, recorder_h *recorder);
351
352 /**
353  * @brief Creates a recorder handle to record an audio.
354  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
355  * @privlevel public
356  * @privilege %http://tizen.org/privilege/recorder
357  * @remarks You must release @a recorder using recorder_destroy().
358  * @param[out]  recorder  A handle to the recorder
359  * @return @c 0 on success, otherwise a negative error value
360  * @retval #RECORDER_ERROR_NONE Successful
361  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
362  * @retval #RECORDER_ERROR_OUT_OF_MEMORY Out of memory
363  * @retval #RECORDER_ERROR_SOUND_POLICY Sound policy error
364  * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation
365  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
366  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
367  * @post The recorder state will be #RECORDER_STATE_CREATED.
368  * @see recorder_destroy()
369  */
370 int recorder_create_audiorecorder(recorder_h *recorder);
371
372
373 /**
374  * @brief Destroys the recorder handle.
375  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
376  * @privlevel public
377  * @privilege %http://tizen.org/privilege/recorder
378  * @remarks The video recorder's camera handle is not released by this function.
379  * @param[in]   recorder    The handle to the media recorder
380  * @return @c 0 on success, otherwise a negative error value
381  * @retval #RECORDER_ERROR_NONE Successful
382  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
383  * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation
384  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
385  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
386  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
387  * @pre  The recorder state should be #RECORDER_STATE_CREATED.
388  * @post The recorder state will be #RECORDER_STATE_NONE.
389  * @see camera_destroy()
390  * @see recorder_create_videorecorder()
391  * @see recorder_create_audiorecorder()
392  */
393 int recorder_destroy(recorder_h recorder);
394
395 /**
396  * @brief Prepares the media recorder for recording.
397  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
398  * @privlevel public
399  * @privilege %http://tizen.org/privilege/recorder
400  * @remarks Before calling the function, it is required to properly set audio encoder (recorder_set_audio_encoder()),
401  *          video encoder(recorder_set_video_encoder()) and file format (recorder_set_file_format()).
402  * @param[in]   recorder  The handle to the media recorder
403  * @return @c 0 on success, otherwise a negative error value
404  * @retval #RECORDER_ERROR_NONE Successful
405  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
406  * @retval #RECORDER_ERROR_SOUND_POLICY Sound policy error
407  * @retval #RECORDER_ERROR_RESOURCE_CONFLICT Resource conflict error
408  * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation
409  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
410  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
411  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
412  * @pre  The recorder state should be #RECORDER_STATE_CREATED by recorder_create_videorecorder(), recorder_create_audiorecorder() or recorder_unprepare().
413  * @post The recorder state will be #RECORDER_STATE_READY.
414  * @post If recorder handle is created by recorder_create_videorecorder(), the camera state will be changed to #CAMERA_STATE_PREVIEW.
415  * @see recorder_create_videorecorder()
416  * @see recorder_create_audiorecorder()
417  * @see recorder_unprepare()
418  * @see recorder_set_audio_encoder()
419  * @see recorder_set_video_encoder()
420  * @see recorder_set_file_format()
421  */
422 int recorder_prepare(recorder_h recorder);
423
424 /**
425  * @brief Resets the media recorder.
426  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
427  * @privlevel public
428  * @privilege %http://tizen.org/privilege/recorder
429  * @param[in]  recorder  The handle to the media recorder
430  * @return @c 0 on success, otherwise a negative error value
431  * @retval #RECORDER_ERROR_NONE Successful
432  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
433  * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation
434  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
435  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
436  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
437  * @pre  The recorder state should be #RECORDER_STATE_READY set by recorder_prepare(), recorder_cancel() or recorder_commit().
438  * @post The recorder state will be #RECORDER_STATE_CREATED.
439  * @post If the recorder handle is created by recorder_create_videorecorder(), camera state will be changed to #CAMERA_STATE_CREATED.
440  * @see recorder_prepare()
441  * @see recorder_cancel()
442  * @see recorder_commit()
443  */
444 int recorder_unprepare(recorder_h recorder);
445
446 /**
447  * @brief Starts the recording.
448  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
449  * @privlevel public
450  * @privilege %http://tizen.org/privilege/recorder
451  * @remarks If file path has been set to an existing file, this file is removed automatically and updated by new one. \n
452  *          In the video recorder, some preview format does not support record mode. It will return #RECORDER_ERROR_INVALID_OPERATION error. \n
453  *          You should use default preview format or #CAMERA_PIXEL_FORMAT_NV12 in the record mode. \n
454  *          When you want to record audio or video file, you need to add privilege according to rules below additionally. \n
455  *          If you want to save contents to internal storage, you should add mediastorage privilege. \n
456  *          If you want to save contents to external storage, you should add externalstorage privilege. \n
457  *          The filename should be set before this function is invoked.
458  * @param[in]  recorder  The handle to the media recorder
459  * @return @c 0 on success, otherwise a negative error value
460  * @retval #RECORDER_ERROR_NONE Successful
461  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
462  * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation
463  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
464  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
465  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
466  * @pre The recorder state must be #RECORDER_STATE_READY by recorder_prepare() or #RECORDER_STATE_PAUSED by recorder_pause(). \n
467  *      The filename should be set by recorder_set_filename().
468  * @post The recorder state will be #RECORDER_STATE_RECORDING.
469  * @see recorder_pause()
470  * @see recorder_commit()
471  * @see recorder_cancel()
472  * @see recorder_set_audio_encoder()
473  * @see recorder_set_filename()
474  * @see recorder_set_file_format()
475  * @see recorder_recording_status_cb()
476  * @see recorder_set_filename()
477  */
478 int recorder_start(recorder_h recorder);
479
480 /**
481  * @brief Pauses the recording.
482  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
483  * @privlevel public
484  * @privilege %http://tizen.org/privilege/recorder
485  * @remarks Recording can be resumed with recorder_start().
486  * @param[in]  recorder  The handle to the media recorder
487  * @return @c 0 on success, otherwise a negative error value
488  * @retval #RECORDER_ERROR_NONE Successful
489  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
490  * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation
491  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
492  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
493  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
494  * @pre The recorder state must be #RECORDER_STATE_RECORDING.
495  * @post The recorder state will be #RECORDER_STATE_PAUSED.
496  * @see recorder_pause()
497  * @see recorder_commit()
498  * @see recorder_cancel()
499  */
500 int recorder_pause(recorder_h recorder);
501
502 /**
503  * @brief Stops recording and saves the result.
504  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
505  * @privlevel public
506  * @privilege %http://tizen.org/privilege/recorder
507  * @remarks When you want to record audio or video file, you need to add privilege according to rules below additionally. \n
508  *          If you want to save contents to internal storage, you should add mediastorage privilege. \n
509  *          If you want to save contents to external storage, you should add externalstorage privilege.
510  * @param[in]  recorder  The handle to the media recorder
511  * @return @c 0 on success, otherwise a negative error value
512  * @retval #RECORDER_ERROR_NONE Successful
513  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
514  * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation
515  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
516  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
517  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
518  * @pre The recorder state must be #RECORDER_STATE_RECORDING set by recorder_start() or #RECORDER_STATE_PAUSED by recorder_pause().
519  * @post The recorder state will be #RECORDER_STATE_READY.
520  * @see recorder_pause()
521  * @see recorder_cancel()
522  * @see recorder_set_filename()
523  * @see recorder_start()
524  */
525 int recorder_commit(recorder_h recorder);
526
527 /**
528  * @brief Cancels the recording.
529  * @details The recording data is discarded and not written in the recording file.
530  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
531  * @privlevel public
532  * @privilege %http://tizen.org/privilege/recorder
533  * @remarks When you want to record audio or video file, you need to add privilege according to rules below additionally. \n
534  *          If you want to save contents to internal storage, you should add mediastorage privilege. \n
535  *          If you want to save contents to external storage, you should add externalstorage privilege.
536  * @param[in]  recorder  The handle to the media recorder
537  * @return @c 0 on success, otherwise a negative error value
538  * @retval #RECORDER_ERROR_NONE Successful
539  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
540  * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation
541  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
542  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
543  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
544  * @pre The recorder state must be #RECORDER_STATE_RECORDING set by recorder_start() or #RECORDER_STATE_PAUSED by recorder_pause().
545  * @post The recorder state will be #RECORDER_STATE_READY.
546  * @see recorder_pause()
547  * @see recorder_commit()
548  * @see recorder_cancel()
549  * @see recorder_start()
550  */
551 int recorder_cancel(recorder_h recorder);
552
553 /**
554  * @brief Gets the recorder's current state.
555  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
556  * @param[in]  recorder The handle to the media recorder
557  * @param[out]  state  The current state of the recorder
558  * @return  @c 0 on success, otherwise a negative error value
559  * @retval #RECORDER_ERROR_NONE Successful
560  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
561  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
562  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
563  */
564 int recorder_get_state(recorder_h recorder, recorder_state_e *state);
565
566 /**
567  * @brief Gets the peak audio input level that was sampled since the last call to this function.
568  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
569  * @remarks @c 0 dB indicates maximum input level, @c -300 dB indicates minimum input level.
570  * @param[in]  recorder The handle to the media recorder
571  * @param[out] dB  The audio input level in dB
572  * @return  @c 0 on success, otherwise a negative error value
573  * @retval #RECORDER_ERROR_NONE Successful
574  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
575  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
576  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
577  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
578  * @pre The recorder state must be #RECORDER_STATE_RECORDING or #RECORDER_STATE_PAUSED.
579  */
580 int recorder_get_audio_level(recorder_h recorder, double *dB);
581
582 /**
583  * @brief Sets the file path to record.
584  * @details This function sets file path which defines where newly recorded data should be stored.
585  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
586  * @remarks If the same file already exists in the file system, then old file will be overwritten.
587  * @param[in]   recorder        The handle to the media recorder
588  * @param[in]   path The recording file path
589  * @return @c 0 on success, otherwise a negative error value
590  * @retval #RECORDER_ERROR_NONE Successful
591  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
592  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
593  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
594  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
595  * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY.
596  * @see recorder_get_filename()
597  */
598 int recorder_set_filename(recorder_h recorder, const char *path);
599
600 /**
601  * @brief Gets the file path to record.
602  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
603  * @remarks You must release @a path using free().
604  * @param[in]   recorder    The handle to the media recorder
605  * @param[out]  path    The recording file path
606  * @return @c 0 on success, otherwise a negative error value
607  * @retval #RECORDER_ERROR_NONE Successful
608  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
609  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
610  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
611  * @see recorder_set_filename()
612  */
613 int recorder_get_filename(recorder_h recorder, char **path);
614
615 /**
616  * @brief Sets the file format for recording media stream.
617  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
618  * @remarks Since 2.3.1, it could be returned #RECORDER_ERROR_INVALID_OPERATION \n
619  *          when it's audio recorder and its state is #RECORDER_STATE_READY \n
620  *          because of checking codec compatibility with current encoder.
621  * @param[in] recorder The handle to the media recorder
622  * @param[in] format   The media file format
623  * @return @c 0 on success, otherwise a negative error value
624  * @retval #RECORDER_ERROR_NONE Successful
625  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
626  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
627  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
628  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
629  * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation (Since 2.3.1)
630  * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY (for video recorder only).\n
631  *      Since 2.3.1, this API also works for audio recorder when its state is #RECORDER_STATE_READY.
632  * @see recorder_get_file_format()
633  * @see recorder_foreach_supported_file_format()
634  */
635 int recorder_set_file_format(recorder_h recorder, recorder_file_format_e format);
636
637
638 /**
639  * @brief Gets the file format for recording media stream.
640  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
641  * @param[in] recorder The handle to the media recorder
642  * @param[out] format   The media file format
643  * @return @c 0 on success, otherwise a negative error value
644  * @retval #RECORDER_ERROR_NONE Successful
645  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
646  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
647  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
648  * @see recorder_set_file_format()
649  * @see recorder_foreach_supported_file_format()
650  */
651 int recorder_get_file_format(recorder_h recorder, recorder_file_format_e *format);
652
653
654 /**
655  * @brief Sets the recorder's sound manager stream information.
656  * @since_tizen 3.0
657  * @remarks You can set sound stream information including audio routing.
658  *          For more details, please refer to @ref CAPI_MEDIA_SOUND_MANAGER_MODULE
659  * @param[in]   recorder        The handle to the media recorder
660  * @param[in]   stream_info     The sound manager info
661  * @return @c 0 on success, otherwise a negative error value
662  * @retval #RECORDER_ERROR_NONE Successful
663  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
664  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
665  * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation
666  * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY
667  * @see #sound_stream_info_h
668  * @see sound_manager_create_stream_information()
669  * @see sound_manager_destroy_stream_information()
670  */
671 int recorder_set_sound_stream_info(recorder_h recorder, sound_stream_info_h stream_info);
672
673
674  /**
675  * @}
676 */
677
678 /**
679  * @addtogroup CAPI_MEDIA_RECORDER_CAPABILITY_MODULE
680  * @{
681  */
682
683 /**
684  * @brief Retrieves all supported file formats by invoking a specific callback for each supported file format.
685  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
686  * @param[in] recorder  The handle to the media recorder
687  * @param[in] callback The iteration callback
688  * @param[in] user_data The user data to be passed to the callback function
689  * @return @c 0 on success, otherwise a negative error value
690  * @retval #RECORDER_ERROR_NONE Successful
691  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
692  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
693  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
694  * @post  recorder_supported_file_format_cb() will be invoked.
695  * @see recorder_get_file_format()
696  * @see recorder_set_file_format()
697  * @see recorder_supported_file_format_cb()
698  */
699 int recorder_foreach_supported_file_format(recorder_h recorder, recorder_supported_file_format_cb callback, void *user_data);
700
701 /**
702  * @}
703 */
704
705 /**
706  * @addtogroup CAPI_MEDIA_RECORDER_MODULE
707  * @{
708  */
709
710 /**
711  * @brief Sets the audio codec for encoding an audio stream.
712  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
713  * @remarks You can get available audio encoders by using recorder_foreach_supported_audio_encoder(). \n
714  *          If set to #RECORDER_AUDIO_CODEC_DISABLE, the audio track is not created in recording files.\n
715  *          Since 2.3.1, it could be returned #RECORDER_ERROR_INVALID_OPERATION \n
716  *          when it's audio recorder and its state is #RECORDER_STATE_READY \n
717  *          because of checking codec compatibility with current file format.
718  * @param[in] recorder The handle to the media recorder
719  * @param[in] codec    The audio codec
720  * @return @c 0 on success, otherwise a negative error value
721  * @retval #RECORDER_ERROR_NONE Successful
722  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
723  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
724  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
725  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
726  * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation (Since 2.3.1)
727  * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY.
728  * @see recorder_get_audio_encoder()
729  * @see recorder_foreach_supported_audio_encoder()
730  */
731 int recorder_set_audio_encoder(recorder_h recorder, recorder_audio_codec_e codec);
732
733 /**
734  * @brief Gets the audio codec for encoding an audio stream.
735  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
736  * @param[in] recorder The handle to the media recorder
737  * @param[out] codec   The audio codec
738  * @return @c 0 on success, otherwise a negative error value
739  * @retval #RECORDER_ERROR_NONE Successful
740  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
741  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
742  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
743  * @see recorder_set_audio_encoder()
744  * @see recorder_foreach_supported_audio_encoder()
745  */
746 int recorder_get_audio_encoder(recorder_h recorder, recorder_audio_codec_e *codec);
747
748  /**
749  * @}
750 */
751
752 /**
753  * @addtogroup CAPI_MEDIA_RECORDER_CAPABILITY_MODULE
754  * @{
755  */
756
757 /**
758  * @brief Retrieves all supported audio encoders by invoking a specific callback for each supported audio encoder.
759  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
760  * @param[in] recorder  The handle to the media recorder
761  * @param[in] callback  The iteration callback
762  * @param[in] user_data The user data to be passed to the callback function
763  * @return @c 0 on success, otherwise a negative error value
764  * @retval #RECORDER_ERROR_NONE Successful
765  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
766  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
767  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
768  * @post  recorder_supported_audio_encoder_cb() will be invoked.
769  * @see recorder_set_audio_encoder()
770  * @see recorder_get_audio_encoder()
771  * @see recorder_supported_audio_encoder_cb()
772  */
773 int recorder_foreach_supported_audio_encoder(recorder_h recorder, recorder_supported_audio_encoder_cb callback, void *user_data);
774
775 /**
776  * @}
777 */
778
779 /**
780  * @addtogroup CAPI_MEDIA_RECORDER_MODULE
781  * @{
782  */
783
784 /**
785  * @brief Sets the resolution of the video recording.
786  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
787  * @remarks This function should be called before recording (recorder_start()).
788  * @param[in] recorder  The handle to the media recorder
789  * @param[in] width     The preview width
790  * @param[in] height    The preview height
791  * @return @c 0 on success, otherwise a negative error value
792  * @retval #RECORDER_ERROR_NONE Successful
793  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
794  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
795  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
796  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
797  * @pre    The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY.
798  * @see recorder_start()
799  * @see recorder_get_video_resolution()
800  * @see recorder_foreach_supported_video_resolution()
801  */
802 int recorder_set_video_resolution(recorder_h recorder, int width, int height);
803
804 /**
805  * @brief Gets the resolution of the video recording.
806  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
807  * @param[in] recorder  The handle to the media recorder
808  * @param[out] width    The video width
809  * @param[out] height   The video height
810  * @return @c 0 on success, otherwise a negative error value
811  * @retval #RECORDER_ERROR_NONE Successful
812  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
813  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
814  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
815  * @see recorder_set_video_resolution()
816  * @see recorder_foreach_supported_video_resolution()
817  */
818 int recorder_get_video_resolution(recorder_h recorder, int *width, int *height);
819
820 /**
821  * @}
822 */
823
824 /**
825  * @addtogroup CAPI_MEDIA_RECORDER_CAPABILITY_MODULE
826  * @{
827  */
828
829 /**
830  * @brief Retrieves all supported video resolutions by invoking callback function once for each supported video resolution.
831  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
832  * @param[in] recorder  The handle to the media recorder
833  * @param[in] foreach_cb        The callback function to be invoked
834  * @param[in] user_data The user data to be passed to the callback function
835  * @return @c 0 on success, otherwise a negative error value
836  * @retval #RECORDER_ERROR_NONE Successful
837  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
838  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
839  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
840  * @post        This function invokes recorder_supported_video_resolution_cb() repeatedly to retrieve each supported video resolution.
841  * @see recorder_set_video_resolution()
842  * @see recorder_get_video_resolution()
843  * @see recorder_supported_video_resolution_cb()
844  */
845 int recorder_foreach_supported_video_resolution(recorder_h recorder, recorder_supported_video_resolution_cb foreach_cb, void *user_data);
846
847 /**
848  * @}
849 */
850
851 /**
852  * @addtogroup CAPI_MEDIA_RECORDER_MODULE
853  * @{
854  */
855
856 /**
857  * @brief Sets the video codec for encoding video stream.
858  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
859  * @remarks You can get available video encoders by using recorder_foreach_supported_video_encoder().
860  * @param[in] recorder The handle to the media recorder
861  * @param[in] codec    The video codec
862  * @return @c 0 on success, otherwise a negative error value
863  * @retval #RECORDER_ERROR_NONE Successful
864  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
865  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
866  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
867  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
868  * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY.
869  * @see recorder_get_video_encoder()
870  * @see recorder_foreach_supported_video_encoder()
871  */
872 int recorder_set_video_encoder(recorder_h recorder, recorder_video_codec_e codec);
873
874 /**
875  * @brief Gets the video codec for encoding video stream.
876  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
877  * @param[in] recorder The handle to the media recorder
878  * @param[out] codec   The video codec
879  * @return @c 0 on success, otherwise a negative error value
880  * @retval #RECORDER_ERROR_NONE Successful
881  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
882  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
883  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
884  * @see recorder_set_video_encoder()
885  * @see recorder_foreach_supported_video_encoder()
886  */
887 int recorder_get_video_encoder(recorder_h recorder, recorder_video_codec_e *codec);
888
889 /**
890  * @}
891 */
892
893 /**
894  * @addtogroup CAPI_MEDIA_RECORDER_CAPABILITY_MODULE
895  * @{
896  */
897
898 /**
899  * @brief Retrieves all supported video encoders by invoking a specific callback for each supported video encoder.
900  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
901  * @param[in] recorder  The handle to the media recorder
902  * @param[in] callback  The iteration callback
903  * @param[in] user_data The user data to be passed to the callback function
904  * @return @c 0 on success, otherwise a negative error value
905  * @retval #RECORDER_ERROR_NONE Successful
906  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
907  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
908  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
909  * @post  recorder_supported_video_encoder_cb() will be invoked.
910  * @see recorder_set_video_encoder()
911  * @see recorder_get_video_encoder()
912  * @see recorder_supported_video_encoder_cb()
913  */
914 int recorder_foreach_supported_video_encoder(recorder_h recorder, recorder_supported_video_encoder_cb callback, void *user_data);
915
916  /**
917  * @}
918 */
919
920 /**
921  * @addtogroup CAPI_MEDIA_RECORDER_MODULE
922  * @{
923  */
924
925 /**
926  * @brief Registers the callback function that will be invoked when the recorder state changes.
927  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
928  * @param[in] recorder  The handle to the media recorder
929  * @param[in] callback  The function pointer of user callback
930  * @param[in] user_data The user data to be passed to the callback function
931  * @return @c 0 on success, otherwise a negative error value
932  * @retval #RECORDER_ERROR_NONE Successful
933  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
934  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
935  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
936  * @post  recorder_state_changed_cb() will be invoked.
937  * @see recorder_unset_state_changed_cb()
938  * @see recorder_state_changed_cb()
939  */
940 int recorder_set_state_changed_cb(recorder_h recorder, recorder_state_changed_cb callback, void *user_data);
941
942 /**
943  * @brief Unregisters the callback function.
944  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
945  * @param[in]  recorder The handle to the media recorder
946  * @return @c 0 on success, otherwise a negative error value
947  * @retval #RECORDER_ERROR_NONE Successful
948  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
949  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
950  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
951  * @see recorder_set_state_changed_cb()
952  */
953 int recorder_unset_state_changed_cb(recorder_h recorder);
954
955 /**
956  * @brief Registers a callback function to be called when the media recorder is interrupted according to a policy.
957  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
958  * @param[in] recorder  The handle to the media recorder
959  * @param[in] callback    The callback function to register
960  * @param[in] user_data   The user data to be passed to the callback function
961  * @return @c 0 on success, otherwise a negative error value
962  * @retval #RECORDER_ERROR_NONE Successful
963  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
964  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
965  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
966  * @see recorder_unset_interrupted_cb()
967  * @see recorder_interrupted_cb()
968  */
969 int recorder_set_interrupted_cb(recorder_h recorder, recorder_interrupted_cb callback,
970             void *user_data);
971
972 /**
973  * @brief Unregisters the callback function.
974  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
975  * @param[in]   recorder        The handle to the media recorder
976  * @return @c 0 on success, otherwise a negative error value
977  * @retval #RECORDER_ERROR_NONE Successful
978  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
979  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
980  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
981  * @see recorder_set_interrupted_cb()
982  */
983 int recorder_unset_interrupted_cb(recorder_h recorder);
984
985 /**
986  * @brief Registers a callback function to be called when audio stream data is being delivered.
987  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
988  * @remarks This callback function holds the same buffer that will be recorded. \n
989  *          Therefore if an user changes the buffer, the result file will have the buffer. \n
990  * @remarks The callback is called via internal thread of Frameworks. Therefore do not invoke UI API, recorder_unprepare(), recorder_commit() and recorder_cancel() in callback.\n
991  *          This callback function to be called in #RECORDER_STATE_RECORDING and #RECORDER_STATE_PAUSED state.
992  *
993  * @param[in] recorder    The handle to the recorder
994  * @param[in] callback    The callback function to register
995  * @param[in] user_data   The user data to be passed to the callback function
996  * @return @c 0 on success, otherwise a negative error value
997  * @retval #RECORDER_ERROR_NONE Successful
998  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
999  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1000  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1001  * @pre The recorder state should be #RECORDER_STATE_READY or #RECORDER_STATE_CREATED.
1002  * @see recorder_unset_audio_stream_cb()
1003  * @see recorder_audio_stream_cb()
1004  */
1005 int recorder_set_audio_stream_cb(recorder_h recorder, recorder_audio_stream_cb callback, void* user_data);
1006
1007 /**
1008  * @brief Unregisters the callback function.
1009  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1010  * @param[in]   recorder        The handle to the media recorder
1011  * @return @c 0 on success, otherwise a negative error value
1012  * @retval #RECORDER_ERROR_NONE Successful
1013  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1014  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1015  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1016  * @see     recorder_set_audio_stream_cb()
1017  */
1018 int recorder_unset_audio_stream_cb(recorder_h recorder);
1019
1020 /**
1021  * @brief Registers a callback function to be invoked when the recording information changes.
1022  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1023  * @param[in]  recorder   The handle to the media recorder
1024  * @param[in]  callback   The function pointer of user callback
1025  * @param[in]  user_data  The user data to be passed to the callback function
1026  * @return @c 0 on success, otherwise a negative error value
1027  * @retval #RECORDER_ERROR_NONE Successful
1028  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1029  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1030  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1031  * @post  recorder_recording_status_cb() will be invoked.
1032  * @see recorder_unset_recording_status_cb()
1033  * @see recorder_recording_status_cb()
1034  */
1035 int recorder_set_recording_status_cb(recorder_h recorder, recorder_recording_status_cb callback, void *user_data);
1036
1037 /**
1038  * @brief Unregisters the callback function.
1039  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1040  * @param[in]  recorder    The handle to the media recorder
1041  * @return @c 0 on success, otherwise a negative error value
1042  * @retval #RECORDER_ERROR_NONE Successful
1043  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1044  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1045  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1046  * @see recorder_set_recording_status_cb()
1047  */
1048 int recorder_unset_recording_status_cb(recorder_h recorder);
1049
1050 /**
1051  * @brief Registers the callback function to be run when reached the recording limit.
1052  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1053  * @param[in]   recorder        The handle to media recorder
1054  * @param[in]   callback        The function pointer of user callback
1055  * @param[in]   user_data       The user data to be passed to the callback function
1056  * @return @c 0 on success, otherwise a negative error value
1057  * @retval #RECORDER_ERROR_NONE Successful
1058  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1059  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1060  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1061  * @post  recorder_recording_limit_reached_cb() will be invoked.
1062  * @see recorder_unset_recording_limit_reached_cb()
1063  * @see recorder_attr_set_size_limit()
1064  * @see recorder_attr_set_time_limit()
1065  * @see recorder_recording_limit_reached_cb()
1066  */
1067 int recorder_set_recording_limit_reached_cb(recorder_h recorder, recorder_recording_limit_reached_cb callback, void *user_data);
1068
1069 /**
1070  * @brief Unregisters the callback function.
1071  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1072  * @param[in]  recorder  The handle to the media recorder
1073  * @return @c 0 on success, otherwise a negative error value
1074  * @retval #RECORDER_ERROR_NONE Successful
1075  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1076  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1077  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1078  * @see recorder_set_recording_limit_reached_cb()
1079  */
1080 int recorder_unset_recording_limit_reached_cb(recorder_h recorder);
1081
1082 /**
1083  * @brief Registers a callback function to be called when an asynchronous operation error occurred.
1084  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1085  * @remarks This callback informs critical error situation.\n
1086  *          When this callback is invoked, user should release the resource and terminate the application. \n
1087  *          These error codes will occur. \n
1088  *          #RECORDER_ERROR_DEVICE \n
1089  *          #RECORDER_ERROR_INVALID_OPERATION \n
1090  *          #RECORDER_ERROR_OUT_OF_MEMORY
1091  * @param[in]   recorder        The handle to the recorder
1092  * @param[in]   callback        The callback function to register
1093  * @param[in]   user_data       The user data to be passed to the callback function
1094  * @return  @c 0 on success, otherwise a negative error value
1095  * @retval #RECORDER_ERROR_NONE Successful
1096  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1097  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1098  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1099  * @post        This function will invoke recorder_error_cb() when an asynchronous operation error occur.
1100  * @see recorder_unset_error_cb()
1101  * @see recorder_error_cb()
1102  */
1103 int recorder_set_error_cb(recorder_h recorder, recorder_error_cb callback, void *user_data);
1104
1105
1106 /**
1107  * @brief Unregisters the callback function.
1108  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1109  * @param[in]   recorder        The handle to the recorder
1110  * @return  @c on success, otherwise a negative error value
1111  * @retval    #RECORDER_ERROR_NONE Successful
1112  * @retval    #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1113  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1114  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1115  * @see recorder_set_error_cb()
1116  */
1117 int recorder_unset_error_cb(recorder_h recorder);
1118
1119
1120 /**
1121  * @}
1122  */
1123
1124 /**
1125  * @addtogroup CAPI_MEDIA_RECORDER_ATTRIBUTES_MODULE
1126  * @{
1127  */
1128
1129
1130 /**
1131  * @brief Sets the maximum size of a recording file.
1132  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1133  * @remarks After reaching the limitation, the recording data is discarded and not written in the recording file.
1134  * @param[in] recorder The handle to the media recorder
1135  * @param[in] kbyte    The maximum size of the recording file(KB) \n
1136  *                     @c 0 means unlimited recording size.
1137  * @return @c 0 on success, otherwise a negative error value
1138  * @retval #RECORDER_ERROR_NONE Successful
1139  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1140  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
1141  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1142  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1143  * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY.
1144  * @see recorder_attr_get_size_limit()
1145  * @see recorder_attr_set_time_limit()
1146  */
1147 int recorder_attr_set_size_limit(recorder_h recorder, int kbyte);
1148
1149 /**
1150  * @brief Gets the maximum size of a recording file.
1151  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1152  * @param[in]  recorder The handle to the media recorder
1153  * @param[out] kbyte    The maximum size of recording file (KB) \n
1154  *                      @c 0 means unlimited recording size.
1155  * @return @c 0 on success, otherwise a negative error value
1156  * @retval #RECORDER_ERROR_NONE Successful
1157  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1158  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1159  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1160  * @see recorder_attr_set_size_limit()
1161  * @see recorder_attr_get_time_limit()
1162  */
1163 int recorder_attr_get_size_limit(recorder_h recorder, int *kbyte);
1164
1165 /**
1166  * @brief Sets the time limit of a recording file.
1167  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1168  * @remarks After reaching the limitation, the recording data is discarded and not written in the recording file.
1169  * @param[in] recorder The handle to the media recorder
1170  * @param[in] second   The time limit of the recording file (in seconds) \n
1171  *                     @c 0 means unlimited recording size.
1172  * @return @c 0 on success, otherwise a negative error value
1173  * @retval #RECORDER_ERROR_NONE Successful
1174  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1175  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
1176  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1177  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1178  * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY.
1179  * @see recorder_attr_get_time_limit()
1180  * @see recorder_attr_set_size_limit()
1181  */
1182 int recorder_attr_set_time_limit(recorder_h recorder, int second);
1183
1184
1185 /**
1186  * @brief Gets the time limit of a recording file.
1187  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1188  * @param[in]  recorder  The handle to the media recorder
1189  * @param[out] second    The time limit of the recording file (in seconds) \n
1190  *                       @c 0 means unlimited recording time.
1191  * @return @c 0 on success, otherwise a negative error value
1192  * @retval #RECORDER_ERROR_NONE Successful
1193  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1194  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1195  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1196  * @see recorder_attr_set_time_limit()
1197  * @see recorder_attr_get_size_limit()
1198  */
1199 int recorder_attr_get_time_limit(recorder_h recorder, int *second);
1200
1201 /**
1202  * @brief Sets the audio device for recording.
1203  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1204  * @param[in] recorder The handle to the media recorder
1205  * @param[in] device   The type of an audio device
1206  * @return @c 0 on success, otherwise a negative error value
1207  * @retval #RECORDER_ERROR_NONE Successful
1208  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1209  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
1210  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1211  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1212  * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY (for video recorder only).\n
1213  *      Since 2.3.1, this API also works for audio recorder when its state is #RECORDER_STATE_READY.
1214  * @see recorder_attr_get_audio_device()
1215  */
1216 int recorder_attr_set_audio_device(recorder_h recorder, recorder_audio_device_e device);
1217
1218 /**
1219  * @brief Gets the audio device for recording.
1220  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1221  * @param[in] recorder  The handle to the media recorder
1222  * @param[out] device The type of an audio device
1223  * @return @c 0 on success, otherwise a negative error value
1224  * @retval #RECORDER_ERROR_NONE Successful
1225  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1226  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1227  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1228  * @see recorder_attr_set_audio_device()
1229  */
1230 int recorder_attr_get_audio_device(recorder_h recorder, recorder_audio_device_e *device);
1231
1232 /**
1233  * @brief Sets the sampling rate of an audio stream.
1234  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1235  * @param[in] recorder    The handle to the media recorder
1236  * @param[in] samplerate The sample rate in Hertz
1237  * @return @c 0 on success, otherwise a negative error value
1238  * @retval #RECORDER_ERROR_NONE Successful
1239  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1240  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
1241  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1242  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1243  * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY (for video recorder only).\n
1244  *      Since 2.3.1, this API also works for audio recorder when its state is #RECORDER_STATE_READY.
1245  * @see recorder_attr_get_audio_samplerate()
1246  */
1247 int recorder_attr_set_audio_samplerate(recorder_h recorder, int samplerate);
1248
1249 /**
1250  * @brief Gets the sampling rate of an audio stream.
1251  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1252  * @param[in]  recorder    The handle to the media recorder
1253  * @param[out] samplerate  The sample rate in Hertz
1254  * @return @c 0 on success, otherwise a negative error value
1255  * @retval #RECORDER_ERROR_NONE Successful
1256  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1257  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1258  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1259  * @see recorder_attr_set_audio_samplerate()
1260  */
1261 int recorder_attr_get_audio_samplerate(recorder_h recorder, int *samplerate);
1262
1263 /**
1264  * @brief Sets the bitrate of an audio encoder.
1265  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1266  * @param[in] recorder  The handle to the media recorder
1267  * @param[in] bitrate   The bitrate (for mms : 12200[bps], normal : 288000[bps])
1268  * @return @c 0 on success, otherwise a negative error value
1269  * @retval #RECORDER_ERROR_NONE Successful
1270  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1271  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
1272  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1273  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1274  * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY.
1275  * @see recorder_attr_get_audio_encoder_bitrate()
1276  */
1277 int recorder_attr_set_audio_encoder_bitrate(recorder_h recorder, int bitrate);
1278
1279 /**
1280  * @brief Sets the bitrate of a video encoder.
1281  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1282  * @param[in] recorder  The handle to the media recorder
1283  * @param[in] bitrate   The bitrate in bits per second
1284  * @return @c 0 on success, otherwise a negative error value
1285  * @retval #RECORDER_ERROR_NONE Successful
1286  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1287  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
1288  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1289  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1290  * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY.
1291  * @see recorder_attr_get_video_encoder_bitrate()
1292  */
1293 int recorder_attr_set_video_encoder_bitrate(recorder_h recorder, int bitrate);
1294
1295 /**
1296  * @brief Gets the bitrate of an audio encoder.
1297  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1298  * @param[in]  recorder  The handle to the media recorder
1299  * @param[out] bitrate   The bitrate in bits per second
1300  * @return @c 0 on success, otherwise a negative error value
1301  * @retval #RECORDER_ERROR_NONE Successful
1302  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1303  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1304  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1305  * @see recorder_attr_set_audio_encoder_bitrate()
1306  */
1307 int recorder_attr_get_audio_encoder_bitrate(recorder_h recorder, int *bitrate);
1308
1309 /**
1310  * @brief Gets the bitrate of a video encoder.
1311  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1312  * @param[in]  recorder  The handle to the media recorder
1313  * @param[out] bitrate   The bitrate in bits per second
1314  * @return @c 0 on success, otherwise a negative error value
1315  * @retval #RECORDER_ERROR_NONE Successful
1316  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1317  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1318  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1319  * @see recorder_attr_set_audio_encoder_bitrate()
1320  */
1321 int recorder_attr_get_video_encoder_bitrate(recorder_h recorder, int *bitrate);
1322
1323 /**
1324  * @brief Sets the mute state of a recorder.
1325  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1326  * @param[in] recorder  The handle to the media recorder
1327  * @param[in] enable The mute state
1328  * @return @c 0 on success, otherwise a negative error value
1329  * @retval #RECORDER_ERROR_NONE Successful
1330  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1331  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1332  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1333  * @see recorder_attr_is_muted()
1334  */
1335 int recorder_attr_set_mute(recorder_h recorder, bool enable);
1336
1337 /**
1338  * @brief Gets the mute state of a recorder.
1339  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1340  * @param[in] recorder The handle to the media recorder
1341  * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
1342  * @return  @c true if the recorder is not recording any sound,
1343  *          otherwise @c false if the recorder is recording
1344  * @exception #RECORDER_ERROR_NONE Successful
1345  * @exception #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1346  * @exception #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1347  * @exception #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1348  * @see recorder_attr_set_mute()
1349  */
1350 bool recorder_attr_is_muted(recorder_h recorder);
1351
1352 /**
1353  * @brief Sets the recording motion rate.
1354  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1355  * @remarks This attribute is valid only in a video recorder. \n
1356  *          If the rate bigger than @c 0 and smaller than @c 1, video is recorded in a slow motion mode. \n
1357  *          If the rate bigger than @c 1, video is recorded in a fast motion mode (time lapse recording).
1358  * @remarks Audio data is not recorded. \n
1359  *          To reset slow motion recording, set the rate to @c 1.
1360  * @param[in] recorder The handle to the media recorder
1361  * @param[in] rate     The recording motion rate \n
1362  *                     It is computed with fps. (@c 0<rate<@c 1 for slow motion, @c 1<rate for fast motion(time lapse recording), @c 1 to reset).
1363  * @return @c 0 on success, otherwise a negative error value
1364  * @retval #RECORDER_ERROR_NONE Successful
1365  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1366  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1367  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1368  * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY.
1369  * @see recorder_attr_get_recording_motion_rate()
1370  */
1371 int recorder_attr_set_recording_motion_rate(recorder_h recorder , double rate);
1372
1373 /**
1374  * @brief Gets the recording motion rate.
1375  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1376  * @remarks This attribute is valid only in a video recorder. \n
1377  *          If the rate bigger than @c 0 and smaller than @c 1, video is recorded in a slow motion mode. \n
1378  *          If the rate bigger than @c 1, video is recorded in a fast motion mode (time lapse recording).
1379  * @remarks Audio data is not recorded. \n
1380  *          To reset slow motion recording, set the rate to @c 1.
1381  * @param[in]  recorder The handle to the media recorder
1382  * @param[out] rate     The recording motion rate \n
1383  *                      It is computed with fps.
1384  * @return @c 0 on success, otherwise a negative error value
1385  * @retval #RECORDER_ERROR_NONE Successful
1386  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1387  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1388  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1389  * @see recorder_attr_set_recording_motion_rate()
1390  */
1391 int recorder_attr_get_recording_motion_rate(recorder_h recorder , double *rate);
1392
1393 /**
1394  * @brief Sets the number of the audio channel.
1395  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1396  * @remarks This attribute is applied only in RECORDER_STATE_CREATED state. \n
1397  *          For mono recording, setting channel to @c 1. \n
1398  *          For stereo recording, setting channel to @c 2.
1399  * @param[in] recorder       The handle to the media recorder
1400  * @param[in] channel_count  The number of the audio channel
1401  * @return @c 0 on success, otherwise a negative error value
1402  * @retval #RECORDER_ERROR_NONE Successful
1403  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1404  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1405  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1406  * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY (for video recorder only).\n
1407  *      Since 2.3.1, this API also works for audio recorder when its state is #RECORDER_STATE_READY.
1408  * @see recorder_attr_get_audio_channel()
1409  */
1410 int recorder_attr_set_audio_channel(recorder_h recorder, int channel_count);
1411
1412 /**
1413  * @brief Gets the number of the audio channel.
1414  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1415  * @param[in] recorder  The handle to the media recorder
1416  * @param[out] channel_count  The number of the audio channel
1417  * @return @c 0 on success, otherwise a negative error value
1418  * @retval #RECORDER_ERROR_NONE Successful
1419  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1420  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1421  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1422  * @see recorder_attr_set_audio_channel()
1423  */
1424 int recorder_attr_get_audio_channel(recorder_h recorder, int *channel_count);
1425
1426
1427 /**
1428  * @brief Sets the video orientation in a video metadata tag.
1429  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1430  * @param[in]   recorder        The handle to a media recorder
1431  * @param[in]   orientation     The information of the video orientation
1432  * @return @c 0 on success, otherwise a negative error value
1433  * @retval #RECORDER_ERROR_NONE Successful
1434  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1435  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1436  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1437  * @see recorder_attr_get_orientation_tag()
1438  */
1439 int recorder_attr_set_orientation_tag(recorder_h recorder,  recorder_rotation_e orientation);
1440
1441 /**
1442  * @brief Gets the video orientation in a video metadata tag.
1443  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1444  * @param[in]   recorder        The handle to a media recorder
1445  * @param[out]  orientation     The information of the video orientation
1446  * @return  @c 0 on success, otherwise a negative error value
1447  * @retval #RECORDER_ERROR_NONE Successful
1448  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1449  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1450  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1451  * @see recorder_attr_set_orientation_tag()
1452  */
1453 int recorder_attr_get_orientation_tag(recorder_h recorder, recorder_rotation_e *orientation);
1454
1455 /**
1456  * @}
1457  */
1458
1459 #ifdef __cplusplus
1460 }
1461 #endif
1462
1463 #endif /* __TIZEN_MULTIMEDIA_RECORDER_H__ */
1464