summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-04-18 18:39:57 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-04-19 13:38:14 +0300
commit1ba441cae6cf2355f6986b066b696111bec29bd7 (patch)
tree74084de32c4868809ae6ff7fa1f9814cd152f729 /src
parent0af0fb9ca9eae903cc533a05e2282ec36cc3ce55 (diff)
libcamera: Include header related to source file first
Include the header file corresponding to the source file in the very first position. This complies with the Google C++ coding style guideliens, and helps ensuring that the headers are self-contained. Three bugs are already caught by this change (missing includes or forward declarations) in device_enumerator.h, event_dispatcher_poll.h and pipeline_handler.h. Fix them. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/buffer.cpp4
-rw-r--r--src/libcamera/camera.cpp3
-rw-r--r--src/libcamera/camera_manager.cpp3
-rw-r--r--src/libcamera/camera_sensor.cpp3
-rw-r--r--src/libcamera/device_enumerator.cpp3
-rw-r--r--src/libcamera/event_dispatcher_poll.cpp3
-rw-r--r--src/libcamera/event_notifier.cpp3
-rw-r--r--src/libcamera/geometry.cpp4
-rw-r--r--src/libcamera/include/device_enumerator.h3
-rw-r--r--src/libcamera/include/event_dispatcher_poll.h2
-rw-r--r--src/libcamera/include/pipeline_handler.h1
-rw-r--r--src/libcamera/log.cpp3
-rw-r--r--src/libcamera/media_device.cpp3
-rw-r--r--src/libcamera/media_object.cpp3
-rw-r--r--src/libcamera/object.cpp1
-rw-r--r--src/libcamera/pipeline_handler.cpp3
-rw-r--r--src/libcamera/request.cpp3
-rw-r--r--src/libcamera/signal.cpp2
-rw-r--r--src/libcamera/stream.cpp4
-rw-r--r--src/libcamera/timer.cpp3
-rw-r--r--src/libcamera/utils.cpp4
-rw-r--r--src/libcamera/v4l2_device.cpp3
-rw-r--r--src/libcamera/v4l2_subdevice.cpp3
23 files changed, 45 insertions, 22 deletions
diff --git a/src/libcamera/buffer.cpp b/src/libcamera/buffer.cpp
index 21abdcce..d86278a8 100644
--- a/src/libcamera/buffer.cpp
+++ b/src/libcamera/buffer.cpp
@@ -5,13 +5,13 @@
* buffer.cpp - Buffer handling
*/
+#include <libcamera/buffer.h>
+
#include <errno.h>
#include <string.h>
#include <sys/mman.h>
#include <unistd.h>
-#include <libcamera/buffer.h>
-
#include "log.h"
/**
diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp
index a5276962..d7a39ca6 100644
--- a/src/libcamera/camera.cpp
+++ b/src/libcamera/camera.cpp
@@ -5,9 +5,10 @@
* camera.cpp - Camera device
*/
+#include <libcamera/camera.h>
+
#include <iomanip>
-#include <libcamera/camera.h>
#include <libcamera/request.h>
#include <libcamera/stream.h>
diff --git a/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp
index e2473816..58d3b0dd 100644
--- a/src/libcamera/camera_manager.cpp
+++ b/src/libcamera/camera_manager.cpp
@@ -5,8 +5,9 @@
* camera_manager.h - Camera management
*/
-#include <libcamera/camera.h>
#include <libcamera/camera_manager.h>
+
+#include <libcamera/camera.h>
#include <libcamera/event_dispatcher.h>
#include "device_enumerator.h"
diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp
index 52bd8f6f..8f2eab56 100644
--- a/src/libcamera/camera_sensor.cpp
+++ b/src/libcamera/camera_sensor.cpp
@@ -5,13 +5,14 @@
* camera_sensor.cpp - A camera sensor
*/
+#include "camera_sensor.h"
+
#include <algorithm>
#include <float.h>
#include <iomanip>
#include <limits.h>
#include <math.h>
-#include "camera_sensor.h"
#include "formats.h"
#include "v4l2_subdevice.h"
diff --git a/src/libcamera/device_enumerator.cpp b/src/libcamera/device_enumerator.cpp
index e7de415b..f3f26d98 100644
--- a/src/libcamera/device_enumerator.cpp
+++ b/src/libcamera/device_enumerator.cpp
@@ -5,6 +5,8 @@
* device_enumerator.cpp - Enumeration and matching
*/
+#include "device_enumerator.h"
+
#include <fcntl.h>
#include <libudev.h>
#include <string.h>
@@ -13,7 +15,6 @@
#include <libcamera/event_notifier.h>
-#include "device_enumerator.h"
#include "log.h"
#include "media_device.h"
#include "utils.h"
diff --git a/src/libcamera/event_dispatcher_poll.cpp b/src/libcamera/event_dispatcher_poll.cpp
index a2674ab3..130b5e20 100644
--- a/src/libcamera/event_dispatcher_poll.cpp
+++ b/src/libcamera/event_dispatcher_poll.cpp
@@ -5,6 +5,8 @@
* event_dispatcher_poll.cpp - Poll-based event dispatcher
*/
+#include "event_dispatcher_poll.h"
+
#include <algorithm>
#include <iomanip>
#include <poll.h>
@@ -16,7 +18,6 @@
#include <libcamera/event_notifier.h>
#include <libcamera/timer.h>
-#include "event_dispatcher_poll.h"
#include "log.h"
/**
diff --git a/src/libcamera/event_notifier.cpp b/src/libcamera/event_notifier.cpp
index 0f84e412..b32c7ed2 100644
--- a/src/libcamera/event_notifier.cpp
+++ b/src/libcamera/event_notifier.cpp
@@ -5,9 +5,10 @@
* event_notifier.cpp - File descriptor event notifier
*/
+#include <libcamera/event_notifier.h>
+
#include <libcamera/camera_manager.h>
#include <libcamera/event_dispatcher.h>
-#include <libcamera/event_notifier.h>
/**
* \file event_notifier.h
diff --git a/src/libcamera/geometry.cpp b/src/libcamera/geometry.cpp
index a39b85e4..c8aa05f5 100644
--- a/src/libcamera/geometry.cpp
+++ b/src/libcamera/geometry.cpp
@@ -5,11 +5,11 @@
* geometry.cpp - Geometry-related structures
*/
+#include <libcamera/geometry.h>
+
#include <sstream>
#include <stdint.h>
-#include <libcamera/geometry.h>
-
/**
* \file geometry.h
* \brief Data structures related to geometric objects
diff --git a/src/libcamera/include/device_enumerator.h b/src/libcamera/include/device_enumerator.h
index 22ed8ded..28018618 100644
--- a/src/libcamera/include/device_enumerator.h
+++ b/src/libcamera/include/device_enumerator.h
@@ -14,6 +14,9 @@
#include <linux/media.h>
+struct udev;
+struct udev_monitor;
+
namespace libcamera {
class EventNotifier;
diff --git a/src/libcamera/include/event_dispatcher_poll.h b/src/libcamera/include/event_dispatcher_poll.h
index 1c0066c2..14c3eea1 100644
--- a/src/libcamera/include/event_dispatcher_poll.h
+++ b/src/libcamera/include/event_dispatcher_poll.h
@@ -13,6 +13,8 @@
#include <map>
#include <vector>
+struct pollfd;
+
namespace libcamera {
class EventNotifier;
diff --git a/src/libcamera/include/pipeline_handler.h b/src/libcamera/include/pipeline_handler.h
index a0862ebf..c3f7d4c2 100644
--- a/src/libcamera/include/pipeline_handler.h
+++ b/src/libcamera/include/pipeline_handler.h
@@ -10,6 +10,7 @@
#include <list>
#include <map>
#include <memory>
+#include <set>
#include <string>
#include <vector>
diff --git a/src/libcamera/log.cpp b/src/libcamera/log.cpp
index 77927ec3..ebf55330 100644
--- a/src/libcamera/log.cpp
+++ b/src/libcamera/log.cpp
@@ -5,6 +5,8 @@
* log.cpp - Logging infrastructure
*/
+#include "log.h"
+
#include <cstdio>
#include <cstdlib>
#include <ctime>
@@ -15,7 +17,6 @@
#include <string.h>
#include <unordered_set>
-#include "log.h"
#include "utils.h"
/**
diff --git a/src/libcamera/media_device.cpp b/src/libcamera/media_device.cpp
index 9c438ce8..449571fb 100644
--- a/src/libcamera/media_device.cpp
+++ b/src/libcamera/media_device.cpp
@@ -5,6 +5,8 @@
* media_device.cpp - Media device handler
*/
+#include "media_device.h"
+
#include <errno.h>
#include <fcntl.h>
#include <string.h>
@@ -17,7 +19,6 @@
#include <linux/media.h>
#include "log.h"
-#include "media_device.h"
/**
* \file media_device.h
diff --git a/src/libcamera/media_object.cpp b/src/libcamera/media_object.cpp
index bbb8fb64..8794ff45 100644
--- a/src/libcamera/media_object.cpp
+++ b/src/libcamera/media_object.cpp
@@ -5,6 +5,8 @@
* media_object.cpp - Media device objects: entities, pads and links
*/
+#include "media_object.h"
+
#include <errno.h>
#include <string.h>
#include <unistd.h>
@@ -16,7 +18,6 @@
#include "log.h"
#include "media_device.h"
-#include "media_object.h"
/**
* \file media_object.h
diff --git a/src/libcamera/object.cpp b/src/libcamera/object.cpp
index 826eed6f..a504ca2c 100644
--- a/src/libcamera/object.cpp
+++ b/src/libcamera/object.cpp
@@ -6,6 +6,7 @@
*/
#include <libcamera/object.h>
+
#include <libcamera/signal.h>
/**
diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp
index f7a8a1ac..345abca8 100644
--- a/src/libcamera/pipeline_handler.cpp
+++ b/src/libcamera/pipeline_handler.cpp
@@ -5,13 +5,14 @@
* pipeline_handler.cpp - Pipeline handler infrastructure
*/
+#include "pipeline_handler.h"
+
#include <libcamera/buffer.h>
#include <libcamera/camera.h>
#include <libcamera/camera_manager.h>
#include "log.h"
#include "media_device.h"
-#include "pipeline_handler.h"
#include "utils.h"
/**
diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp
index ef65c42f..fa3ee46d 100644
--- a/src/libcamera/request.cpp
+++ b/src/libcamera/request.cpp
@@ -5,11 +5,12 @@
* request.cpp - Capture request handling
*/
+#include <libcamera/request.h>
+
#include <map>
#include <libcamera/buffer.h>
#include <libcamera/camera.h>
-#include <libcamera/request.h>
#include <libcamera/stream.h>
#include "log.h"
diff --git a/src/libcamera/signal.cpp b/src/libcamera/signal.cpp
index f97d68b3..4cb85ecb 100644
--- a/src/libcamera/signal.cpp
+++ b/src/libcamera/signal.cpp
@@ -5,6 +5,8 @@
* signal.cpp - Signal & slot implementation
*/
+#include <libcamera/signal.h>
+
/**
* \file signal.h
* \brief Signal & slot implementation
diff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp
index 1668b67d..71dd461d 100644
--- a/src/libcamera/stream.cpp
+++ b/src/libcamera/stream.cpp
@@ -5,11 +5,11 @@
* stream.cpp - Video stream for a Camera
*/
+#include <libcamera/stream.h>
+
#include <iomanip>
#include <sstream>
-#include <libcamera/stream.h>
-
/**
* \file stream.h
* \brief Video stream for a Camera
diff --git a/src/libcamera/timer.cpp b/src/libcamera/timer.cpp
index f42e479b..1cce4508 100644
--- a/src/libcamera/timer.cpp
+++ b/src/libcamera/timer.cpp
@@ -5,11 +5,12 @@
* timer.cpp - Generic timer
*/
+#include <libcamera/timer.h>
+
#include <time.h>
#include <libcamera/camera_manager.h>
#include <libcamera/event_dispatcher.h>
-#include <libcamera/timer.h>
#include "log.h"
diff --git a/src/libcamera/utils.cpp b/src/libcamera/utils.cpp
index e38f3268..66123b18 100644
--- a/src/libcamera/utils.cpp
+++ b/src/libcamera/utils.cpp
@@ -5,11 +5,11 @@
* utils.cpp - Miscellaneous utility functions
*/
+#include "utils.h"
+
#include <string.h>
#include <sys/auxv.h>
-#include "utils.h"
-
/**
* \file utils.h
* \brief Miscellaneous utility functions
diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp
index ccc5fbfc..8d8c7887 100644
--- a/src/libcamera/v4l2_device.cpp
+++ b/src/libcamera/v4l2_device.cpp
@@ -5,6 +5,8 @@
* v4l2_device.cpp - V4L2 Device
*/
+#include "v4l2_device.h"
+
#include <fcntl.h>
#include <iomanip>
#include <sstream>
@@ -21,7 +23,6 @@
#include "log.h"
#include "media_device.h"
#include "media_object.h"
-#include "v4l2_device.h"
/**
* \file v4l2_device.h
diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp
index eaa673e9..6fc866a6 100644
--- a/src/libcamera/v4l2_subdevice.cpp
+++ b/src/libcamera/v4l2_subdevice.cpp
@@ -5,6 +5,8 @@
* v4l2_subdevice.cpp - V4L2 Subdevice
*/
+#include "v4l2_subdevice.h"
+
#include <fcntl.h>
#include <iomanip>
#include <sstream>
@@ -19,7 +21,6 @@
#include "log.h"
#include "media_device.h"
#include "media_object.h"
-#include "v4l2_subdevice.h"
/**
* \file v4l2_subdevice.h