From d2b18c8f5b085d753bba315ce0d8d8da7c35e433 Mon Sep 17 00:00:00 2001 From: Andrey Utkin Date: Tue, 9 Oct 2012 15:26:02 +0300 Subject: Introduce ff_network_wait_fd_timeout() Signed-off-by: Michael Niedermayer --- libavformat/network.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'libavformat/network.h') diff --git a/libavformat/network.h b/libavformat/network.h index cce188f464..51d855daf9 100644 --- a/libavformat/network.h +++ b/libavformat/network.h @@ -26,6 +26,7 @@ #include "config.h" #include "libavutil/error.h" #include "os_support.h" +#include "avio.h" #if HAVE_UNISTD_H #include @@ -80,6 +81,18 @@ void ff_tls_deinit(void); int ff_network_wait_fd(int fd, int write); +/** + * This works similarly to ff_network_wait_fd, but waits up to 'timeout' microseconds + * Uses ff_network_wait_fd in a loop + * + * @fd Socket descriptor + * @write Set 1 to wait for socket able to be read, 0 to be written + * @timeout Timeout interval, in microseconds. Actual precision is 100000 mcs, due to ff_network_wait_fd usage + * @param int_cb Interrupt callback, is checked after each ff_network_wait_fd call + * @return 0 if data can be read/written, AVERROR(ETIMEDOUT) if timeout expired, or negative error code + */ +int ff_network_wait_fd_timeout(int fd, int write, int64_t timeout, AVIOInterruptCB *int_cb); + int ff_inet_aton (const char * str, struct in_addr * add); #if !HAVE_STRUCT_SOCKADDR_STORAGE -- cgit v1.2.3