From: Brian Matherly Date: Fri, 24 Jan 2014 18:54:58 +0000 (-0600) Subject: Fix crash for mlt_audio_f32le and other formats that were not covered X-Git-Url: https://git.sesse.net/?p=mlt;a=commitdiff_plain;h=51b370c199a9a936aa94655d514f3fd23975f15a Fix crash for mlt_audio_f32le and other formats that were not covered --- diff --git a/src/framework/mlt_frame.c b/src/framework/mlt_frame.c index 94a4d15a..baf9d8d5 100644 --- a/src/framework/mlt_frame.c +++ b/src/framework/mlt_frame.c @@ -741,26 +741,11 @@ int mlt_frame_get_audio( mlt_frame self, void **buffer, mlt_audio_format *format mlt_properties_set_int( properties, "audio_samples", *samples ); mlt_properties_set_int( properties, "audio_format", *format ); - switch( *format ) - { - case mlt_image_none: - size = 0; - *buffer = NULL; - break; - case mlt_audio_s16: - size = *samples * *channels * sizeof( int16_t ); - break; - case mlt_audio_s32: - size = *samples * *channels * sizeof( int32_t ); - break; - case mlt_audio_float: - size = *samples * *channels * sizeof( float ); - break; - default: - break; - } + size = mlt_audio_format_size( *format, *samples, *channels ); if ( size ) *buffer = mlt_pool_alloc( size ); + else + *buffer = NULL; if ( *buffer ) memset( *buffer, 0, size ); mlt_properties_set_data( properties, "audio", *buffer, size, ( mlt_destructor )mlt_pool_release, NULL );