X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fmodules%2Fcore%2Ftransition_mix.c;h=b2b3790a4882f72fe4735dbfb6464692ca44d4c8;hb=f4bdbe56053cc8debfdb74583977d74323a8ad0d;hp=1dfda2e8236032513fc069273342dd279ec946cc;hpb=bf3264b9e340ba5c11cbf59835a8af3db94e0cc2;p=melted diff --git a/src/modules/core/transition_mix.c b/src/modules/core/transition_mix.c index 1dfda2e..b2b3790 100644 --- a/src/modules/core/transition_mix.c +++ b/src/modules/core/transition_mix.c @@ -18,7 +18,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "transition_mix.h" +#include #include #include @@ -104,14 +104,17 @@ static mlt_frame transition_process( mlt_transition this, mlt_frame a_frame, mlt mlt_properties_set_double( b_props, "audio.mix", mix ); // Initialise transition previous mix value to prevent an inadvertant jump from 0 - if ( mlt_properties_get( properties, "previous_mix" ) == NULL ) - mlt_properties_set_double( properties, "previous_mix", mlt_properties_get_double( b_props, "audio.mix" ) ); + mlt_position last_position = mlt_properties_get_position( properties, "_last_position" ); + mlt_position current_position = mlt_frame_get_position( b_frame ); + if ( mlt_properties_get( properties, "_previous_mix" ) == NULL + || current_position != last_position + 1 ) + mlt_properties_set_double( properties, "_previous_mix", mix ); // Tell b frame what the previous mix level was - mlt_properties_set_double( b_props, "audio.previous_mix", mlt_properties_get_double( properties, "previous_mix" ) ); + mlt_properties_set_double( b_props, "audio.previous_mix", mlt_properties_get_double( properties, "_previous_mix" ) ); // Save the current mix level for the next iteration - mlt_properties_set_double( properties, "previous_mix", mlt_properties_get_double( b_props, "audio.mix" ) ); + mlt_properties_set_double( properties, "_previous_mix", mlt_properties_get_double( b_props, "audio.mix" ) ); mlt_properties_set_double( b_props, "audio.reverse", mlt_properties_get_double( properties, "reverse" ) ); } @@ -150,7 +153,7 @@ static mlt_frame transition_process( mlt_transition this, mlt_frame a_frame, mlt /** Constructor for the transition. */ -mlt_transition transition_mix_init( char *arg ) +mlt_transition transition_mix_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg ) { mlt_transition this = calloc( sizeof( struct mlt_transition_s ), 1 ); if ( this != NULL && mlt_transition_init( this, NULL ) == 0 )