Add new API for video encode decision callback
[platform/core/multimedia/libmm-camcorder.git] / src / include / mm_camcorder.h
1 /*
2  * libmm-camcorder
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Jeongmo Yang <jm80.yang@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 /**
23         @addtogroup CAMCORDER
24         @{
25
26         @par
27         This part describes the APIs with repect to Multimedia Camcorder.
28         Camcorder is for recording audio and video from audio and video input devices, capturing
29         still image from video input device, and audio recording from audio input
30         device.
31
32         @par
33         Camcorder can be reached by calling functions as shown in the following
34         figure, "The State of Camcorder".
35
36         @par
37         @image html     camcorder_state.png     "The State of Camcorder"        width=12cm
38         @image latex    camcorder_state.png     "The State of Camcorder"        width=12cm
39
40         @par
41         Between each states there is intermediate state, and in this state,
42         any function call which change the camcorder state will be failed.
43
44         @par
45         Recording state and paused state exists when the mode of camcorder is
46         video-capture or audio-capture mode. In case of image-capture mode, CAPTURING state will
47         exsit.
48
49         @par
50 <div>
51 <table>
52         <tr>
53                 <td>FUNCTION</td>
54                 <td>PRE-STATE</td>
55                 <td>POST-STATE</td>
56                 <td>SYNC TYPE</td>
57         </tr>
58         <tr>
59                 <td>mm_camcorder_create()</td>
60                 <td>NONE</td>
61                 <td>NULL</td>
62                 <td>SYNC</td>
63         </tr>
64         <tr>
65                 <td>mm_camcorder_destroy()</td>
66                 <td>NULL</td>
67                 <td>NONE</td>
68                 <td>SYNC</td>
69         </tr>
70         <tr>
71                 <td>mm_camcorder_realize()</td>
72                 <td>NULL</td>
73                 <td>READY</td>
74                 <td>SYNC</td>
75         </tr>
76         <tr>
77                 <td>mm_camcorder_unrealize()</td>
78                 <td>READY</td>
79                 <td>NULL</td>
80                 <td>SYNC</td>
81         </tr>
82         <tr>
83                 <td>mm_camcorder_start()</td>
84                 <td>READY</td>
85                 <td>PREPARED</td>
86                 <td>SYNC</td>
87         </tr>
88         <tr>
89                 <td>mm_camcorder_stop()</td>
90                 <td>PREPARED</td>
91                 <td>READY</td>
92                 <td>SYNC</td>
93         </tr>
94         <tr>
95                 <td>mm_camcorder_capture_start()</td>
96                 <td>PREPARED</td>
97                 <td>CAPTURING</td>
98                 <td>SYNC</td>
99         </tr>
100         <tr>
101                 <td>mm_camcorder_capture_stop()</td>
102                 <td>CAPTURING</td>
103                 <td>PREPARED</td>
104                 <td>SYNC</td>
105         </tr>
106         <tr>
107                 <td>mm_camcorder_record()</td>
108                 <td>PREPARED/PAUSED</td>
109                 <td>RECORDING</td>
110                 <td>SYNC</td>
111         </tr>
112         <tr>
113                 <td>mm_camcorder_pause()</td>
114                 <td>RECORDING</td>
115                 <td>PAUSED</td>
116                 <td>SYNC</td>
117         </tr>
118         <tr>
119                 <td>mm_camcorder_commit()</td>
120                 <td>RECORDING/PAUSED</td>
121                 <td>PREPARED</td>
122                 <td>SYNC</td>
123         </tr>
124         <tr>
125                 <td>mm_camcorder_cancel()</td>
126                 <td>RECORDING/PAUSED</td>
127                 <td>PREPARED</td>
128                 <td>SYNC</td>
129         </tr>
130         <tr>
131                 <td>mm_camcorder_set_message_callback()</td>
132                 <td>N/A</td>
133                 <td>N/A</td>
134                 <td>SYNC</td>
135         </tr>
136         <tr>
137                 <td>mm_camcorder_set_video_stream_callback()</td>
138                 <td>N/A</td>
139                 <td>N/A</td>
140                 <td>SYNC</td>
141         </tr>
142         <tr>
143                 <td>mm_camcorder_set_video_capture_callback()</td>
144                 <td>N/A</td>
145                 <td>N/A</td>
146                 <td>SYNC</td>
147         </tr>
148         <tr>
149                 <td>mm_camcorder_get_state()</td>
150                 <td>N/A</td>
151                 <td>N/A</td>
152                 <td>SYNC</td>
153         </tr>
154         <tr>
155                 <td>mm_camcorder_get_attributes()</td>
156                 <td>N/A</td>
157                 <td>N/A</td>
158                 <td>SYNC</td>
159         </tr>
160         <tr>
161                 <td>mm_camcorder_set_attributes()</td>
162                 <td>N/A</td>
163                 <td>N/A</td>
164                 <td>SYNC</td>
165         </tr>
166         <tr>
167                 <td>mm_camcorder_get_attribute_info()</td>
168                 <td>N/A</td>
169                 <td>N/A</td>
170                 <td>SYNC</td>
171         </tr>
172         <tr>
173                 <td>mm_camcorder_init_focusing()</td>
174                 <td>N/A</td>
175                 <td>N/A</td>
176                 <td>SYNC</td>
177         </tr>
178         <tr>
179                 <td>mm_camcorder_start_focusing()</td>
180                 <td>N/A</td>
181                 <td>N/A</td>
182                 <td>SYNC</td>
183         </tr>
184         <tr>
185                 <td>mm_camcorder_stop_focusing()</td>
186                 <td>N/A</td>
187                 <td>N/A</td>
188                 <td>SYNC</td>
189         </tr>
190 </table>
191 </div>
192
193         @par
194         * Attribute @n
195         Attribute system is an interface to operate camcorder. Depending on each attribute, camcorder behaves differently.
196         Attribute system provides get/set functions. Setting proper attributes, a user can control camcorder as he want. (mm_camcorder_set_attributes())
197         Also, a user can comprehend current status of the camcorder, calling getter function(mm_camcorder_get_attributes()).
198         Beware, arguments of mm_camcorder_set_attributes() and mm_camcorder_get_attributes() should be finished with 'NULL'.
199         This is a rule for the variable argument.
200         @par
201         Besides its value, each Attribute also has 'type' and 'validity type'. 'type' describes variable type that the attribute can get.
202         If you input a value that has wrong type, camcorder will not work properly or be crashed. 'validity' describes array or
203         range of values that are able to set to the attribute. 'validity type' defines type of the 'validity'.
204         @par
205         A user can retrieve these values using mm_camcorder_get_attribute_info().
206         Following tables have 'Attribute name', 'Attribute macro', 'Type', and 'Validity type'. You can refer '#MMCamAttrsType' and '#MMCamAttrsValidType'
207         for discerning 'Type' and 'Validity type'.
208
209
210         @par
211         Following are the attributes which should be set before initialization (#mm_camcorder_realize):
212
213         @par
214 <div>
215 <table>
216         <tr>
217                 <td><center><b>Attribute</b></center></td>
218                 <td><center><b>Description</b></center></td>
219         </tr>
220         <tr>
221                 <td>#MMCAM_MODE</td>
222                 <td>Mode of camcorder ( still/video/audio )</td>
223         </tr>
224         <tr>
225                 <td>#MMCAM_AUDIO_DEVICE</td>
226                 <td>Audio device ID for capturing audio stream</td>
227         </tr>
228         <tr>
229                 <td>#MMCAM_CAMERA_DEVICE_COUNT</td>
230                 <td>Video device count</td>
231         </tr>
232         <tr>
233                 <td>#MMCAM_AUDIO_ENCODER</td>
234                 <td>Audio codec for encoding audio stream</td>
235         </tr>
236         <tr>
237                 <td>#MMCAM_VIDEO_ENCODER</td>
238                 <td>Video codec for encoding video stream</td>
239         </tr>
240         <tr>
241                 <td>#MMCAM_IMAGE_ENCODER</td>
242                 <td>Image codec for capturing still-image</td>
243         </tr>
244         <tr>
245                 <td>#MMCAM_FILE_FORMAT</td>
246                 <td>File format for recording media stream</td>
247         </tr>
248         <tr>
249                 <td>#MMCAM_AUDIO_SAMPLERATE</td>
250                 <td>Sampling rate of audio stream ( This is an integer field )</td>
251         </tr>
252         <tr>
253                 <td>#MMCAM_AUDIO_FORMAT</td>
254                 <td>Audio format of each sample</td>
255         </tr>
256         <tr>
257                 <td>#MMCAM_AUDIO_CHANNEL</td>
258                 <td>Channels of each sample ( This is an integer field )</td>
259         </tr>
260         <tr>
261                 <td>#MMCAM_AUDIO_INPUT_ROUTE(deprecated)</td>
262                 <td>Set audio input route</td>
263         </tr>
264         <tr>
265                 <td>#MMCAM_CAMERA_FORMAT</td>
266                 <td>Format of video stream. This is an integer field</td>
267         </tr>
268         <tr>
269                 <td>#MMCAM_CAMERA_FPS</td>
270                 <td>Frames per second ( This is an integer field )</td>
271         </tr>
272         <tr>
273                 <td>#MMCAM_CAMERA_WIDTH</td>
274                 <td>Width of input video stream</td>
275         </tr>
276         <tr>
277                 <td>#MMCAM_CAMERA_HEIGHT</td>
278                 <td>Height of input video stream</td>
279         </tr>
280         <tr>
281                 <td>#MMCAM_CAMERA_FPS_AUTO</td>
282                 <td>FPS Auto. When you set true to this attribute, FPS will vary depending on the amount of the light.</td>
283         </tr>
284         <tr>
285                 <td>#MMCAM_DISPLAY_HANDLE</td>
286                 <td>Pointer of display buffer or ID of xwindow</td>
287         </tr>
288         <tr>
289                 <td>#MMCAM_DISPLAY_DEVICE</td>
290                 <td>Device of display</td>
291         </tr>
292         <tr>
293                 <td>#MMCAM_DISPLAY_SURFACE</td>
294                 <td>Surface of display</td>
295         </tr>
296         <tr>
297                 <td>#MMCAM_DISPLAY_SOURCE_X</td>
298                 <td>X position of source rectangle. When you want to crop the source, you can set the area with this value.</td>
299         </tr>
300         <tr>
301                 <td>#MMCAM_DISPLAY_SOURCE_Y</td>
302                 <td>Y position of source rectangle. When you want to crop the source, you can set the area with this value.</td>
303         </tr>
304         <tr>
305                 <td>#MMCAM_DISPLAY_SOURCE_WIDTH</td>
306                 <td>Width of source rectangle. When you want to crop the source, you can set the area with this value.</td>
307         </tr>
308         <tr>
309                 <td>#MMCAM_DISPLAY_SOURCE_HEIGHT</td>
310                 <td>Height of source rectangle. When you want to crop the source, you can set the area with this value.</td>
311         </tr>
312         <tr>
313                 <td>#MMCAM_DISPLAY_ROTATION</td>
314                 <td>Rotation of display</td>
315         </tr>
316         <tr>
317                 <td>#MMCAM_DISPLAY_VISIBLE</td>
318                 <td>Visible of display</td>
319         </tr>
320         <tr>
321                 <td>#MMCAM_DISPLAY_SCALE</td>
322                 <td>A scale of displayed image</td>
323         </tr>
324         <tr>
325                 <td>#MMCAM_DISPLAY_GEOMETRY_METHOD</td>
326                 <td>A method that describes a form of geometry for display</td>
327         </tr>
328 </table>
329 </div>
330
331         @par
332         Following are the attributes which should be set before recording (mm_camcorder_record()):
333
334         @par
335 <div>
336 <table>
337         <tr>
338                 <td><center><b>Attribute</b></center></td>
339                 <td><center><b>Description</b></center></td>
340         </tr>
341         <tr>
342                 <td>#MMCAM_AUDIO_ENCODER_BITRATE</td>
343                 <td>Bitrate of Audio Encoder</td>
344         </tr>
345         <tr>
346                 <td>#MMCAM_VIDEO_ENCODER_BITRATE</td>
347                 <td>Bitrate of Video Encoder</td>
348         </tr>
349         <tr>
350                 <td>#MMCAM_TARGET_FILENAME</td>
351                 <td>Target filename. Only used in Audio/Video recording. This is not used for capturing.</td>
352         </tr>
353         <tr>
354                 <td>#MMCAM_TARGET_MAX_SIZE</td>
355                 <td>Maximum size of recording file(Kbyte). If the size of file reaches this value.</td>
356         </tr>
357         <tr>
358                 <td>#MMCAM_TARGET_TIME_LIMIT</td>
359                 <td>Time limit of recording file. If the elapsed time of recording reaches this value.</td>
360         </tr>
361 </table>
362 </div>
363
364         @par
365         Following are the attributes which should be set before capturing (mm_camcorder_capture_start()):
366
367         @par
368 <div>
369 <table>
370         <tr>
371                 <td><center><b>Attribute</b></center></td>
372                 <td><center><b>Description</b></center></td>
373         </tr>
374         <tr>
375                 <td>#MMCAM_IMAGE_ENCODER_QUALITY</td>
376                 <td>Encoding quality of Image codec</td>
377         </tr>
378         <tr>
379                 <td>#MMCAM_CAPTURE_FORMAT</td>
380                 <td>Pixel format that you want to capture</td>
381         </tr>
382         <tr>
383                 <td>#MMCAM_CAPTURE_WIDTH</td>
384                 <td>Width of the image that you want to capture</td>
385         </tr>
386         <tr>
387                 <td>#MMCAM_CAPTURE_HEIGHT</td>
388                 <td>Height of the image that you want to capture</td>
389         </tr>
390         <tr>
391                 <td>#MMCAM_CAPTURE_COUNT</td>
392                 <td>Total count of capturing</td>
393         </tr>
394         <tr>
395                 <td>#MMCAM_CAPTURE_INTERVAL</td>
396                 <td>Interval between each capturing on Multishot ( MMCAM_CAPTURE_COUNT > 1 )</td>
397         </tr>
398 </table>
399 </div>
400
401         @par
402         Following are the attributes which can be set anytime:
403
404         @par
405 <div>
406 <table>
407         <tr>
408                 <td><center><b>Attribute</b></center></td>
409                 <td><center><b>Description</b></center></td>
410         </tr>
411         <tr>
412                 <td>#MMCAM_AUDIO_VOLUME</td>
413                 <td>Input volume of audio source ( double value )</td>
414         </tr>
415         <tr>
416                 <td>#MMCAM_CAMERA_DIGITAL_ZOOM</td>
417                 <td>Digital zoom level</td>
418         </tr>
419         <tr>
420                 <td>#MMCAM_CAMERA_OPTICAL_ZOOM</td>
421                 <td>Optical zoom level</td>
422         </tr>
423         <tr>
424                 <td>#MMCAM_CAMERA_FOCUS_MODE</td>
425                 <td>Focus mode</td>
426         </tr>
427         <tr>
428                 <td>#MMCAM_CAMERA_AF_SCAN_RANGE</td>
429                 <td>AF Scan range</td>
430         </tr>
431         <tr>
432                 <td>#MMCAM_CAMERA_AF_TOUCH_X</td>
433                 <td>X coordinate of touching position</td>
434         </tr>
435         <tr>
436                 <td>#MMCAM_CAMERA_AF_TOUCH_Y</td>
437                 <td>Y coordinate of touching position</td>
438         </tr>
439         <tr>
440                 <td>#MMCAM_CAMERA_AF_TOUCH_WIDTH</td>
441                 <td>Width of touching area</td>
442         </tr>
443         <tr>
444                 <td>#MMCAM_CAMERA_AF_TOUCH_HEIGHT</td>
445                 <td>Height of touching area</td>
446         </tr>
447         <tr>
448                 <td>#MMCAM_CAMERA_EXPOSURE_MODE</td>
449                 <td>Exposure mode</td>
450         </tr>
451         <tr>
452                 <td>#MMCAM_CAMERA_EXPOSURE_VALUE</td>
453                 <td>Exposure value</td>
454         </tr>
455         <tr>
456                 <td>#MMCAM_CAMERA_F_NUMBER</td>
457                 <td>f number of camera</td>
458         </tr>
459         <tr>
460                 <td>#MMCAM_CAMERA_SHUTTER_SPEED</td>
461                 <td>Shutter speed</td>
462         </tr>
463         <tr>
464                 <td>#MMCAM_CAMERA_ISO</td>
465                 <td>ISO of capturing image</td>
466         </tr>
467         <tr>
468                 <td>#MMCAM_CAMERA_WDR</td>
469                 <td>Wide dynamic range</td>
470         </tr>
471         <tr>
472                 <td>#MMCAM_CAMERA_ANTI_HANDSHAKE</td>
473                 <td>Anti Handshake</td>
474         </tr>
475         <tr>
476                 <td>#MMCAM_CAMERA_FOCAL_LENGTH</td>
477                 <td>Focal length of camera lens</td>
478         </tr>
479         <tr>
480                 <td>#MMCAM_FILTER_BRIGHTNESS</td>
481                 <td>Brightness level</td>
482         </tr>
483         <tr>
484                 <td>#MMCAM_FILTER_CONTRAST</td>
485                 <td>Contrast level</td>
486         </tr>
487         <tr>
488                 <td>#MMCAM_FILTER_WB</td>
489                 <td>White balance</td>
490         </tr>
491         <tr>
492                 <td>#MMCAM_FILTER_COLOR_TONE</td>
493                 <td>Color tone (Color effect)</td>
494         </tr>
495         <tr>
496                 <td>#MMCAM_FILTER_SCENE_MODE</td>
497                 <td>Scene mode (Program mode)</td>
498         </tr>
499         <tr>
500                 <td>#MMCAM_FILTER_SATURATION</td>
501                 <td>Saturation level</td>
502         </tr>
503         <tr>
504                 <td>#MMCAM_FILTER_HUE</td>
505                 <td>Hue level</td>
506         </tr>
507         <tr>
508                 <td>#MMCAM_FILTER_SHARPNESS</td>
509                 <td>Sharpness level</td>
510         </tr>
511         <tr>
512                 <td>#MMCAM_CAPTURE_BREAK_CONTINUOUS_SHOT</td>
513                 <td>Set this as true when you want to stop multishot immediately</td>
514         </tr>
515         <tr>
516                 <td>#MMCAM_DISPLAY_RECT_X</td>
517                 <td>X position of display rectangle (This is only available when MMCAM_DISPLAY_GEOMETRY_METHOD is MM_CAMCORDER_CUSTOM_ROI)</td>
518         </tr>
519         <tr>
520                 <td>#MMCAM_DISPLAY_RECT_Y</td>
521                 <td>Y position of display rectangle (This is only available when MMCAM_DISPLAY_GEOMETRY_METHOD is MM_CAMCORDER_CUSTOM_ROI)</td>
522         </tr>
523         <tr>
524                 <td>#MMCAM_DISPLAY_RECT_WIDTH</td>
525                 <td>Width of display rectangle (This is only available when MMCAM_DISPLAY_GEOMETRY_METHOD is MM_CAMCORDER_CUSTOM_ROI)</td>
526         </tr>
527         <tr>
528                 <td>#MMCAM_DISPLAY_RECT_HEIGHT</td>
529                 <td>Height of display rectangle (This is only available when MMCAM_DISPLAY_GEOMETRY_METHOD is MM_CAMCORDER_CUSTOM_ROI)</td>
530         </tr>
531         <tr>
532                 <td>#MMCAM_TAG_ENABLE</td>
533                 <td>Enable to write tags (If this value is FALSE, none of tag information will be written to captured file)</td>
534         </tr>
535         <tr>
536                 <td>#MMCAM_TAG_IMAGE_DESCRIPTION</td>
537                 <td>Image description</td>
538         </tr>
539         <tr>
540                 <td>#MMCAM_TAG_ORIENTATION</td>
541                 <td>Orientation of captured image</td>
542         </tr>
543         <tr>
544                 <td>#MMCAM_TAG_VIDEO_ORIENTATION</td>
545                 <td>Orientation of encoded video</td>
546         </tr>
547         <tr>
548                 <td>#MMCAM_TAG_SOFTWARE</td>
549                 <td>software name and version</td>
550         </tr>
551         <tr>
552                 <td>#MMCAM_TAG_LATITUDE</td>
553                 <td>Latitude of captured postion (GPS information)</td>
554         </tr>
555         <tr>
556                 <td>#MMCAM_TAG_LONGITUDE</td>
557                 <td>Longitude of captured postion (GPS information)</td>
558         </tr>
559         <tr>
560                 <td>#MMCAM_TAG_ALTITUDE</td>
561                 <td>Altitude of captured postion (GPS information)</td>
562         </tr>
563         <tr>
564                 <td>#MMCAM_STROBE_CONTROL</td>
565                 <td>Strobe control</td>
566         </tr>
567         <tr>
568                 <td>#MMCAM_STROBE_MODE</td>
569                 <td>Operation Mode of strobe</td>
570         </tr>
571         <tr>
572                 <td>#MMCAM_DETECT_MODE</td>
573                 <td>Detection mode</td>
574         </tr>
575         <tr>
576                 <td>#MMCAM_DETECT_NUMBER</td>
577                 <td>Total number of detected object</td>
578         </tr>
579         <tr>
580                 <td>#MMCAM_DETECT_FOCUS_SELECT</td>
581                 <td>Select one of detected objects</td>
582         </tr>
583 </table>
584 </div>
585  */
586
587
588
589 #ifndef __MM_CAMCORDER_H__
590 #define __MM_CAMCORDER_H__
591
592
593 /*=======================================================================================
594 | INCLUDE FILES                                                                         |
595 ========================================================================================*/
596 #include <glib.h>
597
598 #include <mm_types.h>
599 #include <mm_error.h>
600 #include <mm_message.h>
601
602 #ifdef __cplusplus
603 extern "C" {
604 #endif
605
606 /*=======================================================================================
607 | GLOBAL DEFINITIONS AND DECLARATIONS FOR CAMCORDER                                     |
608 ========================================================================================*/
609
610 /*=======================================================================================
611 | MACRO DEFINITIONS                                                                     |
612 ========================================================================================*/
613 /**
614  * Get numerator. Definition for fraction setting, such as MMCAM_CAMERA_SHUTTER_SPEED and MMCAM_CAMERA_EXPOSURE_VALUE.
615  */
616 #define MM_CAMCORDER_GET_NUMERATOR(x)                                   ((int)(((int)(x) >> 16) & 0xFFFF))
617 /**
618  * Get denominator. Definition for fraction setting, such as MMCAM_CAMERA_SHUTTER_SPEED and MMCAM_CAMERA_EXPOSURE_VALUE.
619  */
620 #define MM_CAMCORDER_GET_DENOMINATOR(x)                                 ((int)(((int)(x)) & 0xFFFF))
621 /**
622  * Set fraction value. Definition for fraction setting, such as MMCAM_CAMERA_SHUTTER_SPEED and MMCAM_CAMERA_EXPOSURE_VALUE.
623  */
624 #define MM_CAMCORDER_SET_FRACTION(numerator, denominator)       ((int)((((int)(numerator)) << 16) | (int)(denominator)))
625
626 /* Attributes Macros */
627 /**
628  * Mode of camcorder (still/video/audio).
629  * @see         MMCamcorderModeType
630  */
631 #define MMCAM_MODE                              "mode"
632
633 /**
634  * Audio device ID for capturing audio stream.
635  * @see         MMAudioDeviceType (in mm_types.h)
636  */
637 #define MMCAM_AUDIO_DEVICE                      "audio-device"
638
639 /**
640  * Video device count.
641  */
642 #define MMCAM_CAMERA_DEVICE_COUNT               "camera-device-count"
643
644 /**
645  * Facing direction of camera device.
646  * @see         MMCamcorderCameraFacingDirection
647  */
648 #define MMCAM_CAMERA_FACING_DIRECTION           "camera-facing-direction"
649
650 /**
651  * Audio codec for encoding audio stream.
652  * @see         MMAudioCodecType  (in mm_types.h)
653  */
654 #define MMCAM_AUDIO_ENCODER                     "audio-encoder"
655
656 /**
657  * Video codec for encoding video stream.
658  * @see         MMVideoCodecType (in mm_types.h)
659  */
660 #define MMCAM_VIDEO_ENCODER                     "video-encoder"
661
662 /**
663  * Image codec for capturing still-image.
664  * @see         MMImageCodecType (in mm_types.h)
665  */
666 #define MMCAM_IMAGE_ENCODER                     "image-encoder"
667
668 /**
669  * File format for recording media stream.
670  * @see         MMFileFormatType (in mm_types.h)
671  */
672 #define MMCAM_FILE_FORMAT                       "file-format"
673
674 /**
675  * Sampling rate of audio stream. This is an integer field.
676  */
677 #define MMCAM_AUDIO_SAMPLERATE                  "audio-samplerate"
678
679 /**
680  * Audio format of each sample.
681  * @see         MMCamcorderAudioFormat
682  */
683 #define MMCAM_AUDIO_FORMAT                      "audio-format"
684
685 /**
686  * Channels of each sample. This is an integer field.
687  */
688 #define MMCAM_AUDIO_CHANNEL                     "audio-channel"
689
690 /**
691  * Input volume of audio source. Double value.
692  */
693 #define MMCAM_AUDIO_VOLUME                      "audio-volume"
694
695 /**
696  * Disable Audio stream when record.
697  */
698 #define MMCAM_AUDIO_DISABLE                     "audio-disable"
699
700 /**
701  * Set audio input route
702  * @remarks     Deprecated. This will be removed soon.
703  * @see         MMAudioRoutePolicy (in mm_types.h)
704  */
705 #define MMCAM_AUDIO_INPUT_ROUTE                 "audio-input-route"
706
707 /**
708  * Format of video stream. This is an integer field
709  * @see         MMPixelFormatType (in mm_types.h)
710  */
711 #define MMCAM_CAMERA_FORMAT                     "camera-format"
712
713 /**
714  * Slow motion rate when video recording
715  * @remarks     Deprecated
716  */
717 #define MMCAM_CAMERA_SLOW_MOTION_RATE           "camera-slow-motion-rate"
718
719 /**
720  * Motion rate when video recording
721  * @remarks     This should be bigger than 0(zero).
722  *              Default value is 1 and it's for normal video recording.
723  *              If the value is smaller than 1, recorded file will be played slower,
724  *              otherwise, recorded file will be played faster.
725  */
726 #define MMCAM_CAMERA_RECORDING_MOTION_RATE      "camera-recording-motion-rate"
727
728 /**
729  * Frames per second. This is an integer field
730  *
731  */
732 #define MMCAM_CAMERA_FPS                        "camera-fps"
733
734 /**
735  * Width of preview stream.
736  */
737 #define MMCAM_CAMERA_WIDTH                      "camera-width"
738
739 /**
740  * Height of preview stream.
741  */
742 #define MMCAM_CAMERA_HEIGHT                     "camera-height"
743
744 /**
745  * Width of video stream.
746  */
747 #define MMCAM_VIDEO_WIDTH                       "video-width"
748
749 /**
750  * Height of video stream.
751  */
752 #define MMCAM_VIDEO_HEIGHT                      "video-height"
753
754 /**
755  * Digital zoom level.
756  */
757 #define MMCAM_CAMERA_DIGITAL_ZOOM               "camera-digital-zoom"
758
759 /**
760  * Optical zoom level.
761  */
762 #define MMCAM_CAMERA_OPTICAL_ZOOM               "camera-optical-zoom"
763
764 /**
765  * Focus mode
766  * @see         MMCamcorderFocusMode
767  */
768 #define MMCAM_CAMERA_FOCUS_MODE                 "camera-focus-mode"
769
770 /**
771  * AF Scan range
772  * @see         MMCamcorderAutoFocusType
773  */
774 #define MMCAM_CAMERA_AF_SCAN_RANGE              "camera-af-scan-range"
775
776 /**
777  * X coordinate of touching position. Only available when you set '#MM_CAMCORDER_AUTO_FOCUS_TOUCH' to '#MMCAM_CAMERA_AF_SCAN_RANGE'.
778  * @see         MMCamcorderAutoFocusType
779  */
780 #define MMCAM_CAMERA_AF_TOUCH_X                 "camera-af-touch-x"
781
782 /**
783  * Y coordinate of touching position. Only available when you set '#MM_CAMCORDER_AUTO_FOCUS_TOUCH' to '#MMCAM_CAMERA_AF_SCAN_RANGE'.
784  * @see         MMCamcorderAutoFocusType
785  */
786 #define MMCAM_CAMERA_AF_TOUCH_Y                 "camera-af-touch-y"
787
788 /**
789  * Width of touching area. Only available when you set '#MM_CAMCORDER_AUTO_FOCUS_TOUCH' to '#MMCAM_CAMERA_AF_SCAN_RANGE'.
790  * @see         MMCamcorderAutoFocusType
791  */
792 #define MMCAM_CAMERA_AF_TOUCH_WIDTH             "camera-af-touch-width"
793
794 /**
795  * Height of touching area. Only available when you set '#MM_CAMCORDER_AUTO_FOCUS_TOUCH' to '#MMCAM_CAMERA_AF_SCAN_RANGE'.
796  * @see         MMCamcorderAutoFocusType
797  */
798 #define MMCAM_CAMERA_AF_TOUCH_HEIGHT            "camera-af-touch-height"
799
800 /**
801  * Exposure mode
802  * @see         MMCamcorderAutoExposureType
803  */
804 #define MMCAM_CAMERA_EXPOSURE_MODE              "camera-exposure-mode"
805
806 /**
807  * Exposure value
808  */
809 #define MMCAM_CAMERA_EXPOSURE_VALUE             "camera-exposure-value"
810
811 /**
812  * f number of camera
813  */
814 #define MMCAM_CAMERA_F_NUMBER                   "camera-f-number"
815
816 /**
817  * Shutter speed
818  */
819 #define MMCAM_CAMERA_SHUTTER_SPEED              "camera-shutter-speed"
820
821 /**
822  * ISO of capturing image
823  * @see         MMCamcorderISOType
824  */
825 #define MMCAM_CAMERA_ISO                        "camera-iso"
826
827 /**
828  * Wide dynamic range.
829  * @see         MMCamcorderWDRMode
830  */
831 #define MMCAM_CAMERA_WDR                        "camera-wdr"
832
833 /**
834  * Focal length of camera lens.
835  */
836 #define MMCAM_CAMERA_FOCAL_LENGTH               "camera-focal-length"
837
838 /**
839  * Anti Handshake
840  * @see         MMCamcorderAHSMode
841  */
842 #define MMCAM_CAMERA_ANTI_HANDSHAKE             "camera-anti-handshake"
843
844 /**
845  * Video Stabilization
846  * @see         MMCamcorderVideoStabilizationMode
847  */
848 #define MMCAM_CAMERA_VIDEO_STABILIZATION        "camera-video-stabilization"
849
850 /**
851  * FPS Auto. When you set true to this attribute, FPS will vary depending on the amount of the light.
852  */
853 #define MMCAM_CAMERA_FPS_AUTO                   "camera-fps-auto"
854
855 /**
856  * Rotation angle of video input stream.
857  * @see         MMVideoInputRotationType (in mm_types.h)
858  */
859 #define MMCAM_CAMERA_ROTATION                   "camera-rotation"
860
861 /**
862  * HDR(High Dynamic Range) Capture mode
863  * @see         MMCamcorderHDRMode
864  */
865 #define MMCAM_CAMERA_HDR_CAPTURE                "camera-hdr-capture"
866
867 /**
868  * Bitrate of Audio Encoder
869  */
870 #define MMCAM_AUDIO_ENCODER_BITRATE             "audio-encoder-bitrate"
871
872 /**
873  * Bitrate of Video Encoder
874  */
875 #define MMCAM_VIDEO_ENCODER_BITRATE             "video-encoder-bitrate"
876
877 /**
878  * Encoding quality of Image codec
879  */
880 #define MMCAM_IMAGE_ENCODER_QUALITY             "image-encoder-quality"
881
882 /**
883  * Brightness level
884  */
885 #define MMCAM_FILTER_BRIGHTNESS                 "filter-brightness"
886
887 /**
888  * Contrast level
889  */
890 #define MMCAM_FILTER_CONTRAST                   "filter-contrast"
891
892 /**
893  * White balance
894  * @see         MMCamcorderWhiteBalanceType
895  */
896 #define MMCAM_FILTER_WB                         "filter-wb"
897
898 /**
899  * Color tone. (Color effect)
900  * @see         MMCamcorderColorToneType
901  */
902 #define MMCAM_FILTER_COLOR_TONE                 "filter-color-tone"
903
904 /**
905  * Scene mode (Program mode)
906  * @see         MMCamcorderSceneModeType
907  */
908 #define MMCAM_FILTER_SCENE_MODE                 "filter-scene-mode"
909
910 /**
911  * Saturation  level
912  */
913 #define MMCAM_FILTER_SATURATION                 "filter-saturation"
914
915 /**
916  * Hue  level
917  */
918 #define MMCAM_FILTER_HUE                        "filter-hue"
919
920 /**
921  * Sharpness  level
922  */
923 #define MMCAM_FILTER_SHARPNESS                  "filter-sharpness"
924
925 /**
926  * Pixel format that you want to capture. If you set MM_PIXEL_FORMAT_ENCODED,
927  * the result will be encoded by image codec specified in #MMCAM_IMAGE_ENCODER.
928  * If not, the result will be raw data.
929  *
930  * @see         MMPixelFormatType (in mm_types.h)
931  */
932 #define MMCAM_CAPTURE_FORMAT                    "capture-format"
933
934 /**
935  * Width of the image that you want to capture
936  */
937 #define MMCAM_CAPTURE_WIDTH                     "capture-width"
938
939 /**
940  * Height of the image that you want to capture
941
942  */
943 #define MMCAM_CAPTURE_HEIGHT                    "capture-height"
944
945 /**
946  * Total count of capturing. If you set this, it will caputre multiple time.
947  */
948 #define MMCAM_CAPTURE_COUNT                     "capture-count"
949
950 /**
951  * Interval between each capturing on Multishot.
952  */
953 #define MMCAM_CAPTURE_INTERVAL                  "capture-interval"
954
955 /**
956  * Set this when you want to stop multishot immediately.
957  */
958 #define MMCAM_CAPTURE_BREAK_CONTINUOUS_SHOT     "capture-break-cont-shot"
959
960 /**
961  * Raw data of captured image which resolution is same as preview.
962  * This is READ-ONLY attribute and only available in capture callback.
963  * This should be used after casted as MMCamcorderCaptureDataType.
964  */
965 #define MMCAM_CAPTURED_SCREENNAIL               "captured-screennail"
966
967 /**
968  * Raw data of EXIF. This is READ-ONLY attribute and only available in capture callback.
969  */
970 #define MMCAM_CAPTURED_EXIF_RAW_DATA            "captured-exif-raw-data"
971
972 /**
973  * Pointer of display buffer or ID of xwindow.
974  */
975 #define MMCAM_DISPLAY_HANDLE                    "display-handle"
976
977 /**
978  * Device of display.
979  * @see         MMDisplayDeviceType (in mm_types.h)
980  */
981 #define MMCAM_DISPLAY_DEVICE                    "display-device"
982
983 /**
984  * Surface of display.
985  * @see         MMDisplaySurfaceType (in mm_types.h)
986  */
987 #define MMCAM_DISPLAY_SURFACE                    "display-surface"
988
989 /**
990  * Mode of display.
991  * @see         MMDisplayModeType (in mm_types.h)
992  */
993 #define MMCAM_DISPLAY_MODE                       "display-mode"
994
995 /**
996  * X position of display rectangle.
997  * This is only available when #MMCAM_DISPLAY_GEOMETRY_METHOD is MM_CAMCORDER_CUSTOM_ROI.
998  * @see         MMCamcorderGeometryMethod
999  */
1000 #define MMCAM_DISPLAY_RECT_X                    "display-rect-x"
1001
1002 /**
1003  * Y position of display rectangle
1004  * This is only available when #MMCAM_DISPLAY_GEOMETRY_METHOD is MM_CAMCORDER_CUSTOM_ROI.
1005  * @see         MMCamcorderGeometryMethod
1006  */
1007 #define MMCAM_DISPLAY_RECT_Y                    "display-rect-y"
1008
1009 /**
1010  * Width of display rectangle
1011  * This is only available when #MMCAM_DISPLAY_GEOMETRY_METHOD is MM_CAMCORDER_CUSTOM_ROI.
1012  * @see         MMCamcorderGeometryMethod
1013  */
1014 #define MMCAM_DISPLAY_RECT_WIDTH                "display-rect-width"
1015
1016 /**
1017  * Height of display rectangle
1018  * This is only available when #MMCAM_DISPLAY_GEOMETRY_METHOD is MM_CAMCORDER_CUSTOM_ROI.
1019  * @see         MMCamcorderGeometryMethod
1020  */
1021 #define MMCAM_DISPLAY_RECT_HEIGHT               "display-rect-height"
1022
1023 /**
1024  * X position of source rectangle. When you want to crop the source, you can set the area with this value.
1025  */
1026 #define MMCAM_DISPLAY_SOURCE_X                  "display-src-x"
1027
1028 /**
1029  * Y position of source rectangle. When you want to crop the source, you can set the area with this value.
1030  */
1031 #define MMCAM_DISPLAY_SOURCE_Y                  "display-src-y"
1032
1033 /**
1034  * Width of source rectangle. When you want to crop the source, you can set the area with this value.
1035  */
1036 #define MMCAM_DISPLAY_SOURCE_WIDTH              "display-src-width"
1037
1038 /**
1039  * Height of source rectangle. When you want to crop the source, you can set the area with this value.
1040  */
1041 #define MMCAM_DISPLAY_SOURCE_HEIGHT             "display-src-height"
1042
1043 /**
1044  * Rotation angle of display.
1045  * @see         MMDisplayRotationType (in mm_types.h)
1046  */
1047 #define MMCAM_DISPLAY_ROTATION                  "display-rotation"
1048
1049 /**
1050  * Flip of display.
1051  * @see         MMFlipType (in mm_types.h)
1052  */
1053 #define MMCAM_DISPLAY_FLIP                      "display-flip"
1054
1055 /**
1056  * Visible of display.
1057  */
1058 #define MMCAM_DISPLAY_VISIBLE                   "display-visible"
1059
1060 /**
1061  * A scale of displayed image. Available value is like below.
1062  * @see         MMDisplayScaleType (in mm_types.h)
1063  */
1064 #define MMCAM_DISPLAY_SCALE                     "display-scale"
1065
1066 /**
1067  * A method that describes a form of geometry for display.
1068  * @see         MMCamcorderGeometryMethod
1069  */
1070 #define MMCAM_DISPLAY_GEOMETRY_METHOD           "display-geometry-method"
1071
1072 /**
1073  * A videosink name of evas surface.
1074  * This is READ-ONLY attribute.
1075  */
1076 #define MMCAM_DISPLAY_EVAS_SURFACE_SINK         "display-evas-surface-sink"
1077
1078 /**
1079  * This attribute is only available if value of MMCAM_DISPLAY_EVAS_SURFACE_SINK "evaspixmapsink"
1080  */
1081 #define MMCAM_DISPLAY_EVAS_DO_SCALING           "display-evas-do-scaling"
1082
1083 /**
1084  * Target filename. Only used in Audio/Video recording. This is not used for capturing.
1085  */
1086 #define MMCAM_TARGET_FILENAME                   "target-filename"
1087
1088 /**
1089  * Maximum size(Kbyte) of recording file. If the size of file reaches this value,
1090  * camcorder will send 'MM_MESSAGE_CAMCORDER_MAX_SIZE' message.
1091  */
1092 #define MMCAM_TARGET_MAX_SIZE                   "target-max-size"
1093
1094 /**
1095  * Time limit(Second) of recording file. If the elapsed time of recording reaches this value,
1096  * camcorder will send 'MM_MESSAGE_CAMCORDER_TIME_LIMIT' message.
1097  */
1098 #define MMCAM_TARGET_TIME_LIMIT                 "target-time-limit"
1099
1100 /**
1101  * Enable to write tags. If this value is FALSE, none of tag information will be written to captured file.
1102  */
1103 #define MMCAM_TAG_ENABLE                        "tag-enable"
1104
1105 /**
1106  * Image description.
1107  */
1108 #define MMCAM_TAG_IMAGE_DESCRIPTION             "tag-image-description"
1109
1110 /**
1111  * Orientation of captured image
1112  * @see         MMCamcorderTagOrientation
1113  */
1114 #define MMCAM_TAG_ORIENTATION                   "tag-orientation"
1115
1116 /**
1117  * Orientation of captured video
1118  * @see         MMCamcorderTagVideoOrientation
1119  */
1120 #define MMCAM_TAG_VIDEO_ORIENTATION            "tag-video-orientation"
1121
1122 /**
1123  * software name and version
1124  */
1125 #define MMCAM_TAG_SOFTWARE                      "tag-software"
1126
1127 /**
1128  * Enable to write tags related to GPS. If this value is TRUE, tags related GPS information will be written to captured file.
1129  */
1130 #define MMCAM_TAG_GPS_ENABLE                    "tag-gps-enable"
1131
1132 /**
1133  * Latitude of captured postion. GPS information.
1134  */
1135 #define MMCAM_TAG_LATITUDE                      "tag-latitude"
1136
1137 /**
1138  * Longitude of captured postion. GPS information.
1139  */
1140 #define MMCAM_TAG_LONGITUDE                     "tag-longitude"
1141
1142 /**
1143  * Altitude of captured postion. GPS information.
1144  */
1145 #define MMCAM_TAG_ALTITUDE                      "tag-altitude"
1146
1147 /**
1148  * Strobe control
1149  * @see         MMCamcorderStrobeControl
1150  */
1151 #define MMCAM_STROBE_CONTROL                    "strobe-control"
1152
1153 /**
1154  * Operation Mode of strobe
1155  * @see         MMCamcorderStrobeMode
1156  */
1157 #define MMCAM_STROBE_MODE                       "strobe-mode"
1158
1159 /**
1160  * Detection mode
1161  * @see         MMCamcorderDetectMode
1162  */
1163 #define MMCAM_DETECT_MODE                       "detect-mode"
1164
1165 /**
1166  * Total number of detected object
1167  */
1168 #define MMCAM_DETECT_NUMBER                     "detect-number"
1169
1170 /**
1171  * You can use this attribute to select one of detected objects.
1172  */
1173 #define MMCAM_DETECT_FOCUS_SELECT               "detect-focus-select"
1174
1175 /**
1176  * Recommend preview format for capture
1177  */
1178 #define MMCAM_RECOMMEND_PREVIEW_FORMAT_FOR_CAPTURE     "recommend-preview-format-for-capture"
1179
1180 /**
1181  * Recommend preview format for recording
1182  */
1183 #define MMCAM_RECOMMEND_PREVIEW_FORMAT_FOR_RECORDING   "recommend-preview-format-for-recording"
1184
1185 /**
1186  * Recommend rotation of display
1187  */
1188 #define MMCAM_RECOMMEND_DISPLAY_ROTATION        "recommend-display-rotation"
1189
1190 /**
1191  * Recommend width of camera preview.
1192  * This attribute can be used with #mm_camcorder_get_attribute_info and #MMCamcorderPreviewType.
1193  * @see         mm_camcorder_get_attribute_info, MMCamcorderPreviewType
1194  */
1195 #define MMCAM_RECOMMEND_CAMERA_WIDTH            "recommend-camera-width"
1196
1197 /**
1198  * Recommend height of camera preview
1199  * This attribute can be used with #mm_camcorder_get_attribute_info and #MMCamcorderPreviewType.
1200  * @see         mm_camcorder_get_attribute_info, MMCamcorderPreviewType
1201  */
1202 #define MMCAM_RECOMMEND_CAMERA_HEIGHT           "recommend-camera-height"
1203
1204 /**
1205  * Enable to play capture sound
1206  */
1207 #define MMCAM_CAPTURE_SOUND_ENABLE              "capture-sound-enable"
1208
1209 /**
1210  * Flip of video input stream.
1211  * @see         MMFlipType (in mm_types.h)
1212  */
1213 #define MMCAM_CAMERA_FLIP                       "camera-flip"
1214
1215 /**
1216  * Support Zero Shutter Lag capture
1217  */
1218 #define MMCAM_SUPPORT_ZSL_CAPTURE               "support-zsl-capture"
1219
1220 /**
1221 * Support zero copy format
1222 */
1223 #define MMCAM_SUPPORT_ZERO_COPY_FORMAT          "support-zero-copy-format"
1224
1225 /**
1226 * Support media packet callback
1227 */
1228 #define MMCAM_SUPPORT_MEDIA_PACKET_PREVIEW_CB   "support-media-packet-preview-cb"
1229
1230 /**
1231 * Support user buffer for zero copy
1232 */
1233 #define MMCAM_SUPPORT_USER_BUFFER               "support-user-buffer"
1234
1235 /**
1236 * Buffer fd from user
1237 */
1238 #define MMCAM_USER_BUFFER_FD                    "user-buffer-fd"
1239
1240 /**
1241  * Enable to write tags for recorded file
1242  */
1243 #define MMCAM_RECORDER_TAG_ENABLE               "recorder-tag-enable"
1244
1245 /**
1246  * Determines the socket stream path
1247  */
1248 #define MMCAM_DISPLAY_SOCKET_PATH               "display-socket-path"
1249
1250 /**
1251  * Client PID
1252  */
1253 #define MMCAM_CLIENT_PID                        "client-pid"
1254
1255 /**
1256  * Root directory of application
1257  */
1258 #define MMCAM_ROOT_DIRECTORY                    "root-directory"
1259
1260 /**
1261  * Bitrate for encoded preview stream
1262  */
1263 #define MMCAM_ENCODED_PREVIEW_BITRATE           "encoded-preview-bitrate"
1264
1265 /**
1266  * GOP interval for encoded preview stream
1267  */
1268 #define MMCAM_ENCODED_PREVIEW_GOP_INTERVAL      "encoded-preview-gop-interval"
1269
1270 /**
1271  * The distance to move the camera horizontally and physically
1272  */
1273 #define MMCAM_CAMERA_PAN_MECHA                  "camera-pan-mecha"
1274
1275 /**
1276  * The distance to move the camera horizontally
1277  */
1278 #define MMCAM_CAMERA_PAN_ELEC                   "camera-pan-elec"
1279
1280 /**
1281  * The distance to move the camera vertically and physically
1282  */
1283 #define MMCAM_CAMERA_TILT_MECHA                 "camera-tilt-mecha"
1284
1285 /**
1286  * The distance to move the camera vertically
1287  */
1288 #define MMCAM_CAMERA_TILT_ELEC                  "camera-tilt-elec"
1289
1290 /**
1291  * The type of PTZ(Pan Tilt Zoom). Mechanical or Electonic PTZ.
1292  */
1293 #define MMCAM_CAMERA_PTZ_TYPE                   "camera-ptz-type"
1294
1295 /**
1296  * Stream type and index for sound route
1297  */
1298 #define MMCAM_SOUND_STREAM_TYPE                 "sound-stream-type"
1299 #define MMCAM_SOUND_STREAM_INDEX                "sound-stream-index"
1300
1301 /**
1302  * The display reuse flag and sink element pointer
1303  */
1304 #define MMCAM_DISPLAY_REUSE_HINT                "display-reuse-hint"
1305 #define MMCAM_DISPLAY_REUSE_ELEMENT             "display-reuse-element"
1306
1307 /**
1308  * The GBbus connection from outside
1309  */
1310 #define MMCAM_GDBUS_CONNECTION                  "gdbus-connection"
1311
1312 /**
1313  * Replay gain enable
1314  */
1315 #define MMCAM_AUDIO_REPLAY_GAIN_ENABLE          "audio-replay-gain-enable"
1316
1317 /**
1318  * Reference level for replay gain
1319  */
1320 #define MMCAM_AUDIO_REPLAY_GAIN_REFERENCE_LEVEL "audio-replay-gain-reference-level"
1321
1322 /*=======================================================================================
1323 | ENUM DEFINITIONS                                                                      |
1324 ========================================================================================*/
1325 /**
1326  * An enumeration for camcorder states.
1327  */
1328 typedef enum {
1329         MM_CAMCORDER_STATE_NONE,                /**< Camcorder is not created yet */
1330         MM_CAMCORDER_STATE_NULL,                /**< Camcorder is created, but not initialized yet */
1331         MM_CAMCORDER_STATE_READY,               /**< Camcorder is ready to capture */
1332         MM_CAMCORDER_STATE_PREPARE,             /**< Camcorder is prepared to capture (Preview) */
1333         MM_CAMCORDER_STATE_CAPTURING,           /**< Camcorder is now capturing still images */
1334         MM_CAMCORDER_STATE_RECORDING,           /**< Camcorder is now recording */
1335         MM_CAMCORDER_STATE_PAUSED,              /**< Camcorder is paused while recording */
1336         MM_CAMCORDER_STATE_NUM,                 /**< Number of camcorder states */
1337 } MMCamcorderStateType;
1338
1339 /**
1340  * An enumeration for camcorder mode.
1341  */
1342 typedef enum {
1343         MM_CAMCORDER_MODE_VIDEO_CAPTURE = 0,    /**< Video recording and Image capture mode */
1344         MM_CAMCORDER_MODE_AUDIO,                /**< Audio recording mode */
1345 } MMCamcorderModeType;
1346
1347 /**
1348  * An enumeration for facing direction.
1349  */
1350 typedef enum {
1351         MM_CAMCORDER_CAMERA_FACING_DIRECTION_REAR = 0, /**< Facing direction of camera is REAR */
1352         MM_CAMCORDER_CAMERA_FACING_DIRECTION_FRONT,    /**< Facing direction of camera is FRONT */
1353 } MMCamcorderCameraFacingDirection;
1354
1355
1356 /**
1357  * An enumeration of Audio Format.
1358  */
1359 typedef enum {
1360         MM_CAMCORDER_AUDIO_FORMAT_PCM_U8 = 0,           /**< unsigned 8bit audio */
1361         MM_CAMCORDER_AUDIO_FORMAT_PCM_S16_LE = 2,       /**< signed 16bit audio. Little endian. */
1362 } MMCamcorderAudioFormat;
1363
1364
1365 /**
1366  * An enumeration for color tone. Color tone provides an impression of
1367  * seeing through a tinted glass.
1368  */
1369 enum MMCamcorderColorToneType {
1370         MM_CAMCORDER_COLOR_TONE_NONE = 0,               /**< None */
1371         MM_CAMCORDER_COLOR_TONE_MONO,                   /**< Mono */
1372         MM_CAMCORDER_COLOR_TONE_SEPIA,                  /**< Sepia */
1373         MM_CAMCORDER_COLOR_TONE_NEGATIVE,               /**< Negative */
1374         MM_CAMCORDER_COLOR_TONE_BLUE,                   /**< Blue */
1375         MM_CAMCORDER_COLOR_TONE_GREEN,                  /**< Green */
1376         MM_CAMCORDER_COLOR_TONE_AQUA,                   /**< Aqua */
1377         MM_CAMCORDER_COLOR_TONE_VIOLET,                 /**< Violet */
1378         MM_CAMCORDER_COLOR_TONE_ORANGE,                 /**< Orange */
1379         MM_CAMCORDER_COLOR_TONE_GRAY,                   /**< Gray */
1380         MM_CAMCORDER_COLOR_TONE_RED,                    /**< Red */
1381         MM_CAMCORDER_COLOR_TONE_ANTIQUE,                /**< Antique */
1382         MM_CAMCORDER_COLOR_TONE_WARM,                   /**< Warm */
1383         MM_CAMCORDER_COLOR_TONE_PINK,                   /**< Pink */
1384         MM_CAMCORDER_COLOR_TONE_YELLOW,                 /**< Yellow */
1385         MM_CAMCORDER_COLOR_TONE_PURPLE,                 /**< Purple */
1386         MM_CAMCORDER_COLOR_TONE_EMBOSS,                 /**< Emboss */
1387         MM_CAMCORDER_COLOR_TONE_OUTLINE,                /**< Outline */
1388         MM_CAMCORDER_COLOR_TONE_SOLARIZATION,           /**< Solarization */
1389         MM_CAMCORDER_COLOR_TONE_SKETCH,                 /**< Sketch */
1390         MM_CAMCORDER_COLOR_TONE_WASHED,                 /**< Washed */
1391         MM_CAMCORDER_COLOR_TONE_VINTAGE_WARM,           /**< Vintage warm */
1392         MM_CAMCORDER_COLOR_TONE_VINTAGE_COLD,           /**< Vintage cold */
1393         MM_CAMCORDER_COLOR_TONE_POSTERIZATION,          /**< Posterization */
1394         MM_CAMCORDER_COLOR_TONE_CARTOON,                /**< Cartoon */
1395         MM_CAMCORDER_COLOR_TONE_SELECTIVE_RED,          /**< Selective color - Red */
1396         MM_CAMCORDER_COLOR_TONE_SELECTIVE_GREEN,        /**< Selective color - Green */
1397         MM_CAMCORDER_COLOR_TONE_SELECTIVE_BLUE,         /**< Selective color - Blue */
1398         MM_CAMCORDER_COLOR_TONE_SELECTIVE_YELLOW,       /**< Selective color - Yellow */
1399         MM_CAMCORDER_COLOR_TONE_SELECTIVE_RED_YELLOW,   /**< Selective color - Red and Yellow */
1400 };
1401
1402
1403 /**
1404  * An enumeration for white balance. White Balance is the control that adjusts
1405  * the camcorder's color sensitivity to match the prevailing color of white
1406  * outdoor light, yellower indoor light, or (sometimes) greenish fluorescent
1407  * light. White balance may be set either automatically or manually. White balance
1408  * may be set "incorrectly" on purpose to achieve special effects.
1409  */
1410 enum MMCamcorderWhiteBalanceType {
1411         MM_CAMCORDER_WHITE_BALANCE_NONE = 0,            /**< None */
1412         MM_CAMCORDER_WHITE_BALANCE_AUTOMATIC,           /**< Automatic */
1413         MM_CAMCORDER_WHITE_BALANCE_DAYLIGHT,            /**< Daylight */
1414         MM_CAMCORDER_WHITE_BALANCE_CLOUDY,              /**< Cloudy */
1415         MM_CAMCORDER_WHITE_BALANCE_FLUOROSCENT,         /**< Fluorescent */
1416         MM_CAMCORDER_WHITE_BALANCE_INCANDESCENT,        /**< Incandescent */
1417         MM_CAMCORDER_WHITE_BALANCE_SHADE,               /**< Shade */
1418         MM_CAMCORDER_WHITE_BALANCE_HORIZON,             /**< Horizon */
1419         MM_CAMCORDER_WHITE_BALANCE_FLASH,               /**< Flash */
1420         MM_CAMCORDER_WHITE_BALANCE_CUSTOM,              /**< Custom */
1421 };
1422
1423
1424 /**
1425  * An enumeration for scene mode. Scene mode gives the environment condition
1426  * for operating camcorder. The mode of operation can be in daylight, night and
1427  * backlight. It can be an automatic setting also.
1428  */
1429 enum MMCamcorderSceneModeType {
1430         MM_CAMCORDER_SCENE_MODE_NORMAL = 0,     /**< Normal */
1431         MM_CAMCORDER_SCENE_MODE_PORTRAIT,       /**< Portrait */
1432         MM_CAMCORDER_SCENE_MODE_LANDSCAPE,      /**< Landscape */
1433         MM_CAMCORDER_SCENE_MODE_SPORTS,         /**< Sports */
1434         MM_CAMCORDER_SCENE_MODE_PARTY_N_INDOOR, /**< Party & indoor */
1435         MM_CAMCORDER_SCENE_MODE_BEACH_N_INDOOR, /**< Beach & indoor */
1436         MM_CAMCORDER_SCENE_MODE_SUNSET,         /**< Sunset */
1437         MM_CAMCORDER_SCENE_MODE_DUSK_N_DAWN,    /**< Dusk & dawn */
1438         MM_CAMCORDER_SCENE_MODE_FALL_COLOR,     /**< Fall */
1439         MM_CAMCORDER_SCENE_MODE_NIGHT_SCENE,    /**< Night scene */
1440         MM_CAMCORDER_SCENE_MODE_FIREWORK,       /**< Firework */
1441         MM_CAMCORDER_SCENE_MODE_TEXT,           /**< Text */
1442         MM_CAMCORDER_SCENE_MODE_SHOW_WINDOW,    /**< Show window */
1443         MM_CAMCORDER_SCENE_MODE_CANDLE_LIGHT,   /**< Candle light */
1444         MM_CAMCORDER_SCENE_MODE_BACKLIGHT,      /**< Backlight */
1445         MM_CAMCORDER_SCENE_MODE_AQUA,           /**< Aqua */
1446 };
1447
1448
1449 /**
1450  * An enumeration for focusing .
1451  */
1452 enum MMCamcorderFocusMode {
1453         MM_CAMCORDER_FOCUS_MODE_NONE = 0,       /**< Focus mode is None */
1454         MM_CAMCORDER_FOCUS_MODE_PAN,            /**< Pan focus mode*/
1455         MM_CAMCORDER_FOCUS_MODE_AUTO,           /**< Autofocus mode*/
1456         MM_CAMCORDER_FOCUS_MODE_MANUAL,         /**< Manual focus mode*/
1457         MM_CAMCORDER_FOCUS_MODE_TOUCH_AUTO,     /**< Touch Autofocus mode*/
1458         MM_CAMCORDER_FOCUS_MODE_CONTINUOUS,     /**< Continuous Autofocus mode*/
1459 };
1460
1461
1462 /**
1463  * An enumeration for auto focus scan range (af scan range)
1464  */
1465 enum MMCamcorderAutoFocusType {
1466         MM_CAMCORDER_AUTO_FOCUS_NONE = 0,       /**< Scan autofocus is not set */
1467         MM_CAMCORDER_AUTO_FOCUS_NORMAL,         /**< Scan autofocus normally*/
1468         MM_CAMCORDER_AUTO_FOCUS_MACRO,          /**< Scan autofocus in macro mode(close distance)*/
1469         MM_CAMCORDER_AUTO_FOCUS_FULL,           /**< Scan autofocus in full mode(all range scan, limited by dev spec)*/
1470 };
1471
1472
1473 /**
1474  * An enumeration for focus state.
1475  * When 'MM_MESSAGE_CAMCORDER_FOCUS_CHANGED' is delievered through 'MMMessageCallback',
1476  * this enumeration will be set to 'code' of MMMessageParamType.
1477  */
1478 enum MMCamcorderFocusStateType {
1479         MM_CAMCORDER_FOCUS_STATE_RELEASED = 0,  /**< Focus released.*/
1480         MM_CAMCORDER_FOCUS_STATE_ONGOING,       /**< Focus in pregress*/
1481         MM_CAMCORDER_FOCUS_STATE_FOCUSED,       /**< Focus success*/
1482         MM_CAMCORDER_FOCUS_STATE_FAILED,        /**< Focus failed*/
1483 };
1484
1485
1486 /**
1487  * An enumeration for ISO.
1488  */
1489 enum MMCamcorderISOType {
1490         MM_CAMCORDER_ISO_AUTO = 0,              /**< ISO auto mode*/
1491         MM_CAMCORDER_ISO_50,                    /**< ISO 50*/
1492         MM_CAMCORDER_ISO_100,                   /**< ISO 100*/
1493         MM_CAMCORDER_ISO_200,                   /**< ISO 200*/
1494         MM_CAMCORDER_ISO_400,                   /**< ISO 400*/
1495         MM_CAMCORDER_ISO_800,                   /**< ISO 800*/
1496         MM_CAMCORDER_ISO_1600,                  /**< ISO 1600*/
1497         MM_CAMCORDER_ISO_3200,                  /**< ISO 3200*/
1498         MM_CAMCORDER_ISO_6400,                  /**< ISO 6400*/
1499         MM_CAMCORDER_ISO_12800,                 /**< ISO 12800*/
1500 };
1501
1502 /**
1503  * An enumeration for Automatic exposure.
1504  */
1505 enum MMCamcorderAutoExposureType {
1506         MM_CAMCORDER_AUTO_EXPOSURE_OFF = 0,     /**< AE off*/
1507         MM_CAMCORDER_AUTO_EXPOSURE_ALL,         /**< AE on, XXX mode*/
1508         MM_CAMCORDER_AUTO_EXPOSURE_CENTER_1,    /**< AE on, XXX mode*/
1509         MM_CAMCORDER_AUTO_EXPOSURE_CENTER_2,    /**< AE on, XXX mode*/
1510         MM_CAMCORDER_AUTO_EXPOSURE_CENTER_3,    /**< AE on, XXX mode*/
1511         MM_CAMCORDER_AUTO_EXPOSURE_SPOT_1,      /**< AE on, XXX mode*/
1512         MM_CAMCORDER_AUTO_EXPOSURE_SPOT_2,      /**< AE on, XXX mode*/
1513         MM_CAMCORDER_AUTO_EXPOSURE_CUSTOM_1,    /**< AE on, XXX mode*/
1514         MM_CAMCORDER_AUTO_EXPOSURE_CUSTOM_2,    /**< AE on, XXX mode*/
1515 };
1516
1517
1518 /**
1519  * An enumeration for WDR mode .
1520  */
1521 enum MMCamcorderWDRMode {
1522         MM_CAMCORDER_WDR_OFF = 0,               /**< WDR OFF*/
1523         MM_CAMCORDER_WDR_ON,                    /**< WDR ON*/
1524         MM_CAMCORDER_WDR_AUTO,                  /**< WDR AUTO*/
1525 };
1526
1527
1528 /**
1529  * An enumeration for HDR capture mode
1530  */
1531 enum MMCamcorderHDRMode {
1532         MM_CAMCORDER_HDR_OFF = 0,               /**< HDR OFF */
1533         MM_CAMCORDER_HDR_ON,                    /**< HDR ON and no original data - capture callback will be come once */
1534         MM_CAMCORDER_HDR_ON_AND_ORIGINAL,       /**< HDR ON and original data - capture callback will be come twice(1st:Original, 2nd:HDR) */
1535 };
1536
1537
1538 /**
1539  * An enumeration for Anti-handshake mode .
1540  */
1541 enum MMCamcorderAHSMode {
1542         MM_CAMCORDER_AHS_OFF = 0,               /**< AHS OFF*/
1543         MM_CAMCORDER_AHS_ON,                    /**< AHS ON*/
1544         MM_CAMCORDER_AHS_AUTO,                  /**< AHS AUTO*/
1545         MM_CAMCORDER_AHS_MOVIE,                 /**< AHS MOVIE*/
1546 };
1547
1548
1549 /**
1550  * An enumeration for Video stabilization mode
1551  */
1552 enum MMCamcorderVideoStabilizationMode {
1553         MM_CAMCORDER_VIDEO_STABILIZATION_OFF = 0,       /**< Video Stabilization OFF*/
1554         MM_CAMCORDER_VIDEO_STABILIZATION_ON,            /**< Video Stabilization ON*/
1555 };
1556
1557
1558 /**
1559  * Geometry method for camcorder display.
1560  */
1561 enum MMCamcorderGeometryMethod {
1562         MM_CAMCORDER_LETTER_BOX = 0,            /**< Letter box*/
1563         MM_CAMCORDER_ORIGIN_SIZE,               /**< Origin size*/
1564         MM_CAMCORDER_FULL,                      /**< full-screen*/
1565         MM_CAMCORDER_CROPPED_FULL,              /**< Cropped full-screen*/
1566         MM_CAMCORDER_ORIGIN_OR_LETTER,          /**< Origin size or Letter box*/
1567         MM_CAMCORDER_CUSTOM_ROI,                /**< Explicitely described destination ROI*/
1568 };
1569
1570
1571 /**
1572  * An enumeration for orientation values of tag .
1573  */
1574 enum MMCamcorderTagOrientation {
1575         MM_CAMCORDER_TAG_ORT_NONE = 0,          /**< No Orientation.*/
1576         MM_CAMCORDER_TAG_ORT_0R_VT_0C_VL,       /**< The 0th row is at the visual top of the image, and the 0th column is the visual left-hand side.*/
1577         MM_CAMCORDER_TAG_ORT_0R_VT_0C_VR,       /**< The 0th row is at the visual top of the image, and the 0th column is the visual right-hand side.*/
1578         MM_CAMCORDER_TAG_ORT_0R_VB_0C_VR,       /**< The 0th row is at the visual bottom of the image, and the 0th column is the visual right-hand side.*/
1579         MM_CAMCORDER_TAG_ORT_0R_VB_0C_VL,       /**< The 0th row is at the visual bottom of the image, and the 0th column is the visual left-hand side.*/
1580         MM_CAMCORDER_TAG_ORT_0R_VL_0C_VT,       /**< The 0th row is the visual left-hand side of the image, and the 0th column is the visual top.*/
1581         MM_CAMCORDER_TAG_ORT_0R_VR_0C_VT,       /**< The 0th row is the visual right-hand side of the image, and the 0th column is the visual top.*/
1582         MM_CAMCORDER_TAG_ORT_0R_VR_0C_VB,       /**< The 0th row is the visual right-hand side of the image, and the 0th column is the visual bottom.*/
1583         MM_CAMCORDER_TAG_ORT_0R_VL_0C_VB,       /**< The 0th row is the visual left-hand side of the image, and the 0th column is the visual bottom.*/
1584 };
1585
1586 /**
1587  * An enumeration for captured video orientation values of tag .
1588  */
1589 enum MMCamcorderTagVideoOrientation {
1590         MM_CAMCORDER_TAG_VIDEO_ORT_NONE = 0,    /**< No Orientation.*/
1591         MM_CAMCORDER_TAG_VIDEO_ORT_90,          /**< 90 degree */
1592         MM_CAMCORDER_TAG_VIDEO_ORT_180, /**< 180 degree */
1593         MM_CAMCORDER_TAG_VIDEO_ORT_270, /**< 270 degree */
1594 };
1595
1596
1597
1598 /**
1599  * An enumeration for Strobe mode.
1600  */
1601 enum MMCamcorderStrobeMode {
1602         MM_CAMCORDER_STROBE_MODE_OFF = 0,               /**< Always off */
1603         MM_CAMCORDER_STROBE_MODE_ON,                    /**< Always splashes */
1604         MM_CAMCORDER_STROBE_MODE_AUTO,                  /**< Depending on intensity of light, strobe starts to flash. */
1605         MM_CAMCORDER_STROBE_MODE_REDEYE_REDUCTION,      /**< Red eye reduction. Multiple flash before capturing. */
1606         MM_CAMCORDER_STROBE_MODE_SLOW_SYNC,             /**< Slow sync. A type of curtain synchronization. */
1607         MM_CAMCORDER_STROBE_MODE_FRONT_CURTAIN,         /**< Front curtain. A type of curtain synchronization. */
1608         MM_CAMCORDER_STROBE_MODE_REAR_CURTAIN,          /**< Rear curtain. A type of curtain synchronization. */
1609         MM_CAMCORDER_STROBE_MODE_PERMANENT,             /**< keep turned on until turning off */
1610 };
1611
1612
1613 /**
1614  * An enumeration for Strobe Control.
1615  */
1616 enum MMCamcorderStrobeControl {
1617         MM_CAMCORDER_STROBE_CONTROL_OFF = 0,    /**< turn off the flash light */
1618         MM_CAMCORDER_STROBE_CONTROL_ON,         /**< turn on the flash light */
1619         MM_CAMCORDER_STROBE_CONTROL_CHARGE,     /**< charge the flash light */
1620 };
1621
1622
1623 /**
1624  * An enumeration for Detection mode.
1625  */
1626 enum MMCamcorderDetectMode {
1627         MM_CAMCORDER_DETECT_MODE_OFF = 0,       /**< turn detection off */
1628         MM_CAMCORDER_DETECT_MODE_ON,            /**< turn detection on */
1629 };
1630
1631
1632 /**
1633  * An enumeration for recommended preview resolution.
1634  */
1635 enum MMCamcorderPreviewType {
1636         MM_CAMCORDER_PREVIEW_TYPE_NORMAL = 0,   /**< normal ratio like 4:3 */
1637         MM_CAMCORDER_PREVIEW_TYPE_WIDE,         /**< wide ratio like 16:9 */
1638         MM_CAMCORDER_PREVIEW_TYPE_SQUARE,       /**< square ratio like 1:1 */
1639 };
1640
1641
1642 /**********************************
1643 *          Attribute info         *
1644 **********************************/
1645 /**
1646  * An enumeration for attribute values types.
1647  */
1648 typedef enum {
1649         MM_CAM_ATTRS_TYPE_INVALID = -1,         /**< Type is invalid */
1650         MM_CAM_ATTRS_TYPE_INT,                  /**< Integer type attribute */
1651         MM_CAM_ATTRS_TYPE_DOUBLE,               /**< Double type attribute */
1652         MM_CAM_ATTRS_TYPE_STRING,               /**< UTF-8 String type attribute */
1653         MM_CAM_ATTRS_TYPE_DATA,                 /**< Pointer type attribute */
1654 } MMCamAttrsType;
1655
1656
1657 /**
1658  * An enumeration for attribute validation type.
1659  */
1660 typedef enum {
1661         MM_CAM_ATTRS_VALID_TYPE_INVALID = -1,   /**< Invalid validation type */
1662         MM_CAM_ATTRS_VALID_TYPE_NONE,           /**< Do not check validity */
1663         MM_CAM_ATTRS_VALID_TYPE_INT_ARRAY,      /**< validity checking type of integer array */
1664         MM_CAM_ATTRS_VALID_TYPE_INT_RANGE,      /**< validity checking type of integer range */
1665         MM_CAM_ATTRS_VALID_TYPE_DOUBLE_ARRAY,   /**< validity checking type of double array */
1666         MM_CAM_ATTRS_VALID_TYPE_DOUBLE_RANGE,   /**< validity checking type of double range */
1667 } MMCamAttrsValidType;
1668
1669
1670 /**
1671  * An enumeration for attribute access flag.
1672  */
1673 typedef enum {
1674         MM_CAM_ATTRS_FLAG_DISABLED = 0,         /**< None flag is set. This means the attribute is not allowed to use.  */
1675         MM_CAM_ATTRS_FLAG_READABLE = 1 << 0,    /**< Readable */
1676         MM_CAM_ATTRS_FLAG_WRITABLE = 1 << 1,    /**< Writable */
1677         MM_CAM_ATTRS_FLAG_MODIFIED = 1 << 2,    /**< Modified */
1678         MM_CAM_ATTRS_FLAG_RW = MM_CAM_ATTRS_FLAG_READABLE | MM_CAM_ATTRS_FLAG_WRITABLE, /**< Readable and Writable */
1679 } MMCamAttrsFlag;
1680
1681
1682 /**********************************
1683 *          Stream data            *
1684 **********************************/
1685 /**
1686  * An enumeration for stream data type.
1687  */
1688 typedef enum {
1689         MM_CAM_STREAM_DATA_YUV420 = 0,          /**< YUV420 Packed type - 1 plane */
1690         MM_CAM_STREAM_DATA_YUV422,              /**< YUV422 Packed type - 1 plane */
1691         MM_CAM_STREAM_DATA_YUV420SP,            /**< YUV420 SemiPlannar type - 2 planes */
1692         MM_CAM_STREAM_DATA_YUV420P,             /**< YUV420 Plannar type - 3 planes */
1693         MM_CAM_STREAM_DATA_YUV422P,             /**< YUV422 Plannar type - 3 planes */
1694         MM_CAM_STREAM_DATA_ENCODED,             /**< Encoded data type - 1 plane */
1695         MM_CAM_STREAM_DATA_DEPTH,               /**< Depth data type - 1 plane */
1696         MM_CAM_STREAM_DATA_RGB                  /**< RGB data type - 1 plane */
1697 } MMCamStreamData;
1698
1699
1700 /*=======================================================================================
1701 | STRUCTURE DEFINITIONS                                                                 |
1702 ========================================================================================*/
1703 /**
1704  * A structure for attribute information
1705  */
1706 typedef struct {
1707         MMCamAttrsType type;
1708         MMCamAttrsFlag flag;
1709         MMCamAttrsValidType validity_type;
1710
1711         /**
1712          * A union that describes validity of the attribute.
1713          * Only when type is 'MM_CAM_ATTRS_TYPE_INT' or 'MM_CAM_ATTRS_TYPE_DOUBLE',
1714          * the attribute can have validity.
1715          */
1716         union {
1717                 /**
1718                  * Validity structure for integer array.
1719                  */
1720                  struct {
1721                         int *array;             /**< a pointer of array */
1722                         int count;              /**< size of array */
1723                         int def;                /**< default value. Real value not index of array */
1724                 } int_array;
1725
1726                 /**
1727                  * Validity structure for integer range.
1728                  */
1729                 struct {
1730                         int min;                /**< minimum range */
1731                         int max;                /**< maximum range */
1732                         int def;                /**< default value */
1733                 } int_range;
1734
1735                 /**
1736                  * Validity structure for double array.
1737                  */
1738                  struct {
1739                         double *array;          /**< a pointer of array */
1740                         int count;              /**< size of array */
1741                         double def;             /**< default value. Real value not index of array */
1742                 } double_array;
1743
1744                 /**
1745                  * Validity structure for double range.
1746                  */
1747                 struct {
1748                         double min;             /**< minimum range */
1749                         double max;             /**< maximum range */
1750                         double def;             /**< default value */
1751                 } double_range;
1752         };
1753 } MMCamAttrsInfo;
1754
1755
1756 /* General Structure */
1757 /**
1758  * Structure for capture data.
1759  */
1760 typedef struct {
1761         void *data;                     /**< pointer of captured image */
1762         unsigned int length;            /**< length of captured image (in byte)*/
1763         MMPixelFormatType format;       /**< image format */
1764         int width;                      /**< width of captured image */
1765         int height;                     /**< height of captured image */
1766         int encoder_type;               /**< encoder type */
1767 } MMCamcorderCaptureDataType;
1768
1769
1770 /**
1771  * Structure for video stream data.
1772  */
1773 #define BUFFER_MAX_PLANE_NUM 4
1774
1775 typedef struct {
1776         union {
1777                 struct {
1778                         unsigned char *yuv;
1779                         unsigned int length_yuv;
1780                 } yuv420, yuv422;
1781                 struct {
1782                         unsigned char *y;
1783                         unsigned int length_y;
1784                         unsigned char *uv;
1785                         unsigned int length_uv;
1786                 } yuv420sp;
1787                 struct {
1788                         unsigned char *y;
1789                         unsigned int length_y;
1790                         unsigned char *u;
1791                         unsigned int length_u;
1792                         unsigned char *v;
1793                         unsigned int length_v;
1794                 } yuv420p, yuv422p;
1795                 struct {
1796                         unsigned char *data;
1797                         unsigned int length_data;
1798                         int is_delta_frame;
1799                 } encoded, depth, rgb;
1800         } data;                         /**< pointer of captured stream */
1801         MMCamStreamData data_type;      /**< data type */
1802         unsigned int length_total;      /**< total length of stream buffer (in byte)*/
1803         unsigned int num_planes;        /**< number of planes */
1804         MMPixelFormatType format;       /**< image format */
1805         int width;                      /**< width of video buffer */
1806         int height;                     /**< height of video buffer */
1807         unsigned int timestamp;         /**< timestamp of stream buffer (msec)*/
1808         void *bo[BUFFER_MAX_PLANE_NUM]; /**< TBM buffer object */
1809         void *internal_buffer;          /**< Internal buffer pointer */
1810         int stride[BUFFER_MAX_PLANE_NUM];    /**< Stride of each plane */
1811         int elevation[BUFFER_MAX_PLANE_NUM]; /**< Elevation of each plane */
1812 } MMCamcorderVideoStreamDataType;
1813
1814
1815 /**
1816  * Structure for audio stream data.
1817  */
1818 typedef struct {
1819         void *data;                             /**< pointer of captured stream */
1820         unsigned int length;                    /**< length of stream buffer (in byte)*/
1821         MMCamcorderAudioFormat format;          /**< audio format */
1822         int channel;                            /**< number of channel of the stream */
1823         unsigned int timestamp;                 /**< timestamp of stream buffer (msec)*/
1824         float volume_dB;                        /**< dB value of audio stream */
1825 } MMCamcorderAudioStreamDataType;
1826
1827
1828 /**
1829  * Structure for muxed stream data.
1830  */
1831 typedef struct {
1832         void *data;             /**< pointer of muxed stream */
1833         unsigned int length;    /**< length of stream buffer (in byte) */
1834         unsigned long long offset;  /**< current offset for data */
1835 } MMCamcorderMuxedStreamDataType;
1836
1837
1838 /**
1839   * Prerequisite information for mm_camcorder_create()
1840   * The information to set prior to create.
1841   */
1842 typedef struct {
1843         enum MMVideoDeviceType videodev_type;   /**< Video device type */
1844         /* For future use */
1845         int reserved[4];                        /**< reserved fields */
1846 } MMCamPreset;
1847
1848
1849 /**
1850  * Report structure of recording file
1851  */
1852 typedef struct {
1853         char *recording_filename;               /**< File name of stored recording file. Please free after using. */
1854 } MMCamRecordingReport; /**< report structure definition of recording file */
1855
1856
1857 /**
1858  * Face detect defailed information
1859  */
1860 typedef struct _MMCamFaceInfo {
1861         int id;                                 /**< id of each face */
1862         int score;                              /**< score of each face */
1863         MMRectType rect;                        /**< area of face */
1864 } MMCamFaceInfo;
1865
1866 /**
1867  * Face detect information
1868  */
1869 typedef struct _MMCamFaceDetectInfo {
1870         int num_of_faces;                       /**< number of detected faces */
1871         MMCamFaceInfo *face_info;               /**< face information, this should be freed after use it. */
1872 } MMCamFaceDetectInfo;
1873
1874 /**
1875  * Window information
1876  */
1877 typedef struct _MMCamWindowInfo {
1878         int surface_id;
1879         MMRectType rect;
1880 } MMCamWindowInfo;
1881
1882
1883 /*=======================================================================================
1884 | TYPE DEFINITIONS                                                                      |
1885 ========================================================================================*/
1886 /**
1887  *      Function definition for video stream callback.
1888  *  Be careful! In this function, you can't call functions that change the state of camcorder such as mm_camcorder_stop(),
1889  *  mm_camcorder_unrealize(), mm_camcorder_record(), mm_camcorder_commit(), and mm_camcorder_cancel(), etc.
1890  *  Please don't hang this function long. It may cause low performance of preview or occur timeout error from video source.
1891  *  Also, you're not allowed to call mm_camcorder_stop() even in other context, while you're hanging this function.
1892  *  I recommend to you releasing this function ASAP.
1893  *
1894  *      @param[in]      stream                  Reference pointer to video stream data
1895  *      @param[in]      user_param              User parameter which is received from user when callback function was set
1896  *      @return         This function returns true on success, or false on failure.
1897  *      @remarks                This function is issued in the context of gstreamer (video sink thread).
1898  */
1899 typedef gboolean (*mm_camcorder_video_stream_callback)(MMCamcorderVideoStreamDataType *stream, void *user_param);
1900
1901
1902 /**
1903  *      Function definition for audio stream callback.
1904  *  Be careful! In this function, you can't call functions that change the state of camcorder such as mm_camcorder_stop(),
1905  *  mm_camcorder_unrealize(), mm_camcorder_record(), mm_camcorder_commit(), and mm_camcorder_cancel(), etc.
1906  *  Please don't hang this function long. It may cause low performance of camcorder or occur timeout error from audio source.
1907  *  I recommend to you releasing this function ASAP.
1908  *
1909  *      @param[in]      stream                  Reference pointer to audio stream data
1910  *      @param[in]      user_param              User parameter which is received from user when callback function was set
1911  *      @return         This function returns true on success, or false on failure.
1912  *      @remarks
1913  */
1914 typedef gboolean (*mm_camcorder_audio_stream_callback)(MMCamcorderAudioStreamDataType *stream, void *user_param);
1915
1916
1917 /**
1918  *      Function definition for muxed stream callback.
1919  *  Be careful! In this function, you can't call functions that change the state of camcorder such as mm_camcorder_stop(),
1920  *  mm_camcorder_unrealize(), mm_camcorder_record(), mm_camcorder_commit(), and mm_camcorder_cancel(), etc.
1921  *  Please don't hang this function long. It may cause low performance of camcorder or occur timeout error from encoding pipeline.
1922  *  I recommend to you releasing this function ASAP.
1923  *
1924  *      @param[in]      stream                  Reference pointer to muxed stream data
1925  *      @param[in]      user_param              User parameter which is received from user when callback function was set
1926  *      @return         This function returns true on success, or false on failure.
1927  *      @remarks
1928  */
1929 typedef gboolean (*mm_camcorder_muxed_stream_callback)(MMCamcorderMuxedStreamDataType *stream, void *user_param);
1930
1931
1932 /**
1933  *      Function definition for video capture callback.
1934  *  Like '#mm_camcorder_video_stream_callback', you can't call mm_camcorder_stop() while you are hanging this function.
1935  *
1936  *      @param[in]      frame                   Reference pointer to captured data
1937  *      @param[in]      thumbnail               Reference pointer to thumbnail data
1938  *      @param[in]      user_param              User parameter which is received from user when callback function was set
1939  *      @return         This function returns true on success, or false on failure.
1940  *      @remarks                This function is issued in the context of gstreamer (video src thread).
1941  */
1942 typedef gboolean (*mm_camcorder_video_capture_callback)(MMCamcorderCaptureDataType *frame, MMCamcorderCaptureDataType *thumbnail, void *user_param);
1943
1944 /**
1945  *      Function definition for video encode decision callback.
1946  *  Like '#mm_camcorder_video_stream_callback', you can't call mm_camcorder_stop() while you are hanging this function.
1947  *
1948  *      @param[in]      stream                  Reference pointer to video stream data
1949  *      @param[in]      user_param              User parameter which is received from user when callback function was set
1950  *      @return         This function returns true on encoding, or false on drop frame.
1951  *      @remarks                This function is issued in the context of gstreamer (video sink or internal of camerasrc thread).
1952  */
1953 typedef gboolean (*mm_camcorder_video_encode_decision_callback)(MMCamcorderVideoStreamDataType *stream, void *user_param);
1954
1955
1956 /*=======================================================================================
1957 | GLOBAL FUNCTION PROTOTYPES                                                            |
1958 ========================================================================================*/
1959 /**
1960  *    mm_camcorder_create:\n
1961  *  Create camcorder object. This is the function that an user who wants to use mm_camcorder calls first.
1962  *  This function creates handle structure and initialize mutex, attributes, gstreamer.
1963  *  When this function success, it will return  a handle of newly created object.
1964  *  A user have to put the handle when he calls every function of mm_camcorder. \n
1965  *  Second argument of this function is the field to decribe pre-setting information of mm_camcorder such as which camera device it will use.
1966  *  Normally, MM_VIDEO_DEVICE_CAMERA0 is for Main camera(or Mega camera, Back camera),
1967  *  and MM_VIDEO_DEVICE_CAMERA1 is for VGA camera (or Front camera). If you want audio recording,
1968  *  please set MM_VIDEO_DEVICE_NONE. (No camera device is needed.)
1969  *
1970  *      @param[out]     camcorder       A handle of camcorder.
1971  *      @param[in]      info            Information for camera device. Depending on this information,
1972  *                                      camcorder opens different camera devices.
1973  *      @return         This function returns zero(MM_ERROR_NONE) on success, or negative value with error code.\n
1974  *                      Please refer 'mm_error.h' to know the exact meaning of the error.
1975  *      @see            mm_camcorder_destroy
1976  *      @pre            None
1977  *      @post           Next state of mm-camcorder will be MM_CAMCORDER_STATE_NULL
1978  *      @remarks        You can create multiple handles on a context at the same time. However,
1979  *                      camcorder cannot guarantee proper operation because of limitation of resources, such as
1980  *                      camera device, audio device, and display device.
1981  *      @par example
1982  *      @code
1983
1984 #include <mm_camcorder.h>
1985
1986 gboolean initialize_camcorder()
1987 {
1988         int err;
1989         MMCamPreset cam_info;
1990 #if 1
1991         cam_info.videodev_type = MM_VIDEO_DEVICE_CAMERA0;
1992 #else
1993         // when you want to record audio only, enable this.
1994         cam_info.videodev_type = MM_VIDEO_DEVICE_NONE;
1995 #endif
1996
1997         err = mm_camcorder_create(&hcam, &cam_info);
1998
1999         if (err != MM_ERROR_NONE) {
2000                 printf("Fail to call mm_camcorder_create = %x\n", err);
2001                 return FALSE;
2002         }
2003
2004         return TRUE;
2005 }
2006
2007  *      @endcode
2008  */
2009 int mm_camcorder_create(MMHandleType *camcorder, MMCamPreset *info);
2010
2011
2012 /**
2013  *    mm_camcorder_destroy:\n
2014  *  Destroy camcorder object. Release handle and all of the resources that were created in mm_camcorder_create().\n
2015  *  This is the finalizing function of mm_camcorder. If this function is not called or fails to call, the handle isn't released fully.
2016  *  This function releases attributes, mutexes, sessions, and handle itself. This function also removes all of remaining messages.
2017  *  So if your application should wait a certain message of mm_camcorder, please wait to call this function till getting the message.
2018  *
2019  *
2020  *      @param[in]      camcorder       A handle of camcorder.
2021  *      @return         This function returns zero(MM_ERROR_NONE) on success, or negative value with error code.\n
2022  *                      Please refer 'mm_error.h' to know the exact meaning of the error.
2023  *      @see            mm_camcorder_create
2024  *      @pre            Previous state of mm-camcorder should be MM_CAMCORDER_STATE_NULL
2025  *      @post           Because the handle is not valid, you can't check the state.
2026  *      @remarks        None
2027  *      @par example
2028  *      @code
2029
2030 #include <mm_camcorder.h>
2031
2032 gboolean destroy_camcorder()
2033 {
2034         int err;
2035
2036         //Destroy camcorder handle
2037         err = mm_camcorder_destroy(hcam);
2038         if (err < 0) {
2039                 printf("Fail to call mm_camcorder_destroy  = %x\n", err);
2040                 return FALSE;
2041         }
2042
2043         return TRUE;
2044 }
2045
2046  *      @endcode
2047  */
2048 int mm_camcorder_destroy(MMHandleType camcorder);
2049
2050
2051 /**
2052  *    mm_camcorder_realize:\n
2053  *  Allocate resources for camcorder and initialize it.
2054  *  This also creates streamer pipeline. So you have to set attributes that are pivotal to create
2055  *  the pipeline before calling this function. This function also takes a roll to manage confliction
2056  *  between different applications which use camcorder. For example, if you try to use camcorder when
2057  *  other application that is more important such as call application, this function will return
2058  *  'MM_ERROR_POLICY_BLOCKED'. On the contrary, if your application that uses camcorder starts to launch
2059  *  while another application that uses speaker and has lower priority, your application will kick
2060  *  another application.
2061  *
2062  *      @param[in]      camcorder       A handle of camcorder.
2063  *      @return         This function returns zero(MM_ERROR_NONE) on success, or negative value with error code.\n
2064  *                      Please refer 'mm_error.h' to know the exact meaning of the error.
2065  *      @see            mm_camcorder_unrealize
2066  *      @pre            Previous state of mm-camcorder should be MM_CAMCORDER_STATE_NULL
2067  *      @post           Next state of mm-camcorder will be MM_CAMCORDER_STATE_READY
2068  *      @remarks        None
2069  *      @par example
2070  *      @code
2071
2072 #include <mm_camcorder.h>
2073
2074 //For image capturing
2075 gboolean initialize_image_capture()
2076 {
2077         int err;
2078         MMCamPreset cam_info;
2079         char *err_attr_name = NULL;
2080         void * hdisplay = NULL;
2081         int hsize = 0;
2082
2083         //Set video device as 'camera0' (main camera device)
2084         cam_info.videodev_type = MM_VIDEO_DEVICE_CAMERA0;
2085
2086         err = mm_camcorder_create(&hcam, &cam_info);
2087
2088         if (err != MM_ERROR_NONE) {
2089                 printf("Fail to call mm_camcorder_create = %x\n", err);
2090                 return FALSE;
2091         }
2092
2093         mm_camcorder_set_message_callback(hcam,(MMMessageCallback)msg_callback, (void*)hcam);
2094         mm_camcorder_set_video_capture_callback(hcam,(mm_camcorder_video_capture_callback)camcordertest_video_capture_cb, (void*)hcam);
2095
2096         hdisplay = &ad.xid;             //xid of xwindow. This value can be different depending on your environment.
2097         hsize = sizeof(ad.xid);         //size of xid structure.
2098
2099         // camcorder attribute setting
2100         err = mm_camcorder_set_attributes((MMHandleType)hcam, &err_attr_name,
2101                                           MMCAM_MODE, MM_CAMCORDER_MODE_IMAGE,
2102                                           MMCAM_IMAGE_ENCODER, MM_IMAGE_CODEC_JPEG,
2103                                           MMCAM_CAMERA_WIDTH, 640,
2104                                           MMCAM_CAMERA_HEIGHT, 480,
2105                                           MMCAM_CAMERA_FORMAT, MM_PIXEL_FORMAT_YUYV,
2106                                           MMCAM_CAMERA_FPS, 30,
2107                                           MMCAM_DISPLAY_ROTATION, MM_DISPLAY_ROTATION_270,
2108                                           MMCAM_DISPLAY_HANDLE, (void*) hdisplay,          hsize,
2109                                           MMCAM_CAPTURE_FORMAT, MM_PIXEL_FORMAT_ENCODED,
2110                                           MMCAM_CAPTURE_WIDTH, 640,
2111                                           MMCAM_CAPTURE_HEIGHT, 480,
2112                                           NULL);
2113
2114         if (err < 0) {
2115                 printf("Set attrs fail. (%s:%x)\n", err_attr_name, err);
2116                 if (err_attr_name) {
2117                         free(err_attr_name);
2118                         err_attr_name = NULL;
2119                         return FALSE;
2120                 }
2121         }
2122
2123         err =  mm_camcorder_realize(hcam);
2124         if (err < 0) {
2125                 printf("Fail to call mm_camcorder_realize  = %x\n", err);
2126                 return FALSE;
2127         }
2128
2129         return TRUE;
2130 }
2131
2132 //For A/V capturing
2133 gboolean initialize_video_capture()
2134 {
2135         int err;
2136         MMCamPreset cam_info;
2137         char *err_attr_name = NULL;
2138         void * hdisplay = NULL;
2139         int hsize = 0;
2140
2141         //Set video device as 'camera0' (main camera device)
2142         cam_info.videodev_type = MM_VIDEO_DEVICE_CAMERA0;
2143
2144         err = mm_camcorder_create(&hcam, &cam_info);
2145
2146         if (err != MM_ERROR_NONE) {
2147                 printf("Fail to call mm_camcorder_create = %x\n", err);
2148                 return FALSE;
2149         }
2150
2151         mm_camcorder_set_message_callback(hcam,(MMMessageCallback)msg_callback, hcam);
2152
2153         hdisplay = &ad.xid;             //xid of xwindow. This value can be different depending on your environment.
2154         hsize = sizeof(ad.xid);         //size of xid structure.
2155
2156         // camcorder attribute setting
2157         err = mm_camcorder_set_attributes((MMHandleType)hcam, &err_attr_name,
2158                                           MMCAM_MODE, MM_CAMCORDER_MODE_VIDEO,
2159                                           MMCAM_AUDIO_DEVICE, MM_AUDIO_DEVICE_MIC,
2160                                           MMCAM_AUDIO_ENCODER, MM_AUDIO_CODEC_AAC,
2161                                           MMCAM_VIDEO_ENCODER, MM_VIDEO_CODEC_MPEG4,
2162                                           MMCAM_FILE_FORMAT, MM_FILE_FORMAT_3GP,
2163                                           MMCAM_CAMERA_WIDTH, 1280,
2164                                           MMCAM_CAMERA_HEIGHT, 720,
2165                                           MMCAM_CAMERA_FORMAT, MM_PIXEL_FORMAT_NV12,
2166                                           MMCAM_CAMERA_FPS, 30,
2167                                           MMCAM_AUDIO_SAMPLERATE, 44100,
2168                                           MMCAM_AUDIO_FORMAT, MM_CAMCORDER_AUDIO_FORMAT_PCM_S16_LE,
2169                                           MMCAM_AUDIO_CHANNEL, 2,
2170                                           MMCAM_DISPLAY_ROTATION, MM_DISPLAY_ROTATION_270,
2171                                           MMCAM_DISPLAY_HANDLE, (void*) hdisplay,               hsize,
2172                                           MMCAM_TARGET_FILENAME, TARGET_FILENAME, strlen(TARGET_FILENAME),
2173                                           NULL);
2174
2175         if (err < 0) {
2176                 printf("Set attrs fail. (%s:%x)\n", err_attr_name, err);
2177                 if (err_attr_name) {
2178                         free(err_attr_name);
2179                         err_attr_name = NULL;
2180                         return FALSE;
2181                 }
2182         }
2183
2184         err =  mm_camcorder_realize(hcam);
2185         if (err < 0) {
2186                 printf("Fail to call mm_camcorder_realize  = %x\n", err);
2187                 return FALSE;
2188         }
2189
2190         return TRUE;
2191 }
2192
2193 //For audio(only) capturing
2194 gboolean initialize_audio_capture()
2195 {
2196         int err;
2197         MMCamPreset cam_info;
2198         char *err_attr_name = NULL;
2199         void * hdisplay = NULL;
2200         int hsize = 0;
2201
2202         //Set no video device, because audio recording doesn't need video input.
2203         cam_info.videodev_type = MM_VIDEO_DEVICE_NONE;
2204
2205         err = mm_camcorder_create(&hcam, &cam_info);
2206
2207         if (err != MM_ERROR_NONE) {
2208                 printf("Fail to call mm_camcorder_create = %x\n", err);
2209                 return FALSE;
2210         }
2211
2212         mm_camcorder_set_message_callback(hcam,(MMMessageCallback)msg_callback, (void*)hcam);
2213
2214         hdisplay = &ad.xid;             //xid of xwindow. This value can be different depending on your environment.
2215         hsize = sizeof(ad.xid);         //size of xid structure.
2216
2217         // camcorder attribute setting
2218         err = mm_camcorder_set_attributes((MMHandleType)hcam, &err_attr_name,
2219                                           MMCAM_MODE, MM_CAMCORDER_MODE_AUDIO,
2220                                           MMCAM_AUDIO_DEVICE, MM_AUDIO_DEVICE_MIC,
2221                                           MMCAM_AUDIO_ENCODER, MM_AUDIO_CODEC_AAC,
2222                                           MMCAM_FILE_FORMAT, MM_FILE_FORMAT_3GP,
2223                                           MMCAM_AUDIO_SAMPLERATE, 44100,
2224                                           MMCAM_AUDIO_FORMAT, MM_CAMCORDER_AUDIO_FORMAT_PCM_S16_LE,
2225                                           MMCAM_AUDIO_CHANNEL, 2,
2226                                           MMCAM_TARGET_FILENAME, TARGET_FILENAME, strlen(TARGET_FILENAME),
2227                                           MMCAM_TARGET_TIME_LIMIT, 360000,
2228                                           NULL);
2229
2230         if (err < 0) {
2231                 printf("Set attrs fail. (%s:%x)\n", err_attr_name, err);
2232                 if (err_attr_name) {
2233                         free(err_attr_name);
2234                         err_attr_name = NULL;
2235                         return FALSE;
2236                 }
2237         }
2238
2239         err =  mm_camcorder_realize(hcam);
2240         if (err < 0) {
2241                 printf("Fail to call mm_camcorder_realize  = %x\n", err);
2242                 return FALSE;
2243         }
2244
2245         return TRUE;
2246 }
2247  *      @endcode
2248  */
2249 int mm_camcorder_realize(MMHandleType camcorder);
2250
2251
2252 /**
2253  *    mm_camcorder_unrealize:\n
2254  *  Uninitialize camcoder resources and free allocated memory.
2255  *  Most important resource that is released here is gstreamer pipeline of mm_camcorder.
2256  *  Because most of resources, such as camera device, video display device, and audio I/O device, are operating on the gstreamer pipeline,
2257  *  this function should be called to release its resources.
2258  *
2259  *      @param[in]      camcorder       A handle of camcorder.
2260  *      @return         This function returns zero(MM_ERROR_NONE) on success, or negative value with error code.\n
2261  *                      Please refer 'mm_error.h' to know the exact meaning of the error.
2262  *      @see            mm_camcorder_realize
2263  *      @pre            Previous state of mm-camcorder should be MM_CAMCORDER_STATE_READY
2264  *      @post           Next state of mm-camcorder will be MM_CAMCORDER_STATE_NULL
2265  *      @remarks        None
2266  *      @par example
2267  *      @code
2268
2269 #include <mm_camcorder.h>
2270
2271 gboolean unrealize_camcorder()
2272 {
2273         int err;
2274
2275         //Release all resources of camcorder handle
2276         err =  mm_camcorder_unrealize(hcam);
2277         if (err < 0) {
2278                 printf("Fail to call mm_camcorder_unrealize  = %x\n", err);
2279                 return FALSE;
2280         }
2281
2282         return TRUE;
2283 }
2284
2285  *      @endcode
2286  */
2287 int mm_camcorder_unrealize(MMHandleType camcorder);
2288
2289
2290 /**
2291  *      mm_camcorder_start:\n
2292  *   Start previewing. (Image/Video mode)
2293  *  'mm_camcorder_video_stream_callback' is activated after calling this function.
2294  *
2295  *      @param[in]      camcorder       A handle of camcorder.
2296  *      @return         This function returns zero(MM_ERROR_NONE) on success, or negative value with error code.\n
2297  *                      Please refer 'mm_error.h' to know the exact meaning of the error.
2298  *      @see            mm_camcorder_stop
2299  *      @pre            Previous state of mm-camcorder should be MM_CAMCORDER_STATE_READY
2300  *      @post           Next state of mm-camcorder will be MM_CAMCORDER_STATE_PREPARE
2301  *      @remarks        None
2302  *      @par example
2303  *      @code
2304
2305 #include <mm_camcorder.h>
2306
2307 //For image capturing
2308 gboolean initialize_image_capture()
2309 {
2310         int err;
2311         MMCamPreset cam_info;
2312         char *err_attr_name = NULL;
2313         void * hdisplay = NULL;
2314         int hsize = 0;
2315
2316         //Set video device as 'camera0' (main camera device)
2317         cam_info.videodev_type = MM_VIDEO_DEVICE_CAMERA0;
2318
2319         err = mm_camcorder_create(&hcam, &cam_info);
2320
2321         if (err != MM_ERROR_NONE) {
2322                         printf("Fail to call mm_camcorder_create = %x\n", err);
2323                         return FALSE;
2324         }
2325
2326         mm_camcorder_set_message_callback(hcam,(MMMessageCallback)msg_callback, (void*)hcam);
2327         mm_camcorder_set_video_capture_callback(hcam,(mm_camcorder_video_capture_callback)camcordertest_video_capture_cb, (void*)hcam);
2328
2329         hdisplay = &ad.xid;             //xid of xwindow. This value can be different depending on your environment.
2330         hsize = sizeof(ad.xid);         //size of xid structure.
2331
2332         // camcorder attribute setting
2333         err = mm_camcorder_set_attributes((MMHandleType)hcam, &err_attr_name,
2334                                           MMCAM_MODE, MM_CAMCORDER_MODE_IMAGE,
2335                                           MMCAM_IMAGE_ENCODER, MM_IMAGE_CODEC_JPEG,
2336                                           MMCAM_CAMERA_WIDTH, 640,
2337                                           MMCAM_CAMERA_HEIGHT, 480,
2338                                           MMCAM_CAMERA_FORMAT, MM_PIXEL_FORMAT_YUYV,
2339                                           MMCAM_CAMERA_FPS, 30,
2340                                           MMCAM_DISPLAY_ROTATION, MM_DISPLAY_ROTATION_270,
2341                                           MMCAM_DISPLAY_HANDLE, (void*) hdisplay,          hsize,
2342                                           MMCAM_CAPTURE_FORMAT, MM_PIXEL_FORMAT_ENCODED,
2343                                           MMCAM_CAPTURE_WIDTH, 640,
2344                                           MMCAM_CAPTURE_HEIGHT, 480,
2345                                           NULL);
2346
2347         if (err < 0) {
2348                 printf("Set attrs fail. (%s:%x)\n", err_attr_name, err);
2349                 if (err_attr_name) {
2350                         free(err_attr_name);
2351                         err_attr_name = NULL;
2352                         return FALSE;
2353                 }
2354         }
2355
2356         err =  mm_camcorder_realize(hcam);
2357         if (err < 0) {
2358                 printf("Fail to call mm_camcorder_realize  = %x\n", err);
2359                 return FALSE;
2360         }
2361
2362         // start camcorder
2363         err = mm_camcorder_start(hcam);
2364         if (err < 0) {
2365                 printf("Fail to call mm_camcorder_start  = %x\n", err);
2366                 return FALSE;
2367         }
2368
2369         return TRUE;
2370 }
2371
2372 //For A/V capturing
2373 gboolean initialize_video_capture()
2374 {
2375         int err;
2376         MMCamPreset cam_info;
2377         char *err_attr_name = NULL;
2378         void * hdisplay = NULL;
2379         int hsize = 0;
2380
2381         //Set video device as 'camera0' (main camera device)
2382         cam_info.videodev_type = MM_VIDEO_DEVICE_CAMERA0;
2383
2384         err = mm_camcorder_create(&hcam, &cam_info);
2385
2386         if (err != MM_ERROR_NONE) {
2387                         printf("Fail to call mm_camcorder_create = %x\n", err);
2388                         return FALSE;
2389         }
2390
2391         mm_camcorder_set_message_callback(hcam,(MMMessageCallback)msg_callback, hcam);
2392
2393         hdisplay = &ad.xid;             //xid of xwindow. This value can be different depending on your environment.
2394         hsize = sizeof(ad.xid);         //size of xid structure.
2395
2396         // camcorder attribute setting
2397         err = mm_camcorder_set_attributes((MMHandleType)hcam, &err_attr_name,
2398                                           MMCAM_MODE, MM_CAMCORDER_MODE_VIDEO,
2399                                           MMCAM_AUDIO_DEVICE, MM_AUDIO_DEVICE_MIC,
2400                                           MMCAM_AUDIO_ENCODER, MM_AUDIO_CODEC_AAC,
2401                                           MMCAM_VIDEO_ENCODER, MM_VIDEO_CODEC_MPEG4,
2402                                           MMCAM_FILE_FORMAT, MM_FILE_FORMAT_3GP,
2403                                           MMCAM_CAMERA_WIDTH, 1280,
2404                                           MMCAM_CAMERA_HEIGHT, 720,
2405                                           MMCAM_CAMERA_FORMAT, MM_PIXEL_FORMAT_NV12,
2406                                           MMCAM_CAMERA_FPS, 30,
2407                                           MMCAM_AUDIO_SAMPLERATE, 44100,
2408                                           MMCAM_AUDIO_FORMAT, MM_CAMCORDER_AUDIO_FORMAT_PCM_S16_LE,
2409                                           MMCAM_AUDIO_CHANNEL, 2,
2410                                           MMCAM_DISPLAY_ROTATION, MM_DISPLAY_ROTATION_270,
2411                                           MMCAM_DISPLAY_HANDLE, (void*) hdisplay,               hsize,
2412                                           MMCAM_TARGET_FILENAME, TARGET_FILENAME, strlen(TARGET_FILENAME),
2413                                           NULL);
2414
2415         if (err < 0) {
2416                 printf("Set attrs fail. (%s:%x)\n", err_attr_name, err);
2417                 if (err_attr_name) {
2418                         free(err_attr_name);
2419                         err_attr_name = NULL;
2420                         return FALSE;
2421                 }
2422         }
2423
2424         err =  mm_camcorder_realize(hcam);
2425         if (err < 0) {
2426                 printf("Fail to call mm_camcorder_realize  = %x\n", err);
2427                 return FALSE;
2428         }
2429
2430         // start camcorder
2431         err = mm_camcorder_start(hcam);
2432         if (err < 0) {
2433                 printf("Fail to call mm_camcorder_start  = %x\n", err);
2434                 return FALSE;
2435         }
2436
2437         return TRUE;
2438 }
2439
2440 //For audio(only) capturing
2441 gboolean initialize_audio_capture()
2442 {
2443         int err;
2444         MMCamPreset cam_info;
2445         char *err_attr_name = NULL;
2446         void * hdisplay = NULL;
2447         int hsize = 0;
2448
2449         //Set no video device, because audio recording doesn't need video input.
2450         cam_info.videodev_type = MM_VIDEO_DEVICE_NONE;
2451
2452         err = mm_camcorder_create(&hcam, &cam_info);
2453
2454         if (err != MM_ERROR_NONE) {
2455                 printf("Fail to call mm_camcorder_create = %x\n", err);
2456                 return FALSE;
2457         }
2458
2459         mm_camcorder_set_message_callback(hcam,(MMMessageCallback)msg_callback, (void*)hcam);
2460
2461         hdisplay = &ad.xid;             //xid of xwindow. This value can be different depending on your environment.
2462         hsize = sizeof(ad.xid);         //size of xid structure.
2463
2464         // camcorder attribute setting
2465         err = mm_camcorder_set_attributes((MMHandleType)hcam, &err_attr_name,
2466                                           MMCAM_MODE, MM_CAMCORDER_MODE_AUDIO,
2467                                           MMCAM_AUDIO_DEVICE, MM_AUDIO_DEVICE_MIC,
2468                                           MMCAM_AUDIO_ENCODER, MM_AUDIO_CODEC_AAC,
2469                                           MMCAM_FILE_FORMAT, MM_FILE_FORMAT_3GP,
2470                                           MMCAM_AUDIO_SAMPLERATE, 44100,
2471                                           MMCAM_AUDIO_FORMAT, MM_CAMCORDER_AUDIO_FORMAT_PCM_S16_LE,
2472                                           MMCAM_AUDIO_CHANNEL, 2,
2473                                           MMCAM_TARGET_FILENAME, TARGET_FILENAME, strlen(TARGET_FILENAME),
2474                                           MMCAM_TARGET_TIME_LIMIT, 360000,
2475                                           NULL);
2476
2477         if (err < 0) {
2478                 printf("Set attrs fail. (%s:%x)\n", err_attr_name, err);
2479                 if (err_attr_name) {
2480                         free(err_attr_name);
2481                         err_attr_name = NULL;
2482                         return FALSE;
2483                 }
2484         }
2485
2486         err =  mm_camcorder_realize(hcam);
2487         if (err < 0) {
2488                 printf("Fail to call mm_camcorder_realize  = %x\n", err);
2489                 return FALSE;
2490         }
2491
2492         // start camcorder
2493         err = mm_camcorder_start(hcam);
2494         if (err < 0) {
2495                 printf("Fail to call mm_camcorder_start  = %x\n", err);
2496                 return FALSE;
2497         }
2498
2499         return TRUE;
2500 }
2501  *      @endcode
2502  */
2503 int mm_camcorder_start(MMHandleType camcorder);
2504
2505
2506 /**
2507  *    mm_camcorder_stop:\n
2508  *  Stop previewing. (Image/Video mode)
2509  *  This function will change the status of pipeline. If an application doesn't return callbacks
2510  *  of camcorder, this function can be locked. For example, if your application still
2511  *  holds '#mm_camcorder_video_capture_callback' or '#mm_camcorder_video_stream_callback',
2512  *  this function could be hung. So users have to return every callback before calling this function.
2513  *
2514  *      @param[in]      camcorder       A handle of camcorder.
2515  *      @return         This function returns zero(MM_ERROR_NONE) on success, or negative value with error code.\n
2516  *                      Please refer 'mm_error.h' to know the exact meaning of the error.
2517  *      @see            mm_camcorder_start
2518  *      @pre            Previous state of mm-camcorder should be MM_CAMCORDER_STATE_PREPARE
2519  *      @post           Next state of mm-camcorder will be MM_CAMCORDER_STATE_READY
2520  *      @remarks        None
2521  *      @par example
2522  *      @code
2523
2524 #include <mm_camcorder.h>
2525
2526 gboolean stop_camcorder()
2527 {
2528         int err;
2529
2530         //Stop preview
2531         err =  mm_camcorder_stop(hcam);
2532         if (err < 0) {
2533                 printf("Fail to call mm_camcorder_stop  = %x\n", err);
2534                 return FALSE;
2535         }
2536
2537         return TRUE;
2538 }
2539
2540  *      @endcode
2541  */
2542 int mm_camcorder_stop(MMHandleType camcorder);
2543
2544
2545 /**
2546  *    mm_camcorder_capture_start:\n
2547  *  Start capturing of still images. (Image mode only)
2548  *  Captured image will be delievered through 'mm_camcorder_video_capture_callback'.
2549  *  So basically, the operation is working asynchronously. \n
2550  *  When a user call this function, MSL will stop to retrieving preview from camera device.
2551  *  Then set capture resolution, pixel format, and encoding type to camera driver. After resuming,
2552  *  camera can get still image.  A user will be notified by
2553  *  'MM_MESSAGE_CAMCORDER_CAPTURED' message when capturing succeed. When a user sets
2554  *  multishot (by setting multiple number to MMCAM_CAPTURE_COUNT), the message
2555  *  will be called multiple time. You can get the number of image from 'code' of
2556  *  'MMMessageParamType'.
2557  *
2558  *      @param[in]      camcorder       A handle of camcorder.
2559  *      @return         This function returns zero(MM_ERROR_NONE) on success, or negative value with error code.\n
2560  *                      Please refer 'mm_error.h' to know the exact meaning of the error.
2561  *      @see            mm_camcorder_capture_stop
2562  *      @pre            Previous state of mm-camcorder should be MM_CAMCORDER_STATE_PREPARE
2563  *      @post           Next state of mm-camcorder will be MM_CAMCORDER_STATE_CAPTURING
2564  *      @remarks        To call this function, preview should be started successfully.\n
2565  *                      This function is a pair of mm_camcorder_capture_stop().
2566  *                      So user should call mm_camcorder_capture_stop() after getting captured image.
2567  *      @par example
2568  *      @code
2569
2570 #include <mm_camcorder.h>
2571
2572 gboolean capturing_picture()
2573 {
2574         int err;
2575
2576         err =  mm_camcorder_capture_start(hcam);
2577         if (err < 0)
2578         {
2579                 printf("Fail to call mm_camcorder_capture_start  = %x\n", err);
2580                 return FALSE;
2581         }
2582
2583         //mm_camcorder_capture_stop should be called after getting
2584         //MM_MESSAGE_CAMCORDER_CAPTURED message.
2585
2586         return TRUE;
2587 }
2588
2589
2590  *      @endcode
2591  */
2592 int mm_camcorder_capture_start(MMHandleType camcorder);
2593
2594
2595 /**
2596  *    mm_camcorder_capture_stop:\n
2597  *  Stop capturing of still images. (Image mode only)
2598  *  This function notifies the end of capturing and launch preview again.
2599  *  Just as mm_camcorder_capture_start(), this funciton stops still image stream and set preview information such as
2600  *  resolution, pixel format, and framerate to camera driver. Then it command to start preview.
2601  *  If you don't call this, preview will not be displayed even though capturing was finished.
2602  *
2603  *      @param[in]      camcorder       A handle of camcorder.
2604  *      @return         This function returns zero(MM_ERROR_NONE) on success, or negative value with error code.\n
2605  *                      Please refer 'mm_error.h' to know the exact meaning of the error.
2606  *      @see            mm_camcorder_capture_start
2607  *      @pre            Previous state of mm-camcorder should be MM_CAMCORDER_STATE_CAPTURING
2608  *      @post           Next state of mm-camcorder will be MM_CAMCORDER_STATE_PREPARE
2609  *      @remarks        To call this function, a user has to call mm_camcorder_capture_start() first.\n
2610  *                      This is not a function to stop multishot in the middle of operation. For that,
2611  *                      please use '#MMCAM_CAPTURE_BREAK_CONTINUOUS_SHOT' instead.
2612  *      @par example
2613  *      @code
2614
2615 #include <mm_camcorder.h>
2616
2617 gboolean capturing_picture_stop()
2618 {
2619         int err;
2620
2621         err =  mm_camcorder_capture_stop(hcam);
2622         if (err < 0) {
2623                 printf("Fail to call mm_camcorder_capture_stop  = %x\n", err);
2624                 return FALSE;
2625         }
2626
2627         //After calling upper function, preview will start.
2628
2629         return TRUE;
2630 }
2631
2632  *      @endcode
2633  */
2634 int mm_camcorder_capture_stop(MMHandleType camcorder);
2635
2636
2637 /**
2638  *    mm_camcorder_record:\n
2639  *  Start recording. (Audio/Video mode only)
2640  *  Camcorder starts to write a file when you call this function. You can specify the name of file
2641  *  using '#MMCAM_TARGET_FILENAME'. Beware, if you fail to call mm_camcorder_commit() or mm_camcorder_cancel(),
2642  *  the recorded file is still on the storage.
2643  *
2644  *      @param[in]      camcorder       A handle of camcorder.
2645  *      @return         This function returns zero(MM_ERROR_NONE) on success, or negative value with error code.\n
2646  *                      Please refer 'mm_error.h' to know the exact meaning of the error.
2647  *      @see            mm_camcorder_pause
2648  *      @pre            Previous state of mm-camcorder should be MM_CAMCORDER_STATE_PREPARE
2649  *      @post           Next state of mm-camcorder will be MM_CAMCORDER_STATE_RECORDING
2650  *      @remarks        None
2651  *      @par example
2652  *      @code
2653
2654 #include <mm_camcorder.h>
2655
2656 gboolean record_and_cancel_video_file()
2657 {
2658         int err;
2659
2660         // Start recording
2661         err =  mm_camcorder_record(hcam);
2662         if (err < 0) {
2663                 printf("Fail to call mm_camcorder_record  = %x\n", err);
2664                 return FALSE;
2665         }
2666
2667         return TRUE;
2668 }
2669
2670  *      @endcode
2671  */
2672 int mm_camcorder_record(MMHandleType camcorder);
2673
2674
2675 /**
2676  *    mm_camcorder_pause:\n
2677  *  Pause A/V recording or Audio recording. (Audio/Video mode only)
2678  *  On video recording, you can see preview while on pausing. So mm_camcorder cuts video stream path to encoder and keep the flow to preview.
2679  *  If you call mm_camcorder_commit() while on pausing, the recorded file only has Audio and Video stream which were generated before pause().
2680  *
2681  *      @param[in]      camcorder       A handle of camcorder.
2682  *      @return         This function returns zero(MM_ERROR_NONE) on success, or negative value with error code.\n
2683  *                      Please refer 'mm_error.h' to know the exact meaning of the error.
2684  *      @see            mm_camcorder_record
2685  *      @pre            Previous state of mm-camcorder should be MM_CAMCORDER_STATE_RECORDING
2686  *      @post           Next state of mm-camcorder will be MM_CAMCORDER_STATE_PAUSED
2687  *      @remarks        Even though this function is for pausing recording, small amount of buffers could be recorded after pause().
2688  *                      Because the buffers which are existed in the queue were created before pause(), the buffers should be recorded.
2689  *      @par example
2690  *      @code
2691
2692 #include <mm_camcorder.h>
2693
2694 gboolean record_pause_and_resume_recording()
2695 {
2696         int err;
2697
2698         // Start recording
2699         err =  mm_camcorder_record(hcam);
2700         if (err < 0) {
2701                 printf("Fail to call mm_camcorder_record  = %x\n", err);
2702                 return FALSE;
2703         }
2704
2705         // Wait while recording...
2706
2707         // Pause
2708         err =  mm_camcorder_pause(hcam);
2709         if (err < 0) {
2710                 printf("Fail to call mm_camcorder_pause  = %x\n", err);
2711                 return FALSE;
2712         }
2713
2714         // Pausing...
2715
2716         // Resume
2717         err =  mm_camcorder_record(hcam);
2718         if (err < 0) {
2719                 printf("Fail to call mm_camcorder_record  = %x\n", err);
2720                 return FALSE;
2721         }
2722
2723         return TRUE;
2724 }
2725
2726
2727  *      @endcode
2728  */
2729 int mm_camcorder_pause(MMHandleType camcorder);
2730
2731
2732 /**
2733  *    mm_camcorder_commit:\n
2734  *  Stop recording and save results.  (Audio/Video mode only)\n
2735  *  After starting recording, encoded data frame will be stored in the location specified in MMCAM_TARGET_FILENAME.
2736  *  Some encoder or muxer require a certain type of finalizing such as adding some information to header.
2737  *  This function takes that roll. So if you don't call this function after recording, the result file may not be playable.\n
2738  *  After committing successfully, camcorder resumes displaying preview (video recording case).
2739  *  Because this is the function for saving the recording result, the operation is available
2740  *  only when the mode of camcorder is MM_CAMCORDER_MODE_AUDIO or MM_CAMCORDER_MODE_VIDEO.
2741  *
2742  *      @param[in]      camcorder       A handle of camcorder.
2743  *      @return         This function returns zero(MM_ERROR_NONE) on success, or negative value with error code.\n
2744  *                      Please refer 'mm_error.h' to know the exact meaning of the error.
2745  *      @see            mm_camcorder_cancel
2746  *      @pre            Previous state of mm-camcorder should be MM_CAMCORDER_STATE_RECORDING
2747  *      @post           Next state of mm-camcorder will be MM_CAMCORDER_STATE_PREPARE
2748  *      @remarks        This function can take a few second when recording time is long.
2749  *                      and if there are only quite few input buffer from video src or audio src,
2750  *                      committing could be failed.
2751  *      @par example
2752  *      @code
2753
2754 #include <mm_camcorder.h>
2755
2756 gboolean record_and_save_video_file()
2757 {
2758         int err;
2759
2760         // Start recording
2761         err =  mm_camcorder_record(hcam);
2762         if (err < 0) {
2763                 printf("Fail to call mm_camcorder_record  = %x\n", err);
2764                 return FALSE;
2765         }
2766
2767         // Wait while recording for test...
2768         // In normal case, mm_camcorder_record() and mm_camcorder_commit() aren't called in the same function.
2769
2770         // Save file
2771         err =  mm_camcorder_commit(hcam);
2772         if (err < 0) {
2773                 printf("Fail to call mm_camcorder_commit  = %x\n", err);
2774                 return FALSE;
2775         }
2776
2777         return TRUE;
2778 }
2779
2780  *      @endcode
2781  */
2782 int mm_camcorder_commit(MMHandleType camcorder);
2783
2784
2785 /**
2786  *      mm_camcorder_cancel:\n
2787  *    Stop recording and discard the result. (Audio/Video mode only)
2788  *      When a user want to finish recording without saving the result file, this function can be used.
2789  *      Like mm_camcorder_commit(), this function also stops recording, release related resources(like codec) ,and goes back to preview status.
2790  *      However, instead of saving file, this function unlinks(delete) the result.\n
2791  *      Because this is the function for canceling recording, the operation is available
2792  *      only when mode is MM_CAMCORDER_MODE_AUDIO or MM_CAMCORDER_MODE_VIDEO.
2793  *
2794  *      @param[in]      camcorder       A handle of camcorder.
2795  *      @return         This function returns zero(MM_ERROR_NONE) on success, or negative value with error code.\n
2796  *                      Please refer 'mm_error.h' to know the exact meaning of the error.
2797  *      @see            mm_camcorder_commit
2798  *      @pre            Previous state of mm-camcorder should be MM_CAMCORDER_STATE_RECORDING
2799  *      @post           Next state of mm-camcorder will be MM_CAMCORDER_STATE_PREPARE
2800  *      @remarks        None
2801  *      @par example
2802  *      @code
2803
2804 #include <mm_camcorder.h>
2805
2806 gboolean record_and_cancel_video_file()
2807 {
2808         int err;
2809
2810         // Start recording
2811         err =  mm_camcorder_record(hcam);
2812         if (err < 0) {
2813                 printf("Fail to call mm_camcorder_record  = %x\n", err);
2814                 return FALSE;
2815         }
2816
2817         // Wait while recording...
2818
2819         // Cancel recording
2820         err =  mm_camcorder_cancel(hcam);
2821         if (err < 0) {
2822                 printf("Fail to call mm_camcorder_cancel  = %x\n", err);
2823                 return FALSE;
2824         }
2825
2826         return TRUE;
2827 }
2828
2829  *      @endcode
2830  */
2831 int mm_camcorder_cancel(MMHandleType camcorder);
2832
2833
2834 /**
2835  *    mm_camcorder_set_message_callback:\n
2836  *  Set callback for receiving messages from camcorder. Through this callback function, camcorder
2837  *  sends various message including status changes, asynchronous error, capturing, and limitations.
2838  *  One thing you have to know is that message callback is working on the main loop of application.
2839  *  So until releasing the main loop, message callback will not be called.
2840  *
2841  *      @param[in]      camcorder       A handle of camcorder.
2842  *      @param[in]      callback        Function pointer of callback function. Please refer 'MMMessageCallback'.
2843  *      @param[in]      user_data       User parameter for passing to callback function.
2844  *      @return         This function returns zero(MM_ERROR_NONE) on success, or negative value with error code.\n
2845  *                      Please refer 'mm_error.h' to know the exact meaning of the error.
2846  *      @see            MMMessageCallback
2847  *      @pre            None
2848  *      @post           None
2849  *      @remarks        registered 'callback' is called on main loop of the application. So until the main loop is released, 'callback' will not be called.
2850  *      @par example
2851  *      @code
2852
2853 #include <mm_camcorder.h>
2854
2855 gboolean setting_msg_callback()
2856 {
2857         //set callback
2858         mm_camcorder_set_message_callback(hcam,(MMMessageCallback)msg_callback, (void*)hcam);
2859
2860         return TRUE;
2861 }
2862
2863
2864  *      @endcode
2865  */
2866 int mm_camcorder_set_message_callback(MMHandleType camcorder, MMMessageCallback callback, void *user_data);
2867
2868
2869 /**
2870  *    mm_camcorder_set_video_stream_callback:\n
2871  *  Set callback for user defined video stream callback function.
2872  *  Users can retrieve video frame using registered callback.
2873  *  The callback function holds the same buffer that will be drawed on the display device.
2874  *  So if an user change the buffer, it will be displayed on the device.
2875  *
2876  *      @param[in]      camcorder       A handle of camcorder.
2877  *      @param[in]      callback        Function pointer of callback function.
2878  *      @param[in]      user_data       User parameter for passing to callback function.
2879  *      @return         This function returns zero(MM_ERROR_NONE) on success, or negative value with error code.\n
2880  *                      Please refer 'mm_error.h' to know the exact meaning of the error.
2881  *      @see            mm_camcorder_video_stream_callback
2882  *      @pre            None
2883  *      @post           None
2884  *      @remarks        registered 'callback' is called on internal thread of camcorder. Regardless of the status of main loop, this function will be called.
2885  *      @par example
2886  *      @code
2887
2888 #include <mm_camcorder.h>
2889
2890 gboolean setting_video_stream_callback()
2891 {
2892         //set callback
2893         mm_camcorder_set_video_stream_callback(hcam, (mm_camcorder_video_stream_callback)camcordertest_video_stream_cb, (void*)hcam);
2894
2895         return TRUE;
2896 }
2897  *      @endcode
2898  */
2899 int mm_camcorder_set_video_stream_callback(MMHandleType camcorder, mm_camcorder_video_stream_callback callback, void *user_data);
2900
2901
2902 /**
2903  *    mm_camcorder_set_video_capture_callback:\n
2904  *  Set callback for user defined video capture callback function.  (Image mode only)
2905  *  mm_camcorder deliever captured image through the callback.\n
2906  *  Normally, this function provides main captured image and thumnail image. But depending on the environment,
2907  *  thumnail would not be available. Information related with main captured image and thumnail image is also included
2908  *  in the argument of the callback function.
2909  *  For more detail information of callback, please refer 'mm_camcorder_video_capture_callback'.
2910  *
2911  *      @param[in]      camcorder       A handle of camcorder.
2912  *      @param[in]      callback        Function pointer of callback function.
2913  *      @param[in]      user_data       User parameter for passing to callback function.
2914  *      @return         This function returns zero(MM_ERROR_NONE) on success, or negative value with error code.\n
2915  *                      Please refer 'mm_error.h' to know the exact meaning of the error.
2916  *      @see            mm_camcorder_video_capture_callback
2917  *      @pre            None
2918  *      @post           None
2919  *      @remarks        registered 'callback' is called on internal thread of camcorder. Regardless of the status of main loop, this function will be called.
2920  *      @par example
2921  *      @code
2922
2923 #include <mm_camcorder.h>
2924
2925 gboolean setting_capture_callback()
2926 {
2927         //set callback
2928         mm_camcorder_set_video_capture_callback(hcam,(mm_camcorder_video_capture_callback)camcordertest_video_capture_cb, (void*)hcam);
2929
2930         return TRUE;
2931 }
2932  *      @endcode
2933  */
2934 int mm_camcorder_set_video_capture_callback(MMHandleType camcorder, mm_camcorder_video_capture_callback callback, void *user_data);
2935
2936
2937 /**
2938  *    mm_camcorder_set_audio_stream_callback:\n
2939  *  Set callback for user defined audio stream callback function.
2940  *  Users can retrieve audio data using registered callback.
2941  *  The callback function holds the same buffer that will be recorded.
2942  *  So if an user change the buffer, the result file will has the buffer.
2943  *
2944  *      @param[in]      camcorder       A handle of camcorder.
2945  *      @param[in]      callback        Function pointer of callback function.
2946  *      @param[in]      user_data       User parameter for passing to callback function.
2947  *      @return         This function returns zero(MM_ERROR_NONE) on success, or negative value with error code.\n
2948  *                      Please refer 'mm_error.h' to know the exact meaning of the error.
2949  *      @see            mm_camcorder_audio_stream_callback
2950  *      @pre            None
2951  *      @post           None
2952  *      @remarks        registered 'callback' is called on internal thread of camcorder. Regardless of the status of main loop, this function will be called.
2953  *      @par example
2954  *      @code
2955
2956 #include <mm_camcorder.h>
2957
2958 gboolean setting_audio_stream_callback()
2959 {
2960         //set callback
2961         mm_camcorder_set_audio_stream_callback(hcam, (mm_camcorder_audio_stream_callback)camcordertest_audio_stream_cb, (void*)hcam);
2962
2963         return TRUE;
2964 }
2965  *  @endcode
2966  */
2967 int mm_camcorder_set_audio_stream_callback(MMHandleType camcorder, mm_camcorder_audio_stream_callback callback, void *user_data);
2968
2969
2970 /**
2971  *    mm_camcorder_set_muxed_stream_callback:\n
2972  *  Set callback for user defined muxed stream callback function.
2973  *  Users can retrieve muxed data using registered callback.
2974  *  The callback function holds the same buffer that will be recorded.
2975  *
2976  *      @param[in]      camcorder       A handle of camcorder.
2977  *      @param[in]      callback        Function pointer of callback function.
2978  *      @param[in]      user_data       User parameter for passing to callback function.
2979  *      @return         This function returns zero(MM_ERROR_NONE) on success, or negative value with error code.\n
2980  *                      Please refer 'mm_error.h' to know the exact meaning of the error.
2981  *      @see            mm_camcorder_muxed_stream_callback
2982  *      @pre            None
2983  *      @post           None
2984  *      @remarks        registered 'callback' is called on internal thread of camcorder. Regardless of the status of main loop, this function will be called.
2985  *      @par example
2986  *      @code
2987
2988 #include <mm_camcorder.h>
2989
2990 gboolean setting_muxed_stream_callback()
2991 {
2992         //set callback
2993         mm_camcorder_set_muxed_stream_callback(hcam, (mm_camcorder_muxed_stream_callback)camcordertest_muxed_stream_cb, (void*)hcam);
2994
2995         return TRUE;
2996 }
2997  *  @endcode
2998  */
2999 int mm_camcorder_set_muxed_stream_callback(MMHandleType camcorder, mm_camcorder_muxed_stream_callback callback, void *user_data);
3000
3001
3002 /**
3003  *    mm_camcorder_set_video_encode_decision_callback:\n
3004  *  Set callback for user defined video encode decision callback function.
3005  *  Users can retrieve video frame using registered callback,
3006  *  and decide to encoding video frame by return value of function.
3007  *
3008  *      @param[in]      camcorder       A handle of camcorder.
3009  *      @param[in]      callback        Function pointer of callback function.
3010  *      @param[in]      user_data       User parameter for passing to callback function.
3011  *      @return         This function returns zero(MM_ERROR_NONE) on success, or negative value with error code.\n
3012  *                      Please refer 'mm_error.h' to know the exact meaning of the error.
3013  *      @see            mm_camcorder_video_encode_decision_callback
3014  *      @pre            None
3015  *      @post           None
3016  *      @remarks        registered 'callback' is called on internal thread of camcorder. Regardless of the status of main loop, this function will be called.
3017  */
3018 int mm_camcorder_set_video_encode_decision_callback(MMHandleType camcorder, mm_camcorder_video_encode_decision_callback callback, void *user_data);
3019
3020
3021 /**
3022  *    mm_camcorder_get_state:\n
3023  *  Get the current state of camcorder.
3024  *  mm_camcorder is working on the base of its state. An user should check the state of mm_camcorder before calling its functions.
3025  *  If the handle is avaiable, user can retrieve the value.
3026  *
3027  *      @param[in]      camcorder       A handle of camcorder.
3028  *      @param[out]     state           On return, it contains current state of camcorder.
3029  *      @return         This function returns zero(MM_ERROR_NONE) on success, or negative value with error code.\n
3030  *                      Please refer 'mm_error.h' to know the exact meaning of the error.
3031  *      @see            MMCamcorderStateType
3032  *      @pre            None
3033  *      @post           None
3034  *      @remarks        None
3035  *      @par example
3036  *      @code
3037
3038 #include <mm_camcorder.h>
3039
3040 gboolean get_state_of_camcorder()
3041 {
3042         MMCamcorderStateType state;
3043
3044         //Get state of camcorder
3045         mm_camcorder_get_state(hcam, &state);
3046         printf("Current status is %d\n", state);
3047
3048         return TRUE;
3049 }
3050
3051  *      @endcode
3052  */
3053 int mm_camcorder_get_state(MMHandleType camcorder, MMCamcorderStateType *state);
3054 int mm_camcorder_get_state2(MMHandleType camcorder, MMCamcorderStateType *state, MMCamcorderStateType *old_state);
3055
3056
3057 /**
3058  *    mm_camcorder_get_attributes:\n
3059  *  Get attributes of camcorder with given attribute names. This function can get multiple attributes
3060  *  simultaneously. If one of attribute fails, this function will stop at the point.
3061  *  'err_attr_name' let you know the name of the attribute.
3062  *
3063  *      @param[in]      camcorder       Specifies the camcorder  handle.
3064  *      @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
3065  *                                      Free this variable after using.
3066  *      @param[in]      attribute_name  attribute name that user want to get.
3067  *      @return         This function returns zero(MM_ERROR_NONE) on success, or negative value with error code.\n
3068  *                      Please refer 'mm_error.h' to know the exact meaning of the error.
3069  *      @pre            None
3070  *      @post           None
3071  *      @remarks        You can retrieve multiple attributes at the same time.  @n
3072  *                      This function must finish with 'NULL' argument.  @n
3073  *                      ex) mm_camcorder_get_attributes(....... , NULL);
3074  *      @see            mm_camcorder_set_attributes
3075  *      @par example
3076  *      @code
3077
3078 #include <mm_camcorder.h>
3079
3080 gboolean getting_attribute()
3081 {
3082         int err;
3083         MMCamPreset cam_info;
3084         char *err_attr_name = NULL;
3085         void * hdisplay = NULL;
3086         int hsize = 0;
3087
3088         hdisplay = &ad.xid;             //xid of xwindow. This value can be different depending on your environment.
3089         hsize = sizeof(ad.xid);         //size of xid structure.
3090
3091         // camcorder attribute setting
3092         err = mm_camcorder_get_attributes(hcamcorder, NULL,     //The second is the argument for debugging. But you can skip this.
3093                                           MMCAM_MODE,  &mode,   //You have to input a pointer instead of variable itself.
3094                                           NULL);                //mm_camcorder_set_attributes() should be finished with a NULL argument.
3095
3096         return TRUE;
3097 }
3098
3099  *      @endcode
3100  */
3101 int mm_camcorder_get_attributes(MMHandleType camcorder,  char **err_attr_name, const char *attribute_name, ...) G_GNUC_NULL_TERMINATED;
3102
3103
3104
3105 /**
3106  *    mm_camcorder_set_attributes:\n
3107  *  Set attributes of camcorder with given attribute names. This function can set multiple attributes
3108  *  simultaneously. If one of attribute fails, this function will stop at the point.
3109  *  'err_attr_name' let you know the name of the attribute.
3110  *
3111  *      @param[in]      camcorder       Specifies the camcorder  handle.
3112  *      @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
3113  *                                      Free this variable after using.
3114  *      @param[in]      attribute_name  attribute name that user want to set.
3115  *      @return         This function returns zero(MM_ERROR_NONE) on success, or negative value with error code.\n
3116  *                      Please refer 'mm_error.h' to know the exact meaning of the error.
3117  *      @pre            None
3118  *      @post           None
3119  *      @remarks        You can put multiple attributes to camcorder at the same time.  @n
3120  *                      This function must finish with 'NULL' argument.  @n
3121  *                      ex) mm_camcorder_set_attributes(....... , NULL);
3122  *      @see            mm_camcorder_get_attributes
3123  *      @par example
3124  *      @code
3125
3126 #include <mm_camcorder.h>
3127
3128 gboolean setting_attribute()
3129 {
3130         int err;
3131         MMCamPreset cam_info;
3132         char *err_attr_name = NULL;
3133         void * hdisplay = NULL;
3134         int hsize = 0;
3135
3136         hdisplay = &ad.xid;             //xid of xwindow. This value can be different depending on your environment.
3137         hsize = sizeof(ad.xid);         //size of xid structure.
3138
3139         // camcorder attribute setting
3140         err = mm_camcorder_set_attributes((MMHandleType)hcam, &err_attr_name,           //The second is the argument for debugging.
3141                                           MMCAM_MODE, MM_CAMCORDER_MODE_IMAGE,
3142                                           MMCAM_IMAGE_ENCODER, MM_IMAGE_CODEC_JPEG,
3143                                           MMCAM_CAMERA_WIDTH, 640,
3144                                           MMCAM_CAMERA_HEIGHT, 480,
3145                                           MMCAM_CAMERA_FORMAT, MM_PIXEL_FORMAT_YUYV,
3146                                           MMCAM_CAMERA_FPS, 30,
3147                                           MMCAM_DISPLAY_ROTATION, MM_DISPLAY_ROTATION_270,
3148                                           MMCAM_DISPLAY_HANDLE, (void*) hdisplay,          hsize,               //Beware some types require 'size' value, too. (STRING, DATA type attributes)
3149                                           MMCAM_CAPTURE_FORMAT, MM_PIXEL_FORMAT_ENCODED,
3150                                           MMCAM_CAPTURE_WIDTH, 640,
3151                                           MMCAM_CAPTURE_HEIGHT, 480,
3152                                           NULL);                //mm_camcorder_set_attributes() should be finished with a NULL argument.
3153
3154         if (err < 0) {
3155                 printf("Set attrs fail. (%s:%x)\n", err_attr_name, err);                //When the function failed, 'err_attr_name' has the name of attr that made the error.
3156                 if (err_attr_name) {
3157                         free(err_attr_name);                    //Please free 'err_attr_name', after using the argument.
3158                         err_attr_name = NULL;
3159                         return FALSE;
3160                 }
3161         }
3162
3163         return TRUE;
3164 }
3165  *      @endcode
3166  */
3167 int mm_camcorder_set_attributes(MMHandleType camcorder,  char **err_attr_name, const char *attribute_name, ...) G_GNUC_NULL_TERMINATED;
3168
3169
3170 /**
3171  *    mm_camcorder_get_attribute_info:\n
3172  *  Get detail information of the attribute. To manager attributes, an user may want to know the exact character of the attribute,
3173  *  such as type, flag, and validity. This is the function to provide such information.
3174  *  Depending on the 'validity_type', validity union would be different. To know about the type of union, please refer 'MMCamAttrsInfo'.
3175  *
3176  *      @param[in]      camcorder       Specifies the camcorder  handle.
3177  *      @param[in]      attribute_name  attribute name that user want to get information.
3178  *      @param[out]     info            a structure that holds information related with the attribute.
3179  *      @return         This function returns zero(MM_ERROR_NONE) on success, or negative value with error code.\n
3180  *                      Please refer 'mm_error.h' to know the exact meaning of the error.
3181  *      @pre            None
3182  *      @post           None
3183  *      @remarks        If the function succeeds, 'info' holds detail information about the attribute, such as type,
3184  *                      flag, validity_type, validity_values, and default values.
3185  *      @see            mm_camcorder_get_attributes, mm_camcorder_set_attributes
3186  *      @par example
3187  *      @code
3188
3189 #include <mm_camcorder.h>
3190
3191 gboolean getting_info_from_attribute()
3192 {
3193         MMCamAttrsInfo info;
3194         int err;
3195
3196         err = mm_camcorder_get_attribute_info(handle, MMCAM_CAPTURE_HEIGHT, &info);
3197         if (err < 0) {
3198                 printf("Fail to call mm_camcorder_get_attribute_info()");
3199                 return FALSE;
3200         }
3201
3202         //Now 'info' has many information about 'MMCAM_CAPTURE_HEIGHT'
3203
3204         return TRUE;
3205 }
3206  *      @endcode
3207  */
3208 int mm_camcorder_get_attribute_info(MMHandleType camcorder, const char *attribute_name, MMCamAttrsInfo *info);
3209
3210
3211 /**
3212  *    mm_camcorder_get_fps_list_by_resolution:\n
3213  *  Get detail information of the fps configure. To manager fps, an user may want to know the supported fps list by the current preview resolution,
3214  *  Gives attribute information structure, from the configure data.
3215  *  Depending on the 'validity_type', validity union would be different. To know about the type of union, please refer 'MMCamAttrsInfo'.
3216  *
3217  *      @param[in]      camcorder       Specifies the camcorder  handle.
3218  *      @param[in]      width   width value of the current Preview resolution.
3219  *      @param[in]      height  height value of the current Preview resolution.
3220  *      @param[out]     fps_info                a structure that holds information related with the attribute.
3221  *      @return         This function returns zero(MM_ERROR_NONE) on success, or negative value with error code.\n
3222  *                      Please refer 'mm_error.h' to know the exact meaning of the error.
3223  *      @pre            None
3224  *      @post           None
3225  *      @remarks        If the function succeeds, 'info' holds detail information about the attribute, such as type,
3226  *                      flag, validity_type, validity_values, and default values.
3227  *      @see            mm_camcorder_get_attributes, mm_camcorder_set_attributes
3228  *      @par example
3229  *      @code
3230
3231 #include <mm_camcorder.h>
3232
3233 gboolean getting_info_from_attribute()
3234 {
3235         MMCamAttrsInfo info;
3236         int err;
3237
3238         err = mm_camcorder_get_fps_list_by_resolution(handle, width, height, &info);
3239         if (err < 0) {
3240                 printf("Fail to call mm_camcorder_get_attribute_info()");
3241                 return FALSE;
3242         }
3243
3244         //Now 'info' has many information about 'MMCAM_CAPTURE_HEIGHT'
3245
3246         return TRUE;
3247 }
3248  *      @endcode
3249  */
3250 int mm_camcorder_get_fps_list_by_resolution(MMHandleType camcorder, int width, int height, MMCamAttrsInfo *fps_info);
3251
3252
3253 /**
3254  *    mm_camcorder_init_focusing:\n
3255  *  Initialize focusing. \n
3256  *  This function stops focusing action and adjust the camera lens to initial position.
3257  *  Some camera applciation requires to initialize its lens position after releasing half shutter. In that case,
3258  *  this should be a good choice. Comparing with mm_camcorder_stop_focusing, this function not only stops focusing,
3259  *  but also initialize the lens. Preview image might be out-focused after calling this function.
3260  *      @param[in]      camcorder  A handle of camcorder.
3261  *      @return         This function returns zero(MM_ERROR_NONE) on success, or negative value with error code.\n
3262  *                      Please refer 'mm_error.h' to know the exact meaning of the error.
3263  *      @pre            The status of camcorder should be MM_CAMCORDER_STATE_PREPARE, MM_CAMCORDER_STATE_RECORDING, or MM_CAMCORDER_STATE_PAUSED.
3264  *      @post           None
3265  *      @remarks        None
3266  *      @see            mm_camcorder_start_focusing, mm_camcorder_stop_focusing
3267  *      @par example
3268  *      @code
3269
3270 #include <mm_camcorder.h>
3271
3272 gboolean start_autofocus()
3273 {
3274         int err;
3275         char * err_attr_name = NULL;
3276
3277         // Set focus mode to 'AUTO' and scan range to 'AF Normal'.
3278         //You just need to set these values one time. After that, just call mm_camcorder_start_focusing().
3279         err = mm_camcorder_set_attributes((MMHandleType)hcam, &err_attr_name,
3280                                           MMCAM_CAMERA_FOCUS_MODE, MM_CAMCORDER_FOCUS_MODE_AUTO,
3281                                           MMCAM_CAMERA_AF_SCAN_RANGE, MM_CAMCORDER_AUTO_FOCUS_NORMAL,
3282                                           NULL);
3283
3284         if (err < 0) {
3285                 printf("Set attrs fail. (%s:%x)\n", err_attr_name, err);
3286                 if (err_attr_name) {
3287                         free(err_attr_name);
3288                         err_attr_name = NULL;
3289                         return FALSE;
3290                 }
3291         }
3292
3293         mm_camcorder_init_focusing(hcam);
3294         mm_camcorder_start_focusing(hcam);
3295         printf("Waiting for adjusting focus\n");
3296
3297         // Waiting for 'MM_MESSAGE_CAMCORDER_FOCUS_CHANGED'
3298
3299         return TRUE;
3300 }
3301
3302  *      @endcode
3303  */
3304 int mm_camcorder_init_focusing(MMHandleType camcorder);
3305
3306
3307 /**
3308  *    mm_camcorder_start_focusing:\n
3309  *  Start focusing. \n
3310  *  This function command to start focusing opeartion. Because focusing operation depends on mechanic or electric module,
3311  *  it may take small amount of time. (For ex, 500ms ~ 3sec). \n
3312  *  This function works asynchronously. When an user call this function,  it will return immediately.
3313  *  However, focusing operation will continue until it gets results.
3314  *  After finishing operation, you can get 'MM_MESSAGE_CAMCORDER_FOCUS_CHANGED' message.
3315  *  'param.code' of the message structure describes the fucusing was success or not.
3316  *
3317  *      @param[in]      camcorder       A handle of camcorder.
3318  *      @return         This function returns zero(MM_ERROR_NONE) on success, or negative value with error code.\n
3319  *                      Please refer 'mm_error.h' to know the exact meaning of the error.
3320  *      @pre            None
3321  *      @post           None
3322  *      @remarks        None
3323  *      @see            mm_camcorder_init_focusing, mm_camcorder_stop_focusing
3324  *      @par example
3325  *      @code
3326
3327 #include <mm_camcorder.h>
3328
3329 gboolean start_autofocus()
3330 {
3331         int err;
3332         char * err_attr_name = NULL;
3333
3334         // Set focus mode to 'AUTO' and scan range to 'AF Normal'.
3335         //You just need to set these values one time. After that, just call mm_camcorder_start_focusing().
3336         err = mm_camcorder_set_attributes((MMHandleType)hcam, &err_attr_name,
3337                                           MMCAM_CAMERA_FOCUS_MODE, MM_CAMCORDER_FOCUS_MODE_AUTO,
3338                                           MMCAM_CAMERA_AF_SCAN_RANGE, MM_CAMCORDER_AUTO_FOCUS_NORMAL,
3339                                           NULL);
3340
3341         if (err < 0) {
3342                 printf("Set attrs fail. (%s:%x)\n", err_attr_name, err);
3343                 if (err_attr_name) {
3344                         free(err_attr_name);
3345                         err_attr_name = NULL;
3346                         return FALSE;
3347                 }
3348         }
3349
3350         mm_camcorder_init_focusing(hcam);
3351         mm_camcorder_start_focusing(hcam);
3352         printf("Waiting for adjusting focus\n");
3353
3354         // Waiting for 'MM_MESSAGE_CAMCORDER_FOCUS_CHANGED'
3355
3356         return TRUE;
3357 }
3358
3359  *      @endcode
3360  */
3361 int mm_camcorder_start_focusing(MMHandleType camcorder);
3362
3363
3364 /**
3365  *    mm_camcorder_stop_focusing:\n
3366  *  Stop focusing. This function halts focusing operation.\n
3367  *  This is the function to stop focusing in the middle of the operation. So if focusing is already finished or not started yet,
3368  *  this function will do nothing.
3369  *
3370  *      @param[in]      camcorder       A handle of camcorder.
3371  *      @return         This function returns zero(MM_ERROR_NONE) on success, or negative value with error code.\n
3372  *                      Please refer 'mm_error.h' to know the exact meaning of the error.
3373  *      @see            mm_camcorder_init_focusing, mm_camcorder_start_focusing
3374  *      @pre            mm_camcorder_start_focusing() should be called before calling this function.
3375  *      @post           None
3376  *      @remarks        None
3377  *      @par example
3378  *      @code
3379
3380 #include <mm_camcorder.h>
3381
3382 gboolean stop_autofocus()
3383 {
3384         int err;
3385
3386         //Stop focusing
3387         mm_camcorder_stop_focusing(hcam);
3388
3389         return TRUE;
3390 }
3391
3392  *      @endcode
3393  */
3394 int mm_camcorder_stop_focusing(MMHandleType camcorder);
3395
3396 /* emit signal */
3397 void mm_camcorder_emit_signal(MMHandleType camcorder, const char *object_name,
3398         const char *interface_name, const char *signal_name, int value);
3399
3400 /* check compatability between codec and file format */
3401 int mm_camcorder_check_codec_fileformat_compatibility(const char *codec_type, int codec, int file_format);
3402
3403 /* external storage state management */
3404 int mm_camcorder_manage_external_storage_state(MMHandleType camcorder, int storage_state);
3405
3406 /**
3407         @}
3408  */
3409
3410 #ifdef __cplusplus
3411 }
3412 #endif
3413
3414 #endif /* __MM_CAMCORDER_H__ */