summaryrefslogtreecommitdiffstats
path: root/sub/dec_sub.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-06-25 00:03:37 +0200
committerwm4 <wm4@nowhere>2013-06-25 00:34:58 +0200
commit00de44eec90e45f4801e45d636b6759e1fdb9d2f (patch)
tree944b084ba34c465e861c0bd6f48bdccabcf82556 /sub/dec_sub.c
parent125c20bd081a7d99681f3ac25174c1360b885436 (diff)
downloadmpv-00de44eec90e45f4801e45d636b6759e1fdb9d2f.tar.bz2
mpv-00de44eec90e45f4801e45d636b6759e1fdb9d2f.tar.xz
options: add -sub-speed option
Should we actually get into trouble for unproper handling of frame-based subtitle formats, this might be the simplest way to work this around. Also is a bit more intuitive than -subfps, which might use an unknown, misdetected, or non-sense video FPS. Still pretty silly, though.
Diffstat (limited to 'sub/dec_sub.c')
-rw-r--r--sub/dec_sub.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/sub/dec_sub.c b/sub/dec_sub.c
index 968ca3e39f..a1392017a2 100644
--- a/sub/dec_sub.c
+++ b/sub/dec_sub.c
@@ -401,12 +401,19 @@ bool sub_read_all_packets(struct dec_sub *sub, struct sh_sub *sh)
if (sub->charset)
mp_msg(MSGT_OSD, MSGL_INFO, "Using subtitle charset: %s\n", sub->charset);
+ double sub_speed = 1.0;
+
// 23.976 FPS is used as default timebase for frame based formats
if (sub->video_fps && sh->frame_based)
- multiply_timings(subs, sub->video_fps / 23.976);
+ sub_speed *= sub->video_fps / 23.976;
if (opts->sub_fps && sub->video_fps)
- multiply_timings(subs, opts->sub_fps / sub->video_fps);
+ sub_speed *= opts->sub_fps / sub->video_fps;
+
+ sub_speed *= opts->sub_speed;
+
+ if (sub_speed != 1.0)
+ multiply_timings(subs, sub_speed);
if (!opts->suboverlap_enabled)
fix_overlaps_and_gaps(subs);