Tizen coding convention
[platform/core/multimedia/libmm-streamrecorder.git] / src / include / mm_streamrecorder.h
1 /*
2  * libmm-streamrecorder
3  *
4  * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Hyuntae Kim <ht1211.kim@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21
22 #ifndef __MM_STREAMRECORDER_H__
23 #define __MM_STREAMRECORDER_H__
24
25 /*=======================================================================================
26 | INCLUDE FILES                                                                         |
27 ========================================================================================*/
28 #include <glib.h>
29
30 #include <mm_types.h>
31 #include <mm_error.h>
32 #include <mm_message.h>
33
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37
38 /*=======================================================================================
39 | GLOBAL DEFINITIONS AND DECLARATIONS FOR STREAMRECORDER                                        |
40 ========================================================================================*/
41
42 /*=======================================================================================
43 | MACRO DEFINITIONS                                                                     |
44 ========================================================================================*/
45
46 /* Attributes Macros */
47
48 #define MMSTR_VIDEO_ENABLE                     "video-enable"
49
50 #define MMSTR_VIDEO_BUFFER_TYPE                "videobuffer-type"
51
52 #define MMSTR_VIDEO_SOURCE_FORMAT              "videosource-format"
53
54 #define MMSTR_VIDEO_FRAMERATE                  "video-framerate"
55
56 #define MMSTR_VIDEO_BITRATE                    "video-bitrate"
57
58 #define MMSTR_VIDEO_RESOLUTION_WIDTH           "video-resolution-width"
59
60 #define MMSTR_VIDEO_RESOLUTION_HEIGHT          "video-resolution-height"
61
62 /**
63  * Disable Audio stream when record.
64  */
65 #define MMSTR_AUDIO_ENABLE                     "audio-enable"
66
67 #define MMSTR_AUDIO_SOURCE_FORMAT              "audio-source-format"
68
69 #define MMSTR_AUDIO_BITRATE                    "audio-bitrate"
70
71 #define MMSTR_AUDIO_SAMPLERATE                 "audio-samplerate"
72
73 #define MMSTR_VIDEO_ENCODER                    "video-encoder"
74
75 #define MMSTR_AUDIO_ENCODER                    "audio-encoder"
76
77 #define MMSTR_AUDIO_CHANNEL                    "audio-channel-count"
78
79 #define MMSTR_FILE_FORMAT                      "file-format"
80
81 #define MMSTR_FILENAME                         "filename"
82
83 #define MMSTR_RECORDER_MODE                    "recorder-mode"
84
85 #define MMSTR_TARGET_MAX_SIZE                  "target-max-size"
86
87 #define MMSTR_TARGET_TIME_LIMIT                "target-time-limit"
88
89 /*=======================================================================================
90 | ENUM DEFINITIONS                                                                      |
91 ========================================================================================*/
92 /**
93  * An enumeration for streamrecorder states.
94  */
95 typedef enum {
96         MM_STREAMRECORDER_STATE_NONE,           /**< Streamrecorder is not created yet */
97         MM_STREAMRECORDER_STATE_CREATED,        /**< Streamrecorder is created, but not initialized yet */
98         MM_STREAMRECORDER_STATE_PREPARED,       /**< Streamrecorder is prepared to record */
99         MM_STREAMRECORDER_STATE_RECORDING,      /**< Streamrecorder is now recording */
100         MM_STREAMRECORDER_STATE_PAUSED,         /**< Streamrecorder is paused while recording */
101         MM_STREAMRECORDER_STATE_NUM,            /**< Number of streamrecorder states */
102 } MMStreamRecorderStateType;
103
104 /**
105  * An enumeration of Audio Format.
106  */
107 typedef enum {
108         MM_STREAMRECORDER_AUDIO_FORMAT_PCM_U8 = 0,      /**< unsigned 8bit audio */
109         MM_STREAMRECORDER_AUDIO_FORMAT_PCM_S16_LE = 2,  /**< signed 16bit audio. Little endian. */
110 } MMStreamRecorderAudioFormat;
111
112 /**********************************
113 *          Stream data            *
114 **********************************/
115
116 typedef enum {
117         MM_STREAM_TYPE_NONE,
118         MM_STREAM_TYPE_VIDEO,
119         MM_STREAM_TYPE_AUDIO,
120 } MMStreamRecorderStreamType;
121
122 /*=======================================================================================
123 | STRUCTURE DEFINITIONS                                                                 |
124 ========================================================================================*/
125
126 /* General Structure */
127 /**
128  * An enumeration for streamrecorder mode.
129  */
130
131 typedef enum {
132         MM_STREAMRECORDER_MODE_MEDIABUFFER = 0,    /**< Recording with mediabuffer */
133         MM_STREAMRECORDER_MODE_SCREENRECORD,       /**< Recording with screenrecord */
134 } MMStreamRecorderModeType;
135
136 typedef enum {
137         MM_STREAMRECORDER_VIDEO_TYPE_TBM_BO,         /**< TBM BO type */
138         MM_STREAMRECORDER_VIDEO_TYPE_NORMAL_BUFFER,  /**< Normal Raw data buffer */
139 } MMStreamRecorderVideoBufType;
140
141 typedef enum {
142         MM_STREAMRECORDER_INPUT_FORMAT_INVALID = -1,/**< Invalid pixel format */
143         MM_STREAMRECORDER_INPUT_FORMAT_NV12,       /**< NV12 pixel format */
144         MM_STREAMRECORDER_INPUT_FORMAT_NV21,       /**< NV21 pixel format */
145         MM_STREAMRECORDER_INPUT_FORMAT_I420,       /**< I420 pixel format */
146         MM_STREAMRECORDER_INPUT_FORMAT_UYVY,       /**< UYVY pixel format */
147         MM_STREAMRECORDER_INPUT_FORMAT_YUYV,       /**< YUYV pixel format */
148         MM_STREAMRECORDER_INPUT_FORMAT_BGRA8888,   /**< BGRA8888 pixel format */
149         MM_STREAMRECORDER_INPUT_FORMAT_NUM         /**< Number of the pixel format */
150 } MMStreamRecorderVideoSourceFormat;
151
152 /**********************************
153 *          Attribute info         *
154 **********************************/
155
156 /**
157  * Report structure of recording file
158  */
159 typedef struct {
160         char *recording_filename;       /**< File name of stored recording file. Please free after using. */
161 } MMStreamRecordingReport; /**< report structure definition of recording file */
162
163 /**
164 * An enumeration for attribute values types.
165 */
166 typedef enum {
167         MM_STR_REC_ATTRS_TYPE_INVALID = -1, /**< Type is invalid */
168         MM_STR_REC_ATTRS_TYPE_INT,         /**< Integer type attribute */
169         MM_STR_REC_ATTRS_TYPE_DOUBLE,   /**< Double type attribute */
170         MM_STR_REC_ATTRS_TYPE_STRING,   /**< UTF-8 String type attribute */
171         MM_STR_REC_ATTRS_TYPE_DATA,        /**< Pointer type attribute */
172 } MMStreamRecorderAttrsType;
173
174 /**
175 * An enumeration for attribute validation type.
176 */
177 typedef enum {
178         MM_STR_REC_ATTRS_VALID_TYPE_INVALID = -1,       /**< Invalid validation type */
179         MM_STR_REC_ATTRS_VALID_TYPE_NONE,            /**< Do not check validity */
180         MM_STR_REC_ATTRS_VALID_TYPE_INT_ARRAY,       /**< validity checking type of integer array */
181         MM_STR_REC_ATTRS_VALID_TYPE_INT_RANGE,       /**< validity checking type of integer range */
182         MM_STR_REC_ATTRS_VALID_TYPE_DOUBLE_ARRAY,    /**< validity checking type of double array */
183         MM_STR_REC_ATTRS_VALID_TYPE_DOUBLE_RANGE,    /**< validity checking type of double range */
184 } MMStreamRecorderAttrsValidType;
185
186 /**
187 * An enumeration for attribute access flag.
188 */
189 typedef enum {
190         MM_STR_REC_ATTRS_FLAG_DISABLED = 0, /**< None flag is set. This means the attribute is not allowed to use.  */
191         MM_STR_REC_ATTRS_FLAG_READABLE = 1 << 0,/**< Readable */
192         MM_STR_REC_ATTRS_FLAG_WRITABLE = 1 << 1,/**< Writable */
193         MM_STR_REC_ATTRS_FLAG_MODIFIED = 1 << 2,/**< Modified */
194         MM_STR_REC_ATTRS_FLAG_RW = MM_STR_REC_ATTRS_FLAG_READABLE | MM_STR_REC_ATTRS_FLAG_WRITABLE,
195                                                                                         /**< Readable and Writable */
196 } MMStreamRecorderAttrsFlag;
197
198 /**
199 * A structure for attribute information
200 */
201 typedef struct {
202         MMStreamRecorderAttrsType type;
203         MMStreamRecorderAttrsFlag flag;
204         MMStreamRecorderAttrsValidType validity_type;
205
206 /**
207 * A union that describes validity of the attribute.
208 */
209         union {
210    /**
211         * Validity structure for integer array.
212         */
213            struct {
214                    int *array; /**< a pointer of array */
215                    int count;  /**< size of array */
216                    int def;    /**< default value. Real value not index of array */
217            } int_array;
218
219    /**
220         * Validity structure for integer range.
221         */
222            struct {
223                    int min;    /**< minimum range */
224                    int max;    /**< maximum range */
225                    int def;    /**< default value */
226            } int_range;
227
228    /**
229         * Validity structure for double array.
230         */
231            struct {
232                    double *array;  /**< a pointer of array */
233                    int count;  /**< size of array */
234                    double def; /**< default value. Real value not index of array */
235            } double_array;
236
237    /**
238         * Validity structure for double range.
239         */
240            struct {
241                    double min; /**< minimum range */
242                    double max; /**< maximum range */
243                    double def; /**< default value */
244            } double_range;
245         };
246 } MMStreamRecorderAttrsInfo;
247
248
249 /*=======================================================================================
250 | TYPE DEFINITIONS                                                                      |
251 ========================================================================================*/
252 /*=======================================================================================
253 | GLOBAL FUNCTION PROTOTYPES                                                            |
254 ========================================================================================*/
255 /**
256  *    mm_streamrecorder_create:\n
257  *  Create streamrecorder object. This is the function that an user who wants to use mm_streamrecorder calls first.
258  *  This function creates handle structure and initialize mutex, attributes, gstreamer.
259  *  When this function success, it will return  a handle of newly created object.
260  *  A user have to put the handle when he calls every function of mm_streamrecorder. \n
261  *
262  *      @param[out]     streamrecorder  A handle of streamrecorder.
263  *      @param[in]      info            Information for devices
264  *      @return         This function returns zero(MM_ERROR_NONE) on success, or negative value with error code.\n
265  *                      Please refer 'mm_error.h' to know the exact meaning of the error.
266  *      @see            mm_streamrecorder_destroy
267  *      @pre            None
268  *      @post           Next state of mm-streamrecorder will be MM_STREAMRECORDER_STATE_CREATED
269  *      @remarks        You can create multiple handles on a context at the same time. However,
270  *                      streamrecordercorder cannot guarantee proper operation because of limitation of resources.
271  *      @par example
272  *      @code
273
274 #include <mm_streamrecorder.h>
275
276 gboolean initialize_streamrecorder()
277 {
278         int err;
279
280         err = mm_streamrecorder_create(&hstream);
281
282         if (err != MM_ERROR_NONE) {
283                 return FALSE;
284         }
285
286         return TRUE;
287 }
288
289  *      @endcode
290  */
291
292 //INITIAL GSTREAMER
293 int mm_streamrecorder_create(MMHandleType *streamrecorder);
294
295 /**
296  *    mm_streamrecorder_destroy:\n
297  *  Destroy streamrecorder object. Release handle and all of the resources that were created in mm_streamrecorder_create().\n
298  *  This is the finalizing function of mm_streamrecorder. If this function is not called or fails to call, the handle isn't released fully.
299  *  This function releases attributes, mutexes, sessions, and handle itself. This function also removes all of remaining messages.
300  *  So if your application should wait a certain message of mm_streamrecorder, please wait to call this function till getting the message.
301  *
302  *
303  *      @param[in]      streamrecorder  A handle of streamrecorder.
304  *      @return         This function returns zero(MM_ERROR_NONE) on success, or negative value with error code.\n
305  *                      Please refer 'mm_error.h' to know the exact meaning of the error.
306  *      @see            mm_streamrecorder_create
307  *      @pre            Previous state of mm-streamrecorder should be MM_STREAMRECORDER_STATE_CREATED
308  *      @post           Because the handle is not valid, you can't check the state.
309  *      @remarks        None
310  *      @par example
311  *      @code
312
313 #include <mm_streamrecorder.h>
314
315 gboolean destroy_streamrecorder()
316 {
317         int err;
318
319         //Destroy streamrecorder handle
320         err = mm_streamrecorder_destroy(hstreamrecorder);
321         if (err < 0) {
322                 return FALSE;
323         }
324
325         return TRUE;
326 }
327
328  *      @endcode
329  */
330
331 // DESTROY GSTREAMER
332 int mm_streamrecorder_destroy(MMHandleType streamrecorder);
333
334 /**
335  *    mm_streamrecorder_realize:\n
336  *  Allocate resources for streamrecorder and initialize it.
337  *  This also creates streamer pipeline. So you have to set attributes that are pivotal to create
338  *  the pipeline before calling this function. This function also takes a roll to manage confliction
339  *  between different applications which use streamrecorder. For example, if you try to use streamrecorder when
340  *  other application that is more important such as call application, this function will return
341  *  'MM_ERROR_POLICY_BLOCKED'. On the contrary, if your application that uses streamrecorder starts to launch
342  *  while another application that uses speaker and has lower priority, your application will kick
343  *  another application.
344  *
345  *      @param[in]      streamrecorder  A handle of streamrecorder.
346  *      @return         This function returns zero(MM_ERROR_NONE) on success, or negative value with error code.\n
347  *                      Please refer 'mm_error.h' to know the exact meaning of the error.
348  *      @see            mm_streamrecorder_unrealize
349  *      @pre            Previous state of mm-streamrecorder should be MM_STREAMRECORDER_STATE_CREATED
350  *      @post           Next state of mm-streamrecorder will be MM_STREAMRECORDER_STATE_READY
351  *      @remarks        None
352  */
353
354 // CONSTRUCT PIPLINE
355 int mm_streamrecorder_realize(MMHandleType streamrecorder);
356
357 /**
358  *    mm_streamrecorder_unrealize:\n
359  *  Uninitialize streamrecoder resources and free allocated memory.
360  *  Most important resource that is released here is gstreamer pipeline of mm_streamrecorder.
361  *  Because most of resources are operating on the gstreamer pipeline,
362  *  this function should be called to release its resources.
363  *  Moreover, mm_streamrecorder is controlled by audio session manager. If an user doesn't call this function when he want to release mm_streamrecorder,
364  *  other multimedia frameworks may face session problem. For more detail information, please refer mm_session module.
365  *
366  *      @param[in]      streamrecorder  A handle of streamrecorder.
367  *      @return         This function returns zero(MM_ERROR_NONE) on success, or negative value with error code.\n
368  *                      Please refer 'mm_error.h' to know the exact meaning of the error.
369  *      @see            mm_streamrecorder_realize
370  *      @pre            Previous state of mm-streamrecorder should be MM_STREAMRECORDER_STATE_READY
371  *      @post           Next state of mm-streamrecorder will be MM_STREAMRECORDER_STATE_CREATED
372  *      @remarks        None
373  */
374
375 // DESTROY PIPELINE
376 int mm_streamrecorder_unrealize(MMHandleType streamrecorder);
377
378 /**
379  *      mm_streamrecorder_start:\n
380  *   Start previewing. (Image/Video mode)
381  *
382  *      @param[in]      streamrecorder  A handle of streamrecorder.
383  *      @return         This function returns zero(MM_ERROR_NONE) on success, or negative value with error code.\n
384  *                      Please refer 'mm_error.h' to know the exact meaning of the error.
385  *      @see            mm_streamrecorder_stop
386  *      @pre            Previous state of mm-streamrecorder should be MM_STREAMRECORDER_STATE_READY
387  *      @post           Next state of mm-streamrecorder will be MM_STREAMRECORDER_STATE_PREPARED
388  *      @remarks        None
389  */
390
391 // START ENCODE
392 int mm_streamrecorder_record(MMHandleType streamrecorder);
393
394 /**
395  *    mm_streamrecorder_pause:\n
396  *  Pause A/V recording or Audio recording. (Audio/Video mode only)
397  *
398  *  @param[in]  streamrecorder   A handle of streamrecorder.
399  *  @return     This function returns zero(MM_ERROR_NONE) on success, or negative value with error code.\n
400  *          Please refer 'mm_error.h' to know the exact meaning of the error.
401  *  @see        mm_streamrecorder_record
402  *  @pre        Previous state of mm-streamrecorder should be MM_STREAMRECORDER_STATE_RECORDING
403  *  @post       Next state of mm-streamrecorder will be MM_STREAMRECORDER_STATE_PAUSED
404  *  @remarks    Even though this function is for pausing recording, small amount of buffers could be recorded after pause().
405  *          Because the buffers which are existed in the queue were created before pause(), the buffers should be recorded.
406  */
407 int mm_streamrecorder_pause(MMHandleType streamrecorder);
408
409 /**
410  *    mm_streamrecorder_stop:\n
411  *  Stop previewing. (Image/Video mode)
412  *  This function will change the status of pipeline.
413  *
414  *      @param[in]      streamrecorder  A handle of streamrecorder.
415  *      @return         This function returns zero(MM_ERROR_NONE) on success, or negative value with error code.\n
416  *                      Please refer 'mm_error.h' to know the exact meaning of the error.
417  *      @see            mm_streamrecorder_start
418  *      @pre            Previous state of mm-streamrecorder should be MM_STREAMRECORDER_STATE_PREPARED
419  *      @post           Next state of mm-streamrecorder will be MM_STREAMRECORDER_STATE_READY
420  *      @remarks        None
421  *      @par example
422  *      @code
423
424 #include <mm_streamrecorder.h>
425
426 gboolean stop_streamrecorder()
427 {
428         int err;
429
430         //Stop preview
431         err =  mm_streamrecorder_stop(hstreamrecorder);
432         if (err < 0) {
433                 return FALSE;
434         }
435
436         return TRUE;
437 }
438
439  *      @endcode
440  */
441 int mm_streamrecorder_commit(MMHandleType streamrecorder);
442
443 int mm_streamrecorder_cancel(MMHandleType streamrecorder);
444
445 int mm_streamrecorder_push_stream_buffer(MMHandleType streamrecorder, MMStreamRecorderStreamType streamtype, unsigned long timestamp, void *buffer, int size);
446
447 /**
448  *    mm_streamrecorder_commit:\n
449  *  Stop recording and save results.  (Audio/Video mode only)\n
450  *  After starting recording, encoded data frame will be stored in the location specified in MMSTR_FILENAME.
451  *  Some encoder or muxer require a certain type of finalizing such as adding some information to header.
452  *  This function takes that roll. So if you don't call this function after recording, the result file may not be playable.\n
453  *  Because this is the function for saving the recording result, the operation is available
454  *
455  *      @param[in]      streamrecorder  A handle of streamrecorder.
456  *      @return         This function returns zero(MM_ERROR_NONE) on success, or negative value with error code.\n
457  *                      Please refer 'mm_error.h' to know the exact meaning of the error.
458  *      @see            mm_streamrecorder_cancel
459  *      @pre            Previous state of mm-streamrecorder should be MM_STREAMRECORDER_STATE_RECORDING
460  *      @post           Next state of mm-streamrecorder will be MM_STREAMRECORDER_STATE_PREPARED
461  *      @remarks        This function can take a few second when recording time is long.
462  *                      and if there are only quite few input buffer from video src or audio src,
463  *                      committing could be failed.
464  *      @par example
465  *      @code
466
467 #include <mm_streamrecorder.h>
468
469 gboolean record_and_save_video_file()
470 {
471         int err;
472
473         // Start recording
474         err =  mm_streamrecorder_record(hstreamrecorder);
475         if (err < 0) {
476                 return FALSE;
477         }
478
479         // Wait while recording for test...
480         // In normal case, mm_streamrecorder_record() and mm_streamrecorder_commit() aren't called in the same function.
481
482         // Save file
483         err =  mm_streamrecorder_commit(hstreamrecorder);
484         if (err < 0) {
485                 return FALSE;
486         }
487
488         return TRUE;
489 }
490
491  *      @endcode
492  */
493 int mm_streamrecorder_commit(MMHandleType streamrecorder);
494
495 /**
496  *      mm_streamrecorder_cancel:\n
497  *    Stop recording and discard the result. (Audio/Video mode only)
498  *      When a user want to finish recording without saving the result file, this function can be used.
499  *      Like mm_streamrecorder_commit(), this function also stops recording, release related resources(like codec) ,and goes back to preview status.
500  *      However, instead of saving file, this function unlinks(delete) the result.\n
501  *      Because this is the function for canceling recording, the operation is available
502  *
503  *      @param[in]      streamrecorder  A handle of streamrecorder.
504  *      @return         This function returns zero(MM_ERROR_NONE) on success, or negative value with error code.\n
505  *                      Please refer 'mm_error.h' to know the exact meaning of the error.
506  *      @see            mm_streamrecorder_commit
507  *      @pre            Previous state of mm-streamrecorder should be MM_STREAMRECORDER_STATE_RECORDING
508  *      @post           Next state of mm-streamrecorder will be MM_STREAMRECORDER_STATE_PREPARED
509  *      @remarks        None
510  *      @par example
511  *      @code
512
513 #include <mm_streamrecorder.h>
514
515 gboolean record_and_cancel_video_file()
516 {
517         int err;
518
519         // Start recording
520         err =  mm_streamrecorder_record(hstreamrecorder);
521         if (err < 0) {
522                 return FALSE;
523         }
524
525         // Wait while recording...
526
527         // Cancel recording
528         err =  mm_streamrecorder_cancel(hstreamrecorder);
529         if (err < 0) {
530                 return FALSE;
531         }
532
533         return TRUE;
534 }
535
536  *      @endcode
537  */
538 int mm_streamrecorder_cancel(MMHandleType streamrecorder);
539
540 /**
541  *    mm_streamrecorder_set_message_callback:\n
542  *  Set callback for receiving messages from streamrecorder. Through this callback function, streamrecorder
543  *  sends various message including status changes, asynchronous error, capturing, and limitations.
544  *  One thing you have to know is that message callback is working on the main loop of application.
545  *  So until releasing the main loop, message callback will not be called.
546  *
547  *      @param[in]      streamrecorder  A handle of streamrecorder.
548  *      @param[in]      callback        Function pointer of callback function. Please refer 'MMMessageCallback'.
549  *      @param[in]      user_data       User parameter for passing to callback function.
550  *      @return         This function returns zero(MM_ERROR_NONE) on success, or negative value with error code.\n
551  *                      Please refer 'mm_error.h' to know the exact meaning of the error.
552  *      @see            MMMessageCallback
553  *      @pre            None
554  *      @post           None
555  *      @remarks        registered 'callback' is called on main loop of the application. So until the main loop is released, 'callback' will not be called.
556  *      @par example
557  *      @code
558
559 #include <mm_streamrecorder.h>
560
561 gboolean setting_msg_callback()
562 {
563         //set callback
564         mm_streamrecorder_set_message_callback(hstreamrecorder,(MMMessageCallback)msg_callback, (void*)hstreamrecorder);
565
566         return TRUE;
567 }
568
569  *      @endcode
570  */
571 int mm_streamrecorder_set_message_callback(MMHandleType streamrecorder, MMMessageCallback callback, void *user_data);
572
573 /**
574  *    mm_streamrecorder_get_attributes:\n
575  *  Get attributes of streamrecorder with given attribute names. This function can get multiple attributes
576  *  simultaneously. If one of attribute fails, this function will stop at the point.
577  *  'err_attr_name' let you know the name of the attribute.
578  *
579  *      @param[in]      streamrecorder  Specifies the streamrecorder  handle.
580  *      @param[out]     err_attr_name   Specifies the name of attributes that made an error. If the function doesn't make an error, this will be null. @n
581  *                                      Free this variable after using.
582  *      @param[in]      attribute_name  attribute name that user want to get.
583  *      @return         This function returns zero(MM_ERROR_NONE) on success, or negative value with error code.\n
584  *                      Please refer 'mm_error.h' to know the exact meaning of the error.
585  *      @pre            None
586  *      @post           None
587  *      @remarks        You can retrieve multiple attributes at the same time.  @n
588  *                      This function must finish with 'NULL' argument.  @n
589  *                      ex) mm_streamrecorder_get_attributes(....... , NULL);
590  *      @see            mm_streamrecorder_set_attributes
591  */
592 int mm_streamrecorder_get_attributes(MMHandleType streamrecorder, char **err_attr_name, const char *attribute_name, ...) G_GNUC_NULL_TERMINATED;
593
594 /**
595  *    mm_streamrecorder_set_attributes:\n
596  *  Set attributes of streamrecorder with given attribute names. This function can set multiple attributes
597  *  simultaneously. If one of attribute fails, this function will stop at the point.
598  *  'err_attr_name' let you know the name of the attribute.
599  *
600  *      @param[in]      streamrecorder  Specifies the streamrecorder  handle.
601  *      @param[out]     err_attr_name   Specifies the name of attributes that made an error. If the function doesn't make an error, this will be null. @n
602  *                                      Free this variable after using.
603  *      @param[in]      attribute_name  attribute name that user want to set.
604  *      @return         This function returns zero(MM_ERROR_NONE) on success, or negative value with error code.\n
605  *                      Please refer 'mm_error.h' to know the exact meaning of the error.
606  *      @pre            None
607  *      @post           None
608  *      @remarks        You can put multiple attributes to streamrecorder at the same time.  @n
609  *                      This function must finish with 'NULL' argument.  @n
610  *                      ex) mm_streamrecorder_set_attributes(....... , NULL);
611  *      @see            mm_streamrecorder_get_attributes
612  */
613 int mm_streamrecorder_set_attributes(MMHandleType streamrecorder, char **err_attr_name, const char *attribute_name, ...) G_GNUC_NULL_TERMINATED;
614
615 /**
616  *    mm_streamrecorder_get_attribute_info:\n
617  *  Get detail information of the attribute. To manager attributes, an user may want to know the exact character of the attribute,
618  *  such as type, flag, and validity. This is the function to provide such information.
619  *  Depending on the 'validity_type', validity union would be different. To know about the type of union, please refer 'MMStreamRecorderAttrsInfo'.
620  *
621  *      @param[in]      streamrecorder  Specifies the streamrecorder  handle.
622  *      @param[in]      attribute_name  attribute name that user want to get information.
623  *      @param[out]     info            a structure that holds information related with the attribute.
624  *      @return         This function returns zero(MM_ERROR_NONE) on success, or negative value with error code.\n
625  *                      Please refer 'mm_error.h' to know the exact meaning of the error.
626  *      @pre            None
627  *      @post           None
628  *      @remarks        If the function succeeds, 'info' holds detail information about the attribute, such as type,
629  *                      flag, validity_type, validity_values, and default values.
630  *      @see            mm_streamrecorder_get_attributes, mm_streamrecorder_set_attributes
631  */
632
633 int mm_streamrecorder_get_attribute_info(MMHandleType streamrecorder, const char *attribute_name, MMStreamRecorderAttrsInfo *info);
634
635 /**
636  *    mm_streamrecorder_get_state:\n
637  *  Get the current state of streamreccorder.
638  *  mm_streamrecorderr is working on the base of its state. An user should check the state of mm_streamrecorder before calling its functions.
639  *  If the handle is avaiable, user can retrieve the value.
640  *
641  *  @param[in]  streamrecorder   A handle of streamrecorder.
642  *  @param[out] state       On return, it contains current state of streamrecorder.
643  *  @return     This function returns zero(MM_ERROR_NONE) on success, or negative value with error code.\n
644  *          Please refer 'mm_error.h' to know the exact meaning of the error.
645  *  @see        MMStreamRecorderStateType
646  *  @pre        None
647  *  @post       None
648  *  @remarks    None
649  */
650 int mm_streamrecorder_get_state(MMHandleType streamrecorder, MMStreamRecorderStateType *status);
651
652 /**
653         @}
654  */
655
656 #ifdef __cplusplus
657 }
658 #endif
659
660 #endif /* __MM_STREAMRECORDER_H__ */