libcamera v0.4.0
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 <stdint.h>
11#include <vector>
12
13#include <libcamera/base/log.h>
14
17
22
23namespace libcamera {
24
26
28{
29public:
30 IPAManager();
32
33 template<typename T>
34 static std::unique_ptr<T> createIPA(PipelineHandler *pipe,
35 uint32_t minVersion,
36 uint32_t maxVersion)
37 {
38 CameraManager *cm = pipe->cameraManager();
39 IPAManager *self = cm->_d()->ipaManager();
40 IPAModule *m = self->module(pipe, minVersion, maxVersion);
41 if (!m)
42 return nullptr;
43
44 std::unique_ptr<T> proxy = std::make_unique<T>(m, !self->isSignatureValid(m));
45 if (!proxy->isValid()) {
46 LOG(IPAManager, Error) << "Failed to load proxy";
47 return nullptr;
48 }
49
50 return proxy;
51 }
52
53#if HAVE_IPA_PUBKEY
54 static const PubKey &pubKey()
55 {
56 return pubKey_;
57 }
58#endif
59
60private:
61 void parseDir(const char *libDir, unsigned int maxDepth,
62 std::vector<std::string> &files);
63 unsigned int addDir(const char *libDir, unsigned int maxDepth = 0);
64
65 IPAModule *module(PipelineHandler *pipe, uint32_t minVersion,
66 uint32_t maxVersion);
67
68 bool isSignatureValid(IPAModule *ipa) const;
69
70 std::vector<IPAModule *> modules_;
71
72#if HAVE_IPA_PUBKEY
73 static const uint8_t publicKeyData_[];
74 static const PubKey pubKey_;
75#endif
76};
77
78} /* namespace libcamera */
Provide access and manage all cameras in the system.
Definition camera_manager.h:24
const T * _d() const
Retrieve the private data instance.
Definition class.h:94
Manager for IPA modules.
Definition ipa_manager.h:28
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:34
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:54
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:70
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:46
#define LOG(category, severity)
Log a message.
Definition log.h:122
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.