From f08deb4345e4509f8e25cb9c3f10713246db6e36 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 10 Jul 2006 16:41:57 +0000 Subject: gst/rtsp/: replaced closesocket and close in code with one CLOSE_SOCKET. Original commit message from CVS: * gst/rtsp/Makefile.am: * gst/rtsp/rtspconnection.c: (rtsp_connection_send), (rtsp_connection_close): * gst/rtsp/rtspdefs.h: replaced closesocket and close in code with one CLOSE_SOCKET. Some more cleanups. Fixes #345301. --- gst/rtsp/Makefile.am | 10 +++++----- gst/rtsp/rtspconnection.c | 25 +++++++++++++++---------- gst/rtsp/rtspdefs.h | 17 ++++++++++------- 3 files changed, 30 insertions(+), 22 deletions(-) (limited to 'gst') diff --git a/gst/rtsp/Makefile.am b/gst/rtsp/Makefile.am index 85c2dad4..86e0a2a2 100644 --- a/gst/rtsp/Makefile.am +++ b/gst/rtsp/Makefile.am @@ -2,21 +2,21 @@ plugin_LTLIBRARIES = libgstrtsp.la libgstrtsp_la_SOURCES = gstrtsp.c gstrtspsrc.c \ gstrtpdec.c \ - rtspconnection.c \ - rtspdefs.c \ - rtspmessage.c \ + rtspconnection.c \ + rtspdefs.c \ + rtspmessage.c \ rtsptransport.c \ rtspurl.c \ sdpmessage.c libgstrtsp_la_CFLAGS = $(GST_CFLAGS) -libgstrtsp_la_LIBADD = $(GST_LIBS) +libgstrtsp_la_LIBADD = $(GST_LIBS) $(WIN32_LIBS) libgstrtsp_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) check_PROGRAMS = test test_SOURCES = test.c rtspdefs.c rtspurl.c rtspconnection.c rtspmessage.c rtsptransport.c sdpmessage.c test_CFLAGS = $(GST_CFLAGS) -test_LDFLAGS = $(GST_LIBS) +test_LDFLAGS = $(GST_LIBS) $(WIN32_LIBS) noinst_HEADERS = gstrtspsrc.h gstrtsp.h gstrtpdec.h rtsptransport.h rtsp.h rtspurl.h rtspconnection.h rtspdefs.h rtspmessage.h sdp.h sdpmessage.h diff --git a/gst/rtsp/rtspconnection.c b/gst/rtsp/rtspconnection.c index 2be3ef6e..65332cd5 100644 --- a/gst/rtsp/rtspconnection.c +++ b/gst/rtsp/rtspconnection.c @@ -26,19 +26,24 @@ /* we include this here to get the G_OS_* defines */ #include -#ifdef G_OS_UNIX +#ifdef G_OS_WIN32 +#include +#else #include #include #include #include #endif -#ifdef G_OS_WIN32 -#include -#endif #include "rtspconnection.h" +#ifdef G_OS_WIN32 +#define CLOSE_SOCKET(sock) closesocket(sock); +#else +#define CLOSE_SOCKET(sock) close(sock); +#endif + #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 @@ -224,12 +229,15 @@ rtsp_connection_send (RTSPConnection * conn, RTSPMessage * message) startup_error: { GST_DEBUG_OBJECT (self, "Error %d on WSAStartup", error); - return RTSP_ERROR; + g_warning ("Error %d on WSAStartup", error); + return RTSP_EWSASTART; } version_error: { + g_warning ("Windows sockets are not version 0x202 (current 0x%x)", + w.wVersion); WSACleanup (); - return RTSP_ERROR; + return RTSP_EWSAVERSION; } #endif write_error: @@ -586,13 +594,10 @@ rtsp_connection_close (RTSPConnection * conn) if (conn == NULL) return RTSP_EINVAL; + res = CLOSE_SOCKET (conn->fd); #ifdef G_OS_WIN32 - res = socketclose (conn->fd); WSACleanup (); -#else - res = close (conn->fd); #endif - conn->fd = -1; if (res != 0) goto sys_error; diff --git a/gst/rtsp/rtspdefs.h b/gst/rtsp/rtspdefs.h index c5b4474e..169ce48c 100644 --- a/gst/rtsp/rtspdefs.h +++ b/gst/rtsp/rtspdefs.h @@ -25,14 +25,17 @@ G_BEGIN_DECLS typedef enum { - RTSP_OK = 0, + RTSP_OK = 0, /* errors */ - RTSP_EINVAL = -1, - RTSP_ENOMEM = -2, - RTSP_ERESOLV = -3, - RTSP_ENOTIMPL = -4, - RTSP_ESYS = -5, - RTSP_EPARSE = -6, + RTSP_EINVAL = -1, + RTSP_ENOMEM = -2, + RTSP_ERESOLV = -3, + RTSP_ENOTIMPL = -4, + RTSP_ESYS = -5, + RTSP_EPARSE = -6, + RTSP_EWSASTART = -7, + RTSP_EWSAVERSION = -8, + } RTSPResult; typedef enum { -- cgit