#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_demux.h>
-#include <vlc_aout.h>
-
-#include <vlc_codecs.h>
/*****************************************************************************
* Module descriptor
return VLC_EGENERIC;
}
+ if( new_fmt.audio.i_channels == 0 )
+ {
+ msg_Err( p_demux, "0 channels detected" );
+ return VLC_EGENERIC;
+ }
+
new_fmt.audio.i_bytes_per_frame = new_fmt.audio.i_channels
* (new_fmt.audio.i_bitspersample / 8);
new_fmt.audio.i_frame_length = 1;
{
demux_sys_t *p_sys = p_demux->p_sys;
block_t *p_block;
- int64_t i_offset, i;
-
- i_offset = stream_Tell( p_demux->s );
-
- while( ( i_offset >= p_sys->i_block_end )
- && ( p_sys->i_silence_countdown == 0 ) )
- if( ReadBlockHeader( p_demux ) != VLC_SUCCESS )
- return 0;
+ int64_t i;
if( p_sys->i_silence_countdown == 0 )
{
+ int64_t i_offset = stream_Tell( p_demux->s );
+ if( i_offset >= p_sys->i_block_end )
+ {
+ if( ReadBlockHeader( p_demux ) != VLC_SUCCESS )
+ return 0;
+ return 1;
+ }
+
i = ( p_sys->i_block_end - i_offset )
/ p_sys->fmt.audio.i_bytes_per_frame;
if( i > SAMPLES_BUFFER )
p_sys->i_silence_countdown -= i;
}
- p_block->i_dts = p_block->i_pts =
- date_Increment( &p_sys->pts, p_sys->fmt.audio.i_frame_length * i );
+ p_block->i_dts = p_block->i_pts = VLC_TS_0 + date_Get( &p_sys->pts );
es_out_Control( p_demux->out, ES_OUT_SET_PCR, p_block->i_pts );
es_out_Send( p_demux->out, p_sys->p_es, p_block );
+ date_Increment( &p_sys->pts, p_sys->fmt.audio.i_frame_length * i );
+
return 1;
}