[vlc-commits] subtitle: use "sub-original-fps" instead of "sub-fps"

Thomas Guillem git at videolan.org
Thu Oct 18 12:57:31 CEST 2018


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Oct 17 14:38:50 2018 +0200| [920837fa1783567296fd11acd11d6c64c699a9d9] | committer: Thomas Guillem

subtitle: use "sub-original-fps" instead of "sub-fps"

This variable contains the fps of the master demuxer.
Always create this new variable since it is inherited by this module.

The "sub-fps" will only be used for user requests.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=920837fa1783567296fd11acd11d6c64c699a9d9
---

 modules/demux/subtitle.c | 12 ++++++------
 src/input/input.c        |  4 +---
 src/input/var.c          |  3 +++
 3 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/modules/demux/subtitle.c b/modules/demux/subtitle.c
index 24ab12f913..d98760b61e 100644
--- a/modules/demux/subtitle.c
+++ b/modules/demux/subtitle.c
@@ -330,7 +330,7 @@ static int Open ( vlc_object_t *p_this )
     p_sys->props.sami.psz_start     = NULL;
 
     /* Get the FPS */
-    f_fps = var_CreateGetFloat( p_demux, "sub-fps" );
+    f_fps = var_CreateGetFloat( p_demux, "sub-original-fps" );
     if( f_fps >= 1.f )
     {
         p_sys->props.i_microsecperframe = llroundf( (float)CLOCK_FREQ / f_fps );
@@ -996,9 +996,9 @@ static int ParseMicroDvd( vlc_object_t *p_obj, subs_properties_t *p_props,
                 break;
 
             /* We found a possible setting of the framerate "{1}{1}23.976" */
-            /* Check if it's usable, and if the sub-fps is not set */
+            /* Check if it's usable, and if the sub-original-fps is not set */
             float f_fps = us_strtof( psz_text, NULL );
-            if( f_fps > 0.f && var_GetFloat( p_obj, "sub-fps" ) <= 0.f )
+            if( f_fps > 0.f && var_GetFloat( p_obj, "sub-original-fps" ) <= 0.f )
                 p_props->i_microsecperframe = llroundf((float)CLOCK_FREQ / f_fps);
         }
         free( psz_text );
@@ -1715,8 +1715,8 @@ static int ParseMPSub( vlc_object_t *p_obj, subs_properties_t *p_props,
             {
                 float f_fps = us_strtof( psz_temp, NULL );
 
-                if( f_fps > 0.f && var_GetFloat( p_obj, "sub-fps" ) <= 0.f )
-                    var_SetFloat( p_obj, "sub-fps", f_fps );
+                if( f_fps > 0.f && var_GetFloat( p_obj, "sub-original-fps" ) <= 0.f )
+                    var_SetFloat( p_obj, "sub-original-fps", f_fps );
 
                 p_props->mpsub.i_factor = 1;
                 free( psz_temp );
@@ -2346,7 +2346,7 @@ static int ParseSCC( vlc_object_t *p_obj, subs_properties_t *p_props,
         { 6000, { 60, 1 },       false },
     };
     const struct rates *p_rate = &framerates[3];
-    float f_fps = var_GetFloat( p_obj, "sub-fps" );
+    float f_fps = var_GetFloat( p_obj, "sub-original-fps" );
     if( f_fps > 1.0 )
     {
         for( size_t i=0; i<ARRAY_SIZE(framerates); i++ )
diff --git a/src/input/input.c b/src/input/input.c
index 9823e72975..0595b8e73a 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -1004,9 +1004,7 @@ static void SetSubtitlesOptions( input_thread_t *p_input )
     const float f_fps = input_priv(p_input)->master->f_fps;
     if( f_fps > 1.f )
     {
-        float f_requested_fps = var_CreateGetFloat( p_input, "sub-fps" );
-        if( f_requested_fps <= 1.f )
-            var_SetFloat( p_input, "sub-fps", f_fps );
+        var_SetFloat( p_input, "sub-original-fps", f_fps );
     }
 
     int64_t sub_delay = var_InheritInteger( p_input, "sub-delay" );
diff --git a/src/input/var.c b/src/input/var.c
index 3ef8c0fa31..b4264d7938 100644
--- a/src/input/var.c
+++ b/src/input/var.c
@@ -795,6 +795,9 @@ void input_ConfigVarInit ( input_thread_t *p_input )
     var_Create( p_input, "meta-description", VLC_VAR_STRING|VLC_VAR_DOINHERIT);
     var_Create( p_input, "meta-date", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
     var_Create( p_input, "meta-url", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
+
+    /* Inherited by demux/subtitle.c */
+    var_Create( p_input, "sub-original-fps", VLC_VAR_FLOAT );
 }
 
 /*****************************************************************************



More information about the vlc-commits mailing list