v4l2: V4L2CameraProxy: Take V4L2CameraFile as argument for intercepted calls

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>
This commit is contained in:
Paul Elder 2020-06-22 18:42:07 +09:00
parent d37ec82515
commit edacd07c5e
5 changed files with 88 additions and 106 deletions

View file

@ -17,10 +17,10 @@ V4L2CameraFile::V4L2CameraFile(int efd, bool nonBlocking, V4L2CameraProxy *proxy
: proxy_(proxy), nonBlocking_(nonBlocking), efd_(efd),
priority_(V4L2_PRIORITY_DEFAULT)
{
proxy_->open(nonBlocking);
proxy_->open(this);
}
V4L2CameraFile::~V4L2CameraFile()
{
proxy_->close();
proxy_->close(this);
}