diff options
author | eugeni <eugeni@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2006-09-12 21:33:10 +0000 |
---|---|---|
committer | eugeni <eugeni@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2006-09-12 21:33:10 +0000 |
commit | 3f1e7dd9a8dacde060e50974b5b3485fbb40dab6 (patch) | |
tree | ff17a034aa6c50e8a645b6a5ab1a60c2aaabc92d /libmpdemux | |
parent | 840a77bd065b5bfbe3a7abf8a9fabf47226ac24f (diff) |
Fix movie duration calculation in case when TimecodeScale element comes after
Duration element.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@19815 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux')
-rw-r--r-- | libmpdemux/demux_mkv.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/libmpdemux/demux_mkv.c b/libmpdemux/demux_mkv.c index 331eb108f9..a666a8f06d 100644 --- a/libmpdemux/demux_mkv.c +++ b/libmpdemux/demux_mkv.c @@ -663,6 +663,8 @@ demux_mkv_read_info (demuxer_t *demuxer) stream_t *s = demuxer->stream; uint64_t length, l; int il; + uint64_t tc_scale = 1000000; + long double duration; length = ebml_read_length (s, NULL); while (length > 0) @@ -674,9 +676,9 @@ demux_mkv_read_info (demuxer_t *demuxer) uint64_t num = ebml_read_uint (s, &l); if (num == EBML_UINT_INVALID) return 1; - mkv_d->tc_scale = num; + tc_scale = num; mp_msg (MSGT_DEMUX, MSGL_V, "[mkv] | + timecode scale: %"PRIu64"\n", - mkv_d->tc_scale); + tc_scale); break; } @@ -685,9 +687,9 @@ demux_mkv_read_info (demuxer_t *demuxer) long double num = ebml_read_float (s, &l); if (num == EBML_FLOAT_INVALID) return 1; - mkv_d->duration = num * mkv_d->tc_scale / 1000000000.0; - mp_msg (MSGT_DEMUX, MSGL_V, "[mkv] | + duration: %.3fs\n", - mkv_d->duration); + duration = num; + mp_msg (MSGT_DEMUX, MSGL_V, "[mkv] | + duration: %.3Lfs\n", + duration * tc_scale / 1000000000.0); break; } @@ -697,6 +699,8 @@ demux_mkv_read_info (demuxer_t *demuxer) } length -= l + il; } + mkv_d->tc_scale = tc_scale; + mkv_d->duration = duration * tc_scale / 1000000000.0; return 0; } |