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

Francois Cartegnie git at videolan.org
Mon Jan 13 18:09:55 CET 2020


vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Jan  3 13:51:20 2020 +0100| [9fec39cd2be6f541a66e79843c2f5c909f9e374a] | committer: Francois Cartegnie

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

(cherry picked from commit 7ecf8fc08bb9216e5fa5ca067e2366c8505f58a3)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=9fec39cd2be6f541a66e79843c2f5c909f9e374a
---

 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 2d877e04c3..b0ae7f0b0d 100644
--- a/modules/codec/spudec/parse.c
+++ b/modules/codec/spudec/parse.c
@@ -177,9 +177,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;
     }
@@ -206,7 +206,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
@@ -447,6 +447,11 @@ static int ParseControlSeq( decoder_t *p_dec, mtime_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) */
@@ -481,9 +486,6 @@ static int ParseControlSeq( decoder_t *p_dec, mtime_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