From: Steinar H. Gunderson Date: Thu, 16 Jan 2014 18:36:53 +0000 (+0100) Subject: Let Movit effects supply their own fingerprint. X-Git-Url: https://git.sesse.net/?p=mlt;a=commitdiff_plain;h=2c046e968db474d1eafbcf77b119495bf89e6ae5 Let Movit effects supply their own fingerprint. This allows effects to signal that some sort of change means the chain needs to be regenerated. In particular, this unbreaks changing the matrix_size parameter of DeconvolutionSharpenEffect; if you change it, the entire chain will now be regenerated, instead of getting an assertion failure. --- diff --git a/src/modules/opengl/filter_movit_convert.cpp b/src/modules/opengl/filter_movit_convert.cpp index 2b9a39db..c35b546d 100644 --- a/src/modules/opengl/filter_movit_convert.cpp +++ b/src/modules/opengl/filter_movit_convert.cpp @@ -131,6 +131,14 @@ static void build_fingerprint( mlt_service service, mlt_frame frame, std::string fingerprint->push_back( '(' ); fingerprint->append( mlt_properties_get( MLT_SERVICE_PROPERTIES( service ), "_unique_id" ) ); + + const char* effect_fingerprint = mlt_properties_get( MLT_SERVICE_PROPERTIES( service ), "_movit fingerprint" ); + if ( effect_fingerprint ) { + fingerprint->push_back( '[' ); + fingerprint->append( effect_fingerprint ); + fingerprint->push_back( ']' ); + } + bool disable = mlt_properties_get_int( MLT_SERVICE_PROPERTIES( service ), "movit.parms.int.disable" ); if ( disable ) { fingerprint->push_back( 'd' ); diff --git a/src/modules/opengl/filter_movit_deconvolution_sharpen.cpp b/src/modules/opengl/filter_movit_deconvolution_sharpen.cpp index bedb3133..34d779e0 100644 --- a/src/modules/opengl/filter_movit_deconvolution_sharpen.cpp +++ b/src/modules/opengl/filter_movit_deconvolution_sharpen.cpp @@ -31,8 +31,8 @@ static int get_image( mlt_frame frame, uint8_t **image, mlt_image_format *format GlslManager::get_instance()->lock_service( frame ); mlt_position position = mlt_filter_get_position( filter, frame ); mlt_position length = mlt_filter_get_length2( filter, frame ); - mlt_properties_set_int( properties, "movit.parms.int.matrix_size", - mlt_properties_anim_get_int( properties, "matrix_size", position, length ) ); + int matrix_size = mlt_properties_anim_get_int( properties, "matrix_size", position, length ); + mlt_properties_set_int( properties, "movit.parms.int.matrix_size", matrix_size ); mlt_properties_set_double( properties, "movit.parms.float.circle_radius", mlt_properties_anim_get_double( properties, "circle_radius", position, length ) ); mlt_properties_set_double( properties, "movit.parms.float.gaussian_radius", @@ -41,6 +41,13 @@ static int get_image( mlt_frame frame, uint8_t **image, mlt_image_format *format mlt_properties_anim_get_double( properties, "correlation", position, length ) ); mlt_properties_set_double( properties, "movit.parms.float.noise", mlt_properties_anim_get_double( properties, "noise", position, length ) ); + + // DeconvolutionSharpenEffect compiles the matrix size into the shader, + // so we need to regenerate the chain if this changes. + char fingerprint[256]; + snprintf( fingerprint, sizeof( fingerprint ), "s=%d", matrix_size ); + mlt_properties_set( properties, "_movit fingerprint", fingerprint ); + GlslManager::get_instance()->unlock_service( frame ); *format = mlt_image_glsl; int error = mlt_frame_get_image( frame, image, format, width, height, writable );