summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsaintdev <[email protected]>2007-07-26 04:24:01 +0000
committersaintdev <[email protected]>2007-07-26 04:24:01 +0000
commite5b8dbf75f6dcc48367e726c39097bc80b2a5b91 (patch)
tree860e8710cc56be55431883afe69ff230909c9258
parent2c12dc427e857334b3d744ddf8829590f6ee3906 (diff)
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
-rw-r--r--libhb/muxmkv.c17
1 files changed, 9 insertions, 8 deletions
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 :( */