a2c50e99543ff19f8440235e17c9adf918a8386c
[platform/core/multimedia/libmm-camcorder.git] / src / include / mm_camcorder_stillshot.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 #ifndef __MM_CAMCORDER_STILLSHOT_H__
23 #define __MM_CAMCORDER_STILLSHOT_H__
24
25 /*=======================================================================================
26 | INCLUDE FILES                                                                         |
27 ========================================================================================*/
28 #include <gst/gst.h>
29 #include <mm_types.h>
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
35 /*=======================================================================================
36 | GLOBAL DEFINITIONS AND DECLARATIONS FOR CAMCORDER                                     |
37 ========================================================================================*/
38
39 /*=======================================================================================
40 | MACRO DEFINITIONS                                                                     |
41 ========================================================================================*/
42 #define _MMCAMCORDER_CAPTURE_STOP_CHECK_INTERVAL        (50*1000)
43 #define _MMCAMCORDER_CAPTURE_STOP_CHECK_COUNT           60
44
45 #define _MNOTE_VALUE_NONE                               0
46 #define _SOUND_STATUS_INIT                              -1
47
48 /*=======================================================================================
49 | ENUM DEFINITIONS                                                                      |
50 ========================================================================================*/
51
52
53 /*=======================================================================================
54 | STRUCTURE DEFINITIONS                                                                 |
55 ========================================================================================*/
56 /**
57  * MMCamcorder information for image(preview/capture) mode
58  */
59 typedef struct {
60         int type;                                       /**< Still-shot/Multi-shot */
61         int count;                                      /**< Multi-shot capture count */
62         int capture_cur_count;                          /**< Multi-shot capture current count */
63         int capture_send_count;                         /**< Multi-shot capture send count */
64         unsigned long long next_shot_time;              /**< next still capture time */
65         gboolean multi_shot_stop;                       /**< Multi-shot stop flag */
66         gboolean capturing;                             /**< whether MSL is on capturing */
67         gboolean resolution_change;                     /**< whether on resolution changing for capturing. After changing to capture resolution, it sets to FALSE again. */
68         int width;                                      /**< Width of capture image */
69         int height;                                     /**< Height of capture image */
70         int interval;                                   /**< Capture interval */
71         int preview_format;                             /**< Preview format */
72         int hdr_capture_mode;                           /**< HDR Capture mode */
73         gboolean sound_status;                          /**< sound status of system */
74         gboolean played_capture_sound;                  /**< whether play capture sound when capture starts */
75 } _MMCamcorderImageInfo;
76
77 /*=======================================================================================
78 | CONSTANT DEFINITIONS                                                                  |
79 ========================================================================================*/
80
81 /*=======================================================================================
82 | STATIC VARIABLES                                                                      |
83 ========================================================================================*/
84
85 /*=======================================================================================
86 | EXTERN GLOBAL VARIABLE                                                                |
87 ========================================================================================*/
88
89 /*=======================================================================================
90 | GLOBAL FUNCTION PROTOTYPES                                                            |
91 ========================================================================================*/
92 /**
93  * This function add still shot bin to main pipeline.
94  * When application creates initial pipeline, there are only bins for preview.
95  * If application wants to add stil shot function, bins for stillshot should be added.
96  *
97  * @param[in]   handle          Handle of camcorder context.
98  * @return      This function returns MM_ERROR_NONE on success, or the other values on error.
99  * @remarks
100  * @see         __mmcamcorder_create_preview_pipeline()
101  */
102 int _mmcamcorder_create_stillshot_pipeline(MMHandleType handle);
103
104 /**
105  * This function remove still shot bin from main pipeline.
106  *
107  * @param[in]   handle          Handle of camcorder context.
108  * @return      This function returns MM_ERROR_NONE on success, or the other values on error.
109  * @remarks
110  * @see         __mmcamcorder_create_preview_pipeline(), __mmcamcorder_add_stillshot_pipeline()
111  */
112 int _mmcamcorder_remove_stillshot_pipeline(MMHandleType handle);
113
114 /**
115  * This function connects capture signal.
116  *
117  * @param[in]   handle          Handle of camcorder context.
118  * @return      This function returns MM_ERROR_NONE on success, or the other values on error.
119  * @remarks
120  */
121 int _mmcamcorder_connect_capture_signal(MMHandleType handle);
122
123 /**
124  * This function destroy image pipeline.
125  *
126  * @param[in]   handle          Handle of camcorder context.
127  * @return      void
128  * @remarks
129  * @see         _mmcamcorder_destroy_pipeline()
130  *
131  */
132 void _mmcamcorder_destroy_video_capture_pipeline(MMHandleType handle);
133 int _mmcamcorder_video_capture_command(MMHandleType handle, int command);
134
135 /* Function for capture */
136 int __mmcamcorder_set_exif_basic_info(MMHandleType handle, int image_width, int image_height);
137 int __mmcamcorder_update_exif_info(MMHandleType handle, void *imagedata, int imgln);
138 void __mmcamcorder_init_stillshot_info(MMHandleType handle);
139 void __mmcamcorder_get_capture_data_from_buffer(MMCamcorderCaptureDataType *capture_data, int pixtype, GstSample *sample);
140 void __mmcamcorder_release_jpeg_data(MMHandleType handle, MMCamcorderCaptureDataType *dest, int tag_enable, int provide_exif);
141 int __mmcamcorder_capture_save_exifinfo(MMHandleType handle, MMCamcorderCaptureDataType *original, MMCamcorderCaptureDataType *thumbnail, int provide_exif);
142 int __mmcamcorder_set_jpeg_data(MMHandleType handle, MMCamcorderCaptureDataType *dest, MMCamcorderCaptureDataType *thumbnail, int provide_exif);
143 gboolean __mmcamcorder_handoff_callback(GstElement *fakesink, GstBuffer *buffer, GstPad *pad, gpointer u_data);
144
145 #ifdef __cplusplus
146 }
147 #endif
148
149 #endif /* __MM_CAMCORDER_STILLSHOT_H__ */