if ( mlt_properties_get( MLT_FILTER_PROPERTIES( this ), "end" ) != NULL )
{
// Determine the time position of this frame in the transition duration
- mlt_position in = mlt_filter_get_in( this );
- mlt_position out = mlt_filter_get_out( this );
- mlt_position time = mlt_frame_get_position( frame );
- double position = ( double )( time - in ) / ( double )( out - in + 1 );
double end = fabs( mlt_properties_get_double( MLT_FILTER_PROPERTIES( this ), "end" ) );
- level += ( end - level ) * position;
+ level += ( end - level ) * mlt_filter_get_progress( this, frame );
}
// Push the frame filter
output->mask_h = lerp( in->mask_h + ( out->mask_h - in->mask_h ) * position, 1, -1 );
}
-/** Calculate the position for this frame.
-*/
-
-static float position_calculate( mlt_filter this, mlt_frame frame )
-{
- // Get the in and out position
- mlt_position in = mlt_filter_get_in( this );
- mlt_position out = mlt_filter_get_out( this );
-
- // Get the position of the frame
- mlt_position position = mlt_frame_get_position( frame );
-
- // Now do the calcs
- return ( float )( position - in ) / ( float )( out - in + 1 );
-}
-
/** The averaging function...
*/
mlt_frame_push_service( frame, this );
// Calculate the position for the filter effect
- float position = position_calculate( this, frame );
+ double position = mlt_filter_get_progress( this, frame );
mlt_properties_set_double( MLT_FRAME_PROPERTIES( frame ), "filter_position", position );
// Push the get image call
if ( mlt_properties_get( MLT_FILTER_PROPERTIES( this ), "end" ) != NULL )
{
// Determine the time position of this frame in the transition duration
- mlt_position in = mlt_filter_get_in( this );
- mlt_position out = mlt_filter_get_out( this );
- mlt_position time = mlt_frame_get_position( frame );
- double position = (double) ( time - in ) / ( out - in + 1.0 );
double end = (double) mlt_properties_get_int( MLT_FILTER_PROPERTIES( this ), "end" );
- blur += ( end - blur ) * position;
+ blur += ( end - blur ) * mlt_filter_get_progress( this, frame );
}
// Push the frame filter
if ( mlt_properties_get( MLT_FILTER_PROPERTIES( filter ), "end" ) != NULL )
{
// Determine the time position of this frame in the transition duration
- mlt_position in = mlt_filter_get_in( filter );
- mlt_position out = mlt_filter_get_out( filter );
- mlt_position time = mlt_frame_get_position( frame );
- double position = ( double )( time - in ) / ( double )( out - in + 1 );
double end = fabs( mlt_properties_get_double( MLT_FILTER_PROPERTIES( filter ), "end" ) );
- wave += ( end - wave ) * position;
+ wave += ( end - wave ) * mlt_filter_get_progress( filter, frame );
}
// Push the frame filter
// If there is an end adjust gain to the range
if ( mlt_properties_get( filter_props, "end" ) != NULL )
{
- // Determine the time position of this frame in the transition duration
- mlt_position in = mlt_filter_get_in( this );
- mlt_position out = mlt_filter_get_out( this );
- mlt_position time = mlt_frame_get_position( frame );
- double position = ( double )( time - in ) / ( double )( out - in + 1 );
-
double end = -1;
char *p = mlt_properties_get( filter_props, "end" );
if ( strcmp( p, "" ) != 0 )
end = fabs( end );
if ( end != -1 )
- gain += ( end - gain ) * position;
+ gain += ( end - gain ) * mlt_filter_get_progress( this, frame );
}
}
}
// If there is an end adjust gain to the range
if ( mlt_properties_get( filter_props, "end" ) != NULL )
{
- // Determine the time position of this frame in the transition duration
- mlt_position in = mlt_filter_get_in( this );
- mlt_position out = mlt_filter_get_out( this );
- mlt_position time = mlt_frame_get_position( frame );
- double position = ( double )( time - in ) / ( double )( out - in + 1 );
- amplitude *= position;
+ amplitude *= mlt_filter_get_progress( this, frame );
}
mlt_properties_set_int( instance_props, "normalise", 1 );
mlt_properties_set_double( instance_props, "amplitude", amplitude );
int maxdia = mlt_properties_get_int( MLT_FILTER_PROPERTIES( filter ), "maxdiameter" );
int maxcount = mlt_properties_get_int( MLT_FILTER_PROPERTIES( filter ), "maxcount" );
- 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 );
-
*format = mlt_image_yuv422;
int error = mlt_frame_get_image( this, image, format, width, height, 1 );
// load svg
if (!maxcount)
return 0;
+
+ double position = mlt_filter_get_progress( filter, this );
srand(position*10000);
mlt_service_lock( MLT_FILTER_SERVICE( filter ) );
int h = *height;
int w = *width;
- 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 );
+ double position = mlt_filter_get_progress( filter, this );
srand(position*10000);
int noise = mlt_properties_get_int( MLT_FILTER_PROPERTIES( filter ), "noise" );
char buf[256];
char typebuf[256];
- 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 );
- srand(position*10000);
if (!width_line)
return 0;
+
+ double position = mlt_filter_get_progress( filter, this );
+ srand(position*10000);
mlt_service_lock( MLT_FILTER_SERVICE( filter ) );
int x=0;
int y=0;
- 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 );
+ double position = mlt_filter_get_progress( filter, this );
srand(position*10000);
int delta = mlt_properties_get_int( MLT_FILTER_PROPERTIES( filter ), "delta" );