#ifndef GLWIDGET_H #define GLWIDGET_H #include #include #include #include #include #include extern "C" { #include } class VideoDecoder; class GLWidget : public QOpenGLWidget, protected QOpenGLFunctions { Q_OBJECT public: explicit GLWidget(QWidget *parent = nullptr); ~GLWidget() override; void setVideoDecoder(VideoDecoder *decoder); // Ajustes del Shader CRT void setCrtEnabled(bool enabled); void setCurvature(float value); void setScanlineDensity(float value); void setScanlineOpacity(float value); void setAberration(float value); void setVignette(float value); void setBrightness(float value); void clearVideo(); public slots: void onFrameReady(); protected: void initializeGL() override; void resizeGL(int w, int h) override; void paintGL() override; private: void cleanupCudaGL(); VideoDecoder *m_videoDecoder; QOpenGLShaderProgram m_shaderProgram; // Texturas de OpenGL para NV12 GLuint m_texY; GLuint m_texUV; GLuint m_vbo; // Recursos gráficos registrados de CUDA cudaGraphicsResource_t m_cudaResourceY; cudaGraphicsResource_t m_cudaResourceUV; // Fotograma local reutilizable AVFrame *m_localFrame; // Dimensiones de texturas registradas en CUDA int m_allocatedWidth; int m_allocatedHeight; // Estado del Shader bool m_crtEnabled; float m_curvature; float m_scanlineDensity; float m_scanlineOpacity; float m_aberration; float m_vignette; float m_brightness; }; #endif // GLWIDGET_H