*/
#include <framework/mlt.h>
-#include <QtGui/QApplication>
-#include <QtCore/QLocale>
-#include <QtOpenGL/QGLWidget>
+#include <QApplication>
+#include <QLocale>
+#include <QGLWidget>
static void onThreadStarted(mlt_properties owner, mlt_consumer consumer)
{
"OpenGL Shading Language rendering is not supported on this machine.\n" );
mlt_events_fire(properties, "consumer-fatal-error", NULL);
}
+ else {
+ mlt_properties_set_data(properties, "qglslRenderContext", renderContext, 0, NULL, NULL);
+ }
+}
+
+static void onCleanup(mlt_properties owner, mlt_consumer consumer)
+{
+ QGLWidget* renderContext = (QGLWidget*) mlt_properties_get_data(
+ MLT_CONSUMER_PROPERTIES(consumer), "qglslRenderContext", NULL);
+ if (renderContext)
+ renderContext->makeCurrent();
+ delete renderContext;
+ mlt_properties_set_data(MLT_CONSUMER_PROPERTIES(consumer),
+ "qglslRenderContext", NULL, 0, NULL, NULL);
}
extern "C" {
if (filter) {
mlt_properties properties = MLT_CONSUMER_PROPERTIES(consumer);
mlt_properties_set_data(properties, "glslManager", filter, 0, (mlt_destructor) mlt_filter_close, NULL);
+ mlt_events_register( properties, "consumer-cleanup", NULL );
mlt_events_listen(properties, consumer, "consumer-thread-started", (mlt_listener) onThreadStarted);
+ mlt_events_listen(properties, consumer, "consumer-cleanup", (mlt_listener) onCleanup);
return consumer;
}
mlt_consumer_close(consumer);