Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qv4l2memorytransfer_p.h
Go to the documentation of this file.
1// Copyright (C) 2023 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QV4L2MEMORYTRANSFER_P_H
5#define QV4L2MEMORYTRANSFER_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtMultimedia/qabstractvideobuffer.h>
19#include <QtMultimedia/private/qtmultimediaglobal_p.h>
20#include <QtCore/qtypes.h>
21#include <QtCore/private/qexpected_p.h>
22
23#include <linux/videodev2.h>
24#include <sys/time.h>
25
26#include <memory>
27#include <optional>
28#include <system_error>
29
30QT_BEGIN_NAMESPACE
31
32namespace QtV4L2 {
33
36
38{
39public:
45
47
48 virtual ~QV4L2MemoryTransfer();
49
51
52 virtual quint32 buffersCount() const = 0;
53
54protected:
55 virtual q23::expected<void, std::error_code> enqueueBuffer(quint32 index) = 0;
56
58
59 q23::expected<int, std::error_code> ioctl(int request, void *arg);
60 const QV4L2FileDescriptor &fileDescriptor() const { return *m_fileDescriptor; }
61
62private:
63 QV4L2FileDescriptorPtr m_fileDescriptor;
64};
65
67
69makeUserPtrMemoryTransfer(QV4L2FileDescriptorPtr fileDescriptor, const v4l2_pix_format &format);
70
72makeMMapMemoryTransfer(QV4L2FileDescriptorPtr fileDescriptor, const v4l2_pix_format &format);
73
74#if QT_CONFIG(linux_dmabuf)
77 const v4l2_pix_format &format);
78#endif
79
80} // namespace QtV4L2
81
82QT_END_NAMESPACE
83
84#endif // QV4L2MEMORYTRANSFER_P_H
QV4L2MemoryTransfer(QV4L2FileDescriptorPtr fileDescriptor)
virtual q23::expected< void, std::error_code > enqueueBuffer(quint32 index)=0
virtual q23::expected< Frame, std::error_code > dequeueFrame()=0
const QV4L2FileDescriptor & fileDescriptor() const
q23::expected< int, std::error_code > ioctl(int request, void *arg)
q23::expected< void, std::error_code > enqueueBuffers()
virtual quint32 buffersCount() const =0
q23::expected< QV4L2MemoryTransferUPtr, std::error_code > makeUserPtrMemoryTransfer(QV4L2FileDescriptorPtr fileDescriptor, const v4l2_pix_format &format)
Q_STATIC_LOGGING_CATEGORY(qLcV4L2Camera, "qt.multimedia.v4l2.camera")
q23::expected< QV4L2MemoryTransferUPtr, std::error_code > makeMMapMemoryTransfer(QV4L2FileDescriptorPtr fileDescriptor, const v4l2_pix_format &format)
std::shared_ptr< QV4L2FileDescriptor > QV4L2FileDescriptorPtr
#define MAP_FAILED
std::unique_ptr< QAbstractVideoBuffer > videoBuffer