[FFmpeg-cvslog] avformat/paf: read frame rate from header @0x88

Gregory Montoir git at videolan.org
Tue Aug 10 02:14:50 EEST 2021


ffmpeg | branch: master | Gregory Montoir <cyx at users.sourceforge.net> | Fri Feb 22 12:59:04 2019 +0800| [3f92496d9eebea1ecaaf45bad5a6aeb192672fe3] | committer: Paul B Mahol

avformat/paf: read frame rate from header @0x88

Signed-off-by: Gregory Montoir <cyx at users.sourceforge.net>

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

 libavformat/paf.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavformat/paf.c b/libavformat/paf.c
index 2d2d7f8dd8..140e0567e1 100644
--- a/libavformat/paf.c
+++ b/libavformat/paf.c
@@ -94,7 +94,7 @@ static int read_header(AVFormatContext *s)
     PAFDemuxContext *p  = s->priv_data;
     AVIOContext     *pb = s->pb;
     AVStream        *ast, *vst;
-    int ret = 0;
+    int frame_ms, ret = 0;
 
     avio_skip(pb, 132);
 
@@ -106,7 +106,9 @@ static int read_header(AVFormatContext *s)
     vst->nb_frames  =
     vst->duration   =
     p->nb_frames    = avio_rl32(pb);
-    avio_skip(pb, 4);
+    frame_ms        = avio_rl32(pb);
+    if (frame_ms < 1)
+        return AVERROR_INVALIDDATA;
 
     vst->codecpar->width  = avio_rl32(pb);
     vst->codecpar->height = avio_rl32(pb);
@@ -115,7 +117,7 @@ static int read_header(AVFormatContext *s)
     vst->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
     vst->codecpar->codec_tag  = 0;
     vst->codecpar->codec_id   = AV_CODEC_ID_PAF_VIDEO;
-    avpriv_set_pts_info(vst, 64, 1, 10);
+    avpriv_set_pts_info(vst, 64, frame_ms, 1000);
 
     ast = avformat_new_stream(s, 0);
     if (!ast)



More information about the ffmpeg-cvslog mailing list