diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-06-30 22:44:18 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-06-30 22:44:18 +0200 |
commit | 64b25938e90253432d28ffd7d971f085c560a523 (patch) | |
tree | 56ba6a39d7e8f14ebccdcc4db935164b5da624a2 /libavformat | |
parent | be24f85176d8e46c3154f1f51013f235b273183e (diff) | |
parent | ceabc13f129cd6344b1eebdbe10119083fe5520e (diff) | |
download | ffmpeg-64b25938e90253432d28ffd7d971f085c560a523.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
dsputilenc_mmx: split assignment of ff_sse16_sse2 to SSE2 section.
dnxhdenc: add space between function argument type and comment.
x86: fmtconvert: add special asm for float_to_int16_interleave_misc_*
attributes: Add a definition of av_always_inline for MSVC
cmdutils: Pass the actual chosen encoder to filter_codec_opts
os_support: Add fallback definitions for stat flags
os_support: Rename the poll fallback function to ff_poll
network: Check for struct pollfd
os_support: Don't compare a negative number against socket descriptors
os_support: Include all the necessary headers for the win32 open function
x86: vc1: fix and enable optimised loop filter
Conflicts:
cmdutils.c
cmdutils.h
ffmpeg.c
ffplay.c
libavformat/os_support.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/os_support.c | 18 | ||||
-rw-r--r-- | libavformat/os_support.h | 17 |
2 files changed, 26 insertions, 9 deletions
diff --git a/libavformat/os_support.c b/libavformat/os_support.c index fd3836d574..a5f51e5845 100644 --- a/libavformat/os_support.c +++ b/libavformat/os_support.c @@ -28,10 +28,12 @@ #include "os_support.h" #if defined(_WIN32) && !defined(__MINGW32CE__) +#undef open +#include <fcntl.h> +#include <io.h> #include <windows.h> #include <share.h> -#undef open int ff_win32_open(const char *filename_utf8, int oflag, int pmode) { int fd; @@ -265,7 +267,7 @@ int ff_socket_nonblock(int socket, int enable) } #if !HAVE_POLL_H -int poll(struct pollfd *fds, nfds_t numfds, int timeout) +int ff_poll(struct pollfd *fds, nfds_t numfds, int timeout) { fd_set read_set; fd_set write_set; @@ -285,7 +287,7 @@ int poll(struct pollfd *fds, nfds_t numfds, int timeout) FD_ZERO(&write_set); FD_ZERO(&exception_set); - n = -1; + n = 0; for(i = 0; i < numfds; i++) { if (fds[i].fd < 0) continue; @@ -300,22 +302,22 @@ int poll(struct pollfd *fds, nfds_t numfds, int timeout) if (fds[i].events & POLLOUT) FD_SET(fds[i].fd, &write_set); if (fds[i].events & POLLERR) FD_SET(fds[i].fd, &exception_set); - if (fds[i].fd > n) - n = fds[i].fd; + if (fds[i].fd >= n) + n = fds[i].fd + 1; }; - if (n == -1) + if (n == 0) /* Hey!? Nothing to poll, in fact!!! */ return 0; if (timeout < 0) - rc = select(n+1, &read_set, &write_set, &exception_set, NULL); + rc = select(n, &read_set, &write_set, &exception_set, NULL); else { struct timeval tv; tv.tv_sec = timeout / 1000; tv.tv_usec = 1000 * (timeout % 1000); - rc = select(n+1, &read_set, &write_set, &exception_set, &tv); + rc = select(n, &read_set, &write_set, &exception_set, &tv); }; if (rc < 0) diff --git a/libavformat/os_support.h b/libavformat/os_support.h index bf2698405b..6110a334d1 100644 --- a/libavformat/os_support.h +++ b/libavformat/os_support.h @@ -29,6 +29,8 @@ #include "config.h" +#include <sys/stat.h> + #if defined(__MINGW32__) && !defined(__MINGW32CE__) # include <fcntl.h> # ifdef lseek @@ -58,6 +60,13 @@ static inline int is_dos_path(const char *path) #define SHUT_RD SD_RECEIVE #define SHUT_WR SD_SEND #define SHUT_RDWR SD_BOTH + +#ifndef S_IRUSR +#define S_IRUSR S_IREAD +#endif +#ifndef S_IWUSR +#define S_IWUSR S_IWRITE +#endif #endif #if defined(_WIN32) && !defined(__MINGW32CE__) @@ -78,6 +87,10 @@ typedef int socklen_t; #if !HAVE_POLL_H typedef unsigned long nfds_t; +#if HAVE_WINSOCK2_H +#include <winsock2.h> +#endif +#if !HAVE_STRUCT_POLLFD struct pollfd { int fd; short events; /* events to look for */ @@ -97,9 +110,11 @@ struct pollfd { #define POLLERR 0x0004 /* errors pending */ #define POLLHUP 0x0080 /* disconnected */ #define POLLNVAL 0x1000 /* invalid file descriptor */ +#endif -int poll(struct pollfd *fds, nfds_t numfds, int timeout); +int ff_poll(struct pollfd *fds, nfds_t numfds, int timeout); +#define poll ff_poll #endif /* HAVE_POLL_H */ #endif /* CONFIG_NETWORK */ |