Processes and renders a video frame on the GPU. More...
Detailed Description
Processes and renders a video frame on the GPU.
This class is used as a base type for GPU decoders.
Child classes must :
- Create relevant shaders, samplers & textures in the init method.
- When exec is called, copy the data from the AVFrame to the QRhiTextures.
See RGB0Decoder for an example with a single texture, YUV420Decoder for an example with multiple textures.
Public Member Functions | |
virtual std::pair< QShader, QShader > | init (RenderList &r)=0 |
Initialize a GPUVideoDecoder. More... | |
virtual void | exec (RenderList &, QRhiResourceUpdateBatch &res, AVFrame &frame)=0 |
Decode and upload a video frame to the GPU. | |
void | release (RenderList &) |
This method will release all the created samplers and textures. | |
Static Public Member Functions | |
static QRhiTextureSubresourceUploadDescription | createTextureUpload (uint8_t *pixels, int w, int h, int bytesPerPixel, int stride) |
Utility method to create a QRhiTextureSubresourceUploadDescription. More... | |
static QString | vertexShader () noexcept |
Public Attributes | |
std::vector< Sampler > | samplers |
Member Function Documentation
◆ createTextureUpload()
|
static |
Utility method to create a QRhiTextureSubresourceUploadDescription.
If possible, it tries to avoid a copy of pixels : pixels must not be freed before the frame has been rendered.
◆ init()
|
pure virtual |
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.
Implemented in score::gfx::UYVY422Decoder, score::gfx::YUYV422Decoder, score::gfx::YUV422P12Decoder, score::gfx::YUV422P10Decoder, score::gfx::YUV422Decoder, score::gfx::YUV420P12Decoder, score::gfx::YUV420P10Decoder, score::gfx::YUV420Decoder, score::gfx::PackedRectDecoder, score::gfx::PlanarDecoder, score::gfx::PackedDecoder, score::gfx::NV12Decoder, score::gfx::HAPMDecoder, score::gfx::HAPDefaultDecoder, and score::gfx::EmptyDecoder.
The documentation for this class was generated from the following files:
- GPUVideoDecoder.hpp
- GPUVideoDecoder.cpp