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