GNOME Bugzilla – Bug 345288
[udp] make work on Windows
Last modified: 2007-11-14 12:41:24 UTC
I have made some work with UDP under Windows. -all four sinks and src should work. -added nessessary Windows network stuff -replaced unix sockets with pipe. -close(netsocket) replaced with closesocket() -added inet_aton function -tried to make it work with minimal modification to original There is needed some testing. I have tested send some data: win local, win -> lin, lin -> win. It has own directory and can easily added to gst-lpugins-good/gst dir to testing.
Created attachment 67607 [details] windows udp tar file
please rewrite as a patch with proper #ifdef etc.
Created attachment 67711 [details] [review] udp for windows ifdefs and additional error messaging added.
Created attachment 67715 [details] [review] configure.ac patch If found winsock2.h adds -lws2_32 to WIN_LIBS and removes udp from list if needed
> +#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 This just adds a cast, wouldn't that be more elegant to do with a #define? Also, please use ... #else ... in the code where it makes sense. > +AM_CONDITIONAL(HAVE_WINSOCK2_H, test "x$HAVE_WINSOCK2_H" = "xyes") Don't think you need that (you aren't using that anywhere in Makefile.am, are you?) > if test "x$HAVE_SYS_SOCKET_H" != "xyes"; then > - GST_PLUGINS_SELECTED=`echo $GST_PLUGINS_SELECTED | $SED -e s/udp//` > - GST_PLUGINS_SELECTED=`echo $GST_PLUGINS_SELECTED | $SED -e s/rtsp//` > - GST_PLUGINS_NO="\tudp\n$GST_PLUGINS_NO" > - GST_PLUGINS_NO="\trtsp\n$GST_PLUGINS_NO" > + if test "x$HAVE_WINSOCK2_H" != "xyes"; then > + GST_PLUGINS_SELECTED=`echo $GST_PLUGINS_SELECTED | $SED -e s/udp//` > + GST_PLUGINS_SELECTED=`echo $GST_PLUGINS_SELECTED | $SED -e s/rtsp//` > + GST_PLUGINS_NO="\tudp\n$GST_PLUGINS_NO" > + GST_PLUGINS_NO="\trtsp\n$GST_PLUGINS_NO" > + fi > +fi This disables compilation of udp and rtsp under *nix completely, doesn't it?
Created attachment 67836 [details] [review] new patch for configure.ac removed unnessesary +AM_CONDITIONAL(HAVE_WINSOCK2_H, test "x$HAVE_WINSOCK2_H" = "xyes") Next part is ok. This part removes udp and rtsp if there is no sys/socket.h and no winsock2.h. I think this is what is wanted result. > if test "x$HAVE_SYS_SOCKET_H" != "xyes"; then > - GST_PLUGINS_SELECTED=`echo $GST_PLUGINS_SELECTED | $SED -e s/udp//` > - GST_PLUGINS_SELECTED=`echo $GST_PLUGINS_SELECTED | $SED -e s/rtsp//` > - GST_PLUGINS_NO="\tudp\n$GST_PLUGINS_NO" > - GST_PLUGINS_NO="\trtsp\n$GST_PLUGINS_NO" > + if test "x$HAVE_WINSOCK2_H" != "xyes"; then > + GST_PLUGINS_SELECTED=`echo $GST_PLUGINS_SELECTED | $SED -e s/udp//` > + GST_PLUGINS_SELECTED=`echo $GST_PLUGINS_SELECTED | $SED -e s/rtsp//` > + GST_PLUGINS_NO="\tudp\n$GST_PLUGINS_NO" > + GST_PLUGINS_NO="\trtsp\n$GST_PLUGINS_NO" > + fi > +fi
Created attachment 69022 [details] [review] new, less invasive patch Here's a new patch that's slightly less invasive than your original one. Could you please test this patch on win32 to make sure it compiles/works?
(Oh, and you were right about the configure.ac bit of course, I misread the diff, apologies).
Ping? Any chance you could test if this at least compiles on win32? :)
(In reply to comment #9) > Ping? Any chance you could test if this at least compiles on win32? :) > Yes it compiles in mingw. I can test it next weekend.
Created attachment 69467 [details] [review] new, less invasive patch update Tested with clean CVS system. Added two lines to gstnetutils.h. <gst/gstobject.h> for GstObject, <gst/gstinfo.h> for GST_WARNING_OBJECT(...) and <glib.h> for G_OS_XXXX. Now it should compile properly in windows. There is something wrong with my binary test environment. So this is not really tested. I think I have to install everything again. For example gst-launch-0.10.exe is asking some vc++ debug libraries even it is compiled with Linux hosted MinGW.
Oops, nice catch! Thanks a lot for checking up on this. Committed to CVS: 2006-07-24 Tim-Philipp Müller <tim at centricular dot net> Based on patch by: Joni Valtanen <joni dot valtanen at movial fi> * configure.ac: * gst/udp/Makefile.am: * gst/udp/gstdynudpsink.c: (gst_dynudpsink_init), (gst_dynudpsink_finalize), (gst_dynudpsink_close): * gst/udp/gstdynudpsink.h: * gst/udp/gstmultiudpsink.c: (gst_multiudpsink_init), (gst_multiudpsink_finalize), (gst_multiudpsink_close): * gst/udp/gstmultiudpsink.h: * gst/udp/gstudp.c: (plugin_init): * gst/udp/gstudpsink.h: * gst/udp/gstudpsrc.c: (gst_udpsrc_init), (gst_udpsrc_create), (gst_udpsrc_start), (gst_udpsrc_stop): * gst/udp/gstudpsrc.h: * gst/udp/gstudpnetutils.c: (gst_udp_net_utils_win32_inet_aton), (gst_udp_net_utils_win32_wsa_startup): * gst/udp/gstudpnetutils.h: Port udp plugin to win32 (#345288). If there are any problems with this, please re-open or file a new bug report. Thanks!
Pipes does not work as tought in Windows. Never gets stop command so can not stop or dispose element. Have to make some other way to stop element. udpsrc was it where bug was found. There can be other places also. Somekind of polling might work.
> Pipes does not work as tought in Windows. Never gets stop command so can not > stop or dispose element. > > Have to make some other way to stop element. udpsrc was it where bug was found. > There can be other places also. Somekind of polling might work. There's bug #471232 for this now, it seems, so closing this one again.