1 /* 2 * Copyright (c) 2022-2022 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 HISTREAMER_PIPELINE_VIDEO_ASYNC_DECODER_FILTER_H 17 #define HISTREAMER_PIPELINE_VIDEO_ASYNC_DECODER_FILTER_H 18 19 #ifdef VIDEO_SUPPORT 20 21 #include "filters/codec/codec_filter_base.h" 22 23 namespace OHOS { 24 namespace Media { 25 namespace Pipeline { 26 class VideoDecoderFilter : public CodecFilterBase { 27 public: 28 explicit VideoDecoderFilter(const std::string &name, std::shared_ptr<CodecMode>& codecMode); 29 ~VideoDecoderFilter() override; 30 31 ErrorCode Prepare() override; 32 33 ErrorCode Start() override; 34 35 ErrorCode Stop() override; 36 37 void FlushStart() override; 38 39 void FlushEnd() override; 40 41 bool Negotiate(const std::string& inPort, 42 const std::shared_ptr<const Plugin::Capability>& upstreamCap, 43 Plugin::Capability& negotiatedCap, 44 const Plugin::TagMap& upstreamParams, 45 Plugin::TagMap& downstreamParams) override; 46 47 bool Configure(const std::string &inPort, const std::shared_ptr<const Plugin::Meta> &upstreamMeta, 48 Plugin::TagMap &upstreamParams, Plugin::TagMap &downstreamParams) override; 49 50 ErrorCode PushData(const std::string &inPort, const AVBufferPtr& buffer, int64_t offset) override; 51 52 void OnInputBufferDone(const std::shared_ptr<Plugin::Buffer>& input) override; 53 54 void OnOutputBufferDone(const std::shared_ptr<Plugin::Buffer>& output) override; 55 56 private: 57 uint32_t GetOutBufferPoolSize() override; 58 59 std::shared_ptr<Allocator> GetAllocator() override; 60 61 Plugin::TagMap GetNegotiateParams(const Plugin::TagMap& upstreamParams) override; 62 63 uint32_t CalculateBufferSize(const std::shared_ptr<const OHOS::Media::Plugin::Meta> &meta) override; 64 65 void UpdateParams(const std::shared_ptr<const Plugin::Meta>& upMeta, 66 std::shared_ptr<Plugin::Meta>& meta) override; 67 }; 68 } 69 } 70 } 71 #endif // VIDEO_SUPPORT 72 #endif // HISTREAMER_PIPELINE_VIDEO_ASYNC_DECODER_FILTER_H