aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Khirnov <wyskas@gmail.com>2008-06-01 13:54:11 +0000
committerAurelien Jacobs <aurel@gnuage.org>2008-06-01 13:54:11 +0000
commit7ff97085853ff8eb596eace6408cc657d02958c9 (patch)
tree95aaee96b6851a700db48d78ef3b9bcf6ceef899
parentcdae8eec1062e51059d67bb344b78d668b4c7b48 (diff)
downloadffmpeg-7ff97085853ff8eb596eace6408cc657d02958c9.tar.gz
matroskadec: read TrackTimecodeScale and set timebase accordingly
patch by Anton Khirnov wyskas _at_ gmail _dot_ com Originally committed as revision 13601 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavformat/matroska.h1
-rw-r--r--libavformat/matroskadec.c11
2 files changed, 11 insertions, 1 deletions
diff --git a/libavformat/matroska.h b/libavformat/matroska.h
index 630a824c71..f8e9fb368d 100644
--- a/libavformat/matroska.h
+++ b/libavformat/matroska.h
@@ -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
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 37c11403f9..cff5d67697 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -60,6 +60,7 @@ typedef struct Track {
unsigned char *codec_priv;
int codec_priv_size;
+ double time_scale;
uint64_t default_duration;
MatroskaTrackFlags flags;
@@ -1589,6 +1590,14 @@ matroska_add_stream (MatroskaDemuxContext *matroska)
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 @@ matroska_read_header (AVFormatContext *s,
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;