1 /* 2 * Copyright (C) 2021 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 AVCODEC_SERVICE_PROXY_H 17 #define AVCODEC_SERVICE_PROXY_H 18 19 #include "i_standard_avcodec_service.h" 20 #include "nocopyable.h" 21 22 namespace OHOS { 23 namespace Media { 24 class AVCodecServiceProxy : public IRemoteProxy<IStandardAVCodecService>, public NoCopyable { 25 public: 26 explicit AVCodecServiceProxy(const sptr<IRemoteObject> &impl); 27 virtual ~AVCodecServiceProxy(); 28 29 int32_t SetListenerObject(const sptr<IRemoteObject> &object) override; 30 int32_t InitParameter(AVCodecType type, bool isMimeType, const std::string &name) override; 31 int32_t Configure(const Format &format) override; 32 int32_t Prepare() override; 33 int32_t Start() override; 34 int32_t Stop() override; 35 int32_t Flush() override; 36 int32_t Reset() override; 37 int32_t Release() override; 38 int32_t NotifyEos() override; 39 sptr<OHOS::Surface> CreateInputSurface() override; 40 int32_t SetOutputSurface(sptr<OHOS::Surface> surface) override; 41 std::shared_ptr<AVSharedMemory> GetInputBuffer(uint32_t index) override; 42 int32_t QueueInputBuffer(uint32_t index, AVCodecBufferInfo info, AVCodecBufferFlag flag) override; 43 std::shared_ptr<AVSharedMemory> GetOutputBuffer(uint32_t index) override; 44 int32_t GetOutputFormat(Format &format) override; 45 int32_t ReleaseOutputBuffer(uint32_t index, bool render) override; 46 int32_t SetParameter(const Format &format) override; 47 int32_t DestroyStub() override; 48 49 private: 50 static inline BrokerDelegator<AVCodecServiceProxy> delegator_; 51 52 class AVCodecBufferCache; 53 std::unique_ptr<AVCodecBufferCache> inputBufferCache_; 54 std::unique_ptr<AVCodecBufferCache> outputBufferCache_; 55 }; 56 } // namespace Media 57 } // namespace OHOS 58 #endif // AVCODEC_SERVICE_PROXY_H 59