summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-07-15 15:29:01 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-07-17 17:09:19 +0200
commitad8dabfe9cfadfe50f9f6d47b481a434c2bc9376 (patch)
tree22c01fa50f2b7160df3d4fc07b8dc09eeb0ed026 /libavformat
parentb688c7b7f9885ad3bc123cbdb38dd87ff23f5e2a (diff)
mov/aac: skip initial aac padding
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/isom.h1
-rw-r--r--libavformat/mov.c12
2 files changed, 13 insertions, 0 deletions
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;