[FFmpeg-devel] [PATCH 03/11] avcodec/evc_parser: export framerate to the AVCodecContext

James Almer jamrial at gmail.com
Thu Jun 15 18:18:27 EEST 2023


Signed-off-by: James Almer <jamrial at gmail.com>
---
 libavcodec/evc_parse.c  | 15 +++++++--------
 libavcodec/evc_parser.c |  1 +
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/libavcodec/evc_parse.c b/libavcodec/evc_parse.c
index f69d7ffb6b..68f0d31f96 100644
--- a/libavcodec/evc_parse.c
+++ b/libavcodec/evc_parse.c
@@ -605,14 +605,13 @@ int ff_evc_parse_nal_unit(EVCParserContext *ctx, const uint8_t *buf, int buf_siz
         if (sps->profile_idc == 1) ctx->profile = FF_PROFILE_EVC_MAIN;
         else ctx->profile = FF_PROFILE_EVC_BASELINE;
 
-        if (sps->vui_parameters_present_flag) {
-            if (sps->vui_parameters.timing_info_present_flag) {
-                int64_t num = sps->vui_parameters.num_units_in_tick;
-                int64_t den = sps->vui_parameters.time_scale;
-                if (num != 0 && den != 0)
-                    av_reduce(&ctx->framerate.den, &ctx->framerate.num, num, den, 1 << 30);
-            }
-        }
+        if (sps->vui_parameters_present_flag && sps->vui_parameters.timing_info_present_flag) {
+            int64_t num = sps->vui_parameters.num_units_in_tick;
+            int64_t den = sps->vui_parameters.time_scale;
+            if (num != 0 && den != 0)
+                av_reduce(&ctx->framerate.den, &ctx->framerate.num, num, den, 1 << 30);
+        } else
+            ctx->framerate = (AVRational) { 0, 1 };
 
         bit_depth = sps->bit_depth_chroma_minus8 + 8;
         ctx->format = AV_PIX_FMT_NONE;
diff --git a/libavcodec/evc_parser.c b/libavcodec/evc_parser.c
index 639dcbd135..5feb673b04 100644
--- a/libavcodec/evc_parser.c
+++ b/libavcodec/evc_parser.c
@@ -71,6 +71,7 @@ static int parse_nal_units(AVCodecParserContext *s, AVCodecContext *avctx, const
 
             s->format              = ctx->format;
 
+            avctx->framerate       = ctx->framerate;
             avctx->gop_size        = ctx->gop_size;
             avctx->delay           = ctx->delay;
             avctx->profile         = ctx->profile;
-- 
2.41.0



More information about the ffmpeg-devel mailing list