This reduces the dependency on unistd.h which is not available on all systems.
Showing the changes to libavformat (4 of 8 files). Show all
Unified · Split
| @@ -19,11 +19,10 @@ · 18 unmodified lines | |||
| 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 | */ | 20 | */ |
| 21 | 21 | ||
| 22 | #include <unistd.h> | ||
| 23 | |||
| 24 | #include "libavutil/avstring.h" | 22 | #include "libavutil/avstring.h" |
| 25 | #include "libavutil/dict.h" | 23 | #include "libavutil/dict.h" |
| 26 | #include "libavutil/opt.h" | 24 | #include "libavutil/opt.h" |
| 25 | #include "libavutil/time.h" | ||
| 27 | #include "os_support.h" | 26 | #include "os_support.h" |
| 28 | #include "avformat.h" | 27 | #include "avformat.h" |
| 29 | #if CONFIG_NETWORK | 28 | #if CONFIG_NETWORK |
| @@ -237,7 +236,7 @@ static inline int retry_transfer_wrapper(URLContext *h, unsigned char *buf, int · 207 unmodified lines | |||
| 237 | if (fast_retries) | 236 | if (fast_retries) |
| 238 | fast_retries--; | 237 | fast_retries--; |
| 239 | else | 238 | else |
| 240 | usleep(1000); | 239 | av_usleep(1000); |
| 241 | } else if (ret < 1) | 240 | } else if (ret < 1) |
| 242 | return ret < 0 ? ret : len; | 241 | return ret < 0 ? ret : len; |
| 243 | if (ret) | 242 | if (ret) |
| @@ -30,9 +30,9 @@ · 29 unmodified lines | |||
| 30 | #include "libavutil/mathematics.h" | 30 | #include "libavutil/mathematics.h" |
| 31 | #include "libavutil/opt.h" | 31 | #include "libavutil/opt.h" |
| 32 | #include "libavutil/dict.h" | 32 | #include "libavutil/dict.h" |
| 33 | #include "libavutil/time.h" | ||
| 33 | #include "avformat.h" | 34 | #include "avformat.h" |
| 34 | #include "internal.h" | 35 | #include "internal.h" |
| 35 | #include <unistd.h> | ||
| 36 | #include "avio_internal.h" | 36 | #include "avio_internal.h" |
| 37 | #include "url.h" | 37 | #include "url.h" |
| 38 | 38 | ||
| @@ -407,7 +407,7 @@ reload: · 368 unmodified lines | |||
| 407 | while (av_gettime() - v->last_load_time < reload_interval) { | 407 | while (av_gettime() - v->last_load_time < reload_interval) { |
| 408 | if (ff_check_interrupt(c->interrupt_callback)) | 408 | if (ff_check_interrupt(c->interrupt_callback)) |
| 409 | return AVERROR_EXIT; | 409 | return AVERROR_EXIT; |
| 410 | usleep(100*1000); | 410 | av_usleep(100*1000); |
| 411 | } | 411 | } |
| 412 | /* Enough time has elapsed since the last reload */ | 412 | /* Enough time has elapsed since the last reload */ |
| 413 | goto reload; | 413 | goto reload; |
| @@ -26,11 +26,11 @@ · 25 unmodified lines | |||
| 26 | */ | 26 | */ |
| 27 | 27 | ||
| 28 | #include "libavutil/avstring.h" | 28 | #include "libavutil/avstring.h" |
| 29 | #include "libavutil/time.h" | ||
| 29 | #include "avformat.h" | 30 | #include "avformat.h" |
| 30 | #include "internal.h" | 31 | #include "internal.h" |
| 31 | #include "url.h" | 32 | #include "url.h" |
| 32 | #include "version.h" | 33 | #include "version.h" |
| 33 | #include <unistd.h> | ||
| 34 | 34 | ||
| 35 | /* | 35 | /* |
| 36 | * An apple http stream consists of a playlist with media segment files, | 36 | * An apple http stream consists of a playlist with media segment files, |
| @@ -308,7 +308,7 @@ retry: · 271 unmodified lines | |||
| 308 | while (av_gettime() - s->last_load_time < reload_interval) { | 308 | while (av_gettime() - s->last_load_time < reload_interval) { |
| 309 | if (ff_check_interrupt(&h->interrupt_callback)) | 309 | if (ff_check_interrupt(&h->interrupt_callback)) |
| 310 | return AVERROR_EXIT; | 310 | return AVERROR_EXIT; |
| 311 | usleep(100*1000); | 311 | av_usleep(100*1000); |
| 312 | } | 312 | } |
| 313 | goto retry; | 313 | goto retry; |
| 314 | } | 314 | } |
| @@ -24,11 +24,10 @@ · 23 unmodified lines | |||
| 24 | * RTMP HTTP protocol | 24 | * RTMP HTTP protocol |
| 25 | */ | 25 | */ |
| 26 | 26 | ||
| 27 | #include <unistd.h> | ||
| 28 | |||
| 29 | #include "libavutil/avstring.h" | 27 | #include "libavutil/avstring.h" |
| 30 | #include "libavutil/intfloat.h" | 28 | #include "libavutil/intfloat.h" |
| 31 | #include "libavutil/opt.h" | 29 | #include "libavutil/opt.h" |
| 30 | #include "libavutil/time.h" | ||
| 32 | #include "internal.h" | 31 | #include "internal.h" |
| 33 | #include "http.h" | 32 | #include "http.h" |
| 34 | 33 | ||
| @@ -126,7 +125,7 @@ static int rtmp_http_read(URLContext *h, uint8_t *buf, int size) · 91 unmodified lines | |||
| 126 | if (rt->nb_bytes_read == 0) { | 125 | if (rt->nb_bytes_read == 0) { |
| 127 | /* Wait 50ms before retrying to read a server reply in | 126 | /* Wait 50ms before retrying to read a server reply in |
| 128 | * order to reduce the number of idle requets. */ | 127 | * order to reduce the number of idle requets. */ |
| 129 | usleep(50000); | 128 | av_usleep(50000); |
| 130 | } | 129 | } |
| 131 | 130 | ||
| 132 | if ((ret = rtmp_http_write(h, "", 1)) < 0) | 131 | if ((ret = rtmp_http_write(h, "", 1)) < 0) |