[vlc-devel] [PATCH 03/22] mosaic: simplify the picture chain tail handling
Steve Lhomme
robux4 at ycbcr.xyz
Thu Sep 17 17:33:25 CEST 2020
Rather than a pointer on the last picture pointer, we use either NULL (no
tail/chain empty) or a pointer to the last picture in the chain.
---
modules/spu/mosaic.c | 2 +-
modules/spu/mosaic.h | 2 +-
modules/stream_out/mosaic_bridge.c | 9 ++++++---
3 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/modules/spu/mosaic.c b/modules/spu/mosaic.c
index b06ca3fd6f4..9ae3b2c83cd 100644
--- a/modules/spu/mosaic.c
+++ b/modules/spu/mosaic.c
@@ -544,7 +544,7 @@ static subpicture_t *Filter( filter_t *p_filter, vlc_tick_t date )
/* Display blank */
picture_Release( p_es->p_picture );
p_es->p_picture = NULL;
- p_es->pp_last = &p_es->p_picture;
+ p_es->chain_tail = NULL;
break;
}
else
diff --git a/modules/spu/mosaic.h b/modules/spu/mosaic.h
index 41bd00950d4..699d61f2751 100644
--- a/modules/spu/mosaic.h
+++ b/modules/spu/mosaic.h
@@ -25,7 +25,7 @@ typedef struct bridged_es_t
{
es_format_t fmt;
picture_t *p_picture;
- picture_t **pp_last;
+ picture_t *chain_tail;
bool b_empty;
char *psz_id;
diff --git a/modules/stream_out/mosaic_bridge.c b/modules/stream_out/mosaic_bridge.c
index 518ea73b304..fcc6ad7ca35 100644
--- a/modules/stream_out/mosaic_bridge.c
+++ b/modules/stream_out/mosaic_bridge.c
@@ -417,7 +417,7 @@ static void *Add( sout_stream_t *p_stream, const es_format_t *p_fmt )
//p_es->fmt = *p_fmt;
p_es->psz_id = p_sys->psz_id;
p_es->p_picture = NULL;
- p_es->pp_last = &p_es->p_picture;
+ p_es->chain_tail = NULL;
p_es->b_empty = false;
vlc_global_unlock( VLC_MOSAIC_MUTEX );
@@ -571,9 +571,12 @@ static void decoder_queue_video( decoder_t *p_dec, picture_t *p_pic )
/* push the picture in the mosaic-struct structure */
bridged_es_t *p_es = p_sys->p_es;
vlc_global_lock( VLC_MOSAIC_MUTEX );
- *p_es->pp_last = p_new_pic;
+ if (p_es->p_picture == NULL)
+ p_es->p_picture = p_new_pic;
+ else
+ p_es->chain_tail->p_next = p_new_pic;
p_new_pic->p_next = NULL;
- p_es->pp_last = &p_new_pic->p_next;
+ p_es->chain_tail = p_new_pic;
vlc_global_unlock( VLC_MOSAIC_MUTEX );
}
--
2.26.2
More information about the vlc-devel
mailing list