recorder.h: Remove profile check for supported platform version
[platform/core/api/recorder.git] / include / recorder.h
1 /*
2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #ifndef __TIZEN_MULTIMEDIA_RECORDER_H__
18 #define __TIZEN_MULTIMEDIA_RECORDER_H__
19 #include <tizen.h>
20 #include <camera.h>
21 #include <audio_io.h>
22 #include <sound_manager.h>
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28 #define RECORDER_ERROR_CLASS        TIZEN_ERROR_RECORDER | 0x10
29
30 /**
31  * @file recorder.h
32  * @brief This file contains the Recorder API.
33  * @since_tizen 2.3
34  */
35
36 /**
37  * @addtogroup CAPI_MEDIA_RECORDER_MODULE
38  * @{
39  */
40
41 /**
42  * @brief The Media recorder handle.
43  * @since_tizen 2.3
44  */
45 typedef struct recorder_s *recorder_h;
46
47 /**
48  * @brief Enumeration for error code of the media recorder.
49  * @since_tizen 2.3
50  */
51 typedef enum {
52         RECORDER_ERROR_NONE                  = TIZEN_ERROR_NONE,                /**< Successful */
53         RECORDER_ERROR_INVALID_PARAMETER     = TIZEN_ERROR_INVALID_PARAMETER,   /**< Invalid parameter */
54         RECORDER_ERROR_INVALID_STATE         = RECORDER_ERROR_CLASS | 0x02,     /**< Invalid state */
55         RECORDER_ERROR_OUT_OF_MEMORY         = TIZEN_ERROR_OUT_OF_MEMORY ,      /**< Out of memory */
56         RECORDER_ERROR_DEVICE                = RECORDER_ERROR_CLASS | 0x04,     /**< Device error */
57         RECORDER_ERROR_INVALID_OPERATION     = TIZEN_ERROR_INVALID_OPERATION,   /**< Internal error */
58         RECORDER_ERROR_SECURITY_RESTRICTED   = RECORDER_ERROR_CLASS | 0x07,     /**< Restricted by security system policy */
59         RECORDER_ERROR_ESD                   = RECORDER_ERROR_CLASS | 0x0a,     /**< ESD situation */
60         RECORDER_ERROR_OUT_OF_STORAGE        = RECORDER_ERROR_CLASS | 0x0b,     /**< Out of storage */
61         RECORDER_ERROR_PERMISSION_DENIED     = TIZEN_ERROR_PERMISSION_DENIED,   /**< The access to the resources can not be granted */
62         RECORDER_ERROR_NOT_SUPPORTED         = TIZEN_ERROR_NOT_SUPPORTED,       /**< The feature is not supported */
63         RECORDER_ERROR_RESOURCE_CONFLICT     = RECORDER_ERROR_CLASS | 0x0c,     /**< Blocked by resource conflict (Since 3.0) */
64         RECORDER_ERROR_SERVICE_DISCONNECTED  = RECORDER_ERROR_CLASS | 0x0d,     /**< Socket connection lost (Since 3.0) */
65 } recorder_error_e;
66
67 /**
68  * @brief Enumeration for recorder states.
69  * @since_tizen 2.3
70  */
71 typedef enum {
72         RECORDER_STATE_NONE,      /**< Recorder is not created */
73         RECORDER_STATE_CREATED,   /**< Recorder is created, but not prepared */
74         RECORDER_STATE_READY,     /**< Recorder is ready to record \n In case of video recorder, preview display will be shown */
75         RECORDER_STATE_RECORDING, /**< Recorder is recording media */
76         RECORDER_STATE_PAUSED,    /**< Recorder is paused while recording media */
77 } recorder_state_e;
78
79 /**
80  * @brief Enumeration for the recording limit.
81  * @since_tizen 2.3
82  */
83 typedef enum {
84         RECORDER_RECORDING_LIMIT_TIME,        /**< Time limit (second) of recording file */
85         RECORDER_RECORDING_LIMIT_SIZE,        /**< Size limit (kilo bytes [KB]) of recording file */
86         RECORDER_RECORDING_LIMIT_FREE_SPACE,  /**< No free space in storage */
87 } recorder_recording_limit_type_e;
88
89 /**
90  * @brief Enumeration for the file container format.
91  * @since_tizen 2.3
92  */
93 typedef enum {
94         RECORDER_FILE_FORMAT_3GP,    /**< 3GP file format */
95         RECORDER_FILE_FORMAT_MP4,    /**< MP4 file format */
96         RECORDER_FILE_FORMAT_AMR,    /**< AMR file format */
97         RECORDER_FILE_FORMAT_ADTS,   /**< ADTS file format */
98         RECORDER_FILE_FORMAT_WAV,    /**< WAV file format */
99         RECORDER_FILE_FORMAT_OGG,    /**< OGG file format */
100         RECORDER_FILE_FORMAT_M2TS    /**< MPEG2-TransportStream file format (Since 3.0) */
101 } recorder_file_format_e;
102
103 /**
104  * @brief Enumeration for the audio codec.
105  * @since_tizen 2.3
106  */
107 typedef enum {
108         RECORDER_AUDIO_CODEC_DISABLE = -1, /**< Disable audio track */
109         RECORDER_AUDIO_CODEC_AMR = 0,      /**< AMR codec */
110         RECORDER_AUDIO_CODEC_AAC,          /**< AAC codec */
111         RECORDER_AUDIO_CODEC_VORBIS,       /**< Vorbis codec */
112         RECORDER_AUDIO_CODEC_PCM,          /**< PCM codec */
113         RECORDER_AUDIO_CODEC_MP3           /**< MP3 codec (Since 3.0) */
114 } recorder_audio_codec_e;
115
116 /**
117  * @brief Enumeration for the video codec.
118  * @since_tizen 2.3
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 2.3
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 2.3
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 2.3
150  */
151 typedef enum {
152         RECORDER_POLICY_NONE = 0,               /**< None */
153         RECORDER_POLICY_SECURITY = 4,           /**< Security policy */
154         RECORDER_POLICY_RESOURCE_CONFLICT       /**< Resource conflict (Since 3.0) */
155 } recorder_policy_e;
156
157 /**
158  * @brief Enumeration for the recorder type.
159  * @since_tizen 3.0
160  */
161 typedef enum {
162         RECORDER_TYPE_AUDIO = 0,    /**< Audio only recorder */
163         RECORDER_TYPE_VIDEO         /**< Video recorder (audio is optional) */
164 } recorder_type_e;
165
166 /**
167  * @brief Enumeration for the recorder device state.
168  * @since_tizen 3.0
169  */
170 typedef enum {
171         RECORDER_DEVICE_STATE_IDLE = 0,     /**< No recording in progress */
172         RECORDER_DEVICE_STATE_RECORDING,    /**< Now recording */
173         RECORDER_DEVICE_STATE_PAUSED        /**< All recordings are paused */
174 } recorder_device_state_e;
175
176 /**
177  * @brief The structure type to contain video stream data.
178  * @since_tizen 6.0
179  */
180 typedef camera_preview_data_s recorder_video_data_s;
181
182 /**
183  * @}
184 */
185
186 /**
187  * @addtogroup CAPI_MEDIA_RECORDER_MODULE
188  * @{
189  */
190
191 /**
192  * @brief Called when limitation error occurs while recording.
193  * @details The callback function is possible to receive three types of limits: time, size and no-space.
194  * @since_tizen 2.3
195  * @remarks After being called, recording data is discarded and not written in the recording file. Also the state of recorder is not changed.
196  * @param[in] type      The imitation type
197  * @param[in] user_data The user data passed from the callback registration function
198  * @pre You have to register a callback using recorder_set_recording_limit_reached_cb().
199  * @see recorder_set_recording_status_cb()
200  * @see recorder_set_recording_limit_reached_cb()
201  * @see recorder_unset_recording_limit_reached_cb()
202  */
203 typedef void (*recorder_recording_limit_reached_cb)(recorder_recording_limit_type_e type, void *user_data);
204
205 /**
206  * @brief Called to indicate the recording status.
207  * @since_tizen 2.3
208  * @remarks This callback function is repeatedly invoked during the #RECORDER_STATE_RECORDING state.
209  * @param[in] elapsed_time The time of the recording (milliseconds)
210  * @param[in] file_size    The size of the recording file (KB)
211  * @param[in] user_data    The user data passed from the callback registration function
212  * @pre recorder_start() will invoke this callback if you register it using recorder_set_recording_status_cb().
213  * @see recorder_set_recording_status_cb()
214  * @see recorder_unset_recording_status_cb()
215  * @see recorder_start()
216  */
217 typedef void (*recorder_recording_status_cb)(unsigned long long elapsed_time, unsigned long long file_size, void *user_data);
218
219 /**
220  * @brief Called when the record state is changed.
221  * @since_tizen 2.3
222  * @param[in] previous  The previous state of the recorder
223  * @param[in] current   The current state of the recorder
224  * @param[in] by_policy @c true if the state is changed by policy, otherwise @c false if the state is not changed
225  * @param[in] user_data The user data passed from the callback registration function
226  * @pre This function is required to register a callback using recorder_set_state_changed_cb().
227  * @see recorder_set_state_changed_cb()
228  * @see recorder_prepare()
229  * @see recorder_unprepare()
230  * @see recorder_start()
231  * @see recorder_pause()
232  * @see recorder_commit()
233  * @see recorder_cancel()
234  */
235 typedef void (*recorder_state_changed_cb)(recorder_state_e previous , recorder_state_e current , bool by_policy, void *user_data);
236
237 /**
238  * @brief Called when the recorder device state is changed.
239  * @since_tizen 3.0
240  * @param[in] type      The recorder type
241  * @param[in] state     The state of the recorder device
242  * @param[in] user_data The user data passed from the callback registration function
243  * @see recorder_add_device_state_changed_cb()
244  */
245 typedef void (*recorder_device_state_changed_cb)(recorder_type_e type, recorder_device_state_e state, void *user_data);
246
247 /**
248  * @brief Called when the recorder is interrupted by a policy.
249  * @since_tizen 2.3
250  * @remarks This callback is called after interrupt handling is completed.
251  * @param[in] policy    The policy that interrupted the recorder
252  * @param[in] previous  The previous state of the recorder
253  * @param[in] current   The current state of the recorder
254  * @param[in] user_data The user data passed from the callback registration function
255  * @see recorder_set_interrupted_cb()
256  */
257 typedef void (*recorder_interrupted_cb)(recorder_policy_e policy, recorder_state_e previous, recorder_state_e current, void *user_data);
258
259 /**
260  * @brief Called when the recorder interrupt is started by a policy.
261  * @since_tizen 4.0
262  * @remarks This callback is called before interrupt handling is started.
263  * @param[in] policy    The policy that is interrupting the recorder
264  * @param[in] state     The current state of the recorder
265  * @param[in] user_data The user data passed from the callback registration function
266  * @see recorder_set_interrupt_started_cb()
267  */
268 typedef void (*recorder_interrupt_started_cb)(recorder_policy_e policy, recorder_state_e state, void *user_data);
269
270 /**
271  * @brief Called when audio stream data was being delivered just before storing in the recorded file.
272  * @since_tizen 2.3
273  * @remarks The callback function holds the same buffer that will be recorded. \n
274  *          So if the user changes the buffer, the result file will contain the buffer.
275  * @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.
276  * @param[in] stream    The audio stream data
277  * @param[in] size      The size of the stream data
278  * @param[in] format    The audio format
279  * @param[in] channel   The number of the channel
280  * @param[in] timestamp The timestamp of the stream buffer (in msec)
281  * @param[in] user_data The user data passed from the callback registration function
282  * @see recorder_set_audio_stream_cb()
283  */
284 typedef void (*recorder_audio_stream_cb)(void *stream, int size, audio_sample_type_e format, int channel, unsigned int timestamp, void *user_data);
285
286 /**
287  * @brief Called when muxed stream data is delivered just before writing to the file.
288  * @since_tizen 4.0
289  * @remarks This callback receives the data that will be recorded, \n
290  *          but any changes to this data will not affect the recorded file. \n
291  *          The @a stream should not be freed and it's valid only in the callback. To use outside the callback, make a copy.
292  * @param[in] stream    The muxed stream data
293  * @param[in] size      The size of the stream data
294  * @param[in] offset    The offset of the stream data
295  * @param[in] user_data The user data passed from the callback registration function
296  * @see recorder_set_muxed_stream_cb()
297  */
298 typedef void (*recorder_muxed_stream_cb)(void *stream, int size, unsigned long long offset, void *user_data);
299
300 /**
301  * @brief Called when each video frame is delivered before encoding, \n
302  *        and it will be encoded if the application returns @c true, otherwise dropped.
303  * @since_tizen 6.0
304  *
305  * @remarks This function is issued in the context of internal framework so the UI update code should not be directly invoked.
306  * @remarks The @a frame should not be released and it's available until the callback returns.
307  *
308  * @param[in] frame     The reference pointer to video stream data
309  * @param[in] user_data The user data passed from the callback registration function
310  * @see recorder_set_video_encode_decision_cb()
311  */
312 typedef bool (*recorder_video_encode_decision_cb)(recorder_video_data_s *frame, void *user_data);
313
314 /**
315  * @brief Called once for each supported video resolution.
316  * @since_tizen 2.3
317  * @param[in] width     The video image width
318  * @param[in] height    The video image height
319  * @param[in] user_data The user data passed from the foreach function
320  * @return    @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop
321  * @pre recorder_foreach_supported_video_resolution() will invoke this callback.
322  * @see recorder_foreach_supported_video_resolution()
323  */
324 typedef bool (*recorder_supported_video_resolution_cb)(int width, int height, void *user_data);
325
326 /**
327  * @brief Called when the error occurred.
328  * @since_tizen 2.3
329  * @remarks This callback informs about the critical error situation. \n
330  *          When being invoked, user should release the resource and terminate the application. \n
331  *          This error code will be reported.
332  *          #RECORDER_ERROR_DEVICE \n
333  *          #RECORDER_ERROR_INVALID_OPERATION \n
334  *          #RECORDER_ERROR_OUT_OF_MEMORY.
335  * @param[in] error         The error code
336  * @param[in] current_state The current state of the recorder
337  * @param[in] user_data     The user data passed from the callback registration function
338  * @pre This callback function is invoked if you register this callback using recorder_set_error_cb().
339  * @see recorder_set_error_cb()
340  * @see recorder_unset_error_cb()
341  */
342 typedef void (*recorder_error_cb)(recorder_error_e error, recorder_state_e current_state, void *user_data);
343
344  /**
345  * @}
346 */
347
348 /**
349  * @addtogroup CAPI_MEDIA_RECORDER_CAPABILITY_MODULE
350  * @{
351  */
352
353 /**
354  * @brief Called iteratively to notify about the supported file formats.
355  * @since_tizen 2.3
356  * @param[in] format    The format of recording files
357  * @param[in] user_data The user data passed from the foreach function
358  * @return @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop
359  * @pre recorder_foreach_supported_file_format() will invoke this callback.
360  * @see recorder_foreach_supported_file_format()
361  */
362 typedef bool (*recorder_supported_file_format_cb)(recorder_file_format_e format, void *user_data);
363
364 /**
365  * @brief Called iteratively to notify about the supported audio encoders.
366  * @since_tizen 2.3
367  * @param[in] codec     The codec of audio encoder
368  * @param[in] user_data The user data passed from the foreach function
369  * @return @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop
370  * @pre recorder_foreach_supported_audio_encoder() will invoke this callback.
371  * @see recorder_foreach_supported_audio_encoder()
372  */
373 typedef bool (*recorder_supported_audio_encoder_cb)(recorder_audio_codec_e codec, void *user_data);
374
375 /**
376  * @brief Called iteratively to notify about the supported video encoders.
377  * @since_tizen 2.3
378  * @param[in] codec     The codec of video encoder
379  * @param[in] user_data The user data passed from the foreach function
380  * @return @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop
381  * @pre recorder_foreach_supported_video_encoder() will invoke this callback.
382  * @see recorder_foreach_supported_video_encoder()
383  */
384 typedef bool (*recorder_supported_video_encoder_cb)(recorder_video_codec_e codec, void *user_data);
385
386 /**
387  * @}
388 */
389
390 /**
391  * @addtogroup CAPI_MEDIA_RECORDER_MODULE
392  * @{
393  */
394
395 /**
396  * @brief Creates a recorder handle to record a video.
397  * @since_tizen 2.3
398  * @remarks You must release @a recorder using recorder_destroy(). \n
399  * The @a camera handle also could be used for capturing images. \n
400  * If the camera state was #CAMERA_STATE_CREATED, the preview format will be changed to the recommended preview format for recording.
401  * @remarks The created recorder state will be different according to camera state : \n
402  * #CAMERA_STATE_CREATED -> #RECORDER_STATE_CREATED\n
403  * #CAMERA_STATE_PREVIEW -> #RECORDER_STATE_READY\n
404  * #CAMERA_STATE_CAPTURED -> #RECORDER_STATE_READY
405  * @remarks The privilege %http://tizen.org/privilege/recorder is not required since 4.0,\n
406  *          but it is required in all earlier versions.
407  * @remarks Since 4.0, It's related to the following feature: %http://tizen.org/feature/media.video_recording \n
408  *          instead of using %http://tizen.org/feature/microphone
409  * @param[in]  camera   The handle to the camera
410  * @param[out] recorder A handle to the recorder
411  * @return @c 0 on success, otherwise a negative error value
412  * @retval #RECORDER_ERROR_NONE Successful
413  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
414  * @retval #RECORDER_ERROR_OUT_OF_MEMORY Out of memory
415  * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation
416  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
417  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
418  * @see camera_create()
419  * @see camera_stop_preview()
420  * @see recorder_destroy()
421  */
422 int recorder_create_videorecorder(camera_h camera, recorder_h *recorder);
423
424 /**
425  * @brief Creates a recorder handle to record an audio.
426  * @since_tizen 2.3
427  * @remarks You must release @a recorder using recorder_destroy().
428  * @remarks The privilege %http://tizen.org/privilege/recorder is not required since 4.0,\n
429  *          but it is required in all earlier versions.
430  * @remarks Since 4.0, It's related to the following feature: %http://tizen.org/feature/media.audio_recording \n
431  *          instead of using %http://tizen.org/feature/microphone
432  * @param[out] recorder A handle to the recorder
433  * @return @c 0 on success, otherwise a negative error value
434  * @retval #RECORDER_ERROR_NONE Successful
435  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
436  * @retval #RECORDER_ERROR_OUT_OF_MEMORY Out of memory
437  * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation
438  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
439  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
440  * @post The recorder state will be #RECORDER_STATE_CREATED.
441  * @see recorder_destroy()
442  */
443 int recorder_create_audiorecorder(recorder_h *recorder);
444
445
446 /**
447  * @brief Destroys the recorder handle.
448  * @since_tizen 2.3
449  * @remarks The video recorder's camera handle is not released by this function.
450  * @param[in] recorder The handle to the media recorder
451  * @return @c 0 on success, otherwise a negative error value
452  * @retval #RECORDER_ERROR_NONE Successful
453  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
454  * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation
455  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
456  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
457  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
458  * @pre The recorder state should be #RECORDER_STATE_CREATED.
459  * @post The recorder state will be #RECORDER_STATE_NONE.
460  * @see camera_destroy()
461  * @see recorder_create_videorecorder()
462  * @see recorder_create_audiorecorder()
463  */
464 int recorder_destroy(recorder_h recorder);
465
466 /**
467  * @brief Prepares the media recorder for recording.
468  * @since_tizen 2.3
469  * @remarks Before calling the function, it is required to properly set audio encoder (recorder_set_audio_encoder()),
470  *          video encoder(recorder_set_video_encoder()) and file format (recorder_set_file_format()).
471  * @param[in] recorder The handle to the media recorder
472  * @return @c 0 on success, otherwise a negative error value
473  * @retval #RECORDER_ERROR_NONE Successful
474  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
475  * @retval #RECORDER_ERROR_RESOURCE_CONFLICT Resource conflict error
476  * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation
477  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
478  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
479  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
480  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
481  * @pre The recorder state should be #RECORDER_STATE_CREATED by recorder_create_videorecorder(), recorder_create_audiorecorder() or recorder_unprepare().
482  * @post The recorder state will be #RECORDER_STATE_READY.
483  * @post If recorder handle is created by recorder_create_videorecorder(), the camera state will be changed to #CAMERA_STATE_PREVIEW.
484  * @see recorder_create_videorecorder()
485  * @see recorder_create_audiorecorder()
486  * @see recorder_unprepare()
487  * @see recorder_set_audio_encoder()
488  * @see recorder_set_video_encoder()
489  * @see recorder_set_file_format()
490  */
491 int recorder_prepare(recorder_h recorder);
492
493 /**
494  * @brief Resets the media recorder.
495  * @since_tizen 2.3
496  * @param[in] recorder The handle to the media recorder
497  * @return @c 0 on success, otherwise a negative error value
498  * @retval #RECORDER_ERROR_NONE Successful
499  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
500  * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation
501  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
502  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
503  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
504  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
505  * @pre The recorder state should be #RECORDER_STATE_READY set by recorder_prepare(), recorder_cancel() or recorder_commit().
506  * @post The recorder state will be #RECORDER_STATE_CREATED.
507  * @post If the recorder handle is created by recorder_create_videorecorder(), camera state will be changed to #CAMERA_STATE_CREATED.
508  * @see recorder_prepare()
509  * @see recorder_cancel()
510  * @see recorder_commit()
511  */
512 int recorder_unprepare(recorder_h recorder);
513
514 /**
515  * @brief Starts the recording.
516  * @since_tizen 2.3
517  * @privlevel public
518  * @privilege %http://tizen.org/privilege/recorder
519  * @remarks If file path has been set to an existing file, this file is removed automatically and updated by new one. \n
520  *          In the video recorder, some preview format does not support record mode. It will return #RECORDER_ERROR_INVALID_OPERATION error. \n
521  *          You should use default preview format or #CAMERA_PIXEL_FORMAT_NV12 in the record mode. \n
522  *          When you want to record audio or video file, you need to add privilege according to rules below additionally. \n
523  *          If you want to save contents to internal storage, you should add mediastorage privilege. \n
524  *          If you want to save contents to external storage, you should add externalstorage privilege. \n
525  *          The filename should be set before this function is invoked.
526  * @param[in] recorder The handle to the media recorder
527  * @return @c 0 on success, otherwise a negative error value
528  * @retval #RECORDER_ERROR_NONE Successful
529  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
530  * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation
531  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
532  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
533  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
534  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
535  * @pre The recorder state must be #RECORDER_STATE_READY by recorder_prepare() or #RECORDER_STATE_PAUSED by recorder_pause(). \n
536  *      The filename should be set by recorder_set_filename().
537  * @post The recorder state will be #RECORDER_STATE_RECORDING.
538  * @see recorder_pause()
539  * @see recorder_commit()
540  * @see recorder_cancel()
541  * @see recorder_set_audio_encoder()
542  * @see recorder_set_filename()
543  * @see recorder_set_file_format()
544  * @see recorder_recording_status_cb()
545  * @see recorder_set_filename()
546  */
547 int recorder_start(recorder_h recorder);
548
549 /**
550  * @brief Pauses the recording.
551  * @since_tizen 2.3
552  * @privlevel public
553  * @privilege %http://tizen.org/privilege/recorder
554  * @remarks Recording can be resumed with recorder_start().
555  * @param[in] recorder The handle to the media recorder
556  * @return @c 0 on success, otherwise a negative error value
557  * @retval #RECORDER_ERROR_NONE Successful
558  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
559  * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation
560  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
561  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
562  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
563  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
564  * @pre The recorder state must be #RECORDER_STATE_RECORDING.
565  * @post The recorder state will be #RECORDER_STATE_PAUSED.
566  * @see recorder_start()
567  * @see recorder_commit()
568  * @see recorder_cancel()
569  */
570 int recorder_pause(recorder_h recorder);
571
572 /**
573  * @brief Stops recording and saves the result.
574  * @since_tizen 2.3
575  * @privlevel public
576  * @privilege %http://tizen.org/privilege/recorder
577  * @remarks When you want to record audio or video file, you need to add privilege according to rules below additionally. \n
578  *          If you want to save contents to internal storage, you should add mediastorage privilege. \n
579  *          If you want to save contents to external storage, you should add externalstorage privilege.
580  * @param[in] recorder The handle to the media recorder
581  * @return @c 0 on success, otherwise a negative error value
582  * @retval #RECORDER_ERROR_NONE Successful
583  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
584  * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation
585  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
586  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
587  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
588  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
589  * @pre The recorder state must be #RECORDER_STATE_RECORDING set by recorder_start() or #RECORDER_STATE_PAUSED by recorder_pause().
590  * @post The recorder state will be #RECORDER_STATE_READY.
591  * @see recorder_pause()
592  * @see recorder_cancel()
593  * @see recorder_set_filename()
594  * @see recorder_start()
595  */
596 int recorder_commit(recorder_h recorder);
597
598 /**
599  * @brief Cancels the recording.
600  * @details The recording data is discarded and not written in the recording file.
601  * @since_tizen 2.3
602  * @privlevel public
603  * @privilege %http://tizen.org/privilege/recorder
604  * @remarks When you want to record audio or video file, you need to add privilege according to rules below additionally. \n
605  *          If you want to save contents to internal storage, you should add mediastorage privilege. \n
606  *          If you want to save contents to external storage, you should add externalstorage privilege.
607  * @param[in] recorder The handle to the media recorder
608  * @return @c 0 on success, otherwise a negative error value
609  * @retval #RECORDER_ERROR_NONE Successful
610  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
611  * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation
612  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
613  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
614  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
615  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
616  * @pre The recorder state must be #RECORDER_STATE_RECORDING set by recorder_start() or #RECORDER_STATE_PAUSED by recorder_pause().
617  * @post The recorder state will be #RECORDER_STATE_READY.
618  * @see recorder_pause()
619  * @see recorder_commit()
620  * @see recorder_cancel()
621  * @see recorder_start()
622  */
623 int recorder_cancel(recorder_h recorder);
624
625 /**
626  * @brief Gets the recorder's current state.
627  * @since_tizen 2.3
628  * @param[in]  recorder The handle to the media recorder
629  * @param[out] state    The current state of the recorder
630  * @return  @c 0 on success, otherwise a negative error value
631  * @retval #RECORDER_ERROR_NONE Successful
632  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
633  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
634  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
635  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
636  */
637 int recorder_get_state(recorder_h recorder, recorder_state_e *state);
638
639 /**
640  * @brief Gets the peak audio input level that was sampled since the last call to this function.
641  * @since_tizen 2.3
642  * @remarks @c 0 dB indicates maximum input level, @c -300 dB indicates minimum input level.
643  * @param[in]  recorder The handle to the media recorder
644  * @param[out] dB       The audio input level in dB
645  * @return  @c 0 on success, otherwise a negative error value
646  * @retval #RECORDER_ERROR_NONE Successful
647  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
648  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
649  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
650  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
651  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
652  * @pre The recorder state must be #RECORDER_STATE_RECORDING or #RECORDER_STATE_PAUSED.
653  */
654 int recorder_get_audio_level(recorder_h recorder, double *dB);
655
656 /**
657  * @brief Sets the file path to record.
658  * @details This function sets file path which defines where newly recorded data should be stored.
659  * @since_tizen 2.3
660  * @remarks If the same file already exists in the file system, then old file will be overwritten.
661  * @param[in] recorder The handle to the media recorder
662  * @param[in] path     The recording file path
663  * @return @c 0 on success, otherwise a negative error value
664  * @retval #RECORDER_ERROR_NONE Successful
665  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
666  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
667  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
668  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
669  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
670  * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY.
671  * @see recorder_get_filename()
672  */
673 int recorder_set_filename(recorder_h recorder, const char *path);
674
675 /**
676  * @brief Gets the file path to record.
677  * @since_tizen 2.3
678  * @remarks You must release @a path using free().
679  * @param[in]  recorder The handle to the media recorder
680  * @param[out] path     The recording file path
681  * @return @c 0 on success, otherwise a negative error value
682  * @retval #RECORDER_ERROR_NONE Successful
683  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
684  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
685  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
686  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
687  * @see recorder_set_filename()
688  */
689 int recorder_get_filename(recorder_h recorder, char **path);
690
691 /**
692  * @brief Sets the file format for recording media stream.
693  * @since_tizen 2.3
694  * @remarks 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 encoder.
697  * @param[in] recorder The handle to the media recorder
698  * @param[in] format   The media file format
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  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
707  * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY (for video recorder only).\n
708  *      Since 2.3.1, this API also works for audio recorder when its state is #RECORDER_STATE_READY.
709  * @see recorder_get_file_format()
710  * @see recorder_foreach_supported_file_format()
711  */
712 int recorder_set_file_format(recorder_h recorder, recorder_file_format_e format);
713
714
715 /**
716  * @brief Gets the file format for recording media stream.
717  * @since_tizen 2.3
718  * @param[in]  recorder The handle to the media recorder
719  * @param[out] format   The media file format
720  * @return @c 0 on success, otherwise a negative error value
721  * @retval #RECORDER_ERROR_NONE Successful
722  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
723  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
724  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
725  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
726  * @see recorder_set_file_format()
727  * @see recorder_foreach_supported_file_format()
728  */
729 int recorder_get_file_format(recorder_h recorder, recorder_file_format_e *format);
730
731
732 /**
733  * @brief Sets the recorder's sound manager stream information.
734  * @since_tizen 3.0
735  * @remarks You can set sound stream information including audio routing.
736  *          For more details, please refer to @ref CAPI_MEDIA_SOUND_MANAGER_MODULE
737  * @param[in] recorder    The handle to the media recorder
738  * @param[in] stream_info The sound manager info
739  * @return @c 0 on success, otherwise a negative error value
740  * @retval #RECORDER_ERROR_NONE Successful
741  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
742  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
743  * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation
744  * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY
745  * @see #sound_stream_info_h
746  * @see sound_manager_create_stream_information()
747  * @see sound_manager_destroy_stream_information()
748  */
749 int recorder_set_sound_stream_info(recorder_h recorder, sound_stream_info_h stream_info);
750
751
752  /**
753  * @}
754 */
755
756 /**
757  * @addtogroup CAPI_MEDIA_RECORDER_CAPABILITY_MODULE
758  * @{
759  */
760
761 /**
762  * @brief Retrieves all supported file formats by invoking a specific callback for each supported file format.
763  * @since_tizen 2.3
764  * @param[in] recorder  The handle to the media recorder
765  * @param[in] callback  The iteration callback
766  * @param[in] user_data The user data to be passed to the callback function
767  * @return @c 0 on success, otherwise a negative error value
768  * @retval #RECORDER_ERROR_NONE Successful
769  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
770  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
771  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
772  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
773  * @post recorder_supported_file_format_cb() will be invoked.
774  * @see recorder_get_file_format()
775  * @see recorder_set_file_format()
776  * @see recorder_supported_file_format_cb()
777  */
778 int recorder_foreach_supported_file_format(recorder_h recorder, recorder_supported_file_format_cb callback, void *user_data);
779
780 /**
781  * @}
782 */
783
784 /**
785  * @addtogroup CAPI_MEDIA_RECORDER_MODULE
786  * @{
787  */
788
789 /**
790  * @brief Sets the audio codec for encoding an audio stream.
791  * @since_tizen 2.3
792  * @remarks You can get available audio encoders by using recorder_foreach_supported_audio_encoder(). \n
793  *          If set to #RECORDER_AUDIO_CODEC_DISABLE, the audio track is not created in recording files.\n
794  *          Since 2.3.1, it could be returned #RECORDER_ERROR_INVALID_OPERATION \n
795  *          when it's audio recorder and its state is #RECORDER_STATE_READY \n
796  *          because of checking codec compatibility with current file format.
797  * @param[in] recorder The handle to the media recorder
798  * @param[in] codec    The audio codec
799  * @return @c 0 on success, otherwise a negative error value
800  * @retval #RECORDER_ERROR_NONE Successful
801  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
802  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
803  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
804  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
805  * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation (Since 2.3.1)
806  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
807  * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY.
808  * @see recorder_get_audio_encoder()
809  * @see recorder_foreach_supported_audio_encoder()
810  */
811 int recorder_set_audio_encoder(recorder_h recorder, recorder_audio_codec_e codec);
812
813 /**
814  * @brief Gets the audio codec for encoding an audio stream.
815  * @since_tizen 2.3
816  * @param[in]  recorder The handle to the media recorder
817  * @param[out] codec    The audio codec
818  * @return @c 0 on success, otherwise a negative error value
819  * @retval #RECORDER_ERROR_NONE Successful
820  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
821  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
822  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
823  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
824  * @see recorder_set_audio_encoder()
825  * @see recorder_foreach_supported_audio_encoder()
826  */
827 int recorder_get_audio_encoder(recorder_h recorder, recorder_audio_codec_e *codec);
828
829  /**
830  * @}
831 */
832
833 /**
834  * @addtogroup CAPI_MEDIA_RECORDER_CAPABILITY_MODULE
835  * @{
836  */
837
838 /**
839  * @brief Retrieves all supported audio encoders by invoking a specific callback for each supported audio encoder.
840  * @since_tizen 2.3
841  * @param[in] recorder  The handle to the media recorder
842  * @param[in] callback  The iteration callback
843  * @param[in] user_data The user data to be passed to the callback function
844  * @return @c 0 on success, otherwise a negative error value
845  * @retval #RECORDER_ERROR_NONE Successful
846  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
847  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
848  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
849  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
850  * @post recorder_supported_audio_encoder_cb() will be invoked.
851  * @see recorder_set_audio_encoder()
852  * @see recorder_get_audio_encoder()
853  * @see recorder_supported_audio_encoder_cb()
854  */
855 int recorder_foreach_supported_audio_encoder(recorder_h recorder, recorder_supported_audio_encoder_cb callback, void *user_data);
856
857 /**
858  * @}
859 */
860
861 /**
862  * @addtogroup CAPI_MEDIA_RECORDER_MODULE
863  * @{
864  */
865
866 /**
867  * @brief Sets the resolution of the video recording.
868  * @since_tizen 2.3
869  * @remarks This function should be called before recording (recorder_start()).
870  * @param[in] recorder  The handle to the media recorder
871  * @param[in] width     The video width
872  * @param[in] height    The video height
873  * @return @c 0 on success, otherwise a negative error value
874  * @retval #RECORDER_ERROR_NONE Successful
875  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
876  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
877  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
878  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
879  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
880  * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY.
881  * @see recorder_start()
882  * @see recorder_get_video_resolution()
883  * @see recorder_foreach_supported_video_resolution()
884  */
885 int recorder_set_video_resolution(recorder_h recorder, int width, int height);
886
887 /**
888  * @brief Gets the resolution of the video recording.
889  * @since_tizen 2.3
890  * @param[in]  recorder The handle to the media recorder
891  * @param[out] width    The video width
892  * @param[out] height   The video height
893  * @return @c 0 on success, otherwise a negative error value
894  * @retval #RECORDER_ERROR_NONE Successful
895  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
896  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
897  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
898  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
899  * @see recorder_set_video_resolution()
900  * @see recorder_foreach_supported_video_resolution()
901  */
902 int recorder_get_video_resolution(recorder_h recorder, int *width, int *height);
903
904 /**
905  * @}
906 */
907
908 /**
909  * @addtogroup CAPI_MEDIA_RECORDER_CAPABILITY_MODULE
910  * @{
911  */
912
913 /**
914  * @brief Retrieves all supported video resolutions by invoking callback function once for each supported video resolution.
915  * @since_tizen 2.3
916  * @param[in] recorder   The handle to the media recorder
917  * @param[in] foreach_cb The callback function to be invoked
918  * @param[in] user_data  The user data to be passed to the callback function
919  * @return @c 0 on success, otherwise a negative error value
920  * @retval #RECORDER_ERROR_NONE Successful
921  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
922  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
923  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
924  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
925  * @post This function invokes recorder_supported_video_resolution_cb() repeatedly to retrieve each supported video resolution.
926  * @see recorder_set_video_resolution()
927  * @see recorder_get_video_resolution()
928  * @see recorder_supported_video_resolution_cb()
929  */
930 int recorder_foreach_supported_video_resolution(recorder_h recorder, recorder_supported_video_resolution_cb foreach_cb, void *user_data);
931
932 /**
933  * @}
934 */
935
936 /**
937  * @addtogroup CAPI_MEDIA_RECORDER_MODULE
938  * @{
939  */
940
941 /**
942  * @brief Sets the video codec for encoding video stream.
943  * @since_tizen 2.3
944  * @remarks You can get available video encoders by using recorder_foreach_supported_video_encoder().
945  * @param[in] recorder The handle to the media recorder
946  * @param[in] codec    The video codec
947  * @return @c 0 on success, otherwise a negative error value
948  * @retval #RECORDER_ERROR_NONE Successful
949  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
950  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
951  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
952  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
953  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
954  * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY.
955  * @see recorder_get_video_encoder()
956  * @see recorder_foreach_supported_video_encoder()
957  */
958 int recorder_set_video_encoder(recorder_h recorder, recorder_video_codec_e codec);
959
960 /**
961  * @brief Gets the video codec for encoding video stream.
962  * @since_tizen 2.3
963  * @param[in]  recorder The handle to the media recorder
964  * @param[out] codec    The video codec
965  * @return @c 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_PERMISSION_DENIED The access to the resources can not be granted
969  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
970  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
971  * @see recorder_set_video_encoder()
972  * @see recorder_foreach_supported_video_encoder()
973  */
974 int recorder_get_video_encoder(recorder_h recorder, recorder_video_codec_e *codec);
975
976 /**
977  * @}
978 */
979
980 /**
981  * @addtogroup CAPI_MEDIA_RECORDER_CAPABILITY_MODULE
982  * @{
983  */
984
985 /**
986  * @brief Retrieves all supported video encoders by invoking a specific callback for each supported video encoder.
987  * @since_tizen 2.3
988  * @param[in] recorder  The handle to the media recorder
989  * @param[in] callback  The iteration callback
990  * @param[in] user_data The user data to be passed to the callback function
991  * @return @c 0 on success, otherwise a negative error value
992  * @retval #RECORDER_ERROR_NONE Successful
993  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
994  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
995  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
996  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
997  * @post recorder_supported_video_encoder_cb() will be invoked.
998  * @see recorder_set_video_encoder()
999  * @see recorder_get_video_encoder()
1000  * @see recorder_supported_video_encoder_cb()
1001  */
1002 int recorder_foreach_supported_video_encoder(recorder_h recorder, recorder_supported_video_encoder_cb callback, void *user_data);
1003
1004  /**
1005  * @}
1006 */
1007
1008 /**
1009  * @addtogroup CAPI_MEDIA_RECORDER_MODULE
1010  * @{
1011  */
1012
1013 /**
1014  * @brief Registers the callback function that will be invoked when the recorder state changes.
1015  * @since_tizen 2.3
1016  * @param[in] recorder  The handle to the media recorder
1017  * @param[in] callback  The function pointer of user callback
1018  * @param[in] user_data The user data to be passed to the callback function
1019  * @return @c 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_PERMISSION_DENIED The access to the resources can not be granted
1023  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1024  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
1025  * @post recorder_state_changed_cb() will be invoked.
1026  * @see recorder_unset_state_changed_cb()
1027  * @see recorder_state_changed_cb()
1028  */
1029 int recorder_set_state_changed_cb(recorder_h recorder, recorder_state_changed_cb callback, void *user_data);
1030
1031 /**
1032  * @brief Unregisters the callback function.
1033  * @since_tizen 2.3
1034  * @param[in] recorder The handle to the media recorder
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  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
1041  * @see recorder_set_state_changed_cb()
1042  */
1043 int recorder_unset_state_changed_cb(recorder_h recorder);
1044
1045 /**
1046  * @brief Registers a callback function to be called when the media recorder is interrupted according to a policy.
1047  * @since_tizen 2.3
1048  * @param[in] recorder  The handle to the media recorder
1049  * @param[in] callback  The callback function to register
1050  * @param[in] user_data The user data to be passed to the callback function
1051  * @return @c 0 on success, otherwise a negative error value
1052  * @retval #RECORDER_ERROR_NONE Successful
1053  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1054  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1055  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1056  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
1057  * @see recorder_unset_interrupted_cb()
1058  * @see recorder_interrupted_cb()
1059  */
1060 int recorder_set_interrupted_cb(recorder_h recorder, recorder_interrupted_cb callback, void *user_data);
1061
1062 /**
1063  * @brief Unregisters the callback function.
1064  * @since_tizen 2.3
1065  * @param[in] recorder The handle to the media recorder
1066  * @return @c 0 on success, otherwise a negative error value
1067  * @retval #RECORDER_ERROR_NONE Successful
1068  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1069  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1070  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1071  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
1072  * @see recorder_set_interrupted_cb()
1073  */
1074 int recorder_unset_interrupted_cb(recorder_h recorder);
1075
1076 /**
1077  * @brief Registers a callback function to be called when the media recorder interrupt is started according to a policy.
1078  * @since_tizen 4.0
1079  * @param[in] recorder  The handle to the media recorder
1080  * @param[in] callback  The callback function to register
1081  * @param[in] user_data The user data to be passed to the callback function
1082  * @return @c 0 on success, otherwise a negative error value
1083  * @retval #RECORDER_ERROR_NONE Successful
1084  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1085  * @see recorder_unset_interrupt_started_cb()
1086  * @see recorder_interrupt_started_cb()
1087  */
1088 int recorder_set_interrupt_started_cb(recorder_h recorder, recorder_interrupt_started_cb callback, void *user_data);
1089
1090 /**
1091  * @brief Unregisters the callback function.
1092  * @since_tizen 4.0
1093  * @param[in] recorder The handle to the media recorder
1094  * @return @c 0 on success, otherwise a negative error value
1095  * @retval #RECORDER_ERROR_NONE Successful
1096  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1097  * @see recorder_set_interrupt_started_cb()
1098  */
1099 int recorder_unset_interrupt_started_cb(recorder_h recorder);
1100
1101 /**
1102  * @brief Registers a callback function to be called when audio stream data is being delivered.
1103  * @since_tizen 2.3
1104  * @remarks This callback function holds the same buffer that will be recorded. \n
1105  *          Therefore if an user changes the buffer, the result file will have the buffer. \n
1106  * @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
1107  *          This callback function to be called in #RECORDER_STATE_RECORDING and #RECORDER_STATE_PAUSED state.
1108  *
1109  * @param[in] recorder  The handle to the recorder
1110  * @param[in] callback  The callback function to register
1111  * @param[in] user_data The user data to be passed to the callback function
1112  * @return @c 0 on success, otherwise a negative error value
1113  * @retval #RECORDER_ERROR_NONE Successful
1114  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1115  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1116  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1117  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
1118  * @pre The recorder state should be #RECORDER_STATE_READY or #RECORDER_STATE_CREATED.
1119  * @see recorder_unset_audio_stream_cb()
1120  * @see recorder_audio_stream_cb()
1121  */
1122 int recorder_set_audio_stream_cb(recorder_h recorder, recorder_audio_stream_cb callback, void *user_data);
1123
1124 /**
1125  * @brief Unregisters the callback function.
1126  * @since_tizen 2.3
1127  * @param[in] recorder The handle to the media recorder
1128  * @return @c 0 on success, otherwise a negative error value
1129  * @retval #RECORDER_ERROR_NONE Successful
1130  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1131  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1132  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1133  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
1134  * @see     recorder_set_audio_stream_cb()
1135  */
1136 int recorder_unset_audio_stream_cb(recorder_h recorder);
1137
1138 /**
1139  * @brief Registers a callback function to be called when muxed stream data is delivered.
1140  * @since_tizen 4.0
1141  * @remarks This callback receives the data that will be recorded, \n
1142  *          but any changes to this data will not affect the recorded file.
1143  * @param[in] recorder  The handle to the recorder
1144  * @param[in] callback  The callback function to register
1145  * @param[in] user_data The user data to be passed to the callback function
1146  * @return @c 0 on success, otherwise a negative error value
1147  * @retval #RECORDER_ERROR_NONE Successful
1148  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1149  * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation
1150  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
1151  * @pre The recorder state should be #RECORDER_STATE_READY or #RECORDER_STATE_CREATED.
1152  * @see recorder_unset_muxed_stream_cb()
1153  * @see recorder_muxed_stream_cb()
1154  */
1155 int recorder_set_muxed_stream_cb(recorder_h recorder, recorder_muxed_stream_cb callback, void *user_data);
1156
1157 /**
1158  * @brief Unregisters the callback function.
1159  * @since_tizen 4.0
1160  * @param[in] recorder The handle to the media recorder
1161  * @return @c 0 on success, otherwise a negative error value
1162  * @retval #RECORDER_ERROR_NONE Successful
1163  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1164  * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation
1165  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
1166  * @pre The recorder state should be #RECORDER_STATE_READY or #RECORDER_STATE_CREATED.
1167  * @see recorder_set_muxed_stream_cb()
1168  */
1169 int recorder_unset_muxed_stream_cb(recorder_h recorder);
1170
1171 /**
1172  * @brief Registers a callback function to be called when each video frame is delivered before encoding.
1173  * @since_tizen 6.0
1174  * @remarks The audio stream will be disabled by force if @a callback is set.
1175  * @param[in] recorder  The handle to the recorder
1176  * @param[in] callback  The callback function to register
1177  * @param[in] user_data The user data to be passed to the callback function
1178  * @return @c 0 on success, otherwise a negative error value
1179  * @retval #RECORDER_ERROR_NONE Successful
1180  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1181  * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation
1182  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
1183  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1184  * @pre The recorder state should be #RECORDER_STATE_READY or #RECORDER_STATE_CREATED.
1185  * @post The @a callback will be invoked when each video frame is delivered before encoding, \n
1186  *       and it will be encoded if the @a callback returns @c true, otherwise dropped.
1187  * @see recorder_unset_video_encode_decision_cb()
1188  * @see recorder_video_encode_decision_cb()
1189  */
1190 int recorder_set_video_encode_decision_cb(recorder_h recorder, recorder_video_encode_decision_cb callback, void *user_data);
1191
1192 /**
1193  * @brief Unregisters the callback function.
1194  * @since_tizen 6.0
1195  * @param[in] recorder The handle to the media recorder
1196  * @return @c 0 on success, otherwise a negative error value
1197  * @retval #RECORDER_ERROR_NONE Successful
1198  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1199  * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation
1200  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
1201  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1202  * @pre The recorder state should be #RECORDER_STATE_READY or #RECORDER_STATE_CREATED.
1203  * @see recorder_set_video_encode_decision_cb()
1204  */
1205 int recorder_unset_video_encode_decision_cb(recorder_h recorder);
1206
1207 /**
1208  * @brief Registers a callback function to be invoked when the recording information changes.
1209  * @since_tizen 2.3
1210  * @param[in] recorder  The handle to the media recorder
1211  * @param[in] callback  The function pointer of user callback
1212  * @param[in] user_data The user data to be passed to the callback function
1213  * @return @c 0 on success, otherwise a negative error value
1214  * @retval #RECORDER_ERROR_NONE Successful
1215  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1216  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1217  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1218  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
1219  * @post recorder_recording_status_cb() will be invoked.
1220  * @see recorder_unset_recording_status_cb()
1221  * @see recorder_recording_status_cb()
1222  */
1223 int recorder_set_recording_status_cb(recorder_h recorder, recorder_recording_status_cb callback, void *user_data);
1224
1225 /**
1226  * @brief Unregisters the callback function.
1227  * @since_tizen 2.3
1228  * @param[in] recorder The handle to the media recorder
1229  * @return @c 0 on success, otherwise a negative error value
1230  * @retval #RECORDER_ERROR_NONE Successful
1231  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1232  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1233  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1234  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
1235  * @see recorder_set_recording_status_cb()
1236  */
1237 int recorder_unset_recording_status_cb(recorder_h recorder);
1238
1239 /**
1240  * @brief Registers the callback function to be run when reached the recording limit.
1241  * @since_tizen 2.3
1242  * @param[in] recorder  The handle to media recorder
1243  * @param[in] callback  The function pointer of user callback
1244  * @param[in] user_data The user data to be passed to the callback function
1245  * @return @c 0 on success, otherwise a negative error value
1246  * @retval #RECORDER_ERROR_NONE Successful
1247  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1248  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1249  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1250  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
1251  * @post recorder_recording_limit_reached_cb() will be invoked.
1252  * @see recorder_unset_recording_limit_reached_cb()
1253  * @see recorder_attr_set_size_limit()
1254  * @see recorder_attr_set_time_limit()
1255  * @see recorder_recording_limit_reached_cb()
1256  */
1257 int recorder_set_recording_limit_reached_cb(recorder_h recorder, recorder_recording_limit_reached_cb callback, void *user_data);
1258
1259 /**
1260  * @brief Unregisters the callback function.
1261  * @since_tizen 2.3
1262  * @param[in] recorder The handle to the media recorder
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_PERMISSION_DENIED The access to the resources can not be granted
1267  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1268  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
1269  * @see recorder_set_recording_limit_reached_cb()
1270  */
1271 int recorder_unset_recording_limit_reached_cb(recorder_h recorder);
1272
1273 /**
1274  * @brief Registers a callback function to be called when an asynchronous operation error occurred.
1275  * @since_tizen 2.3
1276  * @remarks This callback informs critical error situation.\n
1277  *          When this callback is invoked, user should release the resource and terminate the application. \n
1278  *          These error codes will occur. \n
1279  *          #RECORDER_ERROR_DEVICE \n
1280  *          #RECORDER_ERROR_INVALID_OPERATION \n
1281  *          #RECORDER_ERROR_OUT_OF_MEMORY
1282  * @param[in] recorder  The handle to the recorder
1283  * @param[in] callback  The callback function to register
1284  * @param[in] user_data The user data to be passed to the callback function
1285  * @return  @c 0 on success, otherwise a negative error value
1286  * @retval #RECORDER_ERROR_NONE Successful
1287  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1288  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1289  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1290  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
1291  * @post This function will invoke recorder_error_cb() when an asynchronous operation error occur.
1292  * @see recorder_unset_error_cb()
1293  * @see recorder_error_cb()
1294  */
1295 int recorder_set_error_cb(recorder_h recorder, recorder_error_cb callback, void *user_data);
1296
1297
1298 /**
1299  * @brief Unregisters the callback function.
1300  * @since_tizen 2.3
1301  * @param[in] recorder The handle to the recorder
1302  * @return  @c on success, otherwise a negative error value
1303  * @retval    #RECORDER_ERROR_NONE Successful
1304  * @retval    #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1305  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1306  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1307  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
1308  * @see recorder_set_error_cb()
1309  */
1310 int recorder_unset_error_cb(recorder_h recorder);
1311
1312
1313 /**
1314  * @brief Gets the state of recorder device.
1315  * @since_tizen 3.0
1316  * @param[in]  type  The recorder type
1317  * @param[out] state The current state of the device
1318  * @return @c 0 on success, otherwise a negative error value
1319  * @retval #RECORDER_ERROR_NONE Successful
1320  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1321  * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation
1322  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1323  */
1324 int recorder_get_device_state(recorder_type_e type, recorder_device_state_e *state);
1325
1326 /**
1327  * @brief Registers a callback function to be called when the recorder device state changes.
1328  * @since_tizen 3.0
1329  * @param[in]  callback  The callback function to register
1330  * @param[in]  user_data The user data to be passed to the callback function
1331  * @param[out] cb_id     The id of the registered callback
1332  * @return @c 0 on success, otherwise a negative error value
1333  * @retval #RECORDER_ERROR_NONE Successful
1334  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1335  * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation
1336  * @retval #RECORDER_ERROR_OUT_OF_MEMORY Out of memory
1337  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1338  * @post This function will invoke recorder_device_state_changed_cb() when the recorder device's state changes.
1339  * @see recorder_remove_device_state_changed_cb()
1340  * @see recorder_device_state_changed_cb()
1341  */
1342 int recorder_add_device_state_changed_cb(recorder_device_state_changed_cb callback, void *user_data, int *cb_id);
1343
1344 /**
1345  * @brief Unregisters a callback function.
1346  * @since_tizen 3.0
1347  * @param[in] cb_id The id of the registered callback
1348  * @return @c 0 on success, otherwise a negative error value
1349  * @retval #RECORDER_ERROR_NONE Successful
1350  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1351  * @retval #RECORDER_ERROR_INVALID_OPERATION Invalid operation
1352  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1353  * @see recorder_add_device_state_changed_cb()
1354  */
1355 int recorder_remove_device_state_changed_cb(int cb_id);
1356
1357 /**
1358  * @}
1359  */
1360
1361 /**
1362  * @addtogroup CAPI_MEDIA_RECORDER_ATTRIBUTES_MODULE
1363  * @{
1364  */
1365
1366
1367 /**
1368  * @brief Sets the maximum size of a recording file.
1369  * @since_tizen 2.3
1370  * @remarks After reaching the limitation, the recording data is discarded and not written in the recording file.
1371  * @param[in] recorder The handle to the media recorder
1372  * @param[in] kbyte    The maximum size of the recording file(KB) \n
1373  *                     @c 0 means unlimited recording size.
1374  * @return @c 0 on success, otherwise a negative error value
1375  * @retval #RECORDER_ERROR_NONE Successful
1376  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1377  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
1378  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1379  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1380  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
1381  * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY.
1382  * @see recorder_attr_get_size_limit()
1383  * @see recorder_attr_set_time_limit()
1384  */
1385 int recorder_attr_set_size_limit(recorder_h recorder, int kbyte);
1386
1387 /**
1388  * @brief Gets the maximum size of a recording file.
1389  * @since_tizen 2.3
1390  * @param[in]  recorder The handle to the media recorder
1391  * @param[out] kbyte    The maximum size of recording file (KB) \n
1392  *                      @c 0 means unlimited recording size.
1393  * @return @c 0 on success, otherwise a negative error value
1394  * @retval #RECORDER_ERROR_NONE Successful
1395  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1396  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1397  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1398  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
1399  * @see recorder_attr_set_size_limit()
1400  * @see recorder_attr_get_time_limit()
1401  */
1402 int recorder_attr_get_size_limit(recorder_h recorder, int *kbyte);
1403
1404 /**
1405  * @brief Sets the time limit of a recording file.
1406  * @since_tizen 2.3
1407  * @remarks After reaching the limitation, the recording data is discarded and not written in the recording file.
1408  * @param[in] recorder The handle to the media recorder
1409  * @param[in] second   The time limit of the recording file (in seconds) \n
1410  *                     @c 0 means unlimited recording size.
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_INVALID_STATE Invalid state
1415  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1416  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1417  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
1418  * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY.
1419  * @see recorder_attr_get_time_limit()
1420  * @see recorder_attr_set_size_limit()
1421  */
1422 int recorder_attr_set_time_limit(recorder_h recorder, int second);
1423
1424
1425 /**
1426  * @brief Gets the time limit of a recording file.
1427  * @since_tizen 2.3
1428  * @param[in]  recorder The handle to the media recorder
1429  * @param[out] second   The time limit of the recording file (in seconds) \n
1430  *                      @c 0 means unlimited recording time.
1431  * @return @c 0 on success, otherwise a negative error value
1432  * @retval #RECORDER_ERROR_NONE Successful
1433  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1434  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1435  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1436  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
1437  * @see recorder_attr_set_time_limit()
1438  * @see recorder_attr_get_size_limit()
1439  */
1440 int recorder_attr_get_time_limit(recorder_h recorder, int *second);
1441
1442 /**
1443  * @brief Sets the audio device for recording.
1444  * @since_tizen 2.3
1445  * @param[in] recorder The handle to the media recorder
1446  * @param[in] device   The type of an audio device
1447  * @return @c 0 on success, otherwise a negative error value
1448  * @retval #RECORDER_ERROR_NONE Successful
1449  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1450  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
1451  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1452  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1453  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
1454  * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY (for video recorder only).\n
1455  *      Since 2.3.1, this API also works for audio recorder when its state is #RECORDER_STATE_READY.
1456  * @see recorder_attr_get_audio_device()
1457  */
1458 int recorder_attr_set_audio_device(recorder_h recorder, recorder_audio_device_e device);
1459
1460 /**
1461  * @brief Gets the audio device for recording.
1462  * @since_tizen 2.3
1463  * @param[in]  recorder The handle to the media recorder
1464  * @param[out] device   The type of an audio device
1465  * @return @c 0 on success, otherwise a negative error value
1466  * @retval #RECORDER_ERROR_NONE Successful
1467  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1468  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1469  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1470  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
1471  * @see recorder_attr_set_audio_device()
1472  */
1473 int recorder_attr_get_audio_device(recorder_h recorder, recorder_audio_device_e *device);
1474
1475 /**
1476  * @brief Sets the sampling rate of an audio stream.
1477  * @since_tizen 2.3
1478  * @param[in] recorder   The handle to the media recorder
1479  * @param[in] samplerate The sample rate in Hertz
1480  * @return @c 0 on success, otherwise a negative error value
1481  * @retval #RECORDER_ERROR_NONE Successful
1482  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1483  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
1484  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1485  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1486  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
1487  * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY (for video recorder only).\n
1488  *      Since 2.3.1, this API also works for audio recorder when its state is #RECORDER_STATE_READY.
1489  * @see recorder_attr_get_audio_samplerate()
1490  */
1491 int recorder_attr_set_audio_samplerate(recorder_h recorder, int samplerate);
1492
1493 /**
1494  * @brief Gets the sampling rate of an audio stream.
1495  * @since_tizen 2.3
1496  * @param[in]  recorder   The handle to the media recorder
1497  * @param[out] samplerate The sample rate in Hertz
1498  * @return @c 0 on success, otherwise a negative error value
1499  * @retval #RECORDER_ERROR_NONE Successful
1500  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1501  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1502  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1503  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
1504  * @see recorder_attr_set_audio_samplerate()
1505  */
1506 int recorder_attr_get_audio_samplerate(recorder_h recorder, int *samplerate);
1507
1508 /**
1509  * @brief Sets the bitrate of an audio encoder.
1510  * @since_tizen 2.3
1511  * @param[in] recorder The handle to the media recorder
1512  * @param[in] bitrate  The bitrate (for mms : 12200[bps], normal : 288000[bps])
1513  * @return @c 0 on success, otherwise a negative error value
1514  * @retval #RECORDER_ERROR_NONE Successful
1515  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1516  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
1517  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1518  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1519  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
1520  * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY.
1521  * @see recorder_attr_get_audio_encoder_bitrate()
1522  */
1523 int recorder_attr_set_audio_encoder_bitrate(recorder_h recorder, int bitrate);
1524
1525 /**
1526  * @brief Sets the bitrate of a video encoder.
1527  * @since_tizen 2.3
1528  * @param[in] recorder The handle to the media recorder
1529  * @param[in] bitrate  The bitrate in bits per second
1530  * @return @c 0 on success, otherwise a negative error value
1531  * @retval #RECORDER_ERROR_NONE Successful
1532  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1533  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
1534  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1535  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1536  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
1537  * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY.
1538  * @see recorder_attr_get_video_encoder_bitrate()
1539  */
1540 int recorder_attr_set_video_encoder_bitrate(recorder_h recorder, int bitrate);
1541
1542 /**
1543  * @brief Gets the bitrate of an audio encoder.
1544  * @since_tizen 2.3
1545  * @param[in]  recorder The handle to the media recorder
1546  * @param[out] bitrate  The bitrate in bits per second
1547  * @return @c 0 on success, otherwise a negative error value
1548  * @retval #RECORDER_ERROR_NONE Successful
1549  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1550  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1551  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1552  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
1553  * @see recorder_attr_set_audio_encoder_bitrate()
1554  */
1555 int recorder_attr_get_audio_encoder_bitrate(recorder_h recorder, int *bitrate);
1556
1557 /**
1558  * @brief Gets the bitrate of a video encoder.
1559  * @since_tizen 2.3
1560  * @param[in]  recorder The handle to the media recorder
1561  * @param[out] bitrate  The bitrate in bits per second
1562  * @return @c 0 on success, otherwise a negative error value
1563  * @retval #RECORDER_ERROR_NONE Successful
1564  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1565  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1566  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1567  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
1568  * @see recorder_attr_set_audio_encoder_bitrate()
1569  */
1570 int recorder_attr_get_video_encoder_bitrate(recorder_h recorder, int *bitrate);
1571
1572 /**
1573  * @brief Sets the mute state of a recorder.
1574  * @since_tizen 2.3
1575  * @param[in] recorder The handle to the media recorder
1576  * @param[in] enable   The mute state
1577  * @return @c 0 on success, otherwise a negative error value
1578  * @retval #RECORDER_ERROR_NONE Successful
1579  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1580  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1581  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1582  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
1583  * @see recorder_attr_is_muted()
1584  */
1585 int recorder_attr_set_mute(recorder_h recorder, bool enable);
1586
1587 /**
1588  * @brief Gets the mute state of a recorder.
1589  * @since_tizen 2.3
1590  * @param[in] recorder The handle to the media recorder
1591  * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
1592  * @return  @c true if the recorder is not recording any sound,
1593  *          otherwise @c false if the recorder is recording
1594  * @exception #RECORDER_ERROR_NONE Successful
1595  * @exception #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1596  * @exception #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1597  * @exception #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1598  * @see recorder_attr_set_mute()
1599  */
1600 bool recorder_attr_is_muted(recorder_h recorder);
1601
1602 /**
1603  * @brief Sets the recording motion rate.
1604  * @since_tizen 2.3
1605  * @remarks This attribute is valid only in a video recorder. \n
1606  *          If the rate bigger than @c 0 and smaller than @c 1, video is recorded in a slow motion mode. \n
1607  *          If the rate bigger than @c 1, video is recorded in a fast motion mode (time lapse recording).
1608  * @remarks Audio data is not recorded. \n
1609  *          To reset slow motion recording, set the rate to @c 1.
1610  * @param[in] recorder The handle to the media recorder
1611  * @param[in] rate     The recording motion rate \n
1612  *                     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).
1613  * @return @c 0 on success, otherwise a negative error value
1614  * @retval #RECORDER_ERROR_NONE Successful
1615  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1616  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
1617  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1618  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1619  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
1620  * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY.
1621  * @see recorder_attr_get_recording_motion_rate()
1622  */
1623 int recorder_attr_set_recording_motion_rate(recorder_h recorder , double rate);
1624
1625 /**
1626  * @brief Gets the recording motion rate.
1627  * @since_tizen 2.3
1628  * @remarks This attribute is valid only in a video recorder. \n
1629  *          If the rate bigger than @c 0 and smaller than @c 1, video is recorded in a slow motion mode. \n
1630  *          If the rate bigger than @c 1, video is recorded in a fast motion mode (time lapse recording).
1631  * @remarks Audio data is not recorded. \n
1632  *          To reset slow motion recording, set the rate to @c 1.
1633  * @param[in]  recorder The handle to the media recorder
1634  * @param[out] rate     The recording motion rate \n
1635  *                      It is computed with fps.
1636  * @return @c 0 on success, otherwise a negative error value
1637  * @retval #RECORDER_ERROR_NONE Successful
1638  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1639  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1640  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1641  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
1642  * @see recorder_attr_set_recording_motion_rate()
1643  */
1644 int recorder_attr_get_recording_motion_rate(recorder_h recorder , double *rate);
1645
1646 /**
1647  * @brief Sets the number of the audio channel.
1648  * @since_tizen 2.3
1649  * @remarks This attribute is applied only in #RECORDER_STATE_CREATED state. \n
1650  *          For mono recording, setting channel to @c 1. \n
1651  *          For stereo recording, setting channel to @c 2.
1652  * @param[in] recorder      The handle to the media recorder
1653  * @param[in] channel_count The number of the audio channel
1654  * @return @c 0 on success, otherwise a negative error value
1655  * @retval #RECORDER_ERROR_NONE Successful
1656  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1657  * @retval #RECORDER_ERROR_INVALID_STATE Invalid state
1658  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1659  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1660  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
1661  * @pre The recorder state must be #RECORDER_STATE_CREATED or #RECORDER_STATE_READY (for video recorder only).\n
1662  *      Since 2.3.1, this API also works for audio recorder when its state is #RECORDER_STATE_READY.
1663  * @see recorder_attr_get_audio_channel()
1664  */
1665 int recorder_attr_set_audio_channel(recorder_h recorder, int channel_count);
1666
1667 /**
1668  * @brief Gets the number of the audio channel.
1669  * @since_tizen 2.3
1670  * @param[in]  recorder      The handle to the media recorder
1671  * @param[out] channel_count The number of the audio channel
1672  * @return @c 0 on success, otherwise a negative error value
1673  * @retval #RECORDER_ERROR_NONE Successful
1674  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1675  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1676  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1677  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
1678  * @see recorder_attr_set_audio_channel()
1679  */
1680 int recorder_attr_get_audio_channel(recorder_h recorder, int *channel_count);
1681
1682
1683 /**
1684  * @brief Sets the video orientation in a video metadata tag.
1685  * @since_tizen 2.3
1686  * @param[in] recorder    The handle to a media recorder
1687  * @param[in] orientation The information of the video orientation
1688  * @return @c 0 on success, otherwise a negative error value
1689  * @retval #RECORDER_ERROR_NONE Successful
1690  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1691  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1692  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1693  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
1694  * @see recorder_attr_get_orientation_tag()
1695  */
1696 int recorder_attr_set_orientation_tag(recorder_h recorder,  recorder_rotation_e orientation);
1697
1698 /**
1699  * @brief Gets the video orientation in a video metadata tag.
1700  * @since_tizen 2.3
1701  * @param[in]  recorder    The handle to a media recorder
1702  * @param[out] orientation The information of the video orientation
1703  * @return  @c 0 on success, otherwise a negative error value
1704  * @retval #RECORDER_ERROR_NONE Successful
1705  * @retval #RECORDER_ERROR_INVALID_PARAMETER Invalid parameter
1706  * @retval #RECORDER_ERROR_PERMISSION_DENIED The access to the resources can not be granted
1707  * @retval #RECORDER_ERROR_NOT_SUPPORTED The feature is not supported
1708  * @retval #RECORDER_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected
1709  * @see recorder_attr_set_orientation_tag()
1710  */
1711 int recorder_attr_get_orientation_tag(recorder_h recorder, recorder_rotation_e *orientation);
1712
1713 /**
1714  * @}
1715  */
1716
1717 #ifdef __cplusplus
1718 }
1719 #endif
1720
1721 #endif /* __TIZEN_MULTIMEDIA_RECORDER_H__ */
1722