score::gfx::GPUVideoDecoder Class Referenceabstract

Processes and renders a video frame on the GPU. More...

Inheritance diagram for score::gfx::GPUVideoDecoder:
score::gfx::EmptyDecoder score::gfx::HAPDecoder score::gfx::NV12Decoder score::gfx::PackedDecoder score::gfx::PackedRectDecoder score::gfx::PlanarDecoder score::gfx::UYVY422Decoder score::gfx::YUV420Decoder score::gfx::YUV420P10Decoder score::gfx::YUV420P12Decoder score::gfx::YUV422Decoder score::gfx::YUV422P10Decoder score::gfx::YUV422P12Decoder score::gfx::YUYV422Decoder

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< Samplersamplers
 

Member Function Documentation

◆ createTextureUpload()

QRhiTextureSubresourceUploadDescription score::gfx::GPUVideoDecoder::createTextureUpload ( uint8_t *  pixels,
int  w,
int  h,
int  bytesPerPixel,
int  stride 
)
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()

virtual std::pair<QShader, QShader> score::gfx::GPUVideoDecoder::init ( RenderList r)
pure virtual

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