1fa7767c5Sopenharmony_ci/* 2fa7767c5Sopenharmony_ci * Copyright (c) 2023-2023 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 16fa7767c5Sopenharmony_ci#include "gtest/gtest.h" 17fa7767c5Sopenharmony_ci#include "plugin/common/plugin_meta.h" 18fa7767c5Sopenharmony_ci#include "pipeline/filters/common/plugin_utils.h" 19fa7767c5Sopenharmony_ci#include "plugin/common/plugin_tags.h" 20fa7767c5Sopenharmony_ci#include "plugin/common/plugin_types.h" 21fa7767c5Sopenharmony_ci#include "plugin/plugins/codec_adapter/codec_utils.h" 22fa7767c5Sopenharmony_ci#include "pipeline/filters/common/plugin_settings.h" 23fa7767c5Sopenharmony_ci#include "pipeline/core/filter_type.h" 24fa7767c5Sopenharmony_ci#include "plugin/convert/ffmpeg_convert.h" 25fa7767c5Sopenharmony_ci#include "hdf_base.h" 26fa7767c5Sopenharmony_ci#include "OMX_Core.h" 27fa7767c5Sopenharmony_ci 28fa7767c5Sopenharmony_ciusing namespace testing::ext; 29fa7767c5Sopenharmony_ciusing namespace OHOS::Media::Plugin; 30fa7767c5Sopenharmony_ciusing namespace OHOS::Media::Plugin::CodecAdapter; 31fa7767c5Sopenharmony_ciusing namespace OHOS::Media::Pipeline; 32fa7767c5Sopenharmony_ci 33fa7767c5Sopenharmony_cinamespace OHOS { 34fa7767c5Sopenharmony_cinamespace Media { 35fa7767c5Sopenharmony_cinamespace Test { 36fa7767c5Sopenharmony_ciHWTEST(TestMeta, find_unavailable_plugins, TestSize.Level1) 37fa7767c5Sopenharmony_ci{ 38fa7767c5Sopenharmony_ci Meta meta; 39fa7767c5Sopenharmony_ci std::string artist("abcd"); 40fa7767c5Sopenharmony_ci meta.Set<Tag::MEDIA_TITLE>(artist); 41fa7767c5Sopenharmony_ci auto cap = MetaToCapability(meta); 42fa7767c5Sopenharmony_ci auto plugins = FindAvailablePlugins(*cap, Plugin::PluginType::AUDIO_DECODER); 43fa7767c5Sopenharmony_ci ASSERT_TRUE(plugins.size() == 0); 44fa7767c5Sopenharmony_ci} 45fa7767c5Sopenharmony_ci 46fa7767c5Sopenharmony_ciHWTEST(TestMeta, set_para_to_sink_plugins, TestSize.Level1) 47fa7767c5Sopenharmony_ci{ 48fa7767c5Sopenharmony_ci std::shared_ptr<Ffmpeg::ResamplePara> resamplePara = std::make_shared<Ffmpeg::ResamplePara>(); 49fa7767c5Sopenharmony_ci resamplePara->channels = 2; 50fa7767c5Sopenharmony_ci resamplePara->sampleRate = 96000; 51fa7767c5Sopenharmony_ci resamplePara->bitsPerSample = 16; 52fa7767c5Sopenharmony_ci resamplePara->channelLayout = 3; 53fa7767c5Sopenharmony_ci resamplePara->srcFfFmt = AVSampleFormat::AV_SAMPLE_FMT_FLTP; 54fa7767c5Sopenharmony_ci resamplePara->destSamplesPerFrame = 2048; 55fa7767c5Sopenharmony_ci resamplePara->destFmt = AVSampleFormat::AV_SAMPLE_FMT_S16; 56fa7767c5Sopenharmony_ci std::shared_ptr<Ffmpeg::Resample> resample = std::make_shared<Ffmpeg::Resample>(); 57fa7767c5Sopenharmony_ci auto src = new uint8_t; 58fa7767c5Sopenharmony_ci size_t srcLength = 16384; 59fa7767c5Sopenharmony_ci auto des = new uint8_t; 60fa7767c5Sopenharmony_ci size_t desLength = 16384; 61fa7767c5Sopenharmony_ci ASSERT_TRUE(resample->Init(*resamplePara) == Status::OK); 62fa7767c5Sopenharmony_ci ASSERT_TRUE(resample->Convert(src, srcLength, des, desLength) == Status::OK); 63fa7767c5Sopenharmony_ci resamplePara->destFmt = AVSampleFormat::AV_SAMPLE_FMT_U8P; 64fa7767c5Sopenharmony_ci ASSERT_TRUE(resample->Init(*resamplePara) == Status::OK); 65fa7767c5Sopenharmony_ci ASSERT_TRUE(resample->Convert(src, srcLength, des, desLength) == Status::OK); 66fa7767c5Sopenharmony_ci 67fa7767c5Sopenharmony_ci resamplePara->bitsPerSample = 8; 68fa7767c5Sopenharmony_ci ASSERT_TRUE(resample->Init(*resamplePara) == Status::OK); 69fa7767c5Sopenharmony_ci ASSERT_FALSE(resample->Convert(src, srcLength, des, desLength) == Status::OK); 70fa7767c5Sopenharmony_ci 71fa7767c5Sopenharmony_ci resamplePara->bitsPerSample = 24; 72fa7767c5Sopenharmony_ci ASSERT_TRUE(resample->Init(*resamplePara) == Status::OK); 73fa7767c5Sopenharmony_ci ASSERT_FALSE(resample->Convert(src, srcLength, des, desLength) == Status::OK); 74fa7767c5Sopenharmony_ci} 75fa7767c5Sopenharmony_ci 76fa7767c5Sopenharmony_ciHWTEST(TestMeta, hdf_status_to_string, TestSize.Level1) 77fa7767c5Sopenharmony_ci{ 78fa7767c5Sopenharmony_ci ASSERT_TRUE(HdfStatus2String(HDF_STATUS::HDF_SUCCESS) != "null"); 79fa7767c5Sopenharmony_ci ASSERT_TRUE(HdfStatus2String(HDF_STATUS::HDF_FAILURE) != "null"); 80fa7767c5Sopenharmony_ci ASSERT_TRUE(HdfStatus2String(HDF_STATUS::HDF_ERR_NOT_SUPPORT) != "null"); 81fa7767c5Sopenharmony_ci ASSERT_TRUE(HdfStatus2String(HDF_STATUS::HDF_ERR_INVALID_PARAM) != "null"); 82fa7767c5Sopenharmony_ci ASSERT_TRUE(HdfStatus2String(HDF_STATUS::HDF_ERR_INVALID_OBJECT) != "null"); 83fa7767c5Sopenharmony_ci ASSERT_TRUE(HdfStatus2String(HDF_STATUS::HDF_ERR_MALLOC_FAIL) != "null"); 84fa7767c5Sopenharmony_ci ASSERT_TRUE(HdfStatus2String(HDF_STATUS::HDF_ERR_TIMEOUT) != "null"); 85fa7767c5Sopenharmony_ci ASSERT_TRUE(HdfStatus2String(HDF_STATUS::HDF_ERR_THREAD_CREATE_FAIL) != "null"); 86fa7767c5Sopenharmony_ci ASSERT_TRUE(HdfStatus2String(HDF_STATUS::HDF_ERR_QUEUE_FULL) != "null"); 87fa7767c5Sopenharmony_ci ASSERT_TRUE(HdfStatus2String(HDF_STATUS::HDF_ERR_DEVICE_BUSY) != "null"); 88fa7767c5Sopenharmony_ci ASSERT_TRUE(HdfStatus2String(HDF_STATUS::HDF_ERR_IO) != "null"); 89fa7767c5Sopenharmony_ci ASSERT_TRUE(HdfStatus2String(HDF_STATUS::HDF_ERR_BAD_FD) != "null"); 90fa7767c5Sopenharmony_ci ASSERT_TRUE(HdfStatus2String(HDF_STATUS::HDF_ERR_NOPERM) != "null"); 91fa7767c5Sopenharmony_ci ASSERT_TRUE(HdfStatus2String(HDF_STATUS::HDF_BSP_ERR_OP) != "null"); 92fa7767c5Sopenharmony_ci ASSERT_TRUE(HdfStatus2String(HDF_STATUS::HDF_ERR_BSP_PLT_API_ERR) != "null"); 93fa7767c5Sopenharmony_ci ASSERT_TRUE(HdfStatus2String(HDF_STATUS::HDF_PAL_ERR_DEV_CREATE) != "null"); 94fa7767c5Sopenharmony_ci ASSERT_TRUE(HdfStatus2String(HDF_STATUS::HDF_PAL_ERR_INNER) != "null"); 95fa7767c5Sopenharmony_ci ASSERT_TRUE(HdfStatus2String(HDF_STATUS::HDF_DEV_ERR_NO_MEMORY) != "null"); 96fa7767c5Sopenharmony_ci ASSERT_TRUE(HdfStatus2String(HDF_STATUS::HDF_DEV_ERR_NO_DEVICE) != "null"); 97fa7767c5Sopenharmony_ci ASSERT_TRUE(HdfStatus2String(HDF_STATUS::HDF_DEV_ERR_NO_DEVICE_SERVICE) != "null"); 98fa7767c5Sopenharmony_ci ASSERT_TRUE(HdfStatus2String(HDF_STATUS::HDF_DEV_ERR_DEV_INIT_FAIL) != "null"); 99fa7767c5Sopenharmony_ci ASSERT_TRUE(HdfStatus2String(HDF_STATUS::HDF_DEV_ERR_PUBLISH_FAIL) != "null"); 100fa7767c5Sopenharmony_ci ASSERT_TRUE(HdfStatus2String(HDF_STATUS::HDF_DEV_ERR_ATTACHDEV_FAIL) != "null"); 101fa7767c5Sopenharmony_ci ASSERT_TRUE(HdfStatus2String(HDF_STATUS::HDF_DEV_ERR_NODATA) != "null"); 102fa7767c5Sopenharmony_ci ASSERT_TRUE(HdfStatus2String(HDF_STATUS::HDF_DEV_ERR_NORANGE) != "null"); 103fa7767c5Sopenharmony_ci ASSERT_TRUE(HdfStatus2String(HDF_STATUS::HDF_DEV_ERR_OP) != "null"); 104fa7767c5Sopenharmony_ci ASSERT_TRUE(HdfStatus2String(100) == "null"); 105fa7767c5Sopenharmony_ci} 106fa7767c5Sopenharmony_ci 107fa7767c5Sopenharmony_ciHWTEST(TestMeta, omx_error_type_to_string, TestSize.Level1) 108fa7767c5Sopenharmony_ci{ 109fa7767c5Sopenharmony_ci ASSERT_TRUE(OmxErrorType2String(OMX_ErrorNone) == "OMX_ErrorNone"); 110fa7767c5Sopenharmony_ci ASSERT_TRUE(OmxErrorType2String(OMX_ErrorInsufficientResources) == "OMX_ErrorInsufficientResources"); 111fa7767c5Sopenharmony_ci ASSERT_TRUE(OmxErrorType2String(OMX_ErrorUndefined) == "OMX_ErrorUndefined"); 112fa7767c5Sopenharmony_ci ASSERT_TRUE(OmxErrorType2String(OMX_ErrorInvalidComponentName) == "OMX_ErrorInvalidComponentName"); 113fa7767c5Sopenharmony_ci ASSERT_TRUE(OmxErrorType2String(OMX_ErrorComponentNotFound) == "OMX_ErrorComponentNotFound"); 114fa7767c5Sopenharmony_ci ASSERT_TRUE(OmxErrorType2String(OMX_ErrorInvalidComponent) == "OMX_ErrorInvalidComponent"); 115fa7767c5Sopenharmony_ci ASSERT_TRUE(OmxErrorType2String(OMX_ErrorBadParameter) == "OMX_ErrorBadParameter"); 116fa7767c5Sopenharmony_ci ASSERT_TRUE(OmxErrorType2String(OMX_ErrorNotImplemented) == "OMX_ErrorNotImplemented"); 117fa7767c5Sopenharmony_ci ASSERT_TRUE(OmxErrorType2String(100) == "OMX_ErrorNone"); 118fa7767c5Sopenharmony_ci} 119fa7767c5Sopenharmony_ci 120fa7767c5Sopenharmony_ciHWTEST(TestMeta, transfor_hdi_ret_value_to_status, TestSize.Level1) 121fa7767c5Sopenharmony_ci{ 122fa7767c5Sopenharmony_ci ASSERT_TRUE(TransHdiRetVal2Status(HDF_SUCCESS) == Status::OK); 123fa7767c5Sopenharmony_ci ASSERT_TRUE(TransHdiRetVal2Status(HDF_FAILURE) == Status::ERROR_UNKNOWN); 124fa7767c5Sopenharmony_ci ASSERT_TRUE(TransHdiRetVal2Status(HDF_ERR_NOT_SUPPORT) == Status::ERROR_INVALID_OPERATION); 125fa7767c5Sopenharmony_ci ASSERT_TRUE(TransHdiRetVal2Status(HDF_ERR_INVALID_PARAM) == Status::ERROR_INVALID_PARAMETER); 126fa7767c5Sopenharmony_ci ASSERT_TRUE(TransHdiRetVal2Status(HDF_ERR_MALLOC_FAIL) == Status::ERROR_NO_MEMORY); 127fa7767c5Sopenharmony_ci ASSERT_TRUE(TransHdiRetVal2Status(100) == Status::ERROR_UNKNOWN); 128fa7767c5Sopenharmony_ci} 129fa7767c5Sopenharmony_ci 130fa7767c5Sopenharmony_ciHWTEST(TestMeta, translate_to_omx_flag_set, TestSize.Level1) 131fa7767c5Sopenharmony_ci{ 132fa7767c5Sopenharmony_ci ASSERT_TRUE(Translate2omxFlagSet(BUFFER_FLAG_EOS) == OMX_BUFFERFLAG_EOS); 133fa7767c5Sopenharmony_ci ASSERT_TRUE(Translate2omxFlagSet(100) == 0); 134fa7767c5Sopenharmony_ci ASSERT_TRUE(Translate2PluginFlagSet(OMX_BUFFERFLAG_EOS) == BUFFER_FLAG_EOS); 135fa7767c5Sopenharmony_ci ASSERT_TRUE(Translate2PluginFlagSet(100) == 0); 136fa7767c5Sopenharmony_ci} 137fa7767c5Sopenharmony_ci 138fa7767c5Sopenharmony_ciHWTEST(TestMeta, coding_type_hst_to_hdi, TestSize.Level1) 139fa7767c5Sopenharmony_ci{ 140fa7767c5Sopenharmony_ci ASSERT_TRUE(CodingTypeHstToHdi(MEDIA_MIME_VIDEO_H264) == OMX_VIDEO_CodingAVC); 141fa7767c5Sopenharmony_ci ASSERT_TRUE(CodingTypeHstToHdi(MEDIA_MIME_VIDEO_H265) 142fa7767c5Sopenharmony_ci == static_cast<OMX_VIDEO_CODINGTYPE>(CODEC_OMX_VIDEO_CodingHEVC)); 143fa7767c5Sopenharmony_ci ASSERT_TRUE(CodingTypeHstToHdi("NULL") == OMX_VIDEO_CodingUnused); 144fa7767c5Sopenharmony_ci} 145fa7767c5Sopenharmony_ci 146fa7767c5Sopenharmony_ciHWTEST(TestMeta, format_hst_to_omx, TestSize.Level1) 147fa7767c5Sopenharmony_ci{ 148fa7767c5Sopenharmony_ci ASSERT_TRUE(FormatHstToOmx(VideoPixelFormat::NV12) == OMX_COLOR_FormatYUV420SemiPlanar); 149fa7767c5Sopenharmony_ci ASSERT_TRUE(FormatHstToOmx(VideoPixelFormat::NV21) == OMX_COLOR_FormatYUV420SemiPlanar); 150fa7767c5Sopenharmony_ci ASSERT_TRUE(FormatHstToOmx(VideoPixelFormat::BGRA) == OMX_COLOR_Format32bitBGRA8888); 151fa7767c5Sopenharmony_ci ASSERT_TRUE(FormatHstToOmx(VideoPixelFormat::RGBA) == OMX_COLOR_Format32bitARGB8888); 152fa7767c5Sopenharmony_ci ASSERT_TRUE(FormatHstToOmx(VideoPixelFormat::YUV420P) == OMX_COLOR_FormatYUV420Planar); 153fa7767c5Sopenharmony_ci ASSERT_TRUE(FormatHstToOmx(VideoPixelFormat::RGB24) == OMX_COLOR_FormatUnused); 154fa7767c5Sopenharmony_ci} 155fa7767c5Sopenharmony_ci 156fa7767c5Sopenharmony_ciHWTEST(TestMeta, omx_state_to_string, TestSize.Level1) 157fa7767c5Sopenharmony_ci{ 158fa7767c5Sopenharmony_ci ASSERT_TRUE(OmxStateToString(OMX_StateInvalid) == "OMX_StateInvalid"); 159fa7767c5Sopenharmony_ci ASSERT_TRUE(OmxStateToString(OMX_StateLoaded) == "OMX_StateLoaded"); 160fa7767c5Sopenharmony_ci ASSERT_TRUE(OmxStateToString(OMX_StateLoaded) == "OMX_StateLoaded"); 161fa7767c5Sopenharmony_ci ASSERT_TRUE(OmxStateToString(OMX_StateIdle) == "OMX_StateIdle"); 162fa7767c5Sopenharmony_ci ASSERT_TRUE(OmxStateToString(OMX_StateExecuting) == "OMX_StateExecuting"); 163fa7767c5Sopenharmony_ci ASSERT_TRUE(OmxStateToString(OMX_StatePause) == "OMX_StatePause"); 164fa7767c5Sopenharmony_ci ASSERT_TRUE(OmxStateToString(OMX_StateWaitForResources) == "OMX_StateWaitForResources"); 165fa7767c5Sopenharmony_ci ASSERT_TRUE(OmxStateToString(OMX_StateKhronosExtensions) == "OMX_StateKhronosExtensions"); 166fa7767c5Sopenharmony_ci ASSERT_TRUE(OmxStateToString(OMX_StateVendorStartUnused) == "OMX_StateVendorStartUnused"); 167fa7767c5Sopenharmony_ci ASSERT_TRUE(OmxStateToString(OMX_StateMax) == "OMX_StateMax"); 168fa7767c5Sopenharmony_ci} 169fa7767c5Sopenharmony_ci 170fa7767c5Sopenharmony_ciHWTEST(TestMeta, get_omx_buffer_type, TestSize.Level1) 171fa7767c5Sopenharmony_ci{ 172fa7767c5Sopenharmony_ci ASSERT_TRUE(GetOmxBufferType(static_cast<const Plugin::MemoryType>(MemoryType::SHARE_MEMORY), true) 173fa7767c5Sopenharmony_ci == CODEC_BUFFER_TYPE_AVSHARE_MEM_FD); 174fa7767c5Sopenharmony_ci ASSERT_TRUE(GetOmxBufferType(static_cast<const Plugin::MemoryType>(MemoryType::SURFACE_BUFFER), true) 175fa7767c5Sopenharmony_ci == CODEC_BUFFER_TYPE_DYNAMIC_HANDLE); 176fa7767c5Sopenharmony_ci ASSERT_TRUE(GetOmxBufferType(static_cast<const Plugin::MemoryType>(MemoryType::SURFACE_BUFFER), false) 177fa7767c5Sopenharmony_ci == CODEC_BUFFER_TYPE_HANDLE); 178fa7767c5Sopenharmony_ci ASSERT_TRUE(GetOmxBufferType(static_cast<const Plugin::MemoryType>(MemoryType::VIRTUAL_ADDR), true) 179fa7767c5Sopenharmony_ci == CODEC_BUFFER_TYPE_INVALID); 180fa7767c5Sopenharmony_ci} 181fa7767c5Sopenharmony_ci 182fa7767c5Sopenharmony_ciHWTEST(TestMeta, codec_buffer_pool, TestSize.Level1) 183fa7767c5Sopenharmony_ci{ 184fa7767c5Sopenharmony_ci PluginParaAllowedMap map = PluginParameterTable::FindAllowedParameterMap(FilterType::MEDIA_SOURCE); 185fa7767c5Sopenharmony_ci ASSERT_TRUE(map.size() == 0); 186fa7767c5Sopenharmony_ci map = PluginParameterTable::FindAllowedParameterMap(FilterType::CAPTURE_SOURCE); 187fa7767c5Sopenharmony_ci ASSERT_TRUE(map.size() == 0); 188fa7767c5Sopenharmony_ci map = PluginParameterTable::FindAllowedParameterMap(FilterType::DEMUXER); 189fa7767c5Sopenharmony_ci ASSERT_TRUE(map.size() == 0); 190fa7767c5Sopenharmony_ci map = PluginParameterTable::FindAllowedParameterMap(FilterType::MUXER); 191fa7767c5Sopenharmony_ci ASSERT_TRUE(map.size() > 0); 192fa7767c5Sopenharmony_ci map = PluginParameterTable::FindAllowedParameterMap(FilterType::AUDIO_DECODER); 193fa7767c5Sopenharmony_ci ASSERT_TRUE(map.size() > 0); 194fa7767c5Sopenharmony_ci map = PluginParameterTable::FindAllowedParameterMap(FilterType::VIDEO_DECODER); 195fa7767c5Sopenharmony_ci ASSERT_TRUE(map.size() > 0); 196fa7767c5Sopenharmony_ci map = PluginParameterTable::FindAllowedParameterMap(FilterType::AUDIO_ENCODER); 197fa7767c5Sopenharmony_ci ASSERT_TRUE(map.size() > 0); 198fa7767c5Sopenharmony_ci map = PluginParameterTable::FindAllowedParameterMap(FilterType::VIDEO_ENCODER); 199fa7767c5Sopenharmony_ci ASSERT_TRUE(map.size() > 0); 200fa7767c5Sopenharmony_ci map = PluginParameterTable::FindAllowedParameterMap(FilterType::AUDIO_SINK); 201fa7767c5Sopenharmony_ci ASSERT_TRUE(map.size() > 0); 202fa7767c5Sopenharmony_ci map = PluginParameterTable::FindAllowedParameterMap(FilterType::VIDEO_SINK); 203fa7767c5Sopenharmony_ci ASSERT_TRUE(map.size() > 0); 204fa7767c5Sopenharmony_ci map = PluginParameterTable::FindAllowedParameterMap(FilterType::OUTPUT_SINK); 205fa7767c5Sopenharmony_ci ASSERT_TRUE(map.size() == 0); 206fa7767c5Sopenharmony_ci map = PluginParameterTable::FindAllowedParameterMap(FilterType::NONE); 207fa7767c5Sopenharmony_ci ASSERT_TRUE(map.size() == 0); 208fa7767c5Sopenharmony_ci} 209fa7767c5Sopenharmony_ci 210fa7767c5Sopenharmony_ciHWTEST(TestMeta, assign_parameter_if_match, TestSize.Level1) 211fa7767c5Sopenharmony_ci{ 212fa7767c5Sopenharmony_ci uint32_t value = 0; 213fa7767c5Sopenharmony_ci uint32_t ret; 214fa7767c5Sopenharmony_ci ASSERT_FALSE(AssignParameterIfMatch(Tag::SECTION_REGULAR_START, ret, value)); 215fa7767c5Sopenharmony_ci ASSERT_FALSE(AssignParameterIfMatch(Tag::MIME, value, 0)); 216fa7767c5Sopenharmony_ci ASSERT_TRUE(AssignParameterIfMatch(Tag::TRACK_ID, ret, value)); 217fa7767c5Sopenharmony_ci} 218fa7767c5Sopenharmony_ci 219fa7767c5Sopenharmony_ciHWTEST(TestMeta, translate_plugin_status, TestSize.Level1) 220fa7767c5Sopenharmony_ci{ 221fa7767c5Sopenharmony_ci auto status = TranslatePluginStatus(Plugin::Status::END_OF_STREAM); 222fa7767c5Sopenharmony_ci ASSERT_TRUE(status == ErrorCode::END_OF_STREAM); 223fa7767c5Sopenharmony_ci status = TranslatePluginStatus(Plugin::Status::OK); 224fa7767c5Sopenharmony_ci ASSERT_TRUE(status == ErrorCode::SUCCESS); 225fa7767c5Sopenharmony_ci status = TranslatePluginStatus(Plugin::Status::NO_ERROR); 226fa7767c5Sopenharmony_ci ASSERT_TRUE(status == ErrorCode::SUCCESS); 227fa7767c5Sopenharmony_ci status = TranslatePluginStatus(Plugin::Status::ERROR_UNKNOWN); 228fa7767c5Sopenharmony_ci ASSERT_TRUE(status == ErrorCode::ERROR_UNKNOWN); 229fa7767c5Sopenharmony_ci status = TranslatePluginStatus(Plugin::Status::ERROR_CLIENT); 230fa7767c5Sopenharmony_ci ASSERT_TRUE(status == ErrorCode::ERROR_UNKNOWN); 231fa7767c5Sopenharmony_ci} 232fa7767c5Sopenharmony_ci 233fa7767c5Sopenharmony_ciHWTEST(TestMeta, translate_into_parameter, TestSize.Level1) 234fa7767c5Sopenharmony_ci{ 235fa7767c5Sopenharmony_ci Tag tag = Tag::SECTION_REGULAR_START; 236fa7767c5Sopenharmony_ci auto ret = TranslateIntoParameter(-1, tag); 237fa7767c5Sopenharmony_ci ASSERT_FALSE(ret); 238fa7767c5Sopenharmony_ci ASSERT_TRUE(tag == Tag::SECTION_REGULAR_START); 239fa7767c5Sopenharmony_ci ret = TranslateIntoParameter(static_cast<const int>(Tag::SECTION_REGULAR_START), tag); 240fa7767c5Sopenharmony_ci ASSERT_TRUE(ret); 241fa7767c5Sopenharmony_ci ASSERT_TRUE(tag == Tag::SECTION_REGULAR_START); 242fa7767c5Sopenharmony_ci} 243fa7767c5Sopenharmony_ci 244fa7767c5Sopenharmony_ciHWTEST(TestMeta, capability_to_string, TestSize.Level1) 245fa7767c5Sopenharmony_ci{ 246fa7767c5Sopenharmony_ci std::shared_ptr<Capability> capability = std::make_shared<Capability>(); 247fa7767c5Sopenharmony_ci std::string string = Capability2String(*capability); 248fa7767c5Sopenharmony_ci ASSERT_TRUE(string == "Capability{mime:}"); 249fa7767c5Sopenharmony_ci capability->SetMime("video/avc"); 250fa7767c5Sopenharmony_ci capability->AppendFixedKey(Capability::Key::MEDIA_BITRATE, nullptr); 251fa7767c5Sopenharmony_ci capability->AppendFixedKey(Capability::Key::VIDEO_BIT_STREAM_FORMAT, nullptr); 252fa7767c5Sopenharmony_ci string = Capability2String(*capability); 253fa7767c5Sopenharmony_ci ASSERT_TRUE(string == "Capability{mime:video/avc, "); 254fa7767c5Sopenharmony_ci} 255fa7767c5Sopenharmony_ci 256fa7767c5Sopenharmony_ciHWTEST(TestMeta, find_allowed_parameter_map, TestSize.Level1) 257fa7767c5Sopenharmony_ci{ 258fa7767c5Sopenharmony_ci FilterType filterType = FilterType::NONE; 259fa7767c5Sopenharmony_ci PluginParaAllowedMap map = PluginParameterTable::FindAllowedParameterMap(filterType); 260fa7767c5Sopenharmony_ci ASSERT_TRUE(map.size() == 0); 261fa7767c5Sopenharmony_ci filterType = FilterType::AUDIO_DECODER; 262fa7767c5Sopenharmony_ci map = PluginParameterTable::FindAllowedParameterMap(filterType); 263fa7767c5Sopenharmony_ci ASSERT_TRUE(map.size() != 0); 264fa7767c5Sopenharmony_ci} 265fa7767c5Sopenharmony_ci} // namespace Test 266fa7767c5Sopenharmony_ci} // namespace Media 267fa7767c5Sopenharmony_ci} // namespace OHOS 268