• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 /**
17  * @addtogroup OH_Camera
18  * @{
19  *
20  * @brief Provide the definition of the C interface for the camera module.
21  *
22  * @syscap SystemCapability.Multimedia.Camera.Core
23  *
24  * @since 11
25  * @version 1.0
26  */
27 
28 /**
29  * @file photo_output.h
30  *
31  * @brief Declare the photo output concepts.
32  *
33  * @library libohcamera.so
34  * @syscap SystemCapability.Multimedia.Camera.Core
35  * @since 11
36  * @version 1.0
37  */
38 
39 #ifndef NATIVE_INCLUDE_CAMERA_PHOTOOUTPUT_H
40 #define NATIVE_INCLUDE_CAMERA_PHOTOOUTPUT_H
41 
42 #include <stdint.h>
43 #include <stdio.h>
44 #include "camera.h"
45 
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49 
50 /**
51  * @brief Photo output object
52  *
53  * A pointer can be created using {@link Camera_PhotoOutput} method.
54  *
55  * @since 11
56  * @version 1.0
57  */
58 typedef struct Camera_PhotoOutput Camera_PhotoOutput;
59 
60 /**
61  * @brief Photo output frame start callback to be called in {@link PhotoOutput_Callbacks}.
62  *
63  * @param photoOutput the {@link Camera_PhotoOutput} which deliver the callback.
64  * @since 11
65  */
66 typedef void (*OH_PhotoOutput_OnFrameStart)(Camera_PhotoOutput* photoOutput);
67 
68 /**
69  * @brief Photo output frame shutter callback to be called in {@link PhotoOutput_Callbacks}.
70  *
71  * @param photoOutput the {@link Camera_PhotoOutput} which deliver the callback.
72  * @param info the {@link Camera_FrameShutterInfo} which delivered by the callback.
73  * @since 11
74  */
75 typedef void (*OH_PhotoOutput_OnFrameShutter)(Camera_PhotoOutput* photoOutput, Camera_FrameShutterInfo* info);
76 
77 /**
78  * @brief Photo output frame end callback to be called in {@link PhotoOutput_Callbacks}.
79  *
80  * @param photoOutput the {@link Camera_PhotoOutput} which deliver the callback.
81  * @param frameCount the frame count which delivered by the callback.
82  * @since 11
83  */
84 typedef void (*OH_PhotoOutput_OnFrameEnd)(Camera_PhotoOutput* photoOutput, int32_t frameCount);
85 
86 /**
87  * @brief Photo output error callback to be called in {@link PhotoOutput_Callbacks}.
88  *
89  * @param photoOutput the {@link Camera_PhotoOutput} which deliver the callback.
90  * @param errorCode the {@link Camera_ErrorCode} of the photo output.
91  *
92  * @see CAMERA_SERVICE_FATAL_ERROR
93  * @since 11
94  */
95 typedef void (*OH_PhotoOutput_OnError)(Camera_PhotoOutput* photoOutput, Camera_ErrorCode errorCode);
96 
97 /**
98  * @brief A listener for photo output.
99  *
100  * @see OH_PhotoOutput_RegisterCallback
101  * @since 11
102  * @version 1.0
103  */
104 typedef struct PhotoOutput_Callbacks {
105     /**
106      * Photo output frame start event.
107      */
108     OH_PhotoOutput_OnFrameStart onFrameStart;
109 
110     /**
111      * Photo output frame shutter event.
112      */
113     OH_PhotoOutput_OnFrameShutter onFrameShutter;
114 
115     /**
116      * Photo output frame end event.
117      */
118     OH_PhotoOutput_OnFrameEnd onFrameEnd;
119 
120     /**
121      * Photo output error event.
122      */
123     OH_PhotoOutput_OnError onError;
124 } PhotoOutput_Callbacks;
125 
126 /**
127  * @brief Register photo output change event callback.
128  *
129  * @param photoOutput the {@link Camera_PhotoOutput} instance.
130  * @param callback the {@link PhotoOutput_Callbacks} to be registered.
131  * @return {@link #CAMERA_OK} if the method call succeeds.
132  *         {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
133  * @since 11
134  */
135 Camera_ErrorCode OH_PhotoOutput_RegisterCallback(Camera_PhotoOutput* photoOutput, PhotoOutput_Callbacks* callback);
136 
137 /**
138  * @brief Unregister photo output change event callback.
139  *
140  * @param photoOutput the {@link Camera_PhotoOutput} instance.
141  * @param callback the {@link PhotoOutput_Callbacks} to be unregistered.
142  * @return {@link #CAMERA_OK} if the method call succeeds.
143  *         {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
144  * @since 11
145  */
146 Camera_ErrorCode OH_PhotoOutput_UnregisterCallback(Camera_PhotoOutput* photoOutput, PhotoOutput_Callbacks* callback);
147 
148 /**
149  * @brief Capture photo.
150  *
151  * @param photoOutput the {@link Camera_PhotoOutput} instance which used to capture photo.
152  * @return {@link #CAMERA_OK} if the method call succeeds.
153  *         {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
154  *         {@link #CAMERA_SESSION_NOT_RUNNING} if the capture session not running.
155  *         {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error.
156  * @since 11
157  */
158 Camera_ErrorCode OH_PhotoOutput_Capture(Camera_PhotoOutput* photoOutput);
159 
160 /**
161  * @brief Capture photo with capture setting.
162  *
163  * @param photoOutput the {@link Camera_PhotoOutput} instance which used to capture photo.
164  * @param setting the {@link Camera_PhotoCaptureSetting} to used to capture photo.
165  * @return {@link #CAMERA_OK} if the method call succeeds.
166  *         {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
167  *         {@link #CAMERA_SESSION_NOT_RUNNING} if the capture session not running.
168  *         {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error.
169  * @since 11
170  */
171 Camera_ErrorCode OH_PhotoOutput_Capture_WithCaptureSetting(Camera_PhotoOutput* photoOutput,
172     Camera_PhotoCaptureSetting setting);
173 
174 /**
175  * @brief Release photo output.
176  *
177  * @param photoOutput the {@link Camera_PhotoOutput} instance to released.
178  * @return {@link #CAMERA_OK} if the method call succeeds.
179  *         {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
180  *         {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error.
181  * @since 11
182  */
183 Camera_ErrorCode OH_PhotoOutput_Release(Camera_PhotoOutput* photoOutput);
184 
185 /**
186  * @brief Check whether to support mirror photo.
187  *
188  * @param photoOutput the {@link Camera_PhotoOutput} instance which used to check whether mirror supported.
189  * @param isSupported the result of whether mirror supported.
190  * @return {@link #CAMERA_OK} if the method call succeeds.
191  *         {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
192  *         {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error.
193  * @since 11
194  */
195 Camera_ErrorCode OH_PhotoOutput_IsMirrorSupported(Camera_PhotoOutput* photoOutput, bool* isSupported);
196 
197 #ifdef __cplusplus
198 }
199 #endif
200 
201 #endif // NATIVE_INCLUDE_CAMERA_PHOTOOUTPUT_H
202 /** @} */