summaryrefslogtreecommitdiff
path: root/libavformat/mov.c
diff options
context:
space:
mode:
authorJon Morley <jon@tweaksoftware.com>2015-01-22 23:04:24 -0800
committerMichael Niedermayer <michaelni@gmx.at>2015-01-23 13:14:15 +0100
commit47372caac507c4c4fbef57e32233a3a5e1823f68 (patch)
treebf8e3483679c9bbdd0ca40e8433c6d9dbd5a016b /libavformat/mov.c
parent0982077be563cb9ea1f905b1182b6f0d1783ae12 (diff)
libavformat/mov.c: Handle timecode from tmcd atom in counter mode
When the timecode value is in counter mode then it is important to use the timescale and frameduration to calculate the timecode fps. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/mov.c')
-rw-r--r--libavformat/mov.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 6851947f9a..ee45aa5dc7 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1658,6 +1658,13 @@ static int mov_parse_stsd_data(MOVContext *c, AVIOContext *pb,
st->codec->flags2 |= CODEC_FLAG2_DROP_FRAME_TIMECODE;
st->codec->time_base.den = st->codec->extradata[16]; /* number of frame */
st->codec->time_base.num = 1;
+ /* adjust for per frame dur in counter mode */
+ if (tmcd_ctx->tmcd_flags & 0x0008) {
+ int timescale = AV_RB32(st->codec->extradata + 8);
+ int framedur = AV_RB32(st->codec->extradata + 12);
+ st->codec->time_base.den *= timescale;
+ st->codec->time_base.num *= framedur;
+ }
if (size > 30) {
uint32_t len = AV_RB32(st->codec->extradata + 18); /* name atom length */
uint32_t format = AV_RB32(st->codec->extradata + 22);