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>
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>
Since the errno.h values don't match the error codes that winsock
returns, map the winsock error codes to the errno ones, to make
sure explicit checks against AVERROR(x) match.
Signed-off-by: Martin Storsjö <martin@martin.st>
Apparently this include is needed on some systems for building the
poll fallback (for the timeval struct for select?), but it isn't
available on all systems. Thus only include it if it exists.
Signed-off-by: Martin Storsjö <martin@martin.st>
This heaader is required for close() for sockets in network
code. For winsock, the equivalent function is defined in the
winsock2.h header.
This avoids having the HAVE_UNISTD_H in all files dealing with
raw sockets.
Signed-off-by: Martin Storsjö <martin@martin.st>
On MSVC, gmtime returns NULL for values outside of their supported
range (and these show up in our fate test). This doesn't seem
to affect the actual fate test result.
Signed-off-by: Martin Storsjö <martin@martin.st>
Currently if a pattern is given we look for up to the fifth file name in
the sequence. This option sets that limit to an arbitrary number.
Signed-off-by: Anton Khirnov <anton@khirnov.net>
This adds the capability to start counting file number from an arbitrary
integer.
This includes a few lines of trivial code from FFmpeg codebase.
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Also use ff_neterrno() instead of errno directly (which doesn't work
on windows), for getting the error code.
Signed-off-by: Martin Storsjö <martin@martin.st>
getnameinfo doesn't set errno on failure, it returns an error code,
which should be handled by gai_strerror instead of the normal
strerror.
Signed-off-by: Martin Storsjö <martin@martin.st>
Rtmpt is effectively half duplex - the server can't return any
data unless we send a request (to which the server responds). If
we don't have any data to send currently, and the server didn't
return any data either, wait a little before doing the next request.
This avoids busy looping with idle posts with empty replies, while
waiting for more data from the server.
Signed-off-by: Martin Storsjö <martin@martin.st>
Add a new option 'rtmp_flush_interval' that allows specifying the
number of packets to write before sending it off as a HTTP request.
This is mostly relevant for RTMPT - for plain RTMP, it only controls
how often we check the socket for incoming packets, which shouldn't
affect the performance in any noticeable way.
Signed-off-by: Martin Storsjö <martin@martin.st>
This seems to be the correct mode to send, according to the
original RTSP RFC, and matches the method RECORD which is
sent later when starting to send data.
Darwin Streaming Server works fine with either of them.
Signed-off-by: Martin Storsjö <martin@martin.st>