64 void init(
RenderList& renderer, QRhiResourceUpdateBatch& res)
override;
65 void runRenderPass(
RenderList&, QRhiCommandBuffer& commands,
Edge& edge)
override;
66 void update(
RenderList& renderer, QRhiResourceUpdateBatch& res,
Edge* edge)
override;
67 void runInitialPasses(
68 RenderList&, QRhiCommandBuffer& commands, QRhiResourceUpdateBatch*& res,
70 QRhiTexture* textureForOutput(
const Port& output)
override;
73 void initState(
RenderList& renderer, QRhiResourceUpdateBatch& res)
override;
74 void releaseState(
RenderList& renderer)
override;
76 RenderList& renderer,
Edge& edge, QRhiResourceUpdateBatch& res)
override;
78 bool hasOutputPassForEdge(
Edge& edge)
const override;
88 bool seekAndDecode(int64_t flicks);
91 bool holdsTime(int64_t flicks)
const noexcept;
93 bool seekTo(int64_t pts);
95 int64_t ptsToFlicks(int64_t pts)
const noexcept;
96 int64_t flicksToPts(int64_t flicks)
const noexcept;
97 bool isSequentialRead(int64_t flicks)
const;
98 bool readVideoPacket(AVPacket* into);
99 bool readNextPacketRaw();
100 bool peekNextPacketRaw();
105 bool readNextPacketAVCodec();
108 bool decodeNextFrame(AVFrame* into, int64_t& ts, int64_t& duration);
110 bool peekNextFrame();
111 void dropPeekedFrame()
noexcept;
113 void createGpuDecoder(QRhi& rhi);
115 std::unique_ptr<GPUVideoDecoder> tryCreateZeroCopyDecoder(QRhi& rhi);
122 bool setupHardwareDecoder(
123 const void* codec, AVPixelFormat hwPixFmt);
124 static enum AVPixelFormat negotiateHWFormat(
125 AVCodecContext* ctx,
const enum AVPixelFormat* pix_fmts);
126 void transferHWFrame();
129 std::string m_filePath;
132 double m_flicks_per_dts{};
133 double m_dts_per_flicks{};
134 AVRational m_timeBase{0, 1};
136 int64_t m_startPts{};
139 int64_t m_framePts{1};
142 bool m_noTimestamps{};
143 int64_t m_nextMissingPts{};
144 bool m_useAVCodec{
true};
147 AVFormatContext* m_formatContext{};
148 AVCodecContext* m_codecContext{};
149 const void* m_codec{};
150 AVStream* m_avstream{};
151 AVFrame* m_decodedFrame{};
154 AVBufferRef* m_hwDeviceCtx{};
155 AVPixelFormat m_hwPixelFormat{AV_PIX_FMT_NONE};
156 AVPixelFormat m_hwSwFormat{AV_PIX_FMT_NONE};
157 std::vector<const char*> m_vkEnabledExtensions;
158 AVFrame* m_swTransferFrame{};
161 bool m_hwSwFormatChecked{
false};
162 bool m_zeroCopyFailed{
false};
163 bool m_sharedVulkanDevice{
false};
168 QRhiBuffer* m_processUBO{};
169 QRhiBuffer* m_materialUBO{};
173 std::unique_ptr<GPUVideoDecoder> m_gpu;
174 QShader m_cachedVertexShader;
175 QShader m_cachedFragmentShader;
177 QSize m_scaleRenderSize{};
179 int64_t m_lastRequestedFlicks{-1};
180 int64_t m_lastDecodedDts{INT64_MIN};
181 int64_t m_lastDecodedDuration{};
182 AVFrame* m_peekedFrame{};
183 int64_t m_peekedDts{};
184 int64_t m_peekedDuration{};
185 bool m_hasPeekedFrame{};
186 AVPacket* m_peekedPacket{};
187 bool m_hasPeekedPacket{};
191 std::vector<std::pair<int64_t, int64_t>> m_keyframes;
192 int64_t m_packetNumber{};
193 bool m_recomputeScale{
true};
The decoded frame, converted to RGBA into a texture of the renderer's own.
Definition VideoNodeRenderer.hpp:59
AVPixelFormat selectHardwareAcceleration(score::gfx::GraphicsApi api, AVCodecID codec_id, QRhi *rhi)
Picks the best HW accel for the given API/codec, using QRhi for vendor detection.
Definition HWAccelSetup.cpp:36
Useful abstraction for storing all the data related to a render target.
Definition score-plugin-gfx/Gfx/Graph/Utils.hpp:307