1094332d3Sopenharmony_ci/* 2094332d3Sopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd. 3094332d3Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4094332d3Sopenharmony_ci * you may not use this file except in compliance with the License. 5094332d3Sopenharmony_ci * You may obtain a copy of the License at 6094332d3Sopenharmony_ci * 7094332d3Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8094332d3Sopenharmony_ci * 9094332d3Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10094332d3Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11094332d3Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12094332d3Sopenharmony_ci * See the License for the specific language governing permissions and 13094332d3Sopenharmony_ci * limitations under the License. 14094332d3Sopenharmony_ci */ 15094332d3Sopenharmony_ci 16094332d3Sopenharmony_ci#ifndef USB_CAMERA_TEST_MULT_H 17094332d3Sopenharmony_ci#define USB_CAMERA_TEST_MULT_H 18094332d3Sopenharmony_ci 19094332d3Sopenharmony_ci#include "test_camera_base.h" 20094332d3Sopenharmony_ci 21094332d3Sopenharmony_cienum { 22094332d3Sopenharmony_ci STREAM_ID_PREVIEW_DOUBLE = 1100, // 1100:double preview streamID 23094332d3Sopenharmony_ci STREAM_ID_CAPTURE_DOUBLE, 24094332d3Sopenharmony_ci STREAM_ID_VIDEO_DOUBLE, 25094332d3Sopenharmony_ci CAPTURE_ID_PREVIEW_DOUBLE = 2100, // 2100:double preview captureId 26094332d3Sopenharmony_ci CAPTURE_ID_CAPTURE_DOUBLE, 27094332d3Sopenharmony_ci CAPTURE_ID_VIDEO_DOUBLE 28094332d3Sopenharmony_ci}; 29094332d3Sopenharmony_ci 30094332d3Sopenharmony_ciclass UtestUSBCameraTestMult : public testing::Test { 31094332d3Sopenharmony_cipublic: 32094332d3Sopenharmony_ci static void SetUpTestCase(void); 33094332d3Sopenharmony_ci static void TearDownTestCase(void); 34094332d3Sopenharmony_ci void SetUp(void); 35094332d3Sopenharmony_ci void TearDown(void); 36094332d3Sopenharmony_ci CamRetCode SelectOpenCamera(std::string cameraId); 37094332d3Sopenharmony_ci void AchieveStreamOperator(); 38094332d3Sopenharmony_ci uint32_t ConvertPixfmtHal2V4l2(uint32_t ohosfmt); 39094332d3Sopenharmony_ci void DefaultInfosPreview(); 40094332d3Sopenharmony_ci void DefaultInfosVideo(); 41094332d3Sopenharmony_ci void DefaultInfosCapture(); 42094332d3Sopenharmony_ci void StartStream(std::vector<StreamIntent> intents); 43094332d3Sopenharmony_ci void StoreImage(const unsigned char *bufStart, const uint32_t size); 44094332d3Sopenharmony_ci void StoreVideo(const unsigned char *bufStart, const uint32_t size); 45094332d3Sopenharmony_ci void OpenVideoFile(); 46094332d3Sopenharmony_ci void CloseFd(); 47094332d3Sopenharmony_ci void StartCapture(int streamId, int captureId, bool shutterCallback, bool isStreaming); 48094332d3Sopenharmony_ci void StopStream(std::vector<int>& captureIds, std::vector<int>& streamIds); 49094332d3Sopenharmony_ci 50094332d3Sopenharmony_ci std::shared_ptr<TestCameraBase> cameraBase_ = nullptr; 51094332d3Sopenharmony_ci bool usbCameraExit_ = false; 52094332d3Sopenharmony_ci std::vector<uint8_t> vecAbility_ = {}; 53094332d3Sopenharmony_ci std::shared_ptr<CameraAbility> ability_ = nullptr; 54094332d3Sopenharmony_ci OHOS::sptr<ICameraDevice> cameraDevice_ = nullptr; 55094332d3Sopenharmony_ci OHOS::sptr<IStreamOperator> streamOperator_ = nullptr; 56094332d3Sopenharmony_ci std::shared_ptr<StreamCustomer> streamCustomerPreview_ = nullptr; 57094332d3Sopenharmony_ci std::shared_ptr<StreamCustomer> streamCustomerCapture_ = nullptr; 58094332d3Sopenharmony_ci std::shared_ptr<StreamCustomer> streamCustomerVideo_ = nullptr; 59094332d3Sopenharmony_ci std::vector<StreamInfo> streamInfos_ = {}; 60094332d3Sopenharmony_ci StreamInfo streamInfoPre_ = {}; 61094332d3Sopenharmony_ci StreamInfo streamInfoVideo_ = {}; 62094332d3Sopenharmony_ci StreamInfo streamInfoCapture_ = {}; 63094332d3Sopenharmony_ci CaptureInfo captureInfo_ = {}; 64094332d3Sopenharmony_ci uint32_t videoFormat_; 65094332d3Sopenharmony_ci int videoFd_ = -1; 66094332d3Sopenharmony_ci}; 67094332d3Sopenharmony_ci#endif 68