summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtem Dyomin <artem.dyomin@qt.io>2024-03-08 15:40:05 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2024-03-08 23:27:47 +0000
commitea95589efcfe2047dc5f5c617a1beae54db30a11 (patch)
treef12db9144142ff522a1ba51763babfe2bf04e103
parent74c2d1e816e6753cba178f08f795a9a16e10f280 (diff)
Fix naming of members in QFFmpegVideoBuffer
Pick-to: 6.5 Change-Id: I73a3312d60b0ef6a30b90344d13e3a5ed8d490fc Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> (cherry picked from commit 024bafe4a13a44b172304d2ba71c35596d03997b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit 8eb764291bb6187f30bc9ccc054000e9e6f18a9b)
-rw-r--r--src/plugins/multimedia/ffmpeg/qffmpegvideobuffer.cpp76
-rw-r--r--src/plugins/multimedia/ffmpeg/qffmpegvideobuffer_p.h12
2 files changed, 44 insertions, 44 deletions
diff --git a/src/plugins/multimedia/ffmpeg/qffmpegvideobuffer.cpp b/src/plugins/multimedia/ffmpeg/qffmpegvideobuffer.cpp
index f6317dd83..b7c97d4b3 100644
--- a/src/plugins/multimedia/ffmpeg/qffmpegvideobuffer.cpp
+++ b/src/plugins/multimedia/ffmpeg/qffmpegvideobuffer.cpp
@@ -25,18 +25,18 @@ QT_BEGIN_NAMESPACE
QFFmpegVideoBuffer::QFFmpegVideoBuffer(AVFrameUPtr frame, AVRational pixelAspectRatio)
: QAbstractVideoBuffer(QVideoFrame::NoHandle),
- frame(frame.get()),
+ m_frame(frame.get()),
m_size(qCalculateFrameSize({ frame->width, frame->height },
{ pixelAspectRatio.num, pixelAspectRatio.den }))
{
if (frame->hw_frames_ctx) {
- hwFrame = std::move(frame);
- m_pixelFormat = toQtPixelFormat(QFFmpeg::HWAccel::format(hwFrame.get()));
+ m_hwFrame = std::move(frame);
+ m_pixelFormat = toQtPixelFormat(QFFmpeg::HWAccel::format(m_hwFrame.get()));
return;
}
- swFrame = std::move(frame);
- m_pixelFormat = toQtPixelFormat(AVPixelFormat(swFrame->format));
+ m_swFrame = std::move(frame);
+ m_pixelFormat = toQtPixelFormat(AVPixelFormat(m_swFrame->format));
convertSWFrame();
}
@@ -45,16 +45,16 @@ QFFmpegVideoBuffer::~QFFmpegVideoBuffer() = default;
void QFFmpegVideoBuffer::convertSWFrame()
{
- Q_ASSERT(swFrame);
+ Q_ASSERT(m_swFrame);
- const auto actualAVPixelFormat = AVPixelFormat(swFrame->format);
+ const auto actualAVPixelFormat = AVPixelFormat(m_swFrame->format);
const auto targetAVPixelFormat = toAVPixelFormat(m_pixelFormat);
- if (actualAVPixelFormat != targetAVPixelFormat || isFrameFlipped(*swFrame)
- || m_size != QSize(swFrame->width, swFrame->height)) {
+ if (actualAVPixelFormat != targetAVPixelFormat || isFrameFlipped(*m_swFrame)
+ || m_size != QSize(m_swFrame->width, m_swFrame->height)) {
Q_ASSERT(toQtPixelFormat(targetAVPixelFormat) == m_pixelFormat);
// convert the format into something we can handle
- SwsContext *c = sws_getContext(swFrame->width, swFrame->height, actualAVPixelFormat,
+ SwsContext *c = sws_getContext(m_swFrame->width, m_swFrame->height, actualAVPixelFormat,
m_size.width(), m_size.height(), targetAVPixelFormat,
SWS_BICUBIC, nullptr, nullptr, nullptr);
@@ -64,24 +64,24 @@ void QFFmpegVideoBuffer::convertSWFrame()
newFrame->format = targetAVPixelFormat;
av_frame_get_buffer(newFrame.get(), 0);
- sws_scale(c, swFrame->data, swFrame->linesize, 0, swFrame->height, newFrame->data, newFrame->linesize);
- if (frame == swFrame.get())
- frame = newFrame.get();
- swFrame = std::move(newFrame);
+ sws_scale(c, m_swFrame->data, m_swFrame->linesize, 0, m_swFrame->height, newFrame->data, newFrame->linesize);
+ if (m_frame == m_swFrame.get())
+ m_frame = newFrame.get();
+ m_swFrame = std::move(newFrame);
sws_freeContext(c);
}
}
void QFFmpegVideoBuffer::setTextureConverter(const QFFmpeg::TextureConverter &converter)
{
- textureConverter = converter;
- textureConverter.init(hwFrame.get());
+ m_textureConverter = converter;
+ m_textureConverter.init(m_hwFrame.get());
m_type = converter.isNull() ? QVideoFrame::NoHandle : QVideoFrame::RhiTextureHandle;
}
QVideoFrameFormat::ColorSpace QFFmpegVideoBuffer::colorSpace() const
{
- switch (frame->colorspace) {
+ switch (m_frame->colorspace) {
default:
case AVCOL_SPC_UNSPECIFIED:
case AVCOL_SPC_RESERVED:
@@ -108,7 +108,7 @@ QVideoFrameFormat::ColorSpace QFFmpegVideoBuffer::colorSpace() const
QVideoFrameFormat::ColorTransfer QFFmpegVideoBuffer::colorTransfer() const
{
- switch (frame->color_trc) {
+ switch (m_frame->color_trc) {
case AVCOL_TRC_BT709:
// The following three cases have transfer characteristics identical to BT709
case AVCOL_TRC_BT1361_ECG:
@@ -139,7 +139,7 @@ QVideoFrameFormat::ColorTransfer QFFmpegVideoBuffer::colorTransfer() const
QVideoFrameFormat::ColorRange QFFmpegVideoBuffer::colorRange() const
{
- switch (frame->color_range) {
+ switch (m_frame->color_range) {
case AVCOL_RANGE_MPEG:
return QVideoFrameFormat::ColorRange_Video;
case AVCOL_RANGE_JPEG:
@@ -152,8 +152,8 @@ QVideoFrameFormat::ColorRange QFFmpegVideoBuffer::colorRange() const
float QFFmpegVideoBuffer::maxNits()
{
float maxNits = -1;
- for (int i = 0; i < frame->nb_side_data; ++i) {
- AVFrameSideData *sd = frame->side_data[i];
+ for (int i = 0; i < m_frame->nb_side_data; ++i) {
+ AVFrameSideData *sd = m_frame->side_data[i];
// TODO: Longer term we might want to also support HDR10+ dynamic metadata
if (sd->type == AV_FRAME_DATA_MASTERING_DISPLAY_METADATA) {
auto *data = reinterpret_cast<AVMasteringDisplayMetadata *>(sd->data);
@@ -172,11 +172,11 @@ QVideoFrame::MapMode QFFmpegVideoBuffer::mapMode() const
QAbstractVideoBuffer::MapData QFFmpegVideoBuffer::map(QVideoFrame::MapMode mode)
{
- if (!swFrame) {
- Q_ASSERT(hwFrame && hwFrame->hw_frames_ctx);
- swFrame = QFFmpeg::makeAVFrame();
+ if (!m_swFrame) {
+ Q_ASSERT(m_hwFrame && m_hwFrame->hw_frames_ctx);
+ m_swFrame = QFFmpeg::makeAVFrame();
/* retrieve data from GPU to CPU */
- int ret = av_hwframe_transfer_data(swFrame.get(), hwFrame.get(), 0);
+ int ret = av_hwframe_transfer_data(m_swFrame.get(), m_hwFrame.get(), 0);
if (ret < 0) {
qWarning() << "Error transferring the data to system memory:" << ret;
return {};
@@ -190,11 +190,11 @@ QAbstractVideoBuffer::MapData QFFmpegVideoBuffer::map(QVideoFrame::MapMode mode)
auto *desc = QVideoTextureHelper::textureDescription(pixelFormat());
mapData.nPlanes = desc->nplanes;
for (int i = 0; i < mapData.nPlanes; ++i) {
- Q_ASSERT(swFrame->linesize[i] >= 0);
+ Q_ASSERT(m_swFrame->linesize[i] >= 0);
- mapData.data[i] = swFrame->data[i];
- mapData.bytesPerLine[i] = swFrame->linesize[i];
- mapData.size[i] = mapData.bytesPerLine[i]*desc->heightForPlane(swFrame->height, i);
+ mapData.data[i] = m_swFrame->data[i];
+ mapData.bytesPerLine[i] = m_swFrame->linesize[i];
+ mapData.size[i] = mapData.bytesPerLine[i]*desc->heightForPlane(m_swFrame->height, i);
}
return mapData;
}
@@ -206,27 +206,27 @@ void QFFmpegVideoBuffer::unmap()
std::unique_ptr<QVideoFrameTextures> QFFmpegVideoBuffer::mapTextures(QRhi *)
{
- if (textures)
+ if (m_textures)
return {};
- if (!hwFrame)
+ if (!m_hwFrame)
return {};
- if (textureConverter.isNull()) {
- textures = nullptr;
+ if (m_textureConverter.isNull()) {
+ m_textures = nullptr;
return {};
}
- textures.reset(textureConverter.getTextures(hwFrame.get()));
- if (!textures) {
+ m_textures.reset(m_textureConverter.getTextures(m_hwFrame.get()));
+ if (!m_textures) {
static thread_local int lastFormat = 0;
- if (std::exchange(lastFormat, hwFrame->format) != hwFrame->format) // prevent logging spam
- qWarning() << " failed to get textures for frame; format:" << hwFrame->format;
+ if (std::exchange(lastFormat, m_hwFrame->format) != m_hwFrame->format) // prevent logging spam
+ qWarning() << " failed to get textures for frame; format:" << m_hwFrame->format;
}
return {};
}
quint64 QFFmpegVideoBuffer::textureHandle(int plane) const
{
- return textures ? textures->textureHandle(plane) : 0;
+ return m_textures ? m_textures->textureHandle(plane) : 0;
}
QVideoFrameFormat::PixelFormat QFFmpegVideoBuffer::pixelFormat() const
diff --git a/src/plugins/multimedia/ffmpeg/qffmpegvideobuffer_p.h b/src/plugins/multimedia/ffmpeg/qffmpegvideobuffer_p.h
index b7249b8d5..223587621 100644
--- a/src/plugins/multimedia/ffmpeg/qffmpegvideobuffer_p.h
+++ b/src/plugins/multimedia/ffmpeg/qffmpegvideobuffer_p.h
@@ -48,7 +48,7 @@ public:
void convertSWFrame();
- AVFrame *getHWFrame() const { return hwFrame.get(); }
+ AVFrame *getHWFrame() const { return m_hwFrame.get(); }
void setTextureConverter(const QFFmpeg::TextureConverter &converter);
@@ -60,13 +60,13 @@ public:
private:
QVideoFrameFormat::PixelFormat m_pixelFormat;
- AVFrame *frame = nullptr;
- AVFrameUPtr hwFrame;
- AVFrameUPtr swFrame;
+ AVFrame *m_frame = nullptr;
+ AVFrameUPtr m_hwFrame;
+ AVFrameUPtr m_swFrame;
QSize m_size;
- QFFmpeg::TextureConverter textureConverter;
+ QFFmpeg::TextureConverter m_textureConverter;
QVideoFrame::MapMode m_mode = QVideoFrame::NotMapped;
- std::unique_ptr<QFFmpeg::TextureSet> textures;
+ std::unique_ptr<QFFmpeg::TextureSet> m_textures;
};
QT_END_NAMESPACE