[vlc-commits] Make the video transcoder support filter chains that output multiple frames

Steinar H. Gunderson git at videolan.org
Tue Jun 11 21:05:43 CEST 2013


vlc | branch: master | Steinar H. Gunderson <steinar+vlc at gunderson.no> | Sat Jun  8 23:01:12 2013 +0200| [48851707f9d3c4fb991d47ee26a5dc9d6aaa65eb] | committer: Rémi Denis-Courmont

Make the video transcoder support filter chains that output multiple frames

In the video transcoder, call the filters as many times as needed
(second and following time with NULL input) until they stop outputting
frames. This means that frame-doubling filters, such as the yadif2x
deinterlacer, get all their frames output.

Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=48851707f9d3c4fb991d47ee26a5dc9d6aaa65eb
---

 modules/stream_out/transcode/video.c |   43 ++++++++++++++++++++++++----------
 1 file changed, 30 insertions(+), 13 deletions(-)

diff --git a/modules/stream_out/transcode/video.c b/modules/stream_out/transcode/video.c
index 346bedd..7807cf8 100644
--- a/modules/stream_out/transcode/video.c
+++ b/modules/stream_out/transcode/video.c
@@ -803,19 +803,36 @@ int transcode_video_process( sout_stream_t *p_stream, sout_stream_id_t *id,
             }
         }
 
-        /* Run filter chain */
-        if( id->p_f_chain )
-            p_pic = filter_chain_VideoFilter( id->p_f_chain, p_pic );
-        if( !p_pic )
-            continue;
-
-        /* Run user specified filter chain */
-        if( id->p_uf_chain )
-            p_pic = filter_chain_VideoFilter( id->p_uf_chain, p_pic );
-        if( !p_pic )
-            continue;
-
-        OutputFrame( p_sys, p_pic, b_need_duplicate, p_stream, id, out );
+        /* Run the filter and output chains; first with the picture,
+         * and then with NULL as many times as we need until they
+         * stop outputting frames.
+         */
+        for ( ;; ) {
+            picture_t *p_filtered_pic = p_pic;
+
+            /* Run filter chain */
+            if( id->p_f_chain )
+                p_filtered_pic = filter_chain_VideoFilter( id->p_f_chain, p_filtered_pic );
+            if( !p_filtered_pic )
+                break;
+
+            for ( ;; ) {
+                picture_t *p_user_filtered_pic = p_filtered_pic;
+
+                /* Run user specified filter chain */
+                if( id->p_uf_chain )
+                    p_user_filtered_pic = filter_chain_VideoFilter( id->p_uf_chain, p_user_filtered_pic );
+                if( !p_user_filtered_pic )
+                    break;
+
+                OutputFrame( p_sys, p_user_filtered_pic, b_need_duplicate, p_stream, id, out );
+                b_need_duplicate = false;
+
+                p_filtered_pic = NULL;
+            }
+
+            p_pic = NULL;
+        }
     }
 
     if( p_sys->i_threads >= 1 )



More information about the vlc-commits mailing list