[FFmpeg-devel] [PATCH] lavf/ape: Fix last packet duration calculation

Paul B Mahol onemda at gmail.com
Sat Aug 25 14:20:38 CEST 2012


Signed-off-by: Paul B Mahol <onemda at gmail.com>
---
 libavformat/ape.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/libavformat/ape.c b/libavformat/ape.c
index c4a390b..9c05cee 100644
--- a/libavformat/ape.c
+++ b/libavformat/ape.c
@@ -45,7 +45,6 @@ typedef struct {
     int nblocks;
     int size;
     int skip;
-    int64_t pts;
 } APEFrame;
 
 typedef struct {
@@ -344,8 +343,7 @@ static int ape_read_header(AVFormatContext * s)
 
     pts = 0;
     for (i = 0; i < ape->totalframes; i++) {
-        ape->frames[i].pts = pts;
-        av_add_index_entry(st, ape->frames[i].pos, ape->frames[i].pts, 0, 0, AVINDEX_KEYFRAME);
+        av_add_index_entry(st, ape->frames[i].pos, pts, 0, 0, AVINDEX_KEYFRAME);
         pts += ape->blocksperframe;
     }
 
@@ -394,7 +392,7 @@ static int ape_read_packet(AVFormatContext * s, AVPacket * pkt)
     AV_WL32(pkt->data + 4, ape->frames[ape->currentframe].skip);
     ret = avio_read(s->pb, pkt->data + extra_size, ape->frames[ape->currentframe].size);
 
-    pkt->pts = ape->frames[ape->currentframe].pts;
+    pkt->duration = nblocks;
     pkt->stream_index = 0;
 
     /* note: we need to modify the packet size here to handle the last
-- 
1.7.4



More information about the ffmpeg-devel mailing list