• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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::TagMap &upstreamParams, Plugin::TagMap &downstreamParams) override;
39 
40     ErrorCode PushData(const std::string &inPort, const AVBufferPtr& buffer, int64_t offset) override;
41 
42     bool Negotiate(const std::string& inPort,
43                    const std::shared_ptr<const Plugin::Capability>& upstreamCap,
44                    Plugin::Capability& negotiatedCap,
45                    const Plugin::TagMap& upstreamParams,
46                    Plugin::TagMap& downstreamParams) override;
47 
48     void OnInputBufferDone(const std::shared_ptr<Plugin::Buffer>& input) override;
49 
50     void OnOutputBufferDone(const std::shared_ptr<Plugin::Buffer>& output) override;
51 
52 private:
53     uint32_t CalculateBufferSize(const std::shared_ptr<const OHOS::Media::Plugin::Meta> &meta) override;
54 
55     std::vector<Capability::Key> GetRequiredOutCapKeys() override;
56 
57     void UpdateParams(const std::shared_ptr<const Plugin::Meta>& upMeta,
58                       std::shared_ptr<Plugin::Meta>& meta) override;
59 };
60 } // Pipeline
61 } // Media
62 } // OHOS
63 #endif // HISTREAMER_PIPELINE_FILTER_AUDIO_DECODER_H
64