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
qandroidvideooutput_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 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 QANDROIDVIDEOOUTPUT_H
5#define QANDROIDVIDEOOUTPUT_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 <qsize.h>
19#include <qmutex.h>
20#include <qreadwritelock.h>
21#include <qabstractvideobuffer.h>
22#include <qmatrix4x4.h>
23#include <qoffscreensurface.h>
24#include <rhi/qrhi.h>
25
27
30class QVideoSink;
31
33{
35public:
36 virtual ~QAndroidVideoOutput() { }
37
38 virtual AndroidSurfaceTexture *surfaceTexture() { return 0; }
39 virtual AndroidSurfaceHolder *surfaceHolder() { return 0; }
40
41 virtual bool isReady() { return true; }
42
43 virtual void setVideoSize(const QSize &) { }
44 virtual void start() { }
45 virtual void stop() { }
46 virtual void reset() { }
47 virtual QSize getVideoSize() const { return QSize(0, 0); }
48
50 void readyChanged(bool);
51
52protected:
53 QAndroidVideoOutput(QObject *parent) : QObject(parent) { }
54};
55
58{
60public:
63
64 QVideoSink *surface() const { return m_sink; }
65 bool shouldTextureBeUpdated() const;
66
68
69 void setVideoSize(const QSize &) override;
70 void stop() override;
71 void reset() override;
72 QSize getVideoSize() const override { return m_nativeSize; }
73
74 void setSubtitle(const QString &subtitle);
75 std::shared_ptr<AndroidTextureThread> getSurfaceThread() { return m_surfaceThread; }
76private Q_SLOTS:
77 void newFrame(const QVideoFrame &);
78
79private:
80 void startNewSurfaceThread();
81 QVideoSink *m_sink = nullptr;
82 QSize m_nativeSize;
83 bool m_surfaceCreatedWithoutRhi = false;
84
85 std::shared_ptr<AndroidTextureThread> m_surfaceThread;
86};
87
88QT_END_NAMESPACE
89
90Q_DECLARE_METATYPE(QList<QRhiResource *>)
91Q_DECLARE_METATYPE(QRhi*)
92
93#endif // QANDROIDVIDEOOUTPUT_H
MapData map(QVideoFrame::MapMode mode) override
Maps the planes of a video buffer to memory.
void unmap() override
Releases the memory mapped by the map() function.
AndroidTextureVideoBuffer(std::shared_ptr< QRhi > rhi, std::shared_ptr< AndroidTextureThread > thread, std::unique_ptr< QRhiTexture > tex, const QSize &size)
QVideoFrameTexturesUPtr mapTextures(QRhi &rhi, QVideoFrameTexturesUPtr &) override
void unmap() override
Releases the memory mapped by the map() function.
QVideoFrameTexturesUPtr mapTextures(QRhi &rhi, QVideoFrameTexturesUPtr &oldTextures) override
ImageFromVideoFrameHelper(AndroidTextureVideoBuffer &atvb)
MapData map(QVideoFrame::MapMode) override
Maps the planes of a video buffer to memory.
QSize getVideoSize() const override
void setSubtitle(const QString &subtitle)
void setVideoSize(const QSize &) override
std::shared_ptr< AndroidTextureThread > getSurfaceThread()
AndroidSurfaceTexture * surfaceTexture() override
QAndroidVideoFrameTextures(QRhi *rhi, QSize size, quint64 handle)
QRhiTexture * texture(uint plane) const override
\inmodule QtCore
Definition qfile.h:95
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:322
std::shared_ptr< QRhi > m_guardRhi
TextureCopy(QRhi *rhi, QRhiTexture *externalTex)
std::unique_ptr< QRhiTexture > copyExternalTexture(QSize size, const QMatrix4x4 &externalTexMatrix)
Combined button and popup list for selecting options.
static QMatrix4x4 extTransformMatrix(AndroidSurfaceTexture *surfaceTexture)
static std::unique_ptr< QRhiGraphicsPipeline > newGraphicsPipeline(QRhi *rhi, QRhiShaderResourceBindings *shaderResourceBindings, QRhiRenderPassDescriptor *renderPassDescriptor, QShader vertexShader, QShader fragmentShader)
static const float g_quad[]