From e5b8dbf75f6dcc48367e726c39097bc80b2a5b91 Mon Sep 17 00:00:00 2001 From: saintdev Date: Thu, 26 Jul 2007 04:24:01 +0000 Subject: Change Matroska timecode scale to be 1000000000 / 90000. This is a patch from Yuvi on the forums. Thanks for killing that magic number! git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@739 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- libhb/muxmkv.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'libhb') diff --git a/libhb/muxmkv.c b/libhb/muxmkv.c index 41c61b574..e40cc8089 100644 --- a/libhb/muxmkv.c +++ b/libhb/muxmkv.c @@ -11,6 +11,10 @@ #include "hb.h" +/* Scale factor to apply to timecodes to convert from HandBrake's + * 1/90000s to nanoseconds as expected by libmkv */ +#define TIMECODE_SCALE 1000000000 / 90000 + struct hb_mux_object_s { HB_MUX_COMMON; @@ -219,16 +223,13 @@ static int MKVMux( hb_mux_object_t * m, hb_mux_data_t * mux_data, if (mux_data == job->mux_data) { /* Video */ - /* Where does the 11130 come from? I had to calculate it from the actual - * and the observed duration of the file. Otherwise the timecodes come - * out way too small, and you get a 2hr movie that plays in .64 sec. */ if ((job->vcodec == HB_VCODEC_X264) && (buf->frametype & HB_FRAME_REF)) { - timecode = (buf->start + (buf->renderOffset - 1000000)) * 11130; + timecode = (buf->start + (buf->renderOffset - 1000000)) * TIMECODE_SCALE; } else { - timecode = buf->start * 11130; + timecode = buf->start * TIMECODE_SCALE; } if (job->chapter_markers && (buf->new_chap || timecode == 0)) @@ -254,13 +255,13 @@ static int MKVMux( hb_mux_object_t * m, hb_mux_data_t * mux_data, mux_data->prev_chapter_tc = timecode; } - if (buf->stop * 11130 > mux_data->max_tc) - mux_data->max_tc = buf->stop * 11130; + if (buf->stop * TIMECODE_SCALE > mux_data->max_tc) + mux_data->max_tc = buf->stop * TIMECODE_SCALE; } else { /* Audio */ - timecode = buf->start * 11130; + timecode = buf->start * TIMECODE_SCALE; if (job->acodec == HB_ACODEC_VORBIS) { /* ughhh, vorbis is a pain :( */ -- cgit v1.2.3