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
qffmpegvideobuffer_p.h
Go to the documentation of this file.
1// Copyright (C) 2021 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 QFFMPEGVIDEOBUFFER_P_H
5#define QFFMPEGVIDEOBUFFER_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 <private/qtmultimediaglobal_p.h>
19#include <private/qabstractvideobuffer_p.h>
20#include <qvideoframe.h>
21#include <QtCore/qvariant.h>
22
23#include "qffmpeg_p.h"
24#include "qffmpeghwaccel_p.h"
25
27
29{
30public:
32
33 QFFmpegVideoBuffer(AVFrameUPtr frame, AVRational pixelAspectRatio = { 1, 1 });
35
36 QVideoFrame::MapMode mapMode() const override;
38 void unmap() override;
39
40 virtual std::unique_ptr<QVideoFrameTextures> mapTextures(QRhi *) override;
41 virtual quint64 textureHandle(QRhi *rhi, int plane) const override;
42
44 QSize size() const;
45
46 static QVideoFrameFormat::PixelFormat toQtPixelFormat(AVPixelFormat avPixelFormat, bool *needsConversion = nullptr);
48
49 void convertSWFrame();
50
51 AVFrame *getHWFrame() const { return m_hwFrame.get(); }
52
54
58
59 float maxNits();
60
61private:
63 AVFrame *m_frame = nullptr;
64 AVFrameUPtr m_hwFrame;
65 AVFrameUPtr m_swFrame;
66 QSize m_size;
67 QFFmpeg::TextureConverter m_textureConverter;
69 std::unique_ptr<QFFmpeg::TextureSet> m_textures;
70};
71
73
74#endif
The QAbstractVideoBuffer class is an abstraction for video data. \inmodule QtMultimedia.
QRhi * rhi() const
Returns the QRhi instance.
QVideoFrameFormat::PixelFormat pixelFormat() const
QVideoFrameFormat::ColorSpace colorSpace() const
void unmap() override
Releases the memory mapped by the map() function.
QVideoFrameFormat::ColorTransfer colorTransfer() const
QFFmpeg::AVFrameUPtr AVFrameUPtr
void setTextureConverter(const QFFmpeg::TextureConverter &converter)
virtual std::unique_ptr< QVideoFrameTextures > mapTextures(QRhi *) override
static AVPixelFormat toAVPixelFormat(QVideoFrameFormat::PixelFormat pixelFormat)
QVideoFrameFormat::ColorRange colorRange() const
AVFrame * getHWFrame() const
static QVideoFrameFormat::PixelFormat toQtPixelFormat(AVPixelFormat avPixelFormat, bool *needsConversion=nullptr)
QFFmpegVideoBuffer(AVFrameUPtr frame, AVRational pixelAspectRatio={ 1, 1 })
~QFFmpegVideoBuffer() override
virtual quint64 textureHandle(QRhi *rhi, int plane) const override
Returns a texture handle to the data buffer.
QVideoFrame::MapMode mapMode() const override
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1804
\inmodule QtCore
Definition qsize.h:25
ColorSpace
Enumerates the color space of video frames.
ColorTransfer
\value ColorTransfer_Unknown The color transfer function is unknown.
PixelFormat
Enumerates video data types.
ColorRange
Describes the color range used by the video data.
MapMode
Enumerates how a video buffer's data is mapped to system memory.
Definition qvideoframe.h:37
QMap< QString, QString > map
[6]
std::unique_ptr< AVFrame, AVDeleter< decltype(&av_frame_free), &av_frame_free > > AVFrameUPtr
Definition qffmpeg_p.h:134
Combined button and popup list for selecting options.
GLenum mode
unsigned long long quint64
Definition qtypes.h:61
QFrame frame
[0]