libcamera: include/libcamera/internal/v4l2_request.h Source File

libcamera v0.7.1 Supporting cameras in Linux since 2019

Loading...
Searching...
No Matches
v4l2_request.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: LGPL-2.1-or-later */
2/*
3 * Copyright (C) 2025, Ideas On Board
4 *
5 * V4L2 Request
6 */
7
8#pragma once
9
10#include <string>
11
12#include <linux/videodev2.h>
13
14#include <libcamera/base/event_notifier.h>
15#include <libcamera/base/log.h>
16#include <libcamera/base/signal.h>
17#include <libcamera/base/unique_fd.h>
18
19namespace libcamera {
20
21 class V4L2Request : protected Loggable
22{
23public:
24 bool isValid() const { return fd_.isValid(); }
25 int fd() const { return fd_.get(); }
26
27 int reinit();
28 int queue();
29
30 V4L2Request(UniqueFD &&fd);
31
32 Signal<V4L2Request *> requestDone;
33
34private:
35 LIBCAMERA_DISABLE_COPY_AND_MOVE(V4L2Request)
36
37 void requestReady();
38 std::string logPrefix() const override;
39
40 UniqueFD fd_;
41 EventNotifier fdNotifier_;
42};
43
44} /* namespace libcamera */
LIBCAMERA_DISABLE_COPY_AND_MOVE
#define LIBCAMERA_DISABLE_COPY_AND_MOVE(klass)
Disable copy and move construction and assignment of the klass.
Definition class.h:29
libcamera::EventNotifier
Notify of activity on a file descriptor.
Definition event_notifier.h:20
libcamera::Loggable
Base class to support log message extensions.
Definition log.h:92
libcamera::Loggable::logPrefix
virtual std::string logPrefix() const =0
Retrieve a string to be prefixed to the log message.
libcamera::Signal
Generic signal and slot communication mechanism.
Definition signal.h:39
libcamera::UniqueFD
unique_ptr-like wrapper for a file descriptor
Definition unique_fd.h:17
libcamera::V4L2Request::fd
int fd() const
Get the file descriptor.
Definition v4l2_request.h:25
libcamera::V4L2Request::requestDone
Signal< V4L2Request * > requestDone
Signal that is emitted when the request is done.
Definition v4l2_request.h:32
libcamera::V4L2Request::queue
int queue()
Queue the request.
Definition v4l2_request.cpp:102
libcamera::V4L2Request::V4L2Request
V4L2Request(UniqueFD &&fd)
Construct a V4L2Request.
Definition v4l2_request.cpp:47
libcamera::V4L2Request::reinit
int reinit()
Reinit the request.
Definition v4l2_request.cpp:85
libcamera::V4L2Request::isValid
bool isValid() const
Check if the request is valid.
Definition v4l2_request.h:24
event_notifier.h
File descriptor event notifier.
log.h
Logging infrastructure.
libcamera
Top-level libcamera namespace.
Definition backtrace.h:17
signal.h
Signal & slot implementation.
unique_fd.h
File descriptor wrapper that owns a file descriptor.