[vlc-devel] [PATCH 1/3] deinterlace: add a callback so calls to filter_NewPicture can be overridden

Steve Lhomme robux4 at videolabs.io
Thu Jul 20 11:04:26 CEST 2017


---
 modules/video_filter/deinterlace/common.c | 6 ++++--
 modules/video_filter/deinterlace/common.h | 5 +++++
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/modules/video_filter/deinterlace/common.c b/modules/video_filter/deinterlace/common.c
index ea9c6af464..b1f7e39db3 100644
--- a/modules/video_filter/deinterlace/common.c
+++ b/modules/video_filter/deinterlace/common.c
@@ -50,6 +50,8 @@ void InitDeinterlacingContext( struct deinterlace_ctx *p_context )
                                   cannot have offset) */
     for( int i = 0; i < HISTORY_SIZE; i++ )
         p_context->pp_history[i] = NULL;
+
+    p_context->pf_new_output_picture = filter_NewPicture;
 }
 
 void FlushDeinterlacing(struct deinterlace_ctx *p_context)
@@ -139,7 +141,7 @@ picture_t *DoDeinterlacing( filter_t *p_filter,
     bool b_top_field_first;
 
     /* Request output picture */
-    p_dst[0] = filter_NewPicture( p_filter );
+    p_dst[0] = p_context->pf_new_output_picture( p_filter );
     if( p_dst[0] == NULL )
     {
         picture_Release( p_pic );
@@ -235,7 +237,7 @@ picture_t *DoDeinterlacing( filter_t *p_filter,
         for( int i = 1; i < i_double_rate_alloc_end ; ++i )
         {
             p_dst[i-1]->p_next =
-            p_dst[i]           = filter_NewPicture( p_filter );
+            p_dst[i]           = p_context->pf_new_output_picture( p_filter );
             if( p_dst[i] )
             {
                 picture_CopyProperties( p_dst[i], p_pic );
diff --git a/modules/video_filter/deinterlace/common.h b/modules/video_filter/deinterlace/common.h
index 940a87e2a9..4f46eb293e 100644
--- a/modules/video_filter/deinterlace/common.h
+++ b/modules/video_filter/deinterlace/common.h
@@ -89,6 +89,11 @@ struct deinterlace_ctx
                                  int order, int i_field);
         int (*pf_render_single_pic)(filter_t *, picture_t *p_dst, picture_t *p_pic);
     };
+
+    /**
+     * Callback to override calls to filter_NewPicture()
+     */
+    picture_t *(*pf_new_output_picture)(filter_t *);
 };
 
 #define DEINTERLACE_DST_SIZE 3
-- 
2.12.1



More information about the vlc-devel mailing list