[vlc-devel] [PATCH 1/5] goom: use a local picture pool to output pictures

Steve Lhomme robux4 at ycbcr.xyz
Fri Aug 14 10:25:35 CEST 2020


---
 modules/visualization/goom.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/modules/visualization/goom.c b/modules/visualization/goom.c
index fa8f2cc197a..dfdde6d6222 100644
--- a/modules/visualization/goom.c
+++ b/modules/visualization/goom.c
@@ -34,6 +34,7 @@
 #include <vlc_aout.h>            /* aout_FormatNbChannels, AOUT_FMTS_SIMILAR */
 #include <vlc_vout.h>              /* vout_*Picture, aout_filter_..tVout */
 #include <vlc_filter.h>
+#include <vlc_picture_pool.h>
 
 #include <goom/goom.h>
 
@@ -81,6 +82,8 @@ typedef struct
     vlc_thread_t  thread;
     video_format_t fmt;
 
+    picture_pool_t *pool;
+
     vout_thread_t *p_vout;
     int           i_speed;
 
@@ -123,10 +126,19 @@ static int Open( vlc_object_t *p_this )
     p_thread->fmt.i_chroma = VLC_CODEC_RGB32;
     p_thread->fmt.i_sar_num = p_thread->fmt.i_sar_den = 1;
 
+    p_thread->pool = picture_pool_NewFromFormat(&p_thread->fmt, 3);
+    if (unlikely(p_thread->pool == NULL))
+    {
+        msg_Err( p_filter, "no suitable vout module" );
+        free( p_thread );
+        return VLC_EGENERIC;
+    }
+
     p_thread->p_vout = aout_filter_GetVout( p_filter, &p_thread->fmt );
     if( p_thread->p_vout == NULL )
     {
         msg_Err( p_filter, "no suitable vout module" );
+        picture_pool_Release( p_thread->pool );
         free( p_thread );
         return VLC_EGENERIC;
     }
@@ -148,6 +160,7 @@ static int Open( vlc_object_t *p_this )
     {
         msg_Err( p_filter, "cannot launch goom thread" );
         vout_Close( p_thread->p_vout );
+        picture_pool_Release( p_thread->pool );
         free( p_thread );
         return VLC_EGENERIC;
     }
@@ -317,7 +330,7 @@ static void *Thread( void *p_thread_data )
         plane = goom_update( p_plugin_info, p_data, 0, 0.0,
                              NULL, NULL );
 
-        p_pic = vout_GetPicture( p_thread->p_vout );
+        p_pic = picture_pool_Wait( p_thread->pool );
         if( unlikely(p_pic == NULL) )
             continue;
 
@@ -356,6 +369,7 @@ static void Close( vlc_object_t *p_this )
     {
         block_Release( p_thread->pp_blocks[p_thread->i_blocks] );
     }
+    picture_pool_Release( p_thread->pool );
 
     free( p_thread );
 }
-- 
2.26.2



More information about the vlc-devel mailing list