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 metadata_output.h 30 * 31 * @brief Declare the metadata 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_METADATAOUTPUT_H 40 #define NATIVE_INCLUDE_CAMERA_METADATAOUTPUT_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 Metadata output object 52 * 53 * A pointer can be created using {@link Camera_MetadataOutput} method. 54 * 55 * @since 11 56 * @version 1.0 57 */ 58 typedef struct Camera_MetadataOutput Camera_MetadataOutput; 59 60 /** 61 * @brief Metadata output metadata object available callback to be called in {@link MetadataOutput_Callbacks}. 62 * 63 * @param metadataOutput the {@link Camera_MetadataOutput} which deliver the callback. 64 * @param metadataObject the {@link Camera_MetadataObject} will be delivered by the callback. 65 * @param size the size of the metadataObject. 66 * @since 11 67 */ 68 typedef void (*OH_MetadataOutput_OnMetadataObjectAvailable)(Camera_MetadataOutput* metadataOutput, 69 Camera_MetadataObject* metadataObject, uint32_t size); 70 71 /** 72 * @brief Metadata output error callback to be called in {@link MetadataOutput_Callbacks}. 73 * 74 * @param metadataOutput the {@link Camera_MetadataOutput} which deliver the callback. 75 * @param errorCode the {@link Camera_ErrorCode} of the metadata output. 76 * 77 * @see CAMERA_SERVICE_FATAL_ERROR 78 * @since 11 79 */ 80 typedef void (*OH_MetadataOutput_OnError)(Camera_MetadataOutput* metadataOutput, Camera_ErrorCode errorCode); 81 82 /** 83 * @brief A listener for metadata output. 84 * 85 * @see OH_MetadataOutput_RegisterCallback 86 * @since 11 87 * @version 1.0 88 */ 89 typedef struct MetadataOutput_Callbacks { 90 /** 91 * Metadata output result data will be called by this callback. 92 */ 93 OH_MetadataOutput_OnMetadataObjectAvailable onMetadataObjectAvailable; 94 95 /** 96 * Metadata output error event. 97 */ 98 OH_MetadataOutput_OnError onError; 99 } MetadataOutput_Callbacks; 100 101 /** 102 * @brief Register metadata output change event callback. 103 * 104 * @param metadataOutput the {@link Camera_MetadataOutput} instance. 105 * @param callback the {@link MetadataOutput_Callbacks} to be registered. 106 * @return {@link #CAMERA_OK} if the method call succeeds. 107 * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. 108 * @since 11 109 */ 110 Camera_ErrorCode OH_MetadataOutput_RegisterCallback(Camera_MetadataOutput* metadataOutput, 111 MetadataOutput_Callbacks* callback); 112 113 /** 114 * @brief Unregister metadata output change event callback. 115 * 116 * @param metadataOutput the {@link Camera_MetadataOutput} instance. 117 * @param callback the {@link MetadataOutput_Callbacks} to be unregistered. 118 * @return {@link #CAMERA_OK} if the method call succeeds. 119 * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. 120 * @since 11 121 */ 122 Camera_ErrorCode OH_MetadataOutput_UnregisterCallback(Camera_MetadataOutput* metadataOutput, 123 MetadataOutput_Callbacks* callback); 124 125 /** 126 * @brief Start metadata output. 127 * 128 * @param metadataOutput the {@link Camera_MetadataOutput} instance to be started. 129 * @return {@link #CAMERA_OK} if the method call succeeds. 130 * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. 131 * {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config. 132 * {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error. 133 * @since 11 134 */ 135 Camera_ErrorCode OH_MetadataOutput_Start(Camera_MetadataOutput* metadataOutput); 136 137 /** 138 * @brief Stop metadata output. 139 * 140 * @param metadataOutput the {@link Camera_MetadataOutput} instance to be stoped. 141 * @return {@link #CAMERA_OK} if the method call succeeds. 142 * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. 143 * {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error. 144 * @since 11 145 */ 146 Camera_ErrorCode OH_MetadataOutput_Stop(Camera_MetadataOutput* metadataOutput); 147 148 /** 149 * @brief Release metadata output. 150 * 151 * @param metadataOutput the {@link Camera_MetadataOutput} instance to be released. 152 * @return {@link #CAMERA_OK} if the method call succeeds. 153 * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. 154 * {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error. 155 * @since 11 156 */ 157 Camera_ErrorCode OH_MetadataOutput_Release(Camera_MetadataOutput* metadataOutput); 158 159 #ifdef __cplusplus 160 } 161 #endif 162 163 #endif // NATIVE_INCLUDE_CAMERA_METADATAOUTPUT_H 164 /** @} */