[Ffmpeg-devel] Network patch for MingW users
Måns Rullgård
mans
Sat Feb 24 15:32:56 CET 2007
Alex Beregszaszi <alex at rtfs.hu> writes:
> 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:
ff_ for both.
>> > +#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.
I disagree. The number of #ifdefs should be kept to a minimum.
--
M?ns Rullg?rd
mans at mansr.com
More information about the ffmpeg-devel
mailing list