- 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 );
+ }