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_FILTER_AUDIO_DECODER_H 17 #define HISTREAMER_PIPELINE_FILTER_AUDIO_DECODER_H 18 19 #include "pipeline/filters/codec/codec_filter_base.h" 20 21 namespace OHOS { 22 namespace Media { 23 namespace Pipeline { 24 class AudioDecoderFilter : public CodecFilterBase { 25 public: 26 AudioDecoderFilter(const std::string& name, std::shared_ptr<CodecMode> codecMode); 27 ~AudioDecoderFilter() override; 28 29 ErrorCode Prepare() override; 30 31 ErrorCode Stop() override; 32 33 void FlushStart() override; 34 35 void FlushEnd() override; 36 37 bool Configure(const std::string& inPort, const std::shared_ptr<const Plugin::Meta>& upstreamMeta, 38 Plugin::Meta& upstreamParams, Plugin::Meta& downstreamParams) override; 39 40 bool Negotiate(const std::string& inPort, 41 const std::shared_ptr<const Plugin::Capability>& upstreamCap, 42 Plugin::Capability& negotiatedCap, 43 const Plugin::Meta& upstreamParams, 44 Plugin::Meta& downstreamParams) override; 45 46 void OnInputBufferDone(const std::shared_ptr<Plugin::Buffer>& input) override; 47 48 void OnOutputBufferDone(const std::shared_ptr<Plugin::Buffer>& output) override; 49 50 private: 51 uint32_t CalculateBufferSize(const std::shared_ptr<const Plugin::Meta>& meta) override; 52 53 std::vector<Capability::Key> GetRequiredOutCapKeys() override; 54 55 void UpdateParams(const std::shared_ptr<const Plugin::Meta>& upMeta, 56 std::shared_ptr<Plugin::Meta>& meta) override; 57 }; 58 } // Pipeline 59 } // Media 60 } // OHOS 61 #endif // HISTREAMER_PIPELINE_FILTER_AUDIO_DECODER_H 62