Commit 7dd2f154 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Use the new block_Fifo functions

parent c06a120a
...@@ -298,7 +298,7 @@ static void Thread( access_t *p_access ) ...@@ -298,7 +298,7 @@ static void Thread( access_t *p_access )
/* Write block */ /* Write block */
if( !p_sys->p_write_list && !p_sys->p_read_list && if( !p_sys->p_write_list && !p_sys->p_read_list &&
p_sys->p_fifo->i_size < TIMESHIFT_FIFO_MAX ) block_FifoSize( p_sys->p_fifo ) < TIMESHIFT_FIFO_MAX )
{ {
/* If there isn't too much timeshifted data, /* If there isn't too much timeshifted data,
* write directly to FIFO */ * write directly to FIFO */
...@@ -310,7 +310,7 @@ static void Thread( access_t *p_access ) ...@@ -310,7 +310,7 @@ static void Thread( access_t *p_access )
block_Release( p_block ); block_Release( p_block );
/* Read from file to fill up the fifo */ /* Read from file to fill up the fifo */
while( p_sys->p_fifo->i_size < TIMESHIFT_FIFO_MIN && while( block_FifoSize( p_sys->p_fifo ) < TIMESHIFT_FIFO_MIN &&
!p_access->b_die ) !p_access->b_die )
{ {
p_block = ReadBlockFromFile( p_access ); p_block = ReadBlockFromFile( p_access );
...@@ -323,10 +323,10 @@ static void Thread( access_t *p_access ) ...@@ -323,10 +323,10 @@ static void Thread( access_t *p_access )
msg_Dbg( p_access, "timeshift: no more input data" ); msg_Dbg( p_access, "timeshift: no more input data" );
while( !p_access->b_die && while( !p_access->b_die &&
(p_sys->p_read_list || p_sys->p_fifo->i_size) ) (p_sys->p_read_list || block_FifoSize( p_sys->p_fifo ) ) )
{ {
/* Read from file to fill up the fifo */ /* Read from file to fill up the fifo */
while( p_sys->p_fifo->i_size < TIMESHIFT_FIFO_MIN && while( block_FifoSize( p_sys->p_fifo ) < TIMESHIFT_FIFO_MIN &&
!p_access->b_die && p_sys->p_read_list ) !p_access->b_die && p_sys->p_read_list )
{ {
p_block = ReadBlockFromFile( p_access ); p_block = ReadBlockFromFile( p_access );
......
...@@ -431,13 +431,13 @@ static block_t *NewUDPPacket( sout_access_out_t *p_access, mtime_t i_dts) ...@@ -431,13 +431,13 @@ static block_t *NewUDPPacket( sout_access_out_t *p_access, mtime_t i_dts)
sout_access_out_sys_t *p_sys = p_access->p_sys; sout_access_out_sys_t *p_sys = p_access->p_sys;
block_t *p_buffer; block_t *p_buffer;
while ( p_sys->p_thread->p_empty_blocks->i_depth > MAX_EMPTY_BLOCKS ) while ( block_FifoCount( p_sys->p_thread->p_empty_blocks ) > MAX_EMPTY_BLOCKS )
{ {
p_buffer = block_FifoGet( p_sys->p_thread->p_empty_blocks ); p_buffer = block_FifoGet( p_sys->p_thread->p_empty_blocks );
block_Release( p_buffer ); block_Release( p_buffer );
} }
if( p_sys->p_thread->p_empty_blocks->i_depth == 0 ) if( block_FifoCount( p_sys->p_thread->p_empty_blocks ) == 0 )
{ {
p_buffer = block_New( p_access->p_sout, p_sys->i_mtu ); p_buffer = block_New( p_access->p_sout, p_sys->i_mtu );
} }
......
...@@ -305,9 +305,9 @@ static int MuxGetStream( sout_mux_t *p_mux, int *pi_stream, mtime_t *pi_dts ) ...@@ -305,9 +305,9 @@ static int MuxGetStream( sout_mux_t *p_mux, int *pi_stream, mtime_t *pi_dts )
/* We don't really need to have anything in the SPU fifo */ /* We don't really need to have anything in the SPU fifo */
if( p_mux->pp_inputs[i]->p_fmt->i_cat == SPU_ES && if( p_mux->pp_inputs[i]->p_fmt->i_cat == SPU_ES &&
p_fifo->i_depth == 0 ) continue; block_FifoCount( p_fifo ) == 0 ) continue;
if( p_fifo->i_depth ) if( block_FifoCount( p_fifo ) )
{ {
block_t *p_buf; block_t *p_buf;
......
...@@ -647,7 +647,7 @@ static int MuxGetStream( sout_mux_t *p_mux, int *pi_stream, mtime_t *pi_dts ) ...@@ -647,7 +647,7 @@ static int MuxGetStream( sout_mux_t *p_mux, int *pi_stream, mtime_t *pi_dts )
sout_input_t *p_input = p_mux->pp_inputs[i]; sout_input_t *p_input = p_mux->pp_inputs[i];
block_t *p_data; block_t *p_data;
if( p_input->p_fifo->i_depth <= 0 ) if( block_FifoCount( p_input->p_fifo ) <= 0 )
{ {
if( p_input->p_fmt->i_cat == AUDIO_ES || if( p_input->p_fmt->i_cat == AUDIO_ES ||
p_input->p_fmt->i_cat == VIDEO_ES ) p_input->p_fmt->i_cat == VIDEO_ES )
......
...@@ -424,14 +424,14 @@ static int Mux ( sout_mux_t *p_mux ) ...@@ -424,14 +424,14 @@ static int Mux ( sout_mux_t *p_mux )
p_stream = &p_sys->stream[i_stream]; p_stream = &p_sys->stream[i_stream];
p_fifo = p_mux->pp_inputs[i]->p_fifo; p_fifo = p_mux->pp_inputs[i]->p_fifo;
i_count = p_fifo->i_depth; i_count = block_FifoCount( p_fifo );
while( i_count > 1 ) while( i_count > 1 )
{ {
avi_idx1_entry_t *p_idx; avi_idx1_entry_t *p_idx;
block_t *p_data; block_t *p_data;
p_data = block_FifoGet( p_fifo ); p_data = block_FifoGet( p_fifo );
if( p_fifo->i_depth > 0 ) if( block_FifoCount( p_fifo ) > 0 )
{ {
block_t *p_next = block_FifoShow( p_fifo ); block_t *p_next = block_FifoShow( p_fifo );
p_data->i_length = p_next->i_dts - p_data->i_dts; p_data->i_length = p_next->i_dts - p_data->i_dts;
......
...@@ -155,7 +155,7 @@ static int Mux( sout_mux_t *p_mux ) ...@@ -155,7 +155,7 @@ static int Mux( sout_mux_t *p_mux )
} }
p_fifo = p_mux->pp_inputs[i]->p_fifo; p_fifo = p_mux->pp_inputs[i]->p_fifo;
i_count = p_fifo->i_depth; i_count = block_FifoCount( p_fifo );
while( i_count > 0 ) while( i_count > 0 )
{ {
block_t *p_data = block_FifoGet( p_fifo ); block_t *p_data = block_FifoGet( p_fifo );
......
...@@ -455,7 +455,7 @@ static int MuxGetStream( sout_mux_t *p_mux, int *pi_stream, mtime_t *pi_dts ) ...@@ -455,7 +455,7 @@ static int MuxGetStream( sout_mux_t *p_mux, int *pi_stream, mtime_t *pi_dts )
block_fifo_t *p_fifo = p_mux->pp_inputs[i]->p_fifo; block_fifo_t *p_fifo = p_mux->pp_inputs[i]->p_fifo;
block_t *p_buf; block_t *p_buf;
if( p_fifo->i_depth <= 1 ) if( Block_FifoCount( p_fifo ) <= 1 )
{ {
if( p_mux->pp_inputs[i]->p_fmt->i_cat != SPU_ES ) if( p_mux->pp_inputs[i]->p_fmt->i_cat != SPU_ES )
{ {
...@@ -521,7 +521,7 @@ again: ...@@ -521,7 +521,7 @@ again:
if( p_stream->fmt.i_cat != SPU_ES ) if( p_stream->fmt.i_cat != SPU_ES )
{ {
/* Fix length of the sample */ /* Fix length of the sample */
if( p_input->p_fifo->i_depth > 0 ) if( block_FifoCount( p_input->p_fifo ) > 0 )
{ {
block_t *p_next = block_FifoShow( p_input->p_fifo ); block_t *p_next = block_FifoShow( p_input->p_fifo );
int64_t i_diff = p_next->i_dts - p_data->i_dts; int64_t i_diff = p_next->i_dts - p_data->i_dts;
......
...@@ -814,7 +814,7 @@ static int MuxGetStream( sout_mux_t *p_mux, int *pi_stream, mtime_t *pi_dts ) ...@@ -814,7 +814,7 @@ static int MuxGetStream( sout_mux_t *p_mux, int *pi_stream, mtime_t *pi_dts )
sout_input_t *p_input = p_mux->pp_inputs[i]; sout_input_t *p_input = p_mux->pp_inputs[i];
block_t *p_data; block_t *p_data;
if( p_input->p_fifo->i_depth <= 0 ) if( block_FifoCount( p_input->p_fifo ) <= 0 )
{ {
if( p_input->p_fmt->i_cat == AUDIO_ES || if( p_input->p_fmt->i_cat == AUDIO_ES ||
p_input->p_fmt->i_cat == VIDEO_ES ) p_input->p_fmt->i_cat == VIDEO_ES )
......
...@@ -1342,7 +1342,7 @@ static int Mux( sout_mux_t *p_mux ) ...@@ -1342,7 +1342,7 @@ static int Mux( sout_mux_t *p_mux )
p_pcr_stream->i_pes_dts + p_pcr_stream->i_pes_length ) p_pcr_stream->i_pes_dts + p_pcr_stream->i_pes_length )
{ {
/* Need more data */ /* Need more data */
if( p_input->p_fifo->i_depth <= 1 ) if( block_FifoCount( p_input->p_fifo ) <= 1 )
{ {
if( p_input->p_fmt->i_cat == AUDIO_ES || if( p_input->p_fmt->i_cat == AUDIO_ES ||
p_input->p_fmt->i_cat == VIDEO_ES ) p_input->p_fmt->i_cat == VIDEO_ES )
...@@ -1350,7 +1350,7 @@ static int Mux( sout_mux_t *p_mux ) ...@@ -1350,7 +1350,7 @@ static int Mux( sout_mux_t *p_mux )
/* We need more data */ /* We need more data */
return VLC_SUCCESS; return VLC_SUCCESS;
} }
else if( p_input->p_fifo->i_depth <= 0 ) else if( block_FifoCount( p_input->p_fifo ) <= 0 )
{ {
/* spu, only one packet is needed */ /* spu, only one packet is needed */
continue; continue;
...@@ -1388,7 +1388,7 @@ static int Mux( sout_mux_t *p_mux ) ...@@ -1388,7 +1388,7 @@ static int Mux( sout_mux_t *p_mux )
else else
p_data = FixPES( p_mux, p_input->p_fifo ); p_data = FixPES( p_mux, p_input->p_fifo );
if( p_input->p_fifo->i_depth > 0 && if( block_FifoCount( p_input->p_fifo ) > 0 &&
p_input->p_fmt->i_cat != SPU_ES ) p_input->p_fmt->i_cat != SPU_ES )
{ {
block_t *p_next = block_FifoShow( p_input->p_fifo ); block_t *p_next = block_FifoShow( p_input->p_fifo );
......
...@@ -209,7 +209,7 @@ static int Mux( sout_mux_t *p_mux ) ...@@ -209,7 +209,7 @@ static int Mux( sout_mux_t *p_mux )
if( !p_mux->i_nb_inputs ) return VLC_SUCCESS; if( !p_mux->i_nb_inputs ) return VLC_SUCCESS;
p_fifo = p_mux->pp_inputs[0]->p_fifo; p_fifo = p_mux->pp_inputs[0]->p_fifo;
i_count = p_fifo->i_depth; i_count = block_FifoCount( p_fifo );
while( i_count > 0 ) while( i_count > 0 )
{ {
block_t *p_length = block_New( p_mux, 25 ); block_t *p_length = block_New( p_mux, 25 );
......
...@@ -143,9 +143,9 @@ static int MuxGetStream( sout_mux_t *p_mux, int *pi_stream, mtime_t *pi_dts ) ...@@ -143,9 +143,9 @@ static int MuxGetStream( sout_mux_t *p_mux, int *pi_stream, mtime_t *pi_dts )
/* We don't really need to have anything in the SPU fifo */ /* We don't really need to have anything in the SPU fifo */
if( p_mux->pp_inputs[i]->p_fmt->i_cat == SPU_ES && if( p_mux->pp_inputs[i]->p_fmt->i_cat == SPU_ES &&
p_fifo->i_depth == 0 ) continue; block_FifoCount( p_fifo ) == 0 ) continue;
if( p_fifo->i_depth ) if( block_FifoCount( p_fifo ) )
{ {
block_t *p_buf; block_t *p_buf;
...@@ -493,7 +493,8 @@ static int DelStream( sout_mux_t *p_mux, sout_input_t *p_input ) ...@@ -493,7 +493,8 @@ static int DelStream( sout_mux_t *p_mux, sout_input_t *p_input )
{ {
if( !p_stream->b_new ) if( !p_stream->b_new )
{ {
while( p_input->p_fifo->i_depth ) MuxBlock( p_mux, p_input ); while( block_FifoCount( p_input->p_fifo ) )
MuxBlock( p_mux, p_input );
} }
if( !p_stream->b_new && if( !p_stream->b_new &&
......
...@@ -285,7 +285,7 @@ static int Mux( sout_mux_t *p_mux ) ...@@ -285,7 +285,7 @@ static int Mux( sout_mux_t *p_mux )
p_sys->b_header = VLC_FALSE; p_sys->b_header = VLC_FALSE;
p_input = p_mux->pp_inputs[0]; p_input = p_mux->pp_inputs[0];
while( p_input->p_fifo->i_depth > 0 ) while( block_FifoCount( p_input->p_fifo ) > 0 )
{ {
block_t *p_block = block_FifoGet( p_input->p_fifo ); block_t *p_block = block_FifoGet( p_input->p_fifo );
p_sys->i_data += p_block->i_buffer; p_sys->i_data += p_block->i_buffer;
......
...@@ -252,12 +252,12 @@ void input_DecoderDecode( decoder_t * p_dec, block_t *p_block ) ...@@ -252,12 +252,12 @@ void input_DecoderDecode( decoder_t * p_dec, block_t *p_block )
{ {
/* FIXME !!!!! */ /* FIXME !!!!! */
while( !p_dec->b_die && !p_dec->b_error && while( !p_dec->b_die && !p_dec->b_error &&
p_dec->p_owner->p_fifo->i_depth > 10 ) block_FifoCount( p_dec->p_owner->p_fifo ) > 10 )
{ {
msleep( 1000 ); msleep( 1000 );
} }
} }
else if( p_dec->p_owner->p_fifo->i_size > 50000000 /* 50 MB */ ) else if( block_FifoSize( p_dec->p_owner->p_fifo ) > 50000000 /* 50 MB */ )
{ {
/* FIXME: ideally we would check the time amount of data /* FIXME: ideally we would check the time amount of data
* in the fifo instead of its size. */ * in the fifo instead of its size. */
...@@ -302,7 +302,8 @@ void input_DecoderDiscontinuity( decoder_t * p_dec, vlc_bool_t b_flush ) ...@@ -302,7 +302,8 @@ void input_DecoderDiscontinuity( decoder_t * p_dec, vlc_bool_t b_flush )
vlc_bool_t input_DecoderEmpty( decoder_t * p_dec ) vlc_bool_t input_DecoderEmpty( decoder_t * p_dec )
{ {
if( p_dec->p_owner->b_own_thread && p_dec->p_owner->p_fifo->i_depth > 0 ) if( p_dec->p_owner->b_own_thread
&& block_FifoCount( p_dec->p_owner->p_fifo ) > 0 )
{ {
return VLC_FALSE; return VLC_FALSE;
} }
...@@ -789,9 +790,9 @@ static int DecoderDecode( decoder_t *p_dec, block_t *p_block ) ...@@ -789,9 +790,9 @@ static int DecoderDecode( decoder_t *p_dec, block_t *p_block )
*/ */
static void DeleteDecoder( decoder_t * p_dec ) static void DeleteDecoder( decoder_t * p_dec )
{ {
msg_Dbg( p_dec, "killing decoder fourcc `%4.4s', %d PES in FIFO", msg_Dbg( p_dec, "killing decoder fourcc `%4.4s', %u PES in FIFO",
(char*)&p_dec->fmt_in.i_codec, (char*)&p_dec->fmt_in.i_codec,
p_dec->p_owner->p_fifo->i_depth ); (unsigned)block_FifoCount( p_dec->p_owner->p_fifo ) );
/* Free all packets still in the decoder fifo. */ /* Free all packets still in the decoder fifo. */
block_FifoEmpty( p_dec->p_owner->p_fifo ); block_FifoEmpty( p_dec->p_owner->p_fifo );
......
...@@ -503,7 +503,8 @@ void sout_MuxDeleteStream( sout_mux_t *p_mux, sout_input_t *p_input ) ...@@ -503,7 +503,8 @@ void sout_MuxDeleteStream( sout_mux_t *p_mux, sout_input_t *p_input )
{ {
int i_index; int i_index;
if( p_mux->b_waiting_stream && p_input->p_fifo->i_depth > 0 ) if( p_mux->b_waiting_stream
&& block_FifoCount( p_input->p_fifo ) > 0 )
{ {
/* We stop waiting, and call the muxer for taking care of the data /* We stop waiting, and call the muxer for taking care of the data
* before we remove this es */ * before we remove this es */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment