[vlc-devel] [PATCH 6/6] transcode: use transcode_video_size_config_apply to get the encoder input format

Steve Lhomme robux4 at ycbcr.xyz
Thu Jan 14 13:54:28 UTC 2021


Use it via transcode_encoder_video_set_src() which does a bit more.

As opposed to before we set the output dimensions as the ones from the input,
not the other way around.
---
 modules/stream_out/transcode/encoder/video.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/modules/stream_out/transcode/encoder/video.c b/modules/stream_out/transcode/encoder/video.c
index 683d9031af5..cfa4b095049 100644
--- a/modules/stream_out/transcode/encoder/video.c
+++ b/modules/stream_out/transcode/encoder/video.c
@@ -238,16 +238,14 @@ void transcode_encoder_video_configure( vlc_object_t *p_obj,
     p_enc->p_encoder->fmt_out.i_codec = p_enc_out->i_chroma = p_cfg->i_codec;
     p_enc->p_encoder->fmt_out.i_bitrate = p_cfg->video.i_bitrate;
     p_enc_out->i_sar_num = p_enc_out->i_sar_den = 0;
-    if( p_cfg->video.fps.num )
+    transcode_encoder_video_set_src(p_enc->p_encoder, p_src, p_cfg);
+    if (p_enc_in->i_frame_rate && p_enc_in->i_frame_rate_base)
     {
-        p_enc_in->i_frame_rate = p_enc_out->i_frame_rate =
-                p_cfg->video.fps.num;
-        p_enc_in->i_frame_rate_base = p_enc_out->i_frame_rate_base =
-                __MAX(p_cfg->video.fps.den, 1);
+        p_enc_out->i_frame_rate = p_enc_in->i_frame_rate;
+        p_enc_out->i_frame_rate_base = p_enc_in->i_frame_rate_base;
     }
 
     /* Complete source format */
-    p_enc_in->orientation = ORIENT_NORMAL;
     p_enc_out->orientation = p_enc_in->orientation;
 
     p_enc_in->i_chroma = p_enc->p_encoder->fmt_in.i_codec;
@@ -259,13 +257,11 @@ void transcode_encoder_video_configure( vlc_object_t *p_obj,
              p_dec_out->i_frame_rate, p_dec_out->i_frame_rate_base,
              p_enc_in->i_frame_rate, p_enc_in->i_frame_rate_base );
 
-    /* Modify to requested sizes/scale */
-    transcode_video_size_config_apply( p_obj, p_src, p_cfg, p_enc_out );
     /* Propagate sizing to output */
-    p_enc_in->i_width = p_enc_out->i_width;
-    p_enc_in->i_visible_width = p_enc_out->i_visible_width;
-    p_enc_in->i_height = p_enc_out->i_height;
-    p_enc_in->i_visible_height = p_enc_out->i_visible_height;
+    p_enc_out->i_width = p_enc_in->i_width;
+    p_enc_out->i_visible_width = p_enc_in->i_visible_width;
+    p_enc_out->i_height = p_enc_in->i_height;
+    p_enc_out->i_visible_height = p_enc_out->i_visible_height;
 
     transcode_video_sar_apply( p_src, p_enc_out );
     p_enc_in->i_sar_num = p_enc_out->i_sar_num;
-- 
2.29.2



More information about the vlc-devel mailing list