Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QFFmpeg::TextureConverter Class Reference

The TextureConverter class implements conversion of AVFrame hw textures to textures for rendering by the specified QRhi. Any instance of TextureConverter matches the pair of FFmpeg hw frames context + QRhi. More...

#include <qffmpegtextureconverter_p.h>

Collaboration diagram for QFFmpeg::TextureConverter:

Public Member Functions

 TextureConverter (QRhi &rhi)
 Construct uninitialized texture converter for the specified QRhi.
bool init (AVFrame &hwFrame)
 Initializes the instance of the texture converter for the frame context associated with the specified frame. The method tries to initialize the conversion backend during the first call with the specified frame format. If frame format is not changed, the method does nothing even if the first attempt failed.
QVideoFrameTexturesUPtr createTextures (AVFrame &hwFrame, QVideoFrameTexturesUPtr &oldTextures)
 Creates video frame textures basing on the current hw frame and the previous textures from the texture pool. We should strive to reuse oldTextures if we can do so. If the method returns null, try createTextureHandles.
QVideoFrameTexturesHandlesUPtr createTextureHandles (AVFrame &hwFrame, QVideoFrameTexturesHandlesUPtr oldHandles)
 Creates video frame texture handles basing on the current hw frame and the previous texture handles from the pool. We should strive to reuse oldHandles if we can do so.
bool isNull () const
 Indicates whether the texture converter is not initialized or the initialization failed. If hw texture conversion is disabled, it always true.

Static Public Member Functions

static void applyDecoderPreset (AVPixelFormat format, AVCodecContext &codecContext)
 Applies platform-specific hw texture conversion presets for a decoder. The function is supposed to be invoked for the get_format callback.
static bool hwTextureConversionEnabled ()
 Indicates whether hw texture conversion is enabled for the application.
static bool isBackendAvailable (AVFrame &hwFrame, const QRhi &rhi)
 Indicates whether the matching textute converter backend can be created. If isBackendAvailable returns false, instances cannot be initialized with the specified frame. If it returns true, init will attempt to create backend, but it may fail if something goes wrong in the backend.

Detailed Description

The TextureConverter class implements conversion of AVFrame hw textures to textures for rendering by the specified QRhi. Any instance of TextureConverter matches the pair of FFmpeg hw frames context + QRhi.

Definition at line 70 of file qffmpegtextureconverter_p.h.

Constructor & Destructor Documentation

◆ TextureConverter()

TextureConverter::TextureConverter ( QRhi & rhi)

Construct uninitialized texture converter for the specified QRhi.

Definition at line 79 of file qffmpegtextureconverter.cpp.

Member Function Documentation

◆ applyDecoderPreset()

void TextureConverter::applyDecoderPreset ( AVPixelFormat format,
AVCodecContext & codecContext )
static

Applies platform-specific hw texture conversion presets for a decoder. The function is supposed to be invoked for the get_format callback.

Definition at line 131 of file qffmpegtextureconverter.cpp.

◆ createTextureHandles()

QVideoFrameTexturesHandlesUPtr TextureConverter::createTextureHandles ( AVFrame & hwFrame,
QVideoFrameTexturesHandlesUPtr oldHandles )

Creates video frame texture handles basing on the current hw frame and the previous texture handles from the pool. We should strive to reuse oldHandles if we can do so.

Definition at line 101 of file qffmpegtextureconverter.cpp.

◆ createTextures()

QVideoFrameTexturesUPtr TextureConverter::createTextures ( AVFrame & hwFrame,
QVideoFrameTexturesUPtr & oldTextures )

Creates video frame textures basing on the current hw frame and the previous textures from the texture pool. We should strive to reuse oldTextures if we can do so. If the method returns null, try createTextureHandles.

Definition at line 90 of file qffmpegtextureconverter.cpp.

◆ hwTextureConversionEnabled()

bool TextureConverter::hwTextureConversionEnabled ( )
static

Indicates whether hw texture conversion is enabled for the application.

Definition at line 121 of file qffmpegtextureconverter.cpp.

◆ init()

bool TextureConverter::init ( AVFrame & hwFrame)

Initializes the instance of the texture converter for the frame context associated with the specified frame. The method tries to initialize the conversion backend during the first call with the specified frame format. If frame format is not changed, the method does nothing even if the first attempt failed.

Returns
Whether the instance has been initialized.

Definition at line 81 of file qffmpegtextureconverter.cpp.

◆ isBackendAvailable()

bool TextureConverter::isBackendAvailable ( AVFrame & hwFrame,
const QRhi & rhi )
static

Indicates whether the matching textute converter backend can be created. If isBackendAvailable returns false, instances cannot be initialized with the specified frame. If it returns true, init will attempt to create backend, but it may fail if something goes wrong in the backend.

Definition at line 150 of file qffmpegtextureconverter.cpp.

◆ isNull()

bool QFFmpeg::TextureConverter::isNull ( ) const
inline

Indicates whether the texture converter is not initialized or the initialization failed. If hw texture conversion is disabled, it always true.

Definition at line 106 of file qffmpegtextureconverter_p.h.


The documentation for this class was generated from the following files: