[Ffmpeg-devel] Network patch for MingW users
François Revol
revol
Tue Feb 20 06:42:36 CET 2007
> > -#if defined(__BEOS__) || defined(__INNOTEK_LIBC__)
> > +#if defined(__BEOS__) || defined(__MINGW32__) ||
> > defined(__INNOTEK_LIBC__)
> > typedef int socklen_t;
> > #endif
>
> Arrgh, more OS dependencies. This too should be tested in configure.
That one I'll need, found out Haiku which defined __BEOS__ actually
typedefs socklen_t :-(
>
> > #ifdef __MINGW32__
> > __declspec(dllimport) void __stdcall Sleep(unsigned long
> > dwMilliseconds);
> > // # include <windows.h>
> > +#define GUID microsoft_issue_GUID
> > +#include <winsock.h>
> > +#undef GUID
> > # define usleep(t) Sleep((t) / 1000)
> > -# include <fcntl.h>
> > -# define lseek(f,p,w) _lseeki64((f), (p), (w))
> > +# define sleep(t) Sleep((t) * 1000)
> > +#define O_NONBLOCK FIONBIO
> > +#define fcntl(fd,b,c) { u_long arg=1L; \
> > + ioctlsocket(fd, c, &arg); }
>
> I'm not convinced this is a good idea. Someone might use fcntl() on
> a
> real file.
Why not just define a fcntlsocket() that other OSes would just map to
fcntl like is done for close already ? Much cleaner.
> > if (port <= 0 || port >= 65536)
> > goto fail;
> >
> > +#ifdef __MINGW32__
> > + init_winsock();
> > +#endif
>
> Aaaaiiiieeee! NO MORE OF THIS. PLEASE.
Also that's totally definitely non threadsafe.
Fran?ois.
More information about the ffmpeg-devel
mailing list