1 /* 2 * Copyright (c) 2021-2022 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 _MPI_ADAPTER_H 17 #define _MPI_ADAPTER_H 18 19 #include <vector> 20 #include <string> 21 #include <thread> 22 #include <list> 23 #include <mutex> 24 #include <map> 25 #include "camera.h" 26 #include "ibuffer.h" 27 #include "stream.h" 28 29 namespace OHOS { 30 namespace Camera { 31 #define INIT_PARAM_KEY_MAX_LEN 128 32 33 using DeviceFormat = struct _DeviceFormat { 34 uint32_t portId; 35 int32_t width; 36 int32_t height; 37 int32_t framerate; 38 uint64_t pixFormat; 39 int32_t mirror; 40 int32_t flip; 41 int32_t rotation; 42 }; 43 44 using PortConfig = struct _PortConfig { 45 int32_t streamId_; 46 int32_t bufferCount_; 47 int32_t width_; 48 int32_t height_; 49 int32_t framerate_; 50 uint32_t format_; 51 int32_t srcPortId_; 52 int32_t dstPortId_; 53 uint64_t usage_; 54 bool isExtPool_; 55 CameraEncodeType encodeType_; 56 }; 57 58 enum ThreadState : uint32_t { 59 THREAD_STOP = 0, 60 THREAD_RUNNING, 61 THREAD_DESTROY, 62 THREAD_NEED_CREATE, 63 }; 64 65 enum PoolState : uint32_t { 66 POOL_INACTIVE = 0, 67 POOL_ACTIVE = 1, 68 }; 69 70 using PoolSpec = struct _PoolSpec { 71 uint32_t poolId; 72 int32_t streamId_; 73 uint32_t statue; 74 uint32_t isCreated; 75 int32_t portNum; 76 uint32_t curCount; 77 uint32_t totalCount; 78 uint64_t frameNumber; 79 }; 80 constexpr int32_t MPI_SUCCESS = 0; 81 82 using BufCallback = std::function<void(std::shared_ptr<FrameSpec>)>; 83 using DeviceStatusCb = std::function<void()>; 84 } // namespace Camera 85 } // namespace OHOS 86 #endif // _MPI_ADAPTER_H 87