[vlc-devel] [PATCH 11/11] picture_chain: pass a vlc_picture_chain_t to vlc_picture_chain_Append
Steve Lhomme
robux4 at ycbcr.xyz
Thu Sep 24 16:49:19 CEST 2020
---
include/vlc_picture.h | 13 ++++++-------
modules/hw/mmal/converter.c | 2 +-
modules/stream_out/mosaic_bridge.c | 2 +-
modules/stream_out/transcode/video.c | 2 +-
modules/video_filter/fps.c | 9 +++++----
src/misc/picture_fifo.c | 2 +-
src/video_output/snapshot.c | 2 +-
7 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/include/vlc_picture.h b/include/vlc_picture.h
index 7ea85456a08..6b04e0c8c4a 100644
--- a/include/vlc_picture.h
+++ b/include/vlc_picture.h
@@ -227,16 +227,15 @@ static inline picture_t * vlc_picture_chain_PeekFront(vlc_picture_chain_t *chain
*
* \return the new tail of the picture chain
*/
-VLC_USED
-static inline picture_t * vlc_picture_chain_Append(picture_t **chain, picture_t *tail,
- picture_t *pic)
+static inline void vlc_picture_chain_Append(vlc_picture_chain_t *chain,
+ picture_t *pic)
{
- if (*chain == NULL)
- *chain = pic;
+ if (chain->front == NULL)
+ chain->front = pic;
else
- tail->p_next = pic;
+ chain->tail->p_next = pic;
pic->p_next = NULL; // we're appending a picture, not a chain
- return pic;
+ chain->tail = pic;
}
/**
diff --git a/modules/hw/mmal/converter.c b/modules/hw/mmal/converter.c
index bc1150b2da3..f872faa9b0c 100644
--- a/modules/hw/mmal/converter.c
+++ b/modules/hw/mmal/converter.c
@@ -136,7 +136,7 @@ static void pic_fifo_init(vlc_picture_chain_t * const pf)
static void pic_fifo_put(vlc_picture_chain_t * const pf, picture_t * pic)
{
- pf->tail = vlc_picture_chain_Append( &pf->front, pf->tail, pic );
+ vlc_picture_chain_Append( pf, pic );
}
#define SUBS_MAX 3
diff --git a/modules/stream_out/mosaic_bridge.c b/modules/stream_out/mosaic_bridge.c
index 964c28e52d4..c9ad35e5be8 100644
--- a/modules/stream_out/mosaic_bridge.c
+++ b/modules/stream_out/mosaic_bridge.c
@@ -569,7 +569,7 @@ 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->pictures.tail = vlc_picture_chain_Append( &p_es->pictures.front, p_es->pictures.tail, p_new_pic );
+ vlc_picture_chain_Append( &p_es->pictures, p_new_pic );
vlc_global_unlock( VLC_MOSAIC_MUTEX );
}
diff --git a/modules/stream_out/transcode/video.c b/modules/stream_out/transcode/video.c
index ed89c7dfd3a..619632cdd63 100644
--- a/modules/stream_out/transcode/video.c
+++ b/modules/stream_out/transcode/video.c
@@ -151,7 +151,7 @@ static void decoder_queue_video( decoder_t *p_dec, picture_t *p_pic )
assert(!picture_HasChainedPics(p_pic));
vlc_mutex_lock(&id->fifo.lock);
- id->fifo.pic.tail = vlc_picture_chain_Append( &id->fifo.pic.front, id->fifo.pic.tail, p_pic );
+ vlc_picture_chain_Append( &id->fifo.pic, p_pic );
vlc_mutex_unlock(&id->fifo.lock);
}
diff --git a/modules/video_filter/fps.c b/modules/video_filter/fps.c
index 4e6a59dfd66..f63d88101ed 100644
--- a/modules/video_filter/fps.c
+++ b/modules/video_filter/fps.c
@@ -111,7 +111,9 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_picture)
p_sys->p_previous_pic->date = date_Get( &p_sys->next_output_pts );
date_Increment( &p_sys->next_output_pts, 1 );
- picture_t *last_pic = p_sys->p_previous_pic;
+ vlc_picture_chain_t chain;
+ vlc_picture_chain_Reset( &chain );
+ vlc_picture_chain_Append( &chain, p_sys->p_previous_pic );
/* Duplicating pictures are not that effective and framerate increase
should be avoided, it's only here as filter should work in that direction too*/
while( unlikely( (date_Get( &p_sys->next_output_pts ) + p_sys->i_output_frame_interval ) < p_picture->date ) )
@@ -122,13 +124,12 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_picture)
picture_Copy( p_tmp, p_sys->p_previous_pic);
p_tmp->date = date_Get( &p_sys->next_output_pts );
- last_pic = vlc_picture_chain_Append( &p_sys->p_previous_pic, last_pic, p_tmp );
+ vlc_picture_chain_Append( &chain, p_tmp );
date_Increment( &p_sys->next_output_pts, 1 );
}
- last_pic = p_sys->p_previous_pic;
p_sys->p_previous_pic = p_picture;
- return last_pic;
+ return chain.front;
}
static int Open( vlc_object_t *p_this)
diff --git a/src/misc/picture_fifo.c b/src/misc/picture_fifo.c
index 9178166765f..6e0fd63e711 100644
--- a/src/misc/picture_fifo.c
+++ b/src/misc/picture_fifo.c
@@ -48,7 +48,7 @@ static void PictureFifoReset(picture_fifo_t *fifo)
static void PictureFifoPush(picture_fifo_t *fifo, picture_t *picture)
{
assert(!picture_HasChainedPics(picture));
- fifo->pics.tail = vlc_picture_chain_Append( &fifo->pics.front, fifo->pics.tail, picture );
+ vlc_picture_chain_Append( &fifo->pics, picture );
}
static picture_t *PictureFifoPop(picture_fifo_t *fifo)
{
diff --git a/src/video_output/snapshot.c b/src/video_output/snapshot.c
index 5213428bcc8..10482b96b21 100644
--- a/src/video_output/snapshot.c
+++ b/src/video_output/snapshot.c
@@ -148,7 +148,7 @@ void vout_snapshot_Set(vout_snapshot_t *snap,
video_format_CopyCrop( &dup->format, fmt );
- snap->pics.tail = vlc_picture_chain_Append( &snap->pics.front, snap->pics.tail, dup );
+ vlc_picture_chain_Append( &snap->pics, dup );
snap->request_count--;
}
vlc_cond_broadcast(&snap->wait);
--
2.26.2
More information about the vlc-devel
mailing list