[vlc-devel] [PATCH 4/6] transcode: use the transcoder config to setup the test input format

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


Don't use previously set values on the output format which have no good
significance. The format requested by the user is the combination of source
format + user configuration.

Set better encoder fmt_out values that the user configuration (which may be 0).
---
 modules/stream_out/transcode/encoder/video.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/modules/stream_out/transcode/encoder/video.c b/modules/stream_out/transcode/encoder/video.c
index d2513c68c43..2ba109a1af0 100644
--- a/modules/stream_out/transcode/encoder/video.c
+++ b/modules/stream_out/transcode/encoder/video.c
@@ -301,23 +301,19 @@ int transcode_encoder_video_test( encoder_t *p_encoder,
     video_format_t *p_vfmt_out = &p_encoder->fmt_out.video;
 
     /* Requested output */
-    p_vfmt_out->i_width = p_cfg->video.i_width & ~1;
-    p_vfmt_out->i_height = p_cfg->video.i_height & ~1;
     p_encoder->fmt_out.i_bitrate = p_cfg->video.i_bitrate;
 
     /* The dimensions will be set properly later on.
      * Just put sensible values so we can test an encoder is available. */
     /* Input */
     p_vfmt_in->i_chroma = i_codec_in;
-    p_vfmt_in->i_width = FIRSTVALID( p_vfmt_out->i_width, p_dec_in->i_width, 16 ) & ~1;
-    p_vfmt_in->i_height = FIRSTVALID( p_vfmt_out->i_height, p_dec_in->i_height, 16 ) & ~1;
-    p_vfmt_in->i_visible_width = FIRSTVALID( p_vfmt_out->i_visible_width,
-                                             p_dec_in->i_visible_width, p_vfmt_in->i_width ) & ~1;
-    p_vfmt_in->i_visible_height = FIRSTVALID( p_vfmt_out->i_visible_height,
-                                              p_dec_in->i_visible_height, p_vfmt_in->i_height ) & ~1;
+    transcode_video_size_config_apply(VLC_OBJECT(p_encoder), p_dec_in, p_cfg, p_vfmt_in);
     p_vfmt_in->i_frame_rate = ENC_FRAMERATE;
     p_vfmt_in->i_frame_rate_base = ENC_FRAMERATE_BASE;
 
+    p_vfmt_out->i_width  = p_vfmt_in->i_width & ~1;
+    p_vfmt_out->i_height = p_vfmt_in->i_height & ~1;
+
     module_t *p_module = module_need( p_encoder, "encoder", p_cfg->psz_name, true );
     if( !p_module )
     {
-- 
2.29.2



More information about the vlc-devel mailing list