[vlc-devel] [PATCH 1/5] subtitle: use "sub-original-fps" instead of "sub-fps"

Thomas Guillem thomas at gllm.fr
Wed Oct 17 15:32:55 CEST 2018


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.
---
 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 0d64532018..130636bf98 100644
--- a/src/input/var.c
+++ b/src/input/var.c
@@ -797,6 +797,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 );
 }
 
 /*****************************************************************************
-- 
2.19.1



More information about the vlc-devel mailing list