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