1 /* 2 * Copyright (C) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef CODECLIST_CAPI_MOCK_H 17 #define CODECLIST_CAPI_MOCK_H 18 19 #include <algorithm> 20 #include "avcodec_common.h" 21 #include "avformat_inner_mock.h" 22 #include "codeclist_mock.h" 23 24 namespace OHOS { 25 namespace MediaAVCodec { 26 class CodecListInnerMock : public CodecListMock { 27 public: CodecListInnerMock(std::shared_ptr<AVCodecList> codeclist,CapabilityData * capabilityData)28 explicit CodecListInnerMock(std::shared_ptr<AVCodecList> codeclist, CapabilityData *capabilityData) 29 : codeclist_(codeclist), capabilityData_(capabilityData) {}; 30 ~CodecListInnerMock() = default; 31 bool IsHardware() override; 32 std::string GetName() override; 33 int32_t GetMaxSupportedInstances() override; // return is not errcode 34 Range GetEncoderBitrateRange() override; 35 bool IsEncoderBitrateModeSupported(OH_BitrateMode bitrateMode) override; 36 Range GetEncoderQualityRange() override; 37 Range GetEncoderComplexityRange() override; 38 std::vector<int32_t> GetAudioSupportedSampleRates() override; 39 Range GetAudioChannelsRange() override; 40 int32_t GetVideoWidthAlignment() override; 41 int32_t GetVideoHeightAlignment() override; 42 Range GetVideoWidthRangeForHeight(int32_t height) override; 43 Range GetVideoHeightRangeForWidth(int32_t width) override; 44 Range GetVideoWidthRange() override; 45 Range GetVideoHeightRange() override; 46 bool IsVideoSizeSupported(int32_t width, int32_t height) override; 47 Range GetVideoFrameRateRange() override; 48 Range GetVideoFrameRateRangeForSize(int32_t width, int32_t height) override; 49 bool AreVideoSizeAndFrameRateSupported(int32_t width, int32_t height, int32_t frameRate) override; 50 std::vector<int32_t> GetVideoSupportedPixelFormats() override; 51 std::vector<int32_t> GetSupportedProfiles() override; 52 std::vector<int32_t> GetSupportedLevelsForProfile(int32_t profile) override; 53 bool AreProfileAndLevelSupported(int32_t profile, int32_t level) override; 54 55 private: 56 std::shared_ptr<AVCodecList> codeclist_ = nullptr; 57 CapabilityData *capabilityData_; 58 }; 59 } // namespace MediaAVCodec 60 } // namespace OHOS 61 #endif // CODECLIST_INNER_MOCK_H 62