]> git.sesse.net Git - mlt/commitdiff
Let Movit effects supply their own fingerprint.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 16 Jan 2014 18:36:53 +0000 (19:36 +0100)
committerDan Dennedy <dan@dennedy.org>
Fri, 17 Jan 2014 03:27:22 +0000 (19:27 -0800)
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.

src/modules/opengl/filter_movit_convert.cpp
src/modules/opengl/filter_movit_deconvolution_sharpen.cpp

index 2b9a39dbc022f66dff306d27c64e3bf458bcd23d..c35b546dcbfb366c65b53e082445c99eab305a5c 100644 (file)
@@ -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" ) );
 
        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' );
        bool disable = mlt_properties_get_int( MLT_SERVICE_PROPERTIES( service ), "movit.parms.int.disable" );
        if ( disable ) {
                fingerprint->push_back( 'd' );
index bedb313331d6fb4dfa3790c32c7581b7a6db4597..34d779e0adf9671d878bfe353b48be454669e884 100644 (file)
@@ -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 );
        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",
        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 ) );
                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 );
        GlslManager::get_instance()->unlock_service( frame );
        *format = mlt_image_glsl;
        int error = mlt_frame_get_image( frame, image, format, width, height, writable );