]> git.sesse.net Git - mlt/blobdiff - src/modules/videostab/filter_videostab2.c
Convert backtick to $(shell) in Makefiles.
[mlt] / src / modules / videostab / filter_videostab2.c
index cd6e78faf3012376e67f654e9e8e2b9e5e9eae35..63d2374c0826eda83976573ff9ed432973ba8bbf 100644 (file)
@@ -48,8 +48,8 @@ static void serialize_vectors( videostab2_data* self, mlt_position length )
                mlt_position i;
 
                // Initialize geometry item
-               item.key = item.f[0] = item.f[1] = 1;
-               item.f[2] = item.f[3] = item.f[4] = 1;
+               item.key = item.f[0] = item.f[1] = item.f[2] = item.f[3] = 1;
+               item.f[4] = 0;
 
                tlist* transform_data =self->stab->transs;
                for ( i = 0; i < length; i++ )
@@ -72,8 +72,8 @@ static void serialize_vectors( videostab2_data* self, mlt_position length )
 
                // Put the analysis results in a property
                mlt_geometry_set_length( g, length );
-               mlt_properties_set( MLT_FILTER_PROPERTIES( (mlt_filter) self->parent ), "vectors", mlt_geometry_serialise( g ) );
-               mlt_geometry_close( g );
+               mlt_properties_set_data( MLT_FILTER_PROPERTIES( (mlt_filter) self->parent ), "vectors", g, 0,
+                       (mlt_destructor) mlt_geometry_close, (mlt_serialiser) mlt_geometry_serialise );
        }
 }
 // scale zoom implements the factor that the vetcors must be scaled since the vector is calulated for real with, now we need it for (scaled)width
@@ -134,6 +134,13 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format
                // Service locks are for concurrency control
                mlt_service_lock( MLT_FILTER_SERVICE( filter ) );
 
+               // Handle signal from app to re-init data
+               if ( mlt_properties_get_int( MLT_FILTER_PROPERTIES(filter) , "refresh" ) )
+               {
+                       mlt_properties_set( MLT_FILTER_PROPERTIES(filter) , "refresh", NULL );
+                       data->initialized = 0;
+               }
+
                if ( !vectors) {
                        if ( !data->initialized )
                        {
@@ -172,7 +179,7 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format
                                        // Load analysis results from property
                                        data->initialized = 2;
 
-                                       int interp = 2;
+                                       int interp = 2; // default to bilinear
                                        float scale_zoom=1.0;
                                        if ( *width != mlt_properties_get_int( MLT_FRAME_PROPERTIES( frame ), "meta.media.width" ) )
                                                scale_zoom = (float) *width / (float) mlt_properties_get_int( MLT_FRAME_PROPERTIES( frame ), "meta.media.width" );
@@ -180,17 +187,11 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format
                                                interp = 0;
                                        else if ( strcmp( interps, "tiles" ) == 0 || strcmp( interps, "fast_bilinear" ) == 0 )
                                                interp = 1;
-                                       else if ( strcmp( interps, "bilinear" ) == 0 )
-                                               interp = 2;
-                                       else if ( strcmp( interps, "bicubic" ) == 0 )
-                                               interp = 3;
-                                       else if ( strcmp( interps, "bicublin" ) == 0 )
-                                               interp = 4;
 
                                        data->trans->interpoltype = interp;
                                        data->trans->smoothing = mlt_properties_get_int( MLT_FILTER_PROPERTIES(filter), "smoothing" );
                                        data->trans->maxshift = mlt_properties_get_int( MLT_FILTER_PROPERTIES(filter), "maxshift" );
-                                       data->trans->maxangle = mlt_properties_get_int( MLT_FILTER_PROPERTIES(filter), "maxangle" );
+                                       data->trans->maxangle = mlt_properties_get_double( MLT_FILTER_PROPERTIES(filter), "maxangle" );
                                        data->trans->crop = mlt_properties_get_int( MLT_FILTER_PROPERTIES(filter), "crop" );
                                        data->trans->invert = mlt_properties_get_int( MLT_FILTER_PROPERTIES(filter), "invert" );
                                        data->trans->relative = mlt_properties_get_int( MLT_FILTER_PROPERTIES(filter), "relative" );
@@ -260,7 +261,12 @@ mlt_filter filter_videostab2_init( mlt_profile profile, mlt_service_type type, c
 
                mlt_filter parent = mlt_filter_new();
                if ( !parent )
+               {
+                       free( data->trans );
+                       free( data->stab );
+                       free( data );
                        return NULL;
+               }
 
                parent->child = data;
                parent->close = filter_close;