[FFmpeg-cvslog] nutdec: use ff_find_last_ts()

Michael Niedermayer git at videolan.org
Sat Jul 6 22:28:52 CEST 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sat Jul  6 22:05:35 2013 +0200| [7f250502897e7af7d9912519c3251f89866feb04] | committer: Michael Niedermayer

nutdec: use ff_find_last_ts()

Fixes finding the duration for nut files that are truncated

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

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

 libavformat/nutdec.c |   10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index 30bdefd9..13048fb 100644
--- a/libavformat/nutdec.c
+++ b/libavformat/nutdec.c
@@ -586,14 +586,8 @@ static int64_t find_duration(NUTContext *nut, int64_t filesize)
     AVFormatContext *s = nut->avf;
     int64_t duration = 0;
 
-    int64_t pos = FFMAX(0, filesize - 2*nut->max_distance);
-    for(;;){
-        int64_t ts = nut_read_timestamp(s, -1, &pos, INT64_MAX);
-        if(ts < 0)
-            break;
-        duration = FFMAX(duration, ts);
-        pos++;
-    }
+    ff_find_last_ts(s, -1, &duration, NULL, nut_read_timestamp);
+
     if(duration > 0)
         s->duration_estimation_method = AVFMT_DURATION_FROM_PTS;
     return duration;



More information about the ffmpeg-cvslog mailing list