[vlc-devel] [PATCH v2 21/24] mmal: use the picture_chain API for the FIFO

Steve Lhomme robux4 at ycbcr.xyz
Fri Sep 18 16:45:27 CEST 2020


pf->head represents the picture chain and pf->tail the tail that is used to
append pictures.
---
 modules/hw/mmal/converter.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/modules/hw/mmal/converter.c b/modules/hw/mmal/converter.c
index f49f1f02022..d85f8a122e1 100644
--- a/modules/hw/mmal/converter.c
+++ b/modules/hw/mmal/converter.c
@@ -123,12 +123,7 @@ typedef struct pic_fifo_s {
 
 static picture_t * pic_fifo_get(pic_fifo_t * const pf)
 {
-    picture_t * const pic = pf->head;;
-    if (pic != NULL) {
-        pf->head = pic->p_next;
-        pic->p_next = NULL;
-    }
-    return pic;
+    return picture_chain_pop_front( &pf->head );
 }
 
 static void pic_fifo_release_all(pic_fifo_t * const pf)
@@ -147,12 +142,16 @@ static void pic_fifo_init(pic_fifo_t * const pf)
 
 static void pic_fifo_put(pic_fifo_t * const pf, picture_t * pic)
 {
-    pic->p_next = NULL;
     if (pf->head == NULL)
+    {
+        pic->p_next = NULL;
         pf->head = pic;
+        pf->tail = pic;
+    }
     else
-        pf->tail->p_next = pic;
-    pf->tail = pic;
+    {
+        pf->tail = picture_chain_append( pf->tail, pic  );
+    }
 }
 
 #define SUBS_MAX 3
@@ -289,8 +288,6 @@ static void conv_input_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf)
 
 static void conv_out_q_pic(converter_sys_t * const sys, picture_t * const pic)
 {
-    pic->p_next = NULL;
-
     vlc_mutex_lock(&sys->lock);
     pic_fifo_put(&sys->ret_pics, pic);
     vlc_mutex_unlock(&sys->lock);
-- 
2.26.2



More information about the vlc-devel mailing list