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
29QT_BEGIN_NAMESPACE
30
31namespace QtV4L2 {
32
35
37{
38public:
44
46
47 virtual ~QV4L2MemoryTransfer();
48
49 virtual std::optional<Frame> dequeueFrame() = 0;
50
51 virtual quint32 buffersCount() const = 0;
52
53protected:
54 virtual bool enqueueBuffer(quint32 index) = 0;
55
56 bool enqueueBuffers();
57
58 q23::expected<int, std::error_code> ioctl(int request, void *arg);
59 const QV4L2FileDescriptor &fileDescriptor() const { return *m_fileDescriptor; }
60
61private:
62 QV4L2FileDescriptorPtr m_fileDescriptor;
63};
64
66
68 const v4l2_pix_format &format);
69
71 const v4l2_pix_format &format);
72
73#if QT_CONFIG(linux_dmabuf)
75 const v4l2_pix_format &format);
76#endif
77
78} // namespace QtV4L2
79
80QT_END_NAMESPACE
81
82#endif // QV4L2MEMORYTRANSFER_P_H
QV4L2MemoryTransfer(QV4L2FileDescriptorPtr fileDescriptor)
virtual bool enqueueBuffer(quint32 index)=0
virtual std::optional< Frame > dequeueFrame()=0
const QV4L2FileDescriptor & fileDescriptor() const
q23::expected< int, std::error_code > ioctl(int request, void *arg)
virtual quint32 buffersCount() const =0
QV4L2MemoryTransferUPtr makeUserPtrMemoryTransfer(QV4L2FileDescriptorPtr fileDescriptor, const v4l2_pix_format &format)
Q_STATIC_LOGGING_CATEGORY(qLcV4L2Camera, "qt.multimedia.v4l2.camera")
QV4L2MemoryTransferUPtr makeMMapMemoryTransfer(QV4L2FileDescriptorPtr fileDescriptor, const v4l2_pix_format &format)
std::shared_ptr< QV4L2FileDescriptor > QV4L2FileDescriptorPtr
#define MAP_FAILED
std::unique_ptr< QAbstractVideoBuffer > videoBuffer