diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-02-10 03:38:13 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-02-10 04:20:07 +0400 |
commit | 8c6ebab747ca8311b81ff4d0a7c17ef60b372f32 (patch) | |
tree | 677444f33cd2ee65df88809ca820ed57d2077ca3 /libavformat | |
parent | ea4037162fb0afa871e5312a7b23c828d2b85066 (diff) | |
parent | c57fe49da8feda7d2e6c266978250a15a83e0484 (diff) |
Merge remote-tracking branch 'qatar/master'
* qatar/master: (26 commits)
eac3dec: replace undefined 1<<31 with INT32_MIN in noise generation
yadif: specify array size outside DECLARE_ALIGNED
prores: specify array size outside DECLARE_ALIGNED brackets.
WavPack demuxer: set packet duration
tta: use skip_bits_long()
mxfdec: Ignore the last entry in Avid's index table segments
mxfdec: Sanity-check SampleRate
mxfdec: Handle small EditUnitByteCount
mxfdec: Consider OPAtom files that do not have exactly one EC to be OP1a
mxfdec: Don't crash in mxf_packet_timestamps() if current_edit_unit overflows
mxfdec: Zero nb_ptses in mxf_compute_ptses_fake_index()
mxfdec: Sanity check PreviousPartition
mxfdec: Never seek back in local sets and KLVs
mxfdec: Move the current_partition check inside mxf_read_header()
mxfdec: Fix infinite loop in mxf_packet_timestamps()
mxfdec: Check eof_reached in mxf_read_local_tags()
mxfdec: Check for NULL component
mxfdec: Make sure mxf->nb_index_tables > 0 in mxf_packet_timestamps()
mxfdec: Make sure x < index_table->nb_ptses
build: Add missing directories to DIRS declarations.
...
Conflicts:
doc/build_system.txt
doc/fate.texi
libavfilter/x86/yadif_template.c
libavformat/mxfdec.c
libavutil/Makefile
tests/fate/audio.mak
tests/fate/prores.mak
tests/fate/screen.mak
tests/fate/video.mak
tests/ref/fate/bethsoft-vid
tests/ref/fate/cscd
tests/ref/fate/dfa4
tests/ref/fate/nuv
tests/ref/fate/vp8-sign-bias
tests/ref/fate/wmv8-drm
tests/ref/lavf/gxf
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/apetag.h | 2 | ||||
-rw-r--r-- | libavformat/mxfdec.c | 48 | ||||
-rw-r--r-- | libavformat/wv.c | 7 |
3 files changed, 37 insertions, 20 deletions
diff --git a/libavformat/apetag.h b/libavformat/apetag.h index 8aaef68c38..869fc4b3c0 100644 --- a/libavformat/apetag.h +++ b/libavformat/apetag.h @@ -30,4 +30,4 @@ */ void ff_ape_parse_tag(AVFormatContext *s); -#endif /* AVFORMAT_ID3V2_H */ +#endif /* AVFORMAT_APETAG_H */ diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index c9278692a3..44533b4431 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -490,7 +490,8 @@ static int mxf_read_partition_pack(void *arg, AVIOContext *pb, int tag, int size /* sanity check PreviousPartition if set */ if (partition->previous_partition && mxf->run_in + partition->previous_partition >= klv_offset) { - av_log(mxf->fc, AV_LOG_ERROR, "PreviousPartition points to this partition or forward\n"); + av_log(mxf->fc, AV_LOG_ERROR, + "PreviousPartition points to this partition or forward\n"); return AVERROR_INVALIDDATA; } @@ -1107,7 +1108,6 @@ static int mxf_compute_ptses_fake_index(MXFContext *mxf, MXFIndexTable *index_ta if (s->nb_index_entries == 2 * s->index_duration + 1) { index_delta = 2; /* Avid index */ - /* ignore the last entry - it's the size of the essence container */ n--; } @@ -1117,7 +1117,8 @@ static int mxf_compute_ptses_fake_index(MXFContext *mxf, MXFIndexTable *index_ta int index = x + offset; if (x >= index_table->nb_ptses) { - av_log(mxf->fc, AV_LOG_ERROR, "x >= nb_ptses - IndexEntryCount %i < IndexDuration %"PRId64"?\n", + av_log(mxf->fc, AV_LOG_ERROR, + "x >= nb_ptses - IndexEntryCount %i < IndexDuration %"PRId64"?\n", s->nb_index_entries, s->index_duration); break; } @@ -1401,8 +1402,10 @@ static int mxf_parse_structural_metadata(MXFContext *mxf) st->codec->codec_id = container_ul->id; st->codec->channels = descriptor->channels; st->codec->bits_per_coded_sample = descriptor->bits_per_sample; + if (descriptor->sample_rate.den > 0) - st->codec->sample_rate = descriptor->sample_rate.num / descriptor->sample_rate.den; + st->codec->sample_rate = descriptor->sample_rate.num / descriptor->sample_rate.den; + /* TODO: implement CODEC_ID_RAWAUDIO */ if (st->codec->codec_id == CODEC_ID_PCM_S16LE) { if (descriptor->bits_per_sample > 16 && descriptor->bits_per_sample <= 24) @@ -1496,14 +1499,15 @@ static int mxf_read_local_tags(MXFContext *mxf, KLVPacket *klv, MXFMetadataReadF else if ((ret = read_child(ctx, pb, tag, size, uid, -1)) < 0) return ret; - /* accept the 64k local set limit being exceeded (Avid) - * don't accept it extending past the end of the KLV though (zzuf5.mxf) */ + /* Accept the 64k local set limit being exceeded (Avid). Don't accept + * it extending past the end of the KLV though (zzuf5.mxf). */ if (avio_tell(pb) > klv_end) { - av_log(mxf->fc, AV_LOG_ERROR, "local tag %#04x extends past end of local set @ %#"PRIx64"\n", + av_log(mxf->fc, AV_LOG_ERROR, + "local tag %#04x extends past end of local set @ %#"PRIx64"\n", tag, klv->offset); return AVERROR_INVALIDDATA; } else if (avio_tell(pb) <= next) /* only seek forward, else this can loop for a long time */ - avio_seek(pb, next, SEEK_SET); + avio_seek(pb, next, SEEK_SET); } if (ctx_size) ctx->type = type; return ctx_size ? mxf_add_metadata_set(mxf, ctx) : 0; @@ -1628,8 +1632,9 @@ static int is_pcm(enum CodecID codec_id) } /** - * Deals with the case where for some audio atoms EditUnitByteCount is very small (2, 4..). - * In those cases we should read more than one sample per call to mxf_read_packet(). + * Deal with the case where for some audio atoms EditUnitByteCount is + * very small (2, 4..). In those cases we should read more than one + * sample per call to mxf_read_packet(). */ static void mxf_handle_small_eubc(AVFormatContext *s) { @@ -1641,15 +1646,18 @@ static void mxf_handle_small_eubc(AVFormatContext *s) return; /* expect PCM with exactly one index table segment and a small (< 32) EUBC */ - if (s->nb_streams != 1 || s->streams[0]->codec->codec_type != AVMEDIA_TYPE_AUDIO || - !is_pcm(s->streams[0]->codec->codec_id) || mxf->nb_index_tables != 1 || - mxf->index_tables[0].nb_segments != 1 || + if (s->nb_streams != 1 || + s->streams[0]->codec->codec_type != AVMEDIA_TYPE_AUDIO || + !is_pcm(s->streams[0]->codec->codec_id) || + mxf->nb_index_tables != 1 || + mxf->index_tables[0].nb_segments != 1 || mxf->index_tables[0].segments[0]->edit_unit_byte_count >= 32) return; /* arbitrarily default to 48 kHz PAL audio frame size */ - /* TODO: we could compute this from the ratio between the audio and video edit rates - * for 48 kHz NTSC we could use the 1802-1802-1802-1802-1801 pattern */ + /* TODO: We could compute this from the ratio between the audio + * and video edit rates for 48 kHz NTSC we could use the + * 1802-1802-1802-1802-1801 pattern. */ mxf->edit_units_per_packet = 1920; } @@ -1799,7 +1807,8 @@ static void mxf_packet_timestamps(MXFContext *mxf, AVPacket *pkt) int64_t last_ofs = -1, next_ofs; MXFIndexTable *t = &mxf->index_tables[0]; - /* this is called from the OP1a demuxing logic, which means there may be no index tables */ + /* this is called from the OP1a demuxing logic, which means there + * may be no index tables */ if (mxf->nb_index_tables <= 0) return; @@ -1809,9 +1818,10 @@ static void mxf_packet_timestamps(MXFContext *mxf, AVPacket *pkt) break; if (next_ofs <= last_ofs) { - /* large next_ofs didn't change or current_edit_unit wrapped around - * this fixes the infinite loop on zzuf3.mxf */ - av_log(mxf->fc, AV_LOG_ERROR, "next_ofs didn't change. not deriving packet timestamps\n"); + /* large next_ofs didn't change or current_edit_unit wrapped + * around this fixes the infinite loop on zzuf3.mxf */ + av_log(mxf->fc, AV_LOG_ERROR, + "next_ofs didn't change. not deriving packet timestamps\n"); return; } diff --git a/libavformat/wv.c b/libavformat/wv.c index 537fdec583..767f4f48ef 100644 --- a/libavformat/wv.c +++ b/libavformat/wv.c @@ -251,6 +251,7 @@ static int wv_read_packet(AVFormatContext *s, int ret; int size, ver, off; int64_t pos; + uint32_t block_samples; if (url_feof(s->pb)) return AVERROR(EIO); @@ -316,6 +317,12 @@ static int wv_read_packet(AVFormatContext *s, pkt->stream_index = 0; wc->block_parsed = 1; pkt->pts = wc->soff; + block_samples = AV_RN32(wc->extra); + if (block_samples > INT32_MAX) + av_log(s, AV_LOG_WARNING, "Too many samples in block: %"PRIu32"\n", block_samples); + else + pkt->duration = block_samples; + av_add_index_entry(s->streams[0], pos, pkt->pts, 0, 0, AVINDEX_KEYFRAME); return 0; } |