]> git.sesse.net Git - mlt/blobdiff - src/modules/opengl/filter_movit_mirror.cpp
Fix build on Windows due to missing queue macros.
[mlt] / src / modules / opengl / filter_movit_mirror.cpp
index 55fa637667f1badec97b5beac1881ede69d38b14..6c7b61328358f1909b579dd92279ff8894834a53 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;
 }
 
@@ -42,6 +50,8 @@ mlt_filter filter_movit_mirror_init( mlt_profile profile, mlt_service_type type,
        GlslManager* glsl = GlslManager::get_instance();
 
        if ( glsl && ( filter = mlt_filter_new() ) ) {
+               mlt_properties properties = MLT_FILTER_PROPERTIES( filter );
+               glsl->add_ref( properties );
                filter->process = process;
        }
        return filter;