]> git.sesse.net Git - mlt/blobdiff - src/modules/opengl/filter_movit_mirror.cpp
Change how the Movit chain is built.
[mlt] / src / modules / opengl / filter_movit_mirror.cpp
index 55fa637667f1badec97b5beac1881ede69d38b14..12d8d271bb58610e6922d46bdc2e97245db3b87b 100644 (file)
 #include "filter_glsl_manager.h"
 #include <movit/mirror_effect.h>
 
+static int get_image( mlt_frame frame, uint8_t **image, mlt_image_format *format, int *width, int *height, int writable )
+{
+       mlt_filter filter = (mlt_filter) mlt_frame_pop_service( frame );
+       *format = mlt_image_glsl;
+       int error = mlt_frame_get_image( frame, image, format, width, height, writable );
+       GlslManager::set_effect_input( MLT_FILTER_SERVICE( filter ), frame, (mlt_service) *image );
+       GlslManager::set_effect( MLT_FILTER_SERVICE( filter ), frame, new MirrorEffect );
+       *image = (uint8_t *) MLT_FILTER_SERVICE( filter );
+       return error;
+}
+
 static mlt_frame process( mlt_filter filter, mlt_frame frame )
 {
-       if ( !mlt_frame_is_test_card( frame ) ) {
-               Effect* effect = GlslManager::get_effect( MLT_FILTER_SERVICE( filter ), frame );
-               if ( !effect )
-                       GlslManager::add_effect( MLT_FILTER_SERVICE( filter ), frame, new MirrorEffect() );
-       }
+       mlt_frame_push_service( frame, filter );
+       mlt_frame_push_get_image( frame, get_image );
        return frame;
 }