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
using
HWAccelUPtr
=
std
::
unique_ptr
<
HWAccel
>;
40
41
/**
42
* @brief The HwFrameContextData class contains custom belongings
43
* of hw frames context.
44
*/
45
struct
HwFrameContextData
46
{
47
using
AVHWFramesContextDeleter
=
void
(*)(
struct
AVHWFramesContext *ctx);
48
AVHWFramesContextDeleter
avDeleter
=
nullptr
;
49
void
*
avUserOpaque
=
nullptr
;
50
51
QRhiValueMapper
<
TextureConverter
>
textureConverterMapper
= {};
52
53
/**
54
* @brief gets or creates an instance of the class, associated with
55
* the frames context of the specified frame. Note, AVFrame
56
* holds shared ownership of the frames context, so consider this
57
* when designing HwFrameContextData's lifetime.
58
*/
59
static
HwFrameContextData
&
ensure
(AVFrame &hwFrame);
60
};
61
62
class
HWAccel
63
{
64
const
AVBufferUPtr m_hwDeviceContext;
65
AVBufferUPtr m_hwFramesContext;
66
67
mutable
std
::once_flag m_constraintsOnceFlag;
68
mutable
AVHWFramesConstraintsUPtr m_constraints;
69
70
public
:
71
~
HWAccel
();
72
73
static
HWAccelUPtr
create
(AVHWDeviceType deviceType);
74
75
static
std::pair<std::optional<Codec>, HWAccelUPtr> findDecoderWithHwAccel(AVCodecID id);
76
77
AVHWDeviceType
deviceType
()
const
;
78
79
AVBufferRef
*
hwDeviceContextAsBuffer
()
const
{
return
m_hwDeviceContext.get(); }
80
AVHWDeviceContext
*
hwDeviceContext
()
const
;
81
AVPixelFormat
hwFormat
()
const
;
82
const
AVHWFramesConstraints
*
constraints
()
const
;
83
84
bool
matchesSizeContraints
(QSize size)
const
;
85
86
void
createFramesContext
(AVPixelFormat swFormat,
const
QSize &size);
87
void
destroyFramesContext
();
88
void
updateFramesContext
(AVPixelFormat swFormat,
const
QSize &size);
89
AVBufferRef
*
hwFramesContextAsBuffer
()
const
{
return
m_hwFramesContext.get(); }
90
AVHWFramesContext *
hwFramesContext
()
const
;
91
92
static
AVPixelFormat
format
(AVFrame *frame);
93
static
QSpan
<
const
AVHWDeviceType
>
encodingDeviceTypes
();
94
static
QSpan
<
const
AVHWDeviceType
>
decodingDeviceTypes
();
95
96
private
:
97
HWAccel(AVBufferUPtr hwDeviceContext) : m_hwDeviceContext(std::move(hwDeviceContext)) { }
98
};
99
100
AVFrameUPtr
copyFromHwPool
(AVFrameUPtr frame);
101
102
}
// namespace QFFmpeg
103
104
QT_END_NAMESPACE
105
106
#
endif
QFFmpegVideoBuffer
Definition
qffmpegvideobuffer_p.h:27
QFFmpeg::HWAccel
Definition
qffmpeghwaccel_p.h:63
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:89
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:79
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:1814
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:46
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:49
QFFmpeg::HwFrameContextData::avDeleter
AVHWFramesContextDeleter avDeleter
Definition
qffmpeghwaccel_p.h:48
QFFmpeg::HwFrameContextData::textureConverterMapper
QRhiValueMapper< TextureConverter > textureConverterMapper
Definition
qffmpeghwaccel_p.h:51
qtmultimedia
src
plugins
multimedia
ffmpeg
qffmpeghwaccel_p.h
Generated on
for Qt by
1.18.0