libcamera v0.1.0+127-8e215127-dirty (2023-12-02T01:06:12+00:00)
Supporting cameras in Linux since 2019
ipa_manager.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: LGPL-2.1-or-later */
2/*
3 * Copyright (C) 2019, Google Inc.
4 *
5 * ipa_manager.h - Image Processing Algorithm module manager
6 */
7
8#pragma once
9
10#include <stdint.h>
11#include <vector>
12
13#include <libcamera/base/log.h>
14
17
21
22namespace libcamera {
23
24LOG_DECLARE_CATEGORY(IPAManager)
25
27{
28public:
29 IPAManager();
31
32 template<typename T>
33 static std::unique_ptr<T> createIPA(PipelineHandler *pipe,
34 uint32_t minVersion,
35 uint32_t maxVersion)
36 {
37 IPAModule *m = self_->module(pipe, minVersion, maxVersion);
38 if (!m)
39 return nullptr;
40
41 std::unique_ptr<T> proxy = std::make_unique<T>(m, !self_->isSignatureValid(m));
42 if (!proxy->isValid()) {
43 LOG(IPAManager, Error) << "Failed to load proxy";
44 return nullptr;
45 }
46
47 return proxy;
48 }
49
50#if HAVE_IPA_PUBKEY
51 static const PubKey &pubKey()
52 {
53 return pubKey_;
54 }
55#endif
56
57private:
58 static IPAManager *self_;
59
60 void parseDir(const char *libDir, unsigned int maxDepth,
61 std::vector<std::string> &files);
62 unsigned int addDir(const char *libDir, unsigned int maxDepth = 0);
63
64 IPAModule *module(PipelineHandler *pipe, uint32_t minVersion,
65 uint32_t maxVersion);
66
67 bool isSignatureValid(IPAModule *ipa) const;
68
69 std::vector<IPAModule *> modules_;
70
71#if HAVE_IPA_PUBKEY
72 static const uint8_t publicKeyData_[];
73 static const PubKey pubKey_;
74#endif
75};
76
77} /* namespace libcamera */
Manager for IPA modules.
Definition: ipa_manager.h:27
static const PubKey & pubKey()
Retrieve the IPA module signing public key.
Definition: ipa_manager.h:51
static std::unique_ptr< T > createIPA(PipelineHandler *pipe, uint32_t minVersion, uint32_t maxVersion)
Create an IPA proxy that matches a given pipeline handler.
Definition: ipa_manager.h:33
Wrapper around IPA module shared object.
Definition: ipa_module.h:24
Create and manage cameras based on a set of media devices.
Definition: pipeline_handler.h:39
Public key wrapper for signature verification.
Definition: pub_key.h:23
Image Processing Algorithm interface.
Image Processing Algorithm module.
Image Processing Algorithm module information.
Logging infrastructure.
#define LOG_DECLARE_CATEGORY(name)
Declare a category of log messages.
#define LOG(category, severity)
Log a message.
Top-level libcamera namespace.
Definition: backtrace.h:17
Create pipelines and cameras from a set of media devices.
Public key signature verification.