• 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 CODEC_SERVICE_PROXY_H
17 #define CODEC_SERVICE_PROXY_H
18 
19 #include "avcodec_dfx_component.h"
20 #include "avcodec_log.h"
21 #include "codec_listener_stub.h"
22 #include "i_standard_codec_service.h"
23 #include "nocopyable.h"
24 
25 namespace OHOS {
26 namespace MediaAVCodec {
27 class CodecServiceProxy : public IRemoteProxy<IStandardCodecService>, public AVCodecDfxComponent, public NoCopyable {
28 public:
29     explicit CodecServiceProxy(const sptr<IRemoteObject> &impl);
30     virtual ~CodecServiceProxy();
31 
32     int32_t SetListenerObject(const sptr<IRemoteObject> &object) override;
33 
34     int32_t Init(AVCodecType type, bool isMimeType, const std::string &name, Media::Meta &callerInfo) override;
35     int32_t Configure(const Format &format) override;
36     int32_t Prepare() override;
37     int32_t Start() override;
38     int32_t Stop() override;
39     int32_t Flush() override;
40     int32_t Reset() override;
41     int32_t Release() override;
42     int32_t GetChannelId(int32_t &channelId) override;
43     int32_t NotifyEos() override;
44     sptr<Surface> CreateInputSurface() override;
45     int32_t SetOutputSurface(sptr<Surface> surface) override;
46     int32_t SetLowPowerPlayerMode(bool isLpp) override;
47     int32_t QueueInputBuffer(uint32_t index, AVCodecBufferInfo info, AVCodecBufferFlag flag) override;
48     int32_t QueueInputBuffer(uint32_t index) override;
49     int32_t QueueInputParameter(uint32_t index) override;
50     int32_t GetOutputFormat(Format &format) override;
51     int32_t ReleaseOutputBuffer(uint32_t index, bool render) override;
52     int32_t RenderOutputBufferAtTime(uint32_t index, int64_t renderTimestampNs) override;
53     int32_t SetParameter(const Format &format) override;
54     int32_t GetInputFormat(Format &format) override;
55 
56     int32_t DestroyStub() override;
57 #ifdef SUPPORT_DRM
58     int32_t SetDecryptConfig(const sptr<DrmStandard::IMediaKeySessionService> &keySession,
59         const bool svpFlag) override;
60 #endif
61     void SetListener(const sptr<CodecListenerStub> &listener);
62     int32_t SetCustomBuffer(std::shared_ptr<AVBuffer> buffer) override;
63     int32_t NotifyMemoryExchange(const bool exchangeFlag) override;
64 
65 private:
66     static inline BrokerDelegator<CodecServiceProxy> delegator_;
67     sptr<CodecListenerStub> listener_;
68 };
69 } // namespace MediaAVCodec
70 } // namespace OHOS
71 #endif // CODEC_SERVICE_PROXY_H
72