[vlc-commits] codec: spudec: use decoder_QueueSub in parser

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


vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Dec 19 14:39:31 2019 +0100| [5ac38b7e5234db068e93293115b58389938e8a33] | committer: Francois Cartegnie

codec: spudec: use decoder_QueueSub in parser

Will need multiple subpicture output per commands

(cherry picked from commit bc28503eeedbe78a32bbc1712185baf9077409d2)

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

 modules/codec/spudec/parse.c  | 10 +++++-----
 modules/codec/spudec/spudec.c |  5 +----
 modules/codec/spudec/spudec.h |  2 +-
 3 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/modules/codec/spudec/parse.c b/modules/codec/spudec/parse.c
index 24eb465a7e..02e69a803e 100644
--- a/modules/codec/spudec/parse.c
+++ b/modules/codec/spudec/parse.c
@@ -93,7 +93,7 @@ static inline unsigned int AddNibble( unsigned int i_code,
  * This function parses the SPU packet and, if valid, sends it to the
  * video output.
  *****************************************************************************/
-subpicture_t * ParsePacket( decoder_t *p_dec )
+void ParsePacket( decoder_t *p_dec, void(*pf_queue)(decoder_t *, subpicture_t *) )
 {
     decoder_sys_t *p_sys = p_dec->p_sys;
     subpicture_t *p_spu;
@@ -102,7 +102,7 @@ subpicture_t * ParsePacket( decoder_t *p_dec )
 
     /* Allocate the subpicture internal data. */
     p_spu = decoder_NewSubpicture( p_dec, NULL );
-    if( !p_spu ) return NULL;
+    if( !p_spu ) return;
 
     p_spu->i_original_picture_width =
         p_dec->fmt_in.subs.spu.i_original_frame_width;
@@ -114,7 +114,7 @@ subpicture_t * ParsePacket( decoder_t *p_dec )
     {
         /* There was a parse error, delete the subpicture */
         subpicture_Delete( p_spu );
-        return NULL;
+        return;
     }
 
     /* we are going to expand the RLE stuff so that we won't need to read
@@ -133,7 +133,7 @@ subpicture_t * ParsePacket( decoder_t *p_dec )
         /* There was a parse error, delete the subpicture */
         subpicture_Delete( p_spu );
         free( spu_data.p_data );
-        return NULL;
+        return;
     }
 
 #ifdef DEBUG_SPUDEC
@@ -145,7 +145,7 @@ subpicture_t * ParsePacket( decoder_t *p_dec )
     Render( p_dec, p_spu, &spu_data, &spu_properties );
     free( spu_data.p_data );
 
-    return p_spu;
+    pf_queue( p_dec, p_spu );
 }
 
 /*****************************************************************************
diff --git a/modules/codec/spudec/spudec.c b/modules/codec/spudec/spudec.c
index 09aeb376e8..f487c94c9a 100644
--- a/modules/codec/spudec/spudec.c
+++ b/modules/codec/spudec/spudec.c
@@ -144,7 +144,6 @@ static int Decode( decoder_t *p_dec, block_t *p_block )
 {
     decoder_sys_t *p_sys = p_dec->p_sys;
     block_t       *p_spu_block;
-    subpicture_t  *p_spu;
 
     if( p_block == NULL ) /* No Drain */
         return VLCDEC_SUCCESS;
@@ -161,7 +160,7 @@ static int Decode( decoder_t *p_dec, block_t *p_block )
     block_ChainRelease( p_spu_block );
 
     /* Parse and decode */
-    p_spu = ParsePacket( p_dec );
+    ParsePacket( p_dec, decoder_QueueSub );
 
     /* reinit context */
     p_sys->i_spu_size = 0;
@@ -169,8 +168,6 @@ static int Decode( decoder_t *p_dec, block_t *p_block )
     p_sys->i_spu      = 0;
     p_sys->p_block    = NULL;
 
-    if( p_spu != NULL )
-        decoder_QueueSub( p_dec, p_spu );
     return VLCDEC_SUCCESS;
 }
 
diff --git a/modules/codec/spudec/spudec.h b/modules/codec/spudec/spudec.h
index ab53413bbc..0608769590 100644
--- a/modules/codec/spudec/spudec.h
+++ b/modules/codec/spudec/spudec.h
@@ -59,4 +59,4 @@ struct decoder_sys_t
 /*****************************************************************************
  * Prototypes
  *****************************************************************************/
-subpicture_t * ParsePacket( decoder_t * );
+void ParsePacket( decoder_t *, void(*pf_queue)(decoder_t *, subpicture_t *) );



More information about the vlc-commits mailing list