#include <time.h>
#include <sys/time.h>
#include <pthread.h>
-#include <sys/syscall.h>
#include <framework/mlt.h>
static void show_frame()
{
-// fprintf(stderr,"show_frame threadID : %ld\n", syscall(SYS_gettid));
-
if ( (fb.width != new_frame.width) || (fb.height != new_frame.height) ) {
glDeleteFramebuffers( 1, &fb.fbo );
glDeleteTextures( 1, &fb.texture );
next = mlt_consumer_rt_frame( consumer );
if ( !mlt_properties_get_int( MLT_FILTER_PROPERTIES( glsl_manager ), "glsl_supported" ) ) {
- fprintf( stderr, "OpenGL Shading Language is not supported on this machine.\n" );
+ mlt_log_error( MLT_CONSUMER_SERVICE(consumer), "OpenGL Shading Language is not supported on this machine.\n" );
xgl->running = 0;
break;
}
XGetGeometry( GLWin.dpy, GLWin.win, &winDummy, &GLWin.x, &GLWin.y,
&GLWin.width, &GLWin.height, &borderDummy, &GLWin.depth );
- fprintf(stderr, "Direct Rendering: %s\n",glXIsDirect( GLWin.dpy, GLWin.ctx ) ? "true" : "false" );
-
// Verify GLSL works on this machine
hiddenctx.ctx = glXCreateContext( GLWin.dpy, vi, GLWin.ctx, GL_TRUE );
if ( hiddenctx.ctx ) {
new_frame.mlt_frame_ref = NULL;
vthread.running = 0;
-
+ xgl->xgl_started = 1;
+
createGLWindow();
run();
if ( vthread.running ) {
vthread.running = 0;
pthread_join( vthread.thread, NULL );
}
- killGLWindow();
xgl->running = 0;
}
static void on_consumer_thread_started( mlt_properties owner, HiddenContext* context )
{
- fprintf(stderr, "%s: %ld\n", __FUNCTION__, syscall(SYS_gettid));
// Initialize this thread's OpenGL state
glXMakeCurrent( context->dpy, context->win, context->ctx );
mlt_events_fire( MLT_FILTER_PROPERTIES(glsl_manager), "init glsl", NULL );
mlt_consumer consumer_xgl_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg )
{
- fprintf(stderr, "consumer_xgl_init\n");
// Create the consumer object
consumer_xgl this = calloc( sizeof( struct consumer_xgl_s ), 1 );
// Close the queue
mlt_deque_close( this->queue );
+ if ( this->xgl_started )
+ killGLWindow();
+
// Finally clean up this
free( this );
}