# HG changeset patch # User bcoudurier # Date 1229034296 0 # Node ID 8ddf05b864a441665df2fd9a78459ea92bda5de5 # Parent 82cbec030af56fbff639d0717770aa9255394faa parse pasp atom and set sample aspect ratio, warn if transformation matrix differs from pasp, based on a patch by Skal. diff -r 82cbec030af5 -r 8ddf05b864a4 mov.c --- a/mov.c Thu Dec 11 20:06:56 2008 +0000 +++ b/mov.c Thu Dec 11 22:24:56 2008 +0000 @@ -430,6 +430,22 @@ return 0; } +static int mov_read_pasp(MOVContext *c, ByteIOContext *pb, MOVAtom atom) +{ + const int num = get_be32(pb); + const int den = get_be32(pb); + AVStream * const st = c->fc->streams[c->fc->nb_streams-1]; + if (den != 0) { + if ((st->sample_aspect_ratio.den && den != st->sample_aspect_ratio.den) || + (st->sample_aspect_ratio.num && num != st->sample_aspect_ratio.num)) + av_log(c->fc, AV_LOG_WARNING, + "sample aspect ratio already set, overriding by 'pasp' atom\n"); + st->sample_aspect_ratio.num = num; + st->sample_aspect_ratio.den = den; + } + return 0; +} + /* this atom contains actual media data */ static int mov_read_mdat(MOVContext *c, ByteIOContext *pb, MOVAtom atom) { @@ -1754,6 +1770,7 @@ { MKTAG('S','M','I',' '), mov_read_smi }, /* Sorenson extension ??? */ { MKTAG('a','l','a','c'), mov_read_extradata }, /* alac specific atom */ { MKTAG('a','v','c','C'), mov_read_glbl }, +{ MKTAG('p','a','s','p'), mov_read_pasp }, { MKTAG('s','t','b','l'), mov_read_default }, { MKTAG('s','t','c','o'), mov_read_stco }, { MKTAG('s','t','s','c'), mov_read_stsc },