From 2ff0f33b6345f193ef9dbd6547b268c0bc12552a Mon Sep 17 00:00:00 2001 From: Tim Champagne Date: Tue, 20 May 2003 16:23:44 +0000 Subject: This adds http and network input for Win32. I have no idea how to test this under win32 though? CVS patchset: 4889 CVS date: 2003/05/20 16:23:44 --- src/input/input_cdda.c | 20 ++++++++++++-------- src/input/input_http.c | 13 +++++++++++-- src/input/input_net.c | 18 ++++++++++++++++-- 3 files changed, 39 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/input/input_cdda.c b/src/input/input_cdda.c index 113d8d130..0948ed035 100644 --- a/src/input/input_cdda.c +++ b/src/input/input_cdda.c @@ -20,7 +20,7 @@ * Compact Disc Digital Audio (CDDA) Input Plugin * by Mike Melanson (melanson@pcisys.net) * - * $Id: input_cdda.c,v 1.24 2003/05/20 02:06:13 tmmm Exp $ + * $Id: input_cdda.c,v 1.25 2003/05/20 16:23:44 tchamp Exp $ */ #ifdef HAVE_CONFIG_H @@ -684,7 +684,6 @@ static int read_cdrom_toc(cdda_input_plugin_t *this_gen, cdrom_toc *toc) { else { DWORD dwBytesReturned; - DWORD dw; CDROM_TOC cdrom_toc; int i; @@ -694,10 +693,10 @@ static int read_cdrom_toc(cdda_input_plugin_t *this_gen, cdrom_toc *toc) { &dwBytesReturned, NULL ) == 0 ) { #ifdef LOG - printf( "xineplug_inp_cdda : could not read TOCHDR\n" ); - dw = GetLastError(); - printf("GetLastError returned %u\n", dw); - + DWORD dw; + printf( "xineplug_inp_cdda : could not read TOCHDR\n" ); + dw = GetLastError(); + printf("GetLastError returned %u\n", dw); #endif return -1; } @@ -749,7 +748,6 @@ static int read_cdrom_toc(cdda_input_plugin_t *this_gen, cdrom_toc *toc) { static int read_cdrom_frames(cdda_input_plugin_t *this_gen, int frame, int num_frames, unsigned char *data) { - DWORD dw; DWORD dwBytesReturned; RAW_READ_INFO raw_read_info; @@ -783,6 +781,7 @@ static int read_cdrom_frames(cdda_input_plugin_t *this_gen, int frame, int num_f &dwBytesReturned, NULL ) == 0 ) { #ifdef LOG + DWORD dw; printf( "xineplug_inp_cdda : could not read frame\n" ); dw = GetLastError(); printf("GetLastError returned %u\n", dw); @@ -838,7 +837,12 @@ static int host_connect_attempt (struct in_addr ia, int port) sin.sin_addr = ia; sin.sin_port = htons(port); - if (connect(s, (struct sockaddr *)&sin, sizeof(sin))==-1 && errno != EINPROGRESS) { +#ifndef WIN32 + if (connect(s, (struct sockaddr *)&sin, sizeof(sin))==-1 && errno != EINPROGRESS) +#else + if (connect(s, (struct sockaddr *)&sin, sizeof(sin))==-1 && WSAGetLastError != WSAEINPROGRESS) +#endif /* WIN32 */ + { printf("input_cdda: cannot connect to host\n"); close(s); return -1; diff --git a/src/input/input_http.c b/src/input/input_http.c index 09b058a43..d05ae687d 100644 --- a/src/input/input_http.c +++ b/src/input/input_http.c @@ -31,9 +31,13 @@ #include #include #include + +#ifndef WIN32 #include #include #include +#endif /* WIN32 */ + #include #include "xine_internal.h" @@ -123,8 +127,13 @@ static int http_plugin_host_connect_attempt (struct in_addr ia, int port, sin.sin_family = AF_INET; sin.sin_addr = ia; sin.sin_port = htons(port); - - if (connect(s, (struct sockaddr *)&sin, sizeof(sin))==-1 && errno != EINPROGRESS) { + +#ifndef WIN32 + if (connect(s, (struct sockaddr *)&sin, sizeof(sin))==-1 && errno != EINPROGRESS) +#else + if (connect(s, (struct sockaddr *)&sin, sizeof(sin))==-1 && WSAGetLastError != WSAEINPROGRESS) +#endif /* WIN32 */ + { xine_message(this->stream, XINE_MSG_CONNECTION_REFUSED, "cannot connect to host", NULL); xine_log (this->stream->xine, XINE_LOG_MSG, _("input_http: cannot connect to host\n")); close(s); diff --git a/src/input/input_net.c b/src/input/input_net.c index 48bba37e6..1e180d94c 100644 --- a/src/input/input_net.c +++ b/src/input/input_net.c @@ -20,7 +20,7 @@ * Read from a tcp network stream over a lan (put a tweaked mp1e encoder the * other end and you can watch tv anywhere in the house ..) * - * $Id: input_net.c,v 1.47 2003/05/15 20:23:17 miguelfreitas Exp $ + * $Id: input_net.c,v 1.48 2003/05/20 16:23:44 tchamp Exp $ * * how to set up mp1e for use with this plugin: * @@ -48,8 +48,12 @@ #include #include #include + +#ifndef WIN32 #include #include +#endif + #include #include @@ -63,6 +67,11 @@ xine_log(xine, XINE_LOG_MSG, message, ##args); \ printf(message, ##args); \ } +#elif defined (WIN32) +#define LOG_MSG(xine, message, args) { \ + xine_log(xine, XINE_LOG_MSG, message, #args); \ + printf(message, #args); \ + } #else #define LOG_MSG(xine, ...) { \ xine_log(xine, XINE_LOG_MSG, __VA_ARGS__); \ @@ -127,7 +136,12 @@ static int host_connect_attempt(struct in_addr ia, int port, xine_t *xine) { sin.sin_addr = ia; sin.sin_port = htons(port); - if (connect(s, (struct sockaddr *)&sin, sizeof(sin))==-1 && errno != EINPROGRESS) { +#ifndef WIN32 + if (connect(s, (struct sockaddr *)&sin, sizeof(sin))==-1 && errno != EINPROGRESS) +#else + if (connect(s, (struct sockaddr *)&sin, sizeof(sin))==-1 && WSAGetLastError != WSAEINPROGRESS) +#endif + { LOG_MSG (xine, _("input_net: connect(): %s\n"), strerror(errno)); close(s); return -1; -- cgit v1.2.3