[FFmpeg-devel] [PATCH] lavc/libdav1d: fix exporting framerate

Anton Khirnov anton at khirnov.net
Mon May 15 11:22:54 EEST 2023


Same issues as in the previous commit.
---
Updated for changes in previous patch.
---
 libavcodec/Makefile   |  2 +-
 libavcodec/libdav1d.c | 10 ++++------
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 9587e56493..4d59411662 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -1086,7 +1086,7 @@ OBJS-$(CONFIG_LIBARIBCAPTION_DECODER)     += libaribcaption.o ass.o
 OBJS-$(CONFIG_LIBCELT_DECODER)            += libcelt_dec.o
 OBJS-$(CONFIG_LIBCODEC2_DECODER)          += libcodec2.o
 OBJS-$(CONFIG_LIBCODEC2_ENCODER)          += libcodec2.o
-OBJS-$(CONFIG_LIBDAV1D_DECODER)           += libdav1d.o
+OBJS-$(CONFIG_LIBDAV1D_DECODER)           += libdav1d.o av1_parse.o
 OBJS-$(CONFIG_LIBDAVS2_DECODER)           += libdavs2.o
 OBJS-$(CONFIG_LIBFDK_AAC_DECODER)         += libfdk-aacdec.o
 OBJS-$(CONFIG_LIBFDK_AAC_ENCODER)         += libfdk-aacenc.o
diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c
index af072da681..0320ae7c6c 100644
--- a/libavcodec/libdav1d.c
+++ b/libavcodec/libdav1d.c
@@ -30,6 +30,7 @@
 #include "libavutil/opt.h"
 
 #include "atsc_a53.h"
+#include "av1_parse.h"
 #include "avcodec.h"
 #include "bytestream.h"
 #include "codec_internal.h"
@@ -154,12 +155,9 @@ static void libdav1d_init_params(AVCodecContext *c, const Dav1dSequenceHeader *s
     else
         c->pix_fmt = pix_fmt[seq->layout][seq->hbd];
 
-    if (seq->num_units_in_tick && seq->time_scale) {
-        av_reduce(&c->framerate.den, &c->framerate.num,
-                  seq->num_units_in_tick, seq->time_scale, INT_MAX);
-        if (seq->equal_picture_interval)
-            c->ticks_per_frame = seq->num_ticks_per_picture;
-    }
+    c->framerate = ff_av1_framerate(seq->num_ticks_per_picture,
+                                    seq->num_units_in_tick,
+                                    seq->time_scale);
 
    if (seq->film_grain_present)
        c->properties |= FF_CODEC_PROPERTY_FILM_GRAIN;
-- 
2.39.2



More information about the ffmpeg-devel mailing list