Browse code

avformat: add writeout_count statistic

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

Michael Niedermayer authored on 2013/04/08 20:21:34
Showing 2 changed files
... ...
@@ -140,6 +140,12 @@ typedef struct AVIOContext {
140 140
      * This field is internal to libavformat and access from outside is not allowed.
141 141
      */
142 142
      int seek_count;
143
+
144
+    /**
145
+     * writeout statistic
146
+     * This field is internal to libavformat and access from outside is not allowed.
147
+     */
148
+     int writeout_count;
143 149
 } AVIOContext;
144 150
 
145 151
 /* unbuffered I/O */
... ...
@@ -131,6 +131,7 @@ static void writeout(AVIOContext *s, const uint8_t *data, int len)
131 131
             s->error = ret;
132 132
         }
133 133
     }
134
+    s->writeout_count ++;
134 135
     s->pos += len;
135 136
 }
136 137
 
... ...
@@ -827,7 +828,9 @@ int avio_close(AVIOContext *s)
827 827
     avio_flush(s);
828 828
     h = s->opaque;
829 829
     av_freep(&s->buffer);
830
-    if (!s->write_flag)
830
+    if (s->write_flag)
831
+        av_log(s, AV_LOG_DEBUG, "Statistics: %d seeks, %d writeouts\n", s->seek_count, s->writeout_count);
832
+    else
831 833
         av_log(s, AV_LOG_DEBUG, "Statistics: %"PRId64" bytes read, %d seeks\n", s->bytes_read, s->seek_count);
832 834
     av_free(s);
833 835
     return ffurl_close(h);