mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-02-27 17:21:05 +00:00
nutdec: use ff_find_last_ts()
Fixes finding the duration for nut files that are truncated Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
8ca5d277d8
commit
7f25050289
@ -586,14 +586,8 @@ static int64_t find_duration(NUTContext *nut, int64_t filesize)
|
|||||||
AVFormatContext *s = nut->avf;
|
AVFormatContext *s = nut->avf;
|
||||||
int64_t duration = 0;
|
int64_t duration = 0;
|
||||||
|
|
||||||
int64_t pos = FFMAX(0, filesize - 2*nut->max_distance);
|
ff_find_last_ts(s, -1, &duration, NULL, nut_read_timestamp);
|
||||||
for(;;){
|
|
||||||
int64_t ts = nut_read_timestamp(s, -1, &pos, INT64_MAX);
|
|
||||||
if(ts < 0)
|
|
||||||
break;
|
|
||||||
duration = FFMAX(duration, ts);
|
|
||||||
pos++;
|
|
||||||
}
|
|
||||||
if(duration > 0)
|
if(duration > 0)
|
||||||
s->duration_estimation_method = AVFMT_DURATION_FROM_PTS;
|
s->duration_estimation_method = AVFMT_DURATION_FROM_PTS;
|
||||||
return duration;
|
return duration;
|
||||||
|
Loading…
Reference in New Issue
Block a user