diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2020-03-22 00:52:28 +0200 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2020-03-24 10:33:40 +0200 |
commit | 01590c3f780598572b3a18decefed55ae8e51059 (patch) | |
tree | 45528bc03285507b3c4d6129dc9162cef4bc6b5e /src/qcam/qt_event_dispatcher.h | |
parent | 45f248da7dbd0dc6df02142bfdf99a5d7f5f80a2 (diff) |
qcam: Remove custom event dispatcher
The qcam application installs a custom event dispatcher based on the Qt
event loop. As the camera manager now creates an internal thread, it
doesn't use that event dispatcher of the application thread at all.
Furthermore, the custom event dispatcher is buggy, as it doesn't
dispatch messages posted to the main thread's event loop. This isn't an
issue as no messages are posted there in the first place, but would
cause incorrect behaviour if we were to use that feature (for instance
to deliver signals from the camera manager thread to the application
thread).
Fixing the event dispatcher requires a change in the libcamera public
API, as there's currently no way to dispatch messages using the public
API (Thread::dispatchMessages() is not exposed). This isn't worth it at
the moment, so just remove the custom event dispatcher. If qcam later
needs the libcamera request and buffer completion signals to be
delivered in the application thread, it will need to handle that
internally, using Qt's cross-thread signal delivery.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src/qcam/qt_event_dispatcher.h')
-rw-r--r-- | src/qcam/qt_event_dispatcher.h | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/src/qcam/qt_event_dispatcher.h b/src/qcam/qt_event_dispatcher.h deleted file mode 100644 index b0f123e5..00000000 --- a/src/qcam/qt_event_dispatcher.h +++ /dev/null @@ -1,62 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ -/* - * Copyright (C) 2019, Google Inc. - * - * qt_event_dispatcher.h - qcam - Qt-based event dispatcher - */ -#ifndef __QCAM_QT_EVENT_DISPATCHER_H__ -#define __QCAM_QT_EVENT_DISPATCHER_H__ - -#include <map> - -#include <libcamera/event_dispatcher.h> - -using namespace libcamera; - -class QSocketNotifier; - -class QtEventDispatcher final : public EventDispatcher, public QObject -{ -public: - QtEventDispatcher(); - ~QtEventDispatcher(); - - void registerEventNotifier(EventNotifier *notifier); - void unregisterEventNotifier(EventNotifier *notifier); - - void registerTimer(Timer *timer); - void unregisterTimer(Timer *timer); - - void processEvents(); - - void interrupt(); - -protected: - void timerEvent(QTimerEvent *event); - -private: - void readNotifierActivated(int socket); - void writeNotifierActivated(int socket); - void exceptionNotifierActivated(int socket); - - struct NotifierPair { - NotifierPair() - : notifier(nullptr), qnotifier(nullptr) - { - } - EventNotifier *notifier; - QSocketNotifier *qnotifier; - }; - - struct NotifierSet { - NotifierPair read; - NotifierPair write; - NotifierPair exception; - }; - - std::map<int, NotifierSet> notifiers_; - std::map<int, Timer *> timers_; - std::map<Timer *, int> timerIds_; -}; - -#endif /* __QCAM_QT_EVENT_DISPATCHER_H__ */ |