Prepare for using the V4L2CameraFile as a container for file-specific information in the V4L2 compatibility layer by making it a required argument for all V4L2CameraProxy calls that are directed from V4L2CompatManager, which are intercepted via LD_PRELOAD. Change V4L2CameraFile accordingly. Also change V4L2CompatManager accordingly. Instead of keeping a map of file descriptors to V4L2CameraProxy instances, we keep a map of V4L2CameraFile instances to V4L2CameraProxy instances. When the proxy methods are called, feed the file as a parameter. The dup function is also modified, in that it is removed from V4L2CameraProxy, and is handled completely in V4L2CompatManager, as a map from file descriptors to V4L2CameraFile instances. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
26 lines
543 B
C++
26 lines
543 B
C++
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
|
/*
|
|
* Copyright (C) 2020, Google Inc.
|
|
*
|
|
* v4l2_camera_file.h - V4L2 compatibility camera file information
|
|
*/
|
|
|
|
#include "v4l2_camera_file.h"
|
|
|
|
#include <linux/videodev2.h>
|
|
|
|
#include "v4l2_camera_proxy.h"
|
|
|
|
using namespace libcamera;
|
|
|
|
V4L2CameraFile::V4L2CameraFile(int efd, bool nonBlocking, V4L2CameraProxy *proxy)
|
|
: proxy_(proxy), nonBlocking_(nonBlocking), efd_(efd),
|
|
priority_(V4L2_PRIORITY_DEFAULT)
|
|
{
|
|
proxy_->open(this);
|
|
}
|
|
|
|
V4L2CameraFile::~V4L2CameraFile()
|
|
{
|
|
proxy_->close(this);
|
|
}
|