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>.
|
#include "qvideoframeconverter_p.h"
#include "qvideoframeconversionhelper_p.h"
#include "qvideoframeformat.h"
#include "qvideoframe_p.h"
#include "qmultimediautils_p.h"
#include <QtCore/qcoreapplication.h>
#include <QtCore/qsize.h>
#include <QtCore/qhash.h>
#include <QtCore/qfile.h>
#include <QtCore/qthreadstorage.h>
#include <QtGui/qimage.h>
#include <QtGui/qoffscreensurface.h>
#include <qpa/qplatformintegration.h>
#include <private/qvideotexturehelper_p.h>
#include <private/qabstractvideobuffer_p.h>
#include <private/qguiapplication_p.h>
#include <rhi/qrhi.h>
Go to the source code of this file.
Functions | |
static QT_BEGIN_NAMESPACE | Q_LOGGING_CATEGORY (qLcVideoFrameConverter, "qt.multimedia.video.frameconverter") namespace |
static bool | pixelFormatHasAlpha (QVideoFrameFormat::PixelFormat format) |
static QShader | vfcGetShader (const QString &name) |
static void | rasterTransform (QImage &image, QtVideo::Rotation rotation, bool mirrorX, bool mirrorY) |
static void | imageCleanupHandler (void *info) |
static QRhi * | initializeRHI (QRhi *videoFrameRhi) |
static bool | updateTextures (QRhi *rhi, std::unique_ptr< QRhiBuffer > &uniformBuffer, std::unique_ptr< QRhiSampler > &textureSampler, std::unique_ptr< QRhiShaderResourceBindings > &shaderResourceBindings, std::unique_ptr< QRhiGraphicsPipeline > &graphicsPipeline, std::unique_ptr< QRhiRenderPassDescriptor > &renderPass, QVideoFrame &frame, const std::unique_ptr< QVideoFrameTextures > &videoFrameTextures) |
static QImage | convertJPEG (const QVideoFrame &frame, QtVideo::Rotation rotation, bool mirrorX, bool mirrorY) |
static QImage | convertCPU (const QVideoFrame &frame, QtVideo::Rotation rotation, bool mirrorX, bool mirrorY) |
QImage | qImageFromVideoFrame (const QVideoFrame &frame, QtVideo::Rotation rotation, bool mirrorX, bool mirrorY) |
QImage | videoFramePlaneAsImage (QVideoFrame &frame, int plane, QImage::Format targetFormat, QSize targetSize) |
Maps the video frame and returns an image having a shared ownership for the video frame and referencing to its mapped data. | |
Variables | |
static QThreadStorage< State > | g_state |
static QHash< QString, QShader > | g_shaderCache |
static const float | g_quad [] |
|
static |
Definition at line 268 of file qvideoframeconverter.cpp.
References convert(), QImage::Format_ARGB32_Premultiplied, QImage::Format_RGB32, frame, pixelFormatHasAlpha(), Q_FUNC_INFO, qCDebug, qConverterForFormat(), rasterTransform(), and QVideoFrame::ReadOnly.
Referenced by qImageFromVideoFrame().
|
static |
Definition at line 254 of file qvideoframeconverter.cpp.
References frame, Q_FUNC_INFO, qCDebug, rasterTransform(), and QVideoFrame::ReadOnly.
Referenced by qImageFromVideoFrame().
Definition at line 133 of file qvideoframeconverter.cpp.
Definition at line 139 of file qvideoframeconverter.cpp.
References Qt::AA_ForceRasterWidgets, QGuiApplication::applicationStateChanged(), Qt::ApplicationSuspended, QObject::connect(), context, QRhi::create(), QRhi::D3D11, g_state, QRhi::Metal, QRhi::Null, QPlatformIntegration::OpenGL, QRhi::OpenGLES2, QGuiApplicationPrivate::platformIntegration(), Q_FUNC_INFO, qApp, qWarning, QPlatformIntegration::RasterGLSurface, QPlatformIntegration::RhiBasedRendering, state, and QCoreApplication::testAttribute().
Referenced by qImageFromVideoFrame().
|
static |
Definition at line 86 of file qvideoframeconverter.cpp.
References QVideoFrameFormat::Format_ABGR8888, QVideoFrameFormat::Format_ARGB8888, QVideoFrameFormat::Format_ARGB8888_Premultiplied, QVideoFrameFormat::Format_AYUV, QVideoFrameFormat::Format_AYUV_Premultiplied, QVideoFrameFormat::Format_BGRA8888, QVideoFrameFormat::Format_BGRA8888_Premultiplied, and QVideoFrameFormat::Format_RGBA8888.
Referenced by convertCPU().
|
static |
Definition at line 29 of file qvideoframeconverter.cpp.
QImage qImageFromVideoFrame | ( | const QVideoFrame & | frame, |
QtVideo::Rotation | rotation, | ||
bool | mirrorX, | ||
bool | mirrorY ) |
Definition at line 289 of file qvideoframeconverter.cpp.
References QRhiSampler::ClampToEdge, convertCPU(), convertJPEG(), QThread::currentThread(), QRhiBuffer::Dynamic, QVideoFrameFormat::Format_Invalid, QVideoFrameFormat::Format_Jpeg, frame, frameSize(), g_quad, g_state, QRhiBuffer::Immutable, initializeRHI(), QSize::isEmpty(), QRhi::isRecordingFrame(), QRhiSampler::Linear, QRhi::newBuffer(), QRhi::newSampler(), QRhi::newShaderResourceBindings(), QRhi::newTexture(), QRhi::newTextureRenderTarget(), QRhiSampler::None, qCDebug, qRotatedFrameSize(), QRhiTexture::RenderTarget, QRhiTexture::RGBA8, QWidget::size, QRhi::thread(), QRhiBuffer::UniformBuffer, and QRhiBuffer::VertexBuffer.
Referenced by AndroidTextureVideoBuffer::map(), and QVideoFrame::toImage().
|
static |
Definition at line 119 of file qvideoframeconverter.cpp.
References QtVideo::None, QTransform::rotate(), and QTransform::scale().
Referenced by convertCPU(), and convertJPEG().
|
static |
Definition at line 197 of file qvideoframeconverter.cpp.
References QRhiVertexInputAttribute::Float2, QRhiShaderStage::Fragment, QVideoTextureHelper::fragmentShaderFileName(), QRhiShaderResourceBinding::FragmentStage, frame, i, QShader::isValid(), QRhi::newGraphicsPipeline(), QRhiShaderResourceBinding::sampledTexture(), QRhiVertexInputLayout::setAttributes(), QRhiVertexInputLayout::setBindings(), QVideoTextureHelper::textureDescription(), QRhiGraphicsPipeline::TriangleStrip, QRhiShaderResourceBinding::uniformBuffer(), QRhiShaderStage::Vertex, QVideoTextureHelper::vertexShaderFileName(), QRhiShaderResourceBinding::VertexStage, and vfcGetShader().
Definition at line 103 of file qvideoframeconverter.cpp.
References QShader::fromSerialized(), g_shaderCache, and QIODeviceBase::ReadOnly.
Referenced by updateTextures().
QImage videoFramePlaneAsImage | ( | QVideoFrame & | frame, |
int | plane, | ||
QImage::Format | targetFormat, | ||
QSize | targetSize ) |
Maps the video frame and returns an image having a shared ownership for the video frame and referencing to its mapped data.
Definition at line 425 of file qvideoframeconverter.cpp.
References frame, QVideoFramePrivate::handle(), QSize::height(), Q_ASSERT, qMin(), qWarning, QVideoFrame::ReadOnly, and QSize::width().
|
static |
Definition at line 63 of file qvideoframeconverter.cpp.
Referenced by qImageFromVideoFrame().
Definition at line 61 of file qvideoframeconverter.cpp.
Referenced by vfcGetShader().
|
static |
Definition at line 60 of file qvideoframeconverter.cpp.
Referenced by initializeRHI(), and qImageFromVideoFrame().