]> git.sesse.net Git - mlt/blobdiff - src/modules/vmfx/filter_shape.c
Merge branch 'frei0r-metadata'
[mlt] / src / modules / vmfx / filter_shape.c
index e900e050339f517732b2e483468268c6e1581c67..cfe0ee6243b652f2d096d6cb8e232f3d4036e33e 100644 (file)
  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
-#include "filter_shape.h"
+#include <framework/mlt.h>
 #include <string.h>
 #include <framework/mlt_factory.h>
 #include <framework/mlt_frame.h>
 #include <framework/mlt_producer.h>
 #include <framework/mlt_geometry.h>
 
-inline double smoothstep( const double e1, const double e2, const double a )
+static inline double smoothstep( const double e1, const double e2, const double a )
 {
     if ( a < e1 ) return 0.0;
     if ( a > e2 ) return 1.0;
@@ -49,6 +49,7 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format *
        int invert = mlt_properties_get_int( MLT_FILTER_PROPERTIES( filter ), "invert" ) * 255;
 
        // Render the frame
+       *format = mlt_image_yuv422;
        if ( mlt_frame_get_image( this, image, format, width, height, writable ) == 0 && ( !use_luminance || ( int )mix != 1 ) )
        {
                // Get the alpha mask of the source
@@ -113,7 +114,7 @@ static mlt_frame filter_process( mlt_filter this, mlt_frame frame )
        double alpha_mix = 0.0;
 
        // Calculate the position and length
-       int position = mlt_frame_get_position( frame ) - mlt_filter_get_in( this );
+       int position = mlt_filter_get_position( this, frame );
        int in = mlt_filter_get_in( this );
        int out = mlt_filter_get_out( this );
        int length;
@@ -145,7 +146,7 @@ static mlt_frame filter_process( mlt_filter this, mlt_frame frame )
                if ( strchr( resource, '%' ) )
                {
                        FILE *test;
-                       sprintf( temp, "%s/lumas/%s/%s", mlt_factory_prefix( ), mlt_environment( "MLT_NORMALISATION" ), strchr( resource, '%' ) + 1 );
+                       sprintf( temp, "%s/lumas/%s/%s", mlt_environment( "MLT_DATA" ), mlt_environment( "MLT_NORMALISATION" ), strchr( resource, '%' ) + 1 );
                        test = fopen( temp, "r" );
 
                        if ( test == NULL )
@@ -163,7 +164,8 @@ static mlt_frame filter_process( mlt_filter this, mlt_frame frame )
                        extension = strrchr( resource, '.' );
                }
 
-               producer = mlt_factory_producer( NULL, resource );
+               mlt_profile profile = mlt_service_profile( MLT_FILTER_SERVICE( this ) );
+               producer = mlt_factory_producer( profile, NULL, resource );
                if ( producer != NULL )
                        mlt_properties_set( MLT_PRODUCER_PROPERTIES( producer ), "eof", "loop" );
                mlt_properties_set_data( MLT_FILTER_PROPERTIES( this ), "instance", producer, 0, ( mlt_destructor )mlt_producer_close, NULL );
@@ -212,7 +214,7 @@ static mlt_frame filter_process( mlt_filter this, mlt_frame frame )
 /** Constructor for the filter.
 */
 
-mlt_filter filter_shape_init( char *arg )
+mlt_filter filter_shape_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg )
 {
        mlt_filter this = mlt_filter_new( );
        if ( this != NULL )