1 /* 2 * Copyright (C) 2021 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 A2DP_SBC_DYNAMIC_LIB_CTRL_H 17 #define A2DP_SBC_DYNAMIC_LIB_CTRL_H 18 #include "../../sbclib/include/sbc_codec.h" 19 20 namespace OHOS { 21 namespace bluetooth { 22 struct CODECSbcEncoder { 23 sbc::createSbcEncoder createSbcEncode; 24 sbc::destroySbcEncoder destroySbcEncode; 25 }; 26 27 struct CODECSbcDecoder { 28 sbc::createSbcDecoder createSbcDecode; 29 sbc::destroySbcDecoder destroySbcDecode; 30 }; 31 32 struct CODECSbcLib { 33 CODECSbcEncoder sbcEncoder; 34 CODECSbcDecoder sbcDecoder; 35 void *lib; 36 }; 37 38 class A2dpSBCDynamicLibCtrl { 39 public: 40 explicit A2dpSBCDynamicLibCtrl(bool isEncoder); 41 ~A2dpSBCDynamicLibCtrl(); 42 CODECSbcLib *LoadCodecSbcLib() const; 43 void UnloadCodecSbcLib(CODECSbcLib *lib) const; 44 45 private: 46 bool isEncoder_ = false; 47 }; 48 } // namespace bluetooth 49 } // namespace OHOS 50 #endif // A2DP_SBC_DYNAMIC_LIB_CTRL_H