summaryrefslogtreecommitdiffstats
path: root/gst/rtsp
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@gmail.com>2006-06-20 12:10:29 +0000
committerWim Taymans <wim.taymans@gmail.com>2006-06-20 12:10:29 +0000
commitb24f97c6950a0760762ff89a25621bce48ab9efe (patch)
tree6c24e3633d3ae2b7ef5b50546fdbce9488a3332a /gst/rtsp
parent490ac45de2ea704b0ab0d7be281dffcd812c8de8 (diff)
gst/rtsp/rtspconnection.c: Use better G_OS_* macros. Fixes #345301 some more.
Original commit message from CVS: * gst/rtsp/rtspconnection.c: (inet_aton), (rtsp_connection_send), (rtsp_connection_close), (rtsp_connection_free): Use better G_OS_* macros. Fixes #345301 some more.
Diffstat (limited to 'gst/rtsp')
-rw-r--r--gst/rtsp/rtspconnection.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/gst/rtsp/rtspconnection.c b/gst/rtsp/rtspconnection.c
index b1fb34f1..2be3ef6e 100644
--- a/gst/rtsp/rtspconnection.c
+++ b/gst/rtsp/rtspconnection.c
@@ -23,18 +23,23 @@
#include <stdlib.h>
#include <string.h>
-#ifdef WIN32
-#include <winsock2.h>
-#else
+/* we include this here to get the G_OS_* defines */
+#include <glib.h>
+
+#ifdef G_OS_UNIX
#include <netdb.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#endif
+#ifdef G_OS_WIN32
+#include <winsock2.h>
+#endif
+
#include "rtspconnection.h"
-#ifdef WIN32
+#ifdef G_OS_WIN32
/* note that inet_aton is deprecated on unix because
* inet_addr returns -1 (INADDR_NONE) for the valid 255.255.255.255
* address. */
@@ -150,7 +155,7 @@ rtsp_connection_send (RTSPConnection * conn, RTSPMessage * message)
if (conn == NULL || message == NULL)
return RTSP_EINVAL;
-#ifdef WIN32
+#ifdef G_OS_WIN32
WSADATA w;
int error = WSAStartup (0x0202, &w);
@@ -215,7 +220,7 @@ rtsp_connection_send (RTSPConnection * conn, RTSPMessage * message)
return RTSP_OK;
-#ifdef WIN32
+#ifdef G_OS_WIN32
startup_error:
{
GST_DEBUG_OBJECT (self, "Error %d on WSAStartup", error);
@@ -580,12 +585,14 @@ rtsp_connection_close (RTSPConnection * conn)
if (conn == NULL)
return RTSP_EINVAL;
-#ifdef WIN32
+
+#ifdef G_OS_WIN32
res = socketclose (conn->fd);
WSACleanup ();
#else
res = close (conn->fd);
#endif
+
conn->fd = -1;
if (res != 0)
goto sys_error;
@@ -604,6 +611,10 @@ rtsp_connection_free (RTSPConnection * conn)
if (conn == NULL)
return RTSP_EINVAL;
+#ifdef G_OS_WIN32
+ WSACleanup ();
+#endif
+
g_free (conn);
return RTSP_OK;