1 /* 2 * Copyright 2018, 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_FILTER_PLUGIN_H 18 19 #define CODEC2_HIDL_PLUGIN_FILTER_PLUGIN_H 20 21 #include <memory> 22 23 #include <C2Component.h> 24 25 namespace android { 26 27 class FilterPlugin_V1 { 28 public: 29 static constexpr int32_t VERSION = 1; 30 31 virtual ~FilterPlugin_V1() = default; 32 33 /** 34 * Returns a C2ComponentStore object with which clients can create 35 * filter components / interfaces. 36 */ 37 virtual std::shared_ptr<C2ComponentStore> getComponentStore() = 0; 38 struct Descriptor { 39 // Parameters that client sets for filter control. 40 std::initializer_list<C2Param::Type> controlParams; 41 // Parameters that the component changes after filtering. 42 std::initializer_list<C2Param::Type> affectedParams; 43 }; 44 45 /** 46 * Describe a filter component. 47 * 48 * @param name[in] filter's name 49 * @param desc[out] pointer to filter descriptor to be populated 50 * @return true if |name| is in the store and |desc| is populated; 51 * false if |name| is not recognized 52 */ 53 virtual bool describe(C2String name, Descriptor *desc) = 0; 54 55 /** 56 * Returns true if a component will apply filtering after all given the 57 * current configuration; false if it will be no-op. 58 */ 59 virtual bool isFilteringEnabled(const std::shared_ptr<C2ComponentInterface> &intf) = 0; 60 61 /** 62 * Query parameters to |intf|, which the component wants applied to 63 * the previous component in the chain. For example, an image/video filter 64 * may require specific usage or pixel format from the previous component. 65 */ 66 virtual c2_status_t queryParamsForPreviousComponent( 67 const std::shared_ptr<C2ComponentInterface> &intf, 68 std::vector<std::unique_ptr<C2Param>> *params) = 0; 69 }; 70 71 } // namespace android 72 73 extern "C" { 74 75 typedef int32_t (*GetFilterPluginVersionFunc)(); 76 int32_t GetFilterPluginVersion(); 77 78 typedef void* (*CreateFilterPluginFunc)(); 79 void *CreateFilterPlugin(); 80 81 typedef void (*DestroyFilterPluginFunc)(void *); 82 void DestroyFilterPlugin(void *plugin); 83 84 } // extern "C" 85 86 #endif // CODEC2_HIDL_PLUGIN_FILTER_PLUGIN_H 87