From ad8dabfe9cfadfe50f9f6d47b481a434c2bc9376 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 15 Jul 2012 15:29:01 +0200 Subject: mov/aac: skip initial aac padding Signed-off-by: Michael Niedermayer --- libavformat/isom.h | 1 + libavformat/mov.c | 12 ++++++++++++ 2 files changed, 13 insertions(+) (limited to 'libavformat') diff --git a/libavformat/isom.h b/libavformat/isom.h index 5f7f18930f..f198f70da2 100644 --- a/libavformat/isom.h +++ b/libavformat/isom.h @@ -135,6 +135,7 @@ typedef struct MOVStreamContext { int64_t data_size; uint32_t tmcd_flags; ///< tmcd track flags int64_t track_end; ///< used for dts generation in fragmented movie files + int start_pad; ///< amount of samples to skip due to enc-dec delay } MOVStreamContext; typedef struct MOVContext { diff --git a/libavformat/mov.c b/libavformat/mov.c index becfeec3bb..0acebc21f1 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -3012,6 +3012,15 @@ static int mov_read_header(AVFormatContext *s) } export_orphan_timecode(s); + for (i = 0; i < s->nb_streams; i++) { + AVStream *st = s->streams[i]; + MOVStreamContext *sc = st->priv_data; + if(st->codec->codec_type == AVMEDIA_TYPE_AUDIO && st->codec->codec_id == CODEC_ID_AAC) { + sc->start_pad = 2112; + st->skip_samples = sc->start_pad; + } + } + if (mov->trex_data) { for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; @@ -3187,7 +3196,10 @@ static int mov_read_seek(AVFormatContext *s, int stream_index, int64_t sample_ti seek_timestamp = st->index_entries[sample].timestamp; for (i = 0; i < s->nb_streams; i++) { + MOVStreamContext *sc = s->streams[i]->priv_data; st = s->streams[i]; + st->skip_samples = (sample_time <= 0) ? sc->start_pad : 0; + if (stream_index == i) continue; -- cgit v1.2.3