]> git.sesse.net Git - mlt/blobdiff - src/modules/vorbis/producer_vorbis.c
Refactor audio conversion and mixing.
[mlt] / src / modules / vorbis / producer_vorbis.c
index 1c1e7ced5d518b6ac19b830e1b31e0abed75d080..77f9216676a1cfbf656713446f052bffb05a6822 100644 (file)
@@ -206,7 +206,7 @@ static double producer_time_of_frame( mlt_producer this, mlt_position position )
 /** Get the audio from a frame.
 */
 
-static int producer_get_audio( mlt_frame frame, int16_t **buffer, mlt_audio_format *format, int *frequency, int *channels, int *samples )
+static int producer_get_audio( mlt_frame frame, void **buffer, mlt_audio_format *format, int *frequency, int *channels, int *samples )
 {
        // Get the properties from the frame
        mlt_properties frame_properties = MLT_FRAME_PROPERTIES( frame );
@@ -314,11 +314,14 @@ static int producer_get_audio( mlt_frame frame, int16_t **buffer, mlt_audio_form
                // Now handle the audio if we have enough
                if ( audio_used >= *samples )
                {
-                       *buffer = mlt_pool_alloc( *samples * *channels * sizeof( int16_t ) );
-                       memcpy( *buffer, audio_buffer, *samples * *channels * sizeof( int16_t ) );
+                       int size = *samples * *channels * sizeof( int16_t );
+
+                       *format = mlt_audio_s16;
+                       *buffer = mlt_pool_alloc( size );
+                       memcpy( *buffer, audio_buffer, size );
                        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, mlt_pool_release, NULL );
+                       mlt_frame_set_audio( frame, *buffer, *format, size, mlt_pool_release );
                }
                else
                {