#include "libavutil/mathematics.h"
#include "libavutil/opt.h"
#include "libavutil/dict.h"
+#include "libavutil/time.h"
#include "avformat.h"
#include "internal.h"
-#include <unistd.h>
#include "avio_internal.h"
#include "url.h"
while (av_gettime() - v->last_load_time < reload_interval) {
if (ff_check_interrupt(c->interrupt_callback))
return AVERROR_EXIT;
- usleep(100*1000);
+ av_usleep(100*1000);
}
/* Enough time has elapsed since the last reload */
goto reload;
ret = ffurl_read(v->input, buf, buf_size);
if (ret > 0)
return ret;
- if (ret < 0 && ret != AVERROR_EOF)
- return ret;
ffurl_close(v->input);
v->input = NULL;
v->cur_seq_no++;
av_free_packet(&var->pkt);
reset_packet(&var->pkt);
var->pb.eof_reached = 0;
+ /* Clear any buffered data */
+ var->pb.buf_end = var->pb.buf_ptr = var->pb.buffer;
+ /* Reset the pos, to let the mpegts demuxer know we've seeked. */
+ var->pb.pos = 0;
/* Locate the segment that contains the target timestamp */
for (j = 0; j < var->n_segments; j++) {
AVInputFormat ff_hls_demuxer = {
.name = "hls,applehttp",
- .long_name = NULL_IF_CONFIG_SMALL("Apple HTTP Live Streaming format"),
+ .long_name = NULL_IF_CONFIG_SMALL("Apple HTTP Live Streaming"),
.priv_data_size = sizeof(HLSContext),
.read_probe = hls_probe,
.read_header = hls_read_header,