1049e185fSopenharmony_ci/*
2049e185fSopenharmony_ci * Copyright (C) 2021 Huawei Device Co., Ltd.
3049e185fSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4049e185fSopenharmony_ci * you may not use this file except in compliance with the License.
5049e185fSopenharmony_ci * You may obtain a copy of the License at
6049e185fSopenharmony_ci *
7049e185fSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8049e185fSopenharmony_ci *
9049e185fSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10049e185fSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11049e185fSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12049e185fSopenharmony_ci * See the License for the specific language governing permissions and
13049e185fSopenharmony_ci * limitations under the License.
14049e185fSopenharmony_ci */
15049e185fSopenharmony_ci
16049e185fSopenharmony_ci#ifndef I_AVCODEC_SERVICE_H
17049e185fSopenharmony_ci#define I_AVCODEC_SERVICE_H
18049e185fSopenharmony_ci
19049e185fSopenharmony_ci#include <string>
20049e185fSopenharmony_ci#include "avcodec_common.h"
21049e185fSopenharmony_ci#include "avcodec_info.h"
22049e185fSopenharmony_ci#include "buffer/avsharedmemory.h"
23049e185fSopenharmony_ci#include "refbase.h"
24049e185fSopenharmony_ci#include "surface.h"
25049e185fSopenharmony_ci
26049e185fSopenharmony_cinamespace OHOS {
27049e185fSopenharmony_cinamespace Media {
28049e185fSopenharmony_ciclass IAVCodecService {
29049e185fSopenharmony_cipublic:
30049e185fSopenharmony_ci    virtual ~IAVCodecService() = default;
31049e185fSopenharmony_ci
32049e185fSopenharmony_ci    virtual int32_t InitParameter(AVCodecType type, bool isMimeType, const std::string &name) = 0;
33049e185fSopenharmony_ci    virtual int32_t Configure(const Format &format) = 0;
34049e185fSopenharmony_ci    virtual int32_t Prepare() = 0;
35049e185fSopenharmony_ci    virtual int32_t Start() = 0;
36049e185fSopenharmony_ci    virtual int32_t Stop() = 0;
37049e185fSopenharmony_ci    virtual int32_t Flush() = 0;
38049e185fSopenharmony_ci    virtual int32_t Reset() = 0;
39049e185fSopenharmony_ci    virtual int32_t Release() = 0;
40049e185fSopenharmony_ci    virtual int32_t NotifyEos() = 0;
41049e185fSopenharmony_ci    virtual sptr<Surface> CreateInputSurface() = 0;
42049e185fSopenharmony_ci    virtual int32_t SetOutputSurface(sptr<Surface> surface) = 0;
43049e185fSopenharmony_ci    virtual std::shared_ptr<AVSharedMemory> GetInputBuffer(uint32_t index) = 0;
44049e185fSopenharmony_ci    virtual int32_t QueueInputBuffer(uint32_t index, AVCodecBufferInfo info, AVCodecBufferFlag flag) = 0;
45049e185fSopenharmony_ci    virtual std::shared_ptr<AVSharedMemory> GetOutputBuffer(uint32_t index) = 0;
46049e185fSopenharmony_ci    virtual int32_t GetOutputFormat(Format &format) = 0;
47049e185fSopenharmony_ci    virtual int32_t ReleaseOutputBuffer(uint32_t index, bool render = false) = 0;
48049e185fSopenharmony_ci    virtual int32_t SetParameter(const Format &format) = 0;
49049e185fSopenharmony_ci    virtual int32_t SetCallback(const std::shared_ptr<AVCodecCallback> &callback) = 0;
50049e185fSopenharmony_ci};
51049e185fSopenharmony_ci} // namespace Media
52049e185fSopenharmony_ci} // namespace OHOS
53049e185fSopenharmony_ci#endif // I_AVCODEC_SERVICE_H