* input_netlist.c: netlist management
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: input_netlist.c,v 1.35 2001/04/28 23:19:19 henri 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>
-#ifndef WIN32
-#include <sys/uio.h> /* struct iovec */
+
+#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 <unistd.h>
#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"
-
-#ifdef WIN32
-struct iovec
- {
- void *iov_base; /* Pointer to data. */
- size_t iov_len; /* Length of data. */
- };
-#endif
-/*****************************************************************************
- * Local prototypes
- *****************************************************************************/
+#include "input_ext-plugins.h"
/*****************************************************************************
* input_NetlistInit: allocates netlist buffers and init indexes
* 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;
/* 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;
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 );
p_data->p_next = NULL;
/* unlock */
- vlc_mutex_unlock (&p_netlist->lock);
+ vlc_mutex_unlock( &p_netlist->lock );
}
/*****************************************************************************
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 );
}
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 );
}
+