uint32_t mask, uint8_t *table );
VLC_API void aout_ChannelReorder(void *, size_t, unsigned, const uint8_t *, vlc_fourcc_t);
-VLC_API void aout_Interleave(void *dst, const void *src, unsigned samples,
- unsigned channels, vlc_fourcc_t fourcc);
+VLC_API void aout_Interleave(void *dst, const void *const *planes,
+ unsigned samples, unsigned channels,
+ vlc_fourcc_t fourcc);
VLC_API void aout_Deinterleave(void *dst, const void *src, unsigned samples,
unsigned channels, vlc_fourcc_t fourcc);
block_t *p_buffer = block_Alloc( p_block->i_buffer );
if( unlikely(p_buffer == NULL) )
goto drop;
- aout_Interleave( p_buffer->p_buffer, p_block->p_buffer,
- p_block->i_nb_samples, ctx->channels,
- p_dec->fmt_out.audio.i_format );
+
+ const void *planes[ctx->channels];
+ for( int i = 0; i < ctx->channels; i++)
+ planes[i] = frame.extended_data[i];
+
+ aout_Interleave( p_buffer->p_buffer, planes, frame.nb_samples,
+ ctx->channels, p_dec->fmt_out.audio.i_format );
if( ctx->channels > AV_NUM_DATA_POINTERS )
free( frame.extended_data );
block_Release( p_block );
/**
* Interleaves audio samples within a block of samples.
* \param dst destination buffer for interleaved samples
- * \param src source buffer with consecutive planes of samples
+ * \param srcv source buffers (one per plane) of uninterleaved samples
* \param samples number of samples (per channel/per plane)
* \param chans channels/planes count
* \param fourcc sample format (must be a linear sample format)
* \note The samples must be naturally aligned in memory.
* \warning Destination and source buffers MUST NOT overlap.
*/
-void aout_Interleave( void *restrict dst, const void *restrict src,
+void aout_Interleave( void *restrict dst, const void *const *srcv,
unsigned samples, unsigned chans, vlc_fourcc_t fourcc )
{
#define INTERLEAVE_TYPE(type) \
do { \
type *d = dst; \
- const type *s = src; \
for( size_t i = 0; i < chans; i++ ) { \
+ const type *s = srcv[i]; \
for( size_t j = 0, k = 0; j < samples; j++, k += chans ) \
d[k] = *(s++); \
d++; \