[FFmpeg-cvslog] avformat: add writeout_count statistic

Michael Niedermayer git at videolan.org
Mon Apr 8 13:55:52 CEST 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Mon Apr  8 13:21:34 2013 +0200| [ad6a50c0ed39d30f3acbe57c29df8119e1379a3c] | committer: Michael Niedermayer

avformat: add writeout_count statistic

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ad6a50c0ed39d30f3acbe57c29df8119e1379a3c
---

 libavformat/avio.h    |    6 ++++++
 libavformat/aviobuf.c |    5 ++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/libavformat/avio.h b/libavformat/avio.h
index 8de28bf..1d692a1 100644
--- a/libavformat/avio.h
+++ b/libavformat/avio.h
@@ -140,6 +140,12 @@ typedef struct AVIOContext {
      * This field is internal to libavformat and access from outside is not allowed.
      */
      int seek_count;
+
+    /**
+     * writeout statistic
+     * This field is internal to libavformat and access from outside is not allowed.
+     */
+     int writeout_count;
 } AVIOContext;
 
 /* unbuffered I/O */
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 7a73a17..966e0e6 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -131,6 +131,7 @@ static void writeout(AVIOContext *s, const uint8_t *data, int len)
             s->error = ret;
         }
     }
+    s->writeout_count ++;
     s->pos += len;
 }
 
@@ -827,7 +828,9 @@ int avio_close(AVIOContext *s)
     avio_flush(s);
     h = s->opaque;
     av_freep(&s->buffer);
-    if (!s->write_flag)
+    if (s->write_flag)
+        av_log(s, AV_LOG_DEBUG, "Statistics: %d seeks, %d writeouts\n", s->seek_count, s->writeout_count);
+    else
         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);



More information about the ffmpeg-cvslog mailing list