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