* Copyright (C) 2003-2004 Ushodaya Enterprises Limited
* Author: Dan Dennedy <dan@dennedy.org>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "transition_mix.h"
// Get the b frame from the stack
mlt_frame b_frame = mlt_frame_pop_audio( frame );
+ // Get the effect
+ mlt_transition effect = mlt_frame_pop_audio( frame );
+
// Get the properties of the b frame
mlt_properties b_props = MLT_FRAME_PROPERTIES( b_frame );
- double mix_start = 0.5, mix_end = 0.5;
- if ( mlt_properties_get( b_props, "audio.previous_mix" ) != NULL )
- mix_start = mlt_properties_get_double( b_props, "audio.previous_mix" );
- if ( mlt_properties_get( b_props, "audio.mix" ) != NULL )
- mix_end = mlt_properties_get_double( b_props, "audio.mix" );
- if ( mlt_properties_get_int( b_props, "audio.reverse" ) )
+ if ( mlt_properties_get_int( MLT_TRANSITION_PROPERTIES( effect ), "combine" ) == 0 )
{
- mix_start = 1 - mix_start;
- mix_end = 1 - mix_end;
- }
+ double mix_start = 0.5, mix_end = 0.5;
+ if ( mlt_properties_get( b_props, "audio.previous_mix" ) != NULL )
+ mix_start = mlt_properties_get_double( b_props, "audio.previous_mix" );
+ if ( mlt_properties_get( b_props, "audio.mix" ) != NULL )
+ mix_end = mlt_properties_get_double( b_props, "audio.mix" );
+ if ( mlt_properties_get_int( b_props, "audio.reverse" ) )
+ {
+ mix_start = 1 - mix_start;
+ mix_end = 1 - mix_end;
+ }
- mlt_frame_mix_audio( frame, b_frame, mix_start, mix_end, buffer, format, frequency, channels, samples );
+ mlt_frame_mix_audio( frame, b_frame, mix_start, mix_end, buffer, format, frequency, channels, samples );
+ }
+ else
+ {
+ mlt_frame_combine_audio( frame, b_frame, buffer, format, frequency, channels, samples );
+ }
return 0;
}
}
// Override the get_audio method
+ mlt_frame_push_audio( a_frame, this );
mlt_frame_push_audio( a_frame, b_frame );
mlt_frame_push_audio( a_frame, transition_get_audio );