diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2020-05-12 00:58:34 +0300 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2020-05-16 03:38:11 +0300 |
commit | 93e72b695e477ac1efc22a0bdddb177199cf2fb9 (patch) | |
tree | 7ba4b9fe0d5442ad7ca4e25aee1bc17b830a98ed /src/libcamera/include/pipeline_handler.h | |
parent | 79c5df21ddde12f98eacf2ece8e3091e4f845d38 (diff) |
libcamera: Move internal headers to include/libcamera/internal/
The libcamera internal headers are located in src/libcamera/include/.
The directory is added to the compiler headers search path with a meson
include_directories() directive, and internal headers are included with
(e.g. for the internal semaphore.h header)
#include "semaphore.h"
All was well, until libcxx decided to implement the C++20
synchronization library. The __threading_support header gained a
#include <semaphore.h>
to include the pthread's semaphore support. As include_directories()
adds src/libcamera/include/ to the compiler search path with -I, the
internal semaphore.h is included instead of the pthread version.
Needless to say, the compiler isn't happy.
Three options have been considered to fix this issue:
- Use -iquote instead of -I. The -iquote option instructs gcc to only
consider the header search path for headers included with the ""
version. Meson unfortunately doesn't support this option.
- Rename the internal semaphore.h header. This was deemed to be the
beginning of a long whack-a-mole game, where namespace clashes with
system libraries would appear over time (possibly dependent on
particular system configurations) and would need to be constantly
fixed.
- Move the internal headers to another directory to create a unique
namespace through path components. This causes lots of churn in all
the existing source files through the all project.
The first option would be best, but isn't available to us due to missing
support in meson. Even if -iquote support was added, we would need to
fix the problem before a new version of meson containing the required
support would be released.
The third option is thus the only practical solution available. Bite the
bullet, and do it, moving headers to include/libcamera/internal/.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src/libcamera/include/pipeline_handler.h')
-rw-r--r-- | src/libcamera/include/pipeline_handler.h | 151 |
1 files changed, 0 insertions, 151 deletions
diff --git a/src/libcamera/include/pipeline_handler.h b/src/libcamera/include/pipeline_handler.h deleted file mode 100644 index 706413fa..00000000 --- a/src/libcamera/include/pipeline_handler.h +++ /dev/null @@ -1,151 +0,0 @@ -/* SPDX-License-Identifier: LGPL-2.1-or-later */ -/* - * Copyright (C) 2018, Google Inc. - * - * pipeline_handler.h - Pipeline handler infrastructure - */ -#ifndef __LIBCAMERA_PIPELINE_HANDLER_H__ -#define __LIBCAMERA_PIPELINE_HANDLER_H__ - -#include <list> -#include <map> -#include <memory> -#include <set> -#include <string> -#include <sys/types.h> -#include <vector> - -#include <libcamera/controls.h> -#include <libcamera/object.h> -#include <libcamera/stream.h> - -#include "ipa_proxy.h" - -namespace libcamera { - -class Camera; -class CameraConfiguration; -class CameraManager; -class DeviceEnumerator; -class DeviceMatch; -class FrameBuffer; -class MediaDevice; -class PipelineHandler; -class Request; - -class CameraData -{ -public: - explicit CameraData(PipelineHandler *pipe) - : pipe_(pipe) - { - } - virtual ~CameraData() {} - - Camera *camera_; - PipelineHandler *pipe_; - std::list<Request *> queuedRequests_; - ControlInfoMap controlInfo_; - ControlList properties_; - std::unique_ptr<IPAProxy> ipa_; - -private: - CameraData(const CameraData &) = delete; - CameraData &operator=(const CameraData &) = delete; -}; - -class PipelineHandler : public std::enable_shared_from_this<PipelineHandler>, - public Object -{ -public: - PipelineHandler(CameraManager *manager); - virtual ~PipelineHandler(); - - virtual bool match(DeviceEnumerator *enumerator) = 0; - MediaDevice *acquireMediaDevice(DeviceEnumerator *enumerator, - const DeviceMatch &dm); - - bool lock(); - void unlock(); - - const ControlInfoMap &controls(Camera *camera); - const ControlList &properties(Camera *camera); - - virtual CameraConfiguration *generateConfiguration(Camera *camera, - const StreamRoles &roles) = 0; - virtual int configure(Camera *camera, CameraConfiguration *config) = 0; - - virtual int exportFrameBuffers(Camera *camera, Stream *stream, - std::vector<std::unique_ptr<FrameBuffer>> *buffers) = 0; - - virtual int start(Camera *camera) = 0; - virtual void stop(Camera *camera) = 0; - - int queueRequest(Camera *camera, Request *request); - - bool completeBuffer(Camera *camera, Request *request, - FrameBuffer *buffer); - void completeRequest(Camera *camera, Request *request); - - const char *name() const { return name_; } - -protected: - void registerCamera(std::shared_ptr<Camera> camera, - std::unique_ptr<CameraData> data, dev_t devnum = 0); - void hotplugMediaDevice(MediaDevice *media); - - virtual int queueRequestDevice(Camera *camera, Request *request) = 0; - - CameraData *cameraData(const Camera *camera); - - CameraManager *manager_; - -private: - void mediaDeviceDisconnected(MediaDevice *media); - virtual void disconnect(); - - std::vector<std::shared_ptr<MediaDevice>> mediaDevices_; - std::vector<std::weak_ptr<Camera>> cameras_; - std::map<const Camera *, std::unique_ptr<CameraData>> cameraData_; - - const char *name_; - - friend class PipelineHandlerFactory; -}; - -class PipelineHandlerFactory -{ -public: - PipelineHandlerFactory(const char *name); - virtual ~PipelineHandlerFactory() {} - - std::shared_ptr<PipelineHandler> create(CameraManager *manager); - - const std::string &name() const { return name_; } - - static void registerType(PipelineHandlerFactory *factory); - static std::vector<PipelineHandlerFactory *> &factories(); - -private: - virtual PipelineHandler *createInstance(CameraManager *manager) = 0; - - std::string name_; -}; - -#define REGISTER_PIPELINE_HANDLER(handler) \ -class handler##Factory final : public PipelineHandlerFactory \ -{ \ -public: \ - handler##Factory() : PipelineHandlerFactory(#handler) {} \ - \ -private: \ - PipelineHandler *createInstance(CameraManager *manager) \ - { \ - return new handler(manager); \ - } \ -}; \ -static handler##Factory global_##handler##Factory; - -} /* namespace libcamera */ - -#endif /* __LIBCAMERA_PIPELINE_HANDLER_H__ */ |