#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); 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; }; #endif // GLWIDGET_H