38 static void setGraphicsApiOverride(std::optional<QRhi::Implementation> api);
40 QVideoWindowPrivate(QVideoWindow *q);
41 ~QVideoWindowPrivate();
42 bool canRender()
const {
return m_useRhi; }
44 static QVideoWindowPrivate *get(QVideoWindow *q);
46 QRhi *rhi()
const {
return m_rhi.get(); }
53 void resizeSwapChain();
54 void releaseSwapChain();
56 void updateTextures(QRhiResourceUpdateBatch *rub);
57 void updateSubtitle(QRhiResourceUpdateBatch *rub,
const QSize &frameSize);
59 void setupGraphicsPipeline(QRhiGraphicsPipeline *pipeline, QRhiShaderResourceBindings *bindings,
const QVideoFrameFormat &fmt);
61 void setPostRenderHookForTests(std::function<
void(QRhi &, QRhiCommandBuffer &)> hook);
63 QVideoWindow *q =
nullptr;
64 Qt::AspectRatioMode aspectRatioMode = Qt::KeepAspectRatio;
66 QBackingStore *backingStore =
nullptr;
69 std::unique_ptr<QOffscreenSurface> m_fallbackSurface;
71 std::unique_ptr<QRhi> m_rhi;
72 std::unique_ptr<QRhiSwapChain> m_swapChain;
73 std::unique_ptr<QRhiRenderPassDescriptor> m_renderPass;
75 std::unique_ptr<QRhiBuffer> m_vertexBuf;
76 bool m_vertexBufReady =
false;
77 std::unique_ptr<QRhiBuffer> m_uniformBuf;
78 std::unique_ptr<QRhiSampler> m_textureSampler;
79 std::unique_ptr<QRhiShaderResourceBindings> m_shaderResourceBindings;
80 std::unique_ptr<QRhiGraphicsPipeline> m_graphicsPipeline;
82 std::unique_ptr<QRhiTexture> m_subtitleTexture;
83 std::unique_ptr<QRhiShaderResourceBindings> m_subtitleResourceBindings;
84 std::unique_ptr<QRhiGraphicsPipeline> m_subtitlePipeline;
85 std::unique_ptr<QRhiBuffer> m_subtitleUniformBuf;
87 std::unique_ptr<QVideoSink> m_sink;
88 std::function<
void(QRhi &, QRhiCommandBuffer &)> m_postRenderHookForTests;
89 QRhi::Implementation m_graphicsApi = QRhi::Null;
90 QVideoTextureHelper::SubtitleLayout m_subtitleLayout;
91 QVideoFrameTexturePool m_texturePool;
93 bool initialized =
false;
94 bool isExposed =
false;
96 bool m_hasSwapChain =
false;
97 bool m_subtitleDirty =
false;
98 bool m_hasSubtitle =
false;
99 QVideoFrameFormat format;
106 explicit QVideoWindow(QScreen *screen =
nullptr);
107 explicit QVideoWindow(QWindow *parent);
108 ~QVideoWindow() override;
110 Q_INVOKABLE QVideoSink *videoSink()
const;
112 Qt::AspectRatioMode aspectRatioMode()
const;
115 void setAspectRatioMode(Qt::AspectRatioMode mode);
118 void aspectRatioModeChanged(Qt::AspectRatioMode mode);
121 bool event(QEvent *e) override;
122 void resizeEvent(QResizeEvent *) override;
125 void setVideoFrame(
const QVideoFrame &frame);
128 friend class QVideoWindowPrivate;
129 std::unique_ptr<QVideoWindowPrivate> d;