diff mbox series

[FFmpeg-devel,4/4] avformat/vivo: Favor setting fps from explicit fractions

Message ID 20211207081411.16442-4-michael@niedermayer.cc
State Accepted
Commit bf1e93bdc9aaa4fd5c231030b5368aae0df018ee
Headers show
Series [FFmpeg-devel,1/4] avformat/4xm: Consider max_streams on reallocating tracks array | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Michael Niedermayer Dec. 7, 2021, 8:14 a.m. UTC
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/vivo.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/vivo.c b/libavformat/vivo.c
index 6447ec7ee84..2a08e1df033 100644
--- a/libavformat/vivo.c
+++ b/libavformat/vivo.c
@@ -121,7 +121,7 @@  static int vivo_get_packet_header(AVFormatContext *s)
 static int vivo_read_header(AVFormatContext *s)
 {
     VivoContext *vivo = s->priv_data;
-    AVRational fps = { 1, 25};
+    AVRational fps = { 0 };
     AVStream *ast, *vst;
     unsigned char *line, *line_end, *key, *value;
     long value_int;
@@ -212,13 +212,16 @@  static int vivo_read_header(AVFormatContext *s)
                     return AVERROR_INVALIDDATA;
 
                 value_used = 1;
-                fps = av_inv_q(av_d2q(d, 10000));
+                if (!fps.num && !fps.den)
+                    fps = av_inv_q(av_d2q(d, 10000));
             }
 
             if (!value_used)
                 av_dict_set(&s->metadata, key, value, 0);
         }
     }
+    if (!fps.num || !fps.den)
+        fps = (AVRational){ 1, 25 };
 
     avpriv_set_pts_info(ast, 64, 1, ast->codecpar->sample_rate);
     avpriv_set_pts_info(vst, 64, fps.num, fps.den);