libcamera: v4l2_subdevice: Store media entity

Store the media entity backing the V4L2Subdevice and add a deviceName()
method to retrieve the human readable name of the subdevice, which is
created using the name of the associated media entity.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
Jacopo Mondi
2019-03-01 12:31:45 +01:00
parent 77100a7578
commit c6daee909c
2 changed files with 17 additions and 8 deletions
+5 -3
View File
@@ -9,9 +9,10 @@
#include <string>
#include "media_object.h"
namespace libcamera {
class MediaEntity;
struct Rectangle;
struct V4L2SubdeviceFormat {
@@ -31,7 +32,8 @@ public:
bool isOpen() const;
void close();
std::string deviceNode() const { return deviceNode_; }
std::string deviceNode() const { return entity_->deviceNode(); }
std::string deviceName() const { return entity_->name(); }
int setCrop(unsigned int pad, Rectangle *rect);
int setCompose(unsigned int pad, Rectangle *rect);
@@ -43,7 +45,7 @@ private:
int setSelection(unsigned int pad, unsigned int target,
Rectangle *rect);
std::string deviceNode_;
const MediaEntity *entity_;
int fd_;
};