]> git.sesse.net Git - mlt/blobdiff - src/modules/opengl/filter_movit_convert.cpp
Let Movit effects supply their own fingerprint.
[mlt] / src / modules / opengl / filter_movit_convert.cpp
index 3e61dffcba6b1a846f81c6906e171d9ec640a46a..c35b546dcbfb366c65b53e082445c99eab305a5c 100644 (file)
@@ -30,6 +30,8 @@
 #include <mlt++/MltProducer.h>
 #include "mlt_flip_effect.h"
 
+static void set_movit_parameters( GlslChain *chain, mlt_service service, mlt_frame frame );
+
 static void yuv422_to_yuv422p( uint8_t *yuv422, uint8_t *yuv422p, int width, int height )
 {
        uint8_t *Y = yuv422p;
@@ -129,11 +131,17 @@ 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" ) );
-       bool disable = mlt_properties_get_int( MLT_SERVICE_PROPERTIES( service ), "movit.disable" );
+
+       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 ok = effect->set_int( "disable", 1 );
-               assert(ok);
        }
        fingerprint->push_back( ')' );
 }
@@ -202,13 +210,14 @@ static void finalize_movit_chain( mlt_service leaf_service, mlt_frame frame )
 
        // Build the chain if needed.
        if ( !chain || new_fingerprint != chain->fingerprint ) {
-               printf("=== CREATING NEW CHAIN (old chain=%p, leaf=%p, fingerprint=%s) ===\n", chain, leaf_service, new_fingerprint.c_str());
+               mlt_log_debug( leaf_service, "=== CREATING NEW CHAIN (old chain=%p, leaf=%p, fingerprint=%s) ===\n", chain, leaf_service, new_fingerprint.c_str() );
                mlt_profile profile = mlt_service_profile( leaf_service );
                chain = new GlslChain;
                chain->effect_chain = new EffectChain( profile->display_aspect_num, profile->display_aspect_den );
                chain->fingerprint = new_fingerprint;
 
                build_movit_chain( leaf_service, frame, chain );
+               set_movit_parameters( chain, leaf_service, frame );
                chain->effect_chain->add_effect( new Mlt::VerticalFlip );
 
                ImageFormat output_format;
@@ -423,6 +432,7 @@ static int convert_image( mlt_frame frame, uint8_t **image, mlt_image_format *fo
                finalize_movit_chain( leaf_service, frame );
 
                // Set per-frame parameters now that we know which Effect instances to set them on.
+               // (finalize_movit_chain may already have done this, though, but twice doesn't hurt.)
                GlslChain *chain = GlslManager::get_chain( leaf_service );
                set_movit_parameters( chain, leaf_service, frame );