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/vdi_types.h" 22 #include "surface.h" 23 24 namespace OHOS::Camera { 25 using namespace OHOS::VDI::Camera::V1_0; 26 using StreamSupported = struct _StreamSupported { 27 VdiOperationMode VdiOperationMode_; 28 VdiStreamSupportType streamSupportType_; 29 std::vector<std::shared_ptr<VdiStreamInfo>> 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, 35 const std::vector<std::shared_ptr<VdiCaptureEndedInfo>> &info)> OnCaptureEnded; 36 std::function<void (int32_t captureId, 37 const std::vector<std::shared_ptr<VdiCaptureErrorInfo>> &info)> OnCaptureError; 38 std::function<void (int32_t captureId, const std::vector<int> &streamIds)> OnFrameShutter; 39 }; 40 41 using OperationType = enum _StreamOperationType : uint8_t { 42 STREAM_BUFFER_FLUSH = 0, 43 STREAM_BUFFER_CANCEL = 1, 44 STREAM_BUFFER_ERROR = 2 45 }; 46 47 using BufferClientConfig = struct _BufferClientConfig { 48 OHOS::sptr<OHOS::SurfaceBuffer> buffer_; 49 int32_t fence_; 50 int32_t usage_; 51 }; 52 } 53 #endif /* CAMERA_DEVICE_DRIVER_UTILS_H */ 54