• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 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 IE_PIPELINE_FILTERS_IMAGE_SOURCE_FILTER_H
17 #define IE_PIPELINE_FILTERS_IMAGE_SOURCE_FILTER_H
18 
19 #include <string>
20 
21 #include "filter_base.h"
22 
23 namespace OHOS {
24 namespace Media {
25 namespace Effect {
26 class ImageSourceFilter : public FilterBase {
27 public:
ImageSourceFilter(const std::string & name)28     explicit ImageSourceFilter(const std::string &name) : FilterBase(name)
29     {
30         filterType_ = FilterType::INPUT_SOURCE;
31     }
32 
33     ~ImageSourceFilter() override = default;
34 
35     virtual ErrorCode SetSource(const std::shared_ptr<EffectBuffer> &source, std::shared_ptr<EffectContext> &context);
36 
SetParameter(int32_t key,const Media::Plugin::Any & value)37     ErrorCode SetParameter(int32_t key, const Media::Plugin::Any &value) override
38     {
39         return FilterBase::SetParameter(key, value);
40     }
41 
GetParameter(int32_t key,Media::Plugin::Any & value)42     ErrorCode GetParameter(int32_t key, Media::Plugin::Any &value) override
43     {
44         return FilterBase::GetParameter(key, value);
45     }
46 
47     ErrorCode Prepare() override;
48 
49     ErrorCode Start() override;
50 
51     void SetNegotiateParameter(uint32_t width, uint32_t height, IEffectFormat format,
52         std::shared_ptr<EffectContext> &context);
53 
54 private:
OnEvent(const Event & event)55     void OnEvent(const Event &event) override {}
56     ErrorCode DoNegotiate();
57 
58     std::shared_ptr<EffectBuffer> srcBuffer_;
59 
60     std::shared_ptr<EffectContext> context_;
61     uint32_t width_;
62     uint32_t height_;
63     IEffectFormat format_;
64 };
65 } // namespace Effect
66 } // namespace Media
67 } // namespace OHOS
68 #endif