*
* You do not need to deallocate the returned string.
* \public \memberof mlt_frame_s
- * \param self a frame
- * \param format an image format enum
+ * \param format an audio format enum
* \return a string for the name of the image format
*/
case mlt_audio_none: return "none";
case mlt_audio_s16: return "s16";
case mlt_audio_s32: return "s32";
+ case mlt_audio_s32le: return "s32le";
case mlt_audio_float: return "float";
+ case mlt_audio_f32le: return "f32le";
}
return "invalid";
}
+/** Get the amount of bytes needed for a block of audio.
+ *
+ * \public \memberof mlt_frame_s
+ * \param format an audio format enum
+ * \param samples the number of samples per channel
+ * \param channels the number of channels
+ * \return the number of bytes
+ */
+
+int mlt_audio_format_size( mlt_audio_format format, int samples, int channels )
+{
+ switch ( format )
+ {
+ case mlt_audio_none: return 0;
+ case mlt_audio_s16: return samples * channels * sizeof( int16_t );
+ case mlt_audio_s32le:
+ case mlt_audio_s32: return samples * channels * sizeof( int32_t );
+ case mlt_audio_f32le:
+ case mlt_audio_float: return samples * channels * sizeof( float );
+ }
+ return 0;
+}
+
/** Get the audio associated to the frame.
*
* You should express the desired format, frequency, channels, and samples as inputs. As long
case mlt_audio_float:
size = *samples * *channels * sizeof( float );
break;
+ default:
+ break;
}
if ( size )
*buffer = mlt_pool_alloc( size );