Mingw headers provide similar defines already (unconditional #defines,
without any #undef or #ifdef around it), while MSVC doesn't have
them.
Signed-off-by: Martin Storsjö <martin@martin.st>
The fallback function is a non-static function, we shouldn't be
defining non-static functions outside of the proper ff/av prefix
namespaces.
This is especially important for a function like poll, which
other parties (other libraries, or executables linking these
libraries) also might provide similar but incompatible fallbacks for.
Signed-off-by: Martin Storsjö <martin@martin.st>
We need to include winsock2.h here, to make sure we have the
real pollfd struct definition, if one exists, before defining the
fallback poll function.
Signed-off-by: Martin Storsjö <martin@martin.st>
The fds are unsigned integers in the windows definition of struct
sockfds. Due to this, the comparison if (fds[i].fd > n) was always
false.
Signed-off-by: Martin Storsjö <martin@martin.st>
io.h is required for open and _wopen, and fcntl.h is required for
the O_CREAT flag. On mingw, fcntl.h is included by os_support.h (and
the mingw fcntl.h includes io.h), but include it explicitly here
since this implementation requires it.
Also move the #undef open up. open must not be defined to ff_win32_open
while including the headers that declare the open function. On mingw,
this happened in os_support.h before open was redirected.
Signed-off-by: Martin Storsjö <martin@martin.st>
This simplifies usage for segment streaming formats with no global
headers, tipically MPEG 2 transport stream "ts" files.
The seg class duplication is required in order to avoid an infinite loop
in libavformat/utils.c:format_child_next_class().
Patch is addition to my previous patch
(https://lists.ffmpeg.org/pipermail/ffmpeg-cvslog/2012-June/051590.html)
and disables seeking on FIFOs/named pipes by setting
URLContext::is_streamed (same as pipe: protocol does for stdin/stdout pipes)
Fixes Ticket986
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
It is included for the open/read/write/close functions. On
MSVC, where this header does not exist, the same functions
are provided by io.h, which is already included.
On windows, these functions are provided by io.h. Make sure
io.h is included if it exists, regardless of the setmode
function.
Signed-off-by: Martin Storsjö <martin@martin.st>
unistd.h used to be required for gethostname. On windows, gethostname
is provided by winsock2.h. Now network.h includes both unistd.h and
winsock2.h if they exist.
Signed-off-by: Martin Storsjö <martin@martin.st>
This gives you the proper v4 or v6 version of the "any address",
allowing receiving connections on any address on the machine.
Signed-off-by: Martin Storsjö <martin@martin.st>