LibavEncoderNode.hpp
1 #pragma once
2 #include <Gfx/Graph/OutputNode.hpp>
3 #include <Gfx/Libav/LibavOutputSettings.hpp>
4 
5 namespace Gfx
6 {
7 struct LibavEncoder;
9 {
10  explicit LibavEncoderNode(
11  const LibavOutputSettings&, LibavEncoder& encoder, int stream);
12  virtual ~LibavEncoderNode();
13 
14  LibavEncoder& encoder;
15  int stream{};
16 
17  std::weak_ptr<score::gfx::RenderList> m_renderer{};
18  QRhiTexture* m_texture{};
19  QRhiTextureRenderTarget* m_renderTarget{};
20  std::function<void()> m_update;
21  std::shared_ptr<score::gfx::RenderState> m_renderState{};
22  bool m_hasSender{};
23 
24  void startRendering() override;
25  void onRendererChange() override;
26  void render() override;
27  bool canRender() const override;
28  void stopRendering() override;
29 
30  void setRenderer(std::shared_ptr<score::gfx::RenderList> r) override;
31  score::gfx::RenderList* renderer() const override;
32 
33  void createOutput(
34  score::gfx::GraphicsApi graphicsApi, std::function<void()> onReady,
35  std::function<void()> onUpdate, std::function<void()> onResize) override;
36  void destroyOutput() override;
37 
38  std::shared_ptr<score::gfx::RenderState> renderState() const override;
40  createRenderer(score::gfx::RenderList& r) const noexcept override;
41  Configuration configuration() const noexcept override;
42 
43  LibavOutputSettings m_settings;
44 
45  QRhiReadbackResult m_readback;
46 };
47 }
Base class for sink nodes (QWindow, spout, syphon, NDI output, ...)
Definition: OutputNode.hpp:23
Definition: OutputNode.hpp:11
List of nodes to be rendered to an output.
Definition: RenderList.hpp:19
Binds the rendering pipeline to ossia processes.
Definition: CameraDevice.cpp:28
GraphicsApi
Available graphics APIs to use.
Definition: RenderState.hpp:17
Definition: LibavEncoder.hpp:22
Definition: LibavEncoderNode.hpp:9
score::gfx::OutputNodeRenderer * createRenderer(score::gfx::RenderList &r) const noexcept override
Create a renderer in a given context for this node.
Definition: LibavEncoderNode.cpp:122
Definition: LibavOutputSettings.hpp:16
Definition: OutputNode.hpp:48