After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 345288 - [udp] make work on Windows
[udp] make work on Windows
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
git master
Other Windows
: Normal enhancement
: 0.10.4
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2006-06-19 08:40 UTC by Joni Valtanen
Modified: 2007-11-14 12:41 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
windows udp tar file (13.44 KB, application/x-gzip)
2006-06-19 08:42 UTC, Joni Valtanen
  Details
udp for windows (15.84 KB, patch)
2006-06-20 13:41 UTC, Joni Valtanen
reviewed Details | Review
configure.ac patch (1.28 KB, patch)
2006-06-20 14:19 UTC, Joni Valtanen
reviewed Details | Review
new patch for configure.ac (1.21 KB, patch)
2006-06-22 09:17 UTC, Joni Valtanen
committed Details | Review
new, less invasive patch (15.48 KB, patch)
2006-07-17 08:07 UTC, Tim-Philipp Müller
none Details | Review
new, less invasive patch update (15.48 KB, patch)
2006-07-24 10:28 UTC, Joni Valtanen
committed Details | Review

Description Joni Valtanen 2006-06-19 08:40:15 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.
Comment 1 Joni Valtanen 2006-06-19 08:42:41 UTC
Created attachment 67607 [details]
windows udp tar file
Comment 2 Wim Taymans 2006-06-19 14:16:56 UTC
please rewrite as a patch with proper #ifdef etc.
Comment 3 Joni Valtanen 2006-06-20 13:41:59 UTC
Created attachment 67711 [details] [review]
udp for windows

ifdefs and additional error messaging added.
Comment 4 Joni Valtanen 2006-06-20 14:19:39 UTC
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
Comment 5 Tim-Philipp Müller 2006-06-21 19:26:30 UTC
> +#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?

Comment 6 Joni Valtanen 2006-06-22 09:17:09 UTC
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
Comment 7 Tim-Philipp Müller 2006-07-17 08:07:40 UTC
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?
Comment 8 Tim-Philipp Müller 2006-07-17 08:10:40 UTC
(Oh, and you were right about the configure.ac bit of course, I misread the diff, apologies).

Comment 9 Tim-Philipp Müller 2006-07-21 09:27:45 UTC
Ping? Any chance you could test if this at least compiles on win32? :)
Comment 10 Joni Valtanen 2006-07-21 12:21:21 UTC
(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.
Comment 11 Joni Valtanen 2006-07-24 10:28:59 UTC
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.
Comment 12 Tim-Philipp Müller 2006-07-24 11:52:17 UTC
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!

Comment 13 Joni Valtanen 2006-10-09 07:28:56 UTC
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.
Comment 14 Tim-Philipp Müller 2007-11-14 12:41:24 UTC
> 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.