[vlc-commits] demux: subtitle: fix sami loop (fix #18785)

Francois Cartegnie git at videolan.org
Mon Sep 11 10:51:46 CEST 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sun Sep 10 15:57:16 2017 +0200| [4378d5f91ef54e5d75e95a13580f11bed16d79d7] | committer: Francois Cartegnie

demux: subtitle: fix sami loop (fix #18785)

happens when a start= is on same line

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

 modules/demux/subtitle.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/modules/demux/subtitle.c b/modules/demux/subtitle.c
index 72d0fe1027..578d2dab79 100644
--- a/modules/demux/subtitle.c
+++ b/modules/demux/subtitle.c
@@ -161,6 +161,11 @@ typedef struct
         float f_factor;
     } mpsub;
 
+    struct
+    {
+        const char *psz_start;
+    } sami;
+
 } subs_properties_t;
 
 struct demux_sys_t
@@ -330,6 +335,7 @@ static int Open ( vlc_object_t *p_this )
     p_sys->props.i_microsecperframe = 40000;
     p_sys->props.jss.b_inited       = false;
     p_sys->props.mpsub.b_inited     = false;
+    p_sys->props.sami.psz_start     = NULL;
 
     /* Get the FPS */
     f_fps = var_CreateGetFloat( p_demux, "sub-original-fps" ); /* FIXME */
@@ -1406,7 +1412,9 @@ static int ParseSami( vlc_object_t *p_obj, subs_properties_t *p_props,
     char text[8192]; /* Arbitrary but should be long enough */
 
     /* search "Start=" */
-    if( !( s = ParseSamiSearch( txt, NULL, "Start=" ) ) )
+    s = ParseSamiSearch( txt, p_props->sami.psz_start, "Start=" );
+    p_props->sami.psz_start = NULL;
+    if( !s )
         return VLC_EGENERIC;
 
     /* get start value */
@@ -1424,7 +1432,6 @@ static int ParseSami( vlc_object_t *p_obj, subs_properties_t *p_props,
 
     i_text = 0;
     text[0] = '\0';
-    const char *psz_startline = s;
     /* now get all txt until  a "Start=" line */
     for( ;; )
     {
@@ -1441,10 +1448,9 @@ static int ParseSami( vlc_object_t *p_obj, subs_properties_t *p_props,
             {
                 c = '\n';
             }
-            else if( strcasestr( s, "Start=" ) &&
-                     psz_startline != s )
+            else if( strcasestr( s, "Start=" ) )
             {
-                TextPreviousLine( txt );
+                p_props->sami.psz_start = s;
                 break;
             }
             s = ParseSamiSearch( txt, s, ">" );



More information about the vlc-commits mailing list