1 /* 2 * Copyright (c) 2020 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 HOS_CAMERA_STREAM_CUSTOMER_H 17 #define HOS_CAMERA_STREAM_CUSTOMER_H 18 19 #include <iostream> 20 #include <thread> 21 #include <vector> 22 #include <map> 23 #include <hdf_log.h> 24 #include <surface.h> 25 #include <display_type.h> 26 #include "camera_metadata_info.h" 27 #include "ibuffer.h" 28 #include "if_system_ability_manager.h" 29 #include "ioffline_stream_operator.h" 30 #include "iservice_registry.h" 31 #include "camera.h" 32 33 namespace OHOS::Camera { 34 class StreamCustomer { 35 public: 36 StreamCustomer(); 37 ~StreamCustomer(); 38 39 sptr<OHOS::IBufferProducer> CreateProducer(); 40 void CamFrame(const std::function<void(void*, const uint32_t)> callback); 41 42 RetCode ReceiveFrameOn(const std::function<void(void*, const uint32_t)> callback); 43 void ReceiveFrameOff(); 44 45 class TestBuffersConsumerListener: public IBufferConsumerListener { 46 public: TestBuffersConsumerListener()47 TestBuffersConsumerListener() 48 { 49 } 50 ~TestBuffersConsumerListener()51 ~TestBuffersConsumerListener() 52 { 53 } 54 OnBufferAvailable()55 void OnBufferAvailable() 56 { 57 } 58 }; 59 60 private: 61 unsigned int camFrameExit_ = 1; 62 63 sptr<OHOS::Surface> consumer_ = nullptr; 64 std::thread* previewThreadId_ = nullptr; 65 }; 66 } // namespace OHOS::Camera 67 #endif // HOS_CAMERA_STREAM_CUSTOMER_H 68