11 #include "IRenderManager.h" 12 #include "RenderVideoSettings.h" 13 #include "cores/RetroPlayer/guibridge/IRenderCallback.h" 14 #include "threads/CriticalSection.h" 18 #include <libavutil/pixfmt.h> 35 class CGUIRenderTargetFactory;
37 class CRenderSettings;
38 class CRPBaseRenderer;
40 class IGUIRenderSettings;
42 class IRenderBufferPool;
44 struct VideoStreamBuffer;
82 AVPixelFormat GetPixelFormat()
const {
return m_format; }
83 unsigned int GetNominalWidth()
const {
return m_nominalWidth; }
84 unsigned int GetNominalHeight()
const {
return m_nominalHeight; }
85 unsigned int GetMaxWidth()
const {
return m_maxWidth; }
86 unsigned int GetMaxHeight()
const {
return m_maxHeight; }
87 float GetPixelAspectRatio()
const {
return m_pixelAspectRatio; }
90 bool Configure(AVPixelFormat format,
91 unsigned int nominalWidth,
92 unsigned int nominalHeight,
93 unsigned int maxWidth,
94 unsigned int maxHeight,
95 float pixelAspectRatio);
97 void AddFrame(
const uint8_t* data,
101 unsigned int orientationDegCW);
105 void SetSpeed(
double speed);
114 const CRect& renderRegion,
126 void CacheVideoFrame(
const std::string& savestatePath);
127 void SaveVideoFrame(
const std::string& savestatePath,
ISavestate& savestate);
128 void ClearVideoFrame(
const std::string& savestatePath);
134 std::shared_ptr<CRPBaseRenderer> GetRendererForSettings(
const IGUIRenderSettings* renderSettings);
139 std::shared_ptr<CRPBaseRenderer> GetRendererForPool(
IRenderBufferPool* bufferPool,
145 void RenderInternal(
const std::shared_ptr<CRPBaseRenderer>& renderer,
163 IRenderBuffer* GetRenderBufferForSavestate(
const std::string& savestatePath,
194 IRenderBuffer* CreateFromCache(std::vector<uint8_t>& cachedFrame,
198 CCriticalSection& mutex);
204 AVPixelFormat format,
208 unsigned int height);
214 void GetVideoFrame(
IRenderBuffer*& readableBuffer, std::vector<uint8_t>& cachedFrame);
215 void FreeVideoFrame(
IRenderBuffer* readableBuffer, std::vector<uint8_t> cachedFrame);
216 void LoadVideoFrameAsync(
const std::string& savestatePath);
217 void LoadVideoFrameSync(
const std::string& savestatePath);
224 std::shared_ptr<IGUIRenderSettings> m_renderSettings;
225 std::shared_ptr<CGUIRenderTargetFactory> m_renderControlFactory;
228 AVPixelFormat m_format = AV_PIX_FMT_NONE;
229 unsigned int m_nominalWidth{0};
230 unsigned int m_nominalHeight{0};
231 unsigned int m_maxWidth = 0;
232 unsigned int m_maxHeight = 0;
233 float m_pixelAspectRatio{1.0f};
236 std::set<std::shared_ptr<CRPBaseRenderer>> m_renderers;
237 std::vector<IRenderBuffer*> m_pendingBuffers;
238 std::vector<IRenderBuffer*> m_renderBuffers;
239 std::map<AVPixelFormat, std::map<AVPixelFormat, SwsContext*>> m_scalers;
240 std::vector<uint8_t> m_cachedFrame;
241 unsigned int m_cachedWidth = 0;
242 unsigned int m_cachedHeight = 0;
243 unsigned int m_cachedRotationCCW{0};
244 std::map<std::string, std::vector<IRenderBuffer*>>
246 std::vector<std::future<void>> m_savestateThreads;
249 enum class RENDER_STATE
255 RENDER_STATE m_state = RENDER_STATE::UNCONFIGURED;
256 bool m_bHasCachedFrame =
false;
257 std::set<std::string> m_failedShaderPresets;
258 std::atomic<bool> m_bFlush = {
false};
261 bool m_bDisplayScaleSet =
false;
264 std::atomic<double> m_speed = {1.0};
267 CCriticalSection m_stateMutex;
268 CCriticalSection m_bufferMutex;
Renders video frames provided by the game loop.
Definition: RPRenderManager.h:67
Interface to pass render settings from the GUI to the renderer.
Definition: IGUIRenderSettings.h:21
bool SupportsScalingMethod(SCALINGMETHOD method) const override
Definition: RPRenderManager.cpp:461
Definition: ISavestate.h:28
Definition: IRenderBuffer.h:27
void RenderControl(bool bClear, bool bUseAlpha, const CRect &renderRegion, const IGUIRenderSettings *renderSettings) override
Render a game control.
Definition: RPRenderManager.cpp:380
void ClearBackground() override
Clear the background of a fullscreen window.
Definition: RPRenderManager.cpp:444
void SaveThumbnail(const std::string &thumbnailPath)
Definition: RPRenderManager.cpp:790
Definition: IRenderCallback.h:17
Provide info of a resolution.
Definition: Resolution.h:66
Definition: AudioDecoder.h:18
Definition: IRenderBufferPool.h:30
Definition: RetroPlayerVideo.h:51
Definition: RenderContext.h:43
Definition: GUIRenderTargetFactory.h:20
Definition: settings.py:1
CGUIRenderTargetFactory * GetGUIRenderTargetFactory()
Access the factory for creating GUI render targets.
Definition: RPRenderManager.h:79
Video settings provided by the rendering system.
Definition: RenderVideoSettings.h:22
Interface to expose rendering functions to GUI components.
Definition: IRenderManager.h:24
Player process info.
Definition: RPProcessInfo.h:80
Definition: RenderSettings.h:17
bool SupportsRenderFeature(RENDERFEATURE feature) const override
Definition: RPRenderManager.cpp:449
bool GetVideoBuffer(unsigned int width, unsigned int height, VideoStreamBuffer &buffer)
Definition: RPRenderManager.cpp:126
void RenderWindow(bool bClear, const RESOLUTION_INFO &coordsRes) override
Render a fullscreen window.
Definition: RPRenderManager.cpp:331