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 I_STANDARD_CODEC_SERVICE_H
17 #define I_STANDARD_CODEC_SERVICE_H
18 
19 #include "av_codec_service_ipc_interface_code.h"
20 #include "avcodec_common.h"
21 #include "avcodec_info.h"
22 #include "buffer/avsharedmemory.h"
23 #include "ipc_types.h"
24 #include "iremote_broker.h"
25 #include "iremote_proxy.h"
26 #include "iremote_stub.h"
27 #include "surface.h"
28 #include "foundation/multimedia/drm_framework/services/drm_service/ipc/i_keysession_service.h"
29 namespace OHOS {
30 namespace MediaAVCodec {
31 class IStandardCodecService : public IRemoteBroker {
32 public:
33     virtual ~IStandardCodecService() = default;
34 
35     virtual int32_t SetListenerObject(const sptr<IRemoteObject> &object) = 0;
36 
37     virtual int32_t Init(AVCodecType type, bool isMimeType, const std::string &name, Media::Meta &callerInfo) = 0;
38     virtual int32_t Configure(const Format &format) = 0;
39     virtual int32_t Prepare() = 0;
40     virtual int32_t Start() = 0;
41     virtual int32_t Stop() = 0;
42     virtual int32_t Flush() = 0;
43     virtual int32_t Reset() = 0;
44     virtual int32_t Release() = 0;
45     virtual int32_t NotifyEos() = 0;
46     virtual sptr<Surface> CreateInputSurface() = 0;
47     virtual int32_t SetOutputSurface(sptr<Surface> surface) = 0;
48     virtual int32_t QueueInputBuffer(uint32_t index, AVCodecBufferInfo info, AVCodecBufferFlag flag) = 0;
49     virtual int32_t QueueInputBuffer(uint32_t index) = 0;
50     virtual int32_t QueueInputParameter(uint32_t index) = 0;
51     virtual int32_t GetOutputFormat(Format &format) = 0;
52     virtual int32_t ReleaseOutputBuffer(uint32_t index, bool render) = 0;
53     virtual int32_t RenderOutputBufferAtTime(uint32_t index, int64_t renderTimestampNs) = 0;
54     virtual int32_t SetParameter(const Format &format) = 0;
55     virtual int32_t GetInputFormat(Format &format) = 0;
SetDecryptConfig(const sptr<DrmStandard::IMediaKeySessionService> & keySession,const bool svpFlag)56     virtual int32_t SetDecryptConfig(const sptr<DrmStandard::IMediaKeySessionService> &keySession,
57         const bool svpFlag)
58     {
59         (void)keySession;
60         (void)svpFlag;
61         return 0;
62     }
63     virtual int32_t SetCustomBuffer(std::shared_ptr<AVBuffer> buffer) = 0;
64 
65     virtual int32_t DestroyStub() = 0;
66     DECLARE_INTERFACE_DESCRIPTOR(u"IStandardCodecService");
67 };
68 } // namespace MediaAVCodec
69 } // namespace OHOS
70 #endif // I_STANDARD_CODEC_SERVICE_H
71