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:
Kieran Bingham
2020-02-17 23:48:11 +00:00
parent 90240a7950
commit b0f1307fcf
2 changed files with 10 additions and 1 deletions

View File

@@ -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_;

View File

@@ -75,6 +75,11 @@ MediaDevice::~MediaDevice()
clear();
}
std::string MediaDevice::logPrefix() const
{
return deviceNode() + "[" + driver() + "]";
}
/**
* \brief Claim a device for exclusive use
*