]> git.sesse.net Git - vlc/commitdiff
transcode: add chroma conversion to be the first filter if needed
authorIlkka Ollakka <ileoo@videolan.org>
Fri, 27 Dec 2013 14:51:18 +0000 (16:51 +0200)
committerIlkka Ollakka <ileoo@videolan.org>
Fri, 27 Dec 2013 15:54:35 +0000 (17:54 +0200)
For example croppadd doesn't like if input and output chromas are not the same.
This is visible for example webcam input and h264 encode (YUV2->I420).

Reported by: Jean-Paul Saman

modules/stream_out/transcode/video.c

index 92f4d8d0cebfaf9bd814483faa3b16094fa73fc7..6716cc715b0d2592c3672755891f10d097814656 100644 (file)
@@ -337,6 +337,13 @@ static void transcode_video_filter_init( sout_stream_t *p_stream,
                            p_stream->p_sys );
         filter_chain_Reset( id->p_uf_chain, p_fmt_out,
                             &id->p_encoder->fmt_in );
+        if( p_fmt_out->video.i_chroma != id->p_encoder->fmt_in.video.i_chroma )
+        {
+            filter_chain_AppendFilter( id->p_uf_chain,
+                                   NULL, NULL,
+                                   p_fmt_out,
+                                   &id->p_encoder->fmt_in );
+        }
         filter_chain_AppendFromString( id->p_uf_chain, p_stream->p_sys->psz_vf2 );
         p_fmt_out = filter_chain_GetFmtOut( id->p_uf_chain );
         es_format_Copy( &id->p_encoder->fmt_in, p_fmt_out );