summaryrefslogtreecommitdiffstats
path: root/subreader.c
diff options
context:
space:
mode:
authoratmos4 <atmos4@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-10-06 02:59:04 +0000
committeratmos4 <atmos4@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-10-06 02:59:04 +0000
commitff72be050bbe0e494f5885ec723c5e6857431ef7 (patch)
treecde4ce7ce7df4c76e7ae4a3a1236f4a411c289f3 /subreader.c
parent0ab47ea363c2680016a62bf227d33a44e0a00669 (diff)
downloadmpv-ff72be050bbe0e494f5885ec723c5e6857431ef7.tar.bz2
mpv-ff72be050bbe0e494f5885ec723c5e6857431ef7.tar.xz
Enable -subfps for time based subtitles, too.
Please update the DOCS for -subfps: "If you have time-based subtitles like subviewer that can't be synced by -subdelay try specifying -subfps with the framerate of the movie the time-based sub was created for, eg. -subfps 25 if you use subs from a 25 fps movie with a movie using a different framerate. If you need to guess -subfps, try 25, 23.98 and 29.97" git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@7611 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'subreader.c')
-rw-r--r--subreader.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/subreader.c b/subreader.c
index 4ad303a29b..384171aa5b 100644
--- a/subreader.c
+++ b/subreader.c
@@ -735,7 +735,7 @@ static void adjust_subs_time(subtitle* sub, float subtime, float fps){
unsigned long subfms = (sub_uses_time ? 100 : fps) * subtime;
n=m=0;
- if (i) for (;;){
+ if (i) for (;;){
if (sub->end <= sub->start){
sub->end = sub->start + subfms;
m++;
@@ -750,6 +750,22 @@ static void adjust_subs_time(subtitle* sub, float subtime, float fps){
if (!m)
n++;
}
+
+ /* Theory:
+ * Movies are often converted from FILM (24 fps)
+ * to PAL (25) by simply speeding it up, so we
+ * to multiply the original timestmaps by
+ * (Movie's FPS / Subtitle's (guessed) FPS)
+ * so eg. for 23.98 fps movie and PAL time based
+ * subtitles we say -subfps 25 and we're fine!
+ */
+
+ /* timed sub fps correction ::atmos */
+ if(sub_uses_time && sub_fps) {
+ sub->start *= sub_fps/fps;
+ sub->end *= sub_fps/fps;
+ }
+
sub = nextsub;
m = 0;
}