mirror of
https://gitee.com/openharmony/xts_hats
synced 2024-11-27 00:50:56 +00:00
commit
26f5f1ea1b
@ -185,6 +185,7 @@ public:
|
||||
std::vector<uint8_t> abilityVec = {};
|
||||
std::shared_ptr<CameraMetadata> ability = nullptr;
|
||||
std::vector<StreamIntent> intents;
|
||||
std::vector<int32_t> previewColorSpaces_ = {2360580, 2360324};
|
||||
class StreamConsumer;
|
||||
std::map<OHOS::Camera::StreamIntent, std::shared_ptr<StreamConsumer>> consumerMap_ = {};
|
||||
class TestBufferConsumerListener : public OHOS::IBufferConsumerListener {
|
||||
|
@ -466,11 +466,29 @@ void CaptureByColorSpaces(std::vector<int32_t> captureColorSpaces, std::shared_p
|
||||
}
|
||||
}
|
||||
|
||||
void VideoByColorSpaces(std::vector<int32_t> videoColorSpaces, std::shared_ptr<OHOS::Camera::Test> cameraTest)
|
||||
void VideoByColorSpaces(std::vector<int32_t> videoColorSpaces, std::vector<int32_t> previewColorSpaces,
|
||||
std::shared_ptr<OHOS::Camera::Test> cameraTest)
|
||||
{
|
||||
if (!videoColorSpaces.empty()) {
|
||||
for (int32_t colorSpaces : videoColorSpaces) {
|
||||
printf("video colorSpaces value %d\n", colorSpaces);
|
||||
cameraTest->imageDataSaveSwitch = SWITCH_ON;
|
||||
|
||||
//updateSettings
|
||||
std::shared_ptr<CameraSetting> meta = std::make_shared<CameraSetting>(ITEM_CAPACITY, DATA_CAPACITY);
|
||||
uint8_t videoStabiliMode = OHOS_CAMERA_VIDEO_STABILIZATION_AUTO;
|
||||
meta->addEntry(OHOS_CONTROL_VIDEO_STABILIZATION_MODE, &videoStabiliMode, DATA_COUNT);
|
||||
const int32_t deviceStreamId = cameraTest->streamIdPreview;
|
||||
meta->addEntry(OHOS_CAMERA_STREAM_ID, &deviceStreamId, DATA_COUNT);
|
||||
std::vector<uint8_t> setting;
|
||||
MetadataUtils::ConvertMetadataToVec(meta, setting);
|
||||
cameraTest->rc = (CamRetCode)cameraTest->cameraDevice->UpdateSettings(setting);
|
||||
EXPECT_EQ(HDI::Camera::V1_0::NO_ERROR, cameraTest->rc);
|
||||
|
||||
if (videoColorSpaces.empty() || previewColorSpaces.empty()) {
|
||||
printf("ColorSpaces empty is null\n");
|
||||
return;
|
||||
}
|
||||
for (int32_t colorSpaces : previewColorSpaces) {
|
||||
printf("preview colorSpaces value %d\n", colorSpaces);
|
||||
|
||||
// preview streamInfo
|
||||
cameraTest->streamInfoV1_1 = std::make_shared<OHOS::HDI::Camera::V1_1::StreamInfo_V1_1>();
|
||||
cameraTest->DefaultInfosPreview(cameraTest->streamInfoV1_1);
|
||||
@ -478,29 +496,34 @@ void VideoByColorSpaces(std::vector<int32_t> videoColorSpaces, std::shared_ptr<O
|
||||
if (colorSpaces == OHOS_CAMERA_BT2020_HLG_FULL) {
|
||||
cameraTest->streamInfoV1_1->v1_0.format_ = OHOS_CAMERA_FORMAT_YCBCR_P010;
|
||||
}
|
||||
cameraTest->streamInfosV1_1.push_back(*cameraTest->streamInfoV1_1);
|
||||
|
||||
// video streamInfo
|
||||
for (int32_t colorSpaces_ : videoColorSpaces) {
|
||||
printf("video colorSpaces_ value %d\n", colorSpaces_);
|
||||
cameraTest->streamInfosV1_1.push_back(*cameraTest->streamInfoV1_1);
|
||||
|
||||
cameraTest->streamInfoVideo = std::make_shared<OHOS::HDI::Camera::V1_1::StreamInfo_V1_1>();
|
||||
cameraTest->DefaultInfosVideo(cameraTest->streamInfoVideo);
|
||||
cameraTest->streamInfoVideo->v1_0.dataspace_ = colorSpaces;
|
||||
if (colorSpaces == OHOS_CAMERA_BT2020_HLG_FULL) {
|
||||
cameraTest->streamInfoVideo->v1_0.format_ = OHOS_CAMERA_FORMAT_YCBCR_P010;
|
||||
}
|
||||
cameraTest->streamInfoVideo->v1_0.dataspace_ = colorSpaces_;
|
||||
cameraTest->streamInfosV1_1.push_back(*cameraTest->streamInfoVideo);
|
||||
cameraTest->rc = cameraTest->streamOperator_V1_1->CreateStreams_V1_1(cameraTest->streamInfosV1_1);
|
||||
EXPECT_EQ(HDI::Camera::V1_0::NO_ERROR, cameraTest->rc);
|
||||
cameraTest->rc = cameraTest->streamOperator_V1_1->CommitStreams(
|
||||
OperationMode::NORMAL, cameraTest->abilityVec);
|
||||
static_cast<OHOS::HDI::Camera::V1_0::OperationMode>(OHOS::HDI::Camera::V1_1::OperationMode_V1_1::VIDEO),
|
||||
cameraTest->abilityVec);
|
||||
EXPECT_EQ(HDI::Camera::V1_0::NO_ERROR, cameraTest->rc);
|
||||
sleep(UT_SECOND_TIMES);
|
||||
|
||||
cameraTest->StartCapture(cameraTest->streamIdPreview, cameraTest->captureIdPreview, false, true);
|
||||
cameraTest->StartCapture(cameraTest->streamIdVideo, cameraTest->captureIdVideo, false, true);
|
||||
cameraTest->captureIds = {cameraTest->captureIdPreview, cameraTest->captureIdVideo};
|
||||
cameraTest->streamIds = {cameraTest->streamIdPreview, cameraTest->streamIdVideo};
|
||||
cameraTest->StopStream(cameraTest->captureIds, cameraTest->streamIds);
|
||||
cameraTest->streamInfosV1_1.clear();
|
||||
sleep(1);
|
||||
}
|
||||
}
|
||||
cameraTest->imageDataSaveSwitch = SWITCH_OFF;
|
||||
}
|
||||
|
||||
void SuperStubByColorSpaces(std::vector<int32_t> superStubColorSpaces, std::shared_ptr<OHOS::Camera::Test> cameraTest)
|
||||
@ -562,6 +585,7 @@ HWTEST_F(CameraHdiTestV1_2, SUB_Driver_Camera_Colorspace_0200, TestSize.Level1)
|
||||
std::vector<int32_t> captureColorSpaces;
|
||||
std::vector<int32_t> videoColorSpaces;
|
||||
std::vector<int32_t> superStubColorSpaces;
|
||||
std::vector<int32_t> previewColorSpaces;
|
||||
int32_t operatorMode = -2;
|
||||
for (size_t i = 0; i < entry.count - 1; i++) {
|
||||
if (operatorMode == -2 && entry.data.i32[i] == HDI::Camera::V1_2::OperationMode_V1_2::CAPTURE) {
|
||||
@ -577,7 +601,12 @@ HWTEST_F(CameraHdiTestV1_2, SUB_Driver_Camera_Colorspace_0200, TestSize.Level1)
|
||||
} else if (operatorMode == HDI::Camera::V1_2::OperationMode_V1_2::CAPTURE) {
|
||||
captureColorSpaces.push_back(entry.data.i32[i]);
|
||||
} else if (operatorMode == HDI::Camera::V1_2::OperationMode_V1_2::VIDEO) {
|
||||
if (std::find(cameraTest->previewColorSpaces_.begin(), cameraTest->previewColorSpaces_.end(),
|
||||
entry.data.i32[i]) != cameraTest->previewColorSpaces_.end()) {
|
||||
previewColorSpaces.push_back(entry.data.i32[i]);
|
||||
} else {
|
||||
videoColorSpaces.push_back(entry.data.i32[i]);
|
||||
}
|
||||
} else if (operatorMode == HDI::Camera::V1_2::OperationMode_V1_2::SUPER_STAB) {
|
||||
superStubColorSpaces.push_back(entry.data.i32[i]);
|
||||
} else if (operatorMode == -2 && entry.data.i32[i] > 0) {
|
||||
@ -585,7 +614,7 @@ HWTEST_F(CameraHdiTestV1_2, SUB_Driver_Camera_Colorspace_0200, TestSize.Level1)
|
||||
}
|
||||
}
|
||||
CaptureByColorSpaces(captureColorSpaces, cameraTest);
|
||||
VideoByColorSpaces(videoColorSpaces, cameraTest);
|
||||
VideoByColorSpaces(videoColorSpaces, previewColorSpaces, cameraTest);
|
||||
SuperStubByColorSpaces(superStubColorSpaces, cameraTest);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user