diff options
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/avio.h | 14 | ||||
-rw-r--r-- | libavformat/avio_internal.h | 5 | ||||
-rw-r--r-- | libavformat/aviobuf.c | 10 | ||||
-rw-r--r-- | libavformat/version.h | 2 |
4 files changed, 27 insertions, 4 deletions
diff --git a/libavformat/avio.h b/libavformat/avio.h index 5e60c2e35c..cd63322a62 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -292,7 +292,9 @@ typedef struct AVIOContext { #if FF_API_AVIOCONTEXT_WRITTEN /** - * @deprecated field utilized privately by libavformat. + * @deprecated field utilized privately by libavformat. For a public + * statistic of how many bytes were written out, see + * AVIOContext::bytes_written. */ attribute_deprecated int64_t written; @@ -303,6 +305,16 @@ typedef struct AVIOContext { * used keeping track of already written data for a later flush. */ unsigned char *buf_ptr_max; + + /** + * Read-only statistic of bytes read for this AVIOContext. + */ + int64_t bytes_read; + + /** + * Read-only statistic of bytes written for this AVIOContext. + */ + int64_t bytes_written; } AVIOContext; /** diff --git a/libavformat/avio_internal.h b/libavformat/avio_internal.h index 467e80701f..187433f283 100644 --- a/libavformat/avio_internal.h +++ b/libavformat/avio_internal.h @@ -52,6 +52,11 @@ typedef struct FFIOContext { int64_t bytes_read; /** + * Bytes written statistic + */ + int64_t bytes_written; + + /** * seek statistic */ int seek_count; diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index f21f1c89df..5da4dea7b6 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -169,6 +169,9 @@ static void writeout(AVIOContext *s, const uint8_t *data, int len) if (ret < 0) { s->error = ret; } else { + ctx->bytes_written += len; + s->bytes_written = ctx->bytes_written; + if (s->pos + len > ctx->written_output_size) { ctx->written_output_size = s->pos + len; #if FF_API_AVIOCONTEXT_WRITTEN @@ -584,6 +587,7 @@ static void fill_buffer(AVIOContext *s) s->buf_ptr = dst; s->buf_end = dst + len; ffiocontext(s)->bytes_read += len; + s->bytes_read = ffiocontext(s)->bytes_read; } } @@ -657,6 +661,7 @@ int avio_read(AVIOContext *s, unsigned char *buf, int size) } else { s->pos += len; ffiocontext(s)->bytes_read += len; + s->bytes_read = ffiocontext(s)->bytes_read; size -= len; buf += len; // reset the buffer @@ -1236,8 +1241,9 @@ int avio_close(AVIOContext *s) av_freep(&s->buffer); if (s->write_flag) - av_log(s, AV_LOG_VERBOSE, "Statistics: %d seeks, %d writeouts\n", - ctx->seek_count, ctx->writeout_count); + av_log(s, AV_LOG_VERBOSE, + "Statistics: %"PRId64" bytes written, %d seeks, %d writeouts\n", + ctx->bytes_written, ctx->seek_count, ctx->writeout_count); else av_log(s, AV_LOG_VERBOSE, "Statistics: %"PRId64" bytes read, %d seeks\n", ctx->bytes_read, ctx->seek_count); diff --git a/libavformat/version.h b/libavformat/version.h index de780124c7..81ed517609 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -32,7 +32,7 @@ // Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium) // Also please add any ticket numbers that you believe might be affected here #define LIBAVFORMAT_VERSION_MAJOR 59 -#define LIBAVFORMAT_VERSION_MINOR 7 +#define LIBAVFORMAT_VERSION_MINOR 8 #define LIBAVFORMAT_VERSION_MICRO 100 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ |