[libcamera-devel] [PATCH 1/8] android: camera_device: Provide log prefix
Jacopo Mondi
jacopo at jmondi.org
Tue May 26 16:22:30 CEST 2020
Make the CameraDevice a Loggable subclass and provide a logPrefix()
method to identify which camera the log outout refers to.
Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
---
src/android/camera_device.cpp | 5 +++++
src/android/camera_device.h | 6 +++++-
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index 4ec429fc3f8f..ad277cb059ca 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -863,6 +863,11 @@ void CameraDevice::requestComplete(Request *request)
delete buffer;
}
+std::string CameraDevice::logPrefix() const
+{
+ return "'" + camera_->name() + "'";
+}
+
void CameraDevice::notifyShutter(uint32_t frameNumber, uint64_t timestamp)
{
camera3_notify_msg_t notify = {};
diff --git a/src/android/camera_device.h b/src/android/camera_device.h
index bce1cfbc85a4..350408c1a3e4 100644
--- a/src/android/camera_device.h
+++ b/src/android/camera_device.h
@@ -16,11 +16,12 @@
#include <libcamera/request.h>
#include <libcamera/stream.h>
+#include "libcamera/internal/log.h"
#include "libcamera/internal/message.h"
class CameraMetadata;
-class CameraDevice
+class CameraDevice : protected libcamera::Loggable
{
public:
CameraDevice(unsigned int id, const std::shared_ptr<libcamera::Camera> &camera);
@@ -39,6 +40,9 @@ public:
int processCaptureRequest(camera3_capture_request_t *request);
void requestComplete(libcamera::Request *request);
+protected:
+ std::string logPrefix() const;
+
private:
struct Camera3RequestDescriptor {
Camera3RequestDescriptor(unsigned int frameNumber,
--
2.26.2
More information about the libcamera-devel
mailing list