diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-08-06 17:02:23 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-08-06 17:02:27 +0400 |
commit | 8878aef04882f1bb6db9f56a2b228865e1c2bb75 (patch) | |
tree | 468edd2d79b78c56fda6a5119009ba56e7ce699d /libavformat/aviobuf.c | |
parent | 7ed002d79136c2e24d12b432852a271b235fc3b9 (diff) | |
parent | daf1e0d3de03bd424016e2a7520e4e94ece5c0ac (diff) |
Merge commit 'daf1e0d3de03bd424016e2a7520e4e94ece5c0ac'
* commit 'daf1e0d3de03bd424016e2a7520e4e94ece5c0ac':
avio: Add an internal function for reading without copying
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/aviobuf.c')
-rw-r--r-- | libavformat/aviobuf.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index 6efc0cfae0..466f3908b5 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -525,6 +525,18 @@ int avio_read(AVIOContext *s, unsigned char *buf, int size) return size1 - size; } +int ffio_read_indirect(AVIOContext *s, unsigned char *buf, int size, unsigned char **data) +{ + if (s->buf_end - s->buf_ptr >= size && !s->write_flag) { + *data = s->buf_ptr; + s->buf_ptr += size; + return size; + } else { + *data = buf; + return avio_read(s, buf, size); + } +} + int ffio_read_partial(AVIOContext *s, unsigned char *buf, int size) { int len; |