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