summaryrefslogtreecommitdiff
path: root/libavformat/rmdec.c
diff options
context:
space:
mode:
authorKostya Shishkov <kostya.shishkov@gmail.com>2011-08-16 09:10:57 +0200
committerAnton Khirnov <anton@khirnov.net>2011-08-17 15:00:42 +0200
commita43b1e74e2abaac6e63eb001474855bd44335988 (patch)
treec3d659074d4ae9fe68fca1110b84cccb19dc2ee0 /libavformat/rmdec.c
parent48ce8b8da714558c8738610d5512b6c3c95c901a (diff)
rmdec: parse FPS in RealMedia properly
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'libavformat/rmdec.c')
-rw-r--r--libavformat/rmdec.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c
index cf5c46a095..7cf5720fe0 100644
--- a/libavformat/rmdec.c
+++ b/libavformat/rmdec.c
@@ -293,21 +293,21 @@ ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVIOContext *pb,
// av_log(s, AV_LOG_DEBUG, "%X %X\n", st->codec->codec_tag, MKTAG('R', 'V', '2', '0'));
if (st->codec->codec_id == CODEC_ID_NONE)
goto fail1;
- st->codec->width = avio_rb16(pb);
+ st->codec->width = avio_rb16(pb);
st->codec->height = avio_rb16(pb);
- st->codec->time_base.num= 1;
- fps= avio_rb16(pb);
+ avio_skip(pb, 2); // looks like bits per sample
+ avio_skip(pb, 4); // always zero?
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->need_parsing = AVSTREAM_PARSE_TIMESTAMPS;
- avio_rb32(pb);
- avio_skip(pb, 2);
- avio_rb16(pb);
+ fps = avio_rb32(pb);
if ((ret = rm_read_extradata(pb, st->codec, codec_data_size - (avio_tell(pb) - codec_pos))) < 0)
return ret;
-// av_log(s, AV_LOG_DEBUG, "fps= %d fps2= %d\n", fps, fps2);
- st->codec->time_base.den = fps * st->codec->time_base.num;
+ av_reduce(&st->codec->time_base.num, &st->codec->time_base.den,
+ 0x10000, fps, (1 << 30) - 1);
+ st->avg_frame_rate.num = st->codec->time_base.den;
+ st->avg_frame_rate.den = st->codec->time_base.num;
}
skip: