[FFmpeg-devel] [PATCH 1/2] Add 'rw_timeout' into URLContext
jamal
jamrial at gmail.com
Wed Aug 29 08:43:55 CEST 2012
On 29/08/12 1:56 AM, Andrey Utkin wrote:
> 2) Include network.h unconditionally to avio.c. The simplest &
> shortest, but somewhat incorrect solution.
This wont work. network.h defines ETIMEDOUT only when HAVE_WINSOCK2_H (and in turn CONFIG_NETWORK) is true.
> 4) Something like the below...
> --- a/libavformat/avio.c
> +++ b/libavformat/avio.c
> @@ -27,6 +27,8 @@
> #include "avformat.h"
> #if CONFIG_NETWORK
> #include "network.h"
> +#elif (!defined ETIMEDOUT)
> +#define ETIMEDOUT EAGAIN
> #endif
> #include "url.h"
>
I'd say either this, or moving the declaration from network.h to os_support.h.
It should be safe to define it without winsock2 support. Pthreads for Windows does it, for example.
os_support.h would need to either include winerror.h, or use the actual error codes.
--- a/libavformat/os_support.h
+++ b/libavformat/os_support.h
@@ -67,6 +67,20 @@
#ifndef S_IWUSR
#define S_IWUSR S_IWRITE
#endif
+
+#include <winerror.h>
+#ifndef EPROTONOSUPPORT
+#define EPROTONOSUPPORT WSAEPROTONOSUPPORT
+#endif
+#ifndef ETIMEDOUT
+#define ETIMEDOUT WSAETIMEDOUT
+#endif
+#ifndef ECONNREFUSED
+#define ECONNREFUSED WSAECONNREFUSED
+#endif
+#ifndef EINPROGRESS
+#define EINPROGRESS WSAEINPROGRESS
+#endif
#endif
or
--- a/libavformat/os_support.h
+++ b/libavformat/os_support.h
@@ -67,6 +67,19 @@
#ifndef S_IWUSR
#define S_IWUSR S_IWRITE
#endif
+
+#ifndef EPROTONOSUPPORT
+#define EPROTONOSUPPORT 10043L
+#endif
+#ifndef ETIMEDOUT
+#define ETIMEDOUT 10060L
+#endif
+#ifndef ECONNREFUSED
+#define ECONNREFUSED 10061L
+#endif
+#ifndef EINPROGRESS
+#define EINPROGRESS 10036L
+#endif
#endif
More information about the ffmpeg-devel
mailing list