diff mbox series

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

Message ID 20211206131327.14034-1-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel] avformat/vivo: Favor setting fps from explicit fractions
Related show

Checks

Context Check Description
andriy/configurex86 warning Failed to apply patch
andriy/configureppc warning Failed to apply patch

Commit Message

Michael Niedermayer Dec. 6, 2021, 1:13 p.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 8e819d910b7..6126f62f7ba 100644
--- a/libavformat/vivo.c
+++ b/libavformat/vivo.c
@@ -120,7 +120,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;
@@ -211,13 +211,16 @@  static int vivo_read_header(AVFormatContext *s)
                     return AVERROR_INVALIDDATA;
 
                 value_used = 1;
-                fps = av_d2q(1/d, 10000);
+                if (!fps.num && !fps.den)
+                    fps = av_d2q(1/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);