• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef CODECBASE_H
16 #define CODECBASE_H
17 
18 #include <string>
19 #include "avcodec_common.h"
20 #include "avsharedmemorybase.h"
21 #include "surface.h"
22 
23 namespace OHOS {
24 namespace MediaAVCodec {
25 class CodecBase {
26 public:
27     CodecBase() = default;
28     virtual ~CodecBase() = default;
29     virtual int32_t SetCallback(const std::shared_ptr<AVCodecCallback> &callback) = 0;
30     virtual int32_t Configure(const Format &format) = 0;
31     virtual int32_t Start() = 0;
32     virtual int32_t Stop() = 0;
33     virtual int32_t Flush() = 0;
34     virtual int32_t Reset() = 0;
35     virtual int32_t Release() = 0;
36     virtual int32_t SetParameter(const Format& format) = 0;
37     virtual int32_t GetOutputFormat(Format& format) = 0;
38     virtual int32_t QueueInputBuffer(uint32_t index, const AVCodecBufferInfo &info, AVCodecBufferFlag flag) = 0;
39     virtual int32_t ReleaseOutputBuffer(uint32_t index) = 0;
40 
41     virtual int32_t NotifyEos();
42     virtual sptr<Surface> CreateInputSurface();
43     virtual int32_t SetOutputSurface(sptr<Surface> surface);
44     virtual int32_t RenderOutputBuffer(uint32_t index);
45     virtual int32_t SignalRequestIDRFrame();
46     virtual int32_t GetInputFormat(Format& format);
47 };
48 } // namespace MediaAVCodec
49 } // namespace OHOS
50 #endif // CODECBASE_H