• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 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 USB_CAMERA_TEST_MULT_H
17 #define USB_CAMERA_TEST_MULT_H
18 
19 #include "test_display.h"
20 
21 enum {
22     STREAM_ID_PREVIEW_DOUBLE = 1100, // 1100:double preview streamID
23     STREAM_ID_CAPTURE_DOUBLE,
24     STREAM_ID_VIDEO_DOUBLE,
25     CAPTURE_ID_PREVIEW_DOUBLE = 2100, // 2100:double preview captureId
26     CAPTURE_ID_CAPTURE_DOUBLE,
27     CAPTURE_ID_VIDEO_DOUBLE
28 };
29 
30 class UtestUSBCameraTestMult : public testing::Test {
31 public:
32     static void SetUpTestCase(void);
33     static void TearDownTestCase(void);
34     void SetUp(void);
35     void TearDown(void);
36     CamRetCode SelectOpenCamera(std::string cameraId);
37     void AchieveStreamOperator();
38     uint32_t ConvertPixfmtHal2V4l2(uint32_t ohosfmt);
39     void DefaultInfosPreview();
40     void DefaultInfosVideo();
41     void DefaultInfosCapture();
42     void StartStream(std::vector<StreamIntent> intents);
43     void StoreImage(const unsigned char *bufStart, const uint32_t size);
44     void StoreVideo(const unsigned char *bufStart, const uint32_t size);
45     void OpenVideoFile();
46     void CloseFd();
47     void StartCapture(int streamId, int captureId, bool shutterCallback, bool isStreaming);
48     void StopStream(std::vector<int>& captureIds, std::vector<int>& streamIds);
49 
50     std::shared_ptr<TestDisplay> cameraBase_ = nullptr;
51     bool usbCameraExit_ = false;
52     std::vector<uint8_t> vecAbility_ = {};
53     std::shared_ptr<CameraAbility> ability_ = nullptr;
54     OHOS::sptr<ICameraDevice> cameraDevice_ = nullptr;
55     OHOS::sptr<IStreamOperator> streamOperator_ = nullptr;
56     std::shared_ptr<StreamCustomer> streamCustomerPreview_ = nullptr;
57     std::shared_ptr<StreamCustomer> streamCustomerCapture_ = nullptr;
58     std::shared_ptr<StreamCustomer> streamCustomerVideo_ = nullptr;
59     std::vector<StreamInfo> streamInfos_ = {};
60     StreamInfo streamInfoPre_ = {};
61     StreamInfo streamInfoVideo_ = {};
62     StreamInfo streamInfoCapture_ = {};
63     CaptureInfo captureInfo_ = {};
64     uint32_t videoFormat_;
65     int videoFd_ = -1;
66 };
67 #endif
68