From 9b8c8371651336fb245c5d32edd5514cc018f1c8 Mon Sep 17 00:00:00 2001 From: Damien Lespiau Date: Tue, 7 Aug 2007 15:13:46 +0000 Subject: [PATCH] Fix compilation on windows. Fixes #464320. Original commit message from CVS: Patch by: Damien Lespiau * configure.ac: * gst-libs/gst/rtsp/Makefile.am: * gst-libs/gst/rtsp/gstrtspconnection.c: (gst_rtsp_connection_connect): Fix compilation on windows. Fixes #464320. --- ChangeLog | 10 ++++++++++ configure.ac | 7 +++++++ gst-libs/gst/rtsp/Makefile.am | 2 +- gst-libs/gst/rtsp/gstrtspconnection.c | 13 ++++++++++--- 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 91b8fe7f5c..aa4b61b823 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2007-08-07 Wim Taymans + + Patch by: Damien Lespiau + + * configure.ac: + * gst-libs/gst/rtsp/Makefile.am: + * gst-libs/gst/rtsp/gstrtspconnection.c: + (gst_rtsp_connection_connect): + Fix compilation on windows. Fixes #464320. + 2007-08-07 Wim Taymans Patch by: Josep Torre Valles diff --git a/configure.ac b/configure.ac index 7689bcc75c..6a985a1fc3 100644 --- a/configure.ac +++ b/configure.ac @@ -205,6 +205,13 @@ AC_CHECK_HEADERS([sys/socket.h], HAVE_SYS_SOCKET_H="yes", HAVE_SYS_SOCKET_H="no") AM_CONDITIONAL(HAVE_SYS_SOCKET_H, test "x$HAVE_SYS_SOCKET_H" = "xyes") +dnl used in gst-libs/gst/rtsp +AC_CHECK_HEADERS([winsock2.h], HAVE_WINSOCK2_H=yes) +if test "x$HAVE_WINSOCK2_H" = "xyes"; then + WIN32_LIBS="-lws2_32" + AC_SUBST(WIN32_LIBS) +fi + dnl used in gst-libs/gst/pbutils and associated unit test AC_CHECK_HEADERS([process.h sys/types.h sys/wait.h sys/stat.h]) diff --git a/gst-libs/gst/rtsp/Makefile.am b/gst-libs/gst/rtsp/Makefile.am index 69e3b41c04..9da02268a6 100644 --- a/gst-libs/gst/rtsp/Makefile.am +++ b/gst-libs/gst/rtsp/Makefile.am @@ -35,7 +35,7 @@ noinst_HEADERS = gstrtsp.h #rtspextreal.c libgstrtsp_@GST_MAJORMINOR@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) -libgstrtsp_@GST_MAJORMINOR@_la_LIBADD = $(GST_LIBS) +libgstrtsp_@GST_MAJORMINOR@_la_LIBADD = $(GST_LIBS) $(WIN32_LIBS) libgstrtsp_@GST_MAJORMINOR@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS) BUILT_SOURCES = $(built_headers) $(built_sources) diff --git a/gst-libs/gst/rtsp/gstrtspconnection.c b/gst-libs/gst/rtsp/gstrtspconnection.c index 89a07a6972..522e1a020f 100644 --- a/gst-libs/gst/rtsp/gstrtspconnection.c +++ b/gst-libs/gst/rtsp/gstrtspconnection.c @@ -212,9 +212,7 @@ gst_rtsp_connection_connect (GstRTSPConnection * conn, GTimeVal * timeout) gint fd; struct sockaddr_in sa_in; struct hostent *hostinfo; - char **addrs; const gchar *ip; - gchar ipbuf[INET_ADDRSTRLEN]; struct in_addr addr; gint ret; guint16 port; @@ -226,6 +224,10 @@ gst_rtsp_connection_connect (GstRTSPConnection * conn, GTimeVal * timeout) #ifdef G_OS_WIN32 unsigned long flags; + struct in_addr *addrp; +#else + char **addrs; + gchar ipbuf[INET_ADDRSTRLEN]; #endif /* G_OS_WIN32 */ g_return_val_if_fail (conn != NULL, GST_RTSP_EINVAL); @@ -244,10 +246,15 @@ gst_rtsp_connection_connect (GstRTSPConnection * conn, GTimeVal * timeout) if (hostinfo->h_addrtype != AF_INET) goto not_ip; /* host not an IP host */ - +#ifdef G_OS_WIN32 + addrp = (struct in_addr *) hostinfo->h_addr_list[0]; + /* this is not threadsafe */ + ip = inet_ntoa (*addrp); +#else addrs = hostinfo->h_addr_list; ip = inet_ntop (AF_INET, (struct in_addr *) addrs[0], ipbuf, sizeof (ipbuf)); +#endif /* G_OS_WIN32 */ } /* get the port from the url */