libcamera v0.5.1
Supporting cameras in Linux since 2019
Loading...
Searching...
No Matches
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 * Image Processing Algorithm module manager
6 */
7
8#pragma once
9
10#include <memory>
11#include <stdint.h>
12#include <vector>
13
14#include <libcamera/base/log.h>
15
18
23
24namespace libcamera {
25
27
29{
30public:
31 IPAManager();
33
34 template<typename T>
35 static std::unique_ptr<T> createIPA(PipelineHandler *pipe,
36 uint32_t minVersion,
37 uint32_t maxVersion)
38 {
39 CameraManager *cm = pipe->cameraManager();
40 IPAManager *self = cm->_d()->ipaManager();
41 IPAModule *m = self->module(pipe, minVersion, maxVersion);
42 if (!m)
43 return nullptr;
44
45 std::unique_ptr<T> proxy = std::make_unique<T>(m, !self->isSignatureValid(m));
46 if (!proxy->isValid()) {
47 LOG(IPAManager, Error) << "Failed to load proxy";
48 return nullptr;
49 }
50
51 return proxy;
52 }
53
54#if HAVE_IPA_PUBKEY
55 static const PubKey &pubKey()
56 {
57 return pubKey_;
58 }
59#endif
60
61private:
62 void parseDir(const char *libDir, unsigned int maxDepth,
63 std::vector<std::string> &files);
64 unsigned int addDir(const char *libDir, unsigned int maxDepth = 0);
65
66 IPAModule *module(PipelineHandler *pipe, uint32_t minVersion,
67 uint32_t maxVersion);
68
69 bool isSignatureValid(IPAModule *ipa) const;
70
71 std::vector<std::unique_ptr<IPAModule>> modules_;
72
73#if HAVE_IPA_PUBKEY
74 static const uint8_t publicKeyData_[];
75 static const PubKey pubKey_;
76#endif
77};
78
79} /* namespace libcamera */
Provide access and manage all cameras in the system.
Definition camera_manager.h:25
const T * _d() const
Retrieve the private data instance.
Definition class.h:94
Manager for IPA modules.
Definition ipa_manager.h:29
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:35
IPAManager()
Construct an IPAManager instance.
Definition ipa_manager.cpp:104
static const PubKey & pubKey()
Retrieve the IPA module signing public key.
Definition ipa_manager.h:55
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:35
CameraManager * cameraManager() const
Retrieve the CameraManager that this pipeline handler belongs to.
Definition pipeline_handler.h:71
Public key wrapper for signature verification.
Definition pub_key.h:23
Internal camera manager support.
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.
Definition log.h:51
#define LOG(category, severity)
Log a message.
Definition log.h:123
The IPA (Image Processing Algorithm) namespace.
Definition af.cpp:58
Top-level libcamera namespace.
Definition backtrace.h:17
Create pipelines and cameras from a set of media devices.
Public key signature verification.