summaryrefslogtreecommitdiff
path: root/libavformat/aviobuf.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-06-02 23:01:13 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-06-15 11:24:16 +0200
commit11153a9371a84d881809f43e60830d3ed8ae60b9 (patch)
treecc70e26589e995012e32099a6be62ba5a38758e8 /libavformat/aviobuf.c
parentf77a695d2e7c309823e69c6bf4078e5beaf61f13 (diff)
avio: Collect and print statistics of bytes read & seeks
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/aviobuf.c')
-rw-r--r--libavformat/aviobuf.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 45a8bad37e..d8451c56d4 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -237,6 +237,7 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
return AVERROR(EPIPE);
if ((res = s->seek(s->opaque, offset, SEEK_SET)) < 0)
return res;
+ s->seek_count ++;
if (!s->write_flag)
s->buf_end = s->buffer;
s->buf_ptr = s->buffer;
@@ -423,6 +424,7 @@ static void fill_buffer(AVIOContext *s)
s->pos += len;
s->buf_ptr = dst;
s->buf_end = dst + len;
+ s->bytes_read += len;
}
}
@@ -792,6 +794,8 @@ int avio_close(AVIOContext *s)
h = s->opaque;
av_free(s->buffer);
+ if (!s->write_flag)
+ av_log(s, AV_LOG_DEBUG, "Statistics: %"PRId64" bytes read, %d seeks\n", s->bytes_read, s->seek_count);
av_free(s);
return ffurl_close(h);
}