Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qffmpeghwaccel_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
#
ifndef
QFFMPEGHWACCEL_P_H
4
#
define
QFFMPEGHWACCEL_P_H
5
6
//
7
// W A R N I N G
8
// -------------
9
//
10
// This file is not part of the Qt API. It exists purely as an
11
// implementation detail. This header file may change from version to
12
// version without notice, or even be removed.
13
//
14
// We mean it.
15
//
16
17
#
include
<
QtFFmpegMediaPluginImpl
/
private
/
qffmpeg_p
.
h
>
18
#
include
<
QtFFmpegMediaPluginImpl
/
private
/
qffmpegtextureconverter_p
.
h
>
19
#
include
<
QtMultimedia
/
qvideoframeformat
.
h
>
20
#
include
<
QtMultimedia
/
private
/
qhwvideobuffer_p
.
h
>
21
#
include
<
QtMultimedia
/
private
/
qrhivaluemapper_p
.
h
>
22
#
include
<
QtCore
/
qspan
.
h
>
23
24
#
include
<
memory
>
25
#
include
<
mutex
>
26
27
QT_BEGIN_NAMESPACE
28
29
class
QRhi;
30
class
QRhiTexture;
31
class
QFFmpegVideoBuffer
;
32
33
namespace
QFFmpeg
{
34
35
// used for the get_format callback for the decoder
36
AVPixelFormat
getFormat
(AVCodecContext *s,
const
AVPixelFormat *fmt);
37
38
class
HWAccel
;
39
40
class
HWAccel
;
41
using
HWAccelUPtr
=
std
::
unique_ptr
<
HWAccel
>;
42
43
/**
44
* @brief The HwFrameContextData class contains custom belongings
45
* of hw frames context.
46
*/
47
struct
HwFrameContextData
48
{
49
using
AVHWFramesContextDeleter
=
void
(*)(
struct
AVHWFramesContext *ctx);
50
AVHWFramesContextDeleter
avDeleter
=
nullptr
;
51
void
*
avUserOpaque
=
nullptr
;
52
53
QRhiValueMapper
<
TextureConverter
>
textureConverterMapper
= {};
54
55
/**
56
* @brief gets or creates an instance of the class, associated with
57
* the frames context of the specified frame. Note, AVFrame
58
* holds shared ownership of the frames context, so consider this
59
* when designing HwFrameContextData's lifetime.
60
*/
61
static
HwFrameContextData
&
ensure
(AVFrame &hwFrame);
62
};
63
64
class
HWAccel
65
{
66
const
AVBufferUPtr m_hwDeviceContext;
67
AVBufferUPtr m_hwFramesContext;
68
69
mutable
std
::once_flag m_constraintsOnceFlag;
70
mutable
AVHWFramesConstraintsUPtr m_constraints;
71
72
public
:
73
~
HWAccel
();
74
75
static
HWAccelUPtr
create
(AVHWDeviceType deviceType);
76
77
static
std::pair<std::optional<Codec>, HWAccelUPtr> findDecoderWithHwAccel(AVCodecID id);
78
79
AVHWDeviceType
deviceType
()
const
;
80
81
AVBufferRef
*
hwDeviceContextAsBuffer
()
const
{
return
m_hwDeviceContext.get(); }
82
AVHWDeviceContext
*
hwDeviceContext
()
const
;
83
AVPixelFormat
hwFormat
()
const
;
84
const
AVHWFramesConstraints
*
constraints
()
const
;
85
86
bool
matchesSizeContraints
(QSize size)
const
;
87
88
void
createFramesContext
(AVPixelFormat swFormat,
const
QSize &size);
89
void
destroyFramesContext
();
90
void
updateFramesContext
(AVPixelFormat swFormat,
const
QSize &size);
91
AVBufferRef
*
hwFramesContextAsBuffer
()
const
{
return
m_hwFramesContext.get(); }
92
AVHWFramesContext *
hwFramesContext
()
const
;
93
94
static
AVPixelFormat
format
(AVFrame *frame);
95
static
QSpan
<
const
AVHWDeviceType
>
encodingDeviceTypes
();
96
static
QSpan
<
const
AVHWDeviceType
>
decodingDeviceTypes
();
97
98
private
:
99
HWAccel(AVBufferUPtr hwDeviceContext) : m_hwDeviceContext(std::move(hwDeviceContext)) { }
100
};
101
102
AVFrameUPtr
copyFromHwPool
(AVFrameUPtr frame);
103
104
}
// namespace QFFmpeg
105
106
QT_END_NAMESPACE
107
108
#
endif
QFFmpegVideoBuffer
Definition
qffmpegvideobuffer_p.h:27
QFFmpeg::HWAccel
Definition
qffmpeghwaccel_p.h:65
QFFmpeg::HWAccel::destroyFramesContext
void destroyFramesContext()
Definition
qffmpeghwaccel.cpp:467
QFFmpeg::HWAccel::hwFramesContext
AVHWFramesContext * hwFramesContext() const
Definition
qffmpeghwaccel.cpp:485
QFFmpeg::HWAccel::encodingDeviceTypes
static QSpan< const AVHWDeviceType > encodingDeviceTypes()
Definition
qffmpeghwaccel.cpp:394
QFFmpeg::HWAccel::matchesSizeContraints
bool matchesSizeContraints(QSize size) const
Definition
qffmpeghwaccel.cpp:426
QFFmpeg::HWAccel::hwFramesContextAsBuffer
AVBufferRef * hwFramesContextAsBuffer() const
Definition
qffmpeghwaccel_p.h:91
QFFmpeg::HWAccel::~HWAccel
~HWAccel()
QFFmpeg::HWAccel::decodingDeviceTypes
static QSpan< const AVHWDeviceType > decodingDeviceTypes()
Definition
qffmpeghwaccel.cpp:400
QFFmpeg::HWAccel::createFramesContext
void createFramesContext(AVPixelFormat swFormat, const QSize &size)
Definition
qffmpeghwaccel.cpp:443
QFFmpeg::HWAccel::format
static AVPixelFormat format(AVFrame *frame)
Definition
qffmpeghwaccel.cpp:384
QFFmpeg::HWAccel::hwDeviceContextAsBuffer
AVBufferRef * hwDeviceContextAsBuffer() const
Definition
qffmpeghwaccel_p.h:81
QFFmpeg::HWAccel::create
static HWAccelUPtr create(AVHWDeviceType deviceType)
Definition
qffmpeghwaccel.cpp:376
QFFmpeg::HWAccel::constraints
const AVHWFramesConstraints * constraints() const
Definition
qffmpeghwaccel.cpp:416
QFFmpeg::HWAccel::updateFramesContext
void updateFramesContext(AVPixelFormat swFormat, const QSize &size)
Definition
qffmpeghwaccel.cpp:472
QFFmpeg::HWAccel::hwDeviceContext
AVHWDeviceContext * hwDeviceContext() const
Definition
qffmpeghwaccel.cpp:406
QFFmpeg::HWAccel::hwFormat
AVPixelFormat hwFormat() const
Definition
qffmpeghwaccel.cpp:411
QFFmpeg::HWAccel::deviceType
AVHWDeviceType deviceType() const
Definition
qffmpeghwaccel.cpp:438
QFFmpeg
Definition
qandroidcacertificates.cpp:26
QFFmpeg::AVError
AVError
Definition
qffmpeg_p.h:350
QFFmpeg::AVCodecCapabilities
AVCodecCapabilities
Definition
qffmpeg_p.h:354
QFFmpeg::copyFromHwPool
AVFrameUPtr copyFromHwPool(AVFrameUPtr frame)
Definition
qffmpeghwaccel.cpp:524
QFFmpeg::CodecRole
CodecRole
Definition
qffmpegcodecstorage_p.h:30
QFFmpeg::CodecRole::Decoders
@ Decoders
Definition
qffmpegcodecstorage_p.h:32
QFFmpeg::CodecRole::Encoders
@ Encoders
Definition
qffmpegcodecstorage_p.h:31
QFFmpeg::getFormat
AVPixelFormat getFormat(AVCodecContext *codecContext, const AVPixelFormat *fmt)
Definition
qffmpeghwaccel.cpp:304
Qt::Literals
Definition
qstring.h:1820
Qt
Definition
qcompare.h:111
std
[33]
Definition
src_corelib_tools_qhash.cpp:421
Q_STATIC_LOGGING_CATEGORY
QT_BEGIN_NAMESPACE Q_STATIC_LOGGING_CATEGORY(lcSynthesizedIterableAccess, "qt.iterable.synthesized", QtWarningMsg)
QFFmpeg::HwFrameContextData
The HwFrameContextData class contains custom belongings of hw frames context.
Definition
qffmpeghwaccel_p.h:48
QFFmpeg::HwFrameContextData::ensure
static HwFrameContextData & ensure(AVFrame &hwFrame)
gets or creates an instance of the class, associated with the frames context of the specified frame....
Definition
qffmpeghwaccel.cpp:504
QFFmpeg::HwFrameContextData::avUserOpaque
void * avUserOpaque
Definition
qffmpeghwaccel_p.h:51
QFFmpeg::HwFrameContextData::avDeleter
AVHWFramesContextDeleter avDeleter
Definition
qffmpeghwaccel_p.h:50
QFFmpeg::HwFrameContextData::textureConverterMapper
QRhiValueMapper< TextureConverter > textureConverterMapper
Definition
qffmpeghwaccel_p.h:53
qtmultimedia
src
plugins
multimedia
ffmpeg
qffmpeghwaccel_p.h
Generated on
for Qt by
1.18.0