Use the new block_Fifo functions
authorRémi Denis-Courmont <rem@videolan.org>
Fri, 14 Sep 2007 16:36:10 +0000 (16:36 +0000)
committerRémi Denis-Courmont <rem@videolan.org>
Fri, 14 Sep 2007 16:36:10 +0000 (16:36 +0000)
14 files changed:
modules/access_filter/timeshift.c
modules/access_output/udp.c
modules/codec/ffmpeg/mux.c
modules/mux/asf.c
modules/mux/avi.c
modules/mux/dummy.c
modules/mux/mp4.c
modules/mux/mpeg/ps.c
modules/mux/mpeg/ts.c
modules/mux/mpjpeg.c
modules/mux/ogg.c
modules/mux/wav.c
src/input/decoder.c
src/stream_output/stream_output.c

index 9693b89..cd605de 100644 (file)
@@ -298,7 +298,7 @@ static void Thread( access_t *p_access )
 
         /* Write block */
         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,
              * write directly to FIFO */
@@ -310,7 +310,7 @@ static void Thread( access_t *p_access )
         block_Release( p_block );
 
         /* 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_block = ReadBlockFromFile( p_access );
@@ -323,10 +323,10 @@ static void Thread( access_t *p_access )
     msg_Dbg( p_access, "timeshift: no more input data" );
 
     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 */
-        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_block = ReadBlockFromFile( p_access );
index 93a53cc..e409e0d 100644 (file)
@@ -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;
     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 );
         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 );
     }
index 4b3537c..c986f9b 100644 (file)
@@ -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 */
         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;
 
index d0440a3..fd2e416 100644 (file)
@@ -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];
         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 ||
                 p_input->p_fmt->i_cat == VIDEO_ES )
index 39f9787..5f339e7 100644 (file)
@@ -424,14 +424,14 @@ static int Mux      ( sout_mux_t *p_mux )
         p_stream = &p_sys->stream[i_stream];
 
         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 )
         {
             avi_idx1_entry_t *p_idx;
             block_t *p_data;
 
             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 );
                 p_data->i_length = p_next->i_dts - p_data->i_dts;
index 161a93b..6921d10 100644 (file)
@@ -155,7 +155,7 @@ static int Mux( sout_mux_t *p_mux )
         }
 
         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 )
         {
             block_t *p_data = block_FifoGet( p_fifo );
index a258adf..5305461 100644 (file)
@@ -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_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 )
             {
@@ -521,7 +521,7 @@ again:
         if( p_stream->fmt.i_cat != SPU_ES )
         {
             /* 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 );
                 int64_t       i_diff  = p_next->i_dts - p_data->i_dts;
index c8958b5..eff0bd0 100644 (file)
@@ -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];
         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 ||
                 p_input->p_fmt->i_cat == VIDEO_ES )
index 80e8d47..eb4a642 100644 (file)
@@ -1342,7 +1342,7 @@ static int Mux( sout_mux_t *p_mux )
                     p_pcr_stream->i_pes_dts + p_pcr_stream->i_pes_length )
                 {
                     /* 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 ||
                             p_input->p_fmt->i_cat == VIDEO_ES )
@@ -1350,7 +1350,7 @@ static int Mux( sout_mux_t *p_mux )
                             /* We need more data */
                             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 */
                             continue;
@@ -1388,7 +1388,7 @@ static int Mux( sout_mux_t *p_mux )
                     else
                         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 )
                     {
                         block_t *p_next = block_FifoShow( p_input->p_fifo );
index 3606234..c4e18ec 100644 (file)
@@ -209,7 +209,7 @@ static int Mux( sout_mux_t *p_mux )
     if( !p_mux->i_nb_inputs ) return VLC_SUCCESS;
 
     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 )
     {
         block_t *p_length = block_New( p_mux, 25 );
index 8411fce..da08c72 100644 (file)
@@ -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 */
         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;
 
@@ -493,7 +493,8 @@ static int DelStream( sout_mux_t *p_mux, sout_input_t *p_input )
     {
         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 &&
index e0a8ede..19383f9 100644 (file)
@@ -285,7 +285,7 @@ static int Mux( sout_mux_t *p_mux )
     p_sys->b_header = VLC_FALSE;
 
     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 );
         p_sys->i_data += p_block->i_buffer;
index af31e71..2d20944 100644 (file)
@@ -252,12 +252,12 @@ void input_DecoderDecode( decoder_t * p_dec, block_t *p_block )
         {
             /* FIXME !!!!! */
             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 );
             }
         }
-        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
              * in the fifo instead of its size. */
@@ -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 )
 {
-    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;
     }
@@ -789,9 +790,9 @@ static int DecoderDecode( decoder_t *p_dec, block_t *p_block )
  */
 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,
-             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. */
     block_FifoEmpty( p_dec->p_owner->p_fifo );
index d200fc0..9406c75 100644 (file)
@@ -503,7 +503,8 @@ void sout_MuxDeleteStream( sout_mux_t *p_mux, sout_input_t *p_input )
 {
     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
          * before we remove this es */