[vlc-commits] codec: spudec: output one spu per sequence (refs #23137)

Francois Cartegnie git at videolan.org
Sat Jan 4 21:02:57 CET 2020


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Jan  3 13:51:20 2020 +0100| [7ecf8fc08bb9216e5fa5ca067e2366c8505f58a3] | committer: Francois Cartegnie

codec: spudec: output one spu per sequence (refs #23137)

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

 modules/codec/spudec/parse.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/modules/codec/spudec/parse.c b/modules/codec/spudec/parse.c
index 9616337a6c..3e04088478 100644
--- a/modules/codec/spudec/parse.c
+++ b/modules/codec/spudec/parse.c
@@ -175,9 +175,9 @@ static int Validate( decoder_t *p_dec, unsigned i_index,
     decoder_sys_t *p_sys = p_dec->p_sys;
 
     /* Check that the next sequence index matches the current one */
-    if( i_next_seq != i_cur_seq )
+    if( i_next_seq < i_cur_seq )
     {
-        msg_Err( p_dec, "index mismatch (0x%.4x != 0x%.4x)",
+        msg_Err( p_dec, "index mismatch (0x%.4x < 0x%.4x)",
                  i_next_seq, i_cur_seq );
         return VLC_EGENERIC;
     }
@@ -204,7 +204,7 @@ static int Validate( decoder_t *p_dec, unsigned i_index,
     }
 
     /* Get rid of padding bytes */
-    if( p_sys->i_spu_size > i_index + 1 )
+    if( i_index > i_next_seq && p_sys->i_spu_size > i_index + 1 )
     {
         /* Zero or one padding byte are quite usual
          * More than one padding byte - this is very strange, but
@@ -445,6 +445,11 @@ static int ParseControlSeq( decoder_t *p_dec, vlc_tick_t i_pts,
             }
 
             i_index += 1;
+
+            if( Validate( p_dec, i_index, i_cur_seq, i_next_seq,
+                          &spu_data, &spu_properties ) == VLC_SUCCESS )
+                OutputPicture( p_dec, &spu_data, &spu_properties, pf_queue );
+
             break;
 
         default: /* xx (unknown command) */
@@ -479,9 +484,6 @@ static int ParseControlSeq( decoder_t *p_dec, vlc_tick_t i_pts,
     }
 
     /* Successfully parsed ! */
-    if( Validate( p_dec, i_index, i_cur_seq, i_next_seq,
-                  &spu_data, &spu_properties ) == VLC_SUCCESS )
-        OutputPicture( p_dec, &spu_data, &spu_properties, pf_queue );
 
     return VLC_SUCCESS;
 }



More information about the vlc-commits mailing list