aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/mov.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-02-22 01:35:41 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-02-22 02:24:18 +0100
commit184fc600e101bb6190ec92a8a3be8898ff22d225 (patch)
tree95dd194f10cf704c3f097fed5eedaf4538a542a5 /libavformat/mov.c
parent92b5f71a7d30974250918b12e93c974b9b555d11 (diff)
parent5d42ac7ffb5471666136402a553454caf3a3c989 (diff)
downloadffmpeg-184fc600e101bb6190ec92a8a3be8898ff22d225.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: mpegvideo_enc: only allocate output packet when we know there will be output Add names for more channel layouts to the channel layout map. sunrast: Add a sample request for RMP_RAW colormap. avcodec: do not override pts or duration from the audio encoder Add prores regression test. Enable already existing rso regression test. Add regression test for "sox" format muxer/demuxer. Add dpx encoding regression test. swscale: K&R formatting cosmetics for PowerPC code (part I/II) img2: Use ff_guess_image2_codec(filename) shorthand where appropriate. Clarify licensing information about files borrowed from libjpeg. Mark mutable static data const where appropriate. avplay: fix -threads option dvbsubdec: avoid undefined signed left shift in RGBA macro mlpdec: use av_log_ask_for_sample() gif: K&R formatting cosmetics png: make .long_name more descriptive movdec: Adjust keyframe flagging in fragmented files rv34: change most "int stride" into "ptrdiff_t stride". Conflicts: avprobe.c ffplay.c libavcodec/mlpdec.c libavcodec/mpegvideo_enc.c libavcodec/pngenc.c libavcodec/x86/v210-init.c libavfilter/vf_boxblur.c libavfilter/vf_crop.c libavfilter/vf_drawtext.c libavfilter/vf_lut.c libavfilter/vf_overlay.c libavfilter/vf_pad.c libavfilter/vf_scale.c libavfilter/vf_select.c libavfilter/vf_setpts.c libavfilter/vf_settb.c libavformat/img2.c libavutil/audioconvert.c tests/codec-regression.sh tests/lavf-regression.sh tests/ref/lavf/dpx tests/ref/vsynth1/prores tests/ref/vsynth2/prores Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/mov.c')
-rw-r--r--libavformat/mov.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index c6680274d5..7d9248db59 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2311,7 +2311,7 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
int64_t dts;
int data_offset = 0;
unsigned entries, first_sample_flags = frag->flags;
- int flags, distance, i;
+ int flags, distance, i, found_keyframe = 0;
for (i = 0; i < c->fc->nb_streams; i++) {
if (c->fc->streams[i]->id == frag->track_id) {
@@ -2365,7 +2365,7 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
unsigned sample_size = frag->size;
int sample_flags = i ? frag->flags : first_sample_flags;
unsigned sample_duration = frag->duration;
- int keyframe;
+ int keyframe = 0;
if (flags & MOV_TRUN_SAMPLE_DURATION) sample_duration = avio_rb32(pb);
if (flags & MOV_TRUN_SAMPLE_SIZE) sample_size = avio_rb32(pb);
@@ -2374,8 +2374,13 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
sc->ctts_data[sc->ctts_count].duration = (flags & MOV_TRUN_SAMPLE_CTS) ?
avio_rb32(pb) : 0;
sc->ctts_count++;
- if ((keyframe = st->codec->codec_type == AVMEDIA_TYPE_AUDIO ||
- (flags & MOV_TRUN_FIRST_SAMPLE_FLAGS && !i && !(sample_flags & ~MOV_FRAG_SAMPLE_FLAG_DEGRADATION_PRIORITY_MASK)) || sample_flags & MOV_FRAG_SAMPLE_FLAG_DEPENDS_NO))
+ if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO)
+ keyframe = 1;
+ else if (!found_keyframe)
+ keyframe = found_keyframe =
+ !(sample_flags & (MOV_FRAG_SAMPLE_FLAG_IS_NON_SYNC |
+ MOV_FRAG_SAMPLE_FLAG_DEPENDS_YES));
+ if (keyframe)
distance = 0;
av_add_index_entry(st, offset, dts, sample_size, distance,
keyframe ? AVINDEX_KEYFRAME : 0);