diff options
author | Wim Taymans <wim.taymans@gmail.com> | 2006-07-10 16:41:57 +0000 |
---|---|---|
committer | Wim Taymans <wim.taymans@gmail.com> | 2006-07-10 16:41:57 +0000 |
commit | f08deb4345e4509f8e25cb9c3f10713246db6e36 (patch) | |
tree | 437857210a52b56bce3b811e38ed7d09efc39ae5 /gst | |
parent | 7089fbac56557b7dbf0b91201352797c89216ec6 (diff) |
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.
Diffstat (limited to 'gst')
-rw-r--r-- | gst/rtsp/Makefile.am | 10 | ||||
-rw-r--r-- | gst/rtsp/rtspconnection.c | 25 | ||||
-rw-r--r-- | gst/rtsp/rtspdefs.h | 17 |
3 files changed, 30 insertions, 22 deletions
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,20 +26,25 @@ /* we include this here to get the G_OS_* defines */ #include <glib.h> -#ifdef G_OS_UNIX +#ifdef G_OS_WIN32 +#include <winsock2.h> +#else #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 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 * address. */ @@ -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 { |