if ( audio_buffer == NULL )
{
// Allocate the audio buffer
- audio_buffer = malloc( 131072 * sizeof( int16_t ) );
+ audio_buffer = mlt_pool_alloc( 131072 * sizeof( int16_t ) );
// And store it on properties for reuse
- mlt_properties_set_data( properties, "audio_buffer", audio_buffer, 0, free, NULL );
+ mlt_properties_set_data( properties, "audio_buffer", audio_buffer, 0, mlt_pool_release, NULL );
}
// Seek if necessary
// Now handle the audio if we have enough
if ( audio_used >= *samples )
{
- *buffer = malloc( *samples * *channels * sizeof( int16_t ) );
+ *buffer = mlt_pool_alloc( *samples * *channels * sizeof( int16_t ) );
memcpy( *buffer, audio_buffer, *samples * *channels * sizeof( int16_t ) );
audio_used -= *samples;
memmove( audio_buffer, &audio_buffer[ *samples * *channels ], audio_used * *channels * sizeof( int16_t ) );
- mlt_properties_set_data( frame_properties, "audio", *buffer, 0, free, NULL );
+ mlt_properties_set_data( frame_properties, "audio", *buffer, 0, mlt_pool_release, NULL );
}
else
{
mlt_frame_set_position( *frame, mlt_producer_position( this ) );
// Set the position of this producer
- mlt_properties_set_position( mlt_frame_properties( *frame ), "vorbis_position", mlt_producer_get_in( this ) + mlt_producer_position( this ) );
+ mlt_properties_set_position( mlt_frame_properties( *frame ), "vorbis_position", mlt_producer_position( this ) );
// Set up the audio
producer_set_up_audio( this, *frame );