]> git.sesse.net Git - vlc/blobdiff - src/input/input_netlist.c
A BIG kludge for the calculation of mux_rate, so that times displayed in
[vlc] / src / input / input_netlist.c
index abf3866ea516bf461a907c0bfc98595b5f456cb1..d48e52ec2a01979632b3aff1cbcd706766fd35f6 100644 (file)
@@ -2,7 +2,7 @@
  * input_netlist.c: netlist management
  *****************************************************************************
  * Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: input_netlist.c,v 1.33 2001/04/06 09:15:47 sam Exp $
+ * $Id: input_netlist.c,v 1.40 2001/07/17 09:48:08 massiot Exp $
  *
  * Authors: Henri Fallon <henri@videolan.org>
  *
 #include <stdlib.h>
 #include <string.h>                                    /* memcpy(), memset() */
 #include <sys/types.h>
-#include <sys/uio.h>                                         /* struct iovec */
-#include <unistd.h>
+
+#ifdef HAVE_UNISTD_H
+#   include <unistd.h>
+#endif
+
+#if !defined( WIN32 )
+#   include <sys/uio.h>                                      /* struct iovec */
+#else
+#   include <io.h>
+#   include "input_iovec.h"
+#endif
 
 #include "config.h"
 #include "common.h"
 #include "stream_control.h"
 #include "input_ext-intf.h"
 #include "input_ext-dec.h"
-
-#include "input.h"
-#include "input_netlist.h"
-
-/*****************************************************************************
- * Local prototypes
- *****************************************************************************/
+#include "input_ext-plugins.h"
 
 /*****************************************************************************
  * input_NetlistInit: allocates netlist buffers and init indexes
@@ -76,14 +79,20 @@ int input_NetlistInit( input_thread_t * p_input, int i_nb_data, int i_nb_pes,
      * the netlist_t struct */
     /* As i_loop is unsigned int, and i_ns_data int, this shouldn't be a 
      * problem */
-    for( i_loop=1; i_loop < i_nb_data; i_loop*=2 )
+    for( i_loop = 1; i_loop < i_nb_data; i_loop *= 2 )
+    {
         ;
+    }
+
     intf_DbgMsg( "Netlist : Required %i byte, got %u",i_nb_data,i_loop );
     i_nb_data = i_loop;
 
     /* Same thing for i_nb_pes */
-    for( i_loop=1; i_loop < i_nb_data; i_loop*=2 )
+    for( i_loop = 1; i_loop < i_nb_data; i_loop *= 2 )
+    {
         ;
+    }
+
     intf_DbgMsg( "Netlist : Required %i byte, got %u",i_nb_data,i_loop );
     i_nb_data = i_loop;
     
@@ -244,12 +253,13 @@ void input_NetlistMviovec( void * p_method_data, size_t i_nb_iovec,
 
 
     /* Fills a table of pointers to packets associated with the io_vec's */
-while (i_loop < i_nb_iovec )
+    while (i_loop < i_nb_iovec )
     {
         if( i_current >= p_netlist->i_nb_data ) 
             i_current-=p_netlist->i_nb_data;
         
         pp_packets[i_loop] = p_netlist->pp_free_data[i_current];
+        pp_packets[i_loop]->b_discard_payload = 0;
 
         i_loop ++;
         i_current ++;
@@ -294,7 +304,7 @@ struct data_packet_s * input_NetlistNewPacket( void * p_method_data,
         return ( NULL );
     }
     
-    p_return = (p_netlist->pp_free_data[p_netlist->i_data_start]);
+    p_return = p_netlist->pp_free_data[p_netlist->i_data_start];
     p_netlist->i_data_start++;
     p_netlist->i_data_start &= ( p_netlist->i_nb_data - 1 );
 
@@ -377,7 +387,7 @@ void input_NetlistDeletePacket( void * p_method_data, data_packet_t * p_data )
     p_data->p_next = NULL;
  
     /* unlock */
-    vlc_mutex_unlock (&p_netlist->lock);
+    vlc_mutex_unlock( &p_netlist->lock );
 }
 
 /*****************************************************************************
@@ -422,7 +432,7 @@ void input_NetlistDeletePES( void * p_method_data, pes_packet_t * p_pes )
     p_netlist->pp_free_pes[p_netlist->i_pes_end] = p_pes;
     
     /* unlock */
-    vlc_mutex_unlock (&p_netlist->lock);
+    vlc_mutex_unlock( &p_netlist->lock );
 
 }
 
@@ -440,12 +450,13 @@ void input_NetlistEnd( input_thread_t * p_input)
     vlc_mutex_destroy (&p_netlist->lock);
     
     /* free the FIFO, the buffer, and the netlist structure */
-    free (p_netlist->pp_free_data);
-    free (p_netlist->pp_free_pes);
-    free (p_netlist->p_pes);
-    free (p_netlist->p_data);
-    free (p_netlist->p_buffers);
+    free( p_netlist->pp_free_data );
+    free( p_netlist->pp_free_pes );
+    free( p_netlist->p_pes );
+    free( p_netlist->p_data );
+    free( p_netlist->p_buffers );
 
     /* free the netlist */
-    free (p_netlist);
+    free( p_netlist );
 }
+