libcamera: media_device: Use Loggable interface
Extend MediaDevice to inherit from the Loggable interface to support a logPrefix which presents the device node path, and the driver name. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
@@ -16,11 +16,12 @@
|
||||
|
||||
#include <libcamera/signal.h>
|
||||
|
||||
#include "log.h"
|
||||
#include "media_object.h"
|
||||
|
||||
namespace libcamera {
|
||||
|
||||
class MediaDevice
|
||||
class MediaDevice : protected Loggable
|
||||
{
|
||||
public:
|
||||
MediaDevice(const std::string &deviceNode);
|
||||
@@ -52,6 +53,9 @@ public:
|
||||
|
||||
Signal<MediaDevice *> disconnected;
|
||||
|
||||
protected:
|
||||
std::string logPrefix() const;
|
||||
|
||||
private:
|
||||
std::string driver_;
|
||||
std::string deviceNode_;
|
||||
|
||||
@@ -75,6 +75,11 @@ MediaDevice::~MediaDevice()
|
||||
clear();
|
||||
}
|
||||
|
||||
std::string MediaDevice::logPrefix() const
|
||||
{
|
||||
return deviceNode() + "[" + driver() + "]";
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Claim a device for exclusive use
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user