[vlc-devel] [PATCH v1 18/33] mmal: deinterlace: only support push mode in common deinterlacer code

Steve Lhomme robux4 at ycbcr.xyz
Fri Sep 25 16:46:54 CEST 2020


---
 modules/hw/mmal/deinterlace.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/modules/hw/mmal/deinterlace.c b/modules/hw/mmal/deinterlace.c
index 2709a1f1730..8305dc90555 100644
--- a/modules/hw/mmal/deinterlace.c
+++ b/modules/hw/mmal/deinterlace.c
@@ -196,10 +196,9 @@ static unsigned int seq_delta(unsigned int sseq, unsigned int fseq)
     return fseq == 0 ? 0 : fseq <= sseq ? sseq - fseq : 15 - (fseq - sseq);
 }
 
-static picture_t *deinterlace(filter_t * p_filter, picture_t * p_pic)
+static int deinterlace(filter_t * p_filter, picture_t * p_pic, struct vlc_video_sink *sink)
 {
     filter_sys_t * const sys = p_filter->p_sys;
-    picture_t *ret_pics = NULL;
     MMAL_STATUS_T err;
     MMAL_BUFFER_HEADER_T * out_buf = NULL;
 
@@ -262,7 +261,6 @@ static picture_t *deinterlace(filter_t * p_filter, picture_t * p_pic)
     }
 
     // Return anything that is in the out Q
-    picture_t * chain_tail = ret_pics;
 
     // Advanced di has a 3 frame latency, so if the seq delta is greater
     // than that then we are expecting at least two frames of output. Wait
@@ -271,6 +269,7 @@ static picture_t *deinterlace(filter_t * p_filter, picture_t * p_pic)
     // seq_out is last frame we removed from Q
     // So after 4 frames sent (1st time we want to wait), 0 rx seq_in=5, seq_out=15, delta=5
 
+    int res = VLC_EGENERIC;
     while ((out_buf = (seq_delta(sys->seq_in, sys->seq_out) >= 5 ? mmal_queue_timedwait(sys->out_q, 1000) : mmal_queue_get(sys->out_q))) != NULL)
     {
         const unsigned int seq_out = (out_buf->flags / MMAL_BUFFER_HEADER_FLAG_USER0) & 0xf;
@@ -284,7 +283,7 @@ static picture_t *deinterlace(filter_t * p_filter, picture_t * p_pic)
         }
         out_buf = NULL;  // Now attached to pic or recycled
 
-        chain_tail = vlc_picture_chain_Append( &ret_pics, chain_tail, out_pic );
+        res = vlc_video_sink_PutPicture( sink, out_pic );
 
         // Ignore 0 seqs
         // Don't think these should actually happen
@@ -293,15 +292,15 @@ static picture_t *deinterlace(filter_t * p_filter, picture_t * p_pic)
     }
 
     // Crash on lockup
-    assert(ret_pics != NULL || seq_delta(sys->seq_in, sys->seq_out) < 5);
+    assert(res == VLC_SUCCESS || seq_delta(sys->seq_in, sys->seq_out) < 5);
 
-    return ret_pics;
+    return res;
 
 fail:
     if (out_buf != NULL)
         mmal_buffer_header_release(out_buf);
     picture_Release(p_pic);
-    return NULL;
+    return VLC_EGENERIC;
 }
 
 static void di_flush(filter_t *p_filter)
@@ -600,7 +599,7 @@ static int OpenMmalDeinterlace(vlc_object_t *p_this)
         goto fail;
     }
 
-    filter->pf_video_filter = deinterlace;
+    filter->pf_video_filter_into = deinterlace;
     filter->pf_flush = di_flush;
     return 0;
 
-- 
2.26.2



More information about the vlc-devel mailing list