[vlc-commits] transcode: use the final converter to apply the scaling

Steve Lhomme git at videolan.org
Mon Jan 18 08:08:30 UTC 2021


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Jan 13 14:31:21 2021 +0100| [4c7e81e56b275705f547da30e41e655111f97b80] | committer: Steve Lhomme

transcode: use the final converter to apply the scaling

df0a715f3ffda6e7fb00b9ae6b70b438044db821 assumed the converter would do the
scaling, in addition to codec/chroma converters and orientation. But the code
to do it properly was missing.

We do not update the encoder source format anymore when the static/user filters
are added. The encoder should still encode at the size requested, regardless of
the extra filters. It may however use a different input codec/chroma if this
one wasn't forced.

The converter is always adapting between the decoder output (with the video
context in the picture) and the encoder input.

Fixes #25362

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

 modules/stream_out/transcode/video.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/modules/stream_out/transcode/video.c b/modules/stream_out/transcode/video.c
index db9998630a..1eb26cc292 100644
--- a/modules/stream_out/transcode/video.c
+++ b/modules/stream_out/transcode/video.c
@@ -524,10 +524,12 @@ int transcode_video_process( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
             /* The fmt_in may have been overriden by the encoder. */
             const es_format_t *encoder_fmt_in = transcode_encoder_format_in( id->encoder );
 
-            /* In case the encoder wasn't open yet, check if we need to add
-             * a converter between last user filter and encoder. */
-            if( !is_encoder_open &&
-                filter_fmt_out.i_codec != encoder_fmt_in->i_codec )
+            /* check if we need to add a converter between last user filter and encoder. */
+            if( filter_fmt_out.i_codec != encoder_fmt_in->i_codec ||
+                id->decoder_out.video.i_width  != encoder_fmt_in->video.i_width ||
+                id->decoder_out.video.i_height != encoder_fmt_in->video.i_height ||
+                id->decoder_out.video.i_visible_width  != encoder_fmt_in->video.i_visible_width ||
+                id->decoder_out.video.i_visible_height != encoder_fmt_in->video.i_visible_height )
             {
                 if ( !id->p_final_conv_static )
                     id->p_final_conv_static =
@@ -544,9 +546,8 @@ int transcode_video_process( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
                 }
 
                 filter_chain_Reset( id->p_final_conv_static,
-                                    p_fmt_filtered,
-                                    //encoder_vctx_in,
-                                    NULL,
+                                    &id->decoder_out,
+                                    picture_GetVideoContext(p_pic),
                                     encoder_fmt_in );
                 filter_chain_AppendConverter( id->p_final_conv_static, NULL );
             }



More information about the vlc-commits mailing list