[vlc-commits] x264: fallback to I420 only when there's no profile set
Steve Lhomme
git at videolan.org
Thu Jan 14 13:52:53 UTC 2021
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Jan 12 10:07:02 2021 +0100| [39a5afb346c1e9052da9f1f36c9d4a8c35d63c8d] | committer: Steve Lhomme
x264: fallback to I420 only when there's no profile set
No need to set a value and then resetting it to something else. This way the
i_codec and i_colorspace value is set the consistently in all cases.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=39a5afb346c1e9052da9f1f36c9d4a8c35d63c8d
---
modules/codec/x264.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/modules/codec/x264.c b/modules/codec/x264.c
index fe6c043015..dbb8ea2ddc 100644
--- a/modules/codec/x264.c
+++ b/modules/codec/x264.c
@@ -816,8 +816,6 @@ static int Open ( vlc_object_t *p_this )
fullrange = var_GetBool( p_enc, SOUT_CFG_PREFIX "fullrange" );
fullrange |= p_enc->fmt_in.video.color_range == COLOR_RANGE_FULL;
- p_enc->fmt_in.i_codec = fullrange ? VLC_CODEC_J420 : VLC_CODEC_I420;
- p_sys->i_colorspace = X264_CSP_I420;
char *psz_profile = var_GetString( p_enc, SOUT_CFG_PREFIX "profile" );
# ifdef MODULE_NAME_IS_x26410b
const int mask = X264_CSP_HIGH_DEPTH;
@@ -842,23 +840,29 @@ static int Open ( vlc_object_t *p_this )
p_enc->fmt_in.i_codec = mask ? VLC_CODEC_I444_10L : fullrange ? VLC_CODEC_J444 : VLC_CODEC_I444;
p_sys->i_colorspace = X264_CSP_I444 | mask;
}
-# ifdef MODULE_NAME_IS_x26410b
else
{
+# ifdef MODULE_NAME_IS_x26410b
msg_Err( p_enc, "Only high-profiles and 10-bit are supported");
free( psz_profile );
return VLC_EGENERIC;
- }
+# else // !MODULE_NAME_IS_x26410b
+ p_enc->fmt_in.i_codec = fullrange ? VLC_CODEC_J420 : VLC_CODEC_I420;
+ p_sys->i_colorspace = X264_CSP_I420;
# endif
+ }
+ free( psz_profile );
}
-# ifdef MODULE_NAME_IS_x26410b
else
{
+# ifdef MODULE_NAME_IS_x26410b
msg_Err( p_enc, "Only high-profiles and 10-bit are supported");
return VLC_EGENERIC;
- }
+# else // !MODULE_NAME_IS_x26410b
+ p_enc->fmt_in.i_codec = fullrange ? VLC_CODEC_J420 : VLC_CODEC_I420;
+ p_sys->i_colorspace = X264_CSP_I420;
# endif
- free( psz_profile );
+ }
p_enc->pf_encode_video = Encode;
p_enc->pf_encode_audio = NULL;
More information about the vlc-commits
mailing list