]> git.sesse.net Git - vlc/commitdiff
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 9693b89d38779dd149f6cac8737dfb6c34ce154d..cd605de7dee411601384080a85c57d1945ceb03b 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 93a53cc38352b83bd0f1d751d8380563e5c15620..e409e0d81d045e87ad5ce093bcb2853af2dd90ca 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 4b3537c65d2ff997ee55d7b3f69c26fa28ca17e9..c986f9b6c291817057a253b96431870062909a7d 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 d0440a3703c563f5c7b68106e9412c90696e208e..fd2e416dcc8b75becaebb4680c8ca06cc84f1cd2 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 39f9787761384115f69c1eca2078de1653f2b83e..5f339e7eb18e663b86dff757a9c6947638dc12ad 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 161a93b80524185eda64f0fbc886999d83353a1a..6921d100b40ef242f6640f782c6444d265c23b35 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 a258adf4cd3bd326968e05ad3972a3c80f3966b4..53054613d5b882e1066bb3df04e1712ae5ef0f50 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 c8958b57bad9bd4bf7264c0d458ea3aea88446b7..eff0bd0f7f2b96d3acde29d9f66d003971aae1bd 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 80e8d47589b12aed23d319a4360b1763c852d552..eb4a642be8c469bf95451daade7b06675bfbab32 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 3606234c1b4ad04ae6de64ea0ad65acf47cd872b..c4e18ecb45dc53d97f19b289c00da8ba1ea6f56f 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 8411fcebfd8416bab8ea6ab5ff0d25f85da5173e..da08c720044f5ad554247dcb0f4c28dc044f5334 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 e0a8edefd7a6ccc967252d3f0a208b31c0c0899a..19383f96169b24907aef8c98d4392bf425624779 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 af31e71c74dbbd270b3c0639bda5ea773b4d5c2d..2d20944bfaaafc1dada3f6afaa609278e6fe6860 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 d200fc0e95efef118c3919f52450b326c48db9ca..9406c7516036175dab290d5b0a351bb872cabac3 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 */