diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-05-02 18:44:22 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-05-02 18:57:29 +0200 |
commit | fd68371b072824ee6f63e38e1b2f6921a05bedcc (patch) | |
tree | d9bda44cd1f8c8c450549632fb8370776032e361 /libavformat/nutdec.c | |
parent | 60ab4480423769ac3db487aba5232b187036c7ea (diff) | |
download | ffmpeg-fd68371b072824ee6f63e38e1b2f6921a05bedcc.tar.gz |
nutdec: Implement duration parsing for indexed nuts
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/nutdec.c')
-rw-r--r-- | libavformat/nutdec.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c index 8896518142..ea0fc1d53a 100644 --- a/libavformat/nutdec.c +++ b/libavformat/nutdec.c @@ -601,6 +601,7 @@ static int find_and_decode_index(NUTContext *nut) int i, j, syncpoint_count; int64_t filesize = avio_size(bc); int64_t *syncpoints; + uint64_t max_pts; int8_t *has_keyframe; int ret = -1; @@ -620,7 +621,12 @@ static int find_and_decode_index(NUTContext *nut) end = get_packetheader(nut, bc, 1, INDEX_STARTCODE); end += avio_tell(bc); - ffio_read_varlen(bc); // max_pts + max_pts = ffio_read_varlen(bc); + s->duration = av_rescale_q(max_pts / nut->time_base_count, + nut->time_base[max_pts % nut->time_base_count], + AV_TIME_BASE_Q); + s->duration_estimation_method = AVFMT_DURATION_FROM_PTS; + GET_V(syncpoint_count, tmp < INT_MAX / 8 && tmp > 0); syncpoints = av_malloc(sizeof(int64_t) * syncpoint_count); has_keyframe = av_malloc(sizeof(int8_t) * (syncpoint_count + 1)); |