libcamera: v4l2_device: Add MediaEntity contructor
Construct a V4L2Device from a MediaEntity device node path. While at there mark constructor as explicit to avoid copy-construction. Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
@@ -32,10 +32,12 @@ struct V4L2Capability final : v4l2_capability {
|
||||
bool hasStreaming() const { return capabilities & V4L2_CAP_STREAMING; }
|
||||
};
|
||||
|
||||
class MediaEntity;
|
||||
class V4L2Device
|
||||
{
|
||||
public:
|
||||
V4L2Device(const std::string &devnode);
|
||||
explicit V4L2Device(const std::string &devnode);
|
||||
explicit V4L2Device(const MediaEntity &entity);
|
||||
V4L2Device(const V4L2Device &) = delete;
|
||||
~V4L2Device();
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include "log.h"
|
||||
#include "media_object.h"
|
||||
#include "v4l2_device.h"
|
||||
|
||||
/**
|
||||
@@ -94,6 +95,17 @@ V4L2Device::V4L2Device(const std::string &devnode)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Construct a V4L2Device from a MediaEntity
|
||||
* \param entity The MediaEntity to build the device from
|
||||
*
|
||||
* Construct a V4L2Device from a MediaEntity's device node path.
|
||||
*/
|
||||
V4L2Device::V4L2Device(const MediaEntity &entity)
|
||||
: V4L2Device(entity.devnode())
|
||||
{
|
||||
}
|
||||
|
||||
V4L2Device::~V4L2Device()
|
||||
{
|
||||
close();
|
||||
|
||||
Reference in New Issue
Block a user