1 /*
2  * Copyright 2020, The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef CODEC2_HIDL_PLUGIN_DEFAULT_FILTER_PLUGIN_H
18 
19 #define CODEC2_HIDL_PLUGIN_DEFAULT_FILTER_PLUGIN_H
20 
21 #include <codec2/hidl/plugin/FilterPlugin.h>
22 
23 #include <FilterWrapper.h>
24 
25 namespace android {
26 
27 class DefaultFilterPlugin : public FilterWrapper::Plugin {
28 public:
29     explicit DefaultFilterPlugin(const char *pluginPath);
30 
31     ~DefaultFilterPlugin();
32 
status()33     status_t status() const override { return mInit; }
34 
getStore()35     std::shared_ptr<C2ComponentStore> getStore() override { return mStore; }
36     bool describe(C2String name, FilterWrapper::Descriptor *desc) override;
37     bool isFilteringEnabled(const std::shared_ptr<C2ComponentInterface> &intf) override;
38     c2_status_t queryParamsForPreviousComponent(
39             const std::shared_ptr<C2ComponentInterface> &intf,
40             std::vector<std::unique_ptr<C2Param>> *params) override;
41 
42 private:
43     status_t mInit;
44     void *mHandle;
45     DestroyFilterPluginFunc mDestroyPlugin;
46     FilterPlugin_V1 *mPlugin;
47     std::shared_ptr<C2ComponentStore> mStore;
48 };
49 
50 }  // namespace android
51 
52 #endif  // CODEC2_HIDL_PLUGIN_DEFAULT_FILTER_PLUGIN_H
53