diff -urNp gst-plugins-good/gst/udp/Makefile.am gst-plugins-good.win/gst/udp/Makefile.am
--- gst-plugins-good/gst/udp/Makefile.am	2005-11-30 13:10:01.000000000 +0200
+++ gst-plugins-good.win/gst/udp/Makefile.am	2006-06-20 16:28:10.000000000 +0300
@@ -14,7 +14,7 @@ BUILT_SOURCES = $(built_sources) $(built
 
 libgstudp_la_SOURCES = gstudp.c gstudpsrc.c gstudpsink.c gstmultiudpsink.c gstdynudpsink.c
 libgstudp_la_CFLAGS = $(GST_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS)
-libgstudp_la_LIBADD = $(GST_BASE_LIBS) $(GST_PLUGINS_BASE_LIBS) \
+libgstudp_la_LIBADD = $(GST_BASE_LIBS) $(GST_PLUGINS_BASE_LIBS) $(WIN32_LIBS)\
 		      -lgstnetbuffer-@GST_MAJORMINOR@
 libgstudp_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
 
diff -urNp gst-plugins-good/gst/udp/gstdynudpsink.c gst-plugins-good.win/gst/udp/gstdynudpsink.c
--- gst-plugins-good/gst/udp/gstdynudpsink.c	2006-04-26 00:39:44.000000000 +0300
+++ gst-plugins-good.win/gst/udp/gstdynudpsink.c	2006-06-20 16:28:10.000000000 +0300
@@ -1,6 +1,7 @@
 /* GStreamer
  * Copyright (C) <2005> Philippe Khalaf <burger@speedy.org>
  * Copyright (C) <2005> Nokia Corporation <kai.vehmanen@nokia.com>
+ * Copyright (C) <2005> Joni Valtanen <joni.valtanen@movial.fi>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -157,15 +158,32 @@ gst_dynudpsink_init (GstDynUDPSink * sin
 {
   GstDynUDPSink *udpsink;
 
+#ifdef G_OS_WIN32
+  WSADATA w;
+  int error = WSAStartup (0x0202, &w);
+ 
+  if (error) { 
+    GST_DEBUG_OBJECT (sink, "WSAStartup error: %d", error);
+  } 
+  if (w.wVersion != 0x0202) { 
+    WSACleanup ();
+    GST_DEBUG_OBJECT (sink, "Winsock version wrong : %x", w.wVersion );
+  }
+#endif
+
   udpsink = GST_DYNUDPSINK (sink);
 
   sink->sock = -1;
+
 }
 
 static void
 gst_dynudpsink_finalize (GObject * object)
 {
   G_OBJECT_CLASS (parent_class)->finalize (object);
+#ifdef G_OS_WIN32
+  WSACleanup ();
+#endif
 }
 
 static GstFlowReturn
@@ -277,9 +295,16 @@ gst_dynudpsink_init_send (GstDynUDPSink 
       goto no_socket;
 
     bc_val = 1;
+#ifdef G_OS_UNIX
     if ((ret =
             setsockopt (sink->sock, SOL_SOCKET, SO_BROADCAST, &bc_val,
                 sizeof (bc_val))) < 0)
+#endif
+#ifdef G_OS_WIN32
+    if ((ret =
+            setsockopt (sink->sock, SOL_SOCKET, SO_BROADCAST, (char *)&bc_val,
+                sizeof (bc_val))) < 0)
+#endif
       goto no_broadcast;
   }
 
@@ -307,7 +332,12 @@ gst_dynudpsink_get_stats (GstDynUDPSink 
 static void
 gst_dynudpsink_close (GstDynUDPSink * sink)
 {
+#ifdef G_OS_UNIX
   close (sink->sock);
+#endif
+#ifdef G_OS_WIN32
+  closesocket (sink->sock);
+#endif
 }
 
 static GstStateChangeReturn
diff -urNp gst-plugins-good/gst/udp/gstdynudpsink.h gst-plugins-good.win/gst/udp/gstdynudpsink.h
--- gst-plugins-good/gst/udp/gstdynudpsink.h	2006-06-02 00:07:26.000000000 +0300
+++ gst-plugins-good.win/gst/udp/gstdynudpsink.h	2006-06-20 16:28:10.000000000 +0300
@@ -32,12 +32,20 @@ G_BEGIN_DECLS
 #include <string.h>
 #include <sys/time.h>
 #include <sys/types.h>
+
+#ifdef G_OS_UNIX
 #include <netinet/in.h>
 #include <netdb.h>
 #include <sys/socket.h>
 #include <sys/wait.h>
-#include <fcntl.h>
 #include <arpa/inet.h>
+#endif
+
+#ifdef G_OS_WIN32
+#include <winsock2.h>
+#endif
+
+#include <fcntl.h>
 #include "gstudp.h"
 
 #define GST_TYPE_DYNUDPSINK             (gst_dynudpsink_get_type())
diff -urNp gst-plugins-good/gst/udp/gstmultiudpsink.c gst-plugins-good.win/gst/udp/gstmultiudpsink.c
--- gst-plugins-good/gst/udp/gstmultiudpsink.c	2006-04-26 00:39:44.000000000 +0300
+++ gst-plugins-good.win/gst/udp/gstmultiudpsink.c	2006-06-20 16:28:10.000000000 +0300
@@ -96,6 +96,11 @@ static GstElementClass *parent_class = N
 
 static guint gst_multiudpsink_signals[LAST_SIGNAL] = { 0 };
 
+#ifdef G_OS_WIN32
+/* There is no inet_aton on Windows */
+static int inet_aton(const char *c, struct in_addr* addr); 
+#endif
+
 GType
 gst_multiudpsink_get_type (void)
 {
@@ -257,6 +262,21 @@ gst_multiudpsink_class_init (GstMultiUDP
 static void
 gst_multiudpsink_init (GstMultiUDPSink * sink)
 {
+
+#ifdef G_OS_WIN32
+  WSADATA w; 
+  int error = WSAStartup (0x0202, &w);
+
+  if (error) { 
+    GST_DEBUG_OBJECT (sink, "WSAStartup error: %d", error);
+  }
+
+  if (w.wVersion != 0x0202) { 
+    WSACleanup ();
+    GST_DEBUG_OBJECT (sink, "Winsock version wrong : %x", w.wVersion );
+  }
+#endif
+
   sink->client_lock = g_mutex_new ();
 }
 
@@ -269,6 +289,10 @@ gst_multiudpsink_finalize (GObject * obj
 
   g_mutex_free (sink->client_lock);
 
+#ifdef G_OS_WIN32
+  WSACleanup ();
+#endif
+
   G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
@@ -383,9 +407,16 @@ gst_multiudpsink_init_send (GstMultiUDPS
     goto no_socket;
 
   bc_val = 1;
+#ifdef G_OS_UNIX
   if ((ret =
           setsockopt (sink->sock, SOL_SOCKET, SO_BROADCAST, &bc_val,
               sizeof (bc_val))) < 0)
+#endif
+#ifdef G_OS_WIN32
+  if ((ret =
+          setsockopt (sink->sock, SOL_SOCKET, SO_BROADCAST, (char *)&bc_val,
+              sizeof (bc_val))) < 0)
+#endif
     goto no_broadcast;
 
   sink->bytes_to_serve = 0;
@@ -412,7 +443,12 @@ no_broadcast:
 static void
 gst_multiudpsink_close (GstMultiUDPSink * sink)
 {
+#ifdef G_OS_UNIX
   close (sink->sock);
+#endif
+#ifdef G_OS_WIN32
+  closesocket (sink->sock);
+#endif
 }
 
 void
@@ -450,6 +486,7 @@ gst_multiudpsink_add (GstMultiUDPSink * 
       /* FIXME, can we use multicast and unicast over the same
        * socket? if not, search for socket of this multicast group or
        * create a new one. */
+
       setsockopt (sink->sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, &multi_addr,
           sizeof (multi_addr));
     } else {
@@ -661,3 +698,16 @@ no_init:
     return GST_STATE_CHANGE_FAILURE;
   }
 }
+
+#ifdef G_OS_WIN32
+static int inet_aton(const char *c, struct in_addr* paddr)
+{
+
+  paddr->s_addr = inet_addr( c );
+    
+  if( paddr->s_addr == INADDR_NONE ) {
+    return 0;
+  }
+  return 1;
+}
+#endif
diff -urNp gst-plugins-good/gst/udp/gstmultiudpsink.h gst-plugins-good.win/gst/udp/gstmultiudpsink.h
--- gst-plugins-good/gst/udp/gstmultiudpsink.h	2006-06-02 00:07:26.000000000 +0300
+++ gst-plugins-good.win/gst/udp/gstmultiudpsink.h	2006-06-20 16:28:10.000000000 +0300
@@ -32,12 +32,21 @@ G_BEGIN_DECLS
 #include <string.h>
 #include <sys/time.h>
 #include <sys/types.h>
+
+#ifdef G_OS_UNIX
 #include <netinet/in.h>
 #include <netdb.h>
 #include <sys/socket.h>
 #include <sys/wait.h>
-#include <fcntl.h>
 #include <arpa/inet.h>
+#endif
+
+#ifdef G_OS_WIN32
+#include <winsock2.h>
+#include <ws2tcpip.h> /* for ip_mreq */
+#endif
+
+#include <fcntl.h>
 #include "gstudp.h"
 
 #define GST_TYPE_MULTIUDPSINK            (gst_multiudpsink_get_type())
diff -urNp gst-plugins-good/gst/udp/gstudpsink.h gst-plugins-good.win/gst/udp/gstudpsink.h
--- gst-plugins-good/gst/udp/gstudpsink.h	2006-06-02 00:07:26.000000000 +0300
+++ gst-plugins-good.win/gst/udp/gstudpsink.h	2006-06-20 16:28:10.000000000 +0300
@@ -33,12 +33,20 @@ G_BEGIN_DECLS
 #include <string.h>
 #include <sys/time.h>
 #include <sys/types.h>
+
+#ifdef G_OS_UNIX
 #include <netinet/in.h>
 #include <netdb.h>
 #include <sys/socket.h>
 #include <sys/wait.h>
-#include <fcntl.h>
 #include <arpa/inet.h>
+#endif
+
+#ifdef G_OS_WIN32
+#include <winsock2.h>
+#endif
+
+#include <fcntl.h>
 #include "gstudp.h"
 
 #define GST_TYPE_UDPSINK                (gst_udpsink_get_type())
diff -urNp gst-plugins-good/gst/udp/gstudpsrc.c gst-plugins-good.win/gst/udp/gstudpsrc.c
--- gst-plugins-good/gst/udp/gstudpsrc.c	2006-04-26 00:39:44.000000000 +0300
+++ gst-plugins-good.win/gst/udp/gstudpsrc.c	2006-06-20 16:28:10.000000000 +0300
@@ -73,13 +73,18 @@
  * </refsect2>
  */
 
+
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
 #include "gstudpsrc.h"
 #include <unistd.h>
+
+#ifdef G_OS_UNIX
 #include <sys/ioctl.h>
+#endif
+
 #include <gst/netbuffer/gstnetbuffer.h>
 
 #ifdef HAVE_FIONREAD_IN_SYS_FILIO
@@ -149,6 +154,11 @@ static void gst_udpsrc_set_property (GOb
 static void gst_udpsrc_get_property (GObject * object, guint prop_id,
     GValue * value, GParamSpec * pspec);
 
+#ifdef G_OS_WIN32
+/* Have to add this some how */
+static int inet_aton(const char *c, struct in_addr* addr);
+#endif
+
 static void
 _do_init (GType type)
 {
@@ -222,11 +232,26 @@ gst_udpsrc_class_init (GstUDPSrcClass * 
 static void
 gst_udpsrc_init (GstUDPSrc * udpsrc, GstUDPSrcClass * g_class)
 {
+#ifdef G_OS_WIN32
+  WSADATA w;
+  int error = WSAStartup (0x0202, &w);
+
+  if (error) {
+    GST_DEBUG_OBJECT (sink, "WSAStartup error: %d", error);
+  } 
+
+  if (w.wVersion != 0x0202) { 
+    WSACleanup ();
+    GST_DEBUG_OBJECT (sink, "Winsock version wrong : %x", w.wVersion );
+  }
+#endif
+
   gst_base_src_set_live (GST_BASE_SRC (udpsrc), TRUE);
   udpsrc->port = UDP_DEFAULT_PORT;
   udpsrc->sock = UDP_DEFAULT_SOCKFD;
   udpsrc->multi_group = g_strdup (UDP_DEFAULT_MULTICAST_GROUP);
   udpsrc->uri = g_strdup (UDP_DEFAULT_URI);
+
 }
 
 static GstCaps *
@@ -253,7 +278,12 @@ gst_udpsrc_create (GstPushSrc * psrc, Gs
   guint max_sock;
   gchar *pktdata;
   gint pktsize;
+#ifdef G_OS_UNIX 
   gint readsize;
+#endif
+#ifdef G_OS_WIN32
+  gulong readsize;
+#endif
   gint ret;
   gboolean try_again;
 
@@ -261,7 +291,9 @@ gst_udpsrc_create (GstPushSrc * psrc, Gs
 
   FD_ZERO (&read_fds);
   FD_SET (udpsrc->sock, &read_fds);
+#ifdef G_OS_UNIX
   FD_SET (READ_SOCKET (udpsrc), &read_fds);
+#endif
   max_sock = MAX (udpsrc->sock, READ_SOCKET (udpsrc));
 
   do {
@@ -271,10 +303,26 @@ gst_udpsrc_create (GstPushSrc * psrc, Gs
     stop = FALSE;
 
     GST_LOG_OBJECT (udpsrc, "doing select");
+#ifdef G_OS_UNIX
     ret = select (max_sock + 1, &read_fds, NULL, NULL, NULL);
+#endif
+#ifdef G_OS_WIN32
+    if( ( ( max_sock + 1 ) != READ_SOCKET (udpsrc) ) || 
+        ( ( max_sock + 1 ) != WRITE_SOCKET (udpsrc) ) ) {
+        ret = select (max_sock + 1, &read_fds, NULL, NULL, NULL);
+    } else {
+        ret = 1;
+    }
+#endif
     GST_LOG_OBJECT (udpsrc, "select returned %d", ret);
     if (ret <= 0) {
+
+#ifdef G_OS_UNIX
       if (errno != EAGAIN && errno != EINTR)
+#endif
+#ifdef G_OS_WIN32
+      if ( WSAGetLastError() != WSAEINTR)
+#endif
         goto select_error;
       else
         try_again = TRUE;
@@ -312,8 +360,14 @@ gst_udpsrc_create (GstPushSrc * psrc, Gs
   } while (try_again);
 
   /* ask how much is available for reading on the socket */
+#ifdef G_OS_UNIX
   if ((ret = ioctl (udpsrc->sock, FIONREAD, &readsize)) < 0)
     goto ioctl_failed;
+#endif
+#ifdef G_OS_WIN32
+  if((ret = ioctlsocket (udpsrc->sock, FIONREAD, &readsize)) < 0)
+    goto ioctl_failed;
+#endif
 
   GST_LOG_OBJECT (udpsrc, "ioctl says %d bytes available", readsize);
 
@@ -515,12 +569,22 @@ gst_udpsrc_start (GstBaseSrc * bsrc)
 
   src = GST_UDPSRC (bsrc);
 
+#ifdef G_OS_UNIX
   GST_DEBUG_OBJECT (src, "creating socket pair");
   if ((ret = socketpair (PF_UNIX, SOCK_STREAM, 0, CONTROL_SOCKETS (src))) < 0)
     goto no_socket_pair;
 
   fcntl (READ_SOCKET (src), F_SETFL, O_NONBLOCK);
   fcntl (WRITE_SOCKET (src), F_SETFL, O_NONBLOCK);
+#endif
+#ifdef G_OS_WIN32
+  GST_DEBUG_OBJECT (src, "creating pipe");
+
+  /* This should work on UNIX too. PF_UNIX sockets replaced with pipe */
+  /* pipe( CONTROL_SOCKETS(src) ) */
+  if( ( ret = pipe( CONTROL_SOCKETS(src) ) ) < 0 )
+    goto no_socket_pair;
+#endif
 
   if (src->sock == -1) {
     if ((ret = socket (AF_INET, SOCK_DGRAM, 0)) < 0)
@@ -529,9 +593,16 @@ gst_udpsrc_start (GstBaseSrc * bsrc)
     src->sock = ret;
 
     reuse = 1;
+#ifdef G_OS_UNIX
     if ((ret =
             setsockopt (src->sock, SOL_SOCKET, SO_REUSEADDR, &reuse,
                 sizeof (reuse))) < 0)
+#endif
+#ifdef G_OS_WIN32
+    if ((ret =
+         setsockopt (src->sock, SOL_SOCKET, SO_REUSEADDR, (char *)&reuse,
+                sizeof (reuse))) < 0)
+#endif
       goto setsockopt_error;
 
     memset (&src->myaddr, 0, sizeof (src->myaddr));
@@ -549,9 +620,18 @@ gst_udpsrc_start (GstBaseSrc * bsrc)
   if (inet_aton (src->multi_group, &(src->multi_addr.imr_multiaddr))) {
     if (src->multi_addr.imr_multiaddr.s_addr) {
       src->multi_addr.imr_interface.s_addr = INADDR_ANY;
+#ifdef G_OS_UNIX
       if ((ret =
               setsockopt (src->sock, IPPROTO_IP, IP_ADD_MEMBERSHIP,
                   &src->multi_addr, sizeof (src->multi_addr))) < 0)
+#endif
+#ifdef G_OS_WIN32
+      if ((ret = setsockopt (src->sock, 
+                             IPPROTO_IP, 
+                             IP_ADD_MEMBERSHIP,
+                             (char *)&src->multi_addr, 
+                             sizeof (src->multi_addr))) < 0)
+#endif
         goto membership;
     }
   }
@@ -569,9 +649,16 @@ gst_udpsrc_start (GstBaseSrc * bsrc)
   }
 
   bc_val = 1;
+#ifdef G_OS_UNIX
   if ((ret =
           setsockopt (src->sock, SOL_SOCKET, SO_BROADCAST, &bc_val,
               sizeof (bc_val))) < 0)
+#endif
+#ifdef G_OS_WIN32
+  if ((ret = 
+          setsockopt (src->sock, SOL_SOCKET, SO_BROADCAST, (char *)&bc_val,
+              sizeof (bc_val))) < 0)
+#endif
     goto no_broadcast;
 
   src->myaddr.sin_port = htons (src->port + 1);
@@ -593,7 +680,12 @@ no_socket:
   }
 setsockopt_error:
   {
+#ifdef G_OS_UNIX
     close (src->sock);
+#endif
+#ifdef G_OS_WIN32
+    closesocket (src->sock);
+#endif
     src->sock = -1;
     GST_ELEMENT_ERROR (src, RESOURCE, SETTINGS, (NULL),
         ("setsockopt failed %d: %s (%d)", ret, g_strerror (errno), errno));
@@ -601,7 +693,12 @@ setsockopt_error:
   }
 bind_error:
   {
+#ifdef G_OS_UNIX
     close (src->sock);
+#endif
+#ifdef G_OS_WIN32
+    closesocket (src->sock);
+#endif
     src->sock = -1;
     GST_ELEMENT_ERROR (src, RESOURCE, SETTINGS, (NULL),
         ("bind failed %d: %s (%d)", ret, g_strerror (errno), errno));
@@ -609,7 +706,12 @@ bind_error:
   }
 membership:
   {
+#ifdef G_OS_UNIX
     close (src->sock);
+#endif
+#ifdef G_OS_WIN32
+    closesocket (src->sock);
+#endif
     src->sock = -1;
     GST_ELEMENT_ERROR (src, RESOURCE, SETTINGS, (NULL),
         ("could add membership %d: %s (%d)", ret, g_strerror (errno), errno));
@@ -617,7 +719,12 @@ membership:
   }
 getsockname_error:
   {
+#ifdef G_OS_UNIX
     close (src->sock);
+#endif
+#ifdef G_OS_WIN32
+    closesocket (src->sock);
+#endif
     src->sock = -1;
     GST_ELEMENT_ERROR (src, RESOURCE, SETTINGS, (NULL),
         ("getsockname failed %d: %s (%d)", ret, g_strerror (errno), errno));
@@ -625,7 +732,12 @@ getsockname_error:
   }
 no_broadcast:
   {
+#ifdef G_OS_UNIX
     close (src->sock);
+#endif
+#ifdef G_OS_WIN32
+    closesocket (src->sock);
+#endif
     src->sock = -1;
     GST_ELEMENT_ERROR (src, RESOURCE, SETTINGS, (NULL),
         ("could not configure socket for broadcast %d: %s (%d)", ret,
@@ -655,10 +767,16 @@ gst_udpsrc_stop (GstBaseSrc * bsrc)
   src = GST_UDPSRC (bsrc);
 
   if (src->sock != -1) {
+#ifdef G_OS_UNIX
     close (src->sock);
+#endif
+#ifdef G_OS_WIN32
+    closesocket (src->sock);
+#endif
     src->sock = -1;
   }
 
+  /* pipes on WIN32 else sockets */
   if (src->control_sock[0] != -1) {
     close (src->control_sock[0]);
     src->control_sock[0] = -1;
@@ -667,6 +785,11 @@ gst_udpsrc_stop (GstBaseSrc * bsrc)
     close (src->control_sock[1]);
     src->control_sock[1] = -1;
   }
+
+#ifdef G_OS_WIN32
+  WSACleanup ();
+#endif
+
   return TRUE;
 }
 
@@ -714,3 +837,16 @@ gst_udpsrc_uri_handler_init (gpointer g_
   iface->get_uri = gst_udpsrc_uri_get_uri;
   iface->set_uri = gst_udpsrc_uri_set_uri;
 }
+
+#ifdef G_OS_WIN32
+static int inet_aton(const char *c, struct in_addr* paddr)
+{
+
+  paddr->s_addr = inet_addr( c );
+    
+  if( paddr->s_addr == INADDR_NONE )
+          return 0;
+
+  return 1;
+}
+#endif
diff -urNp gst-plugins-good/gst/udp/gstudpsrc.h gst-plugins-good.win/gst/udp/gstudpsrc.h
--- gst-plugins-good/gst/udp/gstudpsrc.h	2006-06-02 00:07:26.000000000 +0300
+++ gst-plugins-good.win/gst/udp/gstudpsrc.h	2006-06-20 16:28:10.000000000 +0300
@@ -29,10 +29,18 @@ G_BEGIN_DECLS
 #include <errno.h>
 #include <string.h>
 #include <sys/types.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>
+#include <ws2tcpip.h>
+#endif
 
 #include <fcntl.h>
 #include "gstudp.h"
