[Ffmpeg-devel] Network patch for MingW users

Alex Beregszaszi alex
Sat Feb 24 14:36:02 CET 2007


Hi,

> > @@ -21,10 +21,50 @@
> >  #ifndef NETWORK_H
> >  #define NETWORK_H
> >  
> > +#ifdef __MINGW32__
> > +#include <winsock2.h>
> > +#include <ws2tcpip.h>
> > +#else
> >  #include <sys/types.h>
> >  #include <sys/socket.h>
> >  #include <netinet/in.h>
> >  #include <arpa/inet.h>
> >  #include <netdb.h>
> > +#endif
> >  
> > +/**
> > + * sets the non-blocking io on socket
> > + */
> > +static inline int av_socket_nonblock(int socket, int enable)
> > +{
> > +#ifdef __MINGW32__
> > +   return ioctlsocket(socket, FIONBIO, &enable);
> > +#else
> > +   if (enable)
> > +      return fcntl(socket, F_SETFL, fcntl(socket, F_GETFL) | O_NONBLOCK);
> > +   else
> > +      return fcntl(socket, F_SETFL, fcntl(socket, F_GETFL) & ~O_NONBLOCK);
> >  #endif
> > +}
> 
> This should be in os_support.c with a prototype here.

Still the question remains av_ or ff_ prefix. Even for the macro below:

> > +#ifdef __MINGW32__
> > +#define ff_neterrno() WSAGetLastError()
> > +#define FF_NETERROR(err) WSA##err
> > +#define WSAEAGAIN WSAEWOULDBLOCK
> > +#else
> > +#define ff_neterrno() errno
> > +#define FF_NETERROR(err) err
> > +#endif
> 
> This should be merged with the #ifdef chunk above.

I dont think it must be merged. The ifdef chunk above is about including
headers, while here we add NEW macros.

--
Alex Beregszaszi






More information about the ffmpeg-devel mailing list