• 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 
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 "drm_i_keysession_service.h"
29 
30 namespace OHOS {
31 namespace MediaAVCodec {
32 class IStandardCodecService : public IRemoteBroker {
33 public:
34     virtual ~IStandardCodecService() = default;
35 
36     virtual int32_t SetListenerObject(const sptr<IRemoteObject> &object) = 0;
37 
38     virtual int32_t Init(AVCodecType type, bool isMimeType, const std::string &name, Media::Meta &callerInfo) = 0;
39     virtual int32_t Configure(const Format &format) = 0;
40     virtual int32_t Prepare() = 0;
41     virtual int32_t Start() = 0;
42     virtual int32_t Stop() = 0;
43     virtual int32_t Flush() = 0;
44     virtual int32_t Reset() = 0;
45     virtual int32_t Release() = 0;
46     virtual int32_t GetChannelId(int32_t &channelId) = 0;
47     virtual int32_t NotifyEos() = 0;
48     virtual sptr<Surface> CreateInputSurface() = 0;
49     virtual int32_t SetOutputSurface(sptr<Surface> surface) = 0;
50     virtual int32_t SetLowPowerPlayerMode(bool isLpp) = 0;
51     virtual int32_t QueueInputBuffer(uint32_t index, AVCodecBufferInfo info, AVCodecBufferFlag flag) = 0;
52     virtual int32_t QueueInputBuffer(uint32_t index) = 0;
53     virtual int32_t QueueInputParameter(uint32_t index) = 0;
54     virtual int32_t GetOutputFormat(Format &format) = 0;
55     virtual int32_t ReleaseOutputBuffer(uint32_t index, bool render) = 0;
56     virtual int32_t RenderOutputBufferAtTime(uint32_t index, int64_t renderTimestampNs) = 0;
57     virtual int32_t SetParameter(const Format &format) = 0;
58     virtual int32_t GetInputFormat(Format &format) = 0;
SetDecryptConfig(const sptr<DrmStandard::IMediaKeySessionService> & keySession,const bool svpFlag)59     virtual int32_t SetDecryptConfig(const sptr<DrmStandard::IMediaKeySessionService> &keySession,
60         const bool svpFlag)
61     {
62         (void)keySession;
63         (void)svpFlag;
64         return 0;
65     }
66     virtual int32_t SetCustomBuffer(std::shared_ptr<AVBuffer> buffer) = 0;
67     virtual int32_t NotifyMemoryExchange(const bool exchangeFlag) = 0;
68 
69     virtual int32_t DestroyStub() = 0;
70     DECLARE_INTERFACE_DESCRIPTOR(u"IStandardCodecService");
71 };
72 } // namespace MediaAVCodec
73 } // namespace OHOS
74 #endif // I_STANDARD_CODEC_SERVICE_H
75