summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-09-11 19:01:20 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-09-11 19:01:20 +0000
commita498ea8eb84e53d6ccf62ae52881f6e259002bbc (patch)
treebfab18c6ed35c37abcb098a03983190470ccaf10
parente409a93e36359f5634a129cb299415022f829c49 (diff)
downloadmpv-a498ea8eb84e53d6ccf62ae52881f6e259002bbc.tar.bz2
mpv-a498ea8eb84e53d6ccf62ae52881f6e259002bbc.tar.xz
Avoid division by zero DEMUXER_CTRL_GET_PERCENT_POS with only one frame by just
returning DONTKNOW. A better formula to calculate position would probably be a better fix though. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@19800 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r--libmpdemux/demux_mf.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libmpdemux/demux_mf.c b/libmpdemux/demux_mf.c
index da49cb4813..39a2dd9ec0 100644
--- a/libmpdemux/demux_mf.c
+++ b/libmpdemux/demux_mf.c
@@ -150,6 +150,8 @@ static int demux_control_mf(demuxer_t *demuxer, int cmd, void *arg) {
return DEMUXER_CTRL_OK;
case DEMUXER_CTRL_GET_PERCENT_POS:
+ if (mf->nr_of_files <= 1)
+ return DEMUXER_CTRL_DONTKNOW;
*((int *)arg) = 100 * mf->curr_frame / (mf->nr_of_files - 1);
return DEMUXER_CTRL_OK;