]> git.sesse.net Git - vlc/commitdiff
Make the video transcoder support filter chains that output multiple frames
authorSteinar H. Gunderson <steinar+vlc@gunderson.no>
Sat, 8 Jun 2013 21:01:12 +0000 (23:01 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Tue, 11 Jun 2013 19:03:11 +0000 (22:03 +0300)
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@remlab.net>
modules/stream_out/transcode/video.c

index 346bedd9e3f7a87aa95d4675b2e2785686f294e6..7807cf813c7461bdba24ef47b6f7efa9e4c9ffc1 100644 (file)
@@ -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 )