| ... | ... |
@@ -99,6 +99,7 @@ typedef struct AppleHTTPContext {
|
| 99 | 99 |
int cur_seq_no; |
| 100 | 100 |
int end_of_segment; |
| 101 | 101 |
int first_packet; |
| 102 |
+ AVIOInterruptCB *interrupt_callback; |
|
| 102 | 103 |
} AppleHTTPContext; |
| 103 | 104 |
|
| 104 | 105 |
static int read_chomp_line(AVIOContext *s, char *buf, int maxlen) |
| ... | ... |
@@ -388,7 +389,7 @@ reload: |
| 388 | 388 |
return AVERROR_EOF; |
| 389 | 389 |
while (av_gettime() - v->last_load_time < |
| 390 | 390 |
v->target_duration*1000000) {
|
| 391 |
- if (url_interrupt_cb()) |
|
| 391 |
+ if (ff_check_interrupt(c->interrupt_callback)) |
|
| 392 | 392 |
return AVERROR_EXIT; |
| 393 | 393 |
usleep(100*1000); |
| 394 | 394 |
} |
| ... | ... |
@@ -433,6 +434,8 @@ static int applehttp_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 433 | 433 |
AppleHTTPContext *c = s->priv_data; |
| 434 | 434 |
int ret = 0, i, j, stream_offset = 0; |
| 435 | 435 |
|
| 436 |
+ c->interrupt_callback = &s->interrupt_callback; |
|
| 437 |
+ |
|
| 436 | 438 |
if ((ret = parse_playlist(c, s->filename, NULL, s->pb)) < 0) |
| 437 | 439 |
goto fail; |
| 438 | 440 |
|
| ... | ... |
@@ -266,7 +266,7 @@ retry: |
| 266 | 266 |
if (s->finished) |
| 267 | 267 |
return AVERROR_EOF; |
| 268 | 268 |
while (av_gettime() - s->last_load_time < s->target_duration*1000000) {
|
| 269 |
- if (url_interrupt_cb()) |
|
| 269 |
+ if (ff_check_interrupt(&h->interrupt_callback)) |
|
| 270 | 270 |
return AVERROR_EXIT; |
| 271 | 271 |
usleep(100*1000); |
| 272 | 272 |
} |
| ... | ... |
@@ -276,7 +276,7 @@ retry: |
| 276 | 276 |
av_log(h, AV_LOG_DEBUG, "opening %s\n", url); |
| 277 | 277 |
ret = ffurl_open(&s->seg_hd, url, AVIO_FLAG_READ); |
| 278 | 278 |
if (ret < 0) {
|
| 279 |
- if (url_interrupt_cb()) |
|
| 279 |
+ if (ff_check_interrupt(&h->interrupt_callback)) |
|
| 280 | 280 |
return AVERROR_EXIT; |
| 281 | 281 |
av_log(h, AV_LOG_WARNING, "Unable to open %s\n", url); |
| 282 | 282 |
s->cur_seq_no++; |
| ... | ... |
@@ -284,7 +284,7 @@ static inline int retry_transfer_wrapper(URLContext *h, unsigned char *buf, int |
| 284 | 284 |
if (ret) |
| 285 | 285 |
fast_retries = FFMAX(fast_retries, 2); |
| 286 | 286 |
len += ret; |
| 287 |
- if (url_interrupt_cb()) |
|
| 287 |
+ if (ff_check_interrupt(&h->interrupt_callback)) |
|
| 288 | 288 |
return AVERROR_EXIT; |
| 289 | 289 |
} |
| 290 | 290 |
return len; |
| ... | ... |
@@ -226,7 +226,7 @@ static int rtp_read(URLContext *h, uint8_t *buf, int size) |
| 226 | 226 |
struct pollfd p[2] = {{s->rtp_fd, POLLIN, 0}, {s->rtcp_fd, POLLIN, 0}};
|
| 227 | 227 |
|
| 228 | 228 |
for(;;) {
|
| 229 |
- if (url_interrupt_cb()) |
|
| 229 |
+ if (ff_check_interrupt(&h->interrupt_callback)) |
|
| 230 | 230 |
return AVERROR_EXIT; |
| 231 | 231 |
/* build fdset to listen to RTP and RTCP packets */ |
| 232 | 232 |
n = poll(p, 2, 100); |
| ... | ... |
@@ -1619,7 +1619,7 @@ static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st, |
| 1619 | 1619 |
struct pollfd *p = rt->p; |
| 1620 | 1620 |
|
| 1621 | 1621 |
for (;;) {
|
| 1622 |
- if (url_interrupt_cb()) |
|
| 1622 |
+ if (ff_check_interrupt(&s->interrupt_callback)) |
|
| 1623 | 1623 |
return AVERROR_EXIT; |
| 1624 | 1624 |
if (wait_end && wait_end - av_gettime() < 0) |
| 1625 | 1625 |
return AVERROR(EAGAIN); |
| ... | ... |
@@ -100,7 +100,7 @@ static int tcp_open(URLContext *h, const char *uri, int flags) |
| 100 | 100 |
struct pollfd p = {fd, POLLOUT, 0};
|
| 101 | 101 |
ret = ff_neterrno(); |
| 102 | 102 |
if (ret == AVERROR(EINTR)) {
|
| 103 |
- if (url_interrupt_cb()) {
|
|
| 103 |
+ if (ff_check_interrupt(&h->interrupt_callback)) {
|
|
| 104 | 104 |
ret = AVERROR_EXIT; |
| 105 | 105 |
goto fail1; |
| 106 | 106 |
} |
| ... | ... |
@@ -112,7 +112,7 @@ static int tcp_open(URLContext *h, const char *uri, int flags) |
| 112 | 112 |
|
| 113 | 113 |
/* wait until we are connected or until abort */ |
| 114 | 114 |
while(timeout--) {
|
| 115 |
- if (url_interrupt_cb()) {
|
|
| 115 |
+ if (ff_check_interrupt(&h->interrupt_callback)) {
|
|
| 116 | 116 |
ret = AVERROR_EXIT; |
| 117 | 117 |
goto fail1; |
| 118 | 118 |
} |
| ... | ... |
@@ -2310,7 +2310,7 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) |
| 2310 | 2310 |
count = 0; |
| 2311 | 2311 |
read_size = 0; |
| 2312 | 2312 |
for(;;) {
|
| 2313 |
- if(url_interrupt_cb()){
|
|
| 2313 |
+ if (ff_check_interrupt(&ic->interrupt_callback)){
|
|
| 2314 | 2314 |
ret= AVERROR_EXIT; |
| 2315 | 2315 |
av_log(ic, AV_LOG_DEBUG, "interrupted\n"); |
| 2316 | 2316 |
break; |