[vlc-commits] codec: spudec: use decoder_QueueSub in parser
Francois Cartegnie
git at videolan.org
Sat Jan 4 21:02:49 CET 2020
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Dec 19 14:39:31 2019 +0100| [bc28503eeedbe78a32bbc1712185baf9077409d2] | committer: Francois Cartegnie
codec: spudec: use decoder_QueueSub in parser
Will need multiple subpicture output per commands
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=bc28503eeedbe78a32bbc1712185baf9077409d2
---
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 a1f1a12620..5e1b7175a8 100644
--- a/modules/codec/spudec/parse.c
+++ b/modules/codec/spudec/parse.c
@@ -91,7 +91,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;
@@ -100,7 +100,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;
@@ -112,7 +112,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
@@ -131,7 +131,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
@@ -143,7 +143,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 ae5ec215f5..da728f2094 100644
--- a/modules/codec/spudec/spudec.c
+++ b/modules/codec/spudec/spudec.c
@@ -134,7 +134,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;
@@ -151,7 +150,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;
@@ -159,8 +158,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 f2f29f0012..363624eb26 100644
--- a/modules/codec/spudec/spudec.h
+++ b/modules/codec/spudec/spudec.h
@@ -58,4 +58,4 @@ typedef struct
/*****************************************************************************
* 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