[FFmpeg-devel] libossupport status
Luca Abeni
lucabe72
Sun Dec 23 13:23:33 CET 2007
Hi Vadim,
On Sat, 2007-12-22 at 23:42 +0100, Vadim Lebedev wrote:
[...]
> But it seems that original message in this thread suggest different
> approach: The patch for example proposes
> to remove #include "os_support.h" and
> to replace:
>
> ff_socket_nonblock(server_fd, 1);
> by:
> fcntl(server_fd, F_SETFL, fcntl(server_fd, F_GETFL) | O_NONBLOCK);
>
>
>
> This will no work on win32 (there is no F_SETFL on WIN32)
If you look at libossupport/netinet/in.h, you will see:
static inline int fcntl(int fd, int cmd, ...)
{
if(cmd == F_GETFL){
return 0;
}
if(cmd == F_SETFL){
va_list vl;
long arg;
u_long enable;
va_start(vl, cmd);
arg = va_arg(vl, long);
va_end(vl);
enable= !!(arg & O_NONBLOCK);
return ioctlsocket(fd, FIONBIO, &enable);
}
return -1;
}
I agree that this is the wrong header for containing this code (as I
wrote in the original email, I just put all the code il netinet/in.h,
and I still have to split it in the correct header files).
> The best way IMO will be to keep evrywhere
>
> #include "os_support.h"
>
> and have functions like 'ff_socket_nonblock' defined in os_support.h as
> macros or noops
> this way there will be no runtime and linktime deps on most platforms
This is the idea I tried in my previous patch. But this solution will
either put some OS-dependent code in libav* or create a libav*
dependency on libossupport... So, I switched to the new proposal...
But now, reading the last emails from Michael I suspect I misunderstood
something (maybe the trick is in defining "depends on"... ;-)
I'll have to re-think about this...
Thanks,
Luca
More information about the ffmpeg-devel
mailing list