# include "config.h"
#endif
+#include <assert.h>
+
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_codec.h>
#include <vlc_aout.h>
+#include <vlc_memory.h>
#ifdef HAVE_FLAC_STREAM_DECODER_H
# include <FLAC/stream_decoder.h>
if( p_dec->fmt_out.i_codec == VLC_CODEC_FLAC )
{
p_dec->fmt_out.i_extra = p_dec->fmt_in.i_extra;
- p_dec->fmt_out.p_extra =
- realloc( p_dec->fmt_out.p_extra, p_dec->fmt_out.i_extra );
+ p_dec->fmt_out.p_extra = realloc_or_free( p_dec->fmt_out.p_extra,
+ p_dec->fmt_out.i_extra );
+ assert( p_dec->fmt_out.p_extra );
memcpy( p_dec->fmt_out.p_extra,
p_dec->fmt_in.p_extra, p_dec->fmt_out.i_extra );
}
/* Date management (already done by packetizer) */
p_sys->p_aout_buffer->i_pts = p_sys->p_block->i_pts;
- p_sys->p_aout_buffer->end_date =
- p_sys->p_block->i_pts + p_sys->p_block->i_length;
+ p_sys->p_aout_buffer->i_length = p_sys->p_block->i_length;
return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
}
p_sys->i_samples_delay += p_aout_buf->i_nb_samples;
/* Convert samples to FLAC__int32 */
- if( p_sys->i_buffer < p_aout_buf->i_nb_bytes * 2 )
+ if( p_sys->i_buffer < p_aout_buf->i_buffer * 2 )
{
p_sys->p_buffer =
- realloc( p_sys->p_buffer, p_aout_buf->i_nb_bytes * 2 );
- p_sys->i_buffer = p_aout_buf->i_nb_bytes * 2;
+ realloc_or_free( p_sys->p_buffer, p_aout_buf->i_buffer * 2 );
+ assert( p_sys->p_buffer );
+ p_sys->i_buffer = p_aout_buf->i_buffer * 2;
}
- for( i = 0 ; i < p_aout_buf->i_nb_bytes / 2 ; i++ )
+ for( i = 0 ; i < p_aout_buf->i_buffer / 2 ; i++ )
{
p_sys->p_buffer[i]= ((int16_t *)p_aout_buf->p_buffer)[i];
}
/* Backup the STREAMINFO metadata block */
p_enc->fmt_out.i_extra = STREAMINFO_SIZE + 4;
p_enc->fmt_out.p_extra = malloc( STREAMINFO_SIZE + 4 );
+ assert( p_enc->fmt_out.p_extra );
memcpy( p_enc->fmt_out.p_extra, "fLaC", 4 );
memcpy( ((uint8_t *)p_enc->fmt_out.p_extra) + 4, buffer,
STREAMINFO_SIZE );