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 #ifndef AVCODEC_VIDEO_DECODER_IMPL_H 16 #define AVCODEC_VIDEO_DECODER_IMPL_H 17 18 #include "avcodec_dfx_component.h" 19 #include "avcodec_video_decoder.h" 20 #include "nocopyable.h" 21 #include "i_avcodec_service.h" 22 23 namespace OHOS { 24 namespace MediaAVCodec { 25 class AVCodecVideoDecoderImpl : public AVCodecVideoDecoder, public AVCodecDfxComponent, public NoCopyable { 26 public: 27 AVCodecVideoDecoderImpl(); 28 ~AVCodecVideoDecoderImpl(); 29 30 int32_t Configure(const Format &format) override; 31 int32_t Prepare() override; 32 int32_t Start() override; 33 int32_t Stop() override; 34 int32_t Flush() override; 35 int32_t Reset() override; 36 int32_t Release() override; 37 int32_t SetOutputSurface(sptr<Surface> surface) override; 38 int32_t QueueInputBuffer(uint32_t index, AVCodecBufferInfo info, AVCodecBufferFlag flag) override; 39 int32_t QueueInputBuffer(uint32_t index) override; 40 int32_t GetOutputFormat(Format &format) override; 41 int32_t ReleaseOutputBuffer(uint32_t index, bool render) override; 42 int32_t RenderOutputBufferAtTime(uint32_t index, int64_t renderTimestampNs) override; 43 int32_t QueryInputBuffer(uint32_t &index, int64_t timeoutUs) override; 44 int32_t QueryOutputBuffer(uint32_t &index, int64_t timeoutUs) override; 45 std::shared_ptr<AVBuffer> GetInputBuffer(uint32_t index) override; 46 std::shared_ptr<AVBuffer> GetOutputBuffer(uint32_t index) override; 47 int32_t SetParameter(const Format &format) override; 48 int32_t SetCallback(const std::shared_ptr<AVCodecCallback> &callback) override; 49 int32_t SetCallback(const std::shared_ptr<MediaCodecCallback> &callback) override; 50 #ifdef SUPPORT_DRM 51 int32_t SetDecryptConfig(const sptr<DrmStandard::IMediaKeySessionService> &keySessionProxy, 52 const bool svpFlag) override; 53 #endif 54 int32_t GetChannelId(int32_t &channelId) override; 55 int32_t SetLowPowerPlayerMode(bool isLpp) override; 56 int32_t NotifyMemoryExchange(const bool exchangeFlag) override; 57 int32_t Init(AVCodecType type, bool isMimeType, const std::string &name, Format &format); 58 59 private: 60 std::shared_ptr<ICodecService> codecClient_ = nullptr; 61 }; 62 } // namespace MediaAVCodec 63 } // namespace OHOS 64 #endif // AVCODEC_VIDEO_DECODER_IMPL_H