1 // Copyright 2021 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef ANDROID_V4L2_CODEC2_COMPONENTS_V4L2_COMPONENT_FACTORY_H 6 #define ANDROID_V4L2_CODEC2_COMPONENTS_V4L2_COMPONENT_FACTORY_H 7 8 #include <memory> 9 #include <string> 10 11 #include <C2ComponentFactory.h> 12 #include <util/C2InterfaceHelper.h> 13 14 namespace android { 15 16 class V4L2ComponentFactory : public C2ComponentFactory { 17 public: 18 static std::unique_ptr<V4L2ComponentFactory> create( 19 const std::string& componentName, std::shared_ptr<C2ReflectorHelper> reflector); 20 V4L2ComponentFactory(const std::string& componentName, bool isEncoder, 21 std::shared_ptr<C2ReflectorHelper> reflector); 22 ~V4L2ComponentFactory() override = default; 23 24 // Implementation of C2ComponentFactory. 25 c2_status_t createComponent(c2_node_id_t id, std::shared_ptr<C2Component>* const component, 26 ComponentDeleter deleter) override; 27 c2_status_t createInterface(c2_node_id_t id, 28 std::shared_ptr<C2ComponentInterface>* const interface, 29 InterfaceDeleter deleter) override; 30 31 private: 32 const std::string mComponentName; 33 const bool mIsEncoder; 34 std::shared_ptr<C2ReflectorHelper> mReflector; 35 }; 36 37 } // namespace android 38 39 #endif // ANDROID_V4L2_CODEC2_COMPONENTS_V4L2_COMPONENT_FACTORY_H 40