libcamera: v4l2_videodevice: Use fd for a file descriptor

Manages file descriptors owned by V4L2VideoDevice by UniqueFD.
This also changes the return type of exportDmabufFd to UniqueFD
from FileDescriptor in order to represent a caller owns the
returned file file descriptor.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
Hirokazu Honda
2021-06-10 16:50:24 +09:00
committed by Laurent Pinchart
parent cfe4f9622e
commit a62a886a7d
2 changed files with 15 additions and 19 deletions
@@ -19,6 +19,7 @@
#include <libcamera/base/class.h>
#include <libcamera/base/log.h>
#include <libcamera/base/signal.h>
#include <libcamera/base/unique_fd.h>
#include <libcamera/framebuffer.h>
#include <libcamera/geometry.h>
@@ -31,7 +32,6 @@
namespace libcamera {
class EventNotifier;
class FileDescriptor;
class MediaDevice;
class MediaEntity;
@@ -238,7 +238,7 @@ private:
int createBuffers(unsigned int count,
std::vector<std::unique_ptr<FrameBuffer>> *buffers);
std::unique_ptr<FrameBuffer> createBuffer(unsigned int index);
FileDescriptor exportDmabufFd(unsigned int index, unsigned int plane);
UniqueFD exportDmabufFd(unsigned int index, unsigned int plane);
void bufferAvailable();
FrameBuffer *dequeueBuffer();