score::gfx::PackedRectDecoder Struct Reference
Inheritance diagram for score::gfx::PackedRectDecoder:
score::gfx::GPUVideoDecoder

Public Member Functions

 PackedRectDecoder (QRhiTexture::Format fmt, int bytes_per_pixel, Video::ImageFormat &d, QString f="")
 
std::pair< QShader, QShader > init (RenderList &r) override
 Initialize a GPUVideoDecoder. More...
 
void exec (RenderList &, QRhiResourceUpdateBatch &res, AVFrame &frame) override
 Decode and upload a video frame to the GPU.
 
void setPixels (QRhiResourceUpdateBatch &res, uint8_t *pixels, int stride) const noexcept
 
- Public Member Functions inherited from score::gfx::GPUVideoDecoder
void release (RenderList &)
 This method will release all the created samplers and textures.
 

Public Attributes

QRhiTexture::Format format
 
int bytes_per_pixel {}
 
Video::ImageFormatdecoder
 
QString filter
 
- Public Attributes inherited from score::gfx::GPUVideoDecoder
std::vector< Samplersamplers
 

Static Public Attributes

static constexpr const auto rgb_filter
 
static constexpr const char * vertex
 

Additional Inherited Members

- 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. More...
 
static QString vertexShader () noexcept
 

Member Function Documentation

◆ init()

std::pair<QShader, QShader> score::gfx::PackedRectDecoder::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.

Member Data Documentation

◆ rgb_filter

constexpr const auto score::gfx::PackedRectDecoder::rgb_filter
staticconstexpr
Initial value:
= R"_(#version 450
)_" SCORE_GFX_VIDEO_UNIFORMS R"_(
layout(binding=3) uniform sampler2DRect y_tex;
layout(location = 0) in vec2 v_texcoord;
layout(location = 0) out vec4 fragColor;
vec4 processTexture(vec4 tex) {
vec4 processed = tex;
{ %1 }
return processed;
}
void main ()
{
fragColor = processTexture(texture(y_tex, v_texcoord));
})_"

◆ vertex

constexpr const char* score::gfx::PackedRectDecoder::vertex
staticconstexpr
Initial value:
= R"_(#version 450
layout(location = 0) in vec2 position;
layout(location = 1) in vec2 texcoord;
layout(location = 0) out vec2 v_texcoord;
)_" SCORE_GFX_VIDEO_UNIFORMS R"_(
out gl_PerVertex { vec4 gl_Position; };
void main()
{
v_texcoord = texcoord * mat.texSz.xy;
gl_Position = renderer.clipSpaceCorrMatrix * vec4(position.x * mat.scale.x, position.y * mat.scale.y, 0.0, 1.);
}
)_"

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