summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Champagne <tchamp@users.sourceforge.net>2003-05-20 20:40:29 +0000
committerTim Champagne <tchamp@users.sourceforge.net>2003-05-20 20:40:29 +0000
commit53e2ccb96ebf6b2b0cbe3eb53ca30bed2994b60c (patch)
treedc841b8ae42a333d23e4602318d1471525969bd5
parent19bf4a9a9080c61b9d745235f8c371392b76ae9d (diff)
downloadxine-lib-53e2ccb96ebf6b2b0cbe3eb53ca30bed2994b60c.tar.gz
xine-lib-53e2ccb96ebf6b2b0cbe3eb53ca30bed2994b60c.tar.bz2
This fixes http support for Win32
CVS patchset: 4891 CVS date: 2003/05/20 20:40:29
-rw-r--r--src/input/input_cdda.c4
-rw-r--r--src/input/input_http.c26
-rw-r--r--src/xine-engine/demux.c9
-rw-r--r--win32/libxine.def2
4 files changed, 33 insertions, 8 deletions
diff --git a/src/input/input_cdda.c b/src/input/input_cdda.c
index 0948ed035..c7a93a1bb 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.25 2003/05/20 16:23:44 tchamp Exp $
+ * $Id: input_cdda.c,v 1.26 2003/05/20 20:40:29 tchamp Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -840,7 +840,7 @@ static int host_connect_attempt (struct in_addr ia, int port)
#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)
+ if (connect(s, (struct sockaddr *)&sin, sizeof(sin))==-1 && WSAGetLastError() != WSAEINPROGRESS)
#endif /* WIN32 */
{
printf("input_cdda: cannot connect to host\n");
diff --git a/src/input/input_http.c b/src/input/input_http.c
index d05ae687d..357630c68 100644
--- a/src/input/input_http.c
+++ b/src/input/input_http.c
@@ -115,7 +115,7 @@ static int http_plugin_host_connect_attempt (struct in_addr ia, int port,
int s;
struct sockaddr_in sin;
-
+
s=socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
if (s==-1) {
@@ -131,7 +131,7 @@ static int http_plugin_host_connect_attempt (struct in_addr ia, int port,
#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)
+ 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);
@@ -666,6 +666,7 @@ static int http_plugin_open (input_plugin_t *this_gen ) {
char *proxy;
int done,len,linenum;
int shoutcast = 0, httpcode;
+ int length;
this->shoutcast_pos = 0;
this->proxybuf[0] = '\0';
@@ -764,8 +765,14 @@ static int http_plugin_open (input_plugin_t *this_gen ) {
strcat (this->buf, "Icy-MetaData: 1\015\012");
strcat (this->buf, "\015\012");
-
- if (write (this->fh, this->buf, strlen(this->buf)) != strlen(this->buf)) {
+
+ length = strlen(this->buf);
+#ifndef WIN32
+ if (write (this->fh, this->buf, length) != length) {
+#else
+ if (send(this->fh, this->buf, length, 0) != length) {
+ printf("input_http: WSAGetLastError() = %d\n", WSAGetLastError());
+#endif
xine_message(this->stream, XINE_MSG_CONNECTION_REFUSED, "couldn't send request", NULL);
printf ("input_http: couldn't send request\n");
return 0;
@@ -786,8 +793,8 @@ static int http_plugin_open (input_plugin_t *this_gen ) {
printf ("input_http: read...\n");
*/
+#ifndef WIN32
if (read (this->fh, &this->buf[len], 1) <=0) {
-
switch (errno) {
case EAGAIN:
xine_log (this->stream->xine, XINE_LOG_MSG, _("input_http: EAGAIN\n"));
@@ -797,7 +804,14 @@ static int http_plugin_open (input_plugin_t *this_gen ) {
xine_log (this->stream->xine, XINE_LOG_MSG, _("input_http: read error\n"));
return 0;
}
- }
+ }
+#else
+ if ((length=recv (this->fh, &this->buf[len], 1, 0)) <= 0) {
+ xine_message(this->stream, XINE_MSG_READ_ERROR, NULL);
+ xine_log (this->stream->xine, XINE_LOG_MSG, _("input_http: read error\n"));
+ return 0;
+ }
+#endif
if (this->buf[len] == '\012') {
diff --git a/src/xine-engine/demux.c b/src/xine-engine/demux.c
index 4ebe78f8e..2707165a3 100644
--- a/src/xine-engine/demux.c
+++ b/src/xine-engine/demux.c
@@ -425,6 +425,7 @@ off_t xine_read_abort (xine_stream_t *stream, int fd, char *buf, off_t todo) {
}
}
+#ifndef WIN32
ret = read (fd, &buf[total], todo - total);
/* check EOF */
@@ -439,6 +440,14 @@ off_t xine_read_abort (xine_stream_t *stream, int fd, char *buf, off_t todo) {
perror("xine_read_abort");
return ret;
}
+#else
+ ret = recv (fd, &buf[total], todo - total, 0);
+ if (ret <= 0)
+ {
+ perror("xine_read_abort");
+ return ret;
+ }
+#endif
total += ret;
}
diff --git a/win32/libxine.def b/win32/libxine.def
index fc8b0d036..8c8f0d078 100644
--- a/win32/libxine.def
+++ b/win32/libxine.def
@@ -32,6 +32,8 @@ xine_list_audio_output_plugins
xine_get_current_frame
xine_get_osd_renderer
+xine_get_meta_info
+
xine_open_video_driver
xine_open_audio_driver