diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-11-06 02:18:50 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-11-06 02:23:34 +0100 |
commit | d8cab5c26b0987f139830937e1f30b2a10822680 (patch) | |
tree | 1328facddcdaeac6881f32b7b3511806a68d2111 /libavformat/network.h | |
parent | 3b4798a87375c6090215185a87d51358cbb5af84 (diff) | |
parent | 18ae3626405a8b3d6dbb7e5b848d354cd7bf9a47 (diff) | |
download | ffmpeg-d8cab5c26b0987f139830937e1f30b2a10822680.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
http: Remove the custom function for disabling chunked posts
rtsp: Disable chunked http post through AVOptions
movdec: Set frame_size for AMR
h264_weight: remove duplication functions.
swscale: align vertical filtersize by 2 on x86.
libavfilter: reindent.
matroskadec: empty blocks are in fact valid.
avfilter: don't abort() on zero-size allocations.
h264: improve calculation of codec delay.
movenc: Set a correct packet size for AMR-NB mode 15, "no data"
avformat: Add functions for doing global network initialization
avformat: Add the https protocol
avformat: Add the tls protocol, using OpenSSL or gnutls
avformat: Initialize gnutls in ff_tls_init()
w32threads: Wrap the mutex functions in inline functions returning int
configure: Allow linking to the gnutls library
avformat: Add ff_tls_init()/deinit() that initialize OpenSSL
configure: Allow linking to openssl
avcodec: Allow locking and unlocking an avformat specific mutex
avformat: Split out functions from network.h to a new file, network.c
Conflicts:
Changelog
configure
doc/APIchanges
libavcodec/internal.h
libavcodec/version.h
libavfilter/formats.c
libavformat/matroskadec.c
libavformat/mov.c
libavformat/version.h
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/network.h')
-rw-r--r-- | libavformat/network.h | 58 |
1 files changed, 9 insertions, 49 deletions
diff --git a/libavformat/network.h b/libavformat/network.h index f7e19b196e..cfbbd83ab2 100644 --- a/libavformat/network.h +++ b/libavformat/network.h @@ -36,17 +36,7 @@ #define ECONNREFUSED WSAECONNREFUSED #define EINPROGRESS WSAEINPROGRESS -static inline int ff_neterrno(void) -{ - int err = WSAGetLastError(); - switch (err) { - case WSAEWOULDBLOCK: - return AVERROR(EAGAIN); - case WSAEINTR: - return AVERROR(EINTR); - } - return -err; -} +int ff_neterrno(void); #else #include <sys/types.h> #include <sys/socket.h> @@ -66,31 +56,13 @@ static inline int ff_neterrno(void) int ff_socket_nonblock(int socket, int enable); -static inline int ff_network_init(void) -{ -#if HAVE_WINSOCK2_H - WSADATA wsaData; - if (WSAStartup(MAKEWORD(1,1), &wsaData)) - return 0; -#endif - return 1; -} - -static inline int ff_network_wait_fd(int fd, int write) -{ - int ev = write ? POLLOUT : POLLIN; - struct pollfd p = { .fd = fd, .events = ev, .revents = 0 }; - int ret; - ret = poll(&p, 1, 100); - return ret < 0 ? ff_neterrno() : p.revents & (ev | POLLERR | POLLHUP) ? 0 : AVERROR(EAGAIN); -} - -static inline void ff_network_close(void) -{ -#if HAVE_WINSOCK2_H - WSACleanup(); -#endif -} +int ff_network_init(void); +void ff_network_close(void); + +void ff_tls_init(void); +void ff_tls_deinit(void); + +int ff_network_wait_fd(int fd, int write); int ff_inet_aton (const char * str, struct in_addr * add); @@ -191,18 +163,6 @@ const char *ff_gai_strerror(int ecode); #define IN6_IS_ADDR_MULTICAST(a) (((uint8_t *) (a))[0] == 0xff) #endif -static inline int ff_is_multicast_address(struct sockaddr *addr) -{ - if (addr->sa_family == AF_INET) { - return IN_MULTICAST(ntohl(((struct sockaddr_in *)addr)->sin_addr.s_addr)); - } -#if HAVE_STRUCT_SOCKADDR_IN6 - if (addr->sa_family == AF_INET6) { - return IN6_IS_ADDR_MULTICAST(&((struct sockaddr_in6 *)addr)->sin6_addr); - } -#endif - - return 0; -} +int ff_is_multicast_address(struct sockaddr *addr); #endif /* AVFORMAT_NETWORK_H */ |