[vlc-commits] avcodec: encoder: split double ternary condition

Alexandre Janniaux git at videolan.org
Mon Jan 25 11:37:38 UTC 2021


vlc | branch: master | Alexandre Janniaux <ajanni at videolabs.io> | Thu Jan 21 15:12:47 2021 +0100| [ca66dbd23ed05c72fad3a3ddaeb208d302e57c48] | committer: Alexandre Janniaux

avcodec: encoder: split double ternary condition

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

 modules/codec/avcodec/encoder.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c
index c5f5a28ee0..15b19a756b 100644
--- a/modules/codec/avcodec/encoder.c
+++ b/modules/codec/avcodec/encoder.c
@@ -238,8 +238,12 @@ static void probe_video_frame_rate( encoder_t *p_enc, AVCodecContext *p_context,
     p_context->time_base.num = p_enc->fmt_in.video.i_frame_rate_base ? p_enc->fmt_in.video.i_frame_rate_base : 1;
 
     // MP4V doesn't like CLOCK_FREQ denominator in time_base, so use 1/25 as default for that
-    p_context->time_base.den = p_enc->fmt_in.video.i_frame_rate_base ? p_enc->fmt_in.video.i_frame_rate :
-                                  ( p_enc->fmt_out.i_codec == VLC_CODEC_MP4V ? 25 : CLOCK_FREQ );
+    if( p_enc->fmt_in.video.i_frame_rate_base )
+        p_context->time_base.den = p_enc->fmt_in.video.i_frame_rate;
+    else if( p_enc->fmt_out.i_codec == VLC_CODEC_MP4V )
+        p_context->time_base.den = 25;
+    else
+        p_context->time_base.den = CLOCK_FREQ;
 
     msg_Dbg( p_enc, "Time base for probing set to %d/%d", p_context->time_base.num, p_context->time_base.den );
     if( p_codec->supported_framerates )



More information about the vlc-commits mailing list