Fallback hardware decoder that transfers HW frames to CPU via av_hwframe_transfer_data(), then delegates to a software GPU decoder. More...
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< GPUVideoDecoder > | createDelegateForFormat (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::ImageFormat & | decoder |
| AVPixelFormat | m_swFormat {AV_PIX_FMT_NONE} |
| std::unique_ptr< GPUVideoDecoder > | m_delegate |
| AVFrame * | m_swFrame {} |
Public Attributes inherited from score::gfx::GPUVideoDecoder | |
| std::vector< Sampler > | samplers |
| bool | hasFrame {} |
| bool | failed {} |
Member Function Documentation
◆ exec()
|
inlineoverridevirtual |
Decode and upload a video frame to the GPU.
Implements score::gfx::GPUVideoDecoder.
◆ init()
|
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:
Public Member Functions inherited from