Mercurial > libavformat.hg
changeset 3408:da09478c97ce libavformat
matroskadec: read TrackTimecodeScale and set timebase accordingly
patch by Anton Khirnov wyskas _at_ gmail _dot_ com
author | aurel |
---|---|
date | Sun, 01 Jun 2008 13:54:11 +0000 |
parents | ffd297928ed8 |
children | 524179afafe7 |
files | matroska.h matroskadec.c |
diffstat | 2 files changed, 11 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/matroska.h Sun Jun 01 13:39:54 2008 +0000 +++ b/matroska.h Sun Jun 01 13:54:11 2008 +0000 @@ -94,6 +94,7 @@ #define MATROSKA_ID_TRACKDEFAULTDURATION 0x23E383 #define MATROSKA_ID_TRACKCONTENTENCODINGS 0x6D80 #define MATROSKA_ID_TRACKCONTENTENCODING 0x6240 +#define MATROSKA_ID_TRACKTIMECODESCALE 0x23314F /* IDs in the trackvideo master */ #define MATROSKA_ID_VIDEOFRAMERATE 0x2383E3
--- a/matroskadec.c Sun Jun 01 13:39:54 2008 +0000 +++ b/matroskadec.c Sun Jun 01 13:54:11 2008 +0000 @@ -60,6 +60,7 @@ unsigned char *codec_priv; int codec_priv_size; + double time_scale; uint64_t default_duration; MatroskaTrackFlags flags; @@ -1589,6 +1590,14 @@ break; } + case MATROSKA_ID_TRACKTIMECODESCALE: { + double num; + if ((res = ebml_read_float(matroska, &id, &num)) < 0) + break; + track->time_scale = num; + break; + } + default: av_log(matroska->ctx, AV_LOG_INFO, "Unknown track header entry 0x%x - ignoring\n", id); @@ -2615,7 +2624,7 @@ st = av_new_stream(s, track->stream_index); if (st == NULL) return AVERROR(ENOMEM); - av_set_pts_info(st, 64, matroska->time_scale, 1000*1000*1000); /* 64 bit pts in ns */ + av_set_pts_info(st, 64, matroska->time_scale*track->time_scale, 1000*1000*1000); /* 64 bit pts in ns */ st->codec->codec_id = codec_id; st->start_time = 0;