[FFmpeg-devel] Fix get wrong frame rate with rm/rmvb files
Joakim Plate
elupus
Sat Nov 14 19:07:53 CET 2009
Hi,
Our patch submitter updated the patch in our trac. I'm inlining it here as i'm
posting from gmane. I can't tell if it's valid or not. His comment was "change
the patch to use 32bit pts"
Index: xbmc/cores/dvdplayer/Codecs/ffmpeg/libavformat/rmdec.c
===================================================================
--- xbmc/cores/dvdplayer/Codecs/ffmpeg/libavformat/rmdec.c (revision 24568)
+++ xbmc/cores/dvdplayer/Codecs/ffmpeg/libavformat/rmdec.c (working copy)
@@ -262,7 +262,7 @@
if (rm_read_audio_stream_info(s, pb, st, rst, 0))
return -1;
} else {
- int fps, fps2;
+ int fps, fps2, fps3;
if (get_le32(pb) != MKTAG('V', 'I', 'D', 'O')) {
fail1:
av_log(st->codec, AV_LOG_ERROR, "Unsupported video codec\n");
@@ -278,12 +278,12 @@
goto fail1;
st->codec->width = get_be16(pb);
st->codec->height = get_be16(pb);
- st->codec->time_base.num= 1;
+ st->codec->time_base.num= 1 << 16;
fps= get_be16(pb);
st->codec->codec_type = CODEC_TYPE_VIDEO;
get_be32(pb);
fps2= get_be16(pb);
- get_be16(pb);
+ fps3= get_be16(pb);
st->codec->extradata_size= codec_data_size - (url_ftell(pb) -
codec_pos);
@@ -298,7 +298,7 @@
get_buffer(pb, st->codec->extradata, st->codec->extradata_size);
// av_log(s, AV_LOG_DEBUG, "fps= %d fps2= %d\n", fps, fps2);
- st->codec->time_base.den = fps * st->codec->time_base.num;
+ st->codec->time_base.den = (fps2 << 16) | fps3;
switch(((uint8_t*)st->codec->extradata)[4]>>4){
case 1: st->codec->codec_id = CODEC_ID_RV10; break;
case 2: st->codec->codec_id = CODEC_ID_RV20; break;
More information about the ffmpeg-devel
mailing list