1fa7767c5Sopenharmony_ci/* 2fa7767c5Sopenharmony_ci * Copyright (C) 2024 Huawei Device Co., Ltd. 3fa7767c5Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4fa7767c5Sopenharmony_ci * you may not use this file except in compliance with the License. 5fa7767c5Sopenharmony_ci * You may obtain a copy of the License at 6fa7767c5Sopenharmony_ci * 7fa7767c5Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8fa7767c5Sopenharmony_ci * 9fa7767c5Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10fa7767c5Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11fa7767c5Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12fa7767c5Sopenharmony_ci * See the License for the specific language governing permissions and 13fa7767c5Sopenharmony_ci * limitations under the License. 14fa7767c5Sopenharmony_ci */ 15fa7767c5Sopenharmony_ci#include <iostream> 16fa7767c5Sopenharmony_ci#include <atomic> 17fa7767c5Sopenharmony_ci#include <fstream> 18fa7767c5Sopenharmony_ci#include <thread> 19fa7767c5Sopenharmony_ci#include <queue> 20fa7767c5Sopenharmony_ci#include <string> 21fa7767c5Sopenharmony_ci#include "gtest/gtest.h" 22fa7767c5Sopenharmony_ci#include "video_processing.h" 23fa7767c5Sopenharmony_ci#include "surface/native_buffer.h" 24fa7767c5Sopenharmony_ci#include "iconsumer_surface.h" 25fa7767c5Sopenharmony_ci#include "surface/window.h" 26fa7767c5Sopenharmony_ci#include "nocopyable.h" 27fa7767c5Sopenharmony_ciusing namespace std; 28fa7767c5Sopenharmony_ciusing namespace OHOS; 29fa7767c5Sopenharmony_ciusing namespace testing::ext; 30fa7767c5Sopenharmony_cinamespace { 31fa7767c5Sopenharmony_ciclass VpeVideoApiTest : public testing::Test { 32fa7767c5Sopenharmony_cipublic: 33fa7767c5Sopenharmony_ci // SetUpTestCase: Called before all test cases 34fa7767c5Sopenharmony_ci static void SetUpTestCase(void); 35fa7767c5Sopenharmony_ci // TearDownTestCase: Called after all test case 36fa7767c5Sopenharmony_ci static void TearDownTestCase(void); 37fa7767c5Sopenharmony_ci // SetUp: Called before each test cases 38fa7767c5Sopenharmony_ci void SetUp(void); 39fa7767c5Sopenharmony_ci // TearDown: Called after each test cases 40fa7767c5Sopenharmony_ci void TearDown(void); 41fa7767c5Sopenharmony_ci}; 42fa7767c5Sopenharmony_ci 43fa7767c5Sopenharmony_ciclass TestConsumerListener : public IBufferConsumerListener { 44fa7767c5Sopenharmony_cipublic: 45fa7767c5Sopenharmony_ci TestConsumerListener(sptr<Surface> cs, std::string_view name); 46fa7767c5Sopenharmony_ci ~TestConsumerListener(); 47fa7767c5Sopenharmony_ci void OnBufferAvailable() override; 48fa7767c5Sopenharmony_ci}; 49fa7767c5Sopenharmony_ci 50fa7767c5Sopenharmony_civoid VpeVideoApiTest::SetUpTestCase() {} 51fa7767c5Sopenharmony_civoid VpeVideoApiTest::TearDownTestCase() {} 52fa7767c5Sopenharmony_civoid VpeVideoApiTest::SetUp() {} 53fa7767c5Sopenharmony_civoid VpeVideoApiTest::TearDown() 54fa7767c5Sopenharmony_ci{ 55fa7767c5Sopenharmony_ci OH_VideoProcessing_DeinitializeEnvironment(); 56fa7767c5Sopenharmony_ci} 57fa7767c5Sopenharmony_ci 58fa7767c5Sopenharmony_ciTestConsumerListener::TestConsumerListener(sptr<Surface> cs, std::string_view name) {} 59fa7767c5Sopenharmony_ci 60fa7767c5Sopenharmony_ciTestConsumerListener::~TestConsumerListener() {} 61fa7767c5Sopenharmony_ci 62fa7767c5Sopenharmony_civoid TestConsumerListener::OnBufferAvailable() {} 63fa7767c5Sopenharmony_ci 64fa7767c5Sopenharmony_ciconst VideoProcessing_ColorSpaceInfo SRC_INFO = {OH_VIDEO_HDR_VIVID, 65fa7767c5Sopenharmony_ci OH_COLORSPACE_BT2020_HLG_LIMIT, 66fa7767c5Sopenharmony_ci NATIVEBUFFER_PIXEL_FMT_YCBCR_P010}; 67fa7767c5Sopenharmony_ciconst VideoProcessing_ColorSpaceInfo DST_INFO = {OH_VIDEO_HDR_VIVID, 68fa7767c5Sopenharmony_ci OH_COLORSPACE_BT2020_PQ_LIMIT, 69fa7767c5Sopenharmony_ci NATIVEBUFFER_PIXEL_FMT_YCBCR_P010}; 70fa7767c5Sopenharmony_ci 71fa7767c5Sopenharmony_ci} 72fa7767c5Sopenharmony_ci 73fa7767c5Sopenharmony_cinamespace { 74fa7767c5Sopenharmony_cistatic int32_t g_userValue = 1; 75fa7767c5Sopenharmony_cistatic int32_t g_Index = 1; 76fa7767c5Sopenharmony_ci 77fa7767c5Sopenharmony_cistatic void onErrorEmptyCallback(OH_VideoProcessing* videoProcessor, VideoProcessing_ErrorCode error, 78fa7767c5Sopenharmony_ci void* userData) 79fa7767c5Sopenharmony_ci{ 80fa7767c5Sopenharmony_ci //do nothing 81fa7767c5Sopenharmony_ci} 82fa7767c5Sopenharmony_ci 83fa7767c5Sopenharmony_cistatic void onErrorCallback(OH_VideoProcessing* videoProcessor, VideoProcessing_ErrorCode error, 84fa7767c5Sopenharmony_ci void* userData) 85fa7767c5Sopenharmony_ci{ 86fa7767c5Sopenharmony_ci cout << "onErrorCallback" << endl; 87fa7767c5Sopenharmony_ci} 88fa7767c5Sopenharmony_ci 89fa7767c5Sopenharmony_cistatic void onStateEmptyCallback(OH_VideoProcessing* videoProcessor, VideoProcessing_State state, 90fa7767c5Sopenharmony_ci void* userData) 91fa7767c5Sopenharmony_ci{ 92fa7767c5Sopenharmony_ci //do nothing 93fa7767c5Sopenharmony_ci} 94fa7767c5Sopenharmony_ci 95fa7767c5Sopenharmony_cistatic void onStateCallback(OH_VideoProcessing* videoProcessor, VideoProcessing_State state, 96fa7767c5Sopenharmony_ci void* userData) 97fa7767c5Sopenharmony_ci{ 98fa7767c5Sopenharmony_ci cout << "onStateCallback" << endl; 99fa7767c5Sopenharmony_ci} 100fa7767c5Sopenharmony_ci 101fa7767c5Sopenharmony_ci 102fa7767c5Sopenharmony_cistatic void OnNewOutputBufferEmptyCallback(OH_VideoProcessing* videoProcessor, uint32_t index, 103fa7767c5Sopenharmony_ci void* userData) 104fa7767c5Sopenharmony_ci{ 105fa7767c5Sopenharmony_ci //do nothing 106fa7767c5Sopenharmony_ci} 107fa7767c5Sopenharmony_ci 108fa7767c5Sopenharmony_cistatic void OnNewOutputBufferCallback(OH_VideoProcessing* videoProcessor, uint32_t index, 109fa7767c5Sopenharmony_ci void* userData) 110fa7767c5Sopenharmony_ci{ 111fa7767c5Sopenharmony_ci cout << "OnNewOutputBufferCallback" << endl; 112fa7767c5Sopenharmony_ci} 113fa7767c5Sopenharmony_ci 114fa7767c5Sopenharmony_ci/** 115fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0010 116fa7767c5Sopenharmony_ci * @tc.name : first call OH_VideoProcessing_InitializeEnvironment 117fa7767c5Sopenharmony_ci * @tc.desc : function test 118fa7767c5Sopenharmony_ci */ 119fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0010, TestSize.Level0) 120fa7767c5Sopenharmony_ci{ 121fa7767c5Sopenharmony_ci VideoProcessing_ErrorCode ret = OH_VideoProcessing_InitializeEnvironment(); 122fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_SUCCESS); 123fa7767c5Sopenharmony_ci OH_VideoProcessing_DeinitializeEnvironment(); 124fa7767c5Sopenharmony_ci} 125fa7767c5Sopenharmony_ci 126fa7767c5Sopenharmony_ci/** 127fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0020 128fa7767c5Sopenharmony_ci * @tc.name : first call OH_VideoProcessing_DeinitializeEnvironment 129fa7767c5Sopenharmony_ci * @tc.desc : function test 130fa7767c5Sopenharmony_ci */ 131fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0020, TestSize.Level0) 132fa7767c5Sopenharmony_ci{ 133fa7767c5Sopenharmony_ci VideoProcessing_ErrorCode ret = OH_VideoProcessing_DeinitializeEnvironment(); 134fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_ERROR_OPERATION_NOT_PERMITTED); 135fa7767c5Sopenharmony_ci} 136fa7767c5Sopenharmony_ci 137fa7767c5Sopenharmony_ci/** 138fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0030 139fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessing_DeinitializeEnvironment after initialize 140fa7767c5Sopenharmony_ci * @tc.desc : function test 141fa7767c5Sopenharmony_ci */ 142fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0030, TestSize.Level0) 143fa7767c5Sopenharmony_ci{ 144fa7767c5Sopenharmony_ci VideoProcessing_ErrorCode ret = OH_VideoProcessing_InitializeEnvironment(); 145fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_SUCCESS); 146fa7767c5Sopenharmony_ci ret = OH_VideoProcessing_DeinitializeEnvironment(); 147fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_SUCCESS); 148fa7767c5Sopenharmony_ci} 149fa7767c5Sopenharmony_ci 150fa7767c5Sopenharmony_ci/** 151fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0040 152fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessing_IsColorSpaceConversionSupported with nullptr,nullptr 153fa7767c5Sopenharmony_ci * @tc.desc : function test 154fa7767c5Sopenharmony_ci */ 155fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0040, TestSize.Level0) 156fa7767c5Sopenharmony_ci{ 157fa7767c5Sopenharmony_ci OH_VideoProcessing_InitializeEnvironment(); 158fa7767c5Sopenharmony_ci bool ret = OH_VideoProcessing_IsColorSpaceConversionSupported(nullptr, nullptr); 159fa7767c5Sopenharmony_ci ASSERT_FALSE(ret); 160fa7767c5Sopenharmony_ci OH_VideoProcessing_DeinitializeEnvironment(); 161fa7767c5Sopenharmony_ci} 162fa7767c5Sopenharmony_ci 163fa7767c5Sopenharmony_ci/** 164fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0050 165fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessing_IsColorSpaceConversionSupported 166fa7767c5Sopenharmony_ci * @tc.desc : function test 167fa7767c5Sopenharmony_ci */ 168fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0050, TestSize.Level0) 169fa7767c5Sopenharmony_ci{ 170fa7767c5Sopenharmony_ci OH_VideoProcessing_InitializeEnvironment(); 171fa7767c5Sopenharmony_ci bool ret = OH_VideoProcessing_IsColorSpaceConversionSupported(&SRC_INFO, nullptr); 172fa7767c5Sopenharmony_ci ASSERT_FALSE(ret); 173fa7767c5Sopenharmony_ci} 174fa7767c5Sopenharmony_ci 175fa7767c5Sopenharmony_ci/** 176fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0060 177fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessing_IsColorSpaceConversionSupported 178fa7767c5Sopenharmony_ci * @tc.desc : function test 179fa7767c5Sopenharmony_ci */ 180fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0060, TestSize.Level0) 181fa7767c5Sopenharmony_ci{ 182fa7767c5Sopenharmony_ci OH_VideoProcessing_InitializeEnvironment(); 183fa7767c5Sopenharmony_ci bool ret = OH_VideoProcessing_IsColorSpaceConversionSupported(nullptr, &DST_INFO); 184fa7767c5Sopenharmony_ci ASSERT_FALSE(ret); 185fa7767c5Sopenharmony_ci} 186fa7767c5Sopenharmony_ci 187fa7767c5Sopenharmony_ci/** 188fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0070 189fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessing_IsColorSpaceConversionSupported 190fa7767c5Sopenharmony_ci * @tc.desc : function test 191fa7767c5Sopenharmony_ci */ 192fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0070, TestSize.Level0) 193fa7767c5Sopenharmony_ci{ 194fa7767c5Sopenharmony_ci OH_VideoProcessing_InitializeEnvironment(); 195fa7767c5Sopenharmony_ci bool ret = OH_VideoProcessing_IsColorSpaceConversionSupported(&SRC_INFO, &DST_INFO); 196fa7767c5Sopenharmony_ci if (!access("/system/lib64/", 0)) { 197fa7767c5Sopenharmony_ci ASSERT_TRUE(ret); 198fa7767c5Sopenharmony_ci } else { 199fa7767c5Sopenharmony_ci ASSERT_FALSE(ret); 200fa7767c5Sopenharmony_ci } 201fa7767c5Sopenharmony_ci} 202fa7767c5Sopenharmony_ci 203fa7767c5Sopenharmony_ci/** 204fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0080 205fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessing_IsMetadataGenerationSupported 206fa7767c5Sopenharmony_ci * @tc.desc : function test 207fa7767c5Sopenharmony_ci */ 208fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0080, TestSize.Level0) 209fa7767c5Sopenharmony_ci{ 210fa7767c5Sopenharmony_ci OH_VideoProcessing_InitializeEnvironment(); 211fa7767c5Sopenharmony_ci bool ret = OH_VideoProcessing_IsMetadataGenerationSupported(nullptr); 212fa7767c5Sopenharmony_ci ASSERT_FALSE(ret); 213fa7767c5Sopenharmony_ci} 214fa7767c5Sopenharmony_ci 215fa7767c5Sopenharmony_ci/** 216fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0090 217fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessing_IsMetadataGenerationSupported 218fa7767c5Sopenharmony_ci * @tc.desc : function test 219fa7767c5Sopenharmony_ci */ 220fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0090, TestSize.Level0) 221fa7767c5Sopenharmony_ci{ 222fa7767c5Sopenharmony_ci OH_VideoProcessing_InitializeEnvironment(); 223fa7767c5Sopenharmony_ci bool ret = OH_VideoProcessing_IsMetadataGenerationSupported(&SRC_INFO); 224fa7767c5Sopenharmony_ci if (!access("/system/lib64/", 0)) { 225fa7767c5Sopenharmony_ci ASSERT_TRUE(ret); 226fa7767c5Sopenharmony_ci } else { 227fa7767c5Sopenharmony_ci ASSERT_FALSE(ret); 228fa7767c5Sopenharmony_ci } 229fa7767c5Sopenharmony_ci} 230fa7767c5Sopenharmony_ci 231fa7767c5Sopenharmony_ci/** 232fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0100 233fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessing_Create 234fa7767c5Sopenharmony_ci * @tc.desc : function test 235fa7767c5Sopenharmony_ci */ 236fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0100, TestSize.Level0) 237fa7767c5Sopenharmony_ci{ 238fa7767c5Sopenharmony_ci OH_VideoProcessing_InitializeEnvironment(); 239fa7767c5Sopenharmony_ci OH_VideoProcessing** videoProcessor = nullptr; 240fa7767c5Sopenharmony_ci VideoProcessing_ErrorCode ret = OH_VideoProcessing_Create(videoProcessor, INT_MAX); 241fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_ERROR_INVALID_INSTANCE); 242fa7767c5Sopenharmony_ci} 243fa7767c5Sopenharmony_ci 244fa7767c5Sopenharmony_ci/** 245fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0110 246fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessing_Create 247fa7767c5Sopenharmony_ci * @tc.desc : function test 248fa7767c5Sopenharmony_ci */ 249fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0110, TestSize.Level0) 250fa7767c5Sopenharmony_ci{ 251fa7767c5Sopenharmony_ci OH_VideoProcessing_InitializeEnvironment(); 252fa7767c5Sopenharmony_ci OH_VideoProcessing** videoProcessor = nullptr; 253fa7767c5Sopenharmony_ci VideoProcessing_ErrorCode ret = OH_VideoProcessing_Create(videoProcessor, 254fa7767c5Sopenharmony_ci VIDEO_PROCESSING_TYPE_METADATA_GENERATION); 255fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_ERROR_INVALID_INSTANCE); 256fa7767c5Sopenharmony_ci} 257fa7767c5Sopenharmony_ci 258fa7767c5Sopenharmony_ci/** 259fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0120 260fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessing_Create 261fa7767c5Sopenharmony_ci * @tc.desc : function test 262fa7767c5Sopenharmony_ci */ 263fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0120, TestSize.Level0) 264fa7767c5Sopenharmony_ci{ 265fa7767c5Sopenharmony_ci OH_VideoProcessing_InitializeEnvironment(); 266fa7767c5Sopenharmony_ci OH_VideoProcessing* videoProcessor = nullptr; 267fa7767c5Sopenharmony_ci VideoProcessing_ErrorCode ret = OH_VideoProcessing_Create(&videoProcessor, INT_MAX); 268fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_ERROR_INVALID_PARAMETER); 269fa7767c5Sopenharmony_ci OH_VideoProcessing_Destroy(videoProcessor); 270fa7767c5Sopenharmony_ci} 271fa7767c5Sopenharmony_ci 272fa7767c5Sopenharmony_ci/** 273fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0130 274fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessing_Create 275fa7767c5Sopenharmony_ci * @tc.desc : function test 276fa7767c5Sopenharmony_ci */ 277fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0130, TestSize.Level0) 278fa7767c5Sopenharmony_ci{ 279fa7767c5Sopenharmony_ci OH_VideoProcessing_InitializeEnvironment(); 280fa7767c5Sopenharmony_ci OH_VideoProcessing* videoProcessor = nullptr; 281fa7767c5Sopenharmony_ci VideoProcessing_ErrorCode ret = OH_VideoProcessing_Create(&videoProcessor, 282fa7767c5Sopenharmony_ci VIDEO_PROCESSING_TYPE_METADATA_GENERATION); 283fa7767c5Sopenharmony_ci if (!access("/system/lib64/", 0)) { 284fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_SUCCESS); 285fa7767c5Sopenharmony_ci OH_VideoProcessing_Destroy(videoProcessor); 286fa7767c5Sopenharmony_ci } else { 287fa7767c5Sopenharmony_ci ASSERT_NE(ret, VIDEO_PROCESSING_SUCCESS); 288fa7767c5Sopenharmony_ci } 289fa7767c5Sopenharmony_ci} 290fa7767c5Sopenharmony_ci 291fa7767c5Sopenharmony_ci/** 292fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0140 293fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessing_Destroy 294fa7767c5Sopenharmony_ci * @tc.desc : function test 295fa7767c5Sopenharmony_ci */ 296fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0140, TestSize.Level0) 297fa7767c5Sopenharmony_ci{ 298fa7767c5Sopenharmony_ci OH_VideoProcessing_InitializeEnvironment(); 299fa7767c5Sopenharmony_ci VideoProcessing_ErrorCode ret = OH_VideoProcessing_Destroy(nullptr); 300fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_ERROR_INVALID_INSTANCE); 301fa7767c5Sopenharmony_ci} 302fa7767c5Sopenharmony_ci 303fa7767c5Sopenharmony_ci/** 304fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0150 305fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessing_Destroy 306fa7767c5Sopenharmony_ci * @tc.desc : function test 307fa7767c5Sopenharmony_ci */ 308fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0150, TestSize.Level0) 309fa7767c5Sopenharmony_ci{ 310fa7767c5Sopenharmony_ci OH_VideoProcessing_InitializeEnvironment(); 311fa7767c5Sopenharmony_ci OH_VideoProcessing* videoProcessor = nullptr; 312fa7767c5Sopenharmony_ci VideoProcessing_ErrorCode ret = OH_VideoProcessing_Create(&videoProcessor, 313fa7767c5Sopenharmony_ci VIDEO_PROCESSING_TYPE_METADATA_GENERATION); 314fa7767c5Sopenharmony_ci if (!access("/system/lib64/", 0)) { 315fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_SUCCESS); 316fa7767c5Sopenharmony_ci ret = OH_VideoProcessing_Destroy(videoProcessor); 317fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_SUCCESS); 318fa7767c5Sopenharmony_ci } else { 319fa7767c5Sopenharmony_ci ASSERT_NE(ret, VIDEO_PROCESSING_SUCCESS); 320fa7767c5Sopenharmony_ci } 321fa7767c5Sopenharmony_ci} 322fa7767c5Sopenharmony_ci 323fa7767c5Sopenharmony_ci/** 324fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0160 325fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessing_RegisterCallback 326fa7767c5Sopenharmony_ci * @tc.desc : function test 327fa7767c5Sopenharmony_ci */ 328fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0160, TestSize.Level0) 329fa7767c5Sopenharmony_ci{ 330fa7767c5Sopenharmony_ci OH_VideoProcessing_InitializeEnvironment(); 331fa7767c5Sopenharmony_ci VideoProcessing_ErrorCode ret = OH_VideoProcessing_RegisterCallback(nullptr, nullptr, nullptr); 332fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_ERROR_INVALID_INSTANCE); 333fa7767c5Sopenharmony_ci} 334fa7767c5Sopenharmony_ci 335fa7767c5Sopenharmony_ci/** 336fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0170 337fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessing_RegisterCallback 338fa7767c5Sopenharmony_ci * @tc.desc : function test 339fa7767c5Sopenharmony_ci */ 340fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0170, TestSize.Level0) 341fa7767c5Sopenharmony_ci{ 342fa7767c5Sopenharmony_ci OH_VideoProcessing_InitializeEnvironment(); 343fa7767c5Sopenharmony_ci VideoProcessing_Callback* callback = nullptr; 344fa7767c5Sopenharmony_ci VideoProcessing_ErrorCode ret = OH_VideoProcessingCallback_Create(&callback); 345fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_SUCCESS); 346fa7767c5Sopenharmony_ci ret = OH_VideoProcessing_RegisterCallback(nullptr, callback, nullptr); 347fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_ERROR_INVALID_INSTANCE); 348fa7767c5Sopenharmony_ci OH_VideoProcessingCallback_Destroy(callback); 349fa7767c5Sopenharmony_ci} 350fa7767c5Sopenharmony_ci 351fa7767c5Sopenharmony_ci/** 352fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0180 353fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessing_RegisterCallback 354fa7767c5Sopenharmony_ci * @tc.desc : function test 355fa7767c5Sopenharmony_ci */ 356fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0180, TestSize.Level0) 357fa7767c5Sopenharmony_ci{ 358fa7767c5Sopenharmony_ci OH_VideoProcessing_InitializeEnvironment(); 359fa7767c5Sopenharmony_ci OH_VideoProcessing* videoProcessor = nullptr; 360fa7767c5Sopenharmony_ci VideoProcessing_ErrorCode ret = OH_VideoProcessing_Create(&videoProcessor, 361fa7767c5Sopenharmony_ci VIDEO_PROCESSING_TYPE_METADATA_GENERATION); 362fa7767c5Sopenharmony_ci if (!access("/system/lib64/", 0)) { 363fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_SUCCESS); 364fa7767c5Sopenharmony_ci ret = OH_VideoProcessing_RegisterCallback(videoProcessor, nullptr, nullptr); 365fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_ERROR_INVALID_PARAMETER); 366fa7767c5Sopenharmony_ci OH_VideoProcessing_Destroy(videoProcessor); 367fa7767c5Sopenharmony_ci } else { 368fa7767c5Sopenharmony_ci ASSERT_NE(ret, VIDEO_PROCESSING_SUCCESS); 369fa7767c5Sopenharmony_ci } 370fa7767c5Sopenharmony_ci} 371fa7767c5Sopenharmony_ci 372fa7767c5Sopenharmony_ci/** 373fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0190 374fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessing_RegisterCallback 375fa7767c5Sopenharmony_ci * @tc.desc : function test 376fa7767c5Sopenharmony_ci */ 377fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0190, TestSize.Level0) 378fa7767c5Sopenharmony_ci{ 379fa7767c5Sopenharmony_ci OH_VideoProcessing_InitializeEnvironment(); 380fa7767c5Sopenharmony_ci OH_VideoProcessing* videoProcessor = nullptr; 381fa7767c5Sopenharmony_ci VideoProcessing_ErrorCode ret = OH_VideoProcessing_Create(&videoProcessor, 382fa7767c5Sopenharmony_ci VIDEO_PROCESSING_TYPE_METADATA_GENERATION); 383fa7767c5Sopenharmony_ci if (!access("/system/lib64/", 0)) { 384fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_SUCCESS); 385fa7767c5Sopenharmony_ci VideoProcessing_Callback* callback = nullptr; 386fa7767c5Sopenharmony_ci ret = OH_VideoProcessingCallback_Create(&callback); 387fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_SUCCESS); 388fa7767c5Sopenharmony_ci ret = OH_VideoProcessingCallback_BindOnError(callback, onErrorEmptyCallback); 389fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_SUCCESS); 390fa7767c5Sopenharmony_ci ret = OH_VideoProcessing_RegisterCallback(videoProcessor, callback, nullptr); 391fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_SUCCESS); 392fa7767c5Sopenharmony_ci OH_VideoProcessing_Destroy(videoProcessor); 393fa7767c5Sopenharmony_ci OH_VideoProcessingCallback_Destroy(callback); 394fa7767c5Sopenharmony_ci } else { 395fa7767c5Sopenharmony_ci ASSERT_NE(ret, VIDEO_PROCESSING_SUCCESS); 396fa7767c5Sopenharmony_ci } 397fa7767c5Sopenharmony_ci} 398fa7767c5Sopenharmony_ci 399fa7767c5Sopenharmony_ci/** 400fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0200 401fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessing_RegisterCallback 402fa7767c5Sopenharmony_ci * @tc.desc : function test 403fa7767c5Sopenharmony_ci */ 404fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0200, TestSize.Level0) 405fa7767c5Sopenharmony_ci{ 406fa7767c5Sopenharmony_ci OH_VideoProcessing_InitializeEnvironment(); 407fa7767c5Sopenharmony_ci OH_VideoProcessing* videoProcessor = nullptr; 408fa7767c5Sopenharmony_ci VideoProcessing_ErrorCode ret = OH_VideoProcessing_Create(&videoProcessor, 409fa7767c5Sopenharmony_ci VIDEO_PROCESSING_TYPE_METADATA_GENERATION); 410fa7767c5Sopenharmony_ci if (!access("/system/lib64/", 0)) { 411fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_SUCCESS); 412fa7767c5Sopenharmony_ci VideoProcessing_Callback* callback = nullptr; 413fa7767c5Sopenharmony_ci ret = OH_VideoProcessingCallback_Create(&callback); 414fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_SUCCESS); 415fa7767c5Sopenharmony_ci ret = OH_VideoProcessing_RegisterCallback(videoProcessor, callback, nullptr); 416fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_ERROR_INVALID_VALUE); 417fa7767c5Sopenharmony_ci OH_VideoProcessing_Destroy(videoProcessor); 418fa7767c5Sopenharmony_ci OH_VideoProcessingCallback_Destroy(callback); 419fa7767c5Sopenharmony_ci } else { 420fa7767c5Sopenharmony_ci ASSERT_NE(ret, VIDEO_PROCESSING_SUCCESS); 421fa7767c5Sopenharmony_ci } 422fa7767c5Sopenharmony_ci} 423fa7767c5Sopenharmony_ci 424fa7767c5Sopenharmony_ci/** 425fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0210 426fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessing_RegisterCallback 427fa7767c5Sopenharmony_ci * @tc.desc : function test 428fa7767c5Sopenharmony_ci */ 429fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0210, TestSize.Level0) 430fa7767c5Sopenharmony_ci{ 431fa7767c5Sopenharmony_ci OH_VideoProcessing_InitializeEnvironment(); 432fa7767c5Sopenharmony_ci OH_VideoProcessing* videoProcessor = nullptr; 433fa7767c5Sopenharmony_ci VideoProcessing_ErrorCode ret = OH_VideoProcessing_Create(&videoProcessor, 434fa7767c5Sopenharmony_ci VIDEO_PROCESSING_TYPE_METADATA_GENERATION); 435fa7767c5Sopenharmony_ci if (!access("/system/lib64/", 0)) { 436fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_SUCCESS); 437fa7767c5Sopenharmony_ci VideoProcessing_Callback* callback = nullptr; 438fa7767c5Sopenharmony_ci ret = OH_VideoProcessingCallback_Create(&callback); 439fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_SUCCESS); 440fa7767c5Sopenharmony_ci void* userData = &g_userValue; 441fa7767c5Sopenharmony_ci if (!userData) { 442fa7767c5Sopenharmony_ci ret = OH_VideoProcessing_RegisterCallback(videoProcessor, callback, userData); 443fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_SUCCESS); 444fa7767c5Sopenharmony_ci } 445fa7767c5Sopenharmony_ci OH_VideoProcessing_Destroy(videoProcessor); 446fa7767c5Sopenharmony_ci OH_VideoProcessingCallback_Destroy(callback); 447fa7767c5Sopenharmony_ci } else { 448fa7767c5Sopenharmony_ci ASSERT_NE(ret, VIDEO_PROCESSING_SUCCESS); 449fa7767c5Sopenharmony_ci } 450fa7767c5Sopenharmony_ci} 451fa7767c5Sopenharmony_ci 452fa7767c5Sopenharmony_ci/** 453fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0220 454fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessing_SetSurface 455fa7767c5Sopenharmony_ci * @tc.desc : function test 456fa7767c5Sopenharmony_ci */ 457fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0220, TestSize.Level0) 458fa7767c5Sopenharmony_ci{ 459fa7767c5Sopenharmony_ci OH_VideoProcessing_InitializeEnvironment(); 460fa7767c5Sopenharmony_ci VideoProcessing_ErrorCode ret = OH_VideoProcessing_SetSurface(nullptr, nullptr); 461fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_ERROR_INVALID_INSTANCE); 462fa7767c5Sopenharmony_ci} 463fa7767c5Sopenharmony_ci 464fa7767c5Sopenharmony_ci/** 465fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0230 466fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessing_SetSurface 467fa7767c5Sopenharmony_ci * @tc.desc : function test 468fa7767c5Sopenharmony_ci */ 469fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0230, TestSize.Level0) 470fa7767c5Sopenharmony_ci{ 471fa7767c5Sopenharmony_ci OH_VideoProcessing_InitializeEnvironment(); 472fa7767c5Sopenharmony_ci sptr<Surface> cs = Surface::CreateSurfaceAsConsumer(); 473fa7767c5Sopenharmony_ci sptr<IBufferConsumerListener> listener = new TestConsumerListener( 474fa7767c5Sopenharmony_ci cs, "/data/test/media/out_320_240_10s.rgba"); 475fa7767c5Sopenharmony_ci cs->RegisterConsumerListener(listener); 476fa7767c5Sopenharmony_ci auto p = cs->GetProducer(); 477fa7767c5Sopenharmony_ci sptr<Surface> ps = Surface::CreateSurfaceAsProducer(p); 478fa7767c5Sopenharmony_ci OHNativeWindow *window = nullptr; 479fa7767c5Sopenharmony_ci window = CreateNativeWindowFromSurface(&ps); 480fa7767c5Sopenharmony_ci VideoProcessing_ErrorCode ret = OH_VideoProcessing_SetSurface(nullptr, window); 481fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_ERROR_INVALID_INSTANCE); 482fa7767c5Sopenharmony_ci OH_NativeWindow_DestroyNativeWindow(window); 483fa7767c5Sopenharmony_ci} 484fa7767c5Sopenharmony_ci 485fa7767c5Sopenharmony_ci/** 486fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0240 487fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessing_SetSurface 488fa7767c5Sopenharmony_ci * @tc.desc : function test 489fa7767c5Sopenharmony_ci */ 490fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0240, TestSize.Level0) 491fa7767c5Sopenharmony_ci{ 492fa7767c5Sopenharmony_ci OH_VideoProcessing_InitializeEnvironment(); 493fa7767c5Sopenharmony_ci OH_VideoProcessing* videoProcessor = nullptr; 494fa7767c5Sopenharmony_ci VideoProcessing_ErrorCode ret = OH_VideoProcessing_Create(&videoProcessor, 495fa7767c5Sopenharmony_ci VIDEO_PROCESSING_TYPE_METADATA_GENERATION); 496fa7767c5Sopenharmony_ci if (!access("/system/lib64/", 0)) { 497fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_SUCCESS); 498fa7767c5Sopenharmony_ci ret = OH_VideoProcessing_SetSurface(videoProcessor, nullptr); 499fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_ERROR_INVALID_PARAMETER); 500fa7767c5Sopenharmony_ci OH_VideoProcessing_Destroy(videoProcessor); 501fa7767c5Sopenharmony_ci } else { 502fa7767c5Sopenharmony_ci ASSERT_NE(ret, VIDEO_PROCESSING_SUCCESS); 503fa7767c5Sopenharmony_ci } 504fa7767c5Sopenharmony_ci} 505fa7767c5Sopenharmony_ci 506fa7767c5Sopenharmony_ci/** 507fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0250 508fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessing_SetSurface 509fa7767c5Sopenharmony_ci * @tc.desc : function test 510fa7767c5Sopenharmony_ci */ 511fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0250, TestSize.Level0) 512fa7767c5Sopenharmony_ci{ 513fa7767c5Sopenharmony_ci OH_VideoProcessing_InitializeEnvironment(); 514fa7767c5Sopenharmony_ci OH_VideoProcessing* videoProcessor = nullptr; 515fa7767c5Sopenharmony_ci VideoProcessing_ErrorCode ret = OH_VideoProcessing_Create(&videoProcessor, 516fa7767c5Sopenharmony_ci VIDEO_PROCESSING_TYPE_METADATA_GENERATION); 517fa7767c5Sopenharmony_ci if (!access("/system/lib64/", 0)) { 518fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_SUCCESS); 519fa7767c5Sopenharmony_ci sptr<Surface> cs = Surface::CreateSurfaceAsConsumer(); 520fa7767c5Sopenharmony_ci sptr<IBufferConsumerListener> listener = new TestConsumerListener( 521fa7767c5Sopenharmony_ci cs, "/data/test/media/out_320_240_10s.rgba"); 522fa7767c5Sopenharmony_ci cs->RegisterConsumerListener(listener); 523fa7767c5Sopenharmony_ci auto p = cs->GetProducer(); 524fa7767c5Sopenharmony_ci sptr<Surface> ps = Surface::CreateSurfaceAsProducer(p); 525fa7767c5Sopenharmony_ci OHNativeWindow *window = nullptr; 526fa7767c5Sopenharmony_ci window = CreateNativeWindowFromSurface(&ps); 527fa7767c5Sopenharmony_ci ret = OH_VideoProcessing_SetSurface(videoProcessor, window); 528fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_SUCCESS); 529fa7767c5Sopenharmony_ci OH_VideoProcessing_Destroy(videoProcessor); 530fa7767c5Sopenharmony_ci OH_NativeWindow_DestroyNativeWindow(window); 531fa7767c5Sopenharmony_ci } else { 532fa7767c5Sopenharmony_ci ASSERT_NE(ret, VIDEO_PROCESSING_SUCCESS); 533fa7767c5Sopenharmony_ci } 534fa7767c5Sopenharmony_ci} 535fa7767c5Sopenharmony_ci 536fa7767c5Sopenharmony_ci/** 537fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0260 538fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessing_GetSurface 539fa7767c5Sopenharmony_ci * @tc.desc : function test 540fa7767c5Sopenharmony_ci */ 541fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0260, TestSize.Level0) 542fa7767c5Sopenharmony_ci{ 543fa7767c5Sopenharmony_ci OH_VideoProcessing_InitializeEnvironment(); 544fa7767c5Sopenharmony_ci VideoProcessing_ErrorCode ret = OH_VideoProcessing_GetSurface(nullptr, nullptr); 545fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_ERROR_INVALID_INSTANCE); 546fa7767c5Sopenharmony_ci} 547fa7767c5Sopenharmony_ci 548fa7767c5Sopenharmony_ci/** 549fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0270 550fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessing_GetSurface 551fa7767c5Sopenharmony_ci * @tc.desc : function test 552fa7767c5Sopenharmony_ci */ 553fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0270, TestSize.Level0) 554fa7767c5Sopenharmony_ci{ 555fa7767c5Sopenharmony_ci OH_VideoProcessing_InitializeEnvironment(); 556fa7767c5Sopenharmony_ci sptr<Surface> cs = Surface::CreateSurfaceAsConsumer(); 557fa7767c5Sopenharmony_ci sptr<IBufferConsumerListener> listener = new TestConsumerListener( 558fa7767c5Sopenharmony_ci cs, "/data/test/media/out_320_240_10s.rgba"); 559fa7767c5Sopenharmony_ci cs->RegisterConsumerListener(listener); 560fa7767c5Sopenharmony_ci auto p = cs->GetProducer(); 561fa7767c5Sopenharmony_ci sptr<Surface> ps = Surface::CreateSurfaceAsProducer(p); 562fa7767c5Sopenharmony_ci OHNativeWindow *window = nullptr; 563fa7767c5Sopenharmony_ci window = CreateNativeWindowFromSurface(&ps); 564fa7767c5Sopenharmony_ci VideoProcessing_ErrorCode ret = OH_VideoProcessing_GetSurface(nullptr, &window); 565fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_ERROR_INVALID_INSTANCE); 566fa7767c5Sopenharmony_ci OH_NativeWindow_DestroyNativeWindow(window); 567fa7767c5Sopenharmony_ci} 568fa7767c5Sopenharmony_ci 569fa7767c5Sopenharmony_ci/** 570fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0280 571fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessing_GetSurface 572fa7767c5Sopenharmony_ci * @tc.desc : function test 573fa7767c5Sopenharmony_ci */ 574fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0280, TestSize.Level0) 575fa7767c5Sopenharmony_ci{ 576fa7767c5Sopenharmony_ci OH_VideoProcessing_InitializeEnvironment(); 577fa7767c5Sopenharmony_ci OH_VideoProcessing* videoProcessor = nullptr; 578fa7767c5Sopenharmony_ci VideoProcessing_ErrorCode ret = OH_VideoProcessing_Create(&videoProcessor, 579fa7767c5Sopenharmony_ci VIDEO_PROCESSING_TYPE_METADATA_GENERATION); 580fa7767c5Sopenharmony_ci if (!access("/system/lib64/", 0)) { 581fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_SUCCESS); 582fa7767c5Sopenharmony_ci ret = OH_VideoProcessing_GetSurface(videoProcessor, nullptr); 583fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_ERROR_INVALID_PARAMETER); 584fa7767c5Sopenharmony_ci OH_VideoProcessing_Destroy(videoProcessor); 585fa7767c5Sopenharmony_ci } else { 586fa7767c5Sopenharmony_ci ASSERT_NE(ret, VIDEO_PROCESSING_SUCCESS); 587fa7767c5Sopenharmony_ci } 588fa7767c5Sopenharmony_ci} 589fa7767c5Sopenharmony_ci 590fa7767c5Sopenharmony_ci/** 591fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0290 592fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessing_GetSurface 593fa7767c5Sopenharmony_ci * @tc.desc : function test 594fa7767c5Sopenharmony_ci */ 595fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0290, TestSize.Level0) 596fa7767c5Sopenharmony_ci{ 597fa7767c5Sopenharmony_ci OH_VideoProcessing_InitializeEnvironment(); 598fa7767c5Sopenharmony_ci OH_VideoProcessing* videoProcessor = nullptr; 599fa7767c5Sopenharmony_ci VideoProcessing_ErrorCode ret = OH_VideoProcessing_Create(&videoProcessor, 600fa7767c5Sopenharmony_ci VIDEO_PROCESSING_TYPE_METADATA_GENERATION); 601fa7767c5Sopenharmony_ci if (!access("/system/lib64/", 0)) { 602fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_SUCCESS); 603fa7767c5Sopenharmony_ci sptr<Surface> cs = Surface::CreateSurfaceAsConsumer(); 604fa7767c5Sopenharmony_ci sptr<IBufferConsumerListener> listener = new TestConsumerListener( 605fa7767c5Sopenharmony_ci cs, "/data/test/media/out_320_240_10s.rgba"); 606fa7767c5Sopenharmony_ci cs->RegisterConsumerListener(listener); 607fa7767c5Sopenharmony_ci auto p = cs->GetProducer(); 608fa7767c5Sopenharmony_ci sptr<Surface> ps = Surface::CreateSurfaceAsProducer(p); 609fa7767c5Sopenharmony_ci OHNativeWindow *window = nullptr; 610fa7767c5Sopenharmony_ci window = CreateNativeWindowFromSurface(&ps); 611fa7767c5Sopenharmony_ci ret = OH_VideoProcessing_GetSurface(videoProcessor, &window); 612fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_SUCCESS); 613fa7767c5Sopenharmony_ci OH_VideoProcessing_Destroy(videoProcessor); 614fa7767c5Sopenharmony_ci OH_NativeWindow_DestroyNativeWindow(window); 615fa7767c5Sopenharmony_ci } else { 616fa7767c5Sopenharmony_ci ASSERT_NE(ret, VIDEO_PROCESSING_SUCCESS); 617fa7767c5Sopenharmony_ci } 618fa7767c5Sopenharmony_ci} 619fa7767c5Sopenharmony_ci 620fa7767c5Sopenharmony_ci/** 621fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0300 622fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessing_Start 623fa7767c5Sopenharmony_ci * @tc.desc : function test 624fa7767c5Sopenharmony_ci */ 625fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0300, TestSize.Level0) 626fa7767c5Sopenharmony_ci{ 627fa7767c5Sopenharmony_ci OH_VideoProcessing_InitializeEnvironment(); 628fa7767c5Sopenharmony_ci VideoProcessing_ErrorCode ret = OH_VideoProcessing_Start(nullptr); 629fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_ERROR_INVALID_INSTANCE); 630fa7767c5Sopenharmony_ci} 631fa7767c5Sopenharmony_ci 632fa7767c5Sopenharmony_ci/** 633fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0310 634fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessing_Start 635fa7767c5Sopenharmony_ci * @tc.desc : function test 636fa7767c5Sopenharmony_ci */ 637fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0310, TestSize.Level0) 638fa7767c5Sopenharmony_ci{ 639fa7767c5Sopenharmony_ci OH_VideoProcessing_InitializeEnvironment(); 640fa7767c5Sopenharmony_ci OH_VideoProcessing* videoProcessor = nullptr; 641fa7767c5Sopenharmony_ci VideoProcessing_ErrorCode ret = OH_VideoProcessing_Create(&videoProcessor, 642fa7767c5Sopenharmony_ci VIDEO_PROCESSING_TYPE_METADATA_GENERATION); 643fa7767c5Sopenharmony_ci if (!access("/system/lib64/", 0)) { 644fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_SUCCESS); 645fa7767c5Sopenharmony_ci ret = OH_VideoProcessing_Start(videoProcessor); 646fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_ERROR_OPERATION_NOT_PERMITTED); 647fa7767c5Sopenharmony_ci OH_VideoProcessing_Destroy(videoProcessor); 648fa7767c5Sopenharmony_ci } else { 649fa7767c5Sopenharmony_ci ASSERT_NE(ret, VIDEO_PROCESSING_SUCCESS); 650fa7767c5Sopenharmony_ci } 651fa7767c5Sopenharmony_ci} 652fa7767c5Sopenharmony_ci 653fa7767c5Sopenharmony_ci/** 654fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0320 655fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessing_Start 656fa7767c5Sopenharmony_ci * @tc.desc : function test 657fa7767c5Sopenharmony_ci */ 658fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0320, TestSize.Level0) 659fa7767c5Sopenharmony_ci{ 660fa7767c5Sopenharmony_ci OH_VideoProcessing_InitializeEnvironment(); 661fa7767c5Sopenharmony_ci OH_VideoProcessing* videoProcessor = nullptr; 662fa7767c5Sopenharmony_ci VideoProcessing_ErrorCode ret = OH_VideoProcessing_Create(&videoProcessor, 663fa7767c5Sopenharmony_ci VIDEO_PROCESSING_TYPE_METADATA_GENERATION); 664fa7767c5Sopenharmony_ci if (!access("/system/lib64/", 0)) { 665fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_SUCCESS); 666fa7767c5Sopenharmony_ci sptr<Surface> cs = Surface::CreateSurfaceAsConsumer(); 667fa7767c5Sopenharmony_ci sptr<IBufferConsumerListener> listener = new TestConsumerListener( 668fa7767c5Sopenharmony_ci cs, "/data/test/media/out_320_240_10s.rgba"); 669fa7767c5Sopenharmony_ci cs->RegisterConsumerListener(listener); 670fa7767c5Sopenharmony_ci auto p = cs->GetProducer(); 671fa7767c5Sopenharmony_ci sptr<Surface> ps = Surface::CreateSurfaceAsProducer(p); 672fa7767c5Sopenharmony_ci OHNativeWindow *window = nullptr; 673fa7767c5Sopenharmony_ci window = CreateNativeWindowFromSurface(&ps); 674fa7767c5Sopenharmony_ci ret = OH_VideoProcessing_SetSurface(videoProcessor, window); 675fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_SUCCESS); 676fa7767c5Sopenharmony_ci ret = OH_VideoProcessing_Start(videoProcessor); 677fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_ERROR_OPERATION_NOT_PERMITTED); 678fa7767c5Sopenharmony_ci OH_VideoProcessing_Destroy(videoProcessor); 679fa7767c5Sopenharmony_ci OH_NativeWindow_DestroyNativeWindow(window); 680fa7767c5Sopenharmony_ci } else { 681fa7767c5Sopenharmony_ci ASSERT_NE(ret, VIDEO_PROCESSING_SUCCESS); 682fa7767c5Sopenharmony_ci } 683fa7767c5Sopenharmony_ci} 684fa7767c5Sopenharmony_ci 685fa7767c5Sopenharmony_ci/** 686fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0330 687fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessing_Stop 688fa7767c5Sopenharmony_ci * @tc.desc : function test 689fa7767c5Sopenharmony_ci */ 690fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0330, TestSize.Level0) 691fa7767c5Sopenharmony_ci{ 692fa7767c5Sopenharmony_ci OH_VideoProcessing_InitializeEnvironment(); 693fa7767c5Sopenharmony_ci VideoProcessing_ErrorCode ret = OH_VideoProcessing_Stop(nullptr); 694fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_ERROR_INVALID_INSTANCE); 695fa7767c5Sopenharmony_ci} 696fa7767c5Sopenharmony_ci 697fa7767c5Sopenharmony_ci/** 698fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0340 699fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessing_Stop 700fa7767c5Sopenharmony_ci * @tc.desc : function test 701fa7767c5Sopenharmony_ci */ 702fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0340, TestSize.Level0) 703fa7767c5Sopenharmony_ci{ 704fa7767c5Sopenharmony_ci OH_VideoProcessing_InitializeEnvironment(); 705fa7767c5Sopenharmony_ci OH_VideoProcessing* videoProcessor = nullptr; 706fa7767c5Sopenharmony_ci VideoProcessing_ErrorCode ret = OH_VideoProcessing_Create(&videoProcessor, 707fa7767c5Sopenharmony_ci VIDEO_PROCESSING_TYPE_METADATA_GENERATION); 708fa7767c5Sopenharmony_ci if (!access("/system/lib64/", 0)) { 709fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_SUCCESS); 710fa7767c5Sopenharmony_ci ret = OH_VideoProcessing_Stop(videoProcessor); 711fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_ERROR_OPERATION_NOT_PERMITTED); 712fa7767c5Sopenharmony_ci OH_VideoProcessing_Destroy(videoProcessor); 713fa7767c5Sopenharmony_ci } else { 714fa7767c5Sopenharmony_ci ASSERT_NE(ret, VIDEO_PROCESSING_SUCCESS); 715fa7767c5Sopenharmony_ci } 716fa7767c5Sopenharmony_ci} 717fa7767c5Sopenharmony_ci 718fa7767c5Sopenharmony_ci/** 719fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0350 720fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessing_Stop 721fa7767c5Sopenharmony_ci * @tc.desc : function test 722fa7767c5Sopenharmony_ci */ 723fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0350, TestSize.Level0) 724fa7767c5Sopenharmony_ci{ 725fa7767c5Sopenharmony_ci OH_VideoProcessing_InitializeEnvironment(); 726fa7767c5Sopenharmony_ci OH_VideoProcessing* videoProcessor = nullptr; 727fa7767c5Sopenharmony_ci VideoProcessing_ErrorCode ret = OH_VideoProcessing_Create(&videoProcessor, 728fa7767c5Sopenharmony_ci VIDEO_PROCESSING_TYPE_METADATA_GENERATION); 729fa7767c5Sopenharmony_ci if (!access("/system/lib64/", 0)) { 730fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_SUCCESS); 731fa7767c5Sopenharmony_ci sptr<Surface> cs = Surface::CreateSurfaceAsConsumer(); 732fa7767c5Sopenharmony_ci sptr<IBufferConsumerListener> listener = new TestConsumerListener( 733fa7767c5Sopenharmony_ci cs, "/data/test/media/out_320_240_10s.rgba"); 734fa7767c5Sopenharmony_ci cs->RegisterConsumerListener(listener); 735fa7767c5Sopenharmony_ci auto p = cs->GetProducer(); 736fa7767c5Sopenharmony_ci sptr<Surface> ps = Surface::CreateSurfaceAsProducer(p); 737fa7767c5Sopenharmony_ci OHNativeWindow *window = nullptr; 738fa7767c5Sopenharmony_ci window = CreateNativeWindowFromSurface(&ps); 739fa7767c5Sopenharmony_ci ret = OH_VideoProcessing_SetSurface(videoProcessor, window); 740fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_SUCCESS); 741fa7767c5Sopenharmony_ci OHNativeWindow *outwindow = nullptr; 742fa7767c5Sopenharmony_ci ret = OH_VideoProcessing_GetSurface(videoProcessor, &outwindow); 743fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_SUCCESS); 744fa7767c5Sopenharmony_ci ret = OH_VideoProcessing_Start(videoProcessor); 745fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_ERROR_OPERATION_NOT_PERMITTED); 746fa7767c5Sopenharmony_ci ret = OH_VideoProcessing_Stop(videoProcessor); 747fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_ERROR_OPERATION_NOT_PERMITTED); 748fa7767c5Sopenharmony_ci OH_VideoProcessing_Destroy(videoProcessor); 749fa7767c5Sopenharmony_ci OH_NativeWindow_DestroyNativeWindow(window); 750fa7767c5Sopenharmony_ci } else { 751fa7767c5Sopenharmony_ci ASSERT_NE(ret, VIDEO_PROCESSING_SUCCESS); 752fa7767c5Sopenharmony_ci } 753fa7767c5Sopenharmony_ci} 754fa7767c5Sopenharmony_ci 755fa7767c5Sopenharmony_ci/** 756fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0360 757fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessing_RenderOutputBuffer 758fa7767c5Sopenharmony_ci * @tc.desc : function test 759fa7767c5Sopenharmony_ci */ 760fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0360, TestSize.Level0) 761fa7767c5Sopenharmony_ci{ 762fa7767c5Sopenharmony_ci OH_VideoProcessing_InitializeEnvironment(); 763fa7767c5Sopenharmony_ci VideoProcessing_ErrorCode ret = OH_VideoProcessing_RenderOutputBuffer(nullptr, g_Index); 764fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_ERROR_INVALID_INSTANCE); 765fa7767c5Sopenharmony_ci} 766fa7767c5Sopenharmony_ci 767fa7767c5Sopenharmony_ci/** 768fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0370 769fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessing_RenderOutputBuffer 770fa7767c5Sopenharmony_ci * @tc.desc : function test 771fa7767c5Sopenharmony_ci */ 772fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0370, TestSize.Level0) 773fa7767c5Sopenharmony_ci{ 774fa7767c5Sopenharmony_ci OH_VideoProcessing_InitializeEnvironment(); 775fa7767c5Sopenharmony_ci OH_VideoProcessing* videoProcessor = nullptr; 776fa7767c5Sopenharmony_ci VideoProcessing_ErrorCode ret = OH_VideoProcessing_Create(&videoProcessor, 777fa7767c5Sopenharmony_ci VIDEO_PROCESSING_TYPE_METADATA_GENERATION); 778fa7767c5Sopenharmony_ci if (!access("/system/lib64/", 0)) { 779fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_SUCCESS); 780fa7767c5Sopenharmony_ci ret = OH_VideoProcessing_RenderOutputBuffer(videoProcessor, INT_MAX); 781fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_ERROR_OPERATION_NOT_PERMITTED); 782fa7767c5Sopenharmony_ci OH_VideoProcessing_Destroy(videoProcessor); 783fa7767c5Sopenharmony_ci } else { 784fa7767c5Sopenharmony_ci ASSERT_NE(ret, VIDEO_PROCESSING_SUCCESS); 785fa7767c5Sopenharmony_ci } 786fa7767c5Sopenharmony_ci} 787fa7767c5Sopenharmony_ci 788fa7767c5Sopenharmony_ci/** 789fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0380 790fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessingCallback_Create 791fa7767c5Sopenharmony_ci * @tc.desc : function test 792fa7767c5Sopenharmony_ci */ 793fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0380, TestSize.Level0) 794fa7767c5Sopenharmony_ci{ 795fa7767c5Sopenharmony_ci OH_VideoProcessing_InitializeEnvironment(); 796fa7767c5Sopenharmony_ci VideoProcessing_ErrorCode ret = OH_VideoProcessingCallback_Create(nullptr); 797fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_ERROR_INVALID_PARAMETER); 798fa7767c5Sopenharmony_ci} 799fa7767c5Sopenharmony_ci 800fa7767c5Sopenharmony_ci/** 801fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0390 802fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessingCallback_Create 803fa7767c5Sopenharmony_ci * @tc.desc : function test 804fa7767c5Sopenharmony_ci */ 805fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0390, TestSize.Level0) 806fa7767c5Sopenharmony_ci{ 807fa7767c5Sopenharmony_ci OH_VideoProcessing_InitializeEnvironment(); 808fa7767c5Sopenharmony_ci VideoProcessing_Callback* callback = nullptr; 809fa7767c5Sopenharmony_ci VideoProcessing_ErrorCode ret = OH_VideoProcessingCallback_Create(&callback); 810fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_SUCCESS); 811fa7767c5Sopenharmony_ci OH_VideoProcessingCallback_Destroy(callback); 812fa7767c5Sopenharmony_ci} 813fa7767c5Sopenharmony_ci 814fa7767c5Sopenharmony_ci/** 815fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0400 816fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessingCallback_Destroy 817fa7767c5Sopenharmony_ci * @tc.desc : function test 818fa7767c5Sopenharmony_ci */ 819fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0400, TestSize.Level0) 820fa7767c5Sopenharmony_ci{ 821fa7767c5Sopenharmony_ci OH_VideoProcessing_InitializeEnvironment(); 822fa7767c5Sopenharmony_ci VideoProcessing_ErrorCode ret = OH_VideoProcessingCallback_Destroy(nullptr); 823fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_ERROR_INVALID_PARAMETER); 824fa7767c5Sopenharmony_ci} 825fa7767c5Sopenharmony_ci 826fa7767c5Sopenharmony_ci/** 827fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0410 828fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessingCallback_Destroy 829fa7767c5Sopenharmony_ci * @tc.desc : function test 830fa7767c5Sopenharmony_ci */ 831fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0410, TestSize.Level0) 832fa7767c5Sopenharmony_ci{ 833fa7767c5Sopenharmony_ci OH_VideoProcessing_InitializeEnvironment(); 834fa7767c5Sopenharmony_ci VideoProcessing_Callback* callback = nullptr; 835fa7767c5Sopenharmony_ci VideoProcessing_ErrorCode ret = OH_VideoProcessingCallback_Create(&callback); 836fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_SUCCESS); 837fa7767c5Sopenharmony_ci ret = OH_VideoProcessingCallback_Destroy(callback); 838fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_SUCCESS); 839fa7767c5Sopenharmony_ci} 840fa7767c5Sopenharmony_ci 841fa7767c5Sopenharmony_ci/** 842fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0420 843fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessingCallback_BindOnError 844fa7767c5Sopenharmony_ci * @tc.desc : function test 845fa7767c5Sopenharmony_ci */ 846fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0420, TestSize.Level0) 847fa7767c5Sopenharmony_ci{ 848fa7767c5Sopenharmony_ci OH_VideoProcessing_InitializeEnvironment(); 849fa7767c5Sopenharmony_ci VideoProcessing_ErrorCode ret = OH_VideoProcessingCallback_BindOnError( 850fa7767c5Sopenharmony_ci nullptr, onErrorEmptyCallback); 851fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_ERROR_INVALID_PARAMETER); 852fa7767c5Sopenharmony_ci} 853fa7767c5Sopenharmony_ci 854fa7767c5Sopenharmony_ci/** 855fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0430 856fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessingCallback_BindOnError 857fa7767c5Sopenharmony_ci * @tc.desc : function test 858fa7767c5Sopenharmony_ci */ 859fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0430, TestSize.Level0) 860fa7767c5Sopenharmony_ci{ 861fa7767c5Sopenharmony_ci OH_VideoProcessing_InitializeEnvironment(); 862fa7767c5Sopenharmony_ci VideoProcessing_Callback* callback = nullptr; 863fa7767c5Sopenharmony_ci VideoProcessing_ErrorCode ret = OH_VideoProcessingCallback_Create(&callback); 864fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_SUCCESS); 865fa7767c5Sopenharmony_ci ret = OH_VideoProcessingCallback_BindOnError( 866fa7767c5Sopenharmony_ci callback, onErrorEmptyCallback); 867fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_SUCCESS); 868fa7767c5Sopenharmony_ci OH_VideoProcessingCallback_Destroy(callback); 869fa7767c5Sopenharmony_ci} 870fa7767c5Sopenharmony_ci 871fa7767c5Sopenharmony_ci/** 872fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0440 873fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessingCallback_BindOnError 874fa7767c5Sopenharmony_ci * @tc.desc : function test 875fa7767c5Sopenharmony_ci */ 876fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0440, TestSize.Level0) 877fa7767c5Sopenharmony_ci{ 878fa7767c5Sopenharmony_ci OH_VideoProcessing_InitializeEnvironment(); 879fa7767c5Sopenharmony_ci VideoProcessing_ErrorCode ret = OH_VideoProcessingCallback_BindOnError( 880fa7767c5Sopenharmony_ci nullptr, onErrorCallback); 881fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_ERROR_INVALID_PARAMETER); 882fa7767c5Sopenharmony_ci} 883fa7767c5Sopenharmony_ci 884fa7767c5Sopenharmony_ci/** 885fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0450 886fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessingCallback_BindOnError 887fa7767c5Sopenharmony_ci * @tc.desc : function test 888fa7767c5Sopenharmony_ci */ 889fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0450, TestSize.Level0) 890fa7767c5Sopenharmony_ci{ 891fa7767c5Sopenharmony_ci OH_VideoProcessing_InitializeEnvironment(); 892fa7767c5Sopenharmony_ci VideoProcessing_Callback* callback = nullptr; 893fa7767c5Sopenharmony_ci VideoProcessing_ErrorCode ret = OH_VideoProcessingCallback_Create(&callback); 894fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_SUCCESS); 895fa7767c5Sopenharmony_ci ret = OH_VideoProcessingCallback_BindOnError(callback, onErrorCallback); 896fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_SUCCESS); 897fa7767c5Sopenharmony_ci OH_VideoProcessingCallback_Destroy(callback); 898fa7767c5Sopenharmony_ci} 899fa7767c5Sopenharmony_ci 900fa7767c5Sopenharmony_ci/** 901fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0460 902fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessingCallback_BindOnState 903fa7767c5Sopenharmony_ci * @tc.desc : function test 904fa7767c5Sopenharmony_ci */ 905fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0460, TestSize.Level0) 906fa7767c5Sopenharmony_ci{ 907fa7767c5Sopenharmony_ci OH_VideoProcessing_InitializeEnvironment(); 908fa7767c5Sopenharmony_ci VideoProcessing_ErrorCode ret = OH_VideoProcessingCallback_BindOnState( 909fa7767c5Sopenharmony_ci nullptr, onStateEmptyCallback); 910fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_ERROR_INVALID_PARAMETER); 911fa7767c5Sopenharmony_ci} 912fa7767c5Sopenharmony_ci 913fa7767c5Sopenharmony_ci/** 914fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0470 915fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessingCallback_BindOnState 916fa7767c5Sopenharmony_ci * @tc.desc : function test 917fa7767c5Sopenharmony_ci */ 918fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0470, TestSize.Level0) 919fa7767c5Sopenharmony_ci{ 920fa7767c5Sopenharmony_ci OH_VideoProcessing_InitializeEnvironment(); 921fa7767c5Sopenharmony_ci VideoProcessing_Callback* callback = nullptr; 922fa7767c5Sopenharmony_ci VideoProcessing_ErrorCode ret = OH_VideoProcessingCallback_Create(&callback); 923fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_SUCCESS); 924fa7767c5Sopenharmony_ci ret = OH_VideoProcessingCallback_BindOnState(callback, onStateEmptyCallback); 925fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_SUCCESS); 926fa7767c5Sopenharmony_ci OH_VideoProcessingCallback_Destroy(callback); 927fa7767c5Sopenharmony_ci} 928fa7767c5Sopenharmony_ci 929fa7767c5Sopenharmony_ci/** 930fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0480 931fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessingCallback_BindOnState 932fa7767c5Sopenharmony_ci * @tc.desc : function test 933fa7767c5Sopenharmony_ci */ 934fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0480, TestSize.Level0) 935fa7767c5Sopenharmony_ci{ 936fa7767c5Sopenharmony_ci OH_VideoProcessing_InitializeEnvironment(); 937fa7767c5Sopenharmony_ci VideoProcessing_ErrorCode ret = OH_VideoProcessingCallback_BindOnState(nullptr, onStateCallback); 938fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_ERROR_INVALID_PARAMETER); 939fa7767c5Sopenharmony_ci} 940fa7767c5Sopenharmony_ci 941fa7767c5Sopenharmony_ci/** 942fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0490 943fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessingCallback_BindOnState 944fa7767c5Sopenharmony_ci * @tc.desc : function test 945fa7767c5Sopenharmony_ci */ 946fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0490, TestSize.Level0) 947fa7767c5Sopenharmony_ci{ 948fa7767c5Sopenharmony_ci OH_VideoProcessing_InitializeEnvironment(); 949fa7767c5Sopenharmony_ci VideoProcessing_Callback* callback = nullptr; 950fa7767c5Sopenharmony_ci VideoProcessing_ErrorCode ret = OH_VideoProcessingCallback_Create(&callback); 951fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_SUCCESS); 952fa7767c5Sopenharmony_ci ret = OH_VideoProcessingCallback_BindOnState(callback, onStateCallback); 953fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_SUCCESS); 954fa7767c5Sopenharmony_ci OH_VideoProcessingCallback_Destroy(callback); 955fa7767c5Sopenharmony_ci} 956fa7767c5Sopenharmony_ci 957fa7767c5Sopenharmony_ci/** 958fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0500 959fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessingCallback_BindOnNewOutputBuffer 960fa7767c5Sopenharmony_ci * @tc.desc : function test 961fa7767c5Sopenharmony_ci */ 962fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0500, TestSize.Level0) 963fa7767c5Sopenharmony_ci{ 964fa7767c5Sopenharmony_ci OH_VideoProcessing_InitializeEnvironment(); 965fa7767c5Sopenharmony_ci VideoProcessing_ErrorCode ret = OH_VideoProcessingCallback_BindOnNewOutputBuffer( 966fa7767c5Sopenharmony_ci nullptr, OnNewOutputBufferEmptyCallback); 967fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_ERROR_INVALID_PARAMETER); 968fa7767c5Sopenharmony_ci} 969fa7767c5Sopenharmony_ci 970fa7767c5Sopenharmony_ci/** 971fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0510 972fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessingCallback_BindOnNewOutputBuffer 973fa7767c5Sopenharmony_ci * @tc.desc : function test 974fa7767c5Sopenharmony_ci */ 975fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0510, TestSize.Level0) 976fa7767c5Sopenharmony_ci{ 977fa7767c5Sopenharmony_ci OH_VideoProcessing_InitializeEnvironment(); 978fa7767c5Sopenharmony_ci VideoProcessing_Callback* callback = nullptr; 979fa7767c5Sopenharmony_ci VideoProcessing_ErrorCode ret = OH_VideoProcessingCallback_Create(&callback); 980fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_SUCCESS); 981fa7767c5Sopenharmony_ci ret = OH_VideoProcessingCallback_BindOnNewOutputBuffer(callback, OnNewOutputBufferEmptyCallback); 982fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_SUCCESS); 983fa7767c5Sopenharmony_ci OH_VideoProcessingCallback_Destroy(callback); 984fa7767c5Sopenharmony_ci} 985fa7767c5Sopenharmony_ci 986fa7767c5Sopenharmony_ci/** 987fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0520 988fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessingCallback_BindOnNewOutputBuffer 989fa7767c5Sopenharmony_ci * @tc.desc : function test 990fa7767c5Sopenharmony_ci */ 991fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0520, TestSize.Level0) 992fa7767c5Sopenharmony_ci{ 993fa7767c5Sopenharmony_ci OH_VideoProcessing_InitializeEnvironment(); 994fa7767c5Sopenharmony_ci VideoProcessing_ErrorCode ret = OH_VideoProcessingCallback_BindOnNewOutputBuffer( 995fa7767c5Sopenharmony_ci nullptr, OnNewOutputBufferCallback); 996fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_ERROR_INVALID_PARAMETER); 997fa7767c5Sopenharmony_ci} 998fa7767c5Sopenharmony_ci 999fa7767c5Sopenharmony_ci/** 1000fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_0530 1001fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessingCallback_BindOnNewOutputBuffer 1002fa7767c5Sopenharmony_ci * @tc.desc : function test 1003fa7767c5Sopenharmony_ci */ 1004fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0530, TestSize.Level0) 1005fa7767c5Sopenharmony_ci{ 1006fa7767c5Sopenharmony_ci OH_VideoProcessing_InitializeEnvironment(); 1007fa7767c5Sopenharmony_ci VideoProcessing_Callback* callback = nullptr; 1008fa7767c5Sopenharmony_ci VideoProcessing_ErrorCode ret = OH_VideoProcessingCallback_Create(&callback); 1009fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_SUCCESS); 1010fa7767c5Sopenharmony_ci ret = OH_VideoProcessingCallback_BindOnNewOutputBuffer(callback, OnNewOutputBufferCallback); 1011fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_SUCCESS); 1012fa7767c5Sopenharmony_ci OH_VideoProcessingCallback_Destroy(callback); 1013fa7767c5Sopenharmony_ci} 1014fa7767c5Sopenharmony_ci 1015fa7767c5Sopenharmony_ci/** 1016fa7767c5Sopenharmony_ci * @tc.number : VPE_VIDEO_API_TEST_05400 1017fa7767c5Sopenharmony_ci * @tc.name : call OH_VideoProcessing_Create 1018fa7767c5Sopenharmony_ci * @tc.desc : function test 1019fa7767c5Sopenharmony_ci */ 1020fa7767c5Sopenharmony_ciHWTEST_F(VpeVideoApiTest, VPE_VIDEO_API_TEST_0540, TestSize.Level0) 1021fa7767c5Sopenharmony_ci{ 1022fa7767c5Sopenharmony_ci OH_VideoProcessing_InitializeEnvironment(); 1023fa7767c5Sopenharmony_ci OH_VideoProcessing* videoProcessor = nullptr; 1024fa7767c5Sopenharmony_ci VideoProcessing_ErrorCode ret = OH_VideoProcessing_Create(&videoProcessor, 1025fa7767c5Sopenharmony_ci VIDEO_PROCESSING_TYPE_COLOR_SPACE_CONVERSION); 1026fa7767c5Sopenharmony_ci if (!access("/system/lib64/", 0)) { 1027fa7767c5Sopenharmony_ci ASSERT_EQ(ret, VIDEO_PROCESSING_SUCCESS); 1028fa7767c5Sopenharmony_ci OH_VideoProcessing_Destroy(videoProcessor); 1029fa7767c5Sopenharmony_ci } else { 1030fa7767c5Sopenharmony_ci ASSERT_NE(ret, VIDEO_PROCESSING_SUCCESS); 1031fa7767c5Sopenharmony_ci } 1032fa7767c5Sopenharmony_ci} 1033fa7767c5Sopenharmony_ci}