diff options
author | Yusuke Nakamura <muken.the.vfrmaniac@gmail.com> | 2012-04-13 18:59:14 +0900 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2012-04-13 23:08:34 +0300 |
commit | accea4d9d8ef4a51a02653568118eb2862bf79cc (patch) | |
tree | 38b491848065337e09f0f6a80e8fdb8ba7d9551b | |
parent | f346b6bbebd86525c65bf7f40190d7ba3eb8a90a (diff) | |
download | ffmpeg-accea4d9d8ef4a51a02653568118eb2862bf79cc.tar.gz |
mov: Fix detecting there is no sync sample.
Stss atom without entries doesn't mean every sample is a sync sample.
Signed-off-by: Martin Storsjö <martin@martin.st>
-rw-r--r-- | libavformat/isom.h | 1 | ||||
-rw-r--r-- | libavformat/mov.c | 5 |
2 files changed, 5 insertions, 1 deletions
diff --git a/libavformat/isom.h b/libavformat/isom.h index 214af589a5..f716d9323f 100644 --- a/libavformat/isom.h +++ b/libavformat/isom.h @@ -106,6 +106,7 @@ typedef struct MOVStreamContext { unsigned int sample_size; unsigned int sample_count; int *sample_sizes; + int keyframe_absent; unsigned int keyframe_count; int *keyframes; int time_scale; diff --git a/libavformat/mov.c b/libavformat/mov.c index 1492486dcc..046c030bcf 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -1534,7 +1534,10 @@ static int mov_read_stss(MOVContext *c, AVIOContext *pb, MOVAtom atom) av_dlog(c->fc, "keyframe_count = %d\n", entries); if (!entries) + { + sc->keyframe_absent = 1; return 0; + } if (entries >= UINT_MAX / sizeof(int)) return AVERROR_INVALIDDATA; sc->keyframes = av_malloc(entries * sizeof(int)); @@ -1776,7 +1779,7 @@ static void mov_build_index(MOVContext *mov, AVStream *st) return; } - if (!sc->keyframe_count || current_sample+key_off == sc->keyframes[stss_index]) { + if (!sc->keyframe_absent && (!sc->keyframe_count || current_sample+key_off == sc->keyframes[stss_index])) { keyframe = 1; if (stss_index + 1 < sc->keyframe_count) stss_index++; |