]> git.sesse.net Git - vlc/commitdiff
* fixed a problem with sub-fps overriding
authorDerk-Jan Hartman <hartman@videolan.org>
Tue, 2 Nov 2004 20:52:45 +0000 (20:52 +0000)
committerDerk-Jan Hartman <hartman@videolan.org>
Tue, 2 Nov 2004 20:52:45 +0000 (20:52 +0000)
  If subtitle format  doesn't have their own reference, they should define 25fps as the the standard reference, BUT NOT GLOBALLY. Cause then ALL subtitle formats will use this correction factor of 25fps.

modules/demux/subtitle.c

index 8133c0680fad799cc72a8a7e078fc78ec3941051..0aedae1310fef6f937b4335ade82556a1bb83e0f 100644 (file)
@@ -190,12 +190,15 @@ static int Open ( vlc_object_t *p_this )
 
 
     /* Get the FPS */
-    p_sys->i_microsecperframe = 40000; /* default to 25 fps */
     f_fps = var_CreateGetFloat( p_demux, "sub-fps" );
     if( f_fps >= 1.0 )
     {
         p_sys->i_microsecperframe = (int64_t)( (float)1000000 / f_fps );
     }
+    else
+    {
+        p_sys->i_microsecperframe = 0;
+    }
 
     f_fps = var_CreateGetFloat( p_demux, "sub-original-fps" );
     if( f_fps >= 1.0 )
@@ -680,6 +683,10 @@ static int ParseMicroDvd( demux_t *p_demux, subtitle_t *p_subtitle )
     int    i_stop;
     unsigned int i;
 
+    int i_microsecperframe = 40000; /* default to 25 fps */
+    if( p_sys->i_microsecperframe > 0 ) 
+        i_microsecperframe = p_sys->i_microsecperframe;
+    
     p_subtitle->i_start = 0;
     p_subtitle->i_stop  = 0;
     p_subtitle->psz_text = NULL;
@@ -709,8 +716,8 @@ static int ParseMicroDvd( demux_t *p_demux, subtitle_t *p_subtitle )
         }
     }
 
-    p_subtitle->i_start = (int64_t)i_start * p_sys->i_microsecperframe;
-    p_subtitle->i_stop  = (int64_t)i_stop  * p_sys->i_microsecperframe;
+    p_subtitle->i_start = (int64_t)i_start * i_microsecperframe;
+    p_subtitle->i_stop  = (int64_t)i_stop  * i_microsecperframe;
     p_subtitle->psz_text = strndup( buffer_text, MAX_LINE );
     return( 0 );
 }