Fix compilation on windows. Fixes #464320.

Original commit message from CVS:
Patch by: Damien Lespiau <damien dot lespiau at gmail dot com>
* configure.ac:
* gst-libs/gst/rtsp/Makefile.am:
* gst-libs/gst/rtsp/gstrtspconnection.c:
(gst_rtsp_connection_connect):
Fix compilation on windows. Fixes #464320.
This commit is contained in:
Damien Lespiau 2007-08-07 15:13:46 +00:00 committed by Wim Taymans
parent 5e5aa7b402
commit 9b8c837165
4 changed files with 28 additions and 4 deletions

View file

@ -1,3 +1,13 @@
2007-08-07 Wim Taymans <wim.taymans@gmail.com>
Patch by: Damien Lespiau <damien dot lespiau at gmail dot com>
* 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 <wim.taymans@gmail.com>
Patch by: Josep Torre Valles <josep@fluendo.com>

View file

@ -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])

View file

@ -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)

View file

@ -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 */