summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-01-10 00:02:06 +0100
committerwm4 <wm4@nowhere>2014-01-15 20:51:50 +0100
commit635424c8f07c8e08cfedd067bced0c453fb33eef (patch)
treeb6a6514b566c0577bfebfa75bc76076c909db80e
parent2319918721b49864f383708a4948a27d3e2ecf39 (diff)
downloadmpv-635424c8f07c8e08cfedd067bced0c453fb33eef.tar.bz2
mpv-635424c8f07c8e08cfedd067bced0c453fb33eef.tar.xz
demux_lavf: add hack for MicroDVD for assuming frame based timing
MicroDVD files _can_ contain real timestamps instead of frame timestamps if they declare a FPS. But this seems to be rare, so ignore that if the FPS happens to match with the libavformat microdvd parser's default FPS. This might actually break files that declare 23.976 FPS, but the video file is not 23.976 FPS, but the chance that this happens is probably very low, and the commit fixes the more common breakage with 25 FPS video.
-rw-r--r--demux/demux_lavf.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c
index ceef14f4d0..8707a70e3a 100644
--- a/demux/demux_lavf.c
+++ b/demux/demux_lavf.c
@@ -458,6 +458,12 @@ static void handle_stream(demuxer_t *demuxer, int i)
memcpy(sh_sub->extradata, codec->extradata, codec->extradata_size);
sh_sub->extradata_len = codec->extradata_size;
}
+
+ // Hack for MicroDVD: if time_base matches the ffmpeg microdvd reader's
+ // default FPS (23.976), assume the MicroDVD file did not declare a
+ // FPS, and the MicroDVD file uses frame based timing.
+ if (codec->time_base.num == 125 && codec->time_base.den == 2997)
+ sh_sub->frame_based = true;
break;
}
case AVMEDIA_TYPE_ATTACHMENT: {