1 /* 2 * Copyright (c) 2021 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 #ifndef CAMERA_DEVICE_DRIVER_UTILS_H 17 #define CAMERA_DEVICE_DRIVER_UTILS_H 18 19 #include <camera.h> 20 #include <device_manager_adapter.h> 21 #include "v1_0/types.h" 22 #include "surface.h" 23 24 namespace OHOS::Camera { 25 using namespace OHOS::HDI::Camera::V1_0; 26 using StreamSupported = struct _StreamSupported { 27 OperationMode operationMode_; 28 StreamSupportType streamSupportType_; 29 std::vector<std::shared_ptr<StreamInfo>> streamInfos_; 30 }; 31 32 using CaptureCallback = struct _CaptureCallback { 33 std::function<void (int32_t captureId, const std::vector<int32_t> &streamId)> OnCaptureStarted; 34 std::function<void (int32_t captureId, const std::vector<std::shared_ptr<CaptureEndedInfo>> &info)> OnCaptureEnded; 35 std::function<void (int32_t captureId, const std::vector<std::shared_ptr<CaptureErrorInfo>> &info)> OnCaptureError; 36 std::function<void (int32_t captureId, const std::vector<int> &streamIds)> OnFrameShutter; 37 }; 38 39 using OperationType = enum _StreamOperationType : uint8_t { 40 STREAM_BUFFER_FLUSH = 0, 41 STREAM_BUFFER_CANCEL = 1, 42 STREAM_BUFFER_ERROR = 2 43 }; 44 45 using BufferClientConfig = struct _BufferClientConfig { 46 OHOS::sptr<OHOS::SurfaceBuffer> buffer_; 47 int32_t fence_; 48 int32_t usage_; 49 }; 50 } 51 #endif /* CAMERA_DEVICE_DRIVER_UTILS_H */ 52