Revision f87b1b37 libavformat/avio.c
libavformat/avio.c | ||
---|---|---|
144 | 144 |
return err; |
145 | 145 |
uc->is_connected = 1; |
146 | 146 |
//We must be careful here as ffurl_seek() could be slow, for example for http |
147 |
if( (uc->flags & (URL_WRONLY | URL_RDWR))
|
|
147 |
if( (uc->flags & (AVIO_WRONLY | AVIO_RDWR))
|
|
148 | 148 |
|| !strcmp(uc->prot->name, "file")) |
149 | 149 |
if(!uc->is_streamed && ffurl_seek(uc, 0, SEEK_SET) < 0) |
150 | 150 |
uc->is_streamed= 1; |
... | ... | |
275 | 275 |
ret = transfer_func(h, buf+len, size-len); |
276 | 276 |
if (ret == AVERROR(EINTR)) |
277 | 277 |
continue; |
278 |
if (h->flags & URL_FLAG_NONBLOCK)
|
|
278 |
if (h->flags & AVIO_FLAG_NONBLOCK)
|
|
279 | 279 |
return ret; |
280 | 280 |
if (ret == AVERROR(EAGAIN)) { |
281 | 281 |
ret = 0; |
... | ... | |
296 | 296 |
|
297 | 297 |
int ffurl_read(URLContext *h, unsigned char *buf, int size) |
298 | 298 |
{ |
299 |
if (h->flags & URL_WRONLY)
|
|
299 |
if (h->flags & AVIO_WRONLY)
|
|
300 | 300 |
return AVERROR(EIO); |
301 | 301 |
return retry_transfer_wrapper(h, buf, size, 1, h->prot->url_read); |
302 | 302 |
} |
303 | 303 |
|
304 | 304 |
int ffurl_read_complete(URLContext *h, unsigned char *buf, int size) |
305 | 305 |
{ |
306 |
if (h->flags & URL_WRONLY)
|
|
306 |
if (h->flags & AVIO_WRONLY)
|
|
307 | 307 |
return AVERROR(EIO); |
308 | 308 |
return retry_transfer_wrapper(h, buf, size, size, h->prot->url_read); |
309 | 309 |
} |
310 | 310 |
|
311 | 311 |
int ffurl_write(URLContext *h, const unsigned char *buf, int size) |
312 | 312 |
{ |
313 |
if (!(h->flags & (URL_WRONLY | URL_RDWR)))
|
|
313 |
if (!(h->flags & (AVIO_WRONLY | AVIO_RDWR)))
|
|
314 | 314 |
return AVERROR(EIO); |
315 | 315 |
/* avoid sending too big packets */ |
316 | 316 |
if (h->max_packet_size && size > h->max_packet_size) |
... | ... | |
348 | 348 |
int url_exist(const char *filename) |
349 | 349 |
{ |
350 | 350 |
URLContext *h; |
351 |
if (ffurl_open(&h, filename, URL_RDONLY) < 0)
|
|
351 |
if (ffurl_open(&h, filename, AVIO_RDONLY) < 0)
|
|
352 | 352 |
return 0; |
353 | 353 |
ffurl_close(h); |
354 | 354 |
return 1; |
Also available in: Unified diff