#ifndef __OPENGL_COMPOSITE_H__ #define __OPENGL_COMPOSITE_H__ #include #include #include #include #include #include #include #include #include "DeckLinkAPI_h.h" #include "GLExtensions.h" #include "OpenGLRenderer.h" #include "RuntimeHost.h" #include #include #include #include #include #include class DeckLinkSession; class OpenGLDeckLinkBridge; class OpenGLRenderPass; class OpenGLShaderPrograms; class RuntimeServices; class OpenGLComposite { public: OpenGLComposite(HWND hWnd, HDC hDC, HGLRC hRC); ~OpenGLComposite(); bool InitDeckLink(); bool Start(); bool Stop(); bool ReloadShader(); std::string GetRuntimeStateJson() const; bool AddLayer(const std::string& shaderId, std::string& error); bool RemoveLayer(const std::string& layerId, std::string& error); bool MoveLayer(const std::string& layerId, int direction, std::string& error); bool MoveLayerToIndex(const std::string& layerId, std::size_t targetIndex, std::string& error); bool SetLayerBypass(const std::string& layerId, bool bypassed, std::string& error); bool SetLayerShader(const std::string& layerId, const std::string& shaderId, std::string& error); bool UpdateLayerParameterJson(const std::string& layerId, const std::string& parameterId, const std::string& valueJson, std::string& error); bool UpdateLayerParameterByControlKeyJson(const std::string& layerKey, const std::string& parameterKey, const std::string& valueJson, std::string& error); bool ResetLayerParameters(const std::string& layerId, std::string& error); bool SaveStackPreset(const std::string& presetName, std::string& error); bool LoadStackPreset(const std::string& presetName, std::string& error); void resizeGL(WORD width, WORD height); void paintGL(); void VideoFrameArrived(IDeckLinkVideoInputFrame* inputFrame, bool hasNoInputSource); void PlayoutFrameCompleted(IDeckLinkVideoFrame* completedFrame, BMDOutputFrameCompletionResult result); private: void resizeWindow(int width, int height); bool CheckOpenGLExtensions(); void PublishDeckLinkOutputStatus(const std::string& statusMessage); using LayerProgram = OpenGLRenderer::LayerProgram; HWND hGLWnd; HDC hGLDC; HGLRC hGLRC; CRITICAL_SECTION pMutex; std::unique_ptr mDeckLink; std::unique_ptr mRenderer; std::unique_ptr mRuntimeHost; std::unique_ptr mDeckLinkBridge; std::unique_ptr mRenderPass; std::unique_ptr mShaderPrograms; std::unique_ptr mRuntimeServices; std::vector mCachedLayerRenderStates; bool InitOpenGLState(); void renderEffect(); bool ProcessRuntimePollResults(); void broadcastRuntimeState(); void resetTemporalHistoryState(); }; #endif // __OPENGL_COMPOSITE_H__