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 SBC_CODEC_H
17 #define SBC_CODEC_H
18 
19 #include <cstddef>
20 #include <cstdint>
21 #include <sys/types.h>
22 
23 #include "sbc_constant.h"
24 
25 namespace sbc {
26 class IEncoderBase {
27 public:
28     virtual ~IEncoderBase() = default;
29     virtual ssize_t SBCEncode(const CodecParam& codecParam, const uint8_t* in, size_t iLength, uint8_t* out,
30                    size_t oLength, size_t* written) = 0;
31 };
32 
33 class IDecoderBase {
34 public:
35     virtual ~IDecoderBase() = default;
36     virtual ssize_t SBCDecode(const CodecParam& codecParam, const uint8_t* in, size_t iLength,
37         uint8_t* out, size_t oLength, size_t* written) = 0;
38 };
39 
40 typedef IEncoderBase* (*createSbcEncoder)(void);
41 typedef void (*destroySbcEncoder)(IEncoderBase* p);
42 
43 typedef IDecoderBase* (*createSbcDecoder)(void);
44 typedef void (*destroySbcDecoder)(IDecoderBase* p);
45 }  // namespace sbc
46 #endif  // SBC_CODEC_H
47