]> git.sesse.net Git - mlt/blobdiff - src/modules/frei0r/filter_frei0r.c
Default SDL to use the onefield deinterlace filter.
[mlt] / src / modules / frei0r / filter_frei0r.c
index a2880f154a0f382c97c03dbd07ad3dd36ce7331c..fde17336f1b19f2cde8113d57374840918e1bd9b 100644 (file)
@@ -25,16 +25,18 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format *
 {
 
        mlt_filter filter = mlt_frame_pop_service( this );
-       int error = mlt_frame_get_image( this, image, format, width, height, 1 );
-       
-       if ( error == 0 && *image && *format == mlt_image_yuv422 )
+       mlt_properties properties = MLT_FILTER_PROPERTIES( filter );
+       *format = mlt_image_rgb24a;
+       mlt_log_debug( MLT_FILTER_SERVICE( filter ), "frei0r %dx%d\n", *width, *height );
+       int error = mlt_frame_get_image( this, image, format, width, height, 0 );
+
+       if ( error == 0 && *image )
        {
-               mlt_position in = mlt_filter_get_in( filter );
-               mlt_position out = mlt_filter_get_out( filter );
-               mlt_position time = mlt_frame_get_position( this );
-               double position = ( double )( time - in ) / ( double )( out - in + 1 );
+               mlt_position length = mlt_filter_get_out( filter ) - mlt_filter_get_in( filter ) + 1;
+               mlt_position time = mlt_properties_get_position( properties, "_filter_position" );
+               double position = ( double )( time ) / ( double )( length );
                
-               process_frei0r_item( filter_type , position, MLT_FILTER_PROPERTIES ( filter ), this , image, format , width , height , writable );
+               process_frei0r_item( filter_type, position, properties, this, image, width, height );
                
        }
 
@@ -45,12 +47,14 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format *
 mlt_frame filter_process( mlt_filter this, mlt_frame frame )
 {
        mlt_frame_push_service( frame, this );
+       // Determine the time position of this frame
+       mlt_properties_set_position( MLT_FILTER_PROPERTIES( this ), "_filter_position", mlt_frame_get_position( frame ) -  mlt_filter_get_in( this ) );
+       
        mlt_frame_push_get_image( frame, filter_get_image );
        return frame;
 }
 
-void filter_close( mlt_filter this ){
-       
+void filter_close( mlt_filter this )
+{
        destruct( MLT_FILTER_PROPERTIES ( this ) );
-       
 }