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 "meta/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 Media::Format &format); 32 std::string FindDecoder(const Media::Format &format); 33 CodecType FindCodecType(std::string codecName); 34 std::vector<std::string> FindCodecNameArray(const std::string &mime, bool isEncoder); 35 int32_t GetCapability(CapabilityData &capData, const std::string &mime, const bool isEncoder, 36 const AVCodecCategory &category); 37 38 private: 39 bool CheckBitrate(const Media::Format &format, const CapabilityData &data); 40 bool CheckVideoResolution(const Media::Format &format, const CapabilityData &data); 41 bool CheckVideoPixelFormat(const Media::Format &format, const CapabilityData &data); 42 bool CheckVideoFrameRate(const Media::Format &format, const CapabilityData &data); 43 bool CheckAudioChannel(const Media::Format &format, const CapabilityData &data); 44 bool CheckAudioSampleRate(const Media::Format &format, const CapabilityData &data); 45 bool IsVideoCapSupport(const Media::Format &format, const CapabilityData &data); 46 bool IsAudioCapSupport(const Media::Format &format, const CapabilityData &data); 47 std::string FindCodec(const Media::Format &format, bool isEncoder); 48 std::mutex mutex_; 49 }; 50 } // namespace MediaAVCodec 51 } // namespace OHOS 52 #endif // CODECLIST_CORE_H 53