[FFmpeg-cvslog] lavf: update AVStream.nb_frames when muxing.

Anton Khirnov git at videolan.org
Sat Jul 9 02:09:53 CEST 2011


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Wed Mar 16 08:45:14 2011 +0100| [1c6d2b7df061de2a9205ed711f4344926237bb5f] | committer: Anton Khirnov

lavf: update AVStream.nb_frames when muxing.

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

 libavformat/matroskaenc.c |    2 +-
 libavformat/utils.c       |    7 +++++++
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index d132b65..169e8e4 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -932,7 +932,7 @@ static int mkv_write_ass_blocks(AVFormatContext *s, AVIOContext *pb, AVPacket *p
         size -= start - data;
         sscanf(data, "Dialogue: %d,", &layer);
         i = snprintf(buffer, sizeof(buffer), "%"PRId64",%d,",
-                     s->streams[pkt->stream_index]->nb_frames++, layer);
+                     s->streams[pkt->stream_index]->nb_frames, layer);
         size = FFMIN(i+size, sizeof(buffer));
         memcpy(buffer+i, start, size-i);
 
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 060e58e..e38d9ef 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3023,6 +3023,9 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt)
         return ret;
 
     ret= s->oformat->write_packet(s, pkt);
+
+    if (ret >= 0)
+        s->streams[pkt->stream_index]->nb_frames++;
     return ret;
 }
 
@@ -3143,6 +3146,8 @@ int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt){
             return ret;
 
         ret= s->oformat->write_packet(s, &opkt);
+        if (ret >= 0)
+            s->streams[opkt.stream_index]->nb_frames++;
 
         av_free_packet(&opkt);
         pkt= NULL;
@@ -3165,6 +3170,8 @@ int av_write_trailer(AVFormatContext *s)
             break;
 
         ret= s->oformat->write_packet(s, &pkt);
+        if (ret >= 0)
+            s->streams[pkt.stream_index]->nb_frames++;
 
         av_free_packet(&pkt);
 



More information about the ffmpeg-cvslog mailing list