summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTim Champagne <tchamp@users.sourceforge.net>2003-05-20 16:23:44 +0000
committerTim Champagne <tchamp@users.sourceforge.net>2003-05-20 16:23:44 +0000
commit2ff0f33b6345f193ef9dbd6547b268c0bc12552a (patch)
tree7cc5933246205fe58d25ffad0c0d4c41a0dce57a /src
parentcee76d5b9b53b098178ce66789e0d491406afad2 (diff)
downloadxine-lib-2ff0f33b6345f193ef9dbd6547b268c0bc12552a.tar.gz
xine-lib-2ff0f33b6345f193ef9dbd6547b268c0bc12552a.tar.bz2
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
Diffstat (limited to 'src')
-rw-r--r--src/input/input_cdda.c20
-rw-r--r--src/input/input_http.c13
-rw-r--r--src/input/input_net.c18
3 files changed, 39 insertions, 12 deletions
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 <string.h>
#include <sys/socket.h>
#include <netinet/in.h>
+
+#ifndef WIN32
#include <arpa/inet.h>
#include <netdb.h>
#include <errno.h>
+#endif /* WIN32 */
+
#include <sys/time.h>
#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 <string.h>
#include <sys/socket.h>
#include <netinet/in.h>
+
+#ifndef WIN32
#include <arpa/inet.h>
#include <netdb.h>
+#endif
+
#include <errno.h>
#include <sys/time.h>
@@ -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;