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 BASE_CODER_PLUGIN
17 #define BASE_CODER_PLUGIN
18 
19 #include <string>
20 
21 #include "audio_buffer_info.h"
22 #include "av_codec_base_factory.h"
23 #include "meta/format.h"
24 #include "nocopyable.h"
25 
26 namespace OHOS {
27 namespace MediaAVCodec {
28 class AudioBaseCodec : public AVCodecBaseFactory<AudioBaseCodec, std::string>, public NoCopyable {
29 public:
30     AudioBaseCodec() = default;
31 
32     virtual ~AudioBaseCodec() = default;
33 
34     virtual int32_t Init(const Media::Format &format) = 0;
35 
36     virtual int32_t ProcessSendData(const std::shared_ptr<AudioBufferInfo> &inputBuffer) = 0;
37 
38     virtual int32_t ProcessRecieveData(std::shared_ptr<AudioBufferInfo> &outBuffer) = 0;
39 
40     virtual int32_t Reset() = 0;
41 
42     virtual int32_t Release() = 0;
43 
44     virtual int32_t Flush() = 0;
45 
46     virtual int32_t GetInputBufferSize() const = 0;
47 
48     virtual int32_t GetOutputBufferSize() const = 0;
49 
50     virtual Media::Format GetFormat() const noexcept = 0;
51 
52     virtual std::string_view GetCodecType() const noexcept = 0;
53 };
54 } // namespace MediaAVCodec
55 } // namespace OHOS
56 
57 #endif