diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2020-11-08 01:14:38 +0200 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2020-11-15 22:21:28 +0200 |
commit | d767c84022559e55708f24a3a264853c0142135e (patch) | |
tree | 9b104f71819804d002039fab9be25340e90bc210 /src | |
parent | 7d35c771c0480e1ca5942ba3c9cf09c1fde22f85 (diff) |
libcamera: Move EventDispatcher to internal API
There's no user of the EventDispatcher (and the related EventNotifier
and Timer classes) outside of libcamera. Move those classes to the
internal API.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Diffstat (limited to 'src')
-rw-r--r-- | src/libcamera/camera_manager.cpp | 44 | ||||
-rw-r--r-- | src/libcamera/device_enumerator_udev.cpp | 3 | ||||
-rw-r--r-- | src/libcamera/event_dispatcher.cpp | 2 | ||||
-rw-r--r-- | src/libcamera/event_dispatcher_poll.cpp | 5 | ||||
-rw-r--r-- | src/libcamera/event_notifier.cpp | 4 | ||||
-rw-r--r-- | src/libcamera/ipc_unixsocket.cpp | 3 | ||||
-rw-r--r-- | src/libcamera/pipeline/rkisp1/timeline.h | 3 | ||||
-rw-r--r-- | src/libcamera/process.cpp | 3 | ||||
-rw-r--r-- | src/libcamera/proxy/worker/ipa_proxy_linux_worker.cpp | 2 | ||||
-rw-r--r-- | src/libcamera/thread.cpp | 3 | ||||
-rw-r--r-- | src/libcamera/timer.cpp | 4 | ||||
-rw-r--r-- | src/libcamera/v4l2_device.cpp | 3 | ||||
-rw-r--r-- | src/libcamera/v4l2_videodevice.cpp | 2 |
13 files changed, 17 insertions, 64 deletions
diff --git a/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp index 427ea5da..67641a55 100644 --- a/src/libcamera/camera_manager.cpp +++ b/src/libcamera/camera_manager.cpp @@ -11,10 +11,8 @@ #include <map> #include <libcamera/camera.h> -#include <libcamera/event_dispatcher.h> #include "libcamera/internal/device_enumerator.h" -#include "libcamera/internal/event_dispatcher_poll.h" #include "libcamera/internal/ipa_manager.h" #include "libcamera/internal/log.h" #include "libcamera/internal/pipeline_handler.h" @@ -244,12 +242,8 @@ void CameraManager::Private::removeCamera(Camera *camera) * a time. Attempting to create a second instance without first deleting the * existing instance results in undefined behaviour. * - * The manager is initially stopped, and shall be configured before being - * started. In particular a custom event dispatcher shall be installed if - * needed with CameraManager::setEventDispatcher(). - * - * Once the camera manager is configured, it shall be started with start(). - * This will enumerate all the cameras present in the system, which can then be + * The manager is initially stopped, and shall be started with start(). This + * will enumerate all the cameras present in the system, which can then be * listed with list() and retrieved with get(). * * Cameras are shared through std::shared_ptr<>, ensuring that a camera will @@ -477,38 +471,4 @@ void CameraManager::removeCamera(std::shared_ptr<Camera> camera) * \return The libcamera version string */ -/** - * \brief Set the event dispatcher - * \param[in] dispatcher Pointer to the event dispatcher - * - * libcamera requires an event dispatcher to integrate event notification and - * timers with the application event loop. Applications that want to provide - * their own event dispatcher shall call this function once and only once before - * the camera manager is started with start(). If no event dispatcher is - * provided, a default poll-based implementation will be used. - * - * The CameraManager takes ownership of the event dispatcher and will delete it - * when the application terminates. - */ -void CameraManager::setEventDispatcher(std::unique_ptr<EventDispatcher> dispatcher) -{ - thread()->setEventDispatcher(std::move(dispatcher)); -} - -/** - * \brief Retrieve the event dispatcher - * - * This function retrieves the event dispatcher set with setEventDispatcher(). - * If no dispatcher has been set, a default poll-based implementation is created - * and returned, and no custom event dispatcher may be installed anymore. - * - * The returned event dispatcher is valid until the camera manager is destroyed. - * - * \return Pointer to the event dispatcher - */ -EventDispatcher *CameraManager::eventDispatcher() -{ - return thread()->eventDispatcher(); -} - } /* namespace libcamera */ diff --git a/src/libcamera/device_enumerator_udev.cpp b/src/libcamera/device_enumerator_udev.cpp index c6e23a1a..d26fcf10 100644 --- a/src/libcamera/device_enumerator_udev.cpp +++ b/src/libcamera/device_enumerator_udev.cpp @@ -17,8 +17,7 @@ #include <sys/sysmacros.h> #include <unistd.h> -#include <libcamera/event_notifier.h> - +#include "libcamera/internal/event_notifier.h" #include "libcamera/internal/log.h" #include "libcamera/internal/media_device.h" diff --git a/src/libcamera/event_dispatcher.cpp b/src/libcamera/event_dispatcher.cpp index 90bd5daf..e0ce1eb3 100644 --- a/src/libcamera/event_dispatcher.cpp +++ b/src/libcamera/event_dispatcher.cpp @@ -5,7 +5,7 @@ * event_dispatcher.cpp - Event dispatcher */ -#include <libcamera/event_dispatcher.h> +#include "libcamera/internal/event_dispatcher.h" #include "libcamera/internal/log.h" diff --git a/src/libcamera/event_dispatcher_poll.cpp b/src/libcamera/event_dispatcher_poll.cpp index 9ab85da7..456c6def 100644 --- a/src/libcamera/event_dispatcher_poll.cpp +++ b/src/libcamera/event_dispatcher_poll.cpp @@ -16,11 +16,10 @@ #include <sys/eventfd.h> #include <unistd.h> -#include <libcamera/event_notifier.h> -#include <libcamera/timer.h> - +#include "libcamera/internal/event_notifier.h" #include "libcamera/internal/log.h" #include "libcamera/internal/thread.h" +#include "libcamera/internal/timer.h" #include "libcamera/internal/utils.h" /** diff --git a/src/libcamera/event_notifier.cpp b/src/libcamera/event_notifier.cpp index 21c07faf..6b0575c0 100644 --- a/src/libcamera/event_notifier.cpp +++ b/src/libcamera/event_notifier.cpp @@ -5,11 +5,11 @@ * event_notifier.cpp - File descriptor event notifier */ -#include <libcamera/event_notifier.h> +#include "libcamera/internal/event_notifier.h" #include <libcamera/camera_manager.h> -#include <libcamera/event_dispatcher.h> +#include "libcamera/internal/event_dispatcher.h" #include "libcamera/internal/message.h" #include "libcamera/internal/thread.h" diff --git a/src/libcamera/ipc_unixsocket.cpp b/src/libcamera/ipc_unixsocket.cpp index 5c8cce16..fdb359f7 100644 --- a/src/libcamera/ipc_unixsocket.cpp +++ b/src/libcamera/ipc_unixsocket.cpp @@ -12,8 +12,7 @@ #include <sys/socket.h> #include <unistd.h> -#include <libcamera/event_notifier.h> - +#include "libcamera/internal/event_notifier.h" #include "libcamera/internal/log.h" /** diff --git a/src/libcamera/pipeline/rkisp1/timeline.h b/src/libcamera/pipeline/rkisp1/timeline.h index 0c37b06f..35a08515 100644 --- a/src/libcamera/pipeline/rkisp1/timeline.h +++ b/src/libcamera/pipeline/rkisp1/timeline.h @@ -10,8 +10,7 @@ #include <list> #include <map> -#include <libcamera/timer.h> - +#include "libcamera/internal/timer.h" #include "libcamera/internal/utils.h" namespace libcamera { diff --git a/src/libcamera/process.cpp b/src/libcamera/process.cpp index 72b5afe2..40a434a6 100644 --- a/src/libcamera/process.cpp +++ b/src/libcamera/process.cpp @@ -20,8 +20,7 @@ #include <unistd.h> #include <vector> -#include <libcamera/event_notifier.h> - +#include "libcamera/internal/event_notifier.h" #include "libcamera/internal/log.h" #include "libcamera/internal/utils.h" diff --git a/src/libcamera/proxy/worker/ipa_proxy_linux_worker.cpp b/src/libcamera/proxy/worker/ipa_proxy_linux_worker.cpp index 0c4687f7..bdbac988 100644 --- a/src/libcamera/proxy/worker/ipa_proxy_linux_worker.cpp +++ b/src/libcamera/proxy/worker/ipa_proxy_linux_worker.cpp @@ -9,10 +9,10 @@ #include <sys/types.h> #include <unistd.h> -#include <libcamera/event_dispatcher.h> #include <libcamera/ipa/ipa_interface.h> #include <libcamera/logging.h> +#include "libcamera/internal/event_dispatcher.h" #include "libcamera/internal/ipa_module.h" #include "libcamera/internal/ipc_unixsocket.h" #include "libcamera/internal/log.h" diff --git a/src/libcamera/thread.cpp b/src/libcamera/thread.cpp index b5d7103a..f339dab1 100644 --- a/src/libcamera/thread.cpp +++ b/src/libcamera/thread.cpp @@ -14,8 +14,7 @@ #include <sys/types.h> #include <unistd.h> -#include <libcamera/event_dispatcher.h> - +#include "libcamera/internal/event_dispatcher.h" #include "libcamera/internal/event_dispatcher_poll.h" #include "libcamera/internal/log.h" #include "libcamera/internal/message.h" diff --git a/src/libcamera/timer.cpp b/src/libcamera/timer.cpp index 24e452ed..c242113a 100644 --- a/src/libcamera/timer.cpp +++ b/src/libcamera/timer.cpp @@ -5,13 +5,13 @@ * timer.cpp - Generic timer */ -#include <libcamera/timer.h> +#include "libcamera/internal/timer.h" #include <chrono> #include <libcamera/camera_manager.h> -#include <libcamera/event_dispatcher.h> +#include "libcamera/internal/event_dispatcher.h" #include "libcamera/internal/log.h" #include "libcamera/internal/message.h" #include "libcamera/internal/thread.h" diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp index fd0b140f..decd19ef 100644 --- a/src/libcamera/v4l2_device.cpp +++ b/src/libcamera/v4l2_device.cpp @@ -16,8 +16,7 @@ #include <sys/syscall.h> #include <unistd.h> -#include <libcamera/event_notifier.h> - +#include "libcamera/internal/event_notifier.h" #include "libcamera/internal/log.h" #include "libcamera/internal/sysfs.h" #include "libcamera/internal/utils.h" diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp index 5ee1b479..e76fe2dd 100644 --- a/src/libcamera/v4l2_videodevice.cpp +++ b/src/libcamera/v4l2_videodevice.cpp @@ -20,9 +20,9 @@ #include <linux/version.h> -#include <libcamera/event_notifier.h> #include <libcamera/file_descriptor.h> +#include "libcamera/internal/event_notifier.h" #include "libcamera/internal/log.h" #include "libcamera/internal/media_device.h" #include "libcamera/internal/media_object.h" |