summaryrefslogtreecommitdiffstats
path: root/libmpdemux
diff options
context:
space:
mode:
authorUoti Urpala <uau@mplayer2.org>2011-04-08 02:47:02 +0300
committerUoti Urpala <uau@mplayer2.org>2011-04-08 02:47:02 +0300
commit511498818f3372a911ca142ab25f59bbb10d7e3f (patch)
tree21c06c32f6aa7c4a1d30bf05b71294a0b53cc16d /libmpdemux
parentd4b5ee2cd55929f190fe626c6d74697709ae2858 (diff)
downloadmpv-511498818f3372a911ca142ab25f59bbb10d7e3f.tar.bz2
mpv-511498818f3372a911ca142ab25f59bbb10d7e3f.tar.xz
demux_lavf: disable support for byte-based seeking
libavformat returns nonsense per-stream bitrate values for some MPEG files (0 or many times higher than the overall bitrate of the file), which triggered the heuristic to enable byte-based seeking in demux_lavf and then made the byte-based seeks wildly inaccurate. Disable the support for byte-based seeks. This will avoid problems with files that have consistent timestamps, but on the other hand will completely break seeking in MPEG files that have timestamp resets. I'll probably add at least an option to manually enable byte-based seeking later.
Diffstat (limited to 'libmpdemux')
-rw-r--r--libmpdemux/demux_lavf.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libmpdemux/demux_lavf.c b/libmpdemux/demux_lavf.c
index ed8a3ddb69..3aca4b603c 100644
--- a/libmpdemux/demux_lavf.c
+++ b/libmpdemux/demux_lavf.c
@@ -615,6 +615,9 @@ static demuxer_t* demux_open_lavf(demuxer_t *demuxer){
demuxer->video->id=-2; // audio-only
} //else if (best_video > 0 && demuxer->video->id == -1) demuxer->video->id = best_video;
+ // disabled because unreliable per-stream bitrate values returned
+ // by libavformat trigger this heuristic incorrectly and break things
+#if 0
/* libavformat sets bitrate for mpeg based on pts at start and end
* of file, which fails for files with pts resets. So calculate our
* own bitrate estimate. */
@@ -630,6 +633,7 @@ static demuxer_t* demux_open_lavf(demuxer_t *demuxer){
if (!priv->bitrate)
priv->bitrate = 1440000;
}
+#endif
demuxer->accurate_seek = !priv->seek_by_bytes;
return demuxer;