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_capi_mock.h" 22 #include "codeclist_mock.h" 23 24 namespace OHOS { 25 namespace MediaAVCodec { 26 class CodecListCapiMock : public CodecListMock { 27 public: CodecListCapiMock(OH_AVCapability * codeclist)28 explicit CodecListCapiMock(OH_AVCapability *codeclist) : codeclist_(codeclist) {}; 29 ~CodecListCapiMock() = default; 30 bool IsHardware() override; 31 std::string GetName() override; 32 int32_t GetMaxSupportedInstances() override; // return is not errcode 33 Range GetEncoderBitrateRange() override; 34 bool IsEncoderBitrateModeSupported(OH_BitrateMode bitrateMode) override; 35 Range GetEncoderQualityRange() override; 36 Range GetEncoderComplexityRange() override; 37 std::vector<int32_t> GetAudioSupportedSampleRates() override; 38 Range GetAudioChannelsRange() override; 39 int32_t GetVideoWidthAlignment() override; 40 int32_t GetVideoHeightAlignment() override; 41 Range GetVideoWidthRangeForHeight(int32_t height) override; 42 Range GetVideoHeightRangeForWidth(int32_t width) override; 43 Range GetVideoWidthRange() override; 44 Range GetVideoHeightRange() override; 45 bool IsVideoSizeSupported(int32_t width, int32_t height) override; 46 Range GetVideoFrameRateRange() override; 47 Range GetVideoFrameRateRangeForSize(int32_t width, int32_t height) override; 48 bool AreVideoSizeAndFrameRateSupported(int32_t width, int32_t height, int32_t frameRate) override; 49 std::vector<int32_t> GetVideoSupportedPixelFormats() override; 50 std::vector<int32_t> GetSupportedProfiles() override; 51 std::vector<int32_t> GetSupportedLevelsForProfile(int32_t profile) override; 52 bool AreProfileAndLevelSupported(int32_t profile, int32_t level) override; 53 54 private: 55 OH_AVCapability *codeclist_ = nullptr; 56 CapabilityData capabilityData_; 57 }; 58 } // namespace MediaAVCodec 59 } // namespace OHOS 60 #endif // CODECLIST_CAPI_MOCK_H