From 3f92496d9eebea1ecaaf45bad5a6aeb192672fe3 Mon Sep 17 00:00:00 2001 From: Gregory Montoir Date: Fri, 22 Feb 2019 12:59:04 +0800 Subject: [PATCH] avformat/paf: read frame rate from header @0x88 Signed-off-by: Gregory Montoir --- 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)