Commit 7f62d904 authored by Xavier Marchesini's avatar Xavier Marchesini

Modified in order to add network input under Win32.

It compiles under Linux and Win32 (yeeaaahaaa, haven't broken anything
:-))
(added the WinSock library initialization and cleanup)
Could someone test if it does really function ?
parent 1da48cfc
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* decoders. * decoders.
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: input.c,v 1.109 2001/05/25 13:20:10 sam Exp $ * $Id: input.c,v 1.110 2001/05/28 03:17:01 xav Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -39,6 +39,13 @@ ...@@ -39,6 +39,13 @@
#endif #endif
#include <errno.h> #include <errno.h>
/* WinSock Includes */
#ifdef WIN32
#include <winsock2.h>
#endif
/* Network functions */ /* Network functions */
#if !defined( SYS_BEOS ) && !defined( SYS_NTO ) && !defined( WIN32 ) #if !defined( SYS_BEOS ) && !defined( SYS_NTO ) && !defined( WIN32 )
...@@ -551,7 +558,7 @@ void input_FileClose( input_thread_t * p_input ) ...@@ -551,7 +558,7 @@ void input_FileClose( input_thread_t * p_input )
} }
#if !defined( SYS_BEOS ) && !defined( SYS_NTO ) && !defined( WIN32 ) #if !defined( SYS_BEOS ) && !defined( SYS_NTO )
/***************************************************************************** /*****************************************************************************
* input_NetworkOpen : open a network socket * input_NetworkOpen : open a network socket
*****************************************************************************/ *****************************************************************************/
...@@ -563,6 +570,19 @@ void input_NetworkOpen( input_thread_t * p_input ) ...@@ -563,6 +570,19 @@ void input_NetworkOpen( input_thread_t * p_input )
int i_opt; int i_opt;
struct sockaddr_in sock; struct sockaddr_in sock;
/* WinSock Library Init. */
#ifdef WIN32
WSADATA Data;
int Result = WSAStartup( MAKEWORD( 1,1 ),&Data );
if( Result != 0 )
{
intf_ErrMsg( "Can't initiate WinSocks : error %i", Result) ;
return ;
}
#endif
/* Get the remote server */ /* Get the remote server */
if( p_input->p_source != NULL ) if( p_input->p_source != NULL )
{ {
...@@ -740,5 +760,10 @@ void input_NetworkOpen( input_thread_t * p_input ) ...@@ -740,5 +760,10 @@ void input_NetworkOpen( input_thread_t * p_input )
void input_NetworkClose( input_thread_t * p_input ) void input_NetworkClose( input_thread_t * p_input )
{ {
close( p_input->i_handle ); close( p_input->i_handle );
#ifdef WIN32
WSACleanup();
#endif
} }
#endif #endif
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