From b1ac8c4ddfd29264da5bd120e5837cb383907626 Mon Sep 17 00:00:00 2001 From: lzm Date: Thu, 21 Aug 2025 09:58:29 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=9B=BE=E5=BD=A2?= =?UTF-8?q?=E5=83=8F=E7=B4=A0=E6=A0=BC=E5=BC=8F=E6=9E=9A=E4=B8=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lzm --- .../native/capi/avcodec/native_avcodec_base.cpp | 1 + interfaces/kits/c/native_avcodec_base.h | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/frameworks/native/capi/avcodec/native_avcodec_base.cpp b/frameworks/native/capi/avcodec/native_avcodec_base.cpp index 9e42637af..5e390994b 100644 --- a/frameworks/native/capi/avcodec/native_avcodec_base.cpp +++ b/frameworks/native/capi/avcodec/native_avcodec_base.cpp @@ -148,6 +148,7 @@ const char *OH_MD_KEY_VIDEO_ENCODER_MAX_B_FRAMES = "video_encoder_max_b_frame"; const char *OH_MD_KEY_VIDEO_ENCODER_ENABLE_B_FRAME = "video_encoder_enable_b_frame"; const char *OH_MD_KEY_ENABLE_SYNC_MODE = "enable_sync_mode"; const char *OH_MD_KEY_VIDEO_DECODER_BLANK_FRAME_ON_SHUTDOWN = "video_decoder_blank_frame_on_shutdown"; +const char *OH_MD_KEY_VIDEO_NATIVE_BUFFER_FORMAT = "video_graphic_pixel_format"; #ifdef __cplusplus } #endif diff --git a/interfaces/kits/c/native_avcodec_base.h b/interfaces/kits/c/native_avcodec_base.h index 8aa1fdf2d..0af22a1c5 100644 --- a/interfaces/kits/c/native_avcodec_base.h +++ b/interfaces/kits/c/native_avcodec_base.h @@ -939,6 +939,19 @@ extern const char *OH_MD_KEY_ENABLE_SYNC_MODE; */ extern const char *OH_MD_KEY_VIDEO_DECODER_BLANK_FRAME_ON_SHUTDOWN; +/** + * @brief Key for querying native buffer pixel formats for video codec operations, value type is int32_t. + * The value represents pixel formats defined in {@link OH_NativeBuffer_Format}. + * + * This key serves two primary purposes: + * 1. Runtime decoder output: Get current output format via {@link OH_VideoDecoder_GetOutputDescription} + * (or {@link OH_AVCodecOnStreamChanged} events) + * 2. Runtime encoder input: Get current input format via {@link OH_VideoEncoder_GetInputDescription} + * + * @since 22 + */ +extern const char *OH_MD_KEY_VIDEO_NATIVE_BUFFER_FORMAT; + /** * @brief Media type. * @syscap SystemCapability.Multimedia.Media.CodecBase -- Gitee From fb8972e134844074d219d9ee080484997d3d341b Mon Sep 17 00:00:00 2001 From: lzm Date: Mon, 25 Aug 2025 17:07:22 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=83=8F=E7=B4=A0?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E8=83=BD=E5=8A=9B=E6=9F=A5=E8=AF=A2+?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lzm --- .../native/avcodeclist/avcodec_info.cpp | 9 + .../capi/common/native_avcapability.cpp | 32 ++++ interfaces/inner_api/native/avcodec_info.h | 8 + interfaces/kits/c/native_avcapability.h | 20 +++ .../sa_avcodec/ipc/codeclist_parcel.cpp | 34 ++-- .../sa_avcodec/ipc/codeclist_parcel.h | 2 + .../capi/codeclist_capi_mock.cpp | 21 +++ .../codeclist_test/capi/codeclist_capi_mock.h | 1 + .../codeclist_test/caps_unit_test.cpp | 168 +++++++++--------- test/unittest/codeclist_test/caps_unit_test.h | 3 +- test/unittest/codeclist_test/codeclist_mock.h | 13 +- .../inner/codeclist_inner_mock.cpp | 12 ++ .../inner/codeclist_inner_mock.h | 1 + 13 files changed, 225 insertions(+), 99 deletions(-) diff --git a/frameworks/native/avcodeclist/avcodec_info.cpp b/frameworks/native/avcodeclist/avcodec_info.cpp index f9790db80..acf774b32 100644 --- a/frameworks/native/avcodeclist/avcodec_info.cpp +++ b/frameworks/native/avcodeclist/avcodec_info.cpp @@ -101,6 +101,15 @@ std::vector VideoCaps::GetSupportedFormats() return pixFormat; } +std::vector VideoCaps::GetSupportedGraphicFormats() +{ + CHECK_AND_RETURN_RET_LOG(data_ != nullptr, std::vector(), "data is null"); + std::vector graphicPixFormat = data_->graphicPixFormat; + CHECK_AND_RETURN_RET_LOG(graphicPixFormat.size() != 0, graphicPixFormat, + "GetSupportedGraphicFormats failed: format is null"); + return graphicPixFormat; +} + int32_t VideoCaps::GetSupportedHeightAlignment() { CHECK_AND_RETURN_RET_LOG(data_ != nullptr, 1, "data is null"); diff --git a/frameworks/native/capi/common/native_avcapability.cpp b/frameworks/native/capi/common/native_avcapability.cpp index 1444762df..fd5b43957 100644 --- a/frameworks/native/capi/common/native_avcapability.cpp +++ b/frameworks/native/capi/common/native_avcapability.cpp @@ -376,6 +376,38 @@ OH_AVErrCode OH_AVCapability_GetVideoSupportedPixelFormats(OH_AVCapability *capa return AV_ERR_OK; } +OH_AVErrCode OH_AVCapability_GetVideoSupportedNativeBufferFormats(OH_AVCapability *capability, + const int32_t **nativeBufferFormats, + uint32_t *nativeBufferFormatNum) +{ + CHECK_AND_RETURN_RET_LOG(nativeBufferFormats != nullptr && nativeBufferFormatNum != nullptr, AV_ERR_INVALID_VAL, + "Get video supported graphic pixel formats failed: null input"); + *nativeBufferFormats = nullptr; + *nativeBufferFormatNum = 0; + CHECK_AND_RETURN_RET_LOG(capability != nullptr && capability->magic_ == AVMagic::AVCODEC_MAGIC_AVCAPABILITY, + AV_ERR_INVALID_VAL, "Invalid parameter"); + CapabilityData *capData = capability->capabilityData_; + if (!AVCodecInfo::isVideo(capData->codecType)) { + AVCODEC_LOGW("The capability provided is not expected, should be the video capability"); + } + std::shared_ptr codecInfo = std::make_shared(capData); + const auto &vec = codecInfo->GetSupportedGraphicFormats(); + if (vec.size() == 0) { + return AV_ERR_OK; + } + std::shared_ptr codeclist = AVCodecListFactory::CreateAVCodecList(); + CHECK_AND_RETURN_RET_LOG(codeclist != nullptr, AV_ERR_UNKNOWN, + "Get video supported graphic pixel formats failed: CreateAVCodecList failed"); + size_t vecSize = vec.size() * sizeof(int32_t); + int32_t *buf = static_cast(codeclist->NewBuffer(vecSize)); + CHECK_AND_RETURN_RET_LOG(buf != nullptr, AV_ERR_NO_MEMORY, "new buffer failed"); + errno_t ret = memcpy_s(buf, vecSize, vec.data(), vecSize); + CHECK_AND_RETURN_RET_LOG(ret == EOK, AV_ERR_UNKNOWN, "memcpy_s failed"); + *nativeBufferFormats = buf; + *nativeBufferFormatNum = vec.size(); + return AV_ERR_OK; +} + OH_AVErrCode OH_AVCapability_GetVideoWidthAlignment(OH_AVCapability *capability, int32_t *widthAlignment) { CHECK_AND_RETURN_RET_LOG(widthAlignment != nullptr, AV_ERR_INVALID_VAL, diff --git a/interfaces/inner_api/native/avcodec_info.h b/interfaces/inner_api/native/avcodec_info.h index 04d321a8c..253f0eae7 100644 --- a/interfaces/inner_api/native/avcodec_info.h +++ b/interfaces/inner_api/native/avcodec_info.h @@ -171,6 +171,7 @@ struct CapabilityData { ImgSize blockSize; std::vector sampleRate; std::vector pixFormat; + std::vector graphicPixFormat; std::vector bitDepth; std::vector profiles; std::vector bitrateMode; @@ -340,6 +341,13 @@ public: */ std::vector GetSupportedFormats(); + /** + * @brief Get supported video graphic formats. + * @return Returns an array of supported graphic formats. For Details, see {@link GraphicPixelFormat}. + * @since 6.0 + */ + std::vector GetSupportedGraphicFormats(); + /** * @brief Get supported alignment of video height, only used for video codecs. * @return Returns the supported alignment of video height (in pixels). diff --git a/interfaces/kits/c/native_avcapability.h b/interfaces/kits/c/native_avcapability.h index 1d0af06b2..0212aa527 100644 --- a/interfaces/kits/c/native_avcapability.h +++ b/interfaces/kits/c/native_avcapability.h @@ -399,6 +399,26 @@ bool OH_AVCapability_AreVideoSizeAndFrameRateSupported(OH_AVCapability *capabili OH_AVErrCode OH_AVCapability_GetVideoSupportedPixelFormats(OH_AVCapability *capability, const int32_t **pixelFormats, uint32_t *pixelFormatNum); +/** + * @brief Get the video codec's supported native buffer format. + * @syscap SystemCapability.Multimedia.Media.CodecBase + * @param capability Video codec capability pointer. If an audio codec capability pointer is given, + * undefined behavior occurs + * @param nativeBufferFormats Output parameter. A pointer to the native buffer format array, + * refer to {@link OH_NativeBuffer_Format} + * @param nativeBufferFormatNum Output parameter. The element number of the native buffer format array + * @return Returns AV_ERR_OK if the execution is successful, + * otherwise returns a specific error code, refer to {@link OH_AVErrCode} + * {@link AV_ERR_INVALID_VAL}, the capability is invalid, the nativeBufferFormats is nullptr, + * or the nativeBufferFormatNum is nullptr. + * {@link AV_ERR_UNKNOWN}, unknown error. + * {@link AV_ERR_NO_MEMORY}, internal use memory malloc failed. + * @since 22 + */ +OH_AVErrCode OH_AVCapability_GetVideoSupportedNativeBufferFormats(OH_AVCapability *capability, + const int32_t **nativeBufferFormats, + uint32_t *nativeBufferFormatNum); + /** * @brief Get the codec's supported profiles. * @syscap SystemCapability.Multimedia.Media.CodecBase diff --git a/services/services/sa_avcodec/ipc/codeclist_parcel.cpp b/services/services/sa_avcodec/ipc/codeclist_parcel.cpp index 91b56d981..037db86e6 100644 --- a/services/services/sa_avcodec/ipc/codeclist_parcel.cpp +++ b/services/services/sa_avcodec/ipc/codeclist_parcel.cpp @@ -53,11 +53,8 @@ bool CodecListParcel::Marshalling(MessageParcel &parcel, CapabilityData &capabil (void)parcel.WriteInt32(capabilityData.blockPerSecond.maxVal); (void)parcel.WriteInt32(capabilityData.blockSize.width); (void)parcel.WriteInt32(capabilityData.blockSize.height); - (void)parcel.WriteInt32Vector(capabilityData.sampleRate); - (void)parcel.WriteInt32Vector(capabilityData.pixFormat); - (void)parcel.WriteInt32Vector(capabilityData.bitDepth); - (void)parcel.WriteInt32Vector(capabilityData.profiles); - (void)parcel.WriteInt32Vector(capabilityData.bitrateMode); + CHECK_AND_RETURN_RET_LOG(MarshallingInt32Vector(parcel, capabilityData), false, + "failed to Marshalling int32 vector"); (void)Marshalling(parcel, capabilityData.measuredFrameRate); (void)Marshalling(parcel, capabilityData.profileLevelsMap); (void)parcel.WriteBool(capabilityData.supportSwapWidthHeight); @@ -74,6 +71,16 @@ bool CodecListParcel::Marshalling(MessageParcel &parcel, CapabilityData &capabil return true; } +bool CodecListParcel::MarshallingInt32Vector(MessageParcel &parcel, CapabilityData &capabilityData) +{ + return parcel.WriteInt32Vector(capabilityData.sampleRate) && + parcel.WriteInt32Vector(capabilityData.pixFormat) && + parcel.WriteInt32Vector(capabilityData.graphicPixFormat) && + parcel.WriteInt32Vector(capabilityData.bitDepth) && + parcel.WriteInt32Vector(capabilityData.profiles) && + parcel.WriteInt32Vector(capabilityData.bitrateMode); +} + bool CodecListParcel::Marshalling(MessageParcel &parcel, const std::map &mapSizeToRange) { parcel.WriteUint32(mapSizeToRange.size()); @@ -146,11 +153,8 @@ bool CodecListParcel::Unmarshalling(MessageParcel &parcel, CapabilityData &capab capabilityData.blockPerSecond.maxVal = parcel.ReadInt32(); capabilityData.blockSize.width = parcel.ReadInt32(); capabilityData.blockSize.height = parcel.ReadInt32(); - parcel.ReadInt32Vector(&capabilityData.sampleRate); - parcel.ReadInt32Vector(&capabilityData.pixFormat); - parcel.ReadInt32Vector(&capabilityData.bitDepth); - parcel.ReadInt32Vector(&capabilityData.profiles); - parcel.ReadInt32Vector(&capabilityData.bitrateMode); + CHECK_AND_RETURN_RET_LOG(UnmarshallingInt32Vector(parcel, capabilityData), false, + "failed to Unmarshalling int32 vector"); CHECK_AND_RETURN_RET_LOG(Unmarshalling(parcel, capabilityData.measuredFrameRate), false, "failed to Unmarshalling measuredFrameRate vector"); CHECK_AND_RETURN_RET_LOG(Unmarshalling(parcel, capabilityData.profileLevelsMap), false, @@ -169,6 +173,16 @@ bool CodecListParcel::Unmarshalling(MessageParcel &parcel, CapabilityData &capab return true; } +bool CodecListParcel::UnmarshallingInt32Vector(MessageParcel &parcel, CapabilityData &capabilityData) +{ + return parcel.ReadInt32Vector(&capabilityData.sampleRate) && + parcel.ReadInt32Vector(&capabilityData.pixFormat) && + parcel.ReadInt32Vector(&capabilityData.graphicPixFormat) && + parcel.ReadInt32Vector(&capabilityData.bitDepth) && + parcel.ReadInt32Vector(&capabilityData.profiles) && + parcel.ReadInt32Vector(&capabilityData.bitrateMode); +} + bool CodecListParcel::Unmarshalling(MessageParcel &parcel, std::map &mapSizeToRange) { uint32_t size = parcel.ReadUint32(); diff --git a/services/services/sa_avcodec/ipc/codeclist_parcel.h b/services/services/sa_avcodec/ipc/codeclist_parcel.h index 9323e22ef..c89459af4 100644 --- a/services/services/sa_avcodec/ipc/codeclist_parcel.h +++ b/services/services/sa_avcodec/ipc/codeclist_parcel.h @@ -32,12 +32,14 @@ public: static bool Marshalling(MessageParcel &parcel, const std::map> &mapIntToVec); static bool Marshalling(MessageParcel &parcel, const std::map &mapIntToFormat); static bool Marshalling(MessageParcel &parcel, const std::vector &audioSampleRateRanges); + static bool MarshallingInt32Vector(MessageParcel &parcel, CapabilityData &capabilityData); static bool Unmarshalling(MessageParcel &parcel, CapabilityData &capabilityData); static bool Unmarshalling(MessageParcel &parcel, std::map &mapSizeToRange); static bool Unmarshalling(MessageParcel &parcel, std::map> &mapIntToVec); static bool Unmarshalling(MessageParcel &parcel, std::map &mapIntToFormat); static bool Unmarshalling(MessageParcel &parcel, std::vector &audioSampleRateRanges); + static bool UnmarshallingInt32Vector(MessageParcel &parcel, CapabilityData &capabilityData); }; } // namespace MediaAVCodec } // namespace OHOS diff --git a/test/unittest/codeclist_test/capi/codeclist_capi_mock.cpp b/test/unittest/codeclist_test/capi/codeclist_capi_mock.cpp index 493a3180d..b2d4f7f2d 100644 --- a/test/unittest/codeclist_test/capi/codeclist_capi_mock.cpp +++ b/test/unittest/codeclist_test/capi/codeclist_capi_mock.cpp @@ -337,6 +337,27 @@ std::vector CodecListCapiMock::GetVideoSupportedPixelFormats() return std::vector(); } +std::vector CodecListCapiMock::GetVideoSupportedGraphicPixelFormats() +{ + if (codeclist_ != nullptr) { + const int32_t *graphicFormats = nullptr; + uint32_t graphicFormatNum = 0; + int32_t ret = + OH_AVCapability_GetVideoSupportedNativeBufferFormats(codeclist_, &graphicFormats, &graphicFormatNum); + if (ret != AV_ERR_OK) { + std::cout << "OH_AVCapability_GetVideoSupportedNativeBufferFormats returns error: " << ret << std::endl; + return std::vector(); + } + + StackMemOverWrite(); + std::vector retVector = std::vector(graphicFormats, graphicFormats + graphicFormatNum); + std::sort(retVector.begin(), retVector.end()); + return retVector; + } + std::cout << "codeclist_ is nullptr" << std::endl; + return std::vector(); +} + std::vector CodecListCapiMock::GetSupportedProfiles() { if (codeclist_ != nullptr) { diff --git a/test/unittest/codeclist_test/capi/codeclist_capi_mock.h b/test/unittest/codeclist_test/capi/codeclist_capi_mock.h index 1e766e58c..53a1b284f 100644 --- a/test/unittest/codeclist_test/capi/codeclist_capi_mock.h +++ b/test/unittest/codeclist_test/capi/codeclist_capi_mock.h @@ -47,6 +47,7 @@ public: Range GetVideoFrameRateRangeForSize(int32_t width, int32_t height) override; bool AreVideoSizeAndFrameRateSupported(int32_t width, int32_t height, int32_t frameRate) override; std::vector GetVideoSupportedPixelFormats() override; + std::vector GetVideoSupportedGraphicPixelFormats() override; std::vector GetSupportedProfiles() override; std::vector GetSupportedLevelsForProfile(int32_t profile) override; bool AreProfileAndLevelSupported(int32_t profile, int32_t level) override; diff --git a/test/unittest/codeclist_test/caps_unit_test.cpp b/test/unittest/codeclist_test/caps_unit_test.cpp index 8283216c2..fa0db41e9 100644 --- a/test/unittest/codeclist_test/caps_unit_test.cpp +++ b/test/unittest/codeclist_test/caps_unit_test.cpp @@ -103,8 +103,14 @@ std::vector> CapsUnitTest::GetVideoDecoderCaps() { std::vector> ret; for (auto it : videoDecoderList) { - CapabilityData *capabilityData = avCodecList_->GetCapability(it, false, AVCodecCategory::AVCODEC_NONE); - ret.push_back(std::make_shared(capabilityData)); + CapabilityData *capabilityData = avCodecList_->GetCapability(it, false, AVCodecCategory::AVCODEC_HARDWARE); + if (capabilityData != 0) { + ret.push_back(std::make_shared(capabilityData)); + } + capabilityData = avCodecList_->GetCapability(it, false, AVCodecCategory::AVCODEC_SOFTWARE); + if (capabilityData != 0) { + ret.push_back(std::make_shared(capabilityData)); + } } return ret; } @@ -114,8 +120,14 @@ std::vector> CapsUnitTest::GetVideoEncoderCaps() std::vector> ret; if (isHardIncluded_) { for (auto it : videoEncoderList) { - CapabilityData *capabilityData = avCodecList_->GetCapability(it, true, AVCodecCategory::AVCODEC_NONE); - ret.push_back(std::make_shared(capabilityData)); + CapabilityData *capabilityData = avCodecList_->GetCapability(it, true, AVCodecCategory::AVCODEC_HARDWARE); + if (capabilityData != 0) { + ret.push_back(std::make_shared(capabilityData)); + } + capabilityData = avCodecList_->GetCapability(it, true, AVCodecCategory::AVCODEC_SOFTWARE); + if (capabilityData != 0) { + ret.push_back(std::make_shared(capabilityData)); + } } } return ret; @@ -163,28 +175,36 @@ void CapsUnitTest::CheckVideoCaps(const std::shared_ptr &videoCaps) c cout << "video codecName is : " << codecName << endl; if (codecName.compare(AVCodecCodecName::VIDEO_DECODER_AVC_NAME) == 0) { CheckAVDecAVC(videoCaps); + } else if (codecName.compare(AVCodecCodecName::VIDEO_DECODER_HEVC_NAME) == 0) { + CheckAVDecHEVC(videoCaps); + } else if (codecName.compare(AVCodecCodecName::VIDEO_DECODER_MPEG2_NAME) == 0) { + CheckAVDecMpeg2Video(videoCaps); + } else if (codecName.compare(AVCodecCodecName::VIDEO_DECODER_MPEG4_NAME) == 0) { + CheckAVDecMpeg4(videoCaps); + } else if (codecName.compare(AVCodecCodecName::VIDEO_DECODER_H263_NAME) == 0) { + CheckAVDecH263(videoCaps); } else if (codecName.compare("OMX.hisi.video.encoder.avc") == 0) { CheckAVEncAVC(videoCaps); } } -void CapsUnitTest::CheckAVDecH264(const std::shared_ptr &videoCaps) const +void CapsUnitTest::CheckAVDecHEVC(const std::shared_ptr &videoCaps) const { std::shared_ptr videoCodecCaps = videoCaps->GetCodecInfo(); EXPECT_EQ(AVCODEC_TYPE_VIDEO_DECODER, videoCodecCaps->GetType()); - EXPECT_EQ(CodecMimeType::VIDEO_AVC, videoCodecCaps->GetMimeType()); + EXPECT_EQ(CodecMimeType::VIDEO_HEVC, videoCodecCaps->GetMimeType()); EXPECT_EQ(0, videoCodecCaps->IsHardwareAccelerated()); EXPECT_EQ(1, videoCodecCaps->IsSoftwareOnly()); EXPECT_EQ(0, videoCodecCaps->IsVendor()); EXPECT_GE(1, videoCaps->GetSupportedBitrate().minVal); - EXPECT_LE(MAX_VIDEO_BITRATE, videoCaps->GetSupportedBitrate().maxVal); + EXPECT_LE(300000000, videoCaps->GetSupportedBitrate().maxVal); // 300000000: test value EXPECT_LE(0, videoCaps->GetSupportedWidthAlignment()); - EXPECT_GE(DEFAULT_WIDTH_RANGE.minVal, videoCaps->GetSupportedWidth().minVal); - EXPECT_LE(DEFAULT_WIDTH_RANGE.maxVal, videoCaps->GetSupportedWidth().maxVal); - EXPECT_GE(DEFAULT_HEIGHT_RANGE.minVal, videoCaps->GetSupportedHeight().minVal); - EXPECT_LE(DEFAULT_HEIGHT_RANGE.maxVal, videoCaps->GetSupportedHeight().maxVal); + EXPECT_GE(2, videoCaps->GetSupportedWidth().minVal); // 2: test value + EXPECT_LE(4096, videoCaps->GetSupportedWidth().maxVal); // 4096: test value + EXPECT_GE(2, videoCaps->GetSupportedHeight().minVal); // 2: test value + EXPECT_LE(4096, videoCaps->GetSupportedHeight().maxVal); // 4096: test value EXPECT_GE(1, videoCaps->GetSupportedFrameRate().minVal); - EXPECT_LE(DEFAULT_FRAMERATE_RANGE.maxVal, videoCaps->GetSupportedFrameRate().maxVal); + EXPECT_LE(120, videoCaps->GetSupportedFrameRate().maxVal); // 120: test value EXPECT_LE(0, videoCaps->GetSupportedEncodeQuality().minVal); EXPECT_LE(0, videoCaps->GetSupportedEncodeQuality().maxVal); EXPECT_LE(0, videoCaps->GetSupportedQuality().minVal); @@ -192,6 +212,7 @@ void CapsUnitTest::CheckAVDecH264(const std::shared_ptr &videoCaps) c EXPECT_LE(0, videoCaps->GetSupportedComplexity().minVal); EXPECT_LE(0, videoCaps->GetSupportedComplexity().maxVal); EXPECT_LT(0, videoCaps->GetSupportedFormats().size()); + EXPECT_LT(0, videoCaps->GetSupportedGraphicFormats().size()); EXPECT_LT(0, videoCaps->GetSupportedProfiles().size()); EXPECT_LE(0, videoCaps->GetSupportedBitrateMode().size()); EXPECT_LE(0, videoCaps->GetSupportedLevels().size()); @@ -209,15 +230,15 @@ void CapsUnitTest::CheckAVDecH263(const std::shared_ptr &videoCaps) c EXPECT_EQ(1, videoCodecCaps->IsSoftwareOnly()); EXPECT_EQ(0, videoCodecCaps->IsVendor()); EXPECT_GE(1, videoCaps->GetSupportedBitrate().minVal); - EXPECT_LE(MAX_VIDEO_BITRATE, videoCaps->GetSupportedBitrate().maxVal); + EXPECT_LE(300000000, videoCaps->GetSupportedBitrate().maxVal); // 300000000: test value EXPECT_LE(0, videoCaps->GetSupportedWidthAlignment()); EXPECT_LE(0, videoCaps->GetSupportedHeightAlignment()); - EXPECT_GE(DEFAULT_WIDTH_RANGE.minVal, videoCaps->GetSupportedWidth().minVal); - EXPECT_LE(DEFAULT_WIDTH_RANGE.maxVal, videoCaps->GetSupportedWidth().maxVal); - EXPECT_GE(DEFAULT_HEIGHT_RANGE.minVal, videoCaps->GetSupportedHeight().minVal); - EXPECT_LE(DEFAULT_HEIGHT_RANGE.maxVal, videoCaps->GetSupportedHeight().maxVal); + EXPECT_GE(20, videoCaps->GetSupportedWidth().minVal); // 20: test value + EXPECT_LE(2048, videoCaps->GetSupportedWidth().maxVal); // 2048: test value + EXPECT_GE(20, videoCaps->GetSupportedHeight().minVal); // 20: test value + EXPECT_LE(1152, videoCaps->GetSupportedHeight().maxVal); // 1152: test value EXPECT_GE(1, videoCaps->GetSupportedFrameRate().minVal); - EXPECT_LE(DEFAULT_FRAMERATE_RANGE.maxVal, videoCaps->GetSupportedFrameRate().maxVal); + EXPECT_LE(60, videoCaps->GetSupportedFrameRate().maxVal); EXPECT_LE(0, videoCaps->GetSupportedEncodeQuality().minVal); EXPECT_LE(0, videoCaps->GetSupportedEncodeQuality().maxVal); EXPECT_LE(0, videoCaps->GetSupportedQuality().minVal); @@ -225,6 +246,7 @@ void CapsUnitTest::CheckAVDecH263(const std::shared_ptr &videoCaps) c EXPECT_LE(0, videoCaps->GetSupportedComplexity().minVal); EXPECT_LE(0, videoCaps->GetSupportedComplexity().maxVal); EXPECT_LT(0, videoCaps->GetSupportedFormats().size()); + EXPECT_LT(0, videoCaps->GetSupportedGraphicFormats().size()); EXPECT_LT(0, videoCaps->GetSupportedProfiles().size()); EXPECT_LE(0, videoCaps->GetSupportedBitrateMode().size()); EXPECT_LE(0, videoCaps->GetSupportedLevels().size()); @@ -242,15 +264,15 @@ void CapsUnitTest::CheckAVDecMpeg2Video(const std::shared_ptr &videoC EXPECT_EQ(1, videoCodecCaps->IsSoftwareOnly()); EXPECT_EQ(0, videoCodecCaps->IsVendor()); EXPECT_GE(1, videoCaps->GetSupportedBitrate().minVal); - EXPECT_LE(MAX_VIDEO_BITRATE, videoCaps->GetSupportedBitrate().maxVal); + EXPECT_LE(300000000, videoCaps->GetSupportedBitrate().maxVal); // 300000000: test value EXPECT_LE(0, videoCaps->GetSupportedWidthAlignment()); EXPECT_LE(0, videoCaps->GetSupportedHeightAlignment()); - EXPECT_GE(DEFAULT_WIDTH_RANGE.minVal, videoCaps->GetSupportedWidth().minVal); - EXPECT_LE(DEFAULT_WIDTH_RANGE.maxVal, videoCaps->GetSupportedWidth().maxVal); - EXPECT_GE(DEFAULT_HEIGHT_RANGE.minVal, videoCaps->GetSupportedHeight().minVal); - EXPECT_LE(DEFAULT_HEIGHT_RANGE.maxVal, videoCaps->GetSupportedHeight().maxVal); + EXPECT_GE(2, videoCaps->GetSupportedWidth().minVal); // 2: test value + EXPECT_LE(4096, videoCaps->GetSupportedWidth().maxVal); // 4096: test value + EXPECT_GE(2, videoCaps->GetSupportedHeight().minVal); + EXPECT_LE(4096, videoCaps->GetSupportedHeight().maxVal); // 4096: test value EXPECT_GE(1, videoCaps->GetSupportedFrameRate().minVal); - EXPECT_LE(DEFAULT_FRAMERATE_RANGE.maxVal, videoCaps->GetSupportedFrameRate().maxVal); + EXPECT_LE(60, videoCaps->GetSupportedFrameRate().maxVal); // 60: test value EXPECT_LE(0, videoCaps->GetSupportedEncodeQuality().minVal); EXPECT_LE(0, videoCaps->GetSupportedEncodeQuality().maxVal); EXPECT_LE(0, videoCaps->GetSupportedQuality().minVal); @@ -258,11 +280,12 @@ void CapsUnitTest::CheckAVDecMpeg2Video(const std::shared_ptr &videoC EXPECT_LE(0, videoCaps->GetSupportedComplexity().minVal); EXPECT_LE(0, videoCaps->GetSupportedComplexity().maxVal); EXPECT_LT(0, videoCaps->GetSupportedFormats().size()); + EXPECT_LT(0, videoCaps->GetSupportedGraphicFormats().size()); EXPECT_LT(0, videoCaps->GetSupportedProfiles().size()); EXPECT_LE(0, videoCaps->GetSupportedBitrateMode().size()); EXPECT_LE(0, videoCaps->GetSupportedLevels().size()); EXPECT_EQ(false, videoCaps->IsSupportDynamicIframe()); - EXPECT_EQ(0, videoCaps->IsSizeAndRateSupported(videoCaps->GetSupportedWidth().minVal, + EXPECT_EQ(true, videoCaps->IsSizeAndRateSupported(videoCaps->GetSupportedWidth().minVal, videoCaps->GetSupportedHeight().maxVal, videoCaps->GetSupportedFrameRate().maxVal)); EXPECT_EQ(false, videoCaps->IsSizeAndRateSupported(videoCaps->GetSupportedWidth().minVal - 1, @@ -279,15 +302,15 @@ void CapsUnitTest::CheckAVDecMpeg4(const std::shared_ptr &videoCaps) EXPECT_EQ(1, videoCodecCaps->IsSoftwareOnly()); EXPECT_EQ(0, videoCodecCaps->IsVendor()); EXPECT_GE(1, videoCaps->GetSupportedBitrate().minVal); - EXPECT_LE(MAX_VIDEO_BITRATE, videoCaps->GetSupportedBitrate().maxVal); + EXPECT_LE(300000000, videoCaps->GetSupportedBitrate().maxVal); // 300000000: test value EXPECT_LE(0, videoCaps->GetSupportedWidthAlignment()); EXPECT_LE(0, videoCaps->GetSupportedHeightAlignment()); - EXPECT_GE(DEFAULT_WIDTH_RANGE.minVal, videoCaps->GetSupportedWidth().minVal); - EXPECT_LE(DEFAULT_WIDTH_RANGE.maxVal, videoCaps->GetSupportedWidth().maxVal); - EXPECT_GE(DEFAULT_HEIGHT_RANGE.minVal, videoCaps->GetSupportedHeight().minVal); - EXPECT_LE(DEFAULT_HEIGHT_RANGE.maxVal, videoCaps->GetSupportedHeight().maxVal); + EXPECT_GE(2, videoCaps->GetSupportedWidth().minVal); // 2: test value + EXPECT_LE(4096, videoCaps->GetSupportedWidth().maxVal); // 4096: test value + EXPECT_GE(2, videoCaps->GetSupportedHeight().minVal); // 2: test value + EXPECT_LE(4096, videoCaps->GetSupportedHeight().maxVal); // 4096: test value EXPECT_GE(1, videoCaps->GetSupportedFrameRate().minVal); - EXPECT_LE(DEFAULT_FRAMERATE_RANGE.maxVal, videoCaps->GetSupportedFrameRate().maxVal); + EXPECT_LE(60, videoCaps->GetSupportedFrameRate().maxVal); // 60: test value EXPECT_LE(0, videoCaps->GetSupportedEncodeQuality().minVal); EXPECT_LE(0, videoCaps->GetSupportedEncodeQuality().maxVal); EXPECT_LE(0, videoCaps->GetSupportedQuality().minVal); @@ -295,6 +318,7 @@ void CapsUnitTest::CheckAVDecMpeg4(const std::shared_ptr &videoCaps) EXPECT_LE(0, videoCaps->GetSupportedComplexity().minVal); EXPECT_LE(0, videoCaps->GetSupportedComplexity().maxVal); EXPECT_LT(0, videoCaps->GetSupportedFormats().size()); + EXPECT_LT(0, videoCaps->GetSupportedGraphicFormats().size()); EXPECT_LT(0, videoCaps->GetSupportedProfiles().size()); EXPECT_LE(0, videoCaps->GetSupportedBitrateMode().size()); EXPECT_LE(0, videoCaps->GetSupportedLevels().size()); @@ -313,15 +337,15 @@ void CapsUnitTest::CheckAVDecAVC(const std::shared_ptr &videoCaps) co EXPECT_EQ(1, videoCodecCaps->IsSoftwareOnly()); EXPECT_EQ(0, videoCodecCaps->IsVendor()); EXPECT_GE(1, videoCaps->GetSupportedBitrate().minVal); - EXPECT_LE(MAX_VIDEO_BITRATE, videoCaps->GetSupportedBitrate().maxVal); - EXPECT_GE(DEFAULT_WIDTH_ALIGNMENT, videoCaps->GetSupportedWidthAlignment()); - EXPECT_GE(DEFAULT_HEIGHT_ALIGNMENT, videoCaps->GetSupportedHeightAlignment()); - EXPECT_GE(DEFAULT_WIDTH_RANGE.minVal, videoCaps->GetSupportedWidth().minVal); - EXPECT_LE(DEFAULT_WIDTH_RANGE.maxVal, videoCaps->GetSupportedWidth().maxVal); - EXPECT_GE(DEFAULT_HEIGHT_RANGE.minVal, videoCaps->GetSupportedHeight().minVal); - EXPECT_LE(DEFAULT_HEIGHT_RANGE.maxVal, videoCaps->GetSupportedHeight().maxVal); - EXPECT_GE(DEFAULT_FRAMERATE_RANGE.minVal, videoCaps->GetSupportedFrameRate().minVal); - EXPECT_LE(DEFAULT_FRAMERATE_RANGE.maxVal, videoCaps->GetSupportedFrameRate().maxVal); + EXPECT_LE(300000000, videoCaps->GetSupportedBitrate().maxVal); // 300000000: test value + EXPECT_GE(2, videoCaps->GetSupportedWidthAlignment()); // 2: test value + EXPECT_GE(2, videoCaps->GetSupportedHeightAlignment()); // 2: test value + EXPECT_GE(2, videoCaps->GetSupportedWidth().minVal); // 2: test value + EXPECT_LE(4096, videoCaps->GetSupportedWidth().maxVal); // 4096: test value + EXPECT_GE(2, videoCaps->GetSupportedHeight().minVal); // 2: test value + EXPECT_LE(4096, videoCaps->GetSupportedHeight().maxVal); // 4096: test value + EXPECT_GE(0, videoCaps->GetSupportedFrameRate().minVal); + EXPECT_LE(120, videoCaps->GetSupportedFrameRate().maxVal); // 120: test value EXPECT_LE(0, videoCaps->GetSupportedEncodeQuality().minVal); EXPECT_LE(0, videoCaps->GetSupportedEncodeQuality().maxVal); EXPECT_LE(0, videoCaps->GetSupportedQuality().minVal); @@ -329,6 +353,7 @@ void CapsUnitTest::CheckAVDecAVC(const std::shared_ptr &videoCaps) co EXPECT_LE(0, videoCaps->GetSupportedComplexity().minVal); EXPECT_LE(0, videoCaps->GetSupportedComplexity().maxVal); EXPECT_LT(0, videoCaps->GetSupportedFormats().size()); + EXPECT_LT(0, videoCaps->GetSupportedGraphicFormats().size()); EXPECT_LT(0, videoCaps->GetSupportedProfiles().size()); EXPECT_LE(0, videoCaps->GetSupportedBitrateMode().size()); EXPECT_LE(0, videoCaps->GetSupportedLevels().size()); @@ -346,24 +371,25 @@ void CapsUnitTest::CheckAVEncAVC(const std::shared_ptr &videoCaps) co EXPECT_EQ(1, videoCodecCaps->IsHardwareAccelerated()); EXPECT_EQ(0, videoCodecCaps->IsSoftwareOnly()); EXPECT_EQ(1, videoCodecCaps->IsVendor()); - EXPECT_GE(DEFAULT_BITRATE_RANGE_ENC.minVal, videoCaps->GetSupportedBitrate().minVal); - EXPECT_LE(DEFAULT_BITRATE_RANGE_ENC.maxVal, videoCaps->GetSupportedBitrate().maxVal); - EXPECT_GE(DEFAULT_ALIGNMENT_ENC, videoCaps->GetSupportedWidthAlignment()); - EXPECT_GE(DEFAULT_ALIGNMENT_ENC, videoCaps->GetSupportedHeightAlignment()); - EXPECT_GE(DEFAULT_WIDTH_RANGE_ENC.minVal, videoCaps->GetSupportedWidth().minVal); - EXPECT_LE(DEFAULT_WIDTH_RANGE_ENC.maxVal, videoCaps->GetSupportedWidth().maxVal); - EXPECT_GE(DEFAULT_HEIGHT_RANGE_ENC.minVal, videoCaps->GetSupportedHeight().minVal); - EXPECT_LE(DEFAULT_HEIGHT_RANGE_ENC.maxVal, videoCaps->GetSupportedHeight().maxVal); + EXPECT_GE(10000, videoCaps->GetSupportedBitrate().minVal); // 10000: test value + EXPECT_LE(100000000, videoCaps->GetSupportedBitrate().maxVal); // 100000000: test value + EXPECT_GE(4, videoCaps->GetSupportedWidthAlignment()); // 4: test value + EXPECT_GE(4, videoCaps->GetSupportedHeightAlignment()); // 4: test value + EXPECT_GE(144, videoCaps->GetSupportedWidth().minVal); // 144: test value + EXPECT_LE(4096, videoCaps->GetSupportedWidth().maxVal); // 4096: test value + EXPECT_GE(144, videoCaps->GetSupportedHeight().minVal); // 144: test value + EXPECT_LE(4096, videoCaps->GetSupportedHeight().maxVal); // 4096: test value EXPECT_GE(1, videoCaps->GetSupportedFrameRate().minVal); - EXPECT_LE(DEFAULT_FRAMERATE_RANGE.maxVal, videoCaps->GetSupportedFrameRate().maxVal); - EXPECT_GE(DEFAULT_VIDEO_QUALITY_RANGE.minVal, videoCaps->GetSupportedEncodeQuality().minVal); - EXPECT_LE(DEFAULT_VIDEO_QUALITY_RANGE.maxVal, videoCaps->GetSupportedEncodeQuality().maxVal); + EXPECT_LE(120, videoCaps->GetSupportedFrameRate().maxVal); // 120: test value + EXPECT_GE(0, videoCaps->GetSupportedEncodeQuality().minVal); + EXPECT_LE(100, videoCaps->GetSupportedEncodeQuality().maxVal); // 100: test value EXPECT_LE(0, videoCaps->GetSupportedQuality().minVal); EXPECT_LE(0, videoCaps->GetSupportedQuality().maxVal); EXPECT_LE(0, videoCaps->GetSupportedComplexity().minVal); EXPECT_LE(0, videoCaps->GetSupportedComplexity().maxVal); - EXPECT_TRUE(!videoCaps->GetSupportedFormats().empty()); - EXPECT_LE(DEFAULT_BITRATEMODE_ENC, videoCaps->GetSupportedBitrateMode().size()); + EXPECT_LT(0, videoCaps->GetSupportedFormats().size()); + EXPECT_LT(0, videoCaps->GetSupportedGraphicFormats().size()); + EXPECT_LE(3, videoCaps->GetSupportedBitrateMode().size()); // 3: test value EXPECT_LE(0, videoCaps->GetSupportedLevels().size()); EXPECT_EQ(false, videoCaps->IsSupportDynamicIframe()); EXPECT_EQ(false, videoCaps->IsSizeAndRateSupported(videoCaps->GetSupportedWidth().minVal, @@ -371,37 +397,6 @@ void CapsUnitTest::CheckAVEncAVC(const std::shared_ptr &videoCaps) co videoCaps->GetSupportedFrameRate().maxVal + 1)); } -void CapsUnitTest::CheckAVEncMpeg4(const std::shared_ptr &videoCaps) const -{ - std::shared_ptr videoCodecCaps = videoCaps->GetCodecInfo(); - EXPECT_EQ(AVCODEC_TYPE_VIDEO_ENCODER, videoCodecCaps->GetType()); - EXPECT_EQ(CodecMimeType::VIDEO_MPEG4, videoCodecCaps->GetMimeType()); - EXPECT_EQ(0, videoCodecCaps->IsHardwareAccelerated()); - EXPECT_EQ(1, videoCodecCaps->IsSoftwareOnly()); - EXPECT_EQ(0, videoCodecCaps->IsVendor()); - EXPECT_GE(1, videoCaps->GetSupportedBitrate().minVal); - EXPECT_LE(MAX_VIDEO_BITRATE, videoCaps->GetSupportedBitrate().maxVal); - EXPECT_GE(0, videoCaps->GetSupportedWidthAlignment()); - EXPECT_GE(0, videoCaps->GetSupportedHeightAlignment()); - EXPECT_GE(DEFAULT_WIDTH_RANGE.minVal, videoCaps->GetSupportedWidth().minVal); - EXPECT_LE(DEFAULT_WIDTH, videoCaps->GetSupportedWidth().maxVal); - EXPECT_GE(DEFAULT_HEIGHT_RANGE.minVal, videoCaps->GetSupportedHeight().minVal); - EXPECT_LE(DEFAULT_HEIGHT, videoCaps->GetSupportedHeight().maxVal); - EXPECT_GE(DEFAULT_FRAMERATE_RANGE.minVal, videoCaps->GetSupportedFrameRate().minVal); - EXPECT_LE(DEFAULT_FRAMERATE_RANGE.maxVal, videoCaps->GetSupportedFrameRate().maxVal); - EXPECT_LE(0, videoCaps->GetSupportedEncodeQuality().minVal); - EXPECT_LE(0, videoCaps->GetSupportedEncodeQuality().maxVal); - EXPECT_LE(0, videoCaps->GetSupportedQuality().minVal); - EXPECT_LE(0, videoCaps->GetSupportedQuality().maxVal); - EXPECT_LE(0, videoCaps->GetSupportedComplexity().minVal); - EXPECT_LE(0, videoCaps->GetSupportedComplexity().maxVal); - EXPECT_LT(0, videoCaps->GetSupportedFormats().size()); - EXPECT_LT(0, videoCaps->GetSupportedProfiles().size()); - EXPECT_LT(0, videoCaps->GetSupportedBitrateMode().size()); - EXPECT_LE(0, videoCaps->GetSupportedLevels().size()); - EXPECT_EQ(false, videoCaps->IsSupportDynamicIframe()); -} - void CapsUnitTest::CheckAudioCapsArray(const std::vector> &audioCapsArray) const { for (auto iter = audioCapsArray.begin(); iter != audioCapsArray.end(); iter++) { @@ -973,6 +968,11 @@ HWTEST_F(CapsUnitTest, AVCaps_NullvalToCapi_001, TestSize.Level1) EXPECT_EQ(pixFormats, nullptr); EXPECT_EQ(pixFormatNum, 0); + EXPECT_EQ(OH_AVCapability_GetVideoSupportedNativeBufferFormats(nullptr, &pixFormats, &pixFormatNum), + AV_ERR_INVALID_VAL); + EXPECT_EQ(pixFormats, nullptr); + EXPECT_EQ(pixFormatNum, 0); + const int32_t *profiles = nullptr; uint32_t profileNum = -1; EXPECT_EQ(OH_AVCapability_GetSupportedProfiles(nullptr, &profiles, &profileNum), AV_ERR_INVALID_VAL); diff --git a/test/unittest/codeclist_test/caps_unit_test.h b/test/unittest/codeclist_test/caps_unit_test.h index d380d7850..0a300cecb 100644 --- a/test/unittest/codeclist_test/caps_unit_test.h +++ b/test/unittest/codeclist_test/caps_unit_test.h @@ -29,13 +29,12 @@ public: protected: std::shared_ptr avCodecList_ = nullptr; - void CheckAVDecH264(const std::shared_ptr &videoCaps) const; void CheckAVDecH263(const std::shared_ptr &videoCaps) const; void CheckAVDecMpeg2Video(const std::shared_ptr &videoCaps) const; void CheckAVDecMpeg4(const std::shared_ptr &videoCaps) const; void CheckAVDecAVC(const std::shared_ptr &videoCaps) const; + void CheckAVDecHEVC(const std::shared_ptr &videoCaps) const; void CheckAVEncAVC(const std::shared_ptr &videoCaps) const; - void CheckAVEncMpeg4(const std::shared_ptr &videoCaps) const; void CheckVideoCaps(const std::shared_ptr &videoCaps) const; void CheckVideoCapsArray(const std::vector> &videoCapsArray) const; void CheckAVDecMP3(const std::shared_ptr &audioCaps) const; diff --git a/test/unittest/codeclist_test/codeclist_mock.h b/test/unittest/codeclist_test/codeclist_mock.h index c46bfd4ac..23923f4cb 100644 --- a/test/unittest/codeclist_test/codeclist_mock.h +++ b/test/unittest/codeclist_test/codeclist_mock.h @@ -55,6 +55,7 @@ public: virtual Range GetVideoFrameRateRangeForSize(int32_t width, int32_t height) = 0; virtual bool AreVideoSizeAndFrameRateSupported(int32_t width, int32_t height, int32_t frameRate) = 0; virtual std::vector GetVideoSupportedPixelFormats() = 0; + virtual std::vector GetVideoSupportedGraphicPixelFormats() = 0; virtual std::vector GetSupportedProfiles() = 0; virtual std::vector GetSupportedLevelsForProfile(int32_t profile) = 0; virtual bool AreProfileAndLevelSupported(int32_t profile, int32_t level) = 0; @@ -140,7 +141,6 @@ constexpr int32_t ERROR_HEIGHT = 95; constexpr int32_t ERROR_VIDEO_AVC_PROFILE = -1; constexpr int32_t ERROR_LEVEL = -1; -constexpr uint32_t MAX_VIDEO_BITRATE = 300000000; constexpr uint32_t MAX_AUDIO_BITRATE = 320000; constexpr uint32_t MIN_AUDIO_BITRATE = 32000; constexpr uint32_t MAX_AUDIO_BITRATE_AAC = 500000; @@ -156,9 +156,16 @@ constexpr int AUDIO_SAMPLE_RATE_COUNT_VIVID = 5; constexpr int32_t STACK_BUF_OVERWRITE_MAX_BUF_SIZE = 100; constexpr int32_t STACK_BUF_OVERWRITE_TIMES = 1000; -const std::vector videoDecoderList = {std::string(CodecMimeType::VIDEO_AVC)}; +const std::vector videoDecoderList = { + std::string(CodecMimeType::VIDEO_H263), std::string(CodecMimeType::VIDEO_AVC), + std::string(CodecMimeType::VIDEO_MPEG2), std::string(CodecMimeType::VIDEO_HEVC), + std::string(CodecMimeType::VIDEO_MPEG4), +}; -const std::vector videoEncoderList = {std::string(CodecMimeType::VIDEO_AVC)}; +const std::vector videoEncoderList = { + std::string(CodecMimeType::VIDEO_AVC), + std::string(CodecMimeType::VIDEO_HEVC), +}; const std::vector audioDecoderList = { std::string(CodecMimeType::AUDIO_MPEG), std::string(CodecMimeType::AUDIO_AAC), diff --git a/test/unittest/codeclist_test/inner/codeclist_inner_mock.cpp b/test/unittest/codeclist_test/inner/codeclist_inner_mock.cpp index 6c03521d5..ba7a5e137 100644 --- a/test/unittest/codeclist_test/inner/codeclist_inner_mock.cpp +++ b/test/unittest/codeclist_test/inner/codeclist_inner_mock.cpp @@ -221,6 +221,18 @@ std::vector CodecListInnerMock::GetVideoSupportedPixelFormats() return std::vector(); } +std::vector CodecListInnerMock::GetVideoSupportedGraphicPixelFormats() +{ + if (codeclist_ != nullptr) { + std::shared_ptr codecInfo = std::make_shared(capabilityData_); + auto ret = codecInfo->GetSupportedGraphicFormats(); + std::sort(ret.begin(), ret.end()); + return ret; + } + std::cout << "codeclist_ is nullptr" << std::endl; + return std::vector(); +} + std::vector CodecListInnerMock::GetSupportedProfiles() { if (codeclist_ != nullptr && capabilityData_ != nullptr) { diff --git a/test/unittest/codeclist_test/inner/codeclist_inner_mock.h b/test/unittest/codeclist_test/inner/codeclist_inner_mock.h index d13b569dd..2d2d0e845 100644 --- a/test/unittest/codeclist_test/inner/codeclist_inner_mock.h +++ b/test/unittest/codeclist_test/inner/codeclist_inner_mock.h @@ -48,6 +48,7 @@ public: Range GetVideoFrameRateRangeForSize(int32_t width, int32_t height) override; bool AreVideoSizeAndFrameRateSupported(int32_t width, int32_t height, int32_t frameRate) override; std::vector GetVideoSupportedPixelFormats() override; + std::vector GetVideoSupportedGraphicPixelFormats() override; std::vector GetSupportedProfiles() override; std::vector GetSupportedLevelsForProfile(int32_t profile) override; bool AreProfileAndLevelSupported(int32_t profile, int32_t level) override; -- Gitee