I'm trying to build gstreamer in Visual Studio 8.
I succeeded in building it and all libraries it depends on, but during my test I discovered 2 problems with udpsrc. 1) The pipe blocks but should not. 2) bind fails on multicast addresses. I fixed this and attached a patch. Carsten Index: gstudpsrc.c =================================================================== RCS file: /cvs/gstreamer/gst-plugins-good/gst/udp/gstudpsrc.c,v retrieving revision 1.80 diff -u -r1.80 gstudpsrc.c --- gstudpsrc.c 2 Nov 2007 21:16:09 -0000 1.80 +++ gstudpsrc.c 21 Feb 2008 11:02:48 -0000 @@ -127,6 +127,9 @@ #if defined _MSC_VER && (_MSC_VER >= 1400) #include <io.h> +#define close CloseHandle +#define write _write +#define read _read #endif #include <gst/netbuffer/gstnetbuffer.h> @@ -149,16 +152,39 @@ #define WRITE_SOCKET(src) src->control_sock[1] #define READ_SOCKET(src) src->control_sock[0] -#define SEND_COMMAND(src, command, res) \ -G_STMT_START { \ - unsigned char c; c = command; \ - res = write (WRITE_SOCKET(src), &c, 1); \ +#if !defined(__MINGW32__) && defined(G_OS_WIN32) + +#define SEND_COMMAND(src, command, res) \ +G_STMT_START { \ + gint bw;gchar c; c = command; \ + if (!WriteFile((PHANDLE)WRITE_SOCKET(src), &c, 1,&bw,NULL)){ \ + res=-1;\ + }else{\ + res=bw;\ + }\ +} G_STMT_END + +#define READ_COMMAND(src, command, res) \ +G_STMT_START {\ + gint br=0;\ + if(PeekNamedPipe((PHANDLE)READ_SOCKET(src),NULL,NULL,NULL,NULL,NULL)){ \ + ReadFile((PHANDLE)WRITE_SOCKET(src), &command, 1,&br,NULL);\ + }\ + res=br;\ +} G_STMT_END + +#else +#define SEND_COMMAND(src, command, res) \ +G_STMT_START { \ + gchar c; c = command; \ + res = write(WRITE_SOCKET(src), &c, 1); \ } G_STMT_END #define READ_COMMAND(src, command, res) \ G_STMT_START { \ - res = read(READ_SOCKET(src), &command, 1); \ + res = read(READ_SOCKET(src), &command, 1); \ } G_STMT_END +#endif #define CLOSE_IF_REQUESTED(udpctx) \ if ((!udpctx->externalfd) || (udpctx->externalfd && udpctx->closefd)) \ @@ -718,8 +744,16 @@ /* This should work on UNIX too. PF_UNIX sockets replaced with pipe */ /* pipe( CONTROL_SOCKETS(src), 4096, _O_BINARY ) */ +#if defined(__MINGW32__) if ((ret = _pipe (CONTROL_SOCKETS (src), 4096, _O_BINARY)) < 0) - goto no_socket_pair; + goto no_socket_pair; + +#else + if (!CreatePipe((PHANDLE)&READ_SOCKET(src),(PHANDLE)&WRITE_SOCKET(src),NULL,4096)){ + ret=GetLastError(); + goto no_socket_pair; + } +#endif #else GST_DEBUG_OBJECT (src, "creating socket pair"); if ((ret = socketpair (PF_UNIX, SOCK_STREAM, 0, CONTROL_SOCKETS (src))) < 0) @@ -749,10 +783,11 @@ memset (&src->myaddr, 0, sizeof (src->myaddr)); src->myaddr.sin_family = AF_INET; /* host byte order */ src->myaddr.sin_port = htons (src->port); /* short, network byte order */ - +#ifndef G_OS_WIN32 if (src->multi_addr.imr_multiaddr.s_addr) src->myaddr.sin_addr.s_addr = src->multi_addr.imr_multiaddr.s_addr; else +#endif src->myaddr.sin_addr.s_addr = INADDR_ANY; GST_DEBUG_OBJECT (src, "binding on port %d", src->port); @@ -938,7 +973,6 @@ close (src->control_sock[1]); src->control_sock[1] = -1; } - WSA_CLEANUP (src); return TRUE; ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
Hi,
Nice ! Then I suggest you an other problem : I am trying to use rtspsrc on windows: gst-launch-0.10 -v rtspsrc location=rtsp://anyserver/url ! fakesink And I directly got log message : Setting pipeline to PAUSED ... ERROR: Pipeline doesn't want to pause. ERROR: from element /pipeline0/rtspsrc0: Could not open resource for reading and writing. Additional debug info: E:\devel-cvs\src\gst-plugins-good\gst\rtsp\gstrtspsrc.c(4005): ??? (): /pipeline0/rtspsrc0: Could not connect to server. (not supported on win32, implement me in a different way ??) Setting pipeline to NULL ... FREEING pipeline ... Specialy the message "not supported on win32, implement me in a different way ??" Does it mean that it is not possible to use rtspsrc element on windows ? Sincerely Julien > I'm trying to build gstreamer in Visual Studio 8. > I succeeded in building it and all libraries it depends on, but during > my test I discovered 2 problems with udpsrc. > > 1) The pipe blocks but should not. > 2) bind fails on multicast addresses. > > I fixed this and attached a patch. > > Carsten > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/_______________________________________________ > gstreamer-devel mailing list > [hidden email] > https://lists.sourceforge.net/lists/listinfo/gstreamer-devel > ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
In reply to this post by Carsten-17
On Fri, 2008-02-22 at 11:14 +0100, Carsten wrote: > I'm trying to build gstreamer in Visual Studio 8. > I succeeded in building it and all libraries it depends on, but during > my test I discovered 2 problems with udpsrc. > > 1) The pipe blocks but should not. > 2) bind fails on multicast addresses. > > I fixed this and attached a patch. Other patches are in bugzilla. The most likely one to be accepted will be the one that integrates with GstPoll (here: http://bugzilla.gnome.org/show_bug.cgi?id=515962). Wim > > Carsten > plain text document attachment (gstudpsrc.c.patch) > Index: gstudpsrc.c > =================================================================== > RCS file: /cvs/gstreamer/gst-plugins-good/gst/udp/gstudpsrc.c,v > retrieving revision 1.80 > diff -u -r1.80 gstudpsrc.c > --- gstudpsrc.c 2 Nov 2007 21:16:09 -0000 1.80 > +++ gstudpsrc.c 21 Feb 2008 11:02:48 -0000 > @@ -127,6 +127,9 @@ > > #if defined _MSC_VER && (_MSC_VER >= 1400) > #include <io.h> > +#define close CloseHandle > +#define write _write > +#define read _read > #endif > > #include <gst/netbuffer/gstnetbuffer.h> > @@ -149,16 +152,39 @@ > #define WRITE_SOCKET(src) src->control_sock[1] > #define READ_SOCKET(src) src->control_sock[0] > > -#define SEND_COMMAND(src, command, res) \ > -G_STMT_START { \ > - unsigned char c; c = command; \ > - res = write (WRITE_SOCKET(src), &c, 1); \ > +#if !defined(__MINGW32__) && defined(G_OS_WIN32) > + > +#define SEND_COMMAND(src, command, res) \ > +G_STMT_START { \ > + gint bw;gchar c; c = command; \ > + if (!WriteFile((PHANDLE)WRITE_SOCKET(src), &c, 1,&bw,NULL)){ \ > + res=-1;\ > + }else{\ > + res=bw;\ > + }\ > +} G_STMT_END > + > +#define READ_COMMAND(src, command, res) \ > +G_STMT_START {\ > + gint br=0;\ > + if(PeekNamedPipe((PHANDLE)READ_SOCKET(src),NULL,NULL,NULL,NULL,NULL)){ \ > + ReadFile((PHANDLE)WRITE_SOCKET(src), &command, 1,&br,NULL);\ > + }\ > + res=br;\ > +} G_STMT_END > + > +#else > +#define SEND_COMMAND(src, command, res) \ > +G_STMT_START { \ > + gchar c; c = command; \ > + res = write(WRITE_SOCKET(src), &c, 1); \ > } G_STMT_END > > #define READ_COMMAND(src, command, res) \ > G_STMT_START { \ > - res = read(READ_SOCKET(src), &command, 1); \ > + res = read(READ_SOCKET(src), &command, 1); \ > } G_STMT_END > +#endif > > #define CLOSE_IF_REQUESTED(udpctx) \ > if ((!udpctx->externalfd) || (udpctx->externalfd && udpctx->closefd)) \ > @@ -718,8 +744,16 @@ > > /* This should work on UNIX too. PF_UNIX sockets replaced with pipe */ > /* pipe( CONTROL_SOCKETS(src), 4096, _O_BINARY ) */ > +#if defined(__MINGW32__) > if ((ret = _pipe (CONTROL_SOCKETS (src), 4096, _O_BINARY)) < 0) > - goto no_socket_pair; > + goto no_socket_pair; > + > +#else > + if (!CreatePipe((PHANDLE)&READ_SOCKET(src),(PHANDLE)&WRITE_SOCKET(src),NULL,4096)){ > + ret=GetLastError(); > + goto no_socket_pair; > + } > +#endif > #else > GST_DEBUG_OBJECT (src, "creating socket pair"); > if ((ret = socketpair (PF_UNIX, SOCK_STREAM, 0, CONTROL_SOCKETS (src))) < 0) > @@ -749,10 +783,11 @@ > memset (&src->myaddr, 0, sizeof (src->myaddr)); > src->myaddr.sin_family = AF_INET; /* host byte order */ > src->myaddr.sin_port = htons (src->port); /* short, network byte order */ > - > +#ifndef G_OS_WIN32 > if (src->multi_addr.imr_multiaddr.s_addr) > src->myaddr.sin_addr.s_addr = src->multi_addr.imr_multiaddr.s_addr; > else > +#endif > src->myaddr.sin_addr.s_addr = INADDR_ANY; > > GST_DEBUG_OBJECT (src, "binding on port %d", src->port); > @@ -938,7 +973,6 @@ > close (src->control_sock[1]); > src->control_sock[1] = -1; > } > - > WSA_CLEANUP (src); > > return TRUE; > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
In reply to this post by Carsten-17
Hi,
For the first issue you might want to take a look at: http://bugzilla.gnome.org/show_bug.cgi?id=471232 Haven't yet had time to finish up the patch, but it seems to work fine. Cheers, Ole André -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Carsten Sent: Friday, February 22, 2008 11:15 AM To: [hidden email] Subject: [gst-devel] udpsrc patch for win32/MSC I'm trying to build gstreamer in Visual Studio 8. I succeeded in building it and all libraries it depends on, but during my test I discovered 2 problems with udpsrc. 1) The pipe blocks but should not. 2) bind fails on multicast addresses. I fixed this and attached a patch. Carsten ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
In reply to this post by Julien.Isorce
Hi Julien,
I don't use the rtspsrc for now. So I can't tell. Sorry. Carsten [hidden email] schrieb: > Hi, > > Nice ! > > Then I suggest you an other problem : > > > I am trying to use rtspsrc on windows: > > gst-launch-0.10 -v rtspsrc location=rtsp://anyserver/url ! fakesink > > And I directly got log message : > > > Setting pipeline to PAUSED ... > ERROR: Pipeline doesn't want to pause. > ERROR: from element /pipeline0/rtspsrc0: Could not open resource for > reading and writing. > Additional debug info: > E:\devel-cvs\src\gst-plugins-good\gst\rtsp\gstrtspsrc.c(4005): ??? (): > /pipeline0/rtspsrc0: > Could not connect to server. (not supported on win32, implement me in a > different way ??) > Setting pipeline to NULL ... > FREEING pipeline ... > > Specialy the message "not supported on win32, implement me in a different > way ??" > > Does it mean that it is not possible to use rtspsrc element on windows ? > > Sincerely > > Julien > > >> I'm trying to build gstreamer in Visual Studio 8. >> I succeeded in building it and all libraries it depends on, but during >> my test I discovered 2 problems with udpsrc. >> >> 1) The pipe blocks but should not. >> 2) bind fails on multicast addresses. >> >> I fixed this and attached a patch. >> >> Carsten >> ------------------------------------------------------------------------- >> This SF.net email is sponsored by: Microsoft >> Defy all challenges. Microsoft(R) Visual Studio 2008. >> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/_______________________________________________ >> gstreamer-devel mailing list >> [hidden email] >> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel >> > > > > ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
Free forum by Nabble | Edit this page |