From: Dan Dennedy Date: Mon, 25 Feb 2013 03:24:01 +0000 (-0800) Subject: Let movit.convert suport non-glsl to glsl_texture. X-Git-Url: https://git.sesse.net/?p=mlt;a=commitdiff_plain;h=37b972e8624c7013d056081b954fa95a0ff756eb Let movit.convert suport non-glsl to glsl_texture. It saves the rendered texture and returns it. --- diff --git a/src/modules/opengl/filter_movit_convert.cpp b/src/modules/opengl/filter_movit_convert.cpp index baf8bef7..8c12aed6 100644 --- a/src/modules/opengl/filter_movit_convert.cpp +++ b/src/modules/opengl/filter_movit_convert.cpp @@ -90,9 +90,19 @@ static int convert_image( mlt_frame frame, uint8_t **image, mlt_image_format *fo // Use a temporary chain to convert image in RAM to OpenGL texture. if ( output_format == mlt_image_glsl_texture && *format != mlt_image_glsl ) { - input = new MltInput( width, height ); - chain = new EffectChain( width, height ); - chain->add_input( input ); + // We might already have a texture from a previous conversion from mlt_image_glsl. + glsl_texture texture = (glsl_texture) mlt_properties_get_data( properties, "movit.convert", NULL ); + if ( texture ) { + *image = (uint8_t*) &texture->texture; + mlt_frame_set_image( frame, *image, 0, NULL ); + mlt_properties_set_int( properties, "format", output_format ); + *format = output_format; + return error; + } else { + input = new MltInput( width, height ); + chain = new EffectChain( width, height ); + chain->add_input( input ); + } } if ( *format != mlt_image_glsl ) { @@ -245,7 +255,8 @@ static int convert_image( mlt_frame frame, uint8_t **image, mlt_image_format *fo check_error(); glBindTexture( GL_TEXTURE_2D, 0 ); check_error(); - GlslManager::release_texture( texture ); + mlt_properties_set_data( properties, "movit.convert", texture, 0, + (mlt_destructor) GlslManager::release_texture, NULL); mlt_properties_set_int( properties, "format", output_format ); *format = output_format;