Revision ddb901b7
libavformat/avio.c | ||
---|---|---|
156 | 156 |
len = 0; |
157 | 157 |
while (len < size) { |
158 | 158 |
ret = url_read(h, buf+len, size-len); |
159 |
if (ret < 1) |
|
160 |
return ret; |
|
159 |
if (ret == AVERROR(EAGAIN)) { |
|
160 |
ret = 0; |
|
161 |
} else if (ret < 1) |
|
162 |
return ret < 0 ? ret : len; |
|
161 | 163 |
len += ret; |
162 | 164 |
} |
163 | 165 |
return len; |
libavformat/avio.h | ||
---|---|---|
69 | 69 |
const char *filename, int flags); |
70 | 70 |
int url_open(URLContext **h, const char *filename, int flags); |
71 | 71 |
int url_read(URLContext *h, unsigned char *buf, int size); |
72 |
/** |
|
73 |
* Read as many bytes as possible (up to size), calling the |
|
74 |
* read function multiple times if necessary. |
|
75 |
* Will also retry if the read function returns AVERROR(EAGAIN). |
|
76 |
* This makes special short-read handling in applications |
|
77 |
* unnecessary, if the return value is < size then it is |
|
78 |
* certain there was either an error or the end of file was reached. |
|
79 |
*/ |
|
72 | 80 |
int url_read_complete(URLContext *h, unsigned char *buf, int size); |
73 | 81 |
int url_write(URLContext *h, unsigned char *buf, int size); |
74 | 82 |
int64_t url_seek(URLContext *h, int64_t pos, int whence); |
Also available in: Unified diff