audio mix and repeated frames
[melted] / src / modules / core / transition_mix.c
index e976387..1f08471 100644 (file)
@@ -34,7 +34,7 @@ static int transition_get_audio( mlt_frame frame, int16_t **buffer, mlt_audio_fo
        mlt_properties a_props = mlt_frame_properties( frame );
 
        // Get the b frame from the stack
-       mlt_frame b_frame = mlt_frame_pop_frame( frame );
+       mlt_frame b_frame = mlt_frame_pop_audio( frame );
 
        // Get the properties of the b frame
        mlt_properties b_props = mlt_frame_properties( b_frame );
@@ -56,9 +56,6 @@ static int transition_get_audio( mlt_frame frame, int16_t **buffer, mlt_audio_fo
 
        mlt_frame_mix_audio( frame, b_frame, mix_start, mix_end, buffer, format, frequency, channels, samples );
 
-       // Push the b_frame back on for get_image
-       mlt_frame_push_frame( frame, b_frame );
-
        return 0;
 }
 
@@ -109,14 +106,21 @@ static mlt_frame transition_process( mlt_transition this, mlt_frame a_frame, mlt
                
                mlt_properties_set_double( b_props, "audio.reverse", mlt_properties_get_double( properties, "reverse" ) );
        }
-                       
+
+       // Ensure that the tractor knows this isn't test audio...
+       if ( mlt_properties_get_int( mlt_frame_properties( a_frame ), "test_audio" ) )
+       {
+               mlt_properties_set_int( mlt_frame_properties( a_frame ), "test_audio", 0 );
+               mlt_properties_set_int( mlt_frame_properties( a_frame ), "silent_audio", 1 );
+       }
+
        // Backup the original get_audio (it's still needed)
        mlt_properties_set_data( mlt_frame_properties( a_frame ), "mix.get_audio", a_frame->get_audio, 0, NULL, NULL );
 
        // Override the get_audio method
        a_frame->get_audio = transition_get_audio;
        
-       mlt_frame_push_frame( a_frame, b_frame );
+       mlt_frame_push_audio( a_frame, b_frame );
        
        return a_frame;
 }
@@ -132,6 +136,7 @@ mlt_transition transition_mix_init( char *arg )
                this->process = transition_process;
                if ( arg != NULL )
                        mlt_properties_set_double( mlt_transition_properties( this ), "start", atof( arg ) );
+               mlt_properties_set_int( mlt_transition_properties( this ), "_accepts_blanks", 1 );
        }
        return this;
 }