Loading...
Searching...
No Matches
NV12ExternalOES.hpp
Go to the documentation of this file.
1#pragma once
2
31#include <Gfx/Graph/decoders/GPUVideoDecoder.hpp>
32
33#include <score_plugin_gfx_export.h>
34
35#include <QFile>
36
37extern "C" {
38#include <libavformat/avformat.h>
39}
40
41namespace score::gfx
42{
43
48SCORE_PLUGIN_GFX_EXPORT
49bool nv12ExternalOesUsable(QRhi::Implementation backend) noexcept;
50
56QByteArray toExternalSamplerEssl(QByteArray glsl);
57
59{
60 // Baked with sampler2D so glslang accepts it; the GLSL variant is swapped
61 // below. The sampler already returns RGB, so the only work here is the
62 // optional user filter.
63 static const constexpr auto oes_filter = R"_(#version 450
64
65)_" SCORE_GFX_VIDEO_UNIFORMS R"_(
66
67 layout(binding=3) uniform sampler2D tex;
68
69 layout(location = 0) in vec2 v_texcoord;
70 layout(location = 0) out vec4 fragColor;
71
72 vec4 processTexture(vec4 t) {
73 vec4 processed = t;
74 { %1 }
75 return processed;
76 }
77
78 void main ()
79 {
80 fragColor = processTexture(texture(tex, v_texcoord));
81 })_";
82
83 explicit NV12ExternalOESDecoder(Video::ImageFormat& d, QString f = "")
84 : decoder{d}
85 , filter{std::move(f)}
86 {
87 }
88
89 Video::ImageFormat& decoder;
90 QString filter;
91
92 std::pair<QShader, QShader> init(RenderList& r) override;
93
98 void exec(RenderList&, QRhiResourceUpdateBatch&, AVFrame&) override { }
99};
100
101}
Processes and renders a video frame on the GPU.
Definition GPUVideoDecoder.hpp:90
List of nodes to be rendered to an output.
Definition RenderList.hpp:30
Graphics rendering pipeline for ossia score.
Definition Filter/PreviewWidget.hpp:11
QByteArray toExternalSamplerEssl(QByteArray glsl)
Definition NV12ExternalOES.cpp:55
bool nv12ExternalOesUsable(QRhi::Implementation backend) noexcept
Definition NV12ExternalOES.cpp:11
Definition VideoInterface.hpp:26
Definition NV12ExternalOES.hpp:59
void exec(RenderList &, QRhiResourceUpdateBatch &, AVFrame &) override
Definition NV12ExternalOES.hpp:98
std::pair< QShader, QShader > init(RenderList &r) override
Initialize a GPUVideoDecoder.
Definition NV12ExternalOES.cpp:83