Loading...
Searching...
No Matches

Fallback hardware decoder that transfers HW frames to CPU via av_hwframe_transfer_data(), then delegates to a software GPU decoder. More...

Inheritance diagram for score::gfx::HWTransferDecoder:
score::gfx::GPUVideoDecoder

Detailed Description

Fallback hardware decoder that transfers HW frames to CPU via av_hwframe_transfer_data(), then delegates to a software GPU decoder.

This avoids the software decode cost (GPU-accelerated decode) while still uploading pixel data through the normal QRhi texture upload path. The transfer is a GPU→CPU DMA copy, typically yielding NV12 or P010 data.

This is the fallback used when zero-copy import is not available for the current RHI backend / HW decoder combination.

Public Member Functions

 HWTransferDecoder (Video::ImageFormat &d, AVPixelFormat swFormat=AV_PIX_FMT_NV12)
 
std::unique_ptr< GPUVideoDecodercreateDelegateForFormat (AVPixelFormat fmt)
 
std::pair< QShader, QShader > init (RenderList &r) override
 Initialize a GPUVideoDecoder.
 
void exec (RenderList &r, QRhiResourceUpdateBatch &res, AVFrame &frame) override
 Decode and upload a video frame to the GPU.
 
- Public Member Functions inherited from score::gfx::GPUVideoDecoder
void release (RenderList &)
 This method will release all the created samplers and textures.
 

Static Public Member Functions

static bool canDelegateFormat (AVPixelFormat fmt)
 
- Static Public Member Functions inherited from score::gfx::GPUVideoDecoder
static QRhiTextureSubresourceUploadDescription createTextureUpload (uint8_t *pixels, int w, int h, int bytesPerPixel, int stride)
 Utility method to create a QRhiTextureSubresourceUploadDescription.
 
static QString vertexShader (bool invertY=false) noexcept
 

Public Attributes

Video::ImageFormatdecoder
 
AVPixelFormat m_swFormat {AV_PIX_FMT_NONE}
 
std::unique_ptr< GPUVideoDecoderm_delegate
 
AVFrame * m_swFrame {}
 
- Public Attributes inherited from score::gfx::GPUVideoDecoder
std::vector< Samplersamplers
 
bool hasFrame {}
 
bool failed {}
 

Member Function Documentation

◆ exec()

void score::gfx::HWTransferDecoder::exec ( RenderList ,
QRhiResourceUpdateBatch &  res,
AVFrame &  frame 
)
inlineoverridevirtual

Decode and upload a video frame to the GPU.

Implements score::gfx::GPUVideoDecoder.

◆ init()

std::pair< QShader, QShader > score::gfx::HWTransferDecoder::init ( RenderList r)
inlineoverridevirtual

Initialize a GPUVideoDecoder.

This method must :

  • Create samplers and textures for the video format.
  • Create shaders that will render the data put into these textures.

It returns a {vertex, fragment} shader pair.

Implements score::gfx::GPUVideoDecoder.


The documentation for this struct was generated from the following file: