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

Michael Niedermayer git at videolan.org
Fri Apr 8 01:31:11 EEST 2022


ffmpeg | branch: release/4.2 | Michael Niedermayer <michael at niedermayer.cc> | Mon Dec  6 11:38:39 2021 +0100| [a962cda7fd5da6e95e10f6b53eac0d28dc079e34] | committer: Michael Niedermayer

avformat/vivo: Favor setting fps from explicit fractions

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit bf1e93bdc9aaa4fd5c231030b5368aae0df018ee)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavformat/vivo.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavformat/vivo.c b/libavformat/vivo.c
index 09b593feb4..6119e52de8 100644
--- a/libavformat/vivo.c
+++ b/libavformat/vivo.c
@@ -119,7 +119,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;
@@ -210,13 +210,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);



More information about the ffmpeg-cvslog mailing list