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_CORE_H 17 #define CODECLIST_CORE_H 18 19 #include <mutex> 20 #include "nocopyable.h" 21 #include "format.h" 22 #include "codeclist_utils.h" 23 #include "avcodec_info.h" 24 25 namespace OHOS { 26 namespace MediaAVCodec { 27 class __attribute__((visibility("default"))) CodecListCore : public NoCopyable { 28 public: 29 CodecListCore(); 30 ~CodecListCore(); 31 std::string FindEncoder(const Format &format); 32 std::string FindDecoder(const Format &format); 33 CodecType FindCodecType(std::string codecName); 34 int32_t GetCapability(CapabilityData &capData, const std::string &mime, const bool isEncoder, 35 const AVCodecCategory &category); 36 37 private: 38 bool CheckBitrate(const Format &format, const CapabilityData &data); 39 bool CheckVideoResolution(const Format &format, const CapabilityData &data); 40 bool CheckVideoPixelFormat(const Format &format, const CapabilityData &data); 41 bool CheckVideoFrameRate(const Format &format, const CapabilityData &data); 42 bool CheckAudioChannel(const Format &format, const CapabilityData &data); 43 bool CheckAudioSampleRate(const Format &format, const CapabilityData &data); 44 bool IsVideoCapSupport(const Format &format, const CapabilityData &data); 45 bool IsAudioCapSupport(const Format &format, const CapabilityData &data); 46 std::string FindCodec(const Format &format, bool isEncoder); 47 std::mutex mutex_; 48 }; 49 } // namespace MediaAVCodec 50 } // namespace OHOS 51 #endif // CODECLIST_CORE_H 52