]> git.sesse.net Git - ffmpeg/commitdiff
avformat: add writeout_count statistic
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 8 Apr 2013 11:21:34 +0000 (13:21 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 8 Apr 2013 11:30:40 +0000 (13:30 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/avio.h
libavformat/aviobuf.c

index 8de28bf1d14353d3932999d090873725f5454840..1d692a167bec1e5a5f0d849fdeba75095092a494 100644 (file)
@@ -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 */
index 7a73a1791f974598561468dbf0bf914fa7811b38..966e0e6a3dbad6f20c381c3625c6a662efeaea7d 100644 (file)
@@ -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);