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 VIDEO_CODEC_LOADER_H 17 #define VIDEO_CODEC_LOADER_H 18 #include "codecbase.h" 19 #include "codeclistbase.h" 20 21 namespace OHOS { 22 namespace MediaAVCodec { 23 class VideoCodecLoader { 24 public: VideoCodecLoader(const char * libPath,const char * createFuncName,const char * getCapsFuncName)25 VideoCodecLoader(const char *libPath, const char *createFuncName, const char *getCapsFuncName) 26 : libPath_(libPath), createFuncName_(createFuncName), getCapsFuncName_(getCapsFuncName){}; 27 ~VideoCodecLoader() = default; 28 29 std::shared_ptr<CodecBase> Create(const std::string &name); 30 int32_t GetCaps(std::vector<CapabilityData> &caps); 31 32 int32_t Init(); 33 void Close(); 34 35 private: 36 using CreateByNameFuncType = void (*)(const std::string &name, std::shared_ptr<CodecBase> &codec); 37 using GetCapabilityFuncType = int32_t (*)(std::vector<CapabilityData> &caps); 38 std::shared_ptr<void> codecHandle_ = nullptr; 39 CreateByNameFuncType createFunc_ = nullptr; 40 GetCapabilityFuncType getCapsFunc_ = nullptr; 41 const char *libPath_ = nullptr; 42 const char *createFuncName_ = nullptr; 43 const char *getCapsFuncName_ = nullptr; 44 }; 45 } // namespace MediaAVCodec 46 } // namespace OHOS 47 #endif