Add new sound policy type for call and alarm
[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
18
19 #ifndef __TIZEN_MULTIMEDIA_RECORDER_H__
20 #define __TIZEN_MULTIMEDIA_RECORDER_H__
21 #include <tizen.h>
22 #include <camera.h>
23 #include <audio_io.h>
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29 #define RECORDER_ERROR_CLASS        TIZEN_ERROR_MULTIMEDIA_CLASS | 0x10
30
31
32 /**
33  * @file recorder.h
34  * @brief This file contains the Recorder API.
35  */
36
37 /**
38  * @addtogroup CAPI_MEDIA_RECORDER_MODULE
39  * @{
40  */
41
42 /**
43  * @brief The handle to media recorder
44  */
45 typedef struct recorder_s *recorder_h;
46
47 /**
48  * @brief  Enumerations of error code for the media recorder.
49  */
50 typedef enum
51 {
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 */
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 */
61         RECORDER_ERROR_SOUND_POLICY_BY_ALARM = RECORDER_ERROR_CLASS | 0x09,     /**< Blocked by Audio Session Manager - ALARM */
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_e;
65
66 /**
67  * @brief Enumerations for camera states.
68  */
69 typedef enum
70 {
71         RECORDER_STATE_NONE,                            /**< Recorder is not created */
72         RECORDER_STATE_CREATED,                         /**< Recorder is created, but not prepared*/
73         RECORDER_STATE_READY,                       /**< Recorder is ready to record\n  In case of video recorder, preview display will be shown */
74         RECORDER_STATE_RECORDING,               /**< Recorder is recording media*/
75         RECORDER_STATE_PAUSED,                      /**< Recorder is paused while recording media*/
76 } recorder_state_e;
77
78 /**
79  * @brief Enumerations of recording limitation.
80  */
81 typedef enum
82 {
83         RECORDER_RECORDING_LIMIT_TIME,                  /**< Time limit (second) of recording file */
84         RECORDER_RECORDING_LIMIT_SIZE,                  /**< Size limit (kilo bytes [KB]) of recording file */
85         RECORDER_RECORDING_LIMIT_FREE_SPACE,    /**< No free space in storage  */
86 } recorder_recording_limit_type_e;
87
88 /**
89  * @brief Enumerations of file container format.
90  */
91 typedef enum
92 {
93         RECORDER_FILE_FORMAT_3GP,                     /**< 3GP file format */
94         RECORDER_FILE_FORMAT_MP4,                     /**< MP4 file format */
95         RECORDER_FILE_FORMAT_AMR,                     /**< AMR file format */
96         RECORDER_FILE_FORMAT_ADTS,                   /**< ADTS file format */
97         RECORDER_FILE_FORMAT_WAV,                    /**< WAV file format */
98         RECORDER_FILE_FORMAT_OGG,                    /**< OGG file format */
99 } recorder_file_format_e;
100
101
102 /**
103  * @brief Enumerations of audio codec.
104  */
105 typedef enum
106 {
107         RECORDER_AUDIO_CODEC_DISABLE = -1, /**< Disable audio track */
108         RECORDER_AUDIO_CODEC_AMR = 0,                   /**< AMR codec */
109         RECORDER_AUDIO_CODEC_AAC,                       /**< AAC codec */
110         RECORDER_AUDIO_CODEC_VORBIS,    /**< Vorbis codec */
111         RECORDER_AUDIO_CODEC_PCM                        /**< PCM codec */
112 } recorder_audio_codec_e;
113
114 /**
115  * @brief Enumerations of video codec.
116  */
117 typedef enum
118 {
119         RECORDER_VIDEO_CODEC_H263,                      /**< H263 codec */
120         RECORDER_VIDEO_CODEC_H264,                      /**< H264 codec */
121         RECORDER_VIDEO_CODEC_MPEG4,             /**< MPEG4 codec */
122         RECORDER_VIDEO_CODEC_THEORA             /**< Theora codec */
123 } recorder_video_codec_e;
124
125 /**
126  * @brief Enumerations of audio capture devices.
127  */
128 typedef enum
129 {
130         RECORDER_AUDIO_DEVICE_MIC,      /**< Mic device */
131         RECORDER_AUDIO_DEVICE_MODEM,    /**< Modem */
132 } recorder_audio_device_e;
133
134 /**
135  * @brief Enumerations of the recorder rotation type.
136  */
137 typedef enum
138 {
139         RECORDER_ROTATION_NONE, /**< No rotation */
140         RECORDER_ROTATION_90,           /**< 90 degree rotation */
141         RECORDER_ROTATION_180,  /**< 180 degree rotation */
142         RECORDER_ROTATION_270,  /**< 270 degree rotation */
143 } recorder_rotation_e;
144
145 /**
146  * @brief Enumerations of the recorder flip type.
147  */
148 typedef enum
149 {
150         RECORDER_FLIP_NONE, /**< No Flip */
151         RECORDER_FLIP_HORIZONTAL, /**< Horizontal flip */
152         RECORDER_FLIP_VERTICAL, /**< Vertical flip */
153         RECORDER_FLIP_BOTH /**< Horizontal and vertical flip */
154 } recorder_flip_e;
155
156
157 /**
158  * @brief Enumerations of the recorder policy.
159  */
160 typedef enum
161 {
162         RECORDER_POLICY_NONE = 0,       /**< None */
163         RECORDER_POLICY_SOUND,          /**< Sound policy */
164         RECORDER_POLICY_SOUND_BY_CALL,  /**< Sound policy by CALL */
165         RECORDER_POLICY_SOUND_BY_ALARM, /**< Sound policy by ALARM */
166         RECORDER_POLICY_SECURITY        /**< Security policy */
167 } recorder_policy_e;
168
169 /**
170  * @}
171 */
172
173 /**
174  * @addtogroup CAPI_MEDIA_RECORDER_MODULE
175  * @{
176  */
177
178 /**
179  * @brief  The callback function called when limitation error occurs while recording.
180  * @details The callback function is possible to receive three types of limits: time, size and no-space.
181  * @remarks After called it, recording data is discarded and not written in recording file. Also the state of recorder is not changed.
182  * @param[in] type              The limitation type
183  * @param[in] user_data The user data passed from the callback registration function
184  * @pre It is required to register a callback using recorder_set_recording_limit_reached_cb()
185  * @see recorder_set_recording_status_cb()
186  * @see recorder_set_recording_limit_reached_cb()
187  * @see recorder_unset_recording_limit_reached_cb()
188  */
189 typedef void (*recorder_recording_limit_reached_cb)(recorder_recording_limit_type_e type, void *user_data);
190
191
192 /**
193  * @brief  Callback function to indicate recording status
194  * @remarks This callback function is repeatedly invoked during #RECORDER_STATE_RECORDING state
195  * @param[in] elapsed_time      The time of recording (milliseconds)
196  * @param[in] file_size The size of recording file (KB)
197  * @param[in] user_data The user data passed from the callback registration function
198  * @pre recorder_start() will cause this callback if you register this callback using recorder_set_recording_status_cb()
199  * @see recorder_set_recording_status_cb()
200  * @see recorder_unset_recording_status_cb()
201  * @see recorder_start()
202  */
203 typedef void (*recorder_recording_status_cb)(unsigned long long elapsed_time, unsigned long long file_size, void *user_data);
204
205
206 /**
207  * @brief  Called when the record state has changed.
208  * @param[in] previous  The previous state of recorder
209  * @param[in] current   The current state of recorder
210  * @param[in] by_policy     @c true if the state is changed by policy, otherwise @c false
211  * @param[in] user_data The user data passed from the callback registration function
212  * @pre This function is required to register a callback using recorder_set_state_changed_cb()
213  * @see recorder_set_state_changed_cb()
214  * @see recorder_prepare()
215  * @see recorder_unprepare()
216  * @see recorder_start()
217  * @see recorder_pause()
218  * @see recorder_commit()
219  * @see recorder_cancel()
220  */
221 typedef void (*recorder_state_changed_cb)(recorder_state_e previous , recorder_state_e current , bool by_policy, void *user_data);
222
223 /**
224  * @brief       Called when the recorder interrupted by policy
225  *
226  * @param[in] policy                    The policy that interrupting the recorder
227  * @param[in] previous      The previous state of the recorder
228  * @param[in] current       The current state of the recorder
229  * @param[in] user_data     The user data passed from the callback registration function
230  * @see recorder_set_interrupted_cb()
231  */
232 typedef void (*recorder_interrupted_cb)(recorder_policy_e policy, recorder_state_e previous, recorder_state_e current, void *user_data);
233
234 /**
235  * @brief Called when audio stream data was delivering just before storing in record file.
236  * @remarks
237  * The callback function holds the same buffer that will be recorded.\n
238  * So if an user change the buffer, the result file will has the buffer.\n
239  * The callback is called via internal thread of Frameworks. so don't be invoke UI API, recorder_unprepare(), recorder_commit() and recorder_cancel() in callback.
240  *
241  * @param[in] stream The audio stream data
242  * @param[in] size The size of stream data
243  * @param[in] format The audio format
244  * @param[in] channel The number of channel
245  * @param[in] timestamp The timestamp of stream buffer( in msec )
246  * @param[in] user_data The user data passed from the callback registration function
247  *
248  * @see recorder_set_audio_stream_cb()
249  */
250 typedef void (*recorder_audio_stream_cb)(void* stream, int size, audio_sample_type_e format, int channel, unsigned int timestamp, void *user_data);
251
252 /**
253  * @brief       Called when the error occurred.
254  *
255  * @remarks
256  * This callback inform critical error situation.\n
257  * When invoked this callback, user should release the resource and terminate application.\n
258  * These error code will be occurred\n
259  * #RECORDER_ERROR_DEVICE\n
260  * #RECORDER_ERROR_INVALID_OPERATION\n
261  * #RECORDER_ERROR_OUT_OF_MEMORY\n
262  *
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  *
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 /**
279  * @addtogroup CAPI_MEDIA_RECORDER_CAPABILITY_MODULE
280  * @{
281  */
282
283 /**
284  * @brief Gets called iteratively to notify you of supported file formats. 
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 @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 /**
295  * @brief  Gets called iteratively to notify you of supported audio encoders.
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 @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 /**
306  * @brief  Gets called iteratively to notify you of supported video encoders.
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 @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  * @param[in]   camera  The handle to camera
327  * @param[out]  recorder        A handle to recorder
328  * @remarks @a recorder must be released with recorder_destroy() by you.\n
329  * The @a camera handle also could be used for capturing images.\n
330  * If camera state was CAMERA_STATE_CREATED, the preview format will be changed to the recommended preview format for recording.\n
331  * 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\n
335  * @return      0 on success, otherwise a negative error value.
336  * @retval #RECORDER_ERROR_NONE Successful
337  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
338  * @retval #RECORDER_ERROR_OUT_OF_MEMORY Out of memory
339  * @retval #RECORDER_ERROR_SOUND_POLICY Sound policy error
340  * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation
341  * @see camera_create()
342  * @see camera_stop_preview()
343  * @see recorder_destroy()
344  */
345 int recorder_create_videorecorder(camera_h camera, recorder_h *recorder);
346
347
348 /**
349  * @brief  Creates a recorder handle to record an audio.
350  * @remarks @a recorder must be released with recorder_destroy() by you 
351  * @param[out]  recorder        A handle to  recorder
352  * @return      0 on success, otherwise a negative error value.
353  * @retval #RECORDER_ERROR_NONE Successful
354  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
355  * @retval #RECORDER_ERROR_OUT_OF_MEMORY Out of memory
356  * @retval #RECORDER_ERROR_SOUND_POLICY Sound policy error
357  * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation
358  * @post The recorder state will be #RECORDER_STATE_CREATED.
359  * @see recorder_destroy()
360  */
361 int recorder_create_audiorecorder(recorder_h *recorder);
362
363
364 /**
365  * @brief  Destroys the recorder handle
366  * @remarks     Video recorder's camera handle is not release by this function.
367  * @param[in]   recorder    The handle to media recorder
368  * @return      0 on success, otherwise a negative error value.
369  * @retval #RECORDER_ERROR_NONE Successful
370  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
371  * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation
372  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
373  * @pre  The recorder state should be #RECORDER_STATE_CREATED
374  * @post The recorder state will be #RECORDER_STATE_NONE.
375  * @see camera_destroy()
376  * @see recorder_create_videorecorder()
377  * @see recorder_create_audiorecorder()
378  */
379 int recorder_destroy(recorder_h recorder);
380
381
382 /**
383  * @brief  Prepares the media recorder for recording
384  * @remarks     Before calling the function, it is required to set audio encoder (recorder_set_audio_encoder()),
385  * video encoder(recorder_set_video_encoder()), file format (recorder_set_file_format()) with proper value.
386  * @param[in]   recorder        The handle to media recorder
387  * @return      0 on success, otherwise a negative error value.
388  * @retval #RECORDER_ERROR_NONE Successful
389  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
390  * @retval #RECORDER_ERROR_SOUND_POLICY Sound policy error
391  * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation
392  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
393  * @pre  The recorder state should be #RECORDER_STATE_CREATED by recorder_create_videorecorder(), recorder_create_audiorecorder() or recorder_unprepare().
394  * @post The recorder state will be #RECORDER_STATE_READY.
395  * @post        If recorder handle is created by recorder_create_videorecorder(), it's camera state will be changed to #CAMERA_STATE_PREVIEW.
396  * @see recorder_create_videorecorder()
397  * @see recorder_create_audiorecorder() 
398  * @see recorder_unprepare()
399  * @see recorder_set_audio_encoder()
400  * @see         recorder_set_video_encoder()
401  * @see         recorder_set_file_format()
402  */
403 int recorder_prepare(recorder_h recorder);
404
405
406 /**
407  * @brief  Reset the media recorder.
408  * @param[in]   recorder    The handle to media recorder
409  * @return      0 on success, otherwise a negative error value.
410  * @retval #RECORDER_ERROR_NONE Successful
411  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
412  * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation
413  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
414  * @pre  The recorder state should be #RECORDER_STATE_READY by recorder_prepare(), recorder_cancel(),or recorder_commit().
415  * @post The recorder state will be #RECORDER_STATE_CREATED.
416  * @post        If recorder handle is created by recorder_create_videorecorder(), it's camera state will be changed to #CAMERA_STATE_CREATED.
417  * @see recorder_prepare()
418  * @see recorder_cancel()
419  * @see recorder_commit()
420  */
421 int recorder_unprepare(recorder_h recorder);
422
423
424 /**
425  * @brief  Starts recording
426  * @remarks If file path has been set to existing file, this file is removed automatically and updated by new one.\n
427  * In video recorder, some preview format is not supporting record mode. It will return #RECORDER_ERROR_INVALID_OPERATION error.\n
428  * You should use default preview format or #CAMERA_PIXEL_FORMAT_NV12 in record mode\n
429  * @param[in]   recorder        The handle to media recorder
430  * @return      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  * @pre The recorder state must be #RECORDER_STATE_READY by recorder_prepare() or #RECORDER_STATE_PAUSED by recorder_pause()
436  * @post The recorder state will be #RECORDER_STATE_RECORDING.
437  * @see recorder_pause()
438  * @see         recorder_commit()
439  * @see         recorder_cancel()
440  * @see         recorder_set_audio_encoder()
441  * @see         recorder_set_filename()
442  * @see         recorder_set_file_format()
443  * @see recorder_recording_status_cb()
444  */
445 int recorder_start(recorder_h recorder);
446
447
448 /**
449  * @brief  Pauses recording
450  * @remarks     Recording can be resumed with recorder_start().
451  * @param[in]   recorder        The handle to media recorder
452  * @return      0 on success, otherwise a negative error value.
453  * @retval #RECORDER_ERROR_NONE Successful
454  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
455  * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation
456  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
457  * @pre The recorder state must be #RECORDER_STATE_RECORDING
458  * @post The recorder state will be #RECORDER_STATE_PAUSED.
459  * @see recorder_pause()
460  * @see recorder_commit()
461  * @see recorder_cancel()
462  */
463 int recorder_pause(recorder_h recorder);
464
465
466 /**
467  * @brief  Stops recording and saving the result
468  * @param   [in]        recorder        The handle to media recorder
469  * @return      0 on success, otherwise a negative error value.
470  * @retval #RECORDER_ERROR_NONE Successful
471  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
472  * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation
473  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
474  * @pre The recorder state must be #RECORDER_STATE_RECORDING by recorder_start() or #RECORDER_STATE_PAUSED by recorder_pause()
475  * @post The recorder state will be #RECORDER_STATE_READY.
476  * @see recorder_pause()
477  * @see recorder_cancel()
478  * @see recorder_set_filename()
479  * @see recorder_start()
480  */
481 int recorder_commit(recorder_h recorder);
482
483
484 /**
485  * @brief  Cancels recording.
486  * @detail The recording data is discarded and not written in recording file.
487  * @param[in]   recorder    The handle to media recorder
488  * @return      0 on success, otherwise a negative error value
489  * @retval #RECORDER_ERROR_NONE Successful
490  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
491  * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation
492  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
493  * @pre The recorder state must be #RECORDER_STATE_RECORDING by recorder_start() or #RECORDER_STATE_PAUSED by recorder_pause()
494  * @post The recorder state will be #RECORDER_STATE_READY.
495  * @see recorder_pause()
496  * @see recorder_commit()
497  * @see recorder_cancel()
498  * @see recorder_start()
499  */
500 int recorder_cancel(recorder_h recorder);
501
502
503 /**
504  * @brief Gets the recorder's current state.
505  * @param[in]  recorder The handle to the recorder.
506  * @param[out]  state  The current state of the recorder
507  * @return  0 on success, otherwise a negative error value.
508  * @retval #RECORDER_ERROR_NONE Successful
509  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
510  */
511 int recorder_get_state(recorder_h recorder, recorder_state_e *state);
512
513 /**
514  * @brief Gets the peak audio input level that was sampled since the last call to this function.
515  * @remarks 0 dB indicates maximum input level, -300dB indicates minimum input level
516  * @param[in]  recorder The handle to the recorder.
517  * @param[out]  level  The audio input level in dB
518  * @return  0 on success, otherwise a negative error value.
519  * @retval #RECORDER_ERROR_NONE Successful
520  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
521  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
522  * @pre The recorder state must be #RECORDER_STATE_RECORDING or #RECORDER_STATE_PAUSED
523  */
524 int recorder_get_audio_level(recorder_h recorder, double *dB);
525
526 /**
527  * @brief  Sets the file path to record
528  * @details This function sets file path which defines where newly recorder data should be stored. 
529  * @remarks     If there is already exists same file in file system, then old file will be overwritten.
530  * @param[in]   recorder        The handle to media recorder
531  * @param[in]   path The recording file path
532  * @return      0 on success, otherwise a negative error value.
533  * @retval #RECORDER_ERROR_NONE Successful
534  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
535  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
536  * @pre The recorder state must be #RECORDER_STATE_CREATED by recorder_create() or recorder_unprepare()
537  * @see recorder_get_filename()
538  */
539 int recorder_set_filename(recorder_h recorder, const char *path);
540
541
542 /**
543  * @brief  Gets the file path to record
544  * @remarks  @a path must be released with @c free() by you.
545  * @param[in]   recorder    The handle to media recorder
546  * @param[out]  path    The recording file path
547  * @return      0 on success, otherwise a negative error value.
548  * @retval #RECORDER_ERROR_NONE Successful
549  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
550  * @see recorder_set_filename()
551  */
552 int recorder_get_filename(recorder_h recorder, char **path);
553
554
555 /**
556  * @brief  Sets the file format for recording media stream
557  * @param[in] recorder The handle to media recorder
558  * @param[in] format   The media file format
559  * @return      0 on success, otherwise a negative error value.
560  * @retval #RECORDER_ERROR_NONE Successful
561  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
562  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
563  * @pre The recorder state must be #RECORDER_STATE_CREATED
564  * @see recorder_get_file_format()
565  * @see recorder_foreach_supported_file_format()
566  */
567 int recorder_set_file_format(recorder_h recorder, recorder_file_format_e format);
568
569
570 /**
571  * @brief  Gets the file format for recording media stream
572  * @param [in] recorder The handle to media recorder
573  * @param [in] format   The media file format
574  * @return      0 on success, otherwise a negative error value.
575  * @retval #RECORDER_ERROR_NONE Successful
576  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
577  * @see recorder_set_file_format()
578  * @see recorder_foreach_supported_file_format()
579  */
580 int recorder_get_file_format(recorder_h recorder, recorder_file_format_e *format);
581
582
583  /**
584  * @}
585 */
586
587 /**
588  * @addtogroup CAPI_MEDIA_RECORDER_CAPABILITY_MODULE
589  * @{
590  */
591
592 /**
593  * @brief  Retrieves all supported file formats by invoking a specific callback for each supported file format
594  * @param[in] recorder  The handle to media recorder
595  * @param[in] callback The iteration callback
596  * @param[in] user_data The user data to be passed to the callback function
597  * @return      0 on success, otherwise a negative error value.
598  * @retval #RECORDER_ERROR_NONE Successful
599  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
600  * @post  recorder_supported_file_format_cb() will be invoked
601  * @see recorder_get_file_format()
602  * @see recorder_set_file_format()
603  * @see recorder_supported_file_format_cb()
604  */
605 int recorder_foreach_supported_file_format(recorder_h recorder, recorder_supported_file_format_cb callback, void *user_data);
606
607 /**
608  * @}
609 */
610
611 /**
612  * @addtogroup CAPI_MEDIA_RECORDER_MODULE
613  * @{
614  */
615
616 /**
617  * @brief  Sets the audio codec for encoding audio stream
618  * @remarks You can get available audio encoders by using recorder_foreach_supported_audio_encoder().\n
619  * if set to RECORDER_AUDIO_CODEC_DISABLE, audio track is not created in recording files.
620  * @param[in] recorder The handle to media recorder
621  * @param[in] codec    The audio codec
622  * @return      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  * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY
627  * @see recorder_get_audio_encoder()
628  * @see recorder_foreach_supported_audio_encoder()
629  */
630 int recorder_set_audio_encoder(recorder_h recorder, recorder_audio_codec_e codec);
631
632
633 /**
634  * @brief  Gets the audio codec for encoding audio stream
635  * @param [in] recorder The handle to media recorder
636  * @param [out] codec   The audio codec
637  * @return      0 on success, otherwise a negative error value.
638  * @retval #RECORDER_ERROR_NONE Successful
639  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
640  * @see recorder_set_audio_encoder()
641  * @see recorder_foreach_supported_audio_encoder()
642  */
643 int recorder_get_audio_encoder(recorder_h recorder, recorder_audio_codec_e *codec);
644
645  /**
646  * @}
647 */
648
649 /**
650  * @addtogroup CAPI_MEDIA_RECORDER_CAPABILITY_MODULE
651  * @{
652  */
653
654 /**
655  * @brief  Retrieves all supported audio encoders by invoking a specific callback for each supported audio encoder.
656  * @param[in] recorder  The handle to media recorder
657  * @param[in] callback  The iteration callback
658  * @param[in] user_data The user data to be passed to the callback function
659  * @return      0 on success, otherwise a negative error value.
660  * @retval #RECORDER_ERROR_NONE Successful
661  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
662  * @post  recorder_supported_audio_encoder_cb() will be invoked
663  * @see recorder_set_audio_encoder()
664  * @see recorder_get_audio_encoder()
665  * @see recorder_supported_audio_encoder_cb()
666  */
667 int recorder_foreach_supported_audio_encoder(recorder_h recorder, recorder_supported_audio_encoder_cb callback, void *user_data);
668
669 /**
670  * @}
671 */
672
673 /**
674  * @addtogroup CAPI_MEDIA_RECORDER_MODULE
675  * @{
676  */
677
678 /**
679  * @brief  Sets the video codec for encoding video stream.
680  * @remarks You can get available video encoders by using recorder_foreach_supported_video_encoder().
681  * @param[in] recorder The handle to media recorder
682  * @param[in] codec    The video codec
683  * @return      0 on success, otherwise a negative error value.
684  * @retval #RECORDER_ERROR_NONE Successful
685  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
686  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
687  * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY
688  * @see recorder_get_video_encoder()
689  * @see recorder_foreach_supported_video_encoder()
690  */
691 int recorder_set_video_encoder(recorder_h recorder, recorder_video_codec_e codec);
692
693
694 /**
695  * @brief  Gets the video codec for encoding video stream.
696  * @param[in] recorder The handle to media recorder
697  * @param[out] codec   The video codec
698  * @return      0 on success, otherwise a negative error value.
699  * @retval #RECORDER_ERROR_NONE Successful
700  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
701  * @see recorder_set_video_encoder()
702  * @see recorder_foreach_supported_video_encoder()
703  */
704 int recorder_get_video_encoder(recorder_h recorder, recorder_video_codec_e *codec);
705
706 /**
707  * @}
708 */
709
710 /**
711  * @addtogroup CAPI_MEDIA_RECORDER_CAPABILITY_MODULE
712  * @{
713  */
714
715 /**
716  * @brief  Retrieves all supported video encoders by invoking a specific callback for each supported video encoder.
717  * @param[in] recorder  The handle to media recorder
718  * @param[in] callback  The iteration callback
719  * @param[in] user_data The user data to be passed to the callback function
720  * @return      0 on success, otherwise a negative error value.
721  * @retval #RECORDER_ERROR_NONE Successful
722  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
723  * @post  recorder_supported_video_encoder_cb() will be invoked
724  * @see recorder_set_video_encoder()
725  * @see recorder_get_video_encoder()
726  * @see recorder_supported_video_encoder_cb()
727  */
728 int recorder_foreach_supported_video_encoder(recorder_h recorder, recorder_supported_video_encoder_cb callback, void *user_data);
729
730  /**
731  * @}
732 */
733
734 /**
735  * @addtogroup CAPI_MEDIA_RECORDER_MODULE
736  * @{
737  */
738
739 /**
740  * @brief  Registers the callback function that will be invoked when the recorder state changes.
741  * @param[in] recorder  The handle to the recorder.
742  * @param[in] callback  The function pointer of user callback
743  * @param[in] user_data The user data to be passed to the callback function
744  * @return      0 on success, otherwise a negative error value.
745  * @retval #RECORDER_ERROR_NONE Successful
746  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
747  * @post  recorder_state_changed_cb() will be invoked
748  * @see recorder_unset_state_changed_cb()
749  * @see recorder_state_changed_cb()
750  */
751 int recorder_set_state_changed_cb(recorder_h recorder, recorder_state_changed_cb callback, void *user_data);
752
753
754 /**
755  * @brief  Unregisters the callback function.
756  * @param[in]  recorder The handle to the recorder.
757  * @return      0 on success, otherwise a negative error value.
758  * @retval #RECORDER_ERROR_NONE Successful
759  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
760  * @see recorder_set_state_changed_cb()
761  */
762 int recorder_unset_state_changed_cb(recorder_h recorder);
763
764 /**
765  * @brief       Registers a callback function to be called when recorder interrupted by policy.
766  *
767  * @param[in] recorder  The handle to the recorder
768  * @param[in] callback    The callback function to register
769  * @param[in] user_data   The user data to be passed to the callback function
770  *
771  * @return        0 on success, otherwise a negative error value.
772  * @retval    #RECORDER_ERROR_NONE Successful
773  * @retval    #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
774  *
775  * @see recorder_unset_interrupted_cb()
776  * @see recorder_interrupted_cb()
777  */
778 int recorder_set_interrupted_cb(recorder_h recorder, recorder_interrupted_cb callback,
779             void *user_data);
780
781 /**
782  * @brief       Unregisters the callback function.
783  *
784  * @param[in]   recorder        The handle to the recorder
785  * @return        0 on success, otherwise a negative error value.
786  * @retval    #RECORDER_ERROR_NONE Successful
787  * @retval    #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
788  *
789  * @see     recorder_set_interrupted_cb()
790  */
791 int recorder_unset_interrupted_cb(recorder_h recorder);
792
793 /**
794  * @brief       Registers a callback function to be called when audio stream data was delivering
795  *
796  * @remarks
797  * This callback function holds the same buffer that will be recorded.\n
798  * So if an user change the buffer, the result file will has the buffer.\n
799  * The callback is called via internal thread of Frameworks. so don't be invoke UI API, recorder_unprepare(), recorder_commit() and recorder_cancel() in callback.\n
800  * This callback function to be called in RECORDER_STATE_RECORDING and RECORDER_STATE_PAUSE state.
801  *
802  * @param[in] recorder  The handle to the recorder
803  * @param[in] callback    The callback function to register
804  * @param[in] user_data   The user data to be passed to the callback function
805  *
806  * @return        0 on success, otherwise a negative error value.
807  * @retval    #RECORDER_ERROR_NONE Successful
808  * @retval    #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
809  * @pre         The recorder state should be #RECORDER_STATE_READY or #RECORDER_STATE_CREATED.
810  *
811  * @see recorder_unset_audio_stream_cb()
812  * @see recorder_audio_stream_cb()
813  */
814 int recorder_set_audio_stream_cb(recorder_h recorder, recorder_audio_stream_cb callback, void* user_data);
815
816 /**
817  * @brief       Unregisters the callback function.
818  *
819  * @param[in]   recorder        The handle to the recorder
820  * @return        0 on success, otherwise a negative error value.
821  * @retval    #RECORDER_ERROR_NONE Successful
822  * @retval    #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
823  *
824  * @see     recorder_set_audio_stream_cb()
825  */
826 int recorder_unset_audio_stream_cb(recorder_h recorder);
827
828
829 /**
830  * @brief  Registers a callback function to be invoked when the recording information changes.
831  * @param[in]   recorder    The handle to media recorder
832  * @param[in]   callback        The function pointer of user callback
833  * @param[in]   user_data       The user data to be passed to the callback function
834  * @return      0 on success, otherwise a negative error value.
835  * @retval #RECORDER_ERROR_NONE Successful
836  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
837  * @post  recorder_recording_status_cb() will be invoked
838  * @see recorder_unset_recording_status_cb()
839  * @see recorder_recording_status_cb()
840  */
841 int recorder_set_recording_status_cb(recorder_h recorder, recorder_recording_status_cb callback, void *user_data);
842
843
844 /**
845  * @brief Unregisters the callback function.
846  * @param[in]   recorder    The handle to media recorder
847  * @return      0 on success, otherwise a negative error value.
848  * @retval #RECORDER_ERROR_NONE Successful
849  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
850  * @see recorder_set_recording_status_cb()
851  */
852 int recorder_unset_recording_status_cb(recorder_h recorder);
853
854
855 /**
856  * @brief  Registers the callback function to run when reached recording limit.
857  * @param[in]   recorder        The handle to media recorder
858  * @param[in]   callback        The function pointer of user callback
859  * @param[in]   user_data       The user data to be passed to the callback function
860  * @return      0 on success, otherwise a negative error value.
861  * @retval #RECORDER_ERROR_NONE Successful
862  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
863  * @post  recorder_recording_limit_reached_cb() will be invoked
864  * @see recorder_unset_recording_limit_reached_cb()
865  * @see recorder_attr_set_size_limit()
866  * @see recorder_attr_set_time_limit()
867  * @see recorder_recording_limit_reached_cb()
868  */
869 int recorder_set_recording_limit_reached_cb(recorder_h recorder, recorder_recording_limit_reached_cb callback, void *user_data);
870
871
872 /**
873  * @brief  Unregisters the callback function.
874  * @param[in]   recorder        The handle to media recorder
875  * @return      0 on success, otherwise a negative error value.
876  * @retval #RECORDER_ERROR_NONE Successful
877  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
878  * @see recorder_set_recording_limit_reached_cb()
879  */
880 int recorder_unset_recording_limit_reached_cb(recorder_h recorder);
881
882
883 /**
884  * @brief       Registers a callback function to be called when an asynchronous operation error occurred.
885  *
886  * @remarks
887  * This callback inform critical error situation.\n
888  * When invoked this callback, user should release the resource and terminate application.\n
889  * These error code will be occurred\n
890  * #RECORDER_ERROR_DEVICE\n
891  * #RECORDER_ERROR_INVALID_OPERATION\n
892  * #RECORDER_ERROR_OUT_OF_MEMORY\n
893  *
894  * @param[in]   recorder        The handle to the recorder
895  * @param[in]   callback        The callback function to register
896  * @param[in]   user_data       The user data to be passed to the callback function
897  * @return        0 on success, otherwise a negative error value.
898  * @retval    #RECORDER_ERROR_NONE Successful
899  * @retval    #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
900  * @post        This function will invoke recorder_error_cb() when an asynchronous operation error occur.
901  *
902  * @see recorder_unset_error_cb()
903  * @see recorder_error_cb()
904  */
905 int recorder_set_error_cb(recorder_h recorder, recorder_error_cb callback, void *user_data);
906
907
908 /**
909  * @brief       Unregisters the callback function.
910  *
911  * @param[in]   recorder        The handle to the recorder
912  * @return        0 on success, otherwise a negative error value.
913  * @retval    #RECORDER_ERROR_NONE Successful
914  * @retval    #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
915  *
916  * @see recorder_set_error_cb()
917  */
918 int recorder_unset_error_cb(recorder_h recorder);
919
920
921 /**
922  * @}
923  */
924
925 /**
926  * @addtogroup CAPI_MEDIA_RECORDER_ATTRIBUTES_MODULE
927  * @{
928  */
929
930
931 /**
932  * @brief  Sets maximum size of recording file.
933  * @remarks     After reached limitation, recording data is discarded and not written in recording file.
934  * @param[in] recorder The handle to media recorder
935  * @param[in] kbyte The maximum size of recording file(KB)\n @c 0 means unlimited recording size.
936  * @return      0 on success, otherwise a negative error value.
937  * @retval #RECORDER_ERROR_NONE Successful
938  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
939  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
940  * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY
941  * @see recorder_attr_get_size_limit()
942  * @see recorder_attr_set_time_limit()
943  */
944 int recorder_attr_set_size_limit(recorder_h recorder, int kbyte);
945
946
947 /**
948  * @brief  Gets the maximum size of recording file.
949  * @param[in] recorder The handle to media recorder
950  * @param[out] kbyte   The maximum size of recording file (KB)\n @c 0 means unlimited recording size
951  * @return      0 on success, otherwise a negative error value.
952  * @retval #RECORDER_ERROR_NONE Successful
953  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
954  * @see recorder_attr_set_size_limit()
955  * @see recorder_attr_get_time_limit()
956  */
957 int recorder_attr_get_size_limit(recorder_h recorder, int *kbyte);
958
959
960 /**
961  * @brief  Sets time limit of recording file.
962  * @remarks     After reached limitation, recording data is discarded and not written in recording file.
963  * @param[in] recorder The handle to media recorder
964  * @param[in] second   The time limit of recording file (in seconds) \n @c 0 means unlimited recording size
965  * @return      0 on success, otherwise a negative error value.
966  * @retval #RECORDER_ERROR_NONE Successful
967  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
968  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
969  * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY
970  * @see recorder_attr_get_time_limit()
971  * @see recorder_attr_set_size_limit()
972  */
973 int recorder_attr_set_time_limit(recorder_h recorder, int second);
974
975
976 /**
977  * @brief  Gets the time limit of recording file
978  * @param[in] recorder  The handle to media recorder
979  * @param[out] second   The time limit of recording file (in seconds)\n  @c 0 means unlimited recording time.
980  * @return      0 on success, otherwise a negative error value.
981  * @retval #RECORDER_ERROR_NONE Successful
982  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
983  * @see recorder_attr_set_time_limit()
984  * @see recorder_attr_get_size_limit()
985  */
986 int recorder_attr_get_time_limit(recorder_h recorder, int *second);
987
988
989 /**
990  * @brief  Sets audio device for recording.
991  * @param[in] recorder The handle to media recorder
992  * @param[in] device   The type of audio device
993  * @return      0 on success, otherwise a negative error value.
994  * @retval #RECORDER_ERROR_NONE Successful
995  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
996  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
997  * @pre The recorder state must be #RECORDER_STATE_CREATED
998  * @see recorder_attr_get_audio_device()
999  */
1000 int recorder_attr_set_audio_device(recorder_h recorder, recorder_audio_device_e device);
1001
1002
1003 /**
1004  * @brief Gets the audio device for recording.
1005  * @param[in] recorder  The handle to media recorder
1006  * @param[out] device The type of audio device
1007  * @return      0 on success, otherwise a negative error value.
1008  * @retval #RECORDER_ERROR_NONE Successful
1009  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1010  * @see recorder_attr_set_audio_device()
1011  */
1012 int recorder_attr_get_audio_device(recorder_h recorder, recorder_audio_device_e *device);
1013
1014
1015 /**
1016  * @brief  Sets sampling rate of audio stream.
1017  * @param[in] recorder  The handle to media recorder
1018  * @param[in] samplerate The sample rate in Hertz
1019  * @return      0 on success, otherwise a negative error value.
1020  * @retval #RECORDER_ERROR_NONE Successful
1021  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1022  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
1023  * @pre The recorder state must be #RECORDER_STATE_CREATED
1024  * @see recorder_attr_get_audio_samplerate()
1025  */
1026 int recorder_attr_set_audio_samplerate(recorder_h recorder, int samplerate);
1027
1028
1029 /**
1030  * @brief  Gets the sampling rate of audio stream.
1031  * @param[in] recorder The handle to media recorder
1032  * @param[out] samplerate  The sample rate in Hertz
1033  * @return      0 on success, otherwise a negative error value.
1034  * @retval #RECORDER_ERROR_NONE Successful
1035  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1036  * @see recorder_attr_set_audio_samplerate()
1037  */
1038 int recorder_attr_get_audio_samplerate(recorder_h recorder, int *samplerate);
1039
1040
1041 /**
1042  * @brief  Sets the bitrate of audio encoder.
1043  * @param[in] recorder  The handle to media recorder
1044  * @param[in] bitrate   The bitrate (for mms : 12200[bps], normal : 288000[bps])
1045  * @return      0 on success, otherwise a negative error value.
1046  * @retval #RECORDER_ERROR_NONE Successful
1047  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1048  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
1049  * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY
1050  * @see recorder_attr_get_audio_encoder_bitrate()
1051  */
1052 int recorder_attr_set_audio_encoder_bitrate(recorder_h recorder, int bitrate);
1053
1054
1055 /**
1056  * @brief  Sets bitrate of video encoder.
1057  * @param[in] recorder  The handle to media recorder
1058  * @param[in] bitrate   The bitrate in bits per second
1059  * @return      0 on success, otherwise a negative error value.
1060  * @retval #RECORDER_ERROR_NONE Successful
1061  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1062  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
1063  * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY
1064  * @see recorder_attr_get_video_encoder_bitrate()
1065  */
1066 int recorder_attr_set_video_encoder_bitrate(recorder_h recorder, int bitrate);
1067
1068
1069 /**
1070  * @brief  Gets the bitrate of audio encoder.
1071  * @param[in] recorder  The handle to media recorder
1072  * @param[out] bitrate  The bitrate in bits per second
1073  * @return      0 on success, otherwise a negative error value.
1074  * @retval #RECORDER_ERROR_NONE Successful
1075  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1076  * @see recorder_attr_set_audio_encoder_bitrate()
1077  */
1078 int recorder_attr_get_audio_encoder_bitrate(recorder_h recorder, int *bitrate);
1079
1080
1081 /**
1082  * @brief  Gets the bitrate of video encoder.
1083  * @param[in] recorder The handle to media recorder
1084  * @param[out] bitrate The bitrate in bits per second
1085  * @return      0 on success, otherwise a negative error value.
1086  * @retval #RECORDER_ERROR_NONE Successful
1087  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1088  * @see recorder_attr_set_audio_encoder_bitrate()
1089  */
1090 int recorder_attr_get_video_encoder_bitrate(recorder_h recorder, int *bitrate);
1091
1092
1093
1094 /**
1095  * @brief  Sets the mute state of recorder
1096  * @param[in] recorder The handle to media recorder
1097  * @param[in] enable The mute state
1098  * @return      0 on success, otherwise a negative error value.
1099  * @retval #RECORDER_ERROR_NONE Successful
1100  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1101  * @see recorder_attr_is_muted()
1102  */
1103 int recorder_attr_set_mute(recorder_h recorder, bool enable);
1104
1105 /**
1106  * @brief  Gets the mute state of recorder
1107  * @param[in] recorder The handle to media recorder
1108  * @return      true if the recorder is not recording any sound,\nelse false
1109  * @see recorder_attr_set_mute()
1110  */
1111 bool recorder_attr_is_muted(recorder_h recorder);
1112
1113 /**
1114  * @brief  Sets recording motion rate
1115  * @remarks
1116  * This attribute is valid only in video recorder.\n
1117  * If the rate bigger than 0 and smaller than 1, video is recorded slow motion mode.\n
1118  * If the rate bigger than 1, video is recorded fast motion mode(time lapse recording).
1119  * Audio data is not recorded.\n
1120  * To reset slow motion recording, setting rate to 1.
1121  * @param[in] recorder The handle to media recorder
1122  * @param[in] rate The recording motion rate. it is computed with fps. (0<rate<1 for slow motion, 1<rate for fast motion(time lapse recording), 1 to reset )
1123  * @return      0 on success, otherwise a negative error value.
1124  * @retval #RECORDER_ERROR_NONE Successful
1125  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1126  * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY
1127  * @see recorder_attr_get_recording_motion_rate()
1128  */
1129 int recorder_attr_set_recording_motion_rate(recorder_h recorder , double rate);
1130
1131 /**
1132  * @brief  Gets the recording motion rate
1133  * @remarks
1134  * This attribute is valid only in video recorder.\n
1135  * If the rate bigger than 0 and smaller than 1, video is recorded slow motion mode.\n
1136  * If the rate bigger than 1, video is recorded fast motion mode(time lapse recording).
1137  * Audio data is not recorded.\n
1138  * To reset slow motion recording, setting rate to 1.
1139  * @param[in] recorder The handle to media recorder
1140  * @param[out] rate The recording motion rate. it is computed with fps.
1141  * @return      0 on success, otherwise a negative error value.
1142  * @retval #RECORDER_ERROR_NONE Successful
1143  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1144  * @see recorder_attr_set_recording_motion_rate()
1145  */
1146 int recorder_attr_get_recording_motion_rate(recorder_h recorder , double *rate);
1147
1148 __attribute__ ((deprecated)) int recorder_attr_set_slow_motion_rate(recorder_h recorder , double rate);
1149 __attribute__ ((deprecated)) int recorder_attr_get_slow_motion_rate(recorder_h recorder , double *rate);
1150
1151 /**
1152  * @brief  Sets the numer of audio channel.
1153  * @remarks This attribute is applied only in RECORDER_STATE_CREATED state.\n
1154  * For mono recording, setting channel to 1.\n
1155  * For stereo recording, setting channel to 2.
1156  * @param[in] recorder  The handle to media recorder
1157  * @param[in] channel_count The number of audio channel
1158  * @return      0 on success, otherwise a negative error value.
1159  * @retval #RECORDER_ERROR_NONE Successful
1160  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1161  * @pre The recorder state must be #RECORDER_STATE_CREATED
1162  * @see recorder_attr_get_audio_channel()
1163  */
1164 int recorder_attr_set_audio_channel(recorder_h recorder, int channel_count);
1165
1166 /**
1167  * @brief  Gets the numer of audio channel.
1168  * @param[in] recorder  The handle to media recorder
1169  * @param[out] channel_count The number of audio channel
1170  * @return      0 on success, otherwise a negative error value.
1171  * @retval #RECORDER_ERROR_NONE Successful
1172  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1173  * @see recorder_attr_set_audio_channel()
1174  */
1175 int recorder_attr_get_audio_channel(recorder_h recorder, int *channel_count);
1176
1177 /**
1178  * @brief Sets the orientation of video recording data
1179  * @remarks
1180  * This attribute is valid only in video recorder.\n
1181  * This attribute is applied in video encoding.
1182  * @param[in] recorder  The handle to media recorder
1183  * @param[in] orientation The orientation of video recording data
1184  * @return      0 on success, otherwise a negative error value.
1185  * @retval #RECORDER_ERROR_NONE Successful
1186  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1187  * @see recorder_attr_get_recording_orientation()
1188  */
1189 int recorder_attr_set_recording_orientation(recorder_h recorder, recorder_rotation_e orientation);
1190
1191 /**
1192  * @brief Gets the orientation of video recording data
1193  * @remarks
1194  * This attribute is valid only in video recorder.\n
1195  * @param[in] recorder  The handle to media recorder
1196  * @param[out] orientation The orientation of video recording data
1197  * @return      0 on success, otherwise a negative error value.
1198  * @retval #RECORDER_ERROR_NONE Successful
1199  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1200  * @see recorder_attr_set_recording_orientation()
1201  */
1202 int recorder_attr_get_recording_orientation(recorder_h recorder, recorder_rotation_e *orientation);
1203
1204 /**
1205  * @brief Sets the flip of video recording data
1206  * @remarks
1207  * This attribute is valid only in video recorder.\n
1208  * This attribute is applied in video encoding.
1209  * @param[in] recorder  The handle to media recorder
1210  * @param[in] flip The flip of video recording data
1211  * @return      0 on success, otherwise a negative error value.
1212  * @retval #RECORDER_ERROR_NONE Successful
1213  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1214  * @see recorder_attr_get_recording_flip()
1215  */
1216 int recorder_attr_set_recording_flip(recorder_h recorder, recorder_flip_e flip);
1217
1218 /**
1219  * @brief Gets the flip of video recording data
1220  * @remarks
1221  * This attribute is valid only in video recorder.\n
1222  * This attribute is applied in video encoding.
1223  * @param[in] recorder  The handle to media recorder
1224  * @param[out] flip The flip of video recording data
1225  * @return      0 on success, otherwise a negative error value.
1226  * @retval #RECORDER_ERROR_NONE Successful
1227  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1228  * @see recorder_attr_set_recording_flip()
1229  */
1230 int recorder_attr_get_recording_flip(recorder_h recorder, recorder_flip_e *flip);
1231
1232 /**
1233  * @brief Sets the camera orientation in video metadata tag.
1234  *
1235  * @param[in]   camera  The handle to the camera
1236  * @param[in]   orientation The information of the video orientation
1237  * @return      0 on success, otherwise a negative error value.
1238  * @retval      #CAMERA_ERROR_NONE Successful
1239  * @retval      #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
1240  *
1241  * @see recorder_attr_get_orientation_tag()
1242  */
1243 int recorder_attr_set_orientation_tag(recorder_h recorder,  recorder_rotation_e orientation);
1244
1245 /**
1246  * @brief Gets the camera orientation in video metadata tag.
1247  *
1248  * @param[in]   camera  The handle to the camera
1249  * @param[out]  orientation The information of the video orientation
1250  * @return      0 on success, otherwise a negative error value.
1251  * @retval      #CAMERA_ERROR_NONE Successful
1252  * @retval      #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
1253  *
1254  * @see recorder_attr_set_orientation_tag()
1255  */
1256 int recorder_attr_get_orientation_tag(recorder_h recorder, recorder_rotation_e *orientation);
1257
1258 /**
1259  * @}
1260  */
1261
1262 #ifdef __cplusplus
1263 }
1264 #endif
1265
1266 #endif /* __TIZEN_MULTIMEDIA_RECORDER_H__ */
1267