Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qlinuxmediadevice.h
Go to the documentation of this file.
1// Copyright (C) 2017 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 QLINUXMEDIADEVICE_H
5#define QLINUXMEDIADEVICE_H
6
7#include <linux/v4l2-mediabus.h>
8
9#include <QtCore/qglobal.h>
10#include <QtCore/QString>
11
13
14class QSize;
15class QRect;
16
18{
19public:
20 QLinuxMediaDevice(const QString &devicePath);
22
23 QString model();
25 bool resetLinks();
26 struct media_link *parseLink(const QString &link);
27 struct media_pad *parsePad(const QString &pad);
28 bool enableLink(struct media_link *link);
29 bool disableLink(struct media_link *link);
30 struct media_entity *getEntity(const QString &name);
31 int openVideoDevice(const QString &name);
32
34 {
35 public:
36 CaptureSubDevice(QLinuxMediaDevice *mediaDevice, const QString &name);
37 bool setFormat(const QSize &size, uint32_t pixelFormat = V4L2_PIX_FMT_ABGR32); //TODO: fix to match output device
38 bool clearBuffers();
39 bool requestBuffer();
40 bool queueBuffer(int dmabufFd, const QSize &bufferSize);
41 bool dequeueBuffer();
42 bool streamOn();
43 bool streamOff();
44 private:
45 int m_subdevFd = -1;
46 };
47
49 {
50 public:
51 OutputSubDevice(QLinuxMediaDevice *mediaDevice, const QString &name);
52 bool setFormat(const QSize &size, uint32_t pixelFormat, uint32_t bytesPerLine);
53 bool clearBuffers();
54 bool requestBuffer();
55 bool queueBuffer(int dmabufFd, uint bytesUsed, uint length);
56 bool streamOn();
57 bool streamOff();
58 private:
59 int m_subdevFd = -1;
60 };
61
62 static int openVideoDevice(media_pad *pad);
63
64 static bool setSubdevFormat(struct media_pad *pad, const QSize &size, uint32_t mbusFormat = MEDIA_BUS_FMT_ARGB8888_1X32);
65 static bool setSubdevAlpha(int subdevFd, qreal alpha);
66
67 static bool setSubdevSelection(struct media_pad *pad, const QRect &geometry, uint target);
68 static bool setSubdevCrop(struct media_pad *pad, const QRect &geometry);
69 static bool setSubdevCompose(struct media_pad *pad, const QRect &geometry);
70
71private:
72 static bool streamOn(int subDeviceFd, v4l2_buf_type bufferType);
73 static bool streamOff(int subDeviceFd, v4l2_buf_type bufferType);
74 struct media_device *m_mediaDevice = nullptr;
75 const struct media_device_info *m_info = nullptr;
76};
77
79
80#endif // QLINUXMEDIADEVICE_H
bool setFormat(const QSize &size, uint32_t pixelFormat=V4L2_PIX_FMT_ABGR32)
CaptureSubDevice(QLinuxMediaDevice *mediaDevice, const QString &name)
bool queueBuffer(int dmabufFd, const QSize &bufferSize)
bool queueBuffer(int dmabufFd, uint bytesUsed, uint length)
OutputSubDevice(QLinuxMediaDevice *mediaDevice, const QString &name)
bool setFormat(const QSize &size, uint32_t pixelFormat, uint32_t bytesPerLine)
int openVideoDevice(const QString &name)
struct media_link * parseLink(const QString &link)
bool enableLink(struct media_link *link)
static bool setSubdevCrop(struct media_pad *pad, const QRect &geometry)
bool disableLink(struct media_link *link)
static bool setSubdevSelection(struct media_pad *pad, const QRect &geometry, uint target)
struct media_pad * parsePad(const QString &pad)
static bool setSubdevAlpha(int subdevFd, qreal alpha)
struct media_entity * getEntity(const QString &name)
QLinuxMediaDevice(const QString &devicePath)
static bool setSubdevFormat(struct media_pad *pad, const QSize &size, uint32_t mbusFormat=MEDIA_BUS_FMT_ARGB8888_1X32)
static bool setSubdevCompose(struct media_pad *pad, const QRect &geometry)
\inmodule QtCore\reentrant
Definition qrect.h:30
\inmodule QtCore
Definition qsize.h:25
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
Combined button and popup list for selecting options.
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLuint GLenum GLsizei length
GLenum target
GLuint name
GLfloat GLfloat GLfloat alpha
Definition qopenglext.h:418
unsigned int uint
Definition qtypes.h:34
double qreal
Definition qtypes.h:187